X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=release%2Fman3%2FCPU_SET.3;h=99ec8c9276ca66715ce133e163dc88b58339945d;hb=dba08e2eee1afb613e4e8e9310eb752cb06f45de;hp=0f83c484adc17c3133474fc860dcdcd0af03e36a;hpb=ade14c780aa8e975e7f07311df7eb10a6565feb0;p=linuxjm%2FLDP_man-pages.git diff --git a/release/man3/CPU_SET.3 b/release/man3/CPU_SET.3 index 0f83c484..99ec8c92 100644 --- a/release/man3/CPU_SET.3 +++ b/release/man3/CPU_SET.3 @@ -2,6 +2,7 @@ .\" and 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. @@ -21,18 +22,24 @@ .\" .\" 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) 2013 Akihiro MOTOKI +.\" all rights reserved. +.\" Translated 2013-08-21, Akihiro MOTOKI +.\" .TH CPU_SET 3 2012\-03\-15 Linux "Linux Programmer's Manual" .SH 名前 CPU_SET, CPU_CLR, CPU_ISSET, CPU_ZERO, CPU_COUNT, CPU_AND, CPU_OR, CPU_XOR, CPU_EQUAL, CPU_ALLOC, CPU_ALLOC_SIZE, CPU_FREE, CPU_SET_S, CPU_CLR_S, CPU_ISSET_S, CPU_ZERO_S, CPU_COUNT_S, CPU_AND_S, CPU_OR_S, CPU_XOR_S, -CPU_EQUAL_S \- macros for manipulating CPU sets +CPU_EQUAL_S \- CPU 集合を操作するためのマクロ .SH 書式 .nf \fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ @@ -77,136 +84,117 @@ CPU_EQUAL_S \- macros for manipulating CPU sets \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 .fi .SH 説明 -The \fIcpu_set_t\fP data structure represents a set of CPUs. CPU sets are used -by \fBsched_setaffinity\fP(2) and similar interfaces. +\fIcpu_set_t\fP データ構造体は CPU 集合を表現している。 CPU 集合は \fBsched_setaffinity\fP(2) +や同様のインタフェースで使用されている。 -The \fIcpu_set_t\fP data type is implemented as a bitset. However, the data -structure treated as considered opaque: all manipulation of CPU sets should -be done via the macros described in this page. +\fIcpu_set_t\fP データ型はビット集合として実装されている。 しかし、 データ構造体はその実装を意識せずに扱うものとされており、 CPU +集合のすべての操作は、 このページで説明されているマクロを通して行うべきである。 -The following macros are provided to operate on the CPU set \fIset\fP: +以下のマクロが CPU 集合 \fIset\fP を操作するために提供されている。 .TP 17 \fBCPU_ZERO\fP() -Clears \fIset\fP, so that it contains no CPUs. +\fIset\fP をクリアする。 集合には何も CPU が含まれない状態となる。 .TP \fBCPU_SET\fP() -Add CPU \fIcpu\fP to \fIset\fP. +\fIset\fP に \fIcpu\fP を追加する。 .TP \fBCPU_CLR\fP() -Remove CPU \fIcpu\fP from \fIset\fP. +\fIset\fP から \fIcpu\fP を削除する。 .TP \fBCPU_ISSET\fP() -Test to see if CPU \fIcpu\fP is a member of \fIset\fP. +CPU \fIcpu\fP が \fIset\fP のメンバーであるかを検査する。 .TP \fBCPU_COUNT\fP() -Return the number of CPUs in \fIset\fP. +\fIset\fP に含まれる CPU 数を返す。 .PP -Where a \fIcpu\fP argument is specified, it should not produce side effects, -since the above macros may evaluate the argument more than once. +\fIcpu\fP 引き数が指定する場合、 その引き数は副作用を伴うべきではない。 上記のマクロは引き数を複数回評価する可能性があるからである。 .PP -The first available CPU on the system corresponds to a \fIcpu\fP value of 0, -the next CPU corresponds to a \fIcpu\fP value of 1, and so on. The constant -\fBCPU_SETSIZE\fP (currently 1024) specifies a value one greater than the -maximum CPU number that can be stored in \fIcpu_set_t\fP. +そのシステムで利用可能な最初の CPU が \fIcpu\fP 値 0 に対応し、 次の CPU が \fIcpu\fP 値 1 に対応し、 以降も同様である。 +定数 \fBCPU_SETSIZE\fP (現在のところ 1024) は \fIcpu_set_t\fP に格納できる最大 CPU 数よりも大きな値である。 -The following macros perform logical operations on CPU sets: +以下のマクロは CPU 集合どうしの論理操作を行う。 .TP 17 \fBCPU_AND\fP() -Store the intersection of the sets \fIsrcset1\fP and \fIsrcset2\fP in \fIdestset\fP -(which may be one of the source sets). +集合 \fIsrcset1\fP と \fIsrcset2\fP の積集合を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP +として使用される場合もある)。 .TP \fBCPU_OR\fP() -Store the union of the sets \fIsrcset1\fP and \fIsrcset2\fP in \fIdestset\fP (which -may be one of the source sets). +集合 \fIsrcset1\fP と \fIsrcset2\fP の和集合を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP +として使用される場合もある)。 .TP \fBCPU_XOR\fP() -Store the XOR of the sets \fIsrcset1\fP and \fIsrcset2\fP in \fIdestset\fP (which may -be one of the source sets). The XOR means the set of CPUs that are in -either \fIsrcset1\fP or \fIsrcset2\fP, but not both. +集合 \fIsrcset1\fP と \fIsrcset2\fP の XOR を \fIdestset\fP に格納する (元の集合のいずれかが \fIdestset\fP +として使用される場合もある)。 XOR とは、 \fIsrcset1\fP か \fIsrcset2\fP +のいずれかに含まれるが、両方には含まれない集合のことである。 .TP \fBCPU_EQUAL\fP() -Test whether two CPU set contain exactly the same CPUs. -.SS "Dynamically sized CPU sets" -Because some applications may require the ability to dynamically size CPU -sets (e.g., to allocate sets larger than that defined by the standard -\fIcpu_set_t\fP data type), glibc nowadays provides a set of macros to support -this. +二つの CPU 集合が全く同じ CPU を含んでいるかを検査する。 +.SS "動的に大きさが決まる CPU 集合" +いくつかのアプリケーションでは CPU 集合の大きさを動的に決める能力 (例えば、 標準の \fIcpu_set_t\fP +データ型で定義されたよりも大きい集合を割り当てるなど) が必要となることがあるため、 現在 glibc +はこれに対応するためにいくつかのマクロを提供している。 -The following macros are used to allocate and deallocate CPU sets: +以下のマクロを使うと CPU 集合の割り当てと解放ができる。 .TP 17 \fBCPU_ALLOC\fP() -Allocate a CPU set large enough to hold CPUs in the range 0 to -\fInum_cpus\-1\fP. +0 から \fInum_cpus\-1\fP までの範囲の CPU を保持するのに十分な大きさの CPU 集合を割り当てる。 .TP \fBCPU_ALLOC_SIZE\fP() -Return the size in bytes of the CPU set that would be needed to hold CPUs in -the range 0 to \fInum_cpus\-1\fP. This macro provides the value that can be -used for the \fIsetsize\fP argument in the \fBCPU_*_S\fP() macros described -below. +0 から \fInum_cpus\-1\fP までの範囲の CPU を保持するのに必要な CPU 集合の大きさをバイト数で返す。 このマクロが返す値は、 後述の +\fBCPU_*_S\fP() マクロの \fIsetsize\fP 引き数として使用できる。 .TP \fBCPU_FREE\fP() -Free a CPU set previously allocated by \fBCPU_ALLOC\fP(). +以前に \fBCPU_ALLOC\fP() で割り当てられた CPU 集合を解放する。 .PP -The macros whose names end with "_S" are the analogs of the similarly named -macros without the suffix. These macros perform the same tasks as their -analogs, but operate on the dynamically allocated CPU set(s) whose size is -\fIsetsize\fP bytes. +名前が "_S" で終わるマクロは "_S" なしの同じ名前のマクロと同等である。 これらのマクロは "_S" なしのものと同じ動作をするが、 +動的に割り当てられた、 大きさが \fIsetsize\fP バイトの CPU 集合に対して操作を行う点が異なる。 .SH 返り値 -\fBCPU_ISSET\fP() and \fBCPU_ISSET_S\fP() return nonzero if \fIcpu\fP is in \fIset\fP; -otherwise, it returns 0. +\fBCPU_ISSET\fP() と \fBCPU_ISSET_S\fP() は、 \fIcpu\fP が \fIset\fP に含まれていれば 0 +以外を返し、含まれない場合 0 を返す。 -\fBCPU_COUNT\fP() and \fBCPU_COUNT_S\fP() return the number of CPUs in \fIset\fP. +\fBCPU_COUNT\fP() と \fBCPU_COUNT_S\fP() は \fIset\fP に含まれる CPU 数を返す。 -\fBCPU_EQUAL\fP() and \fBCPU_EQUAL_S\fP() return nonzero if the two CPU sets are -equal; otherwise it returns 0. +\fBCPU_EQUAL\fP() と \fBCPU_EQUAL_S\fP() は、 二つの CPU 集合が等しければ 0 以外を返し、 等しくない場合 0 +を返す。 -\fBCPU_ALLOC\fP() returns a pointer on success, or NULL on failure. (Errors -are as for \fBmalloc\fP(3).) +\fBCPU_ALLOC\fP() は成功するとポインタを返し、 失敗すると NULL を返す (エラーは \fBmalloc\fP(3) と同じである)。 -\fBCPU_ALLOC_SIZE\fP() returns the number of bytes required to store a CPU set -of the specified cardinality. +\fBCPU_ALLOC_SIZE\fP() は指定された大きさの CPU 集合を格納するのに必要なバイト数を返す。 -The other functions do not return a value. +他の関数は値を返さない。 .SH バージョン -The \fBCPU_ZERO\fP(), \fBCPU_SET\fP(), \fBCPU_CLR\fP(), and \fBCPU_ISSET\fP() macros -were added in glibc 2.3.3. +マクロ \fBCPU_ZERO\fP(), \fBCPU_SET\fP(), \fBCPU_CLR\fP(), \fBCPU_ISSET\fP() は glibc 2.3.3 +で追加された。 -\fBCPU_COUNT\fP() first appeared in glibc 2.6. +\fBCPU_COUNT\fP() は glibc 2.6 で初めて登場した。 \fBCPU_AND\fP(), \fBCPU_OR\fP(), \fBCPU_XOR\fP(), \fBCPU_EQUAL\fP(), \fBCPU_ALLOC\fP(), \fBCPU_ALLOC_SIZE\fP(), \fBCPU_FREE\fP(), \fBCPU_ZERO_S\fP(), \fBCPU_SET_S\fP(), \fBCPU_CLR_S\fP(), \fBCPU_ISSET_S\fP(), \fBCPU_AND_S\fP(), \fBCPU_OR_S\fP(), -\fBCPU_XOR_S\fP(), and \fBCPU_EQUAL_S\fP() first appeared in glibc 2.7. +\fBCPU_XOR_S\fP(), \fBCPU_EQUAL_S\fP() は glibc 2.7 で初めて登場した。 .SH 準拠 -These interfaces are Linux\-specific. +これらのインタフェースは Linux 固有である。 .SH 注意 -To duplicate a CPU set, use \fBmemcpy\fP(3). +CPU 集合を複製するには、 \fBmemcpy\fP(3) を使用する。 -Since CPU sets are bitsets allocated in units of long words, the actual -number of CPUs in a dynamically allocated CPU set will be rounded up to the -next multiple of \fIsizeof(unsigned long)\fP. An application should consider -the contents of these extra bits to be undefined. +CPU 集合はロングワード単位に割り当てられるビット集合なので、 動的に割り当てられた CPU 集合の実際の CPU 数は +\fIsizeof(unsigned long)\fP の次の倍数に切り上げられることになる。 アプリケーションは、 +これらの余分なビットの内容は不定と考えるべきである。 -Notwithstanding the similarity in the names, note that the constant -\fBCPU_SETSIZE\fP indicates the number of CPUs in the \fIcpu_set_t\fP data type -(thus, it is effectively a count of bits in the bitset), while the -\fIsetsize\fP argument of the \fBCPU_*_S\fP() macros is a size in bytes. +名前は似ているが、 定数 \fBCPU_SETSIZE\fP は \fIcpu_set_t\fP データ型に含まれる CPU 数 +(つまり、事実上ビット集合内のビットカウント) を示すのに対して、 マクロ \fBCPU_*_S\fP() の \fIsetsize\fP +引き数はバイト単位のサイズである点に注意すること。 -The data types for arguments and return values shown in the SYNOPSIS are -hints what about is expected in each case. However, since these interfaces -are implemented as macros, the compiler won't necessarily catch all type -errors if you violate the suggestions. +「書式」に書かれている引き数と返り値のデータ型は、それぞれの場合でどんな型が期待されるかのヒントである。 しかしながら、 +これらのインタフェースはマクロとして実装されているため、 このヒントを守らなかった場合に、 コンパイラが必ずしも全ての型エラーを捕捉できるとは限らない。 .SH バグ .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7029 -On 32\-bit platforms with glibc 2.8 and earlier, \fBCPU_ALLOC\fP() allocates -twice as much space as is required, and \fBCPU_ALLOC_SIZE\fP() returns a value -twice as large as it should. This bug should not affect the semantics of a -program, but does result in wasted memory and less efficient operation of -the macros that operate on dynamically allocated CPU sets. These bugs are -fixed in glibc 2.9. -.SH EXAMPLE -The following program demonstrates the use of some of the macros used for -dynamically allocated CPU sets. +glibc 2.8 以前の 32 ビットプラットフォームでは、 \fBCPU_ALLOC\fP() は必要な空間の割り当てを二度行い、 +\fBCPU_ALLOC_SIZE\fP() は本来あるべき値の二倍の値を返す。 このバグはプログラムの動作には影響を与えないはずだが、 +無駄にメモリを消費し、 動的に割り当てられた CPU 集合に対して操作を行うマクロの動作の効率が下がる結果となる。 これらのバグは glibc 2.9 +で修正された。 +.SH 例 +以下のプログラムは、動的に割り当てた CPU 集合に対していくつかのマクロを使用する例を示している。 .nf #define _GNU_SOURCE @@ -252,6 +240,6 @@ main(int argc, char *argv[]) \fBsched_setaffinity\fP(2), \fBpthread_attr_setaffinity_np\fP(3), \fBpthread_setaffinity_np\fP(3), \fBcpuset\fP(7) .SH この文書について -この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。