aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-08 15:41:49 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-08 15:41:49 +0000
commit19b84f3c35d7c8e9d4743cdeb93534f7640001e1 (patch)
treeede0426077208d1e07fed0cc3d9802e9f87c51a9 /linux-user
parent08fc60898b2dba14f81fd8b7e5143c4d672a2c2c (diff)
added setgroups and getgroups syscalls
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@131 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7561ed1613..3f6084d055 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -58,6 +58,7 @@
#include <linux/hdreg.h>
#include <linux/soundcard.h>
#include <linux/dirent.h>
+#include <linux/kd.h>
#include "qemu.h"
@@ -117,6 +118,7 @@ extern int setresuid(uid_t, uid_t, uid_t);
extern int getresuid(uid_t *, uid_t *, uid_t *);
extern int setresgid(gid_t, gid_t, gid_t);
extern int getresgid(gid_t *, gid_t *, gid_t *);
+extern int setgroups(int, gid_t *);
static inline long get_errno(long ret)
{
@@ -1722,9 +1724,33 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
}
break;
case TARGET_NR_getgroups:
- goto unimplemented;
+ {
+ int gidsetsize = arg1;
+ uint16_t *target_grouplist = (void *)arg2;
+ gid_t *grouplist;
+ int i;
+
+ grouplist = alloca(gidsetsize * sizeof(gid_t));
+ ret = get_errno(getgroups(gidsetsize, grouplist));
+ if (!is_error(ret)) {
+ for(i = 0;i < gidsetsize; i++)
+ target_grouplist[i] = tswap16(grouplist[i]);
+ }
+ }
+ break;
case TARGET_NR_setgroups:
- goto unimplemented;
+ {
+ int gidsetsize = arg1;
+ uint16_t *target_grouplist = (void *)arg2;
+ gid_t *grouplist;
+ int i;
+
+ grouplist = alloca(gidsetsize * sizeof(gid_t));
+ for(i = 0;i < gidsetsize; i++)
+ grouplist[i] = tswap16(target_grouplist[i]);
+ ret = get_errno(setgroups(gidsetsize, grouplist));
+ }
+ break;
case TARGET_NR_select:
goto unimplemented;
case TARGET_NR_symlink: