Эх сурвалжийг харах

sched_setaffinity.c: make use of the syscall

Fix arg type (const missing).
Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Peter S. Mazinger 14 жил өмнө
parent
commit
29ba11d605

+ 10 - 16
libc/sysdeps/linux/common/sched_setaffinity.c

@@ -16,22 +16,17 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-#ifdef __USE_GNU
-
-#include <sched.h>
-#include <sys/types.h>
 #include <sys/syscall.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <alloca.h>
-
-#if defined __NR_sched_setaffinity
 
-#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
-static __inline__ _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid,
-			size_t, cpusetsize, cpu_set_t *, cpuset)
+#if defined __NR_sched_setaffinity && defined __USE_GNU
+# include <sched.h>
+# include <sys/types.h>
+# include <string.h>
+# include <unistd.h>
+# include <alloca.h>
+# define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
+static __always_inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid,
+				 size_t, cpusetsize, const cpu_set_t *, cpuset)
 
 static size_t __kernel_cpumask_size;
 
@@ -68,7 +63,6 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
 			return -1;
 		}
 
-	return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset);
+	return __syscall_sched_setaffinity(pid, cpusetsize, cpuset);
 }
 #endif
-#endif /* __USE_GNU */