\fBint arch_prctl(int \fP\fIcode\fP\fB, unsigned long *\fP\fIaddr\fP\fB);\fP
.fi
.SH 説明
-The \fBarch_prctl\fP() function sets architecture\-specific process or thread
-state. \fIcode\fP selects a subfunction and passes argument \fIaddr\fP to it;
-\fIaddr\fP is interpreted as either an \fIunsigned long\fP for the "set"
-operations, or as an \fIunsigned long\ *\fP, for the "get" operations.
+\fBarch_prctl\fP() 関数はアーキテクチャ固有のプロセス状態またはスレッド状態を設定する。 \fIcode\fP は副機能を選択し、引き数
+\fIaddr\fP を副機能に渡す。 \fIaddr\fP は、"set" 操作では \fIunsigned long\fP として、"get" 操作では
+\fIunsigned long\ *\fP として解釈される。
.LP
x86\-64 の副機能は以下の通り:
.TP
.SH 準拠
POSIX.1\-2001.
.SH 注意
-The \fBpread\fP() and \fBpwrite\fP() system calls are especially useful in
-multithreaded applications. They allow multiple threads to perform I/O on
-the same file descriptor without being affected by changes to the file
-offset by other threads.
+システムコール \fBpread\fP() と \fBpwrite\fP() は、特にマルチスレッドアプリケーションで役に立つ。 これらを使うと、
+他のスレッドによるファイルオフセットの変更の影響を受けることなく、 複数のスレッドが同じファイルディスクリプタに対して入出力を行うことができる。
Linux では、裏で呼び出されるシステムコールの名前がカーネル 2.6 で変更された。
\fBpread\fP() は \fBpread64\fP() になり、 \fBpwrite\fP() は \fBpwrite64\fP() になった。
.\" SVr4 documents more error conditions EINVAL and EOVERFLOW.
SVr4, POSIX.1\-2001.
-POSIX.1\-2001 specifies the \fIsem_nsems\fP field of the \fIsemid_ds\fP structure
-as having the type \fIunsigned\ short\fP, and the field is so defined on most
-other systems. It was also so defined on Linux 2.2 and earlier, but, since
-Linux 2.4, the field has the type \fIunsigned\ long\fP.
+POSIX.1\-2001 では \fIsemid_ds\fP 構造体の \fIsem_nsems\fP フィールドは \fIunsigned\ short\fP
+型を持つと規定されており、 他のほとんどのシステムでこのフィールドは \fIunsigned\ short\fP 型になっている。 Linux 2.4
+以前ではそうなっていたが、 Linux 2.4 以降ではこのフィールドは \fIunsigned\ long\fP 型である。
.SH 注意
.\" Like Linux, the FreeBSD man pages still document
.\" the inclusion of these header files.
.PP
共有メモリ・セグメントが既に存在する場合、アクセス許可の検査と、 破壊 (destruction) マークがつけられていないかのチェックが行われる。
.SH 返り値
-On success, a valid shared memory identifier is returned. On errir, \-1 is
-returned, and \fIerrno\fP is set to indicate the error.
+成功の場合、有効な共有メモリ・セグメントの識別子が返される。 エラーの場合、 \-1 が返り、 \fIerror\fP にエラーを示す値が設定される。
.SH エラー
失敗した場合は \fIerrno\fP が以下のどれかに設定される:
.TP
i386 int $0x80 eax eax
ia64 break 0x100000 r15 r10/r8
parisc ble 0x100(%sr2, %r0) r20 r28
-s390 svc 0 r1 r2 NR may be passed directly with
-s390x svc 0 r1 r2 "svc NR" if NR is less than 256
+s390 svc 0 r1 r2 NR が 256 未満の場合 "svc NR" で
+s390x svc 0 r1 r2 NR が直接渡される場合がある
sparc/32 t 0x10 g1 o0
sparc/64 t 0x6d g1 o0
x86_64 syscall rax rax
\fBalloca\fP() で割り当てられた空間を \fBfree\fP(3) しようとすることのないように!
.SS "GNU 版についての注意"
-Normally, \fBgcc\fP(1) translates calls to \fBalloca\fP() with inlined code.
-This is not done when either the \fI\-ansi\fP, \fI\-std=c89\fP, \fI\-std=c99\fP, or the
-\fI\-std=c11\fP option is given \fBand\fP the header \fI<alloca.h>\fP is not
-included. Otherwise (without an \-ansi or \-std=c* option) the glibc version
-of \fI<stdlib.h>\fP includes \fI<alloca.h>\fP and that contains
-the lines:
+通常 \fBgcc\fP(1) は \fBalloca\fP() の呼び出しをインラインコードに変換する。 \fI\-ansi\fP, \fI\-std=c89\fP,
+\fI\-std=c99\fP, \fI\-std=c11\fP のいずれかのオプションが指定され、\fBかつ\fP \fI<alloca.h>\fP
+がインクルードされていない場合、 この変換は行われない。 それ以外の場合 (\-ansi オプションも \-std=c* オプションも指定されない場合)
+には、 glibc 版の \fI<stdlib.h>\fP は \fI<alloca.h>\fP
+をインクルードするが、このファイルには以下の行が含まれており、
.nf
#ifdef __GNUC__
#endif
.fi
-独自版の __builtin_alloca (size) 関数があると厄介な結果になる。
+独自版の __builtin_alloca (size) 関数がある場合、厄介な結果になる。
.LP
このコードはインライン化されているので、 この関数のアドレスを取得したり、 他のライブラリをリンクして動作を変更することはできない。
.LP
を複数の文字列に分割する点が異なる。 例えば、区切り文字 \(aq:\(aq を指定して、UNIX サーチ・パスに対して
この関数を使うことができるだろう。
.LP
-\fBargz_append\fP() appends the argz vector (\fIbuf\fP,\ buf_len\fI)\fP after
-(\fI*argz\fP,\ *argz_len\fI)\fP and updates \fI*argz\fP and \fI*argz_len\fP. (Thus,
-\fI*argz_len\fP will be increased by \fIbuf_len\fP.)
+\fBargz_append\fP() は argz vector (\fIbuf\fP,\ \fIbuf_len\fP) の後ろに (\fI*argz\fP,\ \fI*argz_len\fP) を付け加え、 \fI*argz\fP と \fI*argz_len\fP を更新する。 (したがって、 \fI*argz_len\fP は
+\fIbuf_len\fP だけ増加する。)
.LP
-\fBargz_count\fP() counts the number of strings, that is, the number of null
-bytes (\(aq\e0\(aq), in (\fIargz\fP,\ argz_len\fI).\fP
+\fBargz_count\fP() は (\fIargz\fP,\ \fIargz_len\fP) 内の文字列の数を数える。実際には NULL バイト
+(\(aq\e0\(aq) の数を数えている。
.LP
-\fBargz_create\fP() converts a UNIX\-style argument vector \fIargv\fP, terminated
-by \fI(char\ *)\ 0\fP, into an argz vector (\fI*argz\fP,\ *argz_len\fI).\fP
+\fBargz_create\fP() は、UNIX 流の引き数ベクトルである (\fI(char\ *) 0\fP で終端される) \fIargv\fP を、argz
+vector (\fI*argz\fP,\ \fI*argz_len\fP) に変換する。
.LP
-\fBargz_create_sep\fP() converts the null\-terminated string \fIstr\fP into an
-argz vector (\fI*argz\fP,\ *argz_len\fI)\fP by breaking it up at every occurrence
-of the separator \fIsep\fP.
+\fBargz_create_sep\fP() は、NULL 終端された文字列 \fIstr\fP を区切り文字 \fIsep\fP が現れる毎に分割しながら、argz
+vector (*\fIargz\fP,\ \fI*argz_len\fP) に変換する。
.LP
-\fBargz_delete\fP() removes the substring pointed to by \fIentry\fP from the argz
-vector (\fI*argz\fP,\ *argz_len\fI)\fP and updates \fI*argz\fP and \fI*argz_len\fP.
+\fBargz_delete\fP() は、 \fIentry\fP で指し示された文字列を argz vector (\fI*argz\fP,\ \fI*argz_len\fP) から削除し、 \fI*argz\fP と \fI*argz_len\fP を更新する。
.LP
-\fBargz_extract\fP() is the opposite of \fBargz_create\fP(). It takes the argz
-vector (\fIargz\fP,\ argz_len\fI)\fP and fills the array starting at \fIargv\fP with
-pointers to the substrings, and a final NULL, making a UNIX\-style argv
-vector. The array \fIargv\fP must have room for
-\fIargz_count\fP(\fIargz\fP,\fIargz_len\fP) + 1 pointers.
+\fBargz_extract\fP() は \fBargz_create\fP() の反対の操作を行う。argz vector (\fIargz\fP,\ \fIargz_len\fP) を調べ、 \fIargv\fP から始まる配列をサブ文字列へのポインタで埋めていき、 一番最後に NULL を入れて、UNIX
+流の argv ベクトルを作成する。 配列 \fIargv\fP は \fIargz_count\fP(\fIargz\fP,\fIargz_len\fP) + 1
+個のポインタを収容できる空間を持っていなければならない。
.LP
-\fBargz_insert\fP() is the opposite of \fBargz_delete\fP(). It inserts the
-argument \fIentry\fP at position \fIbefore\fP into the argz vector (\fI*argz\fP,\ *argz_len\fI)\fP and updates \fI*argz\fP and \fI*argz_len\fP. If \fIbefore\fP is NULL,
-then \fIentry\fP will inserted at the end.
+\fBargz_insert\fP() は \fBargz_delete\fP() の反対の操作を行う。argz vector (\fI*argz\fP,\ \fI*argz_len\fP) の位置 \fIbefore\fP に引き数 \fIentry\fP を挿入し、 \fI*argz\fP と \fI*argz_len\fP
+を更新する。 \fIbefore\fP が NULL の場合、 \fIentry\fP は末尾に挿入される。
.LP
\fBargz_next\fP() は argz vector を順番に調べるための関数である。 \fIentry\fP が NULL
の場合、最初のエントリを返す。 そうでない場合、次のエントリを返す。 次のエントリがない場合、NULL を返す。
\fBvoid backtrace_symbols_fd(void *const\fP \fB*\fP\fIbuffer\fP\fB,\fP \fBint\fP
\fIsize\fP\fB,\fP \fBint\fP \fIfd\fP\fB);\fP
.SH 説明
-\fBbacktrace\fP() returns a backtrace for the calling program, in the array
-pointed to by \fIbuffer\fP. A backtrace is the series of currently active
-function calls for the program. Each item in the array pointed to by
-\fIbuffer\fP is of type \fIvoid\ *\fP, and is the return address from the
-corresponding stack frame. The \fIsize\fP argument specifies the maximum
-number of addresses that can be stored in \fIbuffer\fP. If the backtrace is
-larger than \fIsize\fP, then the addresses corresponding to the \fIsize\fP most
-recent function calls are returned; to obtain the complete backtrace, make
-sure that \fIbuffer\fP and \fIsize\fP are large enough.
+\fBbacktrace\fP() は、呼び出したプログラムのバックトレースを \fIbuffer\fP が指す配列に入れて返す。バックトレースは、プログラムで
+現在動作中の関数呼び出しの並びである。 \fIbuffer\fP が指す配列の個々の要素は \fIvoid\ *\fP 型で、
+対応するスタックフレームからのリターンアドレスである。 \fIsize\fP 引き数は \fIbuffer\fP に格納できるアドレスの最大個数を指定する。
+バックトレースが \fIsize\fP より大きい場合、 \fIsize\fP 個の直近の関数呼び出しに対応するアドレスが返される。
+完全なバックトレースを取得するためには、確実に \fIbuffer\fP と \fIsize\fP が十分大きくなるようにすること。
\fBbacktrace\fP() によって \fIbuffer\fP にアドレスの集合が得られたら、 \fBbacktrace_symbols\fP()
によって、アドレス集合を、そのアドレスをシンボルで表した文字列の配列 に翻訳できる。 \fIsize\fP 引き数は \fIbuffer\fP
/usr/ / usr
usr . usr
/ / /
-. . .
-.. . ..
+\. . .
+\.. . ..
.TE
.SH 返り値
\fBdirname\fP() と \fBbasename\fP() は、いずれも NULL で終端された文字列へのポインタを返す。 (これらのポインタを
\fIsin\fP が NULL 以外で、かつ \fIsin\->sin_family\fP が \fBAF_INET\fP でなかった。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
-Before glibc 2.17, the \fBbindresvport\fP() function uses a static variable
-that is not protected, so it is not thread\-safe.
+glibc 2.17 より前のバージョンでは、 \fBbindresvport\fP()
+関数は保護されていない静的変数を使用しているため、スレッドセーフではない。
.\" commit f6da27e53695ad1cc0e2a9490358decbbfdff5e5
-Since glibc 2.17, the \fBbindresvport\fP() function uses a lock to protect
-static variable, so it is thread\-safe.
+glibc 2.17 以降では、 \fBbindresvport\fP() 関数は静的変数を保護するロックを使っており、スレッドセーフである。
.SH 準拠
POSIX.1\-2001 にはない。 BSD, Solaris およびその他の多くのシステムに存在する。
.SH 注意
\fBstrptime\fP(3) が用いる変数。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
-The \fBgetdate\fP() function is not thread\-safe.
+\fBgetdate\fP() 関数はスレッドセーフではない。
.LP
-The \fBgetdate_r\fP() function is thread\-safe.
+\fBgetdate_r\fP() 関数はスレッドセーフである。
.SH 準拠
POSIX.1\-2001.
.SH 注意
.LP
\fBgetlogin_r\fP() 関数はスレッドセーフである。
.LP
-The \fBcuserid\fP() function is thread\-safe with exceptions. It is not
-thread\-safe if called with a NULL parameter.
+\fBcuserid\fP() 関数は、例外付きのスレッドセーフである。 パラメータ NULL で呼び出した場合はスレッドセーフではない。
.SH 準拠
\fBgetlogin\fP() と \fBgetlogin_r\fP() は POSIX.1\-2001 で規定されている。
に関連するすべての値を含んでいる。 この関数を用いるプログラムは、おそらく同時に \fBprintf\fP(3) や \fBstrfmon\fP(3)
のような関数も用いるだろう。 これらの関数は、現在使用されているロケールに従った動作をする。
.SH 返り値
-The \fBlocaleconv\fP() function returns a pointer to a filled in \fIstruct
-lconv\fP. This structure may be (in glibc, \fIis\fP) statically allocated, and
-may be overwritten by subsequent calls. According to POSIX, the caller
-should not modify the contents of this structure. The \fBlocaleconv\fP()
-function always succeeds.
+\fBlocaleconv\fP() 関数は、情報が格納された \fIstruct lconv\fP へのポインタを返す。
+この構造体は静的に割り当てられる場合があり (glibc では「そうだ」)、後の呼び出しで上書きされる可能性がある。 POSIX
+では、呼び出し元はこの構造体の内容を変更すべきではないとされている。 \fBlocaleconv\fP() 関数は常に成功する。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
-The \fBlocaleconv\fP() function is not thread\-safe, since it returns a pointer
-to a structure which might be overwritten by subsequent calls.
+\fBlocaleconv\fP() 関数はスレッドセーフではない。この関数は、後の呼び出しで上書きされる可能性がある構造体へのポイントを返すからである。
.SH 準拠
C89, C99
.SH バグ
\fBgcvt\fP(3) と同じである。 引き数 \fInumber\fP が \fIlong double\fP 型である点だけが異なる。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
-The functions \fBqecvt\fP() and \fBqfcvt\fP() are not thread\-safe.
+関数 \fBqecvt\fP() と \fBqfcvt\fP() はスレッドセーフではない。
.LP
関数 \fBqgcvt\fP() はスレッドセーフである。
.SH 準拠
Publishing Company, 1981 の第 3 章 (乱数) を見よ。ここでは、 たくさんの実用的な話題についても深く網羅されている。
.SH バグ
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=15380
-According to POSIX, \fBinitstate\fP() should return NULL on error. In the
-glibc implementation, \fIerrno\fP is (as specified) set on error, but the
-function does not return NULL.
+POSIX では、エラー時に \fBinitstate\fP() は NULL を返すべきとされている。 glibc の実装では、エラー時に \fIerrno\fP
+は仕様通りに設定されるが、関数の返り値は NULL ではない。
.SH 関連項目
\fBdrand48\fP(3), \fBrand\fP(3), \fBrandom_r\fP(3), \fBsrand\fP(3)
.SH この文書について
\fBrexec_af\fP() 関数は glibc バージョン 2.9 で追加された。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
-The \fBrexec\fP() and \fBrexec_af\fP() functions are not thread\-safe.
+関数 \fBrexec\fP() と \fBrexec_af\fP() はスレッドセーフではない。
.SH 準拠
これらの関数は POSIX.1\-2001 にはない。\fBrexec\fP() 関数は 4.2BSD で始めて
登場し、BSD 系、Solaris や他の多くのシステムに存在する。\fBrexec_af\fP()
考慮してのものである (実際には、このような状況はこれまで一度も 起こっていない)。
.SH 注意
.SS "ISO\ 8601 の週・曜日表記 (Week Dates)"
-\fB%G\fP, \fB%g\fP, and \fB%V\fP yield values calculated from the week\-based year
-defined by the ISO\ 8601 standard. In this system, weeks start on a Monday,
-and are numbered from 01, for the first week, up to 52 or 53, for the last
-week. Week 1 is the first week where four or more days fall within the new
-year (or, synonymously, week 01 is: the first week of the year that contains
-a Thursday; or, the week that has 4 January in it). When three of fewer
-days of the first calendar week of the new year fall within that year, then
-the ISO 8601 week\-based system counts those days as part of week 53 of the
-preceding year. For example, 1 January 2010 is a Friday, meaning that just
-three days of that calendar week fall in 2010. Thus, the ISO\ 8601
-week\-based system considers these days to be part of week 53 (\fB%V\fP) of the
-year 2009 (\fB%G\fP); week 01 of ISO\ 8601 year 2010 starts on Monday, 4
-January 2010.
+\fB%G\fP, \fB%g\fP, \fB%V\fP は、ISO\ 8601 標準により定義された週単位表記の年により 計算される値を出力する。 ISO\ 8601
+標準の週単位表記では、週は月曜日から開始され、 週番号は、年の最初の週が 01 となり、最後の週は 52 か 53 となる。 週 01 は、新しい年が
+4 日以上含まれる最初の週である。 言い換えると、週 01 は、その年の木曜日を含む最初の週、 つまり 1 月 4 日を含む週ということである。
+新しい年のカレンダー上の最初の週に新しい年が 3 日以下しか含まれない場合、 ISO\ 8601 の週単位表記では、これらの日を前の年の週 53
+の一部とみなす。 例えば、2010 年 1 月 1 日は金曜日であり、 その週には 2010 年の日が 3 日しか含まれない。 したがって、ISO\ 8601 の週単位表記では、これらの日は 2009 年 (\fB%G\fP) の週 53 (\fB%V\fP) の一部となる。 ISO\ 8601 の 2010
+年の週 01 は 2010 年 1 月 4 日の月曜日から始まる。
.SS "glibc での注意"
.\" HP-UX and Tru64 also have features like this.
glibc では変換指定にいくつか拡張を行っている (これらの拡張は POSIX.1\-2001 には規定されていないが、
\fBPIO_FONTX\fP
Sets screen font and associated rendering information. \fIargp\fP
-points to a
+
.in +4n
.nf
.\" LinuxThreads continue appending the PID (the kernel has no easy
.\" way of telling which threading implementation the user-space
.\" application is using). -- mtk, April 2006
-In Linux versions up to and including 2.6.27, if a multithreaded process
-(or, more precisely, a process that shares its memory with another process
-by being created with the \fBCLONE_VM\fP flag of \fBclone\fP(2)) dumps core, then
-the process ID is always appended to the core filename, unless the process
-ID was already included elsewhere in the filename via a %p specification in
-\fI/proc/sys/kernel/core_pattern\fP. (This is primarily useful when employing
-the obsolete LinuxThreads implementation, where each thread of a process has
-a different PID.)
+バージョン 2.6.27 以前の Linux では、 マルチスレッドプロセス (より正確には、 \fBclone\fP(2) の \fBCLONE_VM\fP
+で生成された別プロセスとメモリを共有しているプロセス) がコアダンプを生成する場合、 コアファイル名にプロセス ID が必ず付加される。 ただし、
+\fI/proc/sys/kernel/core_pattern\fP の %p 指定によりコアファイル名のどこか他の場所にプロセス ID が
+すでに含まれている場合は、プロセス ID が末尾に付加されない。 (この機能が主に役に立つのはすでに使われなくなった LinuxThreads
+実装を利用している場合である。 LinuxThreads 実装では、プロセス内の個々のスレッドは異なるプロセス ID を持つ。)
.SH 例
以下のプログラムは \fI/proc/sys/kernel/core_pattern\fP ファイルのパイプ構文の使用例を示している。
以下のシェルのセッションはこのプログラムの使用例を示すものである (コンパイルして \fIcore_pattern_pipe_test\fP
このファイルは、System V メッセージキューに書き込まれる 1 つのメッセージの 最大バイト数を、システム全体で制限する。
.TP
\fI/proc/sys/kernel/msgmni\fP (Linux 2.4 以降)
-This file defines the system\-wide limit on the number of message queue
-identifiers.
+このファイルはメッセージキュー識別子の最大数をシステム全体で制限する。
.TP
\fI/proc/sys/kernel/msgmnb\fP
このファイルは、 \fImsg_qbytes\fP の設定を初期化するシステム全体のパラメータで
.\" SECURITY,
.\" AUTHORS sections are discouraged
.\" AUTHORS [Discouraged]
-\fBNAME\fP
-\fBSYNOPSIS\fP
-CONFIGURATION [Normally only in Section 4]
-\fBDESCRIPTION\fP
-OPTIONS [Normally only in Sections 1, 8]
-EXIT STATUS [Normally only in Sections 1, 8]
-RETURN VALUE [Normally only in Sections 2, 3]
-ERRORS [Typically only in Sections 2, 3]
-ENVIRONMENT
-FILES
-ATTRIBUTES [Normally only in Sections 2, 3]
-VERSIONS [Normally only in Sections 2, 3]
-CONFORMING TO
-NOTES
-BUGS
-EXAMPLE
-\fBSEE ALSO\fP
+\fB名前\fP
+\fB書式\fP
+設定 [通常はセクション 4 のみ]
+\fB説明\fP
+オプション [通常はセクション 1, 8 のみ]
+終了ステータス [通常はセクション 1, 8 のみ]
+返り値 [通常はセクション 2, 3 のみ]
+エラー [たいていはセクション 2, 3 のみ]
+環境変数
+ファイル
+属性 [通常はセクション 2, 3 のみ]
+バージョン [通常はセクション 2, 3 のみ]
+準拠
+注意/備考
+バグ
+例
+\fB関連項目\fP
.fi
.in
\fI/usr/local\fP が使われていることが多いだろう。
.TP
\fB属性 (ATTRIBUTES)\fP
-A summary of various attributes of the function(s) documented on this page,
-broken into subsections. The following subsections are defined:
+そのページで説明している関数の種々の属性の概要を、サブセクションに分けて説明する。以下のサブセクションが定義されている。
.sp
.RS
.TP
\fBマルチスレッディング (pthreads(7) 参照)\fP
-This subsection notes attributes relating to multithreaded applications:
+このサブセクションでは、マルチスレッドアプリケーションに関連する属性について説明する。
.RS
.IP * 3
-Whether the function is thread\-safe.
+その関数がスレッドセーフかどうか。
.IP *
-Whether the function is a cancellation point.
+その関数が取り消しポイント (cancellation point) かどうか。
.IP *
-Whether the function is async\-cancel\-safe.
+その関数が非同期で安全にキャンセルできるか (async\-cancel\-safe かどうか)。
.RE
.IP
-Details of these attributes can be found in \fBpthreads\fP(7).
+これらの属性の詳細は \fBpthreads\fP(7) で説明されている。
.RE
.TP
\fBバージョン (VERSIONS)\fP
.TP
\fBSO_PEEK_OFF\fP (Linux 3.4 以降)
.\" commit ef64a54f6e558155b4f149bb10666b9e914b6c54
-This option, which is currently supported only for \fBunix\fP(7) sockets, sets
-the value of the "peek offset" for the \fBrecv(2)\fP system call when used with
-\fBMSG_PEEK\fP flag.
+\fBMSG_PEEK\fP フラグと一緒に使用された場合 \fBrecv\fP(2) システムコールの "peek offset"
+にこのオプションの値が設定される。現在のところ、このオプションは \fBunix\fP(7) ソケットでのみサポートされている。
-When this option is set to a negative value (it is set to \-1 for all new
-sockets), traditional behavior is provided: \fBrecv(2)\fP with the \fBMSG_PEEK\fP
-flag will peek data from the front of the queue.
+このオプションが負の値に設定された場合、従来の動作となる。 つまり \fBMSG_PEEK\fP フラグが指定された \fBrecv\fP(2)
+は、キューの先頭のデータに対して peek 処理を行う (データを読み出すが、キューからデータの削除を行わない)。
+新規のソケットではこのオプションの値は必ず \-1 に設定される。
-When the option is set to a value greater than or equal to zero, then the
-next peek at data queued in the socket will occur at the byte offset
-specified by the option value. At the same time, the "peek offset" will be
-incremented by the number of bytes that were peeked from the queue, so that
-a subsequent peek will return the next data in the queue.i
+このオプションに 0 以上の値が設定されると、 そのソケットのキュー上のオプション値で指定されたバイトオフセットにあるデータが次の peek
+処理で返される。 同時に、 "peek offset" がキューから peek 処理されたバイト数だけ加算される。したがって、次の peek
+処理ではキューのその次にあるデータが返される。
-If data is removed from the front of the queue via a call to \fBrecv\fP(2) (or
-similar) without the \fBMSG_PEEK\fP flag, the "peek offset" will be decreased
-by the number of bytes removed. In other words, receiving data without the
-\fBMSG_PEEK\fP flag will cause the "peek offset" to be adjusted to maintain the
-correct relative position in the queued data, so that a subsequent peek will
-retrieve the data that would have been retrieved had the data not been
-removed.
+\fBrecv\fP(2) (や同様のシステムコール) の \fBMSG_PEEK\fP フラグなしの呼び出しでキューの先頭のデータが削除された場合、 "peek
+offset" は削除されたバイト数だけ減算される。 言い換えると、 \fBMSG_PEEK\fP フラグなしでデータを受信すると、 "peek
+offset" が指すキュー内の相対的な位置が狂わないように調整され、この後の peek では、
+データ削除が行われなかった場合に返されたのと同じ値が返されるということである。
-For datagram sockets, if the "peek offset" points to the middle of a packet,
-the data returned will be marked with the \fBMSG_TRUNC\fP flag.
+データグラムソケットでは、 "peek offset" がパケットの途中を指している場合には、 返されるデータには \fBMSG_TRUNC\fP
+フラグが付与される。
-The following example serves to illustrate the use of \fBSO_PEEK_OFF\fP.
-Suppose a stream socket has the following queued input data:
+以下の例は \fBSO_PEEK_OFF\fP の利用例を示している。ストリームソケットのキューに以下の入力データが入っているものとする。
aabbccddeeff
.IP
-The following sequence of \fBrecv\fP(2) calls would have the effect noted in
-the comments:
+以下の順序で \fBrecv\fP(2) の呼び出しを行うと、コメントに書かれた結果となる。
.in +4n
.nf