mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
Add some basic setgroups(), getgroups() and initgroups().
Also teach /bin/id to print the user's supplemental groups.
This commit is contained in:
parent
d3bd3791cb
commit
a7f1d892a9
12 changed files with 167 additions and 19 deletions
|
@ -3,6 +3,9 @@
|
|||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
|
||||
extern "C" {
|
||||
|
@ -218,4 +221,16 @@ int dup2(int old_fd, int new_fd)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int setgroups(size_t size, const gid_t* list)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_getgroups, (dword)size, (dword)list);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int getgroups(int size, gid_t list[])
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_getgroups, (dword)size, (dword)list);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue