This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

INTERNAL_SYSCALL and function calls in arguments


Hi,

sched_setaffinity has the following code:

INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid(), psize, p)


On AMD64, the INTERNAL_SYSCALL macro does not work if you make a
function call as argument. As result, the sched_getaffinity syscall
will always fail.

Is this a bug in the macro, or is the usage wrong at this place? As
far as I can see, this is the only place where we use such a
construct.

  Thorsten


2004-04-09  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/unix/sysv/linux/sched_setaffinity.c: Don't pass function
	call as argument to INTERNAL_SYSCALL.

--- ./sysdeps/unix/sysv/linux/sched_setaffinity.c	29 Mar 2004 21:59:17 -0000	1.4
+++ ./sysdeps/unix/sysv/linux/sched_setaffinity.c	9 Apr 2004 07:11:15 -0000
@@ -40,8 +40,9 @@
 
       size_t psize = 128;
       void *p = alloca (psize);
+      pid_t mypid = getpid ();
 
-      while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (),
+      while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, mypid,
 				     psize, p),
 	     INTERNAL_SYSCALL_ERROR_P (res, err)
 	     && INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]