Section: Linux Programmer's Manual (3)
Return to Main Contents
sched_getcpu - determine CPU on which the calling thread is running
Feature Test Macro Requirements for glibc (see
- Since glibc 2.14:
- Before glibc 2.14:
_BSD_SOURCE || _SVID_SOURCE
/* _GNU_SOURCE also suffices */
returns the number of the CPU on which the calling thread is currently executing.
returns a nonnegative CPU number.
On error, -1 is returned and
is set to indicate the error.
This kernel does not implement
This function is available since glibc 2.6.
is glibc specific.
cpu = sched_getcpu();
is equivalent to the following
int c, s;
s = getcpu(&c, NULL, NULL);
cpu = (s == -1) ? s : c;
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 14:44:43 GMT, January 17, 2018