qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [5267] Swap only altered elements of the grouplist in getgr


From: Andrzej Zaborowski
Subject: [Qemu-devel] [5267] Swap only altered elements of the grouplist in getgroups() ( Kirill Shutemov).
Date: Sat, 20 Sep 2008 02:12:08 +0000

Revision: 5267
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5267
Author:   balrog
Date:     2008-09-20 02:12:08 +0000 (Sat, 20 Sep 2008)

Log Message:
-----------
Swap only altered elements of the grouplist in getgroups() (Kirill Shutemov).

getgroups() returns the number of supplementary group IDs, so it's
unnessary to swap the entire array.  It can dramatically speed up
the syscall: on recent Linux kernels NGROUPS_MAX=65536.

Signed-off-by: Kirill A. Shutemov <address@hidden>

Modified Paths:
--------------
    trunk/linux-user/syscall.c

Modified: trunk/linux-user/syscall.c
===================================================================
--- trunk/linux-user/syscall.c  2008-09-20 02:08:13 UTC (rev 5266)
+++ trunk/linux-user/syscall.c  2008-09-20 02:12:08 UTC (rev 5267)
@@ -5253,7 +5253,7 @@
                 target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 
2, 0);
                 if (!target_grouplist)
                     goto efault;
-                for(i = 0;i < gidsetsize; i++)
+                for(i = 0;i < ret; i++)
                     target_grouplist[i] = tswap16(grouplist[i]);
                 unlock_user(target_grouplist, arg2, gidsetsize * 2);
             }
@@ -5407,7 +5407,7 @@
                     ret = -TARGET_EFAULT;
                     goto fail;
                 }
-                for(i = 0;i < gidsetsize; i++)
+                for(i = 0;i < ret; i++)
                     target_grouplist[i] = tswap32(grouplist[i]);
                 unlock_user(target_grouplist, arg2, gidsetsize * 4);
             }






reply via email to

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