mirror of https://github.com/xemu-project/xemu.git
added setgroups and getgroups syscalls
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@131 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
08fc60898b
commit
19b84f3c35
|
@ -58,6 +58,7 @@
|
||||||
#include <linux/hdreg.h>
|
#include <linux/hdreg.h>
|
||||||
#include <linux/soundcard.h>
|
#include <linux/soundcard.h>
|
||||||
#include <linux/dirent.h>
|
#include <linux/dirent.h>
|
||||||
|
#include <linux/kd.h>
|
||||||
|
|
||||||
#include "qemu.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 getresuid(uid_t *, uid_t *, uid_t *);
|
||||||
extern int setresgid(gid_t, gid_t, gid_t);
|
extern int setresgid(gid_t, gid_t, gid_t);
|
||||||
extern int getresgid(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)
|
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;
|
break;
|
||||||
case TARGET_NR_getgroups:
|
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:
|
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:
|
case TARGET_NR_select:
|
||||||
goto unimplemented;
|
goto unimplemented;
|
||||||
case TARGET_NR_symlink:
|
case TARGET_NR_symlink:
|
||||||
|
|
Loading…
Reference in New Issue