File uClibc.ia64-use-sched_setaffinity-if-present.patch of Package uClibc

Subject: make use of sched_setaffinity if available

From: Stefan Assmann <sassmann@suse.de>


The current implementation relies on the fact that INTERNAL_SYSCALL is defined
for syscall sched_setaffinity. Otherwise the syscall will be treated as
non-existant even if it is implemented. This patch adds a check whether the
syscall is available if INTERNAL_SYSCALL is not defined. This was necessary to
get sched_setaffinity working on ia64.

Signed-off-by: Stefan Assmann <sassmann@suse.de>
---
 libc/sysdeps/linux/common/sched_setaffinity.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/libc/sysdeps/linux/common/sched_setaffinity.c
+++ b/libc/sysdeps/linux/common/sched_setaffinity.c
@@ -78,9 +78,17 @@ int sched_setaffinity(pid_t pid, size_t
 #define ___HAVE_NO_sched_setaffinity
 #endif
 #else
+
+#ifdef __NR_sched_setaffinity
+#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
+_syscall3(int, sched_setaffinity, __pid_t, pid, size_t,
+		cpusetsize, __const cpu_set_t *, cpuset)
+#else
 #define ___HAVE_NO_sched_setaffinity
 #endif
 
+#endif
+
 #if defined ___HAVE_NO_sched_setaffinity && defined __UCLIBC_HAS_STUBS__
 int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
 {
openSUSE Build Service is sponsored by