1SCHED_GETCPU(3) Linux Programmer's Manual SCHED_GETCPU(3)
2
3
4
6 sched_getcpu - determine CPU on which the calling thread is running
7
9 #define _GNU_SOURCE
10 #include <utmpx.h>
11
12 int sched_getcpu(void);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 sched_getcpu(): _BSD_SOURCE || _SVID_SOURCE
17
19 sched_getcpu() returns the number of the CPU on which the calling
20 thread is currently executing.
21
23 On success, sched_getcpu() returns a non-negative CPU number. On
24 error, -1 is returned and errno is set to indicate the error.
25
27 ENOSYS This kernel does not implement getcpu(2).
28
30 This function is available since glibc 2.6.
31
33 sched_getcpu() is glibc specific.
34
36 The call
37
38 cpu = sched_getcpu();
39
40 is equivalent to the following getcpu(2) call:
41
42 int c, s;
43 s = getcpu(&c, NULL, NULL);
44 cpu = (s == -1) ? s : c;
45
47 getcpu(2)
48
50 This page is part of release 3.22 of the Linux man-pages project. A
51 description of the project, and information about reporting bugs, can
52 be found at http://www.kernel.org/doc/man-pages/.
53
54
55
56Linux 2008-07-03 SCHED_GETCPU(3)