qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] {get,set}groups32 syscalls


From: Paul Brook
Subject: [Qemu-devel] {get,set}groups32 syscalls
Date: Mon, 31 Jan 2005 04:01:44 +0000
User-agent: KMail/1.7.2

The attached patch implements the getgroups32 and setgroups32 syscalls.

Paul

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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]