add setresuid/setresgid functions (nonstandard)

This commit is contained in:
Rich Felker 2011-04-03 16:20:57 -04:00
parent 7fd3995282
commit 1db283bf19
3 changed files with 22 additions and 0 deletions

View File

@ -154,6 +154,8 @@ int sethostname(const char *, size_t);
int usleep(unsigned);
unsigned ualarm(unsigned, unsigned);
int setgroups(int, const gid_t []);
int setresuid(uid_t, uid_t, uid_t);
int setresgid(gid_t, gid_t, gid_t);
#endif
#define _XOPEN_VERSION 700

10
src/unistd/setresgid.c Normal file
View File

@ -0,0 +1,10 @@
#define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
#include "libc.h"
int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
{
if (libc.rsyscall) return libc.rsyscall(__NR_setresgid, rgid, egid, sgid, 0, 0, 0);
return syscall(SYS_setresgid, rgid, egid, sgid);
}

10
src/unistd/setresuid.c Normal file
View File

@ -0,0 +1,10 @@
#define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
#include "libc.h"
int setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
if (libc.rsyscall) return libc.rsyscall(__NR_setresuid, ruid, euid, suid, 0, 0, 0);
return syscall(SYS_setresuid, ruid, euid, suid);
}