Commit 19b84f3c35d7c8e9d4743cdeb93534f7640001e1
1 parent
08fc6089
added setgroups and getgroups syscalls
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@131 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
28 additions
and
2 deletions
linux-user/syscall.c
| ... | ... | @@ -58,6 +58,7 @@ |
| 58 | 58 | #include <linux/hdreg.h> |
| 59 | 59 | #include <linux/soundcard.h> |
| 60 | 60 | #include <linux/dirent.h> |
| 61 | +#include <linux/kd.h> | |
| 61 | 62 | |
| 62 | 63 | #include "qemu.h" |
| 63 | 64 | |
| ... | ... | @@ -117,6 +118,7 @@ extern int setresuid(uid_t, uid_t, uid_t); |
| 117 | 118 | extern int getresuid(uid_t *, uid_t *, uid_t *); |
| 118 | 119 | extern int setresgid(gid_t, gid_t, gid_t); |
| 119 | 120 | extern int getresgid(gid_t *, gid_t *, gid_t *); |
| 121 | +extern int setgroups(int, gid_t *); | |
| 120 | 122 | |
| 121 | 123 | static inline long get_errno(long ret) |
| 122 | 124 | { |
| ... | ... | @@ -1722,9 +1724,33 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
| 1722 | 1724 | } |
| 1723 | 1725 | break; |
| 1724 | 1726 | case TARGET_NR_getgroups: |
| 1725 | - goto unimplemented; | |
| 1727 | + { | |
| 1728 | + int gidsetsize = arg1; | |
| 1729 | + uint16_t *target_grouplist = (void *)arg2; | |
| 1730 | + gid_t *grouplist; | |
| 1731 | + int i; | |
| 1732 | + | |
| 1733 | + grouplist = alloca(gidsetsize * sizeof(gid_t)); | |
| 1734 | + ret = get_errno(getgroups(gidsetsize, grouplist)); | |
| 1735 | + if (!is_error(ret)) { | |
| 1736 | + for(i = 0;i < gidsetsize; i++) | |
| 1737 | + target_grouplist[i] = tswap16(grouplist[i]); | |
| 1738 | + } | |
| 1739 | + } | |
| 1740 | + break; | |
| 1726 | 1741 | case TARGET_NR_setgroups: |
| 1727 | - goto unimplemented; | |
| 1742 | + { | |
| 1743 | + int gidsetsize = arg1; | |
| 1744 | + uint16_t *target_grouplist = (void *)arg2; | |
| 1745 | + gid_t *grouplist; | |
| 1746 | + int i; | |
| 1747 | + | |
| 1748 | + grouplist = alloca(gidsetsize * sizeof(gid_t)); | |
| 1749 | + for(i = 0;i < gidsetsize; i++) | |
| 1750 | + grouplist[i] = tswap16(target_grouplist[i]); | |
| 1751 | + ret = get_errno(setgroups(gidsetsize, grouplist)); | |
| 1752 | + } | |
| 1753 | + break; | |
| 1728 | 1754 | case TARGET_NR_select: |
| 1729 | 1755 | goto unimplemented; |
| 1730 | 1756 | case TARGET_NR_symlink: | ... | ... |