qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] getpriority() shouldn't use libc wrapper
Date: Wed, 26 Sep 2007 14:06:08 -0600	[thread overview]
Message-ID: <1190837168.13060.10.camel@phantasm.home.enterpriseandprosperity.com> (raw)

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

The linux-user getpriority() syscall goes through the libc wrapper.
This causes a problem because the libc wrapper remaps the return value
from the kernel.  This patch calls the kernel getpriority syscall
directly.


[-- Attachment #2: 47_getpriority.patch --]
[-- Type: text/x-patch, Size: 1394 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-26 13:13:40.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-26 14:10:29.000000000 -0600
@@ -174,6 +174,7 @@
 #define __NR_sys_getcwd1 __NR_getcwd
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
+#define __NR_sys_getpriority __NR_getpriority
 #define __NR_sys_linkat __NR_linkat
 #define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_mknodat __NR_mknodat
@@ -229,6 +230,7 @@
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
 _syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
 #endif
+_syscall2(int, sys_getpriority, int, which, int, who);
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
 #if defined(TARGET_NR_linkat) && defined(__NR_linkat)
@@ -4010,7 +4012,10 @@
         break;
 #endif
     case TARGET_NR_getpriority:
-        ret = get_errno(getpriority(arg1, arg2));
+        /* libc does special remapping of the return value of
+         * sys_getpriority() so it's just easiest to call
+         * sys_getpriority() directly rather than through libc. */
+        ret = sys_getpriority(arg1, arg2);
         break;
     case TARGET_NR_setpriority:
         ret = get_errno(setpriority(arg1, arg2, arg3));

             reply	other threads:[~2007-09-26 20:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 20:06 Thayne Harbaugh [this message]
2007-10-02  5:30 ` [Qemu-devel] [PATCH] getpriority() shouldn't use libc wrapper Thayne Harbaugh

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=1190837168.13060.10.camel@phantasm.home.enterpriseandprosperity.com \
    --to=thayne@c2.net \
    --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).