summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/sched_getcpu.c
diff options
context:
space:
mode:
authorHenning Heinold <heinold@inf.fu-berlin.de>2011-06-04 21:21:41 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-11-07 20:57:02 +0100
commit19dd090a0f68765db87990ef8eda9bf77bb29581 (patch)
treef210bb330d8b3dda2bcc345a80ce476bd41e1a69 /libc/sysdeps/linux/common/sched_getcpu.c
parent0c7690f6a5d6e073052ee6487f768289db3a58f7 (diff)
libc: flesh out linux scheduler functions
Most stuff was taken from the eglibc. Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/sched_getcpu.c')
-rw-r--r--libc/sysdeps/linux/common/sched_getcpu.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/sched_getcpu.c b/libc/sysdeps/linux/common/sched_getcpu.c
new file mode 100644
index 000000000..bc858ba8e
--- /dev/null
+++ b/libc/sysdeps/linux/common/sched_getcpu.c
@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * sched_getcpu() for uClibc
+ *
+ * Copyright (C) 2011 Bernhard Reutner-Fischer <uclibc@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <sched.h>
+#include <sysdep.h>
+
+#if defined __NR_getcpu
+int
+sched_getcpu (void)
+{
+ unsigned int cpu;
+ int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
+
+ return r == -1 ? r : cpu;
+}
+#endif