OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man3 / get_nprocs_conf.3
1 .\" Copyright (c) 2012, Petr Benas
2 .\" and Copyright (c) 2012, Michael Kerrisk <mtk.man-pages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of
10 .\" this manual under the conditions for verbatim copying, provided that
11 .\" the entire resulting derived work is distributed under the terms of
12 .\" a permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume
16 .\" no responsibility for errors or omissions, or for damages resulting
17 .\" from the use of the information contained herein.  The author(s) may
18 .\" not have taken the same level of care in the production of this
19 .\" manual, which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" Japanese Version Copyright (c) 2012  Akihiro MOTOKI
33 .\"         all rights reserved.
34 .\" Translated 2012-05-31, Akihiro MOTOKI <amotoki@gmail.com>
35 .\"
36 .TH GET_NPROCS 3 2012\-03\-20 GNU "Linux Programmer's Manual"
37 .SH 名前
38 get_nprocs, get_nprocs_conf \- プロセッサ数を取得する
39 .SH 書式
40 \fB#include <sys/sysinfo.h>\fP
41 .sp
42 \fBint get_nprocs(void);\fP
43 .br
44 \fBint get_nprocs_conf(void);\fP
45 .SH 説明
46 \fBget_nprocs_conf\fP() 関数は、オペレーティングシステムで
47 設定されているプロセッサ数を返す。
48
49 \fBget_nprocs\fP() 関数は、システムで現在利用可能なプロセッサ数を返す。
50 (例えば、ホットプラグが可能なシステムでは)
51 オフラインになっているプロセッサがある場合があるので、
52 この数は \fBget_nprocs_conf\fP() が返す数より小さい場合がある。
53 .SH 返り値
54 「説明」の節で説明した通りである。
55 .SH 準拠
56 これらの関数は GNU による拡張である。
57 .SH 注意
58 .\" glibc 2.15
59 これらの関数の現在の実装はかなりコストがかかる実装になっている。
60 関数が呼ばれる度に \fI/sys\fP ファイルシステム内のファイルをオープンして
61 解析するようになっているからである。
62
63 以下の \fBsysconf\fP(3) の呼び出しで、このページに書かれている関数を使った
64 場合に返されるのと同じ情報を得ることができる。
65 .nf
66
67     np = sysconf(_SC_NPROCESSORS_CONF);     /* processors configured */
68     np = sysconf(_SC_NPROCESSORS_ONLN);     /* processors available */
69 .fi
70 .SH 例
71 以下の例は、 \fBget_nprocs\fP() と \fBget_nprocs_conf\fP() が
72 どのように利用できるかを示すものである。
73
74 .nf
75 #include <stdio.h>
76 #include <sys/sysinfo.h>
77
78 int
79 main(int argc, char *argv[])
80 {
81     printf("This system has %d processors configured and "
82             "%d processors available.\en",
83             get_nprocs_conf(), get_nprocs());
84     return 0;
85 }
86 .fi
87
88 .SH この文書について
89 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
90 である。プロジェクトの説明とバグ報告に関する情報は
91 http://www.kernel.org/doc/man\-pages/ に書かれている。