Revisión | 589bd860efeb44b890d6c555cc7beb6cbed00f8a (tree) |
---|---|
Tiempo | 2013-08-21 00:25:24 |
Autor | Akihiro MOTOKI <amotoki@gmai...> |
Commiter | Akihiro MOTOKI |
(split) LDP: Update drafts based on the previous commit
fchownat.2, fstatat.2, kcmp.2, linkat.2, readlinkat.2,
CPU_SET.3, inotify.7, man-pages.7
@@ -3,4 +3,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
3 | 3 | .\" Japanese Version Copyright (c) 2006 Yuichi SATO |
4 | 4 | .\" all rights reserved. |
5 | 5 | .\" Translated 2006-10-14 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39 |
6 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53 | |
6 | 7 | .\" |
@@ -4,4 +4,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
4 | 4 | .\" all rights reserved. |
5 | 5 | .\" Translated 2006-10-13 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39 |
6 | 6 | .\" Updated 2012-05-08, Akihiro MOTOKI <amotoki@gmail.com> |
7 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53 | |
7 | 8 | .\" |
@@ -0,0 +1,6 @@ | ||
1 | +PO4A-HEADER: mode=before; position=^\.TH | |
2 | +.\" | |
3 | +.\" Japanese Version Copyright (c) 2013 Akihiro MOTOKI | |
4 | +.\" all rights reserved. | |
5 | +.\" Translated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com> | |
6 | +.\" |
@@ -3,4 +3,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
3 | 3 | .\" Japanese Version Copyright (c) 2006 Yuichi SATO |
4 | 4 | .\" all rights reserved. |
5 | 5 | .\" Translated 2006-09-30 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39 |
6 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53 | |
6 | 7 | .\" |
@@ -3,4 +3,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
3 | 3 | .\" Japanese Version Copyright (c) 2006 Yuichi SATO |
4 | 4 | .\" all rights reserved. |
5 | 5 | .\" Translated 2006-09-27 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39 |
6 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com> | |
6 | 7 | .\" |
@@ -0,0 +1,6 @@ | ||
1 | +PO4A-HEADER: mode=before; position=^\.TH | |
2 | +.\" | |
3 | +.\" Japanese Version Copyright (c) 2013 Akihiro MOTOKI | |
4 | +.\" all rights reserved. | |
5 | +.\" Translated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com> | |
6 | +.\" |
@@ -11,4 +11,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
11 | 11 | .\" Updated 2012-05-01, Akihiro MOTOKI <amotoki@gmail.com> |
12 | 12 | .\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com> |
13 | 13 | .\" Updated 2013-07-22, Akihiro MOTOKI <amotoki@gmail.com> |
14 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53 | |
14 | 15 | .\" |
@@ -8,4 +8,5 @@ PO4A-HEADER: mode=before; position=^\.TH | ||
8 | 8 | .\" Updated 2008-08-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05 |
9 | 9 | .\" Updated 2013-05-04, Akihiro MOTOKI <amotoki@gmail.com> |
10 | 10 | .\" Updated 2013-07-24, Akihiro MOTOKI <amotoki@gmail.com> |
11 | +.\" Updated 2013-08-21, Akihiro MOTOKI <amotoki@gmail.com>, LDP v3.53 | |
11 | 12 | .\" |
@@ -0,0 +1 @@ | ||
1 | +po4a/add_ja/copyright/man2/kcmp.2 |
@@ -0,0 +1 @@ | ||
1 | +po4a/add_ja/copyright/man3/CPU_SET.3 |
@@ -78,10 +78,9 @@ _ATFILE_SOURCE | ||
78 | 78 | .TP |
79 | 79 | \fBAT_EMPTY_PATH\fP (Linux 2.6.39 以降) |
80 | 80 | .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d |
81 | -If \fIpathname\fP is an empty string, operate on the file referred to by | |
82 | -\fIdirfd\fP (which may have been obtained using the \fBopen\fP(2) \fBO_PATH\fP | |
83 | -flag). In this case, \fIdirfd\fP can refer to any type of file, not just a | |
84 | -directory. | |
81 | +\fIpathname\fP が空の文字列の場合、 \fIdirfd\fP が参照するファイルに対して操作が行われる (\fIdirfd\fP は \fBopen\fP(2) | |
82 | +の \fBO_PATH\fP フラグを使って取得することができる)。 この場合、 \fIdirfd\fP は、 | |
83 | +ディレクトリだけでなく、任意の種類のファイルを参照することができる。 | |
85 | 84 | |
86 | 85 | .TP |
87 | 86 | \fBAT_SYMLINK_NOFOLLOW\fP |
@@ -78,10 +78,9 @@ _ATFILE_SOURCE | ||
78 | 78 | .TP |
79 | 79 | \fBAT_EMPTY_PATH\fP (Linux 2.6.39 以降) |
80 | 80 | .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d |
81 | -If \fIpathname\fP is an empty string, operate on the file referred to by in | |
82 | -which case the call operates on the file referred to by \fIdirfd\fP (which may | |
83 | -have been obtained using the \fBopen\fP(2) \fBO_PATH\fP flag). In this case, | |
84 | -\fIdirfd\fP can refer to any type of file, not just a directory. | |
81 | +\fIpathname\fP が空の文字列の場合、 \fIdirfd\fP が参照するファイルに対して操作が行われる (\fIdirfd\fP は \fBopen\fP(2) | |
82 | +の \fBO_PATH\fP フラグを使って取得することができる)。 この場合、 \fIdirfd\fP は、 | |
83 | +ディレクトリだけでなく、任意の種類のファイルを参照することができる。 | |
85 | 84 | |
86 | 85 | .TP |
87 | 86 | \fBAT_NO_AUTOMOUNT\fP (Linux 2.6.38 以降) |
@@ -0,0 +1,129 @@ | ||
1 | +.\" Copyright (C) 2012, Cyrill Gorcunov <gorcunov@openvz.org> | |
2 | +.\" and Copyright (C) 2012, Michael Kerrisk <mtk.manpages@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 | +.\" Kernel commit d97b46a64674a267bc41c9e16132ee2a98c3347d | |
27 | +.\" | |
28 | +.\"******************************************************************* | |
29 | +.\" | |
30 | +.\" This file was generated with po4a. Translate the source file. | |
31 | +.\" | |
32 | +.\"******************************************************************* | |
33 | +.TH KCMP 2 2013\-01\-27 Linux "Linux Programmer's Manual" | |
34 | +.SH 名前 | |
35 | +kcmp \- 二つのプロセスが同じカーネルリソースを共有しているかを比較する | |
36 | +.SH 書式 | |
37 | +.nf | |
38 | +\fB#include <linux/kcmp.h>\fP | |
39 | + | |
40 | +\fBint kcmp(pid_t \fP\fIpid1\fP\fB, pid_t \fP\fIpid2\fP\fB, int \fP\fItype\fP\fB,\fP | |
41 | +\fB unsigned long \fP\fIidx1\fP\fB, unsigned long \fP\fIidx2\fP\fB);\fP | |
42 | +.fi | |
43 | + | |
44 | +\fI注\fP: このシステムコールには glibc のラッパー関数は存在しない。「注意」の節を参照。 | |
45 | +.SH 説明 | |
46 | +システムコール \fBkcmp\fP() を使うと、 ID が \fIpid1\fP と \fIpid2\fP の二つのプロセスが、 | |
47 | +仮想メモリやファイルディスクリプタなどの、 同じカーネルリソースを共有しているかどうかを検査できる。 | |
48 | + | |
49 | +\fItype\fP 引き数は 2 つのプロセス間でどのリソースを比較するかを指定する。 以下のいずれかの値を指定する。 | |
50 | +.TP | |
51 | +\fBKCMP_FILE\fP | |
52 | +プロセス \fIpid1\fP のファイルディスクリプタ \fIidx1\fP が、 プロセス \fIpid2\fP のファイルディスクリプタ \fIidx2\fP | |
53 | +と同じオープンファイル記述 (open file description) を参照しているかを検査する。 | |
54 | +.TP | |
55 | +\fBKCMP_FILES\fP | |
56 | +二つのプロセスが同じオープンファイル記述の集合を共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP は無視される。 | |
57 | +.TP | |
58 | +\fBKCMP_FS\fP | |
59 | +二つのプロセスが同じファイルシステム情報 (すなわち、ファイルのモード作成マスク、作業ディレクトリ、ファイルシステムのルート) | |
60 | +を共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP は無視される。 | |
61 | +.TP | |
62 | +\fBKCMP_IO\fP | |
63 | +二つのプロセスが I/O コンテキストを共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP は無視される。 | |
64 | +.TP | |
65 | +\fBKCMP_SIGHAND\fP | |
66 | +二つのプロセスがシグナル配送 (disposition) テーブルを共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP | |
67 | +は無視される。 | |
68 | +.TP | |
69 | +\fBKCMP_SYSVSEM\fP | |
70 | +二つのプロセスが同じ System V セマフォ undo 操作のリストを共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP | |
71 | +は無視される。 | |
72 | +.TP | |
73 | +\fBKCMP_VM\fP | |
74 | +二つのプロセスが同じアドレス空間を共有しているかを検査する。 引き数 \fIidx1\fP と \fIidx2\fP は無視される。 | |
75 | +.PP | |
76 | +\fBkcmp\fP() には、タスクが実行されている場合に起こり得る誤判定 (false positive) に関する保護はない。 ということは、 | |
77 | +意味のある結果を得るためには、 このシステムコールで検査されているタスクを停止すべきだということだ。 | |
78 | +.SH 返り値 | |
79 | +\fBkcmp\fP() の呼び出しが成功した場合の返り値は、単にカーネルポインタを数値で比較した結果となる | |
80 | +(カーネルはリソースを比較する際、リソースのメモリアドレスを使用する)。 | |
81 | + | |
82 | +これを説明するには、例を見るのが一番簡単である。 \fIv1\fP と \fIv2\fP を適切なリソースのアドレスとすると、 返り値は以下のいずれか一つとなる。 | |
83 | +.RS 4 | |
84 | +.IP 0 4 | |
85 | +\fIv1\fP は \fIv2\fP と等しい。言い換えれば、二つのプロセスはそのリソースを共有している。 | |
86 | +.IP 1 | |
87 | +\fIv1\fP は \fIv2\fP より小さい。 | |
88 | +.IP 2 | |
89 | +\fIv1\fP は \fIv2\fP より大きい。 | |
90 | +.IP 3 | |
91 | +\fIv1\fP は \fIv2\fP と等しくないが、順序情報がない。 | |
92 | +.RE | |
93 | +.PP | |
94 | +エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。 | |
95 | + | |
96 | +\fBkcmp ()\fP は、ソートに適した値を返すように設計された。 大量のファイルディスクリプタを比較する必要がある場合に、特に役に立つ。 | |
97 | +.SH エラー | |
98 | +.TP | |
99 | +\fBEBADF\fP | |
100 | +\fItype\fP が \fBKCMP_FILE\fP で、かつ \fIfd1\fP か \fIfd2\fP がオープンファイル記述でない。 | |
101 | +.TP | |
102 | +\fBEINVAL\fP | |
103 | +\fItype\fP が無効である。 | |
104 | +.TP | |
105 | +\fBEPERM\fP | |
106 | +プロセスのリソースを検査するのに十分な許可がない。 自分が所有していないプロセスを検査するためには \fBCAP_SYS_PTRACE\fP | |
107 | +ケーパビリティが必要である。 | |
108 | +.TP | |
109 | +\fBESRCH\fP | |
110 | +プロセス \fIpid1\fP か \fIpid2\fP が存在しない。 | |
111 | +.SH バージョン | |
112 | +\fBkcmp\fP() システムコールは Linux 3.5 で初めて登場した。 | |
113 | +.SH 準拠 | |
114 | +\fBkcmp\fP() は Linux 特有であり、 移植を考慮したプログラムでは使用すべきではない。 | |
115 | +.SH 注意 | |
116 | +glibc はこのシステムコールに対するラッパー関数を提供していない。 \fBsyscall\fP(2) を使って呼び出すこと。 | |
117 | + | |
118 | +このシステムコールが利用できるのは、 カーネルの \fBCONFIG_CHECKPOINT_RESTORE\fP オプションが有効になっている場合だけである。 | |
119 | +このシステムコールの主な用途は、 ユーザ空間でのチェックポイント/リストア (checkpoint/restore in user space; | |
120 | +CRIU) 機能である。 このシステムコールを使わないとすると、 \fBproc\fP(5) ファイルシステム経由で必要なプロセス情報を公開することになるが、 | |
121 | +これはセキュリティ上の理由から不適切とみなされた。 | |
122 | + | |
123 | +このページで参照されている共有リソースに関する背景についての情報は \fBclone\fP(2) を参照のこと。 | |
124 | +.SH 関連項目 | |
125 | +\fBclone\fP(2), \fBunshare\fP(2) | |
126 | +.SH この文書について | |
127 | +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 | |
128 | +である。プロジェクトの説明とバグ報告に関する情報は | |
129 | +http://www.kernel.org/doc/man\-pages/ に書かれている。 |
@@ -80,13 +80,12 @@ _ATFILE_SOURCE | ||
80 | 80 | .TP |
81 | 81 | \fBAT_EMPTY_PATH\fP (Linux 2.6.39 以降) |
82 | 82 | .\" commit 11a7b371b64ef39fc5fb1b6f2218eef7c4d035e3 |
83 | -If \fIoldpath\fP is an empty string, create a link to the file referenced by | |
84 | -\fIolddirfd\fP (which may have been obtained using the \fBopen\fP(2) \fBO_PATH\fP | |
85 | -flag). In this case, \fIolddirfd\fP can refer to any type of file, not just a | |
86 | -directory. The caller must have the \fBCAP_DAC_READ_SEARCH\fP capability in | |
87 | -order to use this flag; this prevents arbitrary users from creating hard | |
88 | -links using file descriptors received via a UNIX domain socket (see the | |
89 | -discussion of \fBSCM_RIGHTS\fP in \fBunix\fP(7)). | |
83 | +\fIoldpath\fP が空の文字列の場合、 \fIolddirfd\fP が参照するファイルへのリンクを作成する (\fIolddirfd\fP は | |
84 | +\fBopen\fP(2) の \fBO_PATH\fP フラグを使って取得することができる)。 この場合、 \fIolddirfd\fP は、 | |
85 | +ディレクトリだけでなく、任意の種類のファイルを参照することができる。 このフラグを使うためには、 呼び出し側は | |
86 | +\fBCAP_DAC_READ_SEARCH\fP ケーパビリティを持っていなければならない。 これは、 UNIX | |
87 | +ドメインソケット経由で受信したファイルディスクリプタを使って、 任意のユーザがハードリンクを作成するのを防止するためである (\fBunix\fP(7) の | |
88 | +\fBSCM_RIGHTS\fP に関する議論を参照)。 | |
90 | 89 | .TP |
91 | 90 | \fBAT_SYMLINK_FOLLOW\fP (since Linux 2.6.18) |
92 | 91 | デフォルトでは、 \fIoldpath\fP がシンボリック・リンクの場合、 (\fBlink\fP(2) 同様) \fBlinkat\fP() は |
@@ -103,8 +102,8 @@ discussion of \fBSCM_RIGHTS\fP in \fBunix\fP(7)). | ||
103 | 102 | \fIolddirfd\fP または \fInewdirfd\fP が有効なファイルディスクリプタでない。 |
104 | 103 | .TP |
105 | 104 | \fBENOENT\fP |
106 | -\fBAT_EMPTY_PATH\fP was specified in \fIflags\fP, but the caller did not have the | |
107 | -\fBCAP_DAC_READ_SEARCH\fP capability. | |
105 | +\fIflags\fP に \fBAT_EMPTY_PATH\fP が指定されたが、呼び出し側が \fBCAP_DAC_READ_SEARCH\fP | |
106 | +ケーパビリティを持っていなかった。 | |
108 | 107 | .TP |
109 | 108 | \fBENOTDIR\fP |
110 | 109 | .TP |
@@ -75,10 +75,10 @@ _ATFILE_SOURCE | ||
75 | 75 | \fIpathname\fP が絶対パスである場合、 \fIdirfd\fP は無視される。 |
76 | 76 | |
77 | 77 | .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d |
78 | -Since Linux 2.6.39, \fIpathname\fP can be an empty string, in which case the | |
79 | -call operates on the file referred to by \fIdirfd\fP (which may have been | |
80 | -obtained using the \fBopen\fP(2) \fBO_PATH\fP flag). In this case, \fIdirfd\fP can | |
81 | -refer to any type of file, not just a directory. | |
78 | +Linux 2.6.39 以降では、 \fIpathname\fP に空の文字列を指定することができる。 この場合、 \fBreadlinkat\fP() | |
79 | +の呼び出しは \fIdirfd\fP が参照するファイルに対する操作となる (\fIdirfd\fP は \fBopen\fP(2) の \fBO_PATH\fP | |
80 | +フラグを使って取得することができる)。 空の文字列を指定した場合、 \fIdirfd\fP は、 | |
81 | +ディレクトリだけでなく、任意の種類のファイルを参照することができる。 | |
82 | 82 | |
83 | 83 | .SH 返り値 |
84 | 84 | 成功した場合、 \fBreadlinkat\fP() は \fIbuf\fP に格納されたバイト数を返す。 エラーの場合、\-1 が返されて、 \fIerrno\fP |
@@ -0,0 +1,240 @@ | ||
1 | +.\" Copyright (C) 2006 Michael Kerrisk | |
2 | +.\" and Copyright (C) 2008 Linux Foundation, written by Michael Kerrisk | |
3 | +.\" <mtk.manpages@gmail.com> | |
4 | +.\" | |
5 | +.\" %%%LICENSE_START(VERBATIM) | |
6 | +.\" Permission is granted to make and distribute verbatim copies of this | |
7 | +.\" manual provided the copyright notice and this permission notice are | |
8 | +.\" preserved on all copies. | |
9 | +.\" | |
10 | +.\" Permission is granted to copy and distribute modified versions of this | |
11 | +.\" manual under the conditions for verbatim copying, provided that the | |
12 | +.\" entire resulting derived work is distributed under the terms of a | |
13 | +.\" permission notice identical to this one. | |
14 | +.\" | |
15 | +.\" Since the Linux kernel and libraries are constantly changing, this | |
16 | +.\" manual page may be incorrect or out-of-date. The author(s) assume no | |
17 | +.\" responsibility for errors or omissions, or for damages resulting from | |
18 | +.\" the use of the information contained herein. The author(s) may not | |
19 | +.\" have taken the same level of care in the production of this manual, | |
20 | +.\" which is licensed free of charge, as they might when working | |
21 | +.\" professionally. | |
22 | +.\" | |
23 | +.\" Formatted or processed versions of this manual, if unaccompanied by | |
24 | +.\" the source, must acknowledge the copyright and authors of this work. | |
25 | +.\" %%%LICENSE_END | |
26 | +.\" | |
27 | +.\"******************************************************************* | |
28 | +.\" | |
29 | +.\" This file was generated with po4a. Translate the source file. | |
30 | +.\" | |
31 | +.\"******************************************************************* | |
32 | +.TH CPU_SET 3 2012\-03\-15 Linux "Linux Programmer's Manual" | |
33 | +.SH 名前 | |
34 | +CPU_SET, CPU_CLR, CPU_ISSET, CPU_ZERO, CPU_COUNT, CPU_AND, CPU_OR, CPU_XOR, | |
35 | +CPU_EQUAL, CPU_ALLOC, CPU_ALLOC_SIZE, CPU_FREE, CPU_SET_S, CPU_CLR_S, | |
36 | +CPU_ISSET_S, CPU_ZERO_S, CPU_COUNT_S, CPU_AND_S, CPU_OR_S, CPU_XOR_S, | |
37 | +CPU_EQUAL_S \- CPU 集合を操作するためのマクロ | |
38 | +.SH 書式 | |
39 | +.nf | |
40 | +\fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ | |
41 | +\fB#include <sched.h>\fP | |
42 | +.sp | |
43 | +\fBvoid CPU_ZERO(cpu_set_t *\fP\fIset\fP\fB);\fP | |
44 | +.sp | |
45 | +\fBvoid CPU_SET(int \fP\fIcpu\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
46 | +\fBvoid CPU_CLR(int \fP\fIcpu\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
47 | +\fBint CPU_ISSET(int \fP\fIcpu\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
48 | +.sp | |
49 | +\fBint CPU_COUNT(cpu_set_t *\fP\fIset\fP\fB);\fP | |
50 | +.sp | |
51 | +\fBvoid CPU_AND(cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
52 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
53 | +\fBvoid CPU_OR(cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
54 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
55 | +\fBvoid CPU_XOR(cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
56 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
57 | +.sp | |
58 | +\fBint CPU_EQUAL(cpu_set_t *\fP\fIset1\fP\fB, cpu_set_t *\fP\fIset2\fP\fB);\fP | |
59 | +.sp | |
60 | +\fBcpu_set_t *CPU_ALLOC(int \fP\fInum_cpus\fP\fB);\fP | |
61 | +\fBvoid CPU_FREE(cpu_set_t *\fP\fIset\fP\fB);\fP | |
62 | +\fBsize_t CPU_ALLOC_SIZE(int \fP\fInum_cpus\fP\fB);\fP | |
63 | +.sp | |
64 | +\fBvoid CPU_ZERO_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
65 | +.sp | |
66 | +\fBvoid CPU_SET_S(int \fP\fIcpu\fP\fB, size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
67 | +\fBvoid CPU_CLR_S(int \fP\fIcpu\fP\fB, size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
68 | +\fBint CPU_ISSET_S(int \fP\fIcpu\fP\fB, size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
69 | +.sp | |
70 | +\fBint CPU_COUNT_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset\fP\fB);\fP | |
71 | +.sp | |
72 | +\fBvoid CPU_AND_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
73 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
74 | +\fBvoid CPU_OR_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
75 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
76 | +\fBvoid CPU_XOR_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIdestset\fP\fB,\fP | |
77 | +\fB cpu_set_t *\fP\fIsrcset1\fP\fB, cpu_set_t *\fP\fIsrcset2\fP\fB);\fP | |
78 | +.sp | |
79 | +\fBint CPU_EQUAL_S(size_t \fP\fIsetsize\fP\fB, cpu_set_t *\fP\fIset1\fP\fB, cpu_set_t *\fP\fIset2\fP\fB);\fP | |
80 | +.fi | |
81 | +.SH 説明 | |
82 | +\fIcpu_set_t\fP データ構造体は CPU 集合を表現している。 CPU 集合は \fBsched_setaffinity\fP(2) | |
83 | +や同様のインタフェースで使用されている。 | |
84 | + | |
85 | +\fIcpu_set_t\fP データ型はビット集合として実装されている。 しかし、 データ構造体はその実装を意識せずに扱うものとされており、 CPU | |
86 | +集合のすべての操作は、 このページで説明されているマクロを通して行うべきである。 | |
87 | + | |
88 | +以下のマクロが CPU 集合 \fIset\fP を操作するために提供されている。 | |
89 | +.TP 17 | |
90 | +\fBCPU_ZERO\fP() | |
91 | +\fIset\fP をクリアする。 集合には何も CPU が含まれない状態となる。 | |
92 | +.TP | |
93 | +\fBCPU_SET\fP() | |
94 | +\fIset\fP に \fIcpu\fP を追加する。 | |
95 | +.TP | |
96 | +\fBCPU_CLR\fP() | |
97 | +\fIset\fP から \fIcpu\fP を削除する。 | |
98 | +.TP | |
99 | +\fBCPU_ISSET\fP() | |
100 | +CPU \fIcpu\fP が \fIset\fP のメンバーであるかを検査する。 | |
101 | +.TP | |
102 | +\fBCPU_COUNT\fP() | |
103 | +\fIset\fP に含まれる CPU 数を返す。 | |
104 | +.PP | |
105 | +\fIcpu\fP 引き数が指定する場合、 その引き数は副作用を伴うべきではない。 上記のマクロは引き数を複数回評価する可能性があるからである。 | |
106 | +.PP | |
107 | +そのシステムで利用可能な最初の CPU が \fIcpu\fP 値 0 に対応し、 次の CPU が \fIcpu\fP 値 1 に対応し、 以降も同様である。 | |
108 | +定数 \fBCPU_SETSIZE\fP (現在のところ 1024) は \fIcpu_set_t\fP に格納できる最大 CPU 数よりも大きな値である。 | |
109 | + | |
110 | +以下のマクロは CPU 集合どうしの論理操作を行う。 | |
111 | +.TP 17 | |
112 | +\fBCPU_AND\fP() | |
113 | +集合 \fIsrcset1\fP と \fIsrcset2\fP の積集合を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP | |
114 | +として使用される場合もある)。 | |
115 | +.TP | |
116 | +\fBCPU_OR\fP() | |
117 | +集合 \fIsrcset1\fP と \fIsrcset2\fP の和集合を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP | |
118 | +として使用される場合もある)。 | |
119 | +.TP | |
120 | +\fBCPU_XOR\fP() | |
121 | +集合 \fIsrcset1\fP と \fIsrcset2\fP の XOR を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP | |
122 | +として使用される場合もある)。 XOR とは、 \fIsrcset1\fP か \fIsrcset2\fP | |
123 | +のいずれかに含まれるが、両方には含まれない集合のことである。 | |
124 | +.TP | |
125 | +\fBCPU_EQUAL\fP() | |
126 | +二つの CPU 集合が全く同じ CPU を含んでいるかを検査する。 | |
127 | +.SS "動的に大きさが決まる CPU 集合" | |
128 | +いくつかのアプリケーションでは CPU 集合の大きさを動的に決める能力 (例えば、 標準の \fIcpu_set_t\fP | |
129 | +データ型で定義されたよりも大きい集合を割り当てるなど) が必要となることがあるため、 現在 glibc | |
130 | +はこれに対応するためにいくつかのマクロを提供している。 | |
131 | + | |
132 | +以下のマクロを使うと CPU 集合の割り当てと解放ができる。 | |
133 | +.TP 17 | |
134 | +\fBCPU_ALLOC\fP() | |
135 | +0 から \fInum_cpus\-1\fP までの範囲の CPU を保持するのに十分な大きさの CPU 集合を割り当てる。 | |
136 | +.TP | |
137 | +\fBCPU_ALLOC_SIZE\fP() | |
138 | +0 から \fInum_cpus\-1\fP までの範囲の CPU を保持するのに必要な CPU 集合の大きさをバイト数で返す。 このマクロが返す値は、 後述の | |
139 | +\fBCPU_*_S\fP() マクロの \fIsetsize\fP 引き数として使用できる。 | |
140 | +.TP | |
141 | +\fBCPU_FREE\fP() | |
142 | +以前に \fBCPU_ALLOC\fP() で割り当てられた CPU 集合を解放する。 | |
143 | +.PP | |
144 | +名前が "_S" で終わるマクロは "_S" なしの同じ名前のマクロと同等である。 これらのマクロは "_S" なしのものと同じ動作をするが、 | |
145 | +動的に割り当てられた、 大きさが \fIsetsize\fP バイトの CPU 集合に対して操作を行う点が異なる。 | |
146 | +.SH 返り値 | |
147 | +\fBCPU_ISSET\fP() と \fBCPU_ISSET_S\fP() は、 \fIcpu\fP が \fIset\fP に含まれていれば 0 | |
148 | +以外を返し、含まれない場合 0 を返す。 | |
149 | + | |
150 | +\fBCPU_COUNT\fP() と \fBCPU_COUNT_S\fP() は \fIset\fP に含まれる CPU 数を返す。 | |
151 | + | |
152 | +\fBCPU_EQUAL\fP() と \fBCPU_EQUAL_S\fP() は、 二つの CPU 集合が等しければ 0 以外を返し、 等しくない場合 0 | |
153 | +を返す。 | |
154 | + | |
155 | +\fBCPU_ALLOC\fP() は成功するとポインタを返し、 失敗すると NULL を返す (エラーは \fBmalloc\fP(3) と同じである)。 | |
156 | + | |
157 | +\fBCPU_ALLOC_SIZE\fP() は指定された大きさの CPU 集合を格納するのに必要なバイト数を返す。 | |
158 | + | |
159 | +他の関数は値を返さない。 | |
160 | +.SH バージョン | |
161 | +マクロ \fBCPU_ZERO\fP(), \fBCPU_SET\fP(), \fBCPU_CLR\fP(), \fBCPU_ISSET\fP() は glibc 2.3.3 | |
162 | +で追加された。 | |
163 | + | |
164 | +\fBCPU_COUNT\fP() は glibc 2.6 で初めて登場した。 | |
165 | + | |
166 | +\fBCPU_AND\fP(), \fBCPU_OR\fP(), \fBCPU_XOR\fP(), \fBCPU_EQUAL\fP(), \fBCPU_ALLOC\fP(), | |
167 | +\fBCPU_ALLOC_SIZE\fP(), \fBCPU_FREE\fP(), \fBCPU_ZERO_S\fP(), \fBCPU_SET_S\fP(), | |
168 | +\fBCPU_CLR_S\fP(), \fBCPU_ISSET_S\fP(), \fBCPU_AND_S\fP(), \fBCPU_OR_S\fP(), | |
169 | +\fBCPU_XOR_S\fP(), \fBCPU_EQUAL_S\fP() は glibc 2.7 で初めて登場した。 | |
170 | +.SH 準拠 | |
171 | +これらのインタフェースは Linux 固有である。 | |
172 | +.SH 注意 | |
173 | +CPU 集合を複製するには、 \fBmemcpy\fP(3) を使用する。 | |
174 | + | |
175 | +CPU 集合はロングワード単位に割り当てられるビット集合なので、 動的に割り当てられた CPU 集合の実際の CPU 数は | |
176 | +\fIsizeof(unsigned long)\fP の次の倍数に切り上げられることになる。 アプリケーションは、 | |
177 | +これらの余分なビットの内容は不定と考えるべきである。 | |
178 | + | |
179 | +名前は似ているが、 定数 \fBCPU_SETSIZE\fP は \fIcpu_set_t\fP データ型に含まれる CPU 数 | |
180 | +(つまり、事実上ビット集合内のビットカウント) を示すのに対して、 マクロ \fBCPU_*_S\fP() の \fIsetsize\fP | |
181 | +引き数はバイト単位のサイズである点に注意すること。 | |
182 | + | |
183 | +「書式」に書かれている引き数と返り値のデータ型は、それぞれの場合でどんな型が期待されるかのヒントである。 しかしながら、 | |
184 | +これらのインタフェースはマクロとして実装されているため、 このヒントを守らなかった場合に、 コンパイラが必ずしも全ての型エラーを捕捉できるとは限らない。 | |
185 | +.SH バグ | |
186 | +.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7029 | |
187 | +glibc 2.8 以前の 32 ビットプラットフォームでは、 \fBCPU_ALLOC\fP() は必要な空間の割り当てを二度行い、 | |
188 | +\fBCPU_ALLOC_SIZE\fP() は本来あるべき値の二倍の値を返す。 このバグはプログラムの動作には影響を与えないはずだが、 | |
189 | +無駄にメモリを消費し、 動的に割り当てられた CPU 集合に対して操作を行うマクロの動作の効率が下がる結果となる。 これらのバグは glibc 2.9 | |
190 | +で修正された。 | |
191 | +.SH 例 | |
192 | +以下のプログラムは、動的に割り当てた CPU 集合に対していくつかのマクロを使用する例を示している。 | |
193 | + | |
194 | +.nf | |
195 | +#define _GNU_SOURCE | |
196 | +#include <sched.h> | |
197 | +#include <stdlib.h> | |
198 | +#include <unistd.h> | |
199 | +#include <stdio.h> | |
200 | +#include <assert.h> | |
201 | + | |
202 | +int | |
203 | +main(int argc, char *argv[]) | |
204 | +{ | |
205 | + cpu_set_t *cpusetp; | |
206 | + size_t size; | |
207 | + int num_cpus, cpu; | |
208 | + | |
209 | + if (argc < 2) { | |
210 | + fprintf(stderr, "Usage: %s <num\-cpus>\en", argv[0]); | |
211 | + exit(EXIT_FAILURE); | |
212 | + } | |
213 | + | |
214 | + num_cpus = atoi(argv[1]); | |
215 | + | |
216 | + cpusetp = CPU_ALLOC(num_cpus); | |
217 | + if (cpusetp == NULL) { | |
218 | + perror("CPU_ALLOC"); | |
219 | + exit(EXIT_FAILURE); | |
220 | + } | |
221 | + | |
222 | + size = CPU_ALLOC_SIZE(num_cpus); | |
223 | + | |
224 | + CPU_ZERO_S(size, cpusetp); | |
225 | + for (cpu = 0; cpu < num_cpus; cpu += 2) | |
226 | + CPU_SET_S(cpu, size, cpusetp); | |
227 | + | |
228 | + printf("CPU_COUNT() of set: %d\en", CPU_COUNT_S(size, cpusetp)); | |
229 | + | |
230 | + CPU_FREE(cpusetp); | |
231 | + exit(EXIT_SUCCESS); | |
232 | +} | |
233 | +.fi | |
234 | +.SH 関連項目 | |
235 | +\fBsched_setaffinity\fP(2), \fBpthread_attr_setaffinity_np\fP(3), | |
236 | +\fBpthread_setaffinity_np\fP(3), \fBcpuset\fP(7) | |
237 | +.SH この文書について | |
238 | +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 | |
239 | +である。プロジェクトの説明とバグ報告に関する情報は | |
240 | +http://www.kernel.org/doc/man\-pages/ に書かれている。 |
@@ -156,12 +156,10 @@ struct inotify_event { | ||
156 | 156 | 監視対象のディレクトリまたはファイル自身が移動された。 |
157 | 157 | .TP |
158 | 158 | \fBIN_MOVED_FROM\fP |
159 | -Generated for the directory containing the old filename when a file is | |
160 | -renamed (*). | |
159 | +ファイル名の変更を行った際に変更前のファイル名が含まれるディレクトリに対して生成される。 (*) | |
161 | 160 | .TP |
162 | 161 | \fBIN_MOVED_TO\fP |
163 | -Generated for the directory containing the new filename when a file is | |
164 | -renamed (*). | |
162 | +ファイル名の変更を行った際に新しいファイル名が含まれるディレクトリに対して生成される。 (*) | |
165 | 163 | .TP |
166 | 164 | \fBIN_OPEN\fP |
167 | 165 | ファイルがオープンされた。(*) |
@@ -205,20 +205,17 @@ Programmer's Manual\fP を使うこと)。 | ||
205 | 205 | どのように生成するかといったことについて述べる。 内部動作や実装の詳細については省略する (ただしそれが動作の理解にどうしても必要なら別)。 |
206 | 206 | 通常の場合について記述する。 プログラムのコマンドライン・オプションの説明には、 \fBオプション\fP のセクションを用いる。 |
207 | 207 | |
208 | -When describing new behavior or new flags for a system call or library | |
209 | -function, be careful to note the kernel or C library version that introduced | |
210 | -the change. The preferred method of noting this information for flags is as | |
211 | -part of a \fB.TP\fP list, in the following form (here, for a new system call | |
212 | -flag): | |
208 | +システムコールやライブラリ関数の新しい動作や新しいフラグについて説明する際は、 変更が取り込まれたカーネルや C | |
209 | +ライブラリのバージョンを注記に入れるように気を付けること。 フラグにこの情報の注記を入れる方法としては、推奨される方法は、 以下のように \fB.TP\fP | |
210 | +リストの一部にすることである (この例はシステムコールの新しいフラグの場合)。 | |
213 | 211 | .RS 22 |
214 | 212 | .TP |
215 | 213 | \fBXYZ_FLAG\fP (Linux 3.7 以降) |
216 | -Description of flag... | |
214 | +フラグの説明... | |
217 | 215 | .RE |
218 | 216 | .IP |
219 | -Including version information is especially useful to users who are | |
220 | -constrained to using older kernel or C library versions (which is typical in | |
221 | -embedded systems, for example). | |
217 | +バージョン情報を入れておくのは、 古いバージョンのカーネルや C ライブラリを使わざるを得ないユーザにとって、 特に有用である | |
218 | +(例えば、組み込みシステムではよくあることである)。 | |
222 | 219 | .TP |
223 | 220 | \fBオプション (OPTIONS)\fP |
224 | 221 | .\" .TP |