summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Zadoks <nathan@nathan7.eu>2016-03-02 17:26:26 +0100
committerRich Felker <dalias@aerifal.cx>2016-03-02 21:32:36 -0500
commit98d335735d64ee34a34cb9c08ea2cb51a076d2a1 (patch)
treeb8d57da2b7e216381f34d9695a0c8cb8d8f9e527 /src
parent29b13575376509bb21539711f30c1deaf0823033 (diff)
downloadmusl-98d335735d64ee34a34cb9c08ea2cb51a076d2a1.tar.gz
musl-98d335735d64ee34a34cb9c08ea2cb51a076d2a1.tar.bz2
musl-98d335735d64ee34a34cb9c08ea2cb51a076d2a1.tar.xz
musl-98d335735d64ee34a34cb9c08ea2cb51a076d2a1.zip
add sched_getcpu
This is a GNU extension, but a fairly minor one, for a system call that otherwise has no libc wrapper.
Diffstat (limited to 'src')
-rw-r--r--src/sched/sched_getcpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sched/sched_getcpu.c b/src/sched/sched_getcpu.c
new file mode 100644
index 00000000..760e4d5b
--- /dev/null
+++ b/src/sched/sched_getcpu.c
@@ -0,0 +1,13 @@
+#define _GNU_SOURCE
+#include <sched.h>
+#include "syscall.h"
+
+int sched_getcpu(void)
+{
+ int r;
+ unsigned cpu;
+
+ r = __syscall(SYS_getcpu, &cpu, 0, 0);
+ if (!r) return cpu;
+ return __syscall_ret(r);
+}