.\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2008-08-21, Akihiro MOTOKI , LDP v3.04 .\" Updated 2013-05-06, Akihiro MOTOKI .\" .TH SCHED_GETCPU 3 2013\-04\-17 Linux "Linux Programmer's Manual" .SH 名前 sched_getcpu \- 呼び出したスレッドが実行されている CPU を知る .SH 書式 .nf \fB#include \fP \fBint sched_getcpu(void);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBsched_getcpu\fP(): .ad l .RS 4 .PD 0 .TP 4 glibc 2.14 以降: _GNU_SOURCE .TP 4 glibc 2.14 より前: _BSD_SOURCE || _SVID_SOURCE /* _GNU_SOURCE も定義される */ .PD .RE .ad b .SH 説明 \fBsched_getcpu\fP() は、呼び出したスレッドが現在実行されている CPU の番号を返す。 .SH 返り値 成功すると、 \fBsched_getcpu\fP() は非負の CPU 番号を返す。 エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値を設定する。 .SH エラー .TP \fBENOSYS\fP このカーネルでは \fBgetcpu\fP(2) が実装されていない。 .SH バージョン この関数は glibc 2.6 以降で利用可能である。 .SH 準拠 \fBsched_getcpu\fP() は glibc 固有である。 .SH 注意 呼び出し .in +4n .nf cpu = sched_getcpu(); .fi .in は、以下の \fBgetcpu\fP(2) 呼び出しと等価である。 .in +4n .nf int c, s; s = getcpu(&c, NULL, NULL); cpu = (s == \-1) ? s : c; .fi .in .SH 関連項目 \fBgetcpu\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。