qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <k.shutemov@velesys.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] syscall getgroups() optimization
Date: Tue, 26 Jun 2007 00:05:11 +0300	[thread overview]
Message-ID: <20070625210511.GA11900@localhost.localdomain> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 283 bytes --]

On success, getgroups() returns the number of supplementary group IDs. So, 
we can swap real number group IDs.

Patch in the attachment.

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + Velesys LLC, http://www.velesys.com/
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #1.2: qemu-0.9.0-alt-getgroups.patch --]
[-- Type: text/plain, Size: 996 bytes --]

--- qemu/linux-user/syscall.c	2007-05-08 12:42:50 +0300
+++ qemu-0.9.0.cvs20070420/linux-user/syscall.c	2007-05-20 21:13:06 +0300
@@ -3741,7 +4144,7 @@
             ret = get_errno(getgroups(gidsetsize, grouplist));
             if (!is_error(ret)) {
                 target_grouplist = lock_user(arg2, gidsetsize * 2, 0);
-                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);
             }
@@ -3873,7 +4276,7 @@
             ret = get_errno(getgroups(gidsetsize, grouplist));
             if (!is_error(ret)) {
                 target_grouplist = lock_user(arg2, gidsetsize * 4, 0);
-                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);
             }

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2007-06-25 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 21:05 Kirill A. Shutemov [this message]
2007-06-29 21:07 ` [Qemu-devel] [PATCH] syscall getgroups() optimization Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070625210511.GA11900@localhost.localdomain \
    --to=k.shutemov@velesys.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).