qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] {get,set}groups32 syscalls
@ 2005-01-31  4:01 Paul Brook
  0 siblings, 0 replies; only message in thread
From: Paul Brook @ 2005-01-31  4:01 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 79 bytes --]

The attached patch implements the getgroups32 and setgroups32 syscalls.

Paul


[-- Attachment #2: patch.qemu_groups32 --]
[-- Type: text/x-diff, Size: 1545 bytes --]

Index: linux-user/syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.55
diff -u -p -r1.55 syscall.c
--- linux-user/syscall.c	3 Jan 2005 23:31:27 -0000	1.55
+++ linux-user/syscall.c	31 Jan 2005 03:51:03 -0000
@@ -2916,9 +2916,33 @@ long do_syscall(void *cpu_env, int num, 
         ret = get_errno(setregid(arg1, arg2));
         break;
     case TARGET_NR_getgroups32:
-        goto unimplemented;
+        {
+            int gidsetsize = arg1;
+            uint32_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] = tswap32(grouplist[i]);
+            }
+        }
+        break;
     case TARGET_NR_setgroups32:
-        goto unimplemented;
+        {
+            int gidsetsize = arg1;
+            uint32_t *target_grouplist = (void *)arg2;
+            gid_t *grouplist;
+            int i;
+
+            grouplist = alloca(gidsetsize * sizeof(gid_t));
+            for(i = 0;i < gidsetsize; i++)
+                grouplist[i] = tswap32(target_grouplist[i]);
+            ret = get_errno(setgroups(gidsetsize, grouplist));
+        }
+        break;
     case TARGET_NR_fchown32:
         ret = get_errno(fchown(arg1, arg2, arg3));
         break;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-31  4:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-31  4:01 [Qemu-devel] {get,set}groups32 syscalls Paul Brook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).