[PATCH] make use of sched_setaffinity if available
Stefan Assmann
sassmann at suse.de
Tue Dec 16 10:04:49 UTC 2008
Subject: make use of sched_setaffinity if available
From: Stefan Assmann <sassmann at 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 at 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)
{
Stefan
--
Stefan Assmann | SUSE LINUX Products GmbH
Software Engineer | Maxfeldstr. 5, D-90409 Nuernberg
Mail: sassmann at suse.de | GF: Markus Rex, HRB 16746 (AG Nuernberg)
More information about the uClibc
mailing list