OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / sched_getcpu.3
1 .\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
25 .\"         all rights reserved.
26 .\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.04
27 .\" 
28 .TH SCHED_GETCPU 3 2010-10-31 "Linux" "Linux Programmer's Manual"
29 .\"O .SH NAME
30 .SH Ì¾Á°
31 .\"O sched_getcpu \- determine CPU on which the calling thread is running
32 sched_getcpu \- ¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë CPU ¤òÃΤë
33 .\"O .SH SYNOPSIS
34 .SH ½ñ¼°
35 .nf
36 .\"O .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
37 .BR "#define _GNU_SOURCE" "         /* feature_test_macros(7) »²¾È */"
38 .\" Really:_BSD_SOURCE || _SVID_SOURCE
39 .B #include <sched.h>
40
41 .B int sched_getcpu(void);
42 .fi
43 .\"O .SH DESCRIPTION
44 .SH ÀâÌÀ
45 .\"O .BR sched_getcpu ()
46 .\"O returns the number of the CPU on which the calling thread is currently executing.
47 .BR sched_getcpu ()
48 ¤Ï¡¢¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤¬¸½ºß¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë CPU ¤ÎÈÖ¹æ¤òÊÖ¤¹¡£
49 .\"O .SH RETURN VALUE
50 .SH ÊÖ¤êÃÍ
51 .\"O On success,
52 .\"O .BR sched_getcpu ()
53 .\"O returns a nonnegative CPU number.
54 .\"O On error, \-1 is returned and
55 .\"O .I errno
56 .\"O is set to indicate the error.
57 À®¸ù¤¹¤ë¤È¡¢
58 .BR sched_getcpu ()
59 ¤ÏÈóÉé¤Î CPU ÈÖ¹æ¤òÊÖ¤¹¡£
60 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
61 .I errno
62 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
63 .\"O .SH ERRORS
64 .SH ¥¨¥é¡¼
65 .TP
66 .B ENOSYS
67 .\"O This kernel does not implement
68 .\"O .BR getcpu (2).
69 ¤³¤Î¥«¡¼¥Í¥ë¤Ç¤Ï
70 .BR getcpu (2)
71 ¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
72 .\"O .SH VERSIONS
73 .SH ¥Ð¡¼¥¸¥ç¥ó
74 .\"O This function is available since glibc 2.6.
75 ¤³¤Î´Ø¿ô¤Ï glibc 2.6 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
76 .\"O .SH CONFORMING TO
77 .SH ½àµò
78 .\"O .BR sched_getcpu ()
79 .\"O is glibc specific.
80 .BR sched_getcpu ()
81 ¤Ï glibc ¸ÇÍ­¤Ç¤¢¤ë¡£
82 .\"O .SH NOTES
83 .SH Ãí°Õ
84 .\"O The call
85 .in +4n
86 .nf
87
88 cpu = sched_getcpu();
89
90 .fi
91 .in
92 .\"O is equivalent to the following
93 .\"O .BR getcpu (2)
94 .\"O call:
95 ¤Ï¡¢°Ê²¼¤Î
96 .BR getcpu (2)
97 ¤Î¸Æ¤Ó½Ð¤·¤ÈÅù²Á¤Ç¤¢¤ë¡£
98 .in +4n
99 .nf
100
101 int c, s;
102 s = getcpu(&c, NULL, NULL);
103 cpu = (s == \-1) ? s : c;
104 .fi
105 .in
106 .\"O .SH SEE ALSO
107 .SH ´ØÏ¢¹àÌÜ
108 .BR getcpu (2)