]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sched_getcpu.3
Revert "src.mk, All pages: Move man* to man/"
[thirdparty/man-pages.git] / man3 / sched_getcpu.3
CommitLineData
2b65a83f
MK
1.\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2.\" <mtk.manpages@gmail.com>
3.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
2b65a83f 5.\"
45186a5d 6.TH SCHED_GETCPU 3 2021-03-22 "Linux man-pages (unreleased)"
2b65a83f
MK
7.SH NAME
8sched_getcpu \- determine CPU on which the calling thread is running
66985f1c
AC
9.SH LIBRARY
10Standard C library
8fc3b2cf 11.RI ( libc ", " \-lc )
2b65a83f
MK
12.SH SYNOPSIS
13.nf
6a56bbb5 14.B #include <sched.h>
dbfe9c70 15.PP
2b65a83f
MK
16.B int sched_getcpu(void);
17.fi
68e4db0a 18.PP
d39ad78f 19.RS -4
cd05d2ff
MK
20Feature Test Macro Requirements for glibc (see
21.BR feature_test_macros (7)):
d39ad78f 22.RE
68e4db0a 23.PP
cd05d2ff 24.BR sched_getcpu ():
9d2adbae
MK
25.nf
26 Since glibc 2.14:
27 _GNU_SOURCE
28 Before glibc 2.14:
29 _BSD_SOURCE || _SVID_SOURCE
30 /* _GNU_SOURCE also suffices */
31.fi
2b65a83f
MK
32.SH DESCRIPTION
33.BR sched_getcpu ()
15f0b7af
AC
34returns the number of the CPU
35on which the calling thread is currently executing.
2b65a83f
MK
36.SH RETURN VALUE
37On success,
38.BR sched_getcpu ()
2fda57bd 39returns a nonnegative CPU number.
2b65a83f
MK
40On error, \-1 is returned and
41.I errno
42is set to indicate the error.
43.SH ERRORS
44.TP
45.B ENOSYS
46This kernel does not implement
47.BR getcpu (2).
48.SH VERSIONS
49This function is available since glibc 2.6.
a7b3fac9 50.SH ATTRIBUTES
a49469b7
PH
51For an explanation of the terms used in this section, see
52.BR attributes (7).
c466875e
MK
53.ad l
54.nh
a49469b7
PH
55.TS
56allbox;
c466875e 57lbx lb lb
a49469b7
PH
58l l l.
59Interface Attribute Value
60T{
a7b3fac9 61.BR sched_getcpu ()
a49469b7
PH
62T} Thread safety MT-Safe
63.TE
c466875e
MK
64.hy
65.ad
66.sp 1
3113c7f3 67.SH STANDARDS
2b65a83f 68.BR sched_getcpu ()
76c637e1 69is glibc-specific.
2b65a83f
MK
70.SH NOTES
71The call
e646a1ba 72.PP
2b65a83f 73.in +4n
e646a1ba 74.EX
2b65a83f 75cpu = sched_getcpu();
e646a1ba 76.EE
2b65a83f 77.in
e646a1ba 78.PP
2b65a83f
MK
79is equivalent to the following
80.BR getcpu (2)
81call:
e646a1ba 82.PP
2b65a83f 83.in +4n
e646a1ba 84.EX
2b65a83f
MK
85int c, s;
86s = getcpu(&c, NULL, NULL);
c3074d70 87cpu = (s == \-1) ? s : c;
b8302363 88.EE
2b65a83f
MK
89.in
90.SH SEE ALSO
6cc61889
MK
91.BR getcpu (2),
92.BR sched (7)