bug-glibc
[Top][All Lists]
Advanced

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

Incorrect prototype for sched_setaffinity/sched_getaffinity


From: Rusty Russell
Subject: Incorrect prototype for sched_setaffinity/sched_getaffinity
Date: Thu, 08 May 2003 17:23:22 +1000

You cannot hand the setaffinity or getaffinity system calls a smaller
mask than sizeof(unsigned long) inside the kernel -- in general, this
is impossible for userspace to know.  And this minimum size may get
larger in future kernels.

Linus' recommendation is to use fd_set, pushing the problem back to
when we run on 1024-CPU machines, ie. the prototype should be (from
/usr/include/sched.h):

#ifdef __USE_GNU
/* Set the CPU affinity for a task */
extern int sched_setaffinity (__pid_t __pid, unsigned long int __len,
                              struct fd_set *__mask) __THROW;

/* Get the CPU affinity for a task */
extern int sched_getaffinity (__pid_t __pid, unsigned long int __len,
                              struct fd_set *__mask) __THROW;
#endif

Or even omit the __len arg in the interface.

Thanks!
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.




reply via email to

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