libc: Add setuid, setgid, seteuid, setegid
This commit is contained in:
parent
09a615bd99
commit
8f0e358360
@ -50,6 +50,18 @@ extern "C"
|
||||
/* Returns the current process' effective group ID. */
|
||||
gid_t getegid(void);
|
||||
|
||||
/* Sets the current process' real and effective user IDs. */
|
||||
int setuid(uid_t uid);
|
||||
|
||||
/* Sets the current process' effective user ID. */
|
||||
int seteuid(uid_t uid);
|
||||
|
||||
/* Sets the current process' real and effective group IDs. */
|
||||
int setgid(gid_t gid);
|
||||
|
||||
/* Sets the current process' effective group ID. */
|
||||
int setegid(gid_t gid);
|
||||
|
||||
/* Terminates the program with the status code status. */
|
||||
__lc_noreturn void _exit(int status);
|
||||
|
||||
|
@ -58,6 +58,26 @@ extern "C"
|
||||
return (gid_t)getprocid(ID_EGID);
|
||||
}
|
||||
|
||||
int setuid(uid_t uid)
|
||||
{
|
||||
return (int)__lc_fast_syscall2(SYS_setuid, uid, uid);
|
||||
}
|
||||
|
||||
int seteuid(uid_t uid)
|
||||
{
|
||||
return (int)__lc_fast_syscall2(SYS_setuid, getprocid(ID_UID), uid);
|
||||
}
|
||||
|
||||
int setgid(gid_t gid)
|
||||
{
|
||||
return (int)__lc_fast_syscall2(SYS_setgid, gid, gid);
|
||||
}
|
||||
|
||||
int setegid(gid_t gid)
|
||||
{
|
||||
return (int)__lc_fast_syscall2(SYS_setgid, getprocid(ID_GID), gid);
|
||||
}
|
||||
|
||||
unsigned int sleep(unsigned int seconds)
|
||||
{
|
||||
return msleep(seconds * 1000);
|
||||
|
Loading…
Reference in New Issue
Block a user