1SCHED_GETCPU(3)            Linux Programmer's Manual           SCHED_GETCPU(3)
2
3
4

NAME

6       sched_getcpu - determine CPU on which the calling thread is running
7

SYNOPSIS

9       #include <sched.h>
10
11       int sched_getcpu(void);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       sched_getcpu():
16           Since glibc 2.14:
17               _GNU_SOURCE
18           Before glibc 2.14:
19               _BSD_SOURCE || _SVID_SOURCE
20                   /* _GNU_SOURCE also suffices */
21

DESCRIPTION

23       sched_getcpu()  returns  the  number  of  the  CPU on which the calling
24       thread is currently executing.
25

RETURN VALUE

27       On success, sched_getcpu() returns a nonnegative CPU number.  On error,
28       -1 is returned and errno is set to indicate the error.
29

ERRORS

31       ENOSYS This kernel does not implement getcpu(2).
32

VERSIONS

34       This function is available since glibc 2.6.
35

CONFORMING TO

37       sched_getcpu() is glibc specific.
38

NOTES

40       The call
41
42           cpu = sched_getcpu();
43
44       is equivalent to the following getcpu(2) call:
45
46           int c, s;
47           s = getcpu(&c, NULL, NULL);
48           cpu = (s == -1) ? s : c;
49

SEE ALSO

51       getcpu(2)
52

COLOPHON

54       This  page  is  part of release 3.53 of the Linux man-pages project.  A
55       description of the project, and information about reporting  bugs,  can
56       be found at http://www.kernel.org/doc/man-pages/.
57
58
59
60Linux                             2013-04-17                   SCHED_GETCPU(3)
Impressum