OSDN Git Service

ファミリ -> ファミリー
[linuxjm/LDP_man-pages.git] / po4a / socket / po / ja.po
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "POT-Creation-Date: 2015-01-23 22:25+0900\n"
10 "PO-Revision-Date: 2015-01-25 07:27+0900\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "Language: \n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17
18 #. type: TH
19 #: build/C/man2/accept.2:41
20 #, no-wrap
21 msgid "ACCEPT"
22 msgstr "ACCEPT"
23
24 #. type: TH
25 #: build/C/man2/accept.2:41
26 #, no-wrap
27 msgid "2010-09-10"
28 msgstr "2010-09-10"
29
30 #. type: TH
31 #: build/C/man2/accept.2:41 build/C/man2/bind.2:68 build/C/man2/connect.2:67
32 #: build/C/man2/getsockname.2:40 build/C/man2/getsockopt.2:44
33 #: build/C/man2/listen.2:45 build/C/man2/recv.2:41 build/C/man2/recvmmsg.2:31
34 #: build/C/man2/select.2:38 build/C/man2/select_tut.2:32
35 #: build/C/man2/send.2:40 build/C/man2/sendmmsg.2:28
36 #: build/C/man3/sockatmark.3:25 build/C/man2/socket.2:43
37 #: build/C/man7/socket.7:58 build/C/man2/socketcall.2:25
38 #: build/C/man2/socketpair.2:42
39 #, no-wrap
40 msgid "Linux"
41 msgstr "Linux"
42
43 #. type: TH
44 #: build/C/man2/accept.2:41 build/C/man2/bind.2:68
45 #: build/C/man3/bindresvport.3:30 build/C/man2/connect.2:67
46 #: build/C/man3/getifaddrs.3:36 build/C/man2/getsockname.2:40
47 #: build/C/man2/getsockopt.2:44 build/C/man3/if_nameindex.3:26
48 #: build/C/man3/if_nametoindex.3:25 build/C/man2/listen.2:45
49 #: build/C/man2/recv.2:41 build/C/man2/recvmmsg.2:31 build/C/man2/select.2:38
50 #: build/C/man2/select_tut.2:32 build/C/man2/send.2:40
51 #: build/C/man2/sendmmsg.2:28 build/C/man3/sockatmark.3:25
52 #: build/C/man2/socket.2:43 build/C/man7/socket.7:58
53 #: build/C/man2/socketcall.2:25 build/C/man2/socketpair.2:42
54 #, no-wrap
55 msgid "Linux Programmer's Manual"
56 msgstr "Linux Programmer's Manual"
57
58 #. type: SH
59 #: build/C/man2/accept.2:42 build/C/man2/bind.2:69
60 #: build/C/man3/bindresvport.3:31 build/C/man2/connect.2:68
61 #: build/C/man3/getifaddrs.3:37 build/C/man2/getsockname.2:41
62 #: build/C/man2/getsockopt.2:45 build/C/man3/if_nameindex.3:27
63 #: build/C/man3/if_nametoindex.3:26 build/C/man2/listen.2:46
64 #: build/C/man2/recv.2:42 build/C/man2/recvmmsg.2:32 build/C/man2/select.2:39
65 #: build/C/man2/select_tut.2:33 build/C/man2/send.2:41
66 #: build/C/man2/sendmmsg.2:29 build/C/man3/sockatmark.3:26
67 #: build/C/man2/socket.2:44 build/C/man7/socket.7:59
68 #: build/C/man2/socketcall.2:26 build/C/man2/socketpair.2:43
69 #, no-wrap
70 msgid "NAME"
71 msgstr "名前"
72
73 #. type: Plain text
74 #: build/C/man2/accept.2:44
75 msgid "accept, accept4 - accept a connection on a socket"
76 msgstr "accept, accept4 - ソケットへの接続を受ける"
77
78 #. type: SH
79 #: build/C/man2/accept.2:44 build/C/man2/bind.2:71
80 #: build/C/man3/bindresvport.3:33 build/C/man2/connect.2:70
81 #: build/C/man3/getifaddrs.3:39 build/C/man2/getsockname.2:43
82 #: build/C/man2/getsockopt.2:47 build/C/man3/if_nameindex.3:29
83 #: build/C/man3/if_nametoindex.3:29 build/C/man2/listen.2:48
84 #: build/C/man2/recv.2:44 build/C/man2/recvmmsg.2:34 build/C/man2/select.2:42
85 #: build/C/man2/select_tut.2:36 build/C/man2/send.2:43
86 #: build/C/man2/sendmmsg.2:31 build/C/man3/sockatmark.3:28
87 #: build/C/man2/socket.2:46 build/C/man7/socket.7:61
88 #: build/C/man2/socketcall.2:28 build/C/man2/socketpair.2:45
89 #, no-wrap
90 msgid "SYNOPSIS"
91 msgstr "書式"
92
93 #. type: Plain text
94 #: build/C/man2/accept.2:48 build/C/man2/bind.2:75
95 #, no-wrap
96 msgid ""
97 "B<#include E<lt>sys/types.hE<gt>>          /* See NOTES */\n"
98 "B<#include E<lt>sys/socket.hE<gt>>\n"
99 msgstr ""
100 "B<#include E<lt>sys/types.hE<gt>>          /* 「注意」参照 */\n"
101 "B<#include E<lt>sys/socket.hE<gt>>\n"
102
103 #. type: Plain text
104 #: build/C/man2/accept.2:50
105 #, no-wrap
106 msgid "B<int accept(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t *>I<addrlen>B<);>\n"
107 msgstr "B<int accept(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t *>I<addrlen>B<);>\n"
108
109 #. type: Plain text
110 #: build/C/man2/accept.2:53
111 #, no-wrap
112 msgid ""
113 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
114 "B<#include E<lt>sys/socket.hE<gt>>\n"
115 msgstr ""
116 "B<#define _GNU_SOURCE>             /* feature_test_macros(7) 参照 */\n"
117 "B<#include E<lt>sys/socket.hE<gt>>\n"
118
119 #. type: Plain text
120 #: build/C/man2/accept.2:56
121 #, no-wrap
122 msgid ""
123 "B<int accept4(int >I<sockfd>B<, struct sockaddr *>I<addr>B<,>\n"
124 "B<            socklen_t *>I<addrlen>B<, int >I<flags>B<);>\n"
125 msgstr ""
126 "B<int accept4(int >I<sockfd>B<, struct sockaddr *>I<addr>B<,>\n"
127 "B<            socklen_t *>I<addrlen>B<, int >I<flags>B<);>\n"
128
129 #. type: SH
130 #: build/C/man2/accept.2:57 build/C/man2/bind.2:79
131 #: build/C/man3/bindresvport.3:40 build/C/man2/connect.2:79
132 #: build/C/man3/getifaddrs.3:48 build/C/man2/getsockname.2:50
133 #: build/C/man2/getsockopt.2:58 build/C/man3/if_nameindex.3:36
134 #: build/C/man3/if_nametoindex.3:37 build/C/man2/listen.2:56
135 #: build/C/man2/recv.2:59 build/C/man2/recvmmsg.2:44 build/C/man2/select.2:81
136 #: build/C/man2/select_tut.2:75 build/C/man2/send.2:58
137 #: build/C/man2/sendmmsg.2:40 build/C/man3/sockatmark.3:42
138 #: build/C/man2/socket.2:52 build/C/man7/socket.7:65
139 #: build/C/man2/socketcall.2:30 build/C/man2/socketpair.2:52
140 #, no-wrap
141 msgid "DESCRIPTION"
142 msgstr "説明"
143
144 #. type: Plain text
145 #: build/C/man2/accept.2:72
146 msgid "The B<accept>()  system call is used with connection-based socket types (B<SOCK_STREAM>, B<SOCK_SEQPACKET>).  It extracts the first connection request on the queue of pending connections for the listening socket, I<sockfd>, creates a new connected socket, and returns a new file descriptor referring to that socket.  The newly created socket is not in the listening state.  The original socket I<sockfd> is unaffected by this call."
147 msgstr "B<accept>()  システムコールは、接続指向のソケット型 (B<SOCK_STREAM>, B<SOCK_SEQPACKET>)  で用いられる。 この関数は、接続待ちソケット I<socket> 宛ての保留状態の接続要求が入っているキューから 先頭の接続要求を取り出し、接続済みソケットを新規に生成し、 そのソケットを参照する新しいファイルディスクリプターを返す。 新規に生成されたソケットは、接続待ち (listen) 状態ではない。 もともとのソケット I<sockfd> はこの呼び出しによって影響を受けない。"
148
149 #. type: Plain text
150 #: build/C/man2/accept.2:81
151 msgid "The argument I<sockfd> is a socket that has been created with B<socket>(2), bound to a local address with B<bind>(2), and is listening for connections after a B<listen>(2)."
152 msgstr "引き数 I<sockfd> は、 B<socket>(2)  によって生成され、 B<bind>(2)  によってローカルアドレスにバインドされ、 B<listen>(2)  を経て接続を待っているソケットである。"
153
154 #. type: Plain text
155 #: build/C/man2/accept.2:99
156 msgid "The argument I<addr> is a pointer to a I<sockaddr> structure.  This structure is filled in with the address of the peer socket, as known to the communications layer.  The exact format of the address returned I<addr> is determined by the socket's address family (see B<socket>(2)  and the respective protocol man pages).  When I<addr> is NULL, nothing is filled in; in this case, I<addrlen> is not used, and should also be NULL."
157 msgstr "I<addr> 引き数は I<sockaddr> 構造体へのポインターである。 この構造体には接続相手のソケットのアドレスが入っている。 I<addr> 引き数で返されるアドレスの正確なフォーマットは、 ソケットのアドレス種別によって変わる (B<socket>(2)  およびそれぞれのプロトコルの man ページを参照)。 I<addr> が NULL の場合、 I<addr> には何も入らない。この場合、 I<addrlen> は使用されず、この引き数は NULL にしておくべきである。"
158
159 #. type: Plain text
160 #: build/C/man2/accept.2:107
161 msgid "The I<addrlen> argument is a value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by I<addr>; on return it will contain the actual size of the peer address."
162 msgstr "I<addrlen> 引き数は入出力両用の引き数である。呼び出し時には、呼び出し元が I<addr> が指す構造体のサイズ (バイト単位) で初期化しておかなければならない。 返ってくる時には、接続相手のアドレスの実際の大きさが格納される。"
163
164 #. type: Plain text
165 #: build/C/man2/accept.2:112 build/C/man2/getsockname.2:67
166 msgid "The returned address is truncated if the buffer provided is too small; in this case, I<addrlen> will return a value greater than was supplied to the call."
167 msgstr ""
168 "渡されたバッファーが小さ過ぎた場合は、返されるアドレスの末尾が切り詰められる。\n"
169 "この場合には、 I<addrlen> には、呼び出し時に指定された値よりも大きな値が格納される。"
170
171 #. type: Plain text
172 #: build/C/man2/accept.2:125
173 msgid "If no pending connections are present on the queue, and the socket is not marked as nonblocking, B<accept>()  blocks the caller until a connection is present.  If the socket is marked nonblocking and no pending connections are present on the queue, B<accept>()  fails with the error B<EAGAIN> or B<EWOULDBLOCK>."
174 msgstr "キューに保留となっている接続要求がなく、 かつソケットが非停止になっていないときは、 B<accept>()  は接続が発生するまで呼び出し元を停止 (block) する。 ソケットが非停止になっていて、 待ち状態の接続要求がキューに無いときは、 B<accept>()  はエラー B<EAGAIN> か B<EWOULDBLOCK> で失敗する。"
175
176 #. type: Plain text
177 #: build/C/man2/accept.2:139
178 msgid "In order to be notified of incoming connections on a socket, you can use B<select>(2)  or B<poll>(2).  A readable event will be delivered when a new connection is attempted and you may then call B<accept>()  to get a socket for that connection.  Alternatively, you can set the socket to deliver B<SIGIO> when activity occurs on a socket; see B<socket>(7)  for details."
179 msgstr "ソケットへの接続到着を知るには、 B<select>(2)  または B<poll>(2)  を用いればよい。 新しい接続要求が来るとソケットは読み込み可能になるので、 そうしたら B<accept>()  を呼んでその接続に対するソケットを取得すればよい。 あるいはソケットに設定を行い、何らかのアクションがあったときに B<SIGIO> を配送 (deliver) させるようにすることもできる。詳細は B<socket>(7)  を参照のこと。"
180
181 #. type: Plain text
182 #: build/C/man2/accept.2:152
183 msgid "For certain protocols which require an explicit confirmation, such as DECNet, B<accept>()  can be thought of as merely dequeuing the next connection request and not implying confirmation.  Confirmation can be implied by a normal read or write on the new file descriptor, and rejection can be implied by closing the new socket.  Currently only DECNet has these semantics on Linux."
184 msgstr "明示的な接続確認 (confirmation) を必要とするようなプロトコル (DECNet など) では、 B<accept>()  は単に次の接続要求をキューから取り出すだけであり、 接続確認は行わないことに注意せよ。接続確認は、 新しいファイルディスクリプターに対する 通常の読み取り/書き込みによってなされ、接続拒否 (rejection)  は新しいソケットをクローズすることによってなされる。 現在のところ、 Linux 上でこれらのセマンティクスを持つのは DECNet だけである。"
185
186 #. type: Plain text
187 #: build/C/man2/accept.2:162
188 msgid "If I<flags> is 0, then B<accept4>()  is the same as B<accept>().  The following values can be bitwise ORed in I<flags> to obtain different behavior:"
189 msgstr "I<flags> が 0 の場合、 B<accept4>()  は B<accept>()  と同じである。 I<flags> に以下の値をビット毎の論理和 (OR) で指定することで、 異なる動作をさせることができる。"
190
191 #. type: TP
192 #: build/C/man2/accept.2:162 build/C/man2/socket.2:160
193 #, no-wrap
194 msgid "B<SOCK_NONBLOCK>"
195 msgstr "B<SOCK_NONBLOCK>"
196
197 #. type: Plain text
198 #: build/C/man2/accept.2:170 build/C/man2/socket.2:168
199 msgid "Set the B<O_NONBLOCK> file status flag on the new open file description.  Using this flag saves extra calls to B<fcntl>(2)  to achieve the same result."
200 msgstr "新しく生成されるオープンファイル記述 (open file description) の B<O_NONBLOCK> ファイルステータスフラグをセットする。 このフラグを使うことで、 B<O_NONBLOCK> をセットするために B<fcntl>(2)  を追加で呼び出す必要がなくなる。"
201
202 #. type: TP
203 #: build/C/man2/accept.2:170 build/C/man2/socket.2:168
204 #, no-wrap
205 msgid "B<SOCK_CLOEXEC>"
206 msgstr "B<SOCK_CLOEXEC>"
207
208 #. type: Plain text
209 #: build/C/man2/accept.2:180 build/C/man2/socket.2:178
210 msgid "Set the close-on-exec (B<FD_CLOEXEC>)  flag on the new file descriptor.  See the description of the B<O_CLOEXEC> flag in B<open>(2)  for reasons why this may be useful."
211 msgstr "新しいファイルディスクリプターに対して close-on-exec (B<FD_CLOEXEC>)  フラグをセットする。 このフラグが役に立つ理由については、 B<open>(2)  の B<O_CLOEXEC> フラグの説明を参照のこと。"
212
213 #. type: SH
214 #: build/C/man2/accept.2:180 build/C/man2/bind.2:152
215 #: build/C/man3/bindresvport.3:67 build/C/man2/connect.2:127
216 #: build/C/man3/getifaddrs.3:142 build/C/man2/getsockname.2:67
217 #: build/C/man2/getsockopt.2:131 build/C/man3/if_nameindex.3:71
218 #: build/C/man3/if_nametoindex.3:54 build/C/man2/listen.2:82
219 #: build/C/man2/recv.2:408 build/C/man2/recvmmsg.2:148
220 #: build/C/man2/select.2:300 build/C/man2/select_tut.2:485
221 #: build/C/man2/send.2:294 build/C/man2/sendmmsg.2:119
222 #: build/C/man3/sockatmark.3:51 build/C/man2/socket.2:310
223 #: build/C/man2/socketpair.2:69
224 #, no-wrap
225 msgid "RETURN VALUE"
226 msgstr "返り値"
227
228 #. type: Plain text
229 #: build/C/man2/accept.2:187
230 msgid "On success, these system calls return a nonnegative integer that is a descriptor for the accepted socket.  On error, -1 is returned, and I<errno> is set appropriately."
231 msgstr "成功した場合、これらのシステムコールは 受け付けたソケットのディスクリプターである非負の整数値を返す。 エラーが発生した場合は -1 を返し、 I<errno> を適切に設定する。"
232
233 #. type: SS
234 #: build/C/man2/accept.2:187
235 #, no-wrap
236 msgid "Error handling"
237 msgstr "エラー処理"
238
239 #. type: Plain text
240 #: build/C/man2/accept.2:214
241 msgid "Linux B<accept>()  (and B<accept4>())  passes already-pending network errors on the new socket as an error code from B<accept>().  This behavior differs from other BSD socket implementations.  For reliable operation the application should detect the network errors defined for the protocol after B<accept>()  and treat them like B<EAGAIN> by retrying.  In the case of TCP/IP, these are B<ENETDOWN>, B<EPROTO>, B<ENOPROTOOPT>, B<EHOSTDOWN>, B<ENONET>, B<EHOSTUNREACH>, B<EOPNOTSUPP>, and B<ENETUNREACH>."
242 msgstr "Linux の B<accept>()  (と B<accept4>())  は、新しいソケットにおける、発生済みのネットワークエラーを B<accept>()  からのエラーコードとして渡す。 この振舞いは BSD ソケットの実装とは異なる。 信頼性の高い動作を行うためには、 アプリケーションはプロトコルで定義されているネットワークエラーの検知を B<accept>()  のあとに行い、それらのエラーを B<EAGAIN> と同じように扱い、再試行 (retry) を行うべきである。 TCP/IP では、以下のエラーが該当する: B<ENETDOWN>, B<EPROTO>, B<ENOPROTOOPT>, B<EHOSTDOWN>, B<ENONET>, B<EHOSTUNREACH>, B<EOPNOTSUPP>, B<ENETUNREACH>"
243
244 #. type: SH
245 #: build/C/man2/accept.2:214 build/C/man2/bind.2:157
246 #: build/C/man3/bindresvport.3:72 build/C/man2/connect.2:132
247 #: build/C/man3/getifaddrs.3:149 build/C/man2/getsockname.2:72
248 #: build/C/man2/getsockopt.2:136 build/C/man3/if_nameindex.3:78
249 #: build/C/man3/if_nametoindex.3:69 build/C/man2/listen.2:87
250 #: build/C/man2/recv.2:424 build/C/man2/recvmmsg.2:156
251 #: build/C/man2/select.2:318 build/C/man2/send.2:299
252 #: build/C/man2/sendmmsg.2:133 build/C/man3/sockatmark.3:58
253 #: build/C/man2/socket.2:315 build/C/man2/socketpair.2:74
254 #, no-wrap
255 msgid "ERRORS"
256 msgstr "エラー"
257
258 #. type: TP
259 #: build/C/man2/accept.2:215 build/C/man2/recv.2:429 build/C/man2/send.2:315
260 #, no-wrap
261 msgid "B<EAGAIN> or B<EWOULDBLOCK>"
262 msgstr "B<EAGAIN> または B<EWOULDBLOCK>"
263
264 #.  Actually EAGAIN on Linux
265 #. type: Plain text
266 #: build/C/man2/accept.2:223
267 msgid "The socket is marked nonblocking and no connections are present to be accepted.  POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities."
268 msgstr "ソケットが非停止になっていて、 かつ受付け対象の接続が存在しない。 POSIX.1-2001 は、この場合にどちらのエラーを返すことも認めており、 これら 2 つの定数が同じ値を持つことも求めていない。 したがって、移植性が必要なアプリケーションでは、両方の可能性を 確認すべきである。"
269
270 #. type: TP
271 #: build/C/man2/accept.2:223 build/C/man2/bind.2:176
272 #: build/C/man2/connect.2:176 build/C/man2/getsockname.2:73
273 #: build/C/man2/getsockopt.2:137 build/C/man2/listen.2:104
274 #: build/C/man2/recv.2:438 build/C/man2/select.2:319 build/C/man2/send.2:336
275 #: build/C/man3/sockatmark.3:59
276 #, no-wrap
277 msgid "B<EBADF>"
278 msgstr "B<EBADF>"
279
280 #. type: Plain text
281 #: build/C/man2/accept.2:226
282 msgid "The descriptor is invalid."
283 msgstr "ディスクリプターが不正。"
284
285 #. type: TP
286 #: build/C/man2/accept.2:226
287 #, no-wrap
288 msgid "B<ECONNABORTED>"
289 msgstr "B<ECONNABORTED>"
290
291 #. type: Plain text
292 #: build/C/man2/accept.2:229
293 msgid "A connection has been aborted."
294 msgstr "接続が中止された。"
295
296 #. type: TP
297 #: build/C/man2/accept.2:229 build/C/man2/bind.2:208
298 #: build/C/man2/connect.2:182 build/C/man2/getsockname.2:78
299 #: build/C/man2/getsockopt.2:142 build/C/man2/recv.2:447
300 #: build/C/man2/send.2:345 build/C/man2/socketpair.2:78
301 #, no-wrap
302 msgid "B<EFAULT>"
303 msgstr "B<EFAULT>"
304
305 #. type: Plain text
306 #: build/C/man2/accept.2:234
307 msgid "The I<addr> argument is not in a writable part of the user address space."
308 msgstr "I<addr> 引き数がユーザーアドレス空間の書き込み可能領域にない。"
309
310 #. type: TP
311 #: build/C/man2/accept.2:234 build/C/man2/connect.2:210
312 #: build/C/man2/recv.2:451 build/C/man2/select.2:324 build/C/man2/send.2:348
313 #, no-wrap
314 msgid "B<EINTR>"
315 msgstr "B<EINTR>"
316
317 #. type: Plain text
318 #: build/C/man2/accept.2:239
319 msgid "The system call was interrupted by a signal that was caught before a valid connection arrived; see B<signal>(7)."
320 msgstr "有効な接続が到着する前に捕捉されたシグナルによって システムコールが中断された。 B<signal>(7)  参照。"
321
322 #. type: TP
323 #: build/C/man2/accept.2:239 build/C/man2/accept.2:244 build/C/man2/bind.2:180
324 #: build/C/man2/bind.2:185 build/C/man2/getsockname.2:84
325 #: build/C/man2/getsockopt.2:152 build/C/man2/recv.2:456
326 #: build/C/man2/recvmmsg.2:160 build/C/man2/select.2:328
327 #: build/C/man2/select.2:335 build/C/man2/send.2:352
328 #: build/C/man3/sockatmark.3:63 build/C/man2/socket.2:323
329 #: build/C/man2/socket.2:326
330 #, no-wrap
331 msgid "B<EINVAL>"
332 msgstr "B<EINVAL>"
333
334 #. type: Plain text
335 #: build/C/man2/accept.2:244
336 msgid "Socket is not listening for connections, or I<addrlen> is invalid (e.g., is negative)."
337 msgstr "ソケットが接続待ち状態ではない。もしくは、 I<addrlen> が不正である (例えば、負の場合など)。"
338
339 #. type: Plain text
340 #: build/C/man2/accept.2:249
341 msgid "(B<accept4>())  invalid value in I<flags>."
342 msgstr "(B<accept4>())  I<flags> に不正な値が指定されている。"
343
344 #. type: TP
345 #: build/C/man2/accept.2:249 build/C/man2/socket.2:331
346 #: build/C/man2/socketpair.2:83
347 #, no-wrap
348 msgid "B<EMFILE>"
349 msgstr "B<EMFILE>"
350
351 #. type: Plain text
352 #: build/C/man2/accept.2:252
353 msgid "The per-process limit of open file descriptors has been reached."
354 msgstr "1プロセスがオープンできるファイルディスクリプター数の上限に達した。"
355
356 #. type: TP
357 #: build/C/man2/accept.2:252 build/C/man2/socket.2:334
358 #: build/C/man2/socketpair.2:86
359 #, no-wrap
360 msgid "B<ENFILE>"
361 msgstr "B<ENFILE>"
362
363 #. type: Plain text
364 #: build/C/man2/accept.2:255 build/C/man2/socket.2:337
365 #: build/C/man2/socketpair.2:89
366 msgid "The system limit on the total number of open files has been reached."
367 msgstr "オープンされたファイルの総数がシステム全体の上限に達していた。"
368
369 #. type: TP
370 #: build/C/man2/accept.2:255
371 #, no-wrap
372 msgid "B<ENOBUFS>, B<ENOMEM>"
373 msgstr "B<ENOBUFS>, B<ENOMEM>"
374
375 #. type: Plain text
376 #: build/C/man2/accept.2:260
377 msgid "Not enough free memory.  This often means that the memory allocation is limited by the socket buffer limits, not by the system memory."
378 msgstr "メモリーが足りない。 多くの場合は、システムメモリーが足りないわけではなく、 ソケットバッファーの大きさによるメモリー割り当ての制限である。"
379
380 #. type: TP
381 #: build/C/man2/accept.2:260 build/C/man2/bind.2:191
382 #: build/C/man2/connect.2:222 build/C/man2/getsockname.2:92
383 #: build/C/man2/getsockopt.2:166 build/C/man2/listen.2:109
384 #: build/C/man2/recv.2:471 build/C/man2/send.2:381
385 #, no-wrap
386 msgid "B<ENOTSOCK>"
387 msgstr "B<ENOTSOCK>"
388
389 #. type: Plain text
390 #: build/C/man2/accept.2:263
391 msgid "The descriptor references a file, not a socket."
392 msgstr "ディスクリプターはソケットではなくファイルを参照している。"
393
394 #. type: TP
395 #: build/C/man2/accept.2:263 build/C/man2/listen.2:114 build/C/man2/send.2:386
396 #: build/C/man2/socketpair.2:89
397 #, no-wrap
398 msgid "B<EOPNOTSUPP>"
399 msgstr "B<EOPNOTSUPP>"
400
401 #. type: Plain text
402 #: build/C/man2/accept.2:267
403 msgid "The referenced socket is not of type B<SOCK_STREAM>."
404 msgstr "参照しているソケットの型が B<SOCK_STREAM> でない。"
405
406 #. type: TP
407 #: build/C/man2/accept.2:267
408 #, no-wrap
409 msgid "B<EPROTO>"
410 msgstr "B<EPROTO>"
411
412 #. type: Plain text
413 #: build/C/man2/accept.2:270
414 msgid "Protocol error."
415 msgstr "プロトコルエラー。"
416
417 #. type: Plain text
418 #: build/C/man2/accept.2:274
419 msgid "In addition, Linux B<accept>()  may fail if:"
420 msgstr "上記に加えて、Linux の B<accept>()  は以下のエラーで失敗する:"
421
422 #. type: TP
423 #: build/C/man2/accept.2:274
424 #, no-wrap
425 msgid "B<EPERM>"
426 msgstr "B<EPERM>"
427
428 #. type: Plain text
429 #: build/C/man2/accept.2:277
430 msgid "Firewall rules forbid connection."
431 msgstr "ファイアウォールのルールにより接続が禁止された。"
432
433 #. type: Plain text
434 #: build/C/man2/accept.2:289
435 msgid "In addition, network errors for the new socket and as defined for the protocol may be returned.  Various Linux kernels can return other errors such as B<ENOSR>, B<ESOCKTNOSUPPORT>, B<EPROTONOSUPPORT>, B<ETIMEDOUT>.  The value B<ERESTARTSYS> may be seen during a trace."
436 msgstr "この他に、新しいソケットに対するネットワークエラーが返されることもある。 これらはそれぞれのプロトコルで定義されている。 いろいろな Linux カーネルでは、 以下に示すようなエラーを返すこともある。 B<ENOSR>, B<ESOCKTNOSUPPORT>, B<EPROTONOSUPPORT>, B<ETIMEDOUT>.  B<ERESTARTSYS> がトレースの最中に現れることもある。"
437
438 #. type: SH
439 #: build/C/man2/accept.2:289 build/C/man3/getifaddrs.3:162
440 #: build/C/man3/if_nameindex.3:97 build/C/man2/recvmmsg.2:164
441 #: build/C/man2/select.2:343 build/C/man2/sendmmsg.2:145
442 #: build/C/man3/sockatmark.3:70 build/C/man7/socket.7:915
443 #, no-wrap
444 msgid "VERSIONS"
445 msgstr "バージョン"
446
447 #. type: Plain text
448 #: build/C/man2/accept.2:294
449 msgid "The B<accept4>()  system call is available starting with Linux 2.6.28; support in glibc is available starting with version 2.10."
450 msgstr "B<accept4>()  システムコールは Linux 2.6.28 以降で利用可能である。 glibc でのサポートはバージョン 2.10 以降で利用可能である。"
451
452 #. type: SH
453 #: build/C/man2/accept.2:294 build/C/man2/bind.2:232
454 #: build/C/man3/bindresvport.3:104 build/C/man2/connect.2:237
455 #: build/C/man3/getifaddrs.3:170 build/C/man2/getsockname.2:97
456 #: build/C/man2/getsockopt.2:171 build/C/man3/if_nameindex.3:104
457 #: build/C/man3/if_nametoindex.3:92 build/C/man2/listen.2:119
458 #: build/C/man2/recv.2:476 build/C/man2/recvmmsg.2:169
459 #: build/C/man2/select.2:349 build/C/man2/send.2:400
460 #: build/C/man2/sendmmsg.2:150 build/C/man3/sockatmark.3:78
461 #: build/C/man2/socket.2:348 build/C/man2/socketcall.2:42
462 #: build/C/man2/socketpair.2:95
463 #, no-wrap
464 msgid "CONFORMING TO"
465 msgstr "準拠"
466
467 #.  The BSD man page documents five possible error returns
468 #.  (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
469 #.  POSIX.1-2001 documents errors
470 #.  EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
471 #.  ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK.
472 #.  In addition, SUSv2 documents EFAULT and ENOSR.
473 #. type: Plain text
474 #: build/C/man2/accept.2:306
475 msgid "B<accept>(): POSIX.1-2001, SVr4, 4.4BSD, (B<accept>()  first appeared in 4.2BSD)."
476 msgstr "B<accept>(): POSIX.1-2001, SVr4, 4.4BSD, (B<accept>()  は 4.2BSD で初めて実装された)."
477
478 #. type: Plain text
479 #: build/C/man2/accept.2:309
480 msgid "B<accept4>()  is a nonstandard Linux extension."
481 msgstr "B<accept4>()  は非標準の Linux による拡張である。"
482
483 #.  Some testing seems to show that Tru64 5.1 and HP-UX 11 also
484 #.  do not inherit file status flags -- MTK Jun 05
485 #. type: Plain text
486 #: build/C/man2/accept.2:324
487 msgid "On Linux, the new socket returned by B<accept>()  does I<not> inherit file status flags such as B<O_NONBLOCK> and B<O_ASYNC> from the listening socket.  This behavior differs from the canonical BSD sockets implementation.  Portable programs should not rely on inheritance or noninheritance of file status flags and always explicitly set all required flags on the socket returned from B<accept>()."
488 msgstr "Linux では、 B<accept>()  が返す新しいソケットは listen を行っているソケットの ファイル状態フラグ (B<O_NONBLOCK> や B<O_ASYNC> など) を継承「しない」。 この動作は標準的な BSD ソケットの実装とは異なっている。 移植性を考慮したプログラムではファイル状態フラグが継承されるかどうかは 前提にせず、常に B<accept>()  が返したソケットに対して全ての必要なフラグを明示的に設定するように すべきである。"
489
490 #. type: SH
491 #: build/C/man2/accept.2:324 build/C/man2/bind.2:244
492 #: build/C/man3/bindresvport.3:107 build/C/man2/connect.2:253
493 #: build/C/man3/getifaddrs.3:190 build/C/man2/getsockname.2:103
494 #: build/C/man2/getsockopt.2:178 build/C/man2/listen.2:124
495 #: build/C/man2/recv.2:486 build/C/man2/select.2:364
496 #: build/C/man2/select_tut.2:503 build/C/man2/send.2:414
497 #: build/C/man2/sendmmsg.2:153 build/C/man3/sockatmark.3:80
498 #: build/C/man2/socket.2:362 build/C/man7/socket.7:929
499 #: build/C/man2/socketcall.2:45 build/C/man2/socketpair.2:103
500 #, no-wrap
501 msgid "NOTES"
502 msgstr "注意"
503
504 #. type: Plain text
505 #: build/C/man2/accept.2:330 build/C/man2/bind.2:250
506 #: build/C/man2/connect.2:259 build/C/man2/getsockopt.2:184
507 #: build/C/man2/listen.2:150 build/C/man2/socket.2:368
508 #: build/C/man2/socketpair.2:124
509 msgid "POSIX.1-2001 does not require the inclusion of I<E<lt>sys/types.hE<gt>>, and this header file is not required on Linux.  However, some historical (BSD) implementations required this header file, and portable applications are probably wise to include it."
510 msgstr "POSIX.1-2001 では I<E<lt>sys/types.hE<gt>> のインクルードは必須とされておらず、 Linux ではこのヘッダファイルは必要ではない。 しかし、歴史的には、いくつかの実装 (BSD 系) でこのヘッダファイルが 必要であり、移植性が必要なアプリケーションではこのファイルを インクルードするのが賢明であろう。"
511
512 #. type: Plain text
513 #: build/C/man2/accept.2:351
514 msgid "There may not always be a connection waiting after a B<SIGIO> is delivered or B<select>(2)  or B<poll>(2)  return a readability event because the connection might have been removed by an asynchronous network error or another thread before B<accept>()  is called.  If this happens, then the call will block waiting for the next connection to arrive.  To ensure that B<accept>()  never blocks, the passed socket I<sockfd> needs to have the B<O_NONBLOCK> flag set (see B<socket>(7))."
515 msgstr "B<SIGIO> が届けられた後や、 B<select>(2)  または B<poll>(2)  が読み込み可能イベントを返した後に、 必ずしも待機中の接続があるとは限らない。 なぜならその接続は、 B<accept>()  が呼ばれる前に、非同期的なネットワークエラーや 他のスレッドから呼ばれた (別の) accept によって 削除されているかもしれないからである。 この場合、その B<accept>()  呼び出しは停止 (block) し、次の接続の到着を待ちつづける。 B<accept>()  に停止を行わせないようにするには、引き数に渡すソケット I<sockfd> に B<O_NONBLOCK> フラグをセットしておく必要がある (B<socket>(7)  を見よ)。"
516
517 #. type: SS
518 #: build/C/man2/accept.2:351
519 #, no-wrap
520 msgid "The socklen_t type"
521 msgstr "socklen_t 型"
522
523 #. type: Plain text
524 #: build/C/man2/accept.2:361
525 msgid "The third argument of B<accept>()  was originally declared as an I<int *> (and is that under libc4 and libc5 and on many other systems like 4.x BSD, SunOS 4, SGI); a POSIX.1g draft standard wanted to change it into a I<size_t *>, and that is what it is for SunOS 5.  Later POSIX drafts have I<socklen_t *>, and so do the Single UNIX Specification and glibc2.  Quoting Linus Torvalds:"
526 msgstr "B<accept>()  の第 3 引き数は、もともと I<int *> と宣言されていた (libc4 や libc5, 4.x BSD, SunOS 4, SGI など多くのシステムではそうなっている)。 POSIX.1g draft 標準は、 これを I<size_t *> に変更しようとし、SunOS 5 ではそう宣言されている。 後に POSIX drafts には I<socklen_t *> が含まれるようになり、 Single UNIX Specification や glibc2 ではこのように宣言されるようになった。 Linus Torvald の発言を引用する:"
527
528 #.  .I fails: only italicizes a single line
529 #. type: Plain text
530 #: build/C/man2/accept.2:378
531 msgid "\"_Any_ sane library _must_ have \"socklen_t\" be the same size as int.  Anything else breaks any BSD socket layer stuff.  POSIX initially I<did> make it a size_t, and I (and hopefully others, but obviously not too many) complained to them very loudly indeed.  Making it a size_t is completely broken, exactly because size_t very seldom is the same size as \"int\" on 64-bit architectures, for example.  And it I<has> to be the same size as \"int\" because that's what the BSD socket interface is.  Anyway, the POSIX people eventually got a clue, and created \"socklen_t\".  They shouldn't have touched it in the first place, but once they did they felt it had to have a named type for some unfathomable reason (probably somebody didn't like losing face over having done the original stupid thing, so they silently just renamed their blunder).\""
532 msgstr "「まともなライブラリを作りたければ、 \"socklen_t\" のサイズは int と同じにしなきゃならない。 さもないと BSD ソケット層を破壊することになっちゃう。 POSIX は最初こいつを size_t にしたんで、 ぼくは彼らに文句をがなりたてた (多分そういう人は他にもいたと思う。多くはなかったようだけど)。 こいつを size_t にするのは完全にいかれてる。 例えば 64 ビットアーキテクチャーでは、 size_t が \"int\" と同じサイズだなんてことはほとんどないからね。 このサイズは \"int\" と 同じでなきゃ『ダメ』なんだ。 BSD ソケットインターフェースっていうのはそういうものなんだから。 まあともかく POSIX の人たちも、 \"socklen_t\" を作るという解決策をなんとかひねり出した。 そもそも最初から放っておけば良かったんだが、 いじっちゃった以上、 名前付きの型を持たせなきゃならない、と思ったみたいだね。 なんでかはわかんないけど (きっと最初にやっちまった馬鹿な間違いで顔をつぶしたくなかったから、 こっそり名前を付け替えて自分たちの大失敗をごまかそうとしたんだろう)。」"
533
534 #. type: SH
535 #: build/C/man2/accept.2:378 build/C/man2/bind.2:264
536 #: build/C/man2/connect.2:276 build/C/man3/getifaddrs.3:207
537 #: build/C/man3/if_nameindex.3:108 build/C/man2/listen.2:179
538 #: build/C/man2/recv.2:511 build/C/man2/recvmmsg.2:172
539 #: build/C/man2/select.2:555 build/C/man2/select_tut.2:529
540 #: build/C/man2/send.2:438 build/C/man2/sendmmsg.2:168
541 #: build/C/man3/sockatmark.3:104 build/C/man2/socket.2:381
542 #, no-wrap
543 msgid "EXAMPLE"
544 msgstr "例"
545
546 #. type: Plain text
547 #: build/C/man2/accept.2:381 build/C/man2/listen.2:182
548 msgid "See B<bind>(2)."
549 msgstr "B<bind>(2)  参照。"
550
551 #. type: SH
552 #: build/C/man2/accept.2:381 build/C/man2/bind.2:329
553 #: build/C/man3/bindresvport.3:113 build/C/man2/connect.2:281
554 #: build/C/man3/getifaddrs.3:309 build/C/man2/getsockname.2:114
555 #: build/C/man2/getsockopt.2:202 build/C/man3/if_nameindex.3:147
556 #: build/C/man3/if_nametoindex.3:96 build/C/man2/listen.2:182
557 #: build/C/man2/recv.2:516 build/C/man2/recvmmsg.2:278
558 #: build/C/man2/select.2:592 build/C/man2/select_tut.2:821
559 #: build/C/man2/send.2:443 build/C/man2/sendmmsg.2:236
560 #: build/C/man3/sockatmark.3:139 build/C/man2/socket.2:386
561 #: build/C/man7/socket.7:960 build/C/man2/socketcall.2:53
562 #: build/C/man2/socketpair.2:124
563 #, no-wrap
564 msgid "SEE ALSO"
565 msgstr "関連項目"
566
567 #. type: Plain text
568 #: build/C/man2/accept.2:388
569 msgid "B<bind>(2), B<connect>(2), B<listen>(2), B<select>(2), B<socket>(2), B<socket>(7)"
570 msgstr "B<bind>(2), B<connect>(2), B<listen>(2), B<select>(2), B<socket>(2), B<socket>(7)"
571
572 #. type: SH
573 #: build/C/man2/accept.2:388 build/C/man2/bind.2:342
574 #: build/C/man3/bindresvport.3:116 build/C/man2/connect.2:288
575 #: build/C/man3/getifaddrs.3:315 build/C/man2/getsockname.2:121
576 #: build/C/man2/getsockopt.2:213 build/C/man3/if_nameindex.3:154
577 #: build/C/man3/if_nametoindex.3:100 build/C/man2/listen.2:188
578 #: build/C/man2/recv.2:527 build/C/man2/recvmmsg.2:285
579 #: build/C/man2/select.2:607 build/C/man2/select_tut.2:840
580 #: build/C/man2/send.2:458 build/C/man2/sendmmsg.2:241
581 #: build/C/man3/sockatmark.3:144 build/C/man2/socket.2:415
582 #: build/C/man7/socket.7:972 build/C/man2/socketcall.2:71
583 #: build/C/man2/socketpair.2:131
584 #, no-wrap
585 msgid "COLOPHON"
586 msgstr "この文書について"
587
588 #. type: Plain text
589 #: build/C/man2/accept.2:396 build/C/man2/bind.2:350
590 #: build/C/man3/bindresvport.3:124 build/C/man2/connect.2:296
591 #: build/C/man3/getifaddrs.3:323 build/C/man2/getsockname.2:129
592 #: build/C/man2/getsockopt.2:221 build/C/man3/if_nameindex.3:162
593 #: build/C/man3/if_nametoindex.3:108 build/C/man2/listen.2:196
594 #: build/C/man2/recv.2:535 build/C/man2/recvmmsg.2:293
595 #: build/C/man2/select.2:615 build/C/man2/select_tut.2:848
596 #: build/C/man2/send.2:466 build/C/man2/sendmmsg.2:249
597 #: build/C/man3/sockatmark.3:152 build/C/man2/socket.2:423
598 #: build/C/man7/socket.7:980 build/C/man2/socketcall.2:79
599 #: build/C/man2/socketpair.2:139
600 msgid "This page is part of release 3.78 of the Linux I<man-pages> project.  A description of the project, information about reporting bugs, and the latest version of this page, can be found at \\%http://www.kernel.org/doc/man-pages/."
601 msgstr ""
602 "この man ページは Linux I<man-pages> プロジェクトのリリース 3.78 の一部\n"
603 "である。プロジェクトの説明とバグ報告に関する情報は\n"
604 "http://www.kernel.org/doc/man-pages/ に書かれている。"
605
606 #. type: TH
607 #: build/C/man2/bind.2:68
608 #, no-wrap
609 msgid "BIND"
610 msgstr "BIND"
611
612 #. type: TH
613 #: build/C/man2/bind.2:68 build/C/man2/recv.2:41 build/C/man2/send.2:40
614 #, no-wrap
615 msgid "2014-08-19"
616 msgstr "2014-08-19"
617
618 #. type: Plain text
619 #: build/C/man2/bind.2:71
620 msgid "bind - bind a name to a socket"
621 msgstr "bind - ソケットに名前をつける"
622
623 #. type: Plain text
624 #: build/C/man2/bind.2:78
625 #, no-wrap
626 msgid ""
627 "B<int bind(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
628 "B<         socklen_t >I<addrlen>B<);>\n"
629 msgstr ""
630 "B<int bind(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
631 "B<         socklen_t >I<addrlen>B<);>\n"
632
633 #. type: Plain text
634 #: build/C/man2/bind.2:92
635 msgid "When a socket is created with B<socket>(2), it exists in a name space (address family) but has no address assigned to it.  B<bind>()  assigns the address specified by I<addr> to the socket referred to by the file descriptor I<sockfd>.  I<addrlen> specifies the size, in bytes, of the address structure pointed to by I<addr>.  Traditionally, this operation is called \\(lqassigning a name to a socket\\(rq."
636 msgstr "B<socket>(2)  でソケットが作成されたとき、そのソケットは名前空間 (アドレスファミリー) に 存在するが、アドレスは割り当てられていない。 B<bind>()  は、ファイルディスクリプター I<sockfd> で参照されるソケットに I<addr> で指定されたアドレスを割り当てる。 I<addrlen> には I<addr> が指すアドレス構造体のサイズをバイト単位で指定する。 伝統的にこの操作は 「ソケットに名前をつける」 と呼ばれる。"
637
638 #. type: Plain text
639 #: build/C/man2/bind.2:99
640 msgid "It is normally necessary to assign a local address using B<bind>()  before a B<SOCK_STREAM> socket may receive connections (see B<accept>(2))."
641 msgstr "B<SOCK_STREAM> ソケットが接続を受け付けられるようにするには (B<accept>(2)  を参照)、通常その前に B<bind>()  を使用してローカルアドレスを割り当てる必要がある。"
642
643 #. type: Plain text
644 #: build/C/man2/bind.2:130
645 msgid "The rules used in name binding vary between address families.  Consult the manual entries in Section 7 for detailed information.  For B<AF_INET> see B<ip>(7), for B<AF_INET6> see B<ipv6>(7), for B<AF_UNIX> see B<unix>(7), for B<AF_APPLETALK> see B<ddp>(7), for B<AF_PACKET> see B<packet>(7), for B<AF_X25> see B<x25>(7)  and for B<AF_NETLINK> see B<netlink>(7)."
646 msgstr "名前付けのルールはアドレスファミリーごとに異なっている。詳細な情報は 第 7 章の各マニュアルを参照すること。 B<AF_INET> は B<ip>(7)  を、 B<AF_INET6> は B<ipv6>(7)  を、 B<AF_UNIX> は B<unix>(7)  を、 B<AF_APPLETALK> は B<ddp>(7)  を、 B<AF_PACKET> は B<packet>(7)  を、 B<AF_X25> は B<x25>(7)  を、 B<AF_NETLINK> は B<netlink>(7)  を参照。"
647
648 #. type: Plain text
649 #: build/C/man2/bind.2:137
650 msgid "The actual structure passed for the I<addr> argument will depend on the address family.  The I<sockaddr> structure is defined as something like:"
651 msgstr "I<addr> 引き数に実際にどのような構造体が渡されるかは、 アドレスファミリーに依存する。 I<sockaddr> 構造体は以下のような感じで定義されている:"
652
653 #. type: Plain text
654 #: build/C/man2/bind.2:144
655 #, no-wrap
656 msgid ""
657 "struct sockaddr {\n"
658 "    sa_family_t sa_family;\n"
659 "    char        sa_data[14];\n"
660 "}\n"
661 msgstr ""
662 "struct sockaddr {\n"
663 "    sa_family_t sa_family;\n"
664 "    char        sa_data[14];\n"
665 "}\n"
666
667 #. type: Plain text
668 #: build/C/man2/bind.2:152
669 msgid "The only purpose of this structure is to cast the structure pointer passed in I<addr> in order to avoid compiler warnings.  See EXAMPLE below."
670 msgstr "この構造体は、 I<addr> に渡される構造体へのポインターをキャストし、 コンパイラの警告メッセージを抑えるためだけに存在する。 下記の「例」を参照。"
671
672 #. type: Plain text
673 #: build/C/man2/bind.2:157 build/C/man2/getsockname.2:72
674 #: build/C/man2/getsockopt.2:136 build/C/man2/listen.2:87
675 #: build/C/man2/socketpair.2:74
676 msgid "On success, zero is returned.  On error, -1 is returned, and I<errno> is set appropriately."
677 msgstr "成功した場合にはゼロが返される。エラー時には -1 が返され、 I<errno> が適切に設定される。"
678
679 #. type: TP
680 #: build/C/man2/bind.2:158 build/C/man2/bind.2:199
681 #: build/C/man3/bindresvport.3:77 build/C/man2/connect.2:135
682 #: build/C/man2/send.2:304 build/C/man2/socket.2:316
683 #, no-wrap
684 msgid "B<EACCES>"
685 msgstr "B<EACCES>"
686
687 #.  e.g., privileged port in AF_INET domain
688 #. type: Plain text
689 #: build/C/man2/bind.2:162
690 msgid "The address is protected, and the user is not the superuser."
691 msgstr "そのアドレスは保護されていて、かつユーザーがスーパーユーザーではない。"
692
693 #. type: TP
694 #: build/C/man2/bind.2:162 build/C/man2/bind.2:165
695 #: build/C/man3/bindresvport.3:82 build/C/man2/connect.2:148
696 #: build/C/man2/listen.2:88 build/C/man2/listen.2:91
697 #, no-wrap
698 msgid "B<EADDRINUSE>"
699 msgstr "B<EADDRINUSE>"
700
701 #. type: Plain text
702 #: build/C/man2/bind.2:165
703 msgid "The given address is already in use."
704 msgstr "指定されたアドレスが既に使用中である。"
705
706 #. type: Plain text
707 #: build/C/man2/bind.2:175
708 msgid "(Internet domain sockets)  The port number was specified as zero in the socket address structure, but, upon attempting to bind to an ephemeral port, it was determined that all port numbers in the ephemeral port range are currently in use.  See the discussion of I</proc/sys/net/ipv4/ip_local_port_range> B<ip>(7)."
709 msgstr "(インターネットドメインソケットの場合) ソケットアドレス構造体でポート番号に 0 が指定されたが、 一時ポート (ephemeral port) を割り当てようとした際に、 一時ポートとして使用する範囲のすべてのポート番号が使用中であった。 B<ip>(7) の I</proc/sys/net/ipv4/ip_local_port_range> の説明を参照。"
710
711 #. type: Plain text
712 #: build/C/man2/bind.2:180
713 msgid "I<sockfd> is not a valid descriptor."
714 msgstr "I<sockfd> が不正なディスクリプターである。"
715
716 #.  This may change in the future: see
717 #.  .I linux/unix/sock.c for details.
718 #. type: Plain text
719 #: build/C/man2/bind.2:185
720 msgid "The socket is already bound to an address."
721 msgstr "ソケットがすでにアドレスに結びつけ (bind) られている。"
722
723 #. type: Plain text
724 #: build/C/man2/bind.2:191
725 msgid "I<addrlen> is wrong, or I<addr> is not a valid address for this socket's domain."
726 msgstr "I<addrlen> が間違っているか、 I<addr> がこのソケットのドメインで有効なアドレスではない。"
727
728 #. type: Plain text
729 #: build/C/man2/bind.2:195
730 msgid "I<sockfd> is a descriptor for a file, not a socket."
731 msgstr "I<sockfd> がファイルに対するディスクリプターで、ソケットに対するものではない。"
732
733 #. type: Plain text
734 #: build/C/man2/bind.2:199
735 msgid "The following errors are specific to UNIX domain (B<AF_UNIX>)  sockets:"
736 msgstr "以下のエラーは UNIXドメイン (B<AF_UNIX>)  のソケット特有である:"
737
738 #. type: Plain text
739 #: build/C/man2/bind.2:204
740 msgid "Search permission is denied on a component of the path prefix.  (See also B<path_resolution>(7).)"
741 msgstr "パス名の構成要素に検索許可 (search permission) がない (B<path_resolution>(7)  も参照すること)。"
742
743 #. type: TP
744 #: build/C/man2/bind.2:204 build/C/man2/connect.2:151
745 #, no-wrap
746 msgid "B<EADDRNOTAVAIL>"
747 msgstr "B<EADDRNOTAVAIL>"
748
749 #. type: Plain text
750 #: build/C/man2/bind.2:208
751 msgid "A nonexistent interface was requested or the requested address was not local."
752 msgstr "存在しないインターフェースが要求されたか、要求されたアドレスが ローカルではなかった。"
753
754 #. type: Plain text
755 #: build/C/man2/bind.2:212
756 msgid "I<addr> points outside the user's accessible address space."
757 msgstr "I<addr> がユーザーのアクセス可能なアドレス空間の外を指している。"
758
759 #. type: TP
760 #: build/C/man2/bind.2:212
761 #, no-wrap
762 msgid "B<ELOOP>"
763 msgstr "B<ELOOP>"
764
765 #. type: Plain text
766 #: build/C/man2/bind.2:216
767 msgid "Too many symbolic links were encountered in resolving I<addr>."
768 msgstr "I<addr> を解決する際に遭遇したシンボリックリンクが多過ぎる。"
769
770 #. type: TP
771 #: build/C/man2/bind.2:216
772 #, no-wrap
773 msgid "B<ENAMETOOLONG>"
774 msgstr "B<ENAMETOOLONG>"
775
776 #. type: Plain text
777 #: build/C/man2/bind.2:220
778 msgid "I<addr> is too long."
779 msgstr "I<addr> が長過ぎる。"
780
781 #. type: TP
782 #: build/C/man2/bind.2:220
783 #, no-wrap
784 msgid "B<ENOENT>"
785 msgstr "B<ENOENT>"
786
787 #. type: Plain text
788 #: build/C/man2/bind.2:223
789 msgid "The file does not exist."
790 msgstr "ファイルが存在しない。"
791
792 #. type: TP
793 #: build/C/man2/bind.2:223 build/C/man2/recv.2:460 build/C/man2/select.2:340
794 #: build/C/man2/send.2:375
795 #, no-wrap
796 msgid "B<ENOMEM>"
797 msgstr "B<ENOMEM>"
798
799 #. type: Plain text
800 #: build/C/man2/bind.2:226
801 msgid "Insufficient kernel memory was available."
802 msgstr "カーネルに、利用可能なメモリーが十分にない。"
803
804 #. type: TP
805 #: build/C/man2/bind.2:226
806 #, no-wrap
807 msgid "B<ENOTDIR>"
808 msgstr "B<ENOTDIR>"
809
810 #. type: Plain text
811 #: build/C/man2/bind.2:229
812 msgid "A component of the path prefix is not a directory."
813 msgstr "パス名の構成要素がディレクトリではない。"
814
815 #. type: TP
816 #: build/C/man2/bind.2:229
817 #, no-wrap
818 msgid "B<EROFS>"
819 msgstr "B<EROFS>"
820
821 #. type: Plain text
822 #: build/C/man2/bind.2:232
823 msgid "The socket inode would reside on a read-only filesystem."
824 msgstr "ソケット inode が読み込み専用のファイルシステム上にある。"
825
826 #.  SVr4 documents an additional
827 #.  .B ENOSR
828 #.  general error condition, and
829 #.  additional
830 #.  .B EIO
831 #.  and
832 #.  .B EISDIR
833 #.  UNIX-domain error conditions.
834 #. type: Plain text
835 #: build/C/man2/bind.2:244
836 msgid "SVr4, 4.4BSD, POSIX.1-2001 (B<bind>()  first appeared in 4.2BSD)."
837 msgstr "SVr4, 4.4BSD, POSIX.1-2001 (B<bind>()  は 4.2BSD で最初に現われた)。"
838
839 #. type: Plain text
840 #: build/C/man2/bind.2:261
841 msgid "The third argument of B<bind>()  is in reality an I<int> (and this is what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
842 msgstr "B<bind>()  の三番目の引き数は (4.x BSD や libc4, libc5 と同様に) 実際には I<int> である。glibc でも使われている現在の I<socklen_t> に関して、POSIX には少し混乱がある。 詳しくは B<accept>(2)  を参照のこと。"
843
844 #. type: SH
845 #: build/C/man2/bind.2:261 build/C/man2/getsockopt.2:199
846 #: build/C/man2/recvmmsg.2:267 build/C/man2/select.2:492
847 #: build/C/man2/send.2:433 build/C/man3/sockatmark.3:100
848 #: build/C/man7/socket.7:947
849 #, no-wrap
850 msgid "BUGS"
851 msgstr "バグ"
852
853 #.  FIXME Document transparent proxy options
854 #. type: Plain text
855 #: build/C/man2/bind.2:264
856 msgid "The transparent proxy options are not described."
857 msgstr "透過的プロキシ (transparent proxy) オプションについて記述していない。"
858
859 #. type: Plain text
860 #: build/C/man2/bind.2:269
861 msgid "An example of the use of B<bind>()  with Internet domain sockets can be found in B<getaddrinfo>(3)."
862 msgstr "インターネットドメインソケットでの B<bind>()  の利用例が B<getaddrinfo>(3)  に記載されている。"
863
864 #.  listen.7 refers to this example.
865 #.  accept.7 refers to this example.
866 #.  unix.7 refers to this example.
867 #. type: Plain text
868 #: build/C/man2/bind.2:276
869 msgid "The following example shows how to bind a stream socket in the UNIX (B<AF_UNIX>)  domain, and accept connections:"
870 msgstr "以下の例は、UNIX ドメイン (B<AF_UNIX>)  でストリームソケットを bind する方法を示したものである。"
871
872 #. type: Plain text
873 #: build/C/man2/bind.2:283
874 #, no-wrap
875 msgid ""
876 "#include E<lt>sys/socket.hE<gt>\n"
877 "#include E<lt>sys/un.hE<gt>\n"
878 "#include E<lt>stdlib.hE<gt>\n"
879 "#include E<lt>stdio.hE<gt>\n"
880 "#include E<lt>string.hE<gt>\n"
881 msgstr ""
882 "#include E<lt>sys/socket.hE<gt>\n"
883 "#include E<lt>sys/un.hE<gt>\n"
884 "#include E<lt>stdlib.hE<gt>\n"
885 "#include E<lt>stdio.hE<gt>\n"
886 "#include E<lt>string.hE<gt>\n"
887
888 #. type: Plain text
889 #: build/C/man2/bind.2:286
890 #, no-wrap
891 msgid ""
892 "#define MY_SOCK_PATH \"/somepath\"\n"
893 "#define LISTEN_BACKLOG 50\n"
894 msgstr ""
895 "#define MY_SOCK_PATH \"/somepath\"\n"
896 "#define LISTEN_BACKLOG 50\n"
897
898 #. type: Plain text
899 #: build/C/man2/bind.2:289
900 #, no-wrap
901 msgid ""
902 "#define handle_error(msg) \\e\n"
903 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
904 msgstr ""
905 "#define handle_error(msg) \\e\n"
906 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
907
908 #. type: Plain text
909 #: build/C/man2/bind.2:296
910 #, no-wrap
911 msgid ""
912 "int\n"
913 "main(int argc, char *argv[])\n"
914 "{\n"
915 "    int sfd, cfd;\n"
916 "    struct sockaddr_un my_addr, peer_addr;\n"
917 "    socklen_t peer_addr_size;\n"
918 msgstr ""
919 "int\n"
920 "main(int argc, char *argv[])\n"
921 "{\n"
922 "    int sfd, cfd;\n"
923 "    struct sockaddr_un my_addr, peer_addr;\n"
924 "    socklen_t peer_addr_size;\n"
925
926 #. type: Plain text
927 #: build/C/man2/bind.2:300
928 #, no-wrap
929 msgid ""
930 "    sfd = socket(AF_UNIX, SOCK_STREAM, 0);\n"
931 "    if (sfd == -1)\n"
932 "        handle_error(\"socket\");\n"
933 msgstr ""
934 "    sfd = socket(AF_UNIX, SOCK_STREAM, 0);\n"
935 "    if (sfd == -1)\n"
936 "        handle_error(\"socket\");\n"
937
938 #. type: Plain text
939 #: build/C/man2/bind.2:306
940 #, no-wrap
941 msgid ""
942 "    memset(&my_addr, 0, sizeof(struct sockaddr_un));\n"
943 "                        /* Clear structure */\n"
944 "    my_addr.sun_family = AF_UNIX;\n"
945 "    strncpy(my_addr.sun_path, MY_SOCK_PATH,\n"
946 "            sizeof(my_addr.sun_path) - 1);\n"
947 msgstr ""
948 "    memset(&my_addr, 0, sizeof(struct sockaddr_un));\n"
949 "                        /* Clear structure */\n"
950 "    my_addr.sun_family = AF_UNIX;\n"
951 "    strncpy(my_addr.sun_path, MY_SOCK_PATH,\n"
952 "            sizeof(my_addr.sun_path) - 1);\n"
953
954 #. type: Plain text
955 #: build/C/man2/bind.2:310
956 #, no-wrap
957 msgid ""
958 "    if (bind(sfd, (struct sockaddr *) &my_addr,\n"
959 "            sizeof(struct sockaddr_un)) == -1)\n"
960 "        handle_error(\"bind\");\n"
961 msgstr ""
962 "    if (bind(sfd, (struct sockaddr *) &my_addr,\n"
963 "            sizeof(struct sockaddr_un)) == -1)\n"
964 "        handle_error(\"bind\");\n"
965
966 #. type: Plain text
967 #: build/C/man2/bind.2:313
968 #, no-wrap
969 msgid ""
970 "    if (listen(sfd, LISTEN_BACKLOG) == -1)\n"
971 "        handle_error(\"listen\");\n"
972 msgstr ""
973 "    if (listen(sfd, LISTEN_BACKLOG) == -1)\n"
974 "        handle_error(\"listen\");\n"
975
976 #. type: Plain text
977 #: build/C/man2/bind.2:316
978 #, no-wrap
979 msgid ""
980 "    /* Now we can accept incoming connections one\n"
981 "       at a time using accept(2) */\n"
982 msgstr ""
983 "    /* Now we can accept incoming connections one\n"
984 "       at a time using accept(2) */\n"
985
986 #. type: Plain text
987 #: build/C/man2/bind.2:322
988 #, no-wrap
989 msgid ""
990 "    peer_addr_size = sizeof(struct sockaddr_un);\n"
991 "    cfd = accept(sfd, (struct sockaddr *) &peer_addr,\n"
992 "                 &peer_addr_size);\n"
993 "    if (cfd == -1)\n"
994 "        handle_error(\"accept\");\n"
995 msgstr ""
996 "    peer_addr_size = sizeof(struct sockaddr_un);\n"
997 "    cfd = accept(sfd, (struct sockaddr *) &peer_addr,\n"
998 "                 &peer_addr_size)\n"
999 "    if (cfd == -1)\n"
1000 "        handle_error(\"accept\");\n"
1001
1002 #. type: Plain text
1003 #: build/C/man2/bind.2:324
1004 #, no-wrap
1005 msgid "    /* Code to deal with incoming connection(s)... */\n"
1006 msgstr "    /* Code to deal with incoming connection(s)... */\n"
1007
1008 #. type: Plain text
1009 #: build/C/man2/bind.2:328
1010 #, no-wrap
1011 msgid ""
1012 "    /* When no longer required, the socket pathname, MY_SOCK_PATH\n"
1013 "       should be deleted using unlink(2) or remove(3) */\n"
1014 "}\n"
1015 msgstr ""
1016 "    /* When no longer required, the socket pathname, MY_SOCK_PATH\n"
1017 "       should be deleted using unlink(2) or remove(3) */\n"
1018 "}\n"
1019
1020 #. type: Plain text
1021 #: build/C/man2/bind.2:342
1022 msgid "B<accept>(2), B<connect>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), B<getaddrinfo>(3), B<getifaddrs>(3), B<ip>(7), B<ipv6>(7), B<path_resolution>(7), B<socket>(7), B<unix>(7)"
1023 msgstr "B<accept>(2), B<connect>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), B<getaddrinfo>(3), B<getifaddrs>(3), B<ip>(7), B<ipv6>(7), B<path_resolution>(7), B<socket>(7), B<unix>(7)"
1024
1025 #. type: TH
1026 #: build/C/man3/bindresvport.3:30
1027 #, no-wrap
1028 msgid "BINDRESVPORT"
1029 msgstr "BINDRESVPORT"
1030
1031 #. type: TH
1032 #: build/C/man3/bindresvport.3:30
1033 #, no-wrap
1034 msgid "2013-06-21"
1035 msgstr "2013-06-21"
1036
1037 #. type: Plain text
1038 #: build/C/man3/bindresvport.3:33
1039 msgid "bindresvport - bind a socket to a privileged IP port"
1040 msgstr "bindresvport - ソケットを特権 IP ポートにバインドする"
1041
1042 #. type: Plain text
1043 #: build/C/man3/bindresvport.3:37
1044 #, no-wrap
1045 msgid ""
1046 "B<#include E<lt>sys/types.hE<gt>>\n"
1047 "B<#include E<lt>netinet/in.hE<gt>>\n"
1048 msgstr ""
1049 "B<#include E<lt>sys/types.hE<gt>>\n"
1050 "B<#include E<lt>netinet/in.hE<gt>>\n"
1051
1052 #. type: Plain text
1053 #: build/C/man3/bindresvport.3:39
1054 #, no-wrap
1055 msgid "B<int bindresvport(int >I<sockfd>B<, struct sockaddr_in *>I<sin>B<);>\n"
1056 msgstr "B<int bindresvport(int >I<sockfd>B<, struct sockaddr_in *>I<sin>B<);>\n"
1057
1058 #.  Glibc actually starts searching with a port # in the range 600 to 1023
1059 #. type: Plain text
1060 #: build/C/man3/bindresvport.3:46
1061 msgid "B<bindresvport>()  is used to bind a socket descriptor to a privileged anonymous IP port, that is, a port number arbitrarily selected from the range 512 to 1023."
1062 msgstr "B<bindresvport>()  は、ソケットディスクリプターを特権無名 (privileged anonymous) IP ポートに バインドするのに使う。特権無名 IP ポートとは、 ポート番号が 512 から 1023 の範囲から任意に選択されるポートである。"
1063
1064 #. type: Plain text
1065 #: build/C/man3/bindresvport.3:56
1066 msgid "If the B<bind>(2)  performed by B<bindresvport>()  is successful, and I<sin> is not NULL, then I<sin-E<gt>sin_port> returns the port number actually allocated."
1067 msgstr "B<bindresvport>()  によって実行された B<bind>(2)  が成功し、 I<sin> が NULL 以外の場合、実際に割り当てられたポート番号が I<sin-E<gt>sin_port> に入れて返される。"
1068
1069 #. type: Plain text
1070 #: build/C/man3/bindresvport.3:67
1071 msgid "I<sin> can be NULL, in which case I<sin-E<gt>sin_family> is implicitly taken to be B<AF_INET>.  However, in this case, B<bindresvport>()  has no way to return the port number actually allocated.  (This information can later be obtained using B<getsockname>(2).)"
1072 msgstr "I<sin> には NULL を指定することもでき、その場合には I<sin-E<gt>sin_family> は暗黙のうちに B<AF_INET> とみなされる。 しかし、この場合には、 B<bindresvport>()  は実際に割り当てられたポート番号を返す手段を持たない (割り当てられたポート番号は、後で B<getsockname>(2)  を使って取得できる)。"
1073
1074 #. type: Plain text
1075 #: build/C/man3/bindresvport.3:72
1076 msgid "B<bindresvport>()  returns 0 on success; otherwise -1 is returned and I<errno> set to indicate the cause of the error."
1077 msgstr "B<bindresvport>()  は成功すると 0 を返す。それ以外の場合、-1 を返し、 I<errno> にエラーの原因を示す値を設定する。"
1078
1079 #. type: Plain text
1080 #: build/C/man3/bindresvport.3:77
1081 msgid "B<bindresvport>()  can fail for any of the same reasons as B<bind>(2).  In addition, the following errors may occur:"
1082 msgstr "B<bindresvport>()  は B<bind>(2)  と同じ原因で失敗する可能性がある。 さらに、以下のエラーが発生することがある:"
1083
1084 #. type: Plain text
1085 #: build/C/man3/bindresvport.3:82
1086 msgid "The caller did not have superuser privilege (to be precise: the B<CAP_NET_BIND_SERVICE> capability is required)."
1087 msgstr "呼び出し元がスーパーユーザーの特権を持っていなかった (より正確に言うと、 B<CAP_NET_BIND_SERVICE> ケーパビリティが必要である)。"
1088
1089 #. type: Plain text
1090 #: build/C/man3/bindresvport.3:85
1091 msgid "All privileged ports are in use."
1092 msgstr "全ての特権ポートが使用中である。"
1093
1094 #. type: TP
1095 #: build/C/man3/bindresvport.3:85
1096 #, no-wrap
1097 msgid "B<EAFNOSUPPORT> (B<EPFNOSUPPORT> in glibc 2.7 and earlier)"
1098 msgstr "B<EAFNOSUPPORT> (glibc 2.7 以前では B<EPFNOSUPPORT>)"
1099
1100 #. type: Plain text
1101 #: build/C/man3/bindresvport.3:92
1102 msgid "I<sin> is not NULL and I<sin-E<gt>sin_family> is not B<AF_INET>."
1103 msgstr "I<sin> が NULL 以外で、かつ I<sin-E<gt>sin_family> が B<AF_INET> でなかった。"
1104
1105 #. type: SH
1106 #: build/C/man3/bindresvport.3:92 build/C/man3/if_nametoindex.3:85
1107 #: build/C/man3/sockatmark.3:73
1108 #, no-wrap
1109 msgid "ATTRIBUTES"
1110 msgstr "属性"
1111
1112 #. type: SS
1113 #: build/C/man3/bindresvport.3:93 build/C/man3/if_nametoindex.3:86
1114 #: build/C/man3/sockatmark.3:74
1115 #, no-wrap
1116 msgid "Multithreading (see pthreads(7))"
1117 msgstr "マルチスレッディング (pthreads(7) 参照)"
1118
1119 #. type: Plain text
1120 #: build/C/man3/bindresvport.3:98
1121 msgid "Before glibc 2.17, the B<bindresvport>()  function uses a static variable that is not protected, so it is not thread-safe."
1122 msgstr "glibc 2.17 より前のバージョンでは、 B<bindresvport>() 関数は保護されていない静的変数を使用しているため、スレッドセーフではない。"
1123
1124 #.  commit f6da27e53695ad1cc0e2a9490358decbbfdff5e5
1125 #. type: Plain text
1126 #: build/C/man3/bindresvport.3:104
1127 msgid "Since glibc 2.17, the B<bindresvport>()  function uses a lock to protect the static variable, so it is thread-safe."
1128 msgstr "glibc 2.17 以降では、 B<bindresvport>() 関数は静的変数を保護するロックを使っており、スレッドセーフである。"
1129
1130 #. type: Plain text
1131 #: build/C/man3/bindresvport.3:107
1132 msgid "Not in POSIX.1-2001.  Present on the BSDs, Solaris, and many other systems."
1133 msgstr "POSIX.1-2001 にはない。 BSD, Solaris およびその他の多くのシステムに存在する。"
1134
1135 #. type: Plain text
1136 #: build/C/man3/bindresvport.3:113
1137 msgid "Unlike some B<bindresvport>()  implementations, the glibc implementation ignores any value that the caller supplies in I<sin-E<gt>sin_port>."
1138 msgstr "B<bindresvport>()  のいくつかの実装と異なり、glibc の実装では呼び出し元が I<sin-E<gt>sin_port> で渡した値はどんな値であっても無視される。"
1139
1140 #. type: Plain text
1141 #: build/C/man3/bindresvport.3:116
1142 msgid "B<bind>(2), B<getsockname>(2)"
1143 msgstr "B<bind>(2), B<getsockname>(2)"
1144
1145 #. type: TH
1146 #: build/C/man2/connect.2:67
1147 #, no-wrap
1148 msgid "CONNECT"
1149 msgstr "CONNECT"
1150
1151 #. type: TH
1152 #: build/C/man2/connect.2:67
1153 #, no-wrap
1154 msgid "2014-09-06"
1155 msgstr "2014-09-06"
1156
1157 #. type: Plain text
1158 #: build/C/man2/connect.2:70
1159 msgid "connect - initiate a connection on a socket"
1160 msgstr "connect - ソケットの接続を行う"
1161
1162 #. type: Plain text
1163 #: build/C/man2/connect.2:73 build/C/man2/getsockopt.2:50
1164 #: build/C/man2/listen.2:51
1165 #, no-wrap
1166 msgid "B<#include E<lt>sys/types.hE<gt>>          /* See NOTES */\n"
1167 msgstr "B<#include E<lt>sys/types.hE<gt>>          /* 「注意」参照 */\n"
1168
1169 #. type: Plain text
1170 #: build/C/man2/connect.2:75 build/C/man2/getsockname.2:46
1171 #: build/C/man2/getsockopt.2:52 build/C/man2/listen.2:53
1172 #: build/C/man2/recv.2:51
1173 #, no-wrap
1174 msgid "B<#include E<lt>sys/socket.hE<gt>>\n"
1175 msgstr "B<#include E<lt>sys/socket.hE<gt>>\n"
1176
1177 #. type: Plain text
1178 #: build/C/man2/connect.2:78
1179 #, no-wrap
1180 msgid ""
1181 "B<int connect(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
1182 "B<            socklen_t >I<addrlen>B<);>\n"
1183 msgstr ""
1184 "B<int connect(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
1185 "B<            socklen_t >I<addrlen>B<);>\n"
1186
1187 #. type: Plain text
1188 #: build/C/man2/connect.2:97
1189 msgid "The B<connect>()  system call connects the socket referred to by the file descriptor I<sockfd> to the address specified by I<addr>.  The I<addrlen> argument specifies the size of I<addr>.  The format of the address in I<addr> is determined by the address space of the socket I<sockfd>; see B<socket>(2)  for further details."
1190 msgstr "B<connect>()  システムコールは、ファイルディスクリプター I<sockfd> が参照しているソケットを I<addr> で指定されたアドレスに接続する。 I<addrlen> 引き数は I<addr> の大きさを示す。 I<addr> のアドレスのフォーマットはソケット I<sockfd> のアドレス空間により異なる。 さらなる詳細は B<socket>(2)  を参照のこと。"
1191
1192 #. type: Plain text
1193 #: build/C/man2/connect.2:113
1194 msgid "If the socket I<sockfd> is of type B<SOCK_DGRAM>, then I<addr> is the address to which datagrams are sent by default, and the only address from which datagrams are received.  If the socket is of type B<SOCK_STREAM> or B<SOCK_SEQPACKET>, this call attempts to make a connection to the socket that is bound to the address specified by I<addr>."
1195 msgstr "ソケット I<sockfd> が B<SOCK_DGRAM> 型であれば、 I<addr> は、デフォルトのデータグラムの送信先のアドレスであり、 データグラムを受信する唯一のアドレスを示すに過ぎない。 ソケットが B<SOCK_STREAM> 型もしくは B<SOCK_SEQPACKET> 型であれば、このシステムコールは I<addr> で指定されたアドレスに結び付けられたソケットに対する接続の 作成を試みる。"
1196
1197 #. type: Plain text
1198 #: build/C/man2/connect.2:127
1199 msgid "Generally, connection-based protocol sockets may successfully B<connect>()  only once; connectionless protocol sockets may use B<connect>()  multiple times to change their association.  Connectionless sockets may dissolve the association by connecting to an address with the I<sa_family> member of I<sockaddr> set to B<AF_UNSPEC> (supported on Linux since kernel 2.2)."
1200 msgstr "一般的に、接続指向 (connection-oriented) プロトコルでは一度だけ B<connect>()  が成功する。 コネクションレス (connectionless) プロトコルでは対応を変更するために何度も B<connect>()  を使用できる。 非接続ソケットは I<sockaddr> の I<sa_family> メンバに B<AF_UNSPEC> を設定することで、接続アドレスの対応を解消することができる (B<AF_UNSPEC> はカーネル 2.2 以降の Linux でサポート)。"
1201
1202 #. type: Plain text
1203 #: build/C/man2/connect.2:132
1204 msgid "If the connection or binding succeeds, zero is returned.  On error, -1 is returned, and I<errno> is set appropriately."
1205 msgstr "接続または対応づけに成功するとゼロを返す。 失敗すると -1 を返し、 I<errno> に適切な値を設定する。"
1206
1207 #. type: Plain text
1208 #: build/C/man2/connect.2:135
1209 msgid "The following are general socket errors only.  There may be other domain-specific error codes."
1210 msgstr "以下は一般的なソケットについてのエラーである。他にドメイン特有のエラー が発生する可能性がある。"
1211
1212 #. type: Plain text
1213 #: build/C/man2/connect.2:143
1214 msgid "For UNIX domain sockets, which are identified by pathname: Write permission is denied on the socket file, or search permission is denied for one of the directories in the path prefix.  (See also B<path_resolution>(7).)"
1215 msgstr "UNIX ドメインソケットはパス名で識別される。 ソケットファイルへの書き込み許可がなかったか、パス名へ 到達するまでのディレクトリのいずれかに対する検索許可がなかった。 (B<path_resolution>(7)  も参照のこと)"
1216
1217 #. type: TP
1218 #: build/C/man2/connect.2:143
1219 #, no-wrap
1220 msgid "B<EACCES>, B<EPERM>"
1221 msgstr "B<EACCES>, B<EPERM>"
1222
1223 #. type: Plain text
1224 #: build/C/man2/connect.2:148
1225 msgid "The user tried to connect to a broadcast address without having the socket broadcast flag enabled or the connection request failed because of a local firewall rule."
1226 msgstr "ソケットのブロードキャストフラグが有効になっていないのに ユーザーがブロードキャストへ接続を試みた。または、ローカルのファイアウォールの 規則により接続の要求が失敗した。"
1227
1228 #. type: Plain text
1229 #: build/C/man2/connect.2:151
1230 msgid "Local address is already in use."
1231 msgstr "ローカルアドレスが既に使用されている。"
1232
1233 #. type: Plain text
1234 #: build/C/man2/connect.2:164 build/C/man2/listen.2:104
1235 msgid "(Internet domain sockets)  The socket referred to by I<sockfd> had not previously been bound to an address and, upon attempting to bind it to an ephemeral port, it was determined that all port numbers in the ephemeral port range are currently in use.  See the discussion of I</proc/sys/net/ipv4/ip_local_port_range> in B<ip>(7)."
1236 msgstr "(インターネットドメインソケットの場合) I<sockfd> が参照するソケットがそれ以前にアドレスにバインドされておらず、 そのソケットに一時ポートをバインドしようとした際に、 一時ポートとして使用する範囲のポート番号がすべて使用中であった。 B<ip>(7) の I</proc/sys/net/ipv4/ip_local_port_range> の議論を参照のこと。"
1237
1238 #. type: TP
1239 #: build/C/man2/connect.2:164 build/C/man2/socket.2:320
1240 #: build/C/man2/socketpair.2:75
1241 #, no-wrap
1242 msgid "B<EAFNOSUPPORT>"
1243 msgstr "B<EAFNOSUPPORT>"
1244
1245 #. type: Plain text
1246 #: build/C/man2/connect.2:169
1247 msgid "The passed address didn't have the correct address family in its I<sa_family> field."
1248 msgstr "渡されたアドレスの I<sa_family> フィールドが正しいアドレスファミリーではない。"
1249
1250 #. type: TP
1251 #: build/C/man2/connect.2:169 build/C/man2/send.2:323
1252 #, no-wrap
1253 msgid "B<EAGAIN>"
1254 msgstr "B<EAGAIN>"
1255
1256 #. type: Plain text
1257 #: build/C/man2/connect.2:172
1258 msgid "Insufficient entries in the routing cache."
1259 msgstr "ルーティングキャッシュにエントリーが十分にない。"
1260
1261 #. type: TP
1262 #: build/C/man2/connect.2:172
1263 #, no-wrap
1264 msgid "B<EALREADY>"
1265 msgstr "B<EALREADY>"
1266
1267 #. type: Plain text
1268 #: build/C/man2/connect.2:176
1269 msgid "The socket is nonblocking and a previous connection attempt has not yet been completed."
1270 msgstr "ソケットが非停止 (nonblocking) に設定されており、 前の接続が完了していない。"
1271
1272 #. type: Plain text
1273 #: build/C/man2/connect.2:179
1274 msgid "The file descriptor is not a valid index in the descriptor table."
1275 msgstr "ファイルディスクリプターがディスクリプターテーブルの 有効なインデックスではない。"
1276
1277 #. type: TP
1278 #: build/C/man2/connect.2:179 build/C/man2/recv.2:443
1279 #, no-wrap
1280 msgid "B<ECONNREFUSED>"
1281 msgstr "B<ECONNREFUSED>"
1282
1283 #. type: Plain text
1284 #: build/C/man2/connect.2:182
1285 msgid "No-one listening on the remote address."
1286 msgstr "リモートアドレスで接続を待っているプログラムがない。"
1287
1288 #. type: Plain text
1289 #: build/C/man2/connect.2:185
1290 msgid "The socket structure address is outside the user's address space."
1291 msgstr "ソケット構造体のアドレスがユーザーのアドレス空間外にある。"
1292
1293 #. type: TP
1294 #: build/C/man2/connect.2:185
1295 #, no-wrap
1296 msgid "B<EINPROGRESS>"
1297 msgstr "B<EINPROGRESS>"
1298
1299 #. type: Plain text
1300 #: build/C/man2/connect.2:210
1301 msgid "The socket is nonblocking and the connection cannot be completed immediately.  It is possible to B<select>(2)  or B<poll>(2)  for completion by selecting the socket for writing.  After B<select>(2)  indicates writability, use B<getsockopt>(2)  to read the B<SO_ERROR> option at level B<SOL_SOCKET> to determine whether B<connect>()  completed successfully (B<SO_ERROR> is zero) or unsuccessfully (B<SO_ERROR> is one of the usual error codes listed here, explaining the reason for the failure)."
1302 msgstr "ソケットが非停止 (nonblocking) に設定されていて、接続をすぐに 完了することができない。その場合、 B<select>(2)  や B<poll>(2)  を使ってそのソケットが書き込み可能になるのを待つことで、 接続の完了を知ることができる。 B<select>(2)  で書き込み可能になった後に、 B<getsockopt>(2)  を使って B<SOL_SOCKET> レベルで B<SO_ERROR> オプションを読み出すこ とにより、 B<connect>()  が成功したか、失敗したかを判断できる。 成功の場合 B<SO_ERROR> が 0 であり、 失敗の場合 B<SO_ERROR> がここのリストにあるいずれかのエラーコードであり、 それにより失敗の原因が分かる。"
1303
1304 #.  For TCP, the connection will complete asynchronously.
1305 #.  See http://lkml.org/lkml/2005/7/12/254
1306 #. type: Plain text
1307 #: build/C/man2/connect.2:216
1308 msgid "The system call was interrupted by a signal that was caught; see B<signal>(7)."
1309 msgstr "捕捉されたシグナルによりシステムコールが中断された。 B<signal>(7)  参照。"
1310
1311 #. type: TP
1312 #: build/C/man2/connect.2:216 build/C/man2/send.2:355
1313 #, no-wrap
1314 msgid "B<EISCONN>"
1315 msgstr "B<EISCONN>"
1316
1317 #. type: Plain text
1318 #: build/C/man2/connect.2:219
1319 msgid "The socket is already connected."
1320 msgstr "ソケットは既に接続 (connect) されている。"
1321
1322 #. type: TP
1323 #: build/C/man2/connect.2:219
1324 #, no-wrap
1325 msgid "B<ENETUNREACH>"
1326 msgstr "B<ENETUNREACH>"
1327
1328 #. type: Plain text
1329 #: build/C/man2/connect.2:222
1330 msgid "Network is unreachable."
1331 msgstr "到達できないネットワークである。"
1332
1333 #. type: Plain text
1334 #: build/C/man2/connect.2:225
1335 msgid "The file descriptor is not associated with a socket."
1336 msgstr "ファイルディスクリプターがソケットと関連付けられていない。"
1337
1338 #. type: TP
1339 #: build/C/man2/connect.2:225
1340 #, no-wrap
1341 msgid "B<EPROTOTYPE>"
1342 msgstr "B<EPROTOTYPE>"
1343
1344 #. type: Plain text
1345 #: build/C/man2/connect.2:230
1346 msgid "The socket type does not support the requested communications protocol.  This error can occur, for example, on an attempt to connect a UNIX domain datagram socket to a stream socket."
1347 msgstr "ソケットタイプが要求された通信プロトコルではサポートされていない。 このエラーは、 例えば UNIX ドメインデータグラムソケットをストリームソケットに接続しようとした場合などに起こり得る。"
1348
1349 #. type: TP
1350 #: build/C/man2/connect.2:230
1351 #, no-wrap
1352 msgid "B<ETIMEDOUT>"
1353 msgstr "B<ETIMEDOUT>"
1354
1355 #. type: Plain text
1356 #: build/C/man2/connect.2:237
1357 msgid "Timeout while attempting connection.  The server may be too busy to accept new connections.  Note that for IP sockets the timeout may be very long when syncookies are enabled on the server."
1358 msgstr "接続を試みている途中で時間切れ (timeout) になった。サーバーが混雑していて 新たな接続を受け入れられないのかもしれない。 IP ソケットでは、 syncookie がサーバーで有効になっている場合、 タイムアウトが非常に長くなる場合があるので注意すること。"
1359
1360 #.  SVr4 documents the additional
1361 #.  general error codes
1362 #.  .BR EADDRNOTAVAIL ,
1363 #.  .BR EINVAL ,
1364 #.  .BR EAFNOSUPPORT ,
1365 #.  .BR EALREADY ,
1366 #.  .BR EINTR ,
1367 #.  .BR EPROTOTYPE ,
1368 #.  and
1369 #.  .BR ENOSR .
1370 #.  It also
1371 #.  documents many additional error conditions not described here.
1372 #. type: Plain text
1373 #: build/C/man2/connect.2:253
1374 msgid "SVr4, 4.4BSD, (the B<connect>()  function first appeared in 4.2BSD), POSIX.1-2001."
1375 msgstr "SVr4, 4.4BSD, (B<connect>()  関数は 4.2BSD で最初に登場した), POSIX.1-2001."
1376
1377 #. type: Plain text
1378 #: build/C/man2/connect.2:270
1379 msgid "The third argument of B<connect>()  is in reality an I<int> (and this is what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
1380 msgstr "B<connect>()  の三番目の引き数は 4.x BSD や libc4, libc5 と同様に実際には I<int> である。 POSIX では紆余曲折を経て現在の I<socklen_t> になっており、 glibc でも I<socklen_t> を使っている。 B<accept>(2)  も参照のこと。"
1381
1382 #. type: Plain text
1383 #: build/C/man2/connect.2:276
1384 msgid "If B<connect>()  fails, consider the state of the socket as unspecified.  Portable applications should close the socket and create a new one for reconnecting."
1385 msgstr "B<connect>() が失敗した場合、そのソケットの状態は不定だと考えること。 移植性を考慮したアプリケーションでは、そのソケットをクローズし、再接続用に新しいソケットを作成すべきである。"
1386
1387 #. type: Plain text
1388 #: build/C/man2/connect.2:281
1389 msgid "An example of the use of B<connect>()  is shown in B<getaddrinfo>(3)."
1390 msgstr "B<connect>()  の利用例が B<getaddrinfo>(3)  に記載されている。"
1391
1392 #. type: Plain text
1393 #: build/C/man2/connect.2:288
1394 msgid "B<accept>(2), B<bind>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), B<path_resolution>(7)"
1395 msgstr "B<accept>(2), B<bind>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), B<path_resolution>(7)"
1396
1397 #. type: TH
1398 #: build/C/man3/getifaddrs.3:36
1399 #, no-wrap
1400 msgid "GETIFADDRS"
1401 msgstr "GETIFADDRS"
1402
1403 #. type: TH
1404 #: build/C/man3/getifaddrs.3:36
1405 #, no-wrap
1406 msgid "2014-02-26"
1407 msgstr "2014-02-26"
1408
1409 #. type: TH
1410 #: build/C/man3/getifaddrs.3:36 build/C/man3/if_nameindex.3:26
1411 #: build/C/man3/if_nametoindex.3:25
1412 #, no-wrap
1413 msgid "GNU"
1414 msgstr "GNU"
1415
1416 #. type: Plain text
1417 #: build/C/man3/getifaddrs.3:39
1418 msgid "getifaddrs, freeifaddrs - get interface addresses"
1419 msgstr "getifaddrs, freeifaddrs - インターフェースのアドレスを取得する"
1420
1421 #. type: Plain text
1422 #: build/C/man3/getifaddrs.3:43
1423 #, no-wrap
1424 msgid ""
1425 "B<#include E<lt>sys/types.hE<gt>>\n"
1426 "B<#include E<lt>ifaddrs.hE<gt>>\n"
1427 msgstr ""
1428 "B<#include E<lt>sys/types.hE<gt>>\n"
1429 "B<#include E<lt>ifaddrs.hE<gt>>\n"
1430
1431 #. type: Plain text
1432 #: build/C/man3/getifaddrs.3:45
1433 #, no-wrap
1434 msgid "B<int getifaddrs(struct ifaddrs **>I<ifap>B<);>\n"
1435 msgstr "B<int getifaddrs(struct ifaddrs **>I<ifap>B<);>\n"
1436
1437 #. type: Plain text
1438 #: build/C/man3/getifaddrs.3:47
1439 #, no-wrap
1440 msgid "B<void freeifaddrs(struct ifaddrs *>I<ifa>B<);>\n"
1441 msgstr "B<void freeifaddrs(struct ifaddrs *>I<ifa>B<);>\n"
1442
1443 #. type: Plain text
1444 #: build/C/man3/getifaddrs.3:58
1445 msgid "The B<getifaddrs>()  function creates a linked list of structures describing the network interfaces of the local system, and stores the address of the first item of the list in I<*ifap>.  The list consists of I<ifaddrs> structures, defined as follows:"
1446 msgstr "B<getifaddrs>() 関数は、ローカルシステムのネットワークインターフェース情報を表す構造体の連結リストを作成し、 リストの先頭の要素のアドレスを I<*ifap> に格納する。 リストは I<ifaddrs> 構造体で構成される。 I<ifaddrs> 構造体は以下のように定義されている。"
1447
1448 #. type: Plain text
1449 #: build/C/man3/getifaddrs.3:77
1450 #, no-wrap
1451 msgid ""
1452 "struct ifaddrs {\n"
1453 "    struct ifaddrs  *ifa_next;    /* Next item in list */\n"
1454 "    char            *ifa_name;    /* Name of interface */\n"
1455 "    unsigned int     ifa_flags;   /* Flags from SIOCGIFFLAGS */\n"
1456 "    struct sockaddr *ifa_addr;    /* Address of interface */\n"
1457 "    struct sockaddr *ifa_netmask; /* Netmask of interface */\n"
1458 "    union {\n"
1459 "        struct sockaddr *ifu_broadaddr;\n"
1460 "                         /* Broadcast address of interface */\n"
1461 "        struct sockaddr *ifu_dstaddr;\n"
1462 "                         /* Point-to-point destination address */\n"
1463 "    } ifa_ifu;\n"
1464 "#define              ifa_broadaddr ifa_ifu.ifu_broadaddr\n"
1465 "#define              ifa_dstaddr   ifa_ifu.ifu_dstaddr\n"
1466 "    void            *ifa_data;    /* Address-specific data */\n"
1467 "};\n"
1468 msgstr ""
1469 "struct ifaddrs {\n"
1470 "    struct ifaddrs  *ifa_next;    /* Next item in list */\n"
1471 "    char            *ifa_name;    /* Name of interface */\n"
1472 "    unsigned int     ifa_flags;   /* Flags from SIOCGIFFLAGS */\n"
1473 "    struct sockaddr *ifa_addr;    /* Address of interface */\n"
1474 "    struct sockaddr *ifa_netmask; /* Netmask of interface */\n"
1475 "    union {\n"
1476 "        struct sockaddr *ifu_broadaddr;\n"
1477 "                         /* Broadcast address of interface */\n"
1478 "        struct sockaddr *ifu_dstaddr;\n"
1479 "                         /* Point-to-point destination address */\n"
1480 "    } ifa_ifu;\n"
1481 "#define              ifa_broadaddr ifa_ifu.ifu_broadaddr\n"
1482 "#define              ifa_dstaddr   ifa_ifu.ifu_dstaddr\n"
1483 "    void            *ifa_data;    /* Address-specific data */\n"
1484 "};\n"
1485
1486 #. type: Plain text
1487 #: build/C/man3/getifaddrs.3:84
1488 msgid "The I<ifa_next> field contains a pointer to the next structure on the list, or NULL if this is the last item of the list."
1489 msgstr "I<ifa_next> フィールドにはリストの次の構造体へのポインターが格納される。 この要素がリストの最後の場合には NULL が入る。"
1490
1491 #.  The constant
1492 #.  .B IF NAMESIZE
1493 #.  indicates the maximum length of this field.
1494 #. type: Plain text
1495 #: build/C/man3/getifaddrs.3:91
1496 msgid "The I<ifa_name> points to the null-terminated interface name."
1497 msgstr "I<ifa_name> はヌル終端されたインターフェース名を指す。"
1498
1499 #. type: Plain text
1500 #: build/C/man3/getifaddrs.3:100
1501 msgid "The I<ifa_flags> field contains the interface flags, as returned by the B<SIOCGIFFLAGS> B<ioctl>(2)  operation (see B<netdevice>(7)  for a list of these flags)."
1502 msgstr "I<ifa_flags> フィールドには、 B<SIOCGIFFLAGS> B<ioctl>(2) 操作で返されるインターフェースのフラグが格納される (これらのフラグのリストについては B<netdevice>(7) を参照)。"
1503
1504 #. type: Plain text
1505 #: build/C/man3/getifaddrs.3:109
1506 msgid "The I<ifa_addr> field points to a structure containing the interface address.  (The I<sa_family> subfield should be consulted to determine the format of the address structure.)  This field may contain a null pointer."
1507 msgstr "I<ifa_addr> フィールドは、インターフェースのアドレスを格納した構造体へのポインターである (I<sa_family> サブフィールドを参照して、アドレス構造体の形式を判別すべきである)。 このフィールドはヌルポインターとなる場合がある。"
1508
1509 #. type: Plain text
1510 #: build/C/man3/getifaddrs.3:116
1511 msgid "The I<ifa_netmask> field points to a structure containing the netmask associated with I<ifa_addr>, if applicable for the address family.  This field may contain a null pointer."
1512 msgstr "I<ifa_netmask> フィールドには、 ネットマスクがあるアドレスファミリーであれば、 I<ifa_addr> に関連付けられたネットマスクを格納した構造体へのポインターが入る。 このフィールドはヌルポインターとなる場合がある。"
1513
1514 #. type: Plain text
1515 #: build/C/man3/getifaddrs.3:131
1516 msgid "Depending on whether the bit B<IFF_BROADCAST> or B<IFF_POINTOPOINT> is set in I<ifa_flags> (only one can be set at a time), either I<ifa_broadaddr> will contain the broadcast address associated with I<ifa_addr> (if applicable for the address family) or I<ifa_dstaddr> will contain the destination address of the point-to-point interface."
1517 msgstr "I<ifa_flags> にビット B<IFF_BROADCAST> か B<IFF_POINTOPOINT> のどちらが設定されているかにより (同時にはこれらのどちらか一方だけが設定される)、 I<ifa_broadaddr> に I<ifa_addr> に対応するブロードキャストが入るか (そのアドレスファミリーでブロードキャストがある場合)、 I<ifa_dstaddr> に point-to-point インターフェースの宛先アドレスが入るかが決まる。"
1518
1519 #. type: Plain text
1520 #: build/C/man3/getifaddrs.3:136
1521 msgid "The I<ifa_data> field points to a buffer containing address-family-specific data; this field may be NULL if there is no such data for this interface."
1522 msgstr "I<ifa_data> フィールドは、 アドレスファミリー固有のデータが入ったバッファーへのポインターである。 そのインターフェースでこのようなデータがない場合には、 このフィールドは NULL となる。"
1523
1524 #. type: Plain text
1525 #: build/C/man3/getifaddrs.3:142
1526 msgid "The data returned by B<getifaddrs>()  is dynamically allocated and should be freed using B<freeifaddrs>()  when no longer needed."
1527 msgstr "B<getifaddrs>() が返すデータは動的に確保される。 必要なくなった際には B<freeifaddrs>() を使って解放すべきである。"
1528
1529 #. type: Plain text
1530 #: build/C/man3/getifaddrs.3:149
1531 msgid "On success, B<getifaddrs>()  returns zero; on error, -1 is returned, and I<errno> is set appropriately."
1532 msgstr "成功すると、 B<getifaddrs> は 0 を返す。 エラーの場合、 -1 が返り、 I<errno> が適切に設定される。"
1533
1534 #. type: Plain text
1535 #: build/C/man3/getifaddrs.3:162
1536 msgid "B<getifaddrs>()  may fail and set I<errno> for any of the errors specified for B<socket>(2), B<bind>(2), B<getsockname>(2), B<recvmsg>(2), B<sendto>(2), B<malloc>(3), or B<realloc>(3)."
1537 msgstr "B<getifaddrs>() は失敗する場合があり、その場合には I<errno> には B<socket>(2), B<bind>(2), B<getsockname>(2), B<recvmsg>(2), B<sendto>(2), B<malloc>(3), B<realloc>(3) に対して規定されているエラーのいずれかが設定される。"
1538
1539 #. type: Plain text
1540 #: build/C/man3/getifaddrs.3:170
1541 msgid "The B<getifaddrs>()  function first appeared in glibc 2.3, but before glibc 2.3.3, the implementation supported only IPv4 addresses; IPv6 support was added in glibc 2.3.3.  Support of address families other than IPv4 is available only on kernels that support netlink."
1542 msgstr "B<getifaddrs>() 関数は glibc 2.3 で初めて登場したが、 glibc 2.3.3 より前のバージョンの実装では IPv4 アドレスだけがサポートされていた。 IPv6 のサポートは glibc 2.3.3 で追加された。 IPv4 以外のアドレスファミリーが B<getifaddrs> で利用できるのは、 netlink をサポートするカーネルの場合だけである。"
1543
1544 #.  , but the BSD-derived documentation generally
1545 #.  appears to be confused and obsolete on this point.
1546 #.  i.e., commonly it still says one of them will be NULL, even if
1547 #.  the ifa_ifu union is already present
1548 #. type: Plain text
1549 #: build/C/man3/getifaddrs.3:190
1550 msgid "Not in POSIX.1-2001.  This function first appeared in BSDi and is present on the BSD systems, but with slightly different semantics documented\\(emreturning one entry per interface, not per address.  This means I<ifa_addr> and other fields can actually be NULL if the interface has no address, and no link-level address is returned if the interface has an IP address assigned.  Also, the way of choosing either I<ifa_broadaddr> or I<ifa_dstaddr> differs on various systems."
1551 msgstr "POSIX.1-2001 にはない。 この関数は BSDi で初めて登場し、 BSD 系のシステムに存在するが、 ドキュメント上はかなり動作が異なり、アドレス毎ではなくインターフェース毎に 1 エントリを返す。 このことは、 インターフェースがアドレスを持たない場合には I<ifa_addr> や他のフィールドは実際に NULL になり、 インターフェースに IP アドレスが割り当てられている場合には リンクレベルのアドレスは返されない、ということを意味する。 また、 I<ifa_broadaddr> と I<ifa_dstaddr> のどちらを選択するかを決める方法は、 システムにより異なる。"
1552
1553 #. type: Plain text
1554 #: build/C/man3/getifaddrs.3:207
1555 msgid "The addresses returned on Linux will usually be the IPv4 and IPv6 addresses assigned to the interface, but also one B<AF_PACKET> address per interface containing lower-level details about the interface and its physical layer.  In this case, the I<ifa_data> field may contain a pointer to a I<struct rtnl_link_stats>, defined in I<E<lt>linux/if_link.hE<gt>> (in Linux 2.4 and earlier, I<struct net_device_stats>, defined in I<E<lt>linux/netdevice.hE<gt>>), which contains various interface attributes and statistics."
1556 msgstr "Linux では、 返されるアドレスは通常インターフェースに割り当てられた IPv4 アドレスと IPv6 アドレスになるが、 これ以外にインターフェース毎に一つ B<AF_PACKET> アドレスも返される。 B<AF_PACKET> アドレスには、 インターフェースとその物理層に関する低レベルの詳細が格納される。 この場合、 I<ifa_data> フィールドには、 I<E<lt>linux/if_link.hE<gt>> で定義される I<struct rtnl_link_stats> (Linux 2.4 以前では I<E<lt>linux/netdevice.hE<gt>> で定義される I<struct net_device_stats>) へのポインターが格納される。 この構造体には、インターフェースの様々な属性や統計情報が入る。"
1557
1558 #. type: Plain text
1559 #: build/C/man3/getifaddrs.3:214
1560 msgid "The program below demonstrates the use of B<getifaddrs>(), B<freeifaddrs>(), and B<getnameinfo>(3).  Here is what we see when running this program on one system:"
1561 msgstr "以下のプログラムは B<getifaddrs>(), B<freeifaddrs>(), B<getnameinfo>(3) の使用例である。 以下はこのプログラムをあるシステムで実行した際の出力である。"
1562
1563 #. type: Plain text
1564 #: build/C/man3/getifaddrs.3:235
1565 #, no-wrap
1566 msgid ""
1567 "$ B<./a.out>\n"
1568 "lo       AF_PACKET (17)\n"
1569 "                tx_packets =        524; rx_packets =        524\n"
1570 "                tx_bytes   =      38788; rx_bytes   =      38788\n"
1571 "wlp3s0   AF_PACKET (17)\n"
1572 "                tx_packets =     108391; rx_packets =     130245\n"
1573 "                tx_bytes   =   30420659; rx_bytes   =   94230014\n"
1574 "em1      AF_PACKET (17)\n"
1575 "                tx_packets =          0; rx_packets =          0\n"
1576 "                tx_bytes   =          0; rx_bytes   =          0\n"
1577 "lo       AF_INET (2)\n"
1578 "                address: E<lt>127.0.0.1E<gt>\n"
1579 "wlp3s0   AF_INET (2)\n"
1580 "                address: E<lt>192.168.235.137E<gt>\n"
1581 "lo       AF_INET6 (10)\n"
1582 "                address: E<lt>::1E<gt>\n"
1583 "wlp3s0   AF_INET6 (10)\n"
1584 "                address: E<lt>fe80::7ee9:d3ff:fef5:1a91%wlp3s0E<gt>\n"
1585 msgstr ""
1586 "$ B<./a.out>\n"
1587 "lo       AF_PACKET (17)\n"
1588 "                tx_packets =        524; rx_packets =        524\n"
1589 "                tx_bytes   =      38788; rx_bytes   =      38788\n"
1590 "wlp3s0   AF_PACKET (17)\n"
1591 "                tx_packets =     108391; rx_packets =     130245\n"
1592 "                tx_bytes   =   30420659; rx_bytes   =   94230014\n"
1593 "em1      AF_PACKET (17)\n"
1594 "                tx_packets =          0; rx_packets =          0\n"
1595 "                tx_bytes   =          0; rx_bytes   =          0\n"
1596 "lo       AF_INET (2)\n"
1597 "                address: E<lt>127.0.0.1E<gt>\n"
1598 "wlp3s0   AF_INET (2)\n"
1599 "                address: E<lt>192.168.235.137E<gt>\n"
1600 "lo       AF_INET6 (10)\n"
1601 "                address: E<lt>::1E<gt>\n"
1602 "wlp3s0   AF_INET6 (10)\n"
1603 "                address: E<lt>fe80::7ee9:d3ff:fef5:1a91%wlp3s0E<gt>\n"
1604
1605 #. type: SS
1606 #: build/C/man3/getifaddrs.3:237 build/C/man3/if_nameindex.3:121
1607 #: build/C/man2/recvmmsg.2:205
1608 #, no-wrap
1609 msgid "Program source"
1610 msgstr "プログラムのソース"
1611
1612 #. type: Plain text
1613 #: build/C/man3/getifaddrs.3:249
1614 #, no-wrap
1615 msgid ""
1616 "#define _GNU_SOURCE     /* To get defns of NI_MAXSERV and NI_MAXHOST */\n"
1617 "#include E<lt>arpa/inet.hE<gt>\n"
1618 "#include E<lt>sys/socket.hE<gt>\n"
1619 "#include E<lt>netdb.hE<gt>\n"
1620 "#include E<lt>ifaddrs.hE<gt>\n"
1621 "#include E<lt>stdio.hE<gt>\n"
1622 "#include E<lt>stdlib.hE<gt>\n"
1623 "#include E<lt>unistd.hE<gt>\n"
1624 "#include E<lt>linux/if_link.hE<gt>\n"
1625 msgstr ""
1626 "#define _GNU_SOURCE     /* To get defns of NI_MAXSERV and NI_MAXHOST */\n"
1627 "#include E<lt>arpa/inet.hE<gt>\n"
1628 "#include E<lt>sys/socket.hE<gt>\n"
1629 "#include E<lt>netdb.hE<gt>\n"
1630 "#include E<lt>ifaddrs.hE<gt>\n"
1631 "#include E<lt>stdio.hE<gt>\n"
1632 "#include E<lt>stdlib.hE<gt>\n"
1633 "#include E<lt>unistd.hE<gt>\n"
1634 "#include E<lt>linux/if_link.hE<gt>\n"
1635
1636 #. type: Plain text
1637 #: build/C/man3/getifaddrs.3:255
1638 #, no-wrap
1639 msgid ""
1640 "int main(int argc, char *argv[])\n"
1641 "{\n"
1642 "    struct ifaddrs *ifaddr, *ifa;\n"
1643 "    int family, s, n;\n"
1644 "    char host[NI_MAXHOST];\n"
1645 msgstr ""
1646 "int main(int argc, char *argv[])\n"
1647 "{\n"
1648 "    struct ifaddrs *ifaddr, *ifa;\n"
1649 "    int family, s, n;\n"
1650 "    char host[NI_MAXHOST];\n"
1651
1652 #. type: Plain text
1653 #: build/C/man3/getifaddrs.3:260
1654 #, no-wrap
1655 msgid ""
1656 "    if (getifaddrs(&ifaddr) == -1) {\n"
1657 "        perror(\"getifaddrs\");\n"
1658 "        exit(EXIT_FAILURE);\n"
1659 "    }\n"
1660 msgstr ""
1661 "    if (getifaddrs(&ifaddr) == -1) {\n"
1662 "        perror(\"getifaddrs\");\n"
1663 "        exit(EXIT_FAILURE);\n"
1664 "    }\n"
1665
1666 #. type: Plain text
1667 #: build/C/man3/getifaddrs.3:263
1668 #, no-wrap
1669 msgid ""
1670 "    /* Walk through linked list, maintaining head pointer so we\n"
1671 "       can free list later */\n"
1672 msgstr ""
1673 "    /* Walk through linked list, maintaining head pointer so we\n"
1674 "       can free list later */\n"
1675
1676 #. type: Plain text
1677 #: build/C/man3/getifaddrs.3:267
1678 #, no-wrap
1679 msgid ""
1680 "    for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa-E<gt>ifa_next, n++) {\n"
1681 "        if (ifa-E<gt>ifa_addr == NULL)\n"
1682 "            continue;\n"
1683 msgstr ""
1684 "    for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa-E<gt>ifa_next, n++) {\n"
1685 "        if (ifa-E<gt>ifa_addr == NULL)\n"
1686 "            continue;\n"
1687
1688 #. type: Plain text
1689 #: build/C/man3/getifaddrs.3:269
1690 #, no-wrap
1691 msgid "        family = ifa-E<gt>ifa_addr-E<gt>sa_family;\n"
1692 msgstr "        family = ifa-E<gt>ifa_addr-E<gt>sa_family;\n"
1693
1694 #. type: Plain text
1695 #: build/C/man3/getifaddrs.3:272
1696 #, no-wrap
1697 msgid ""
1698 "        /* Display interface name and family (including symbolic\n"
1699 "           form of the latter for the common families) */\n"
1700 msgstr ""
1701 "        /* Display interface name and family (including symbolic\n"
1702 "           form of the latter for the common families) */\n"
1703
1704 #. type: Plain text
1705 #: build/C/man3/getifaddrs.3:279
1706 #, no-wrap
1707 msgid ""
1708 "        printf(\"%-8s %s (%d)\\en\",\n"
1709 "               ifa-E<gt>ifa_name,\n"
1710 "               (family == AF_PACKET) ? \"AF_PACKET\" :\n"
1711 "               (family == AF_INET) ? \"AF_INET\" :\n"
1712 "               (family == AF_INET6) ? \"AF_INET6\" : \"???\",\n"
1713 "               family);\n"
1714 msgstr ""
1715 "        printf(\"%-8s %s (%d)\\en\",\n"
1716 "               ifa-E<gt>ifa_name,\n"
1717 "               (family == AF_PACKET) ? \"AF_PACKET\" :\n"
1718 "               (family == AF_INET) ? \"AF_INET\" :\n"
1719 "               (family == AF_INET6) ? \"AF_INET6\" : \"???\",\n"
1720 "               family);\n"
1721
1722 #. type: Plain text
1723 #: build/C/man3/getifaddrs.3:281
1724 #, no-wrap
1725 msgid "        /* For an AF_INET* interface address, display the address */\n"
1726 msgstr "        /* For an AF_INET* interface address, display the address */\n"
1727
1728 #. type: Plain text
1729 #: build/C/man3/getifaddrs.3:292
1730 #, no-wrap
1731 msgid ""
1732 "        if (family == AF_INET || family == AF_INET6) {\n"
1733 "            s = getnameinfo(ifa-E<gt>ifa_addr,\n"
1734 "                    (family == AF_INET) ? sizeof(struct sockaddr_in) :\n"
1735 "                                          sizeof(struct sockaddr_in6),\n"
1736 "                    host, NI_MAXHOST,\n"
1737 "                    NULL, 0, NI_NUMERICHOST);\n"
1738 "            if (s != 0) {\n"
1739 "                printf(\"getnameinfo() failed: %s\\en\", gai_strerror(s));\n"
1740 "                exit(EXIT_FAILURE);\n"
1741 "            }\n"
1742 msgstr ""
1743 "        if (family == AF_INET || family == AF_INET6) {\n"
1744 "            s = getnameinfo(ifa-E<gt>ifa_addr,\n"
1745 "                    (family == AF_INET) ? sizeof(struct sockaddr_in) :\n"
1746 "                                          sizeof(struct sockaddr_in6),\n"
1747 "                    host, NI_MAXHOST,\n"
1748 "                    NULL, 0, NI_NUMERICHOST);\n"
1749 "            if (s != 0) {\n"
1750 "                printf(\"getnameinfo() failed: %s\\en\", gai_strerror(s));\n"
1751 "                exit(EXIT_FAILURE);\n"
1752 "            }\n"
1753
1754 #. type: Plain text
1755 #: build/C/man3/getifaddrs.3:294
1756 #, no-wrap
1757 msgid "            printf(\"\\et\\etaddress: E<lt>%sE<gt>\\en\", host);\n"
1758 msgstr "            printf(\"\\et\\etaddress: E<lt>%sE<gt>\\en\", host);\n"
1759
1760 #. type: Plain text
1761 #: build/C/man3/getifaddrs.3:297
1762 #, no-wrap
1763 msgid ""
1764 "        } else if (family == AF_PACKET && ifa-E<gt>ifa_data != NULL) {\n"
1765 "            struct rtnl_link_stats *stats = ifa-E<gt>ifa_data;\n"
1766 msgstr ""
1767 "        } else if (family == AF_PACKET && ifa-E<gt>ifa_data != NULL) {\n"
1768 "            struct rtnl_link_stats *stats = ifa-E<gt>ifa_data;\n"
1769
1770 #. type: Plain text
1771 #: build/C/man3/getifaddrs.3:304
1772 #, no-wrap
1773 msgid ""
1774 "            printf(\"\\et\\ettx_packets = %10u; rx_packets = %10u\\en\"\n"
1775 "                   \"\\et\\ettx_bytes   = %10u; rx_bytes   = %10u\\en\",\n"
1776 "                   stats-E<gt>tx_packets, stats-E<gt>rx_packets,\n"
1777 "                   stats-E<gt>tx_bytes, stats-E<gt>rx_bytes);\n"
1778 "        }\n"
1779 "    }\n"
1780 msgstr ""
1781 "            printf(\"\\et\\ettx_packets = %10u; rx_packets = %10u\\en\"\n"
1782 "                   \"\\et\\ettx_bytes   = %10u; rx_bytes   = %10u\\en\",\n"
1783 "                   stats-E<gt>tx_packets, stats-E<gt>rx_packets,\n"
1784 "                   stats-E<gt>tx_bytes, stats-E<gt>rx_bytes);\n"
1785 "        }\n"
1786 "    }\n"
1787
1788 #. type: Plain text
1789 #: build/C/man3/getifaddrs.3:308
1790 #, no-wrap
1791 msgid ""
1792 "    freeifaddrs(ifaddr);\n"
1793 "    exit(EXIT_SUCCESS);\n"
1794 "}\n"
1795 msgstr ""
1796 "    freeifaddrs(ifaddr);\n"
1797 "    exit(EXIT_SUCCESS);\n"
1798 "}\n"
1799
1800 #. type: Plain text
1801 #: build/C/man3/getifaddrs.3:315
1802 msgid "B<bind>(2), B<getsockname>(2), B<socket>(2), B<packet>(7), B<ifconfig>(8)"
1803 msgstr "B<bind>(2), B<getsockname>(2), B<socket>(2), B<packet>(7), B<ifconfig>(8)"
1804
1805 #. type: TH
1806 #: build/C/man2/getsockname.2:40
1807 #, no-wrap
1808 msgid "GETSOCKNAME"
1809 msgstr "GETSOCKNAME"
1810
1811 #. type: TH
1812 #: build/C/man2/getsockname.2:40
1813 #, no-wrap
1814 msgid "2008-12-03"
1815 msgstr "2008-12-03"
1816
1817 #. type: Plain text
1818 #: build/C/man2/getsockname.2:43
1819 msgid "getsockname - get socket name"
1820 msgstr "getsockname - ソケットの名前を取得する"
1821
1822 #. type: Plain text
1823 #: build/C/man2/getsockname.2:49
1824 #, no-wrap
1825 msgid "B<int getsockname(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t *>I<addrlen>B<);>\n"
1826 msgstr "B<int getsockname(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t *>I<addrlen>B<);>\n"
1827
1828 #. type: Plain text
1829 #: build/C/man2/getsockname.2:62
1830 msgid "B<getsockname>()  returns the current address to which the socket I<sockfd> is bound, in the buffer pointed to by I<addr>.  The I<addrlen> argument should be initialized to indicate the amount of space (in bytes) pointed to by I<addr>.  On return it contains the actual size of the socket address."
1831 msgstr "B<getsockname>()  は、ソケット I<sockfd> に結び付けられている現在のアドレスを、 I<addr> が指すバッファーに格納して返す。 I<addrlen> 引き数は、 I<addr> が指している領域のサイズ (バイト単位) に初期化しておかなければならない。 関数が返る時には、 I<addrlen> にはソケットアドレスの実際のサイズ (バイト単位) が格納される。"
1832
1833 #. type: Plain text
1834 #: build/C/man2/getsockname.2:78 build/C/man2/getsockopt.2:142
1835 #: build/C/man2/listen.2:109
1836 msgid "The argument I<sockfd> is not a valid descriptor."
1837 msgstr "引き数 I<sockfd> は有効なディスクリプターでない。"
1838
1839 #. type: Plain text
1840 #: build/C/man2/getsockname.2:84
1841 msgid "The I<addr> argument points to memory not in a valid part of the process address space."
1842 msgstr "引き数 I<addr> の指しているメモリーがプロセスのアドレス空間の有効な部分ではない。"
1843
1844 #. type: Plain text
1845 #: build/C/man2/getsockname.2:88
1846 msgid "I<addrlen> is invalid (e.g., is negative)."
1847 msgstr "I<addrlen> が不正である (例えば、負で場合など)。"
1848
1849 #. type: TP
1850 #: build/C/man2/getsockname.2:88 build/C/man3/if_nameindex.3:83
1851 #: build/C/man2/send.2:367
1852 #, no-wrap
1853 msgid "B<ENOBUFS>"
1854 msgstr "B<ENOBUFS>"
1855
1856 #. type: Plain text
1857 #: build/C/man2/getsockname.2:92
1858 msgid "Insufficient resources were available in the system to perform the operation."
1859 msgstr "処理をするだけの十分なリソースがシステムに無い。"
1860
1861 #. type: Plain text
1862 #: build/C/man2/getsockname.2:97 build/C/man2/getsockopt.2:171
1863 msgid "The argument I<sockfd> is a file, not a socket."
1864 msgstr "引き数 I<sockfd> がソケットではなくファイルである。"
1865
1866 #.  SVr4 documents additional ENOMEM
1867 #.  and ENOSR error codes.
1868 #. type: Plain text
1869 #: build/C/man2/getsockname.2:103
1870 msgid "SVr4, 4.4BSD (the B<getsockname>()  function call appeared in 4.2BSD), POSIX.1-2001."
1871 msgstr "SVr4, 4.4BSD (B<getsockname>()  関数は 4.2BSD で追加された), POSIX.1-2001."
1872
1873 #. type: Plain text
1874 #: build/C/man2/getsockname.2:114
1875 msgid "The third argument of B<getsockname>()  is in reality an I<int\\ *> (and this is what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
1876 msgstr "B<getsockname>()  の三番目の引き数は (4.x BSD や libc4, libc5 と同様に) 実際には I<int\\ *> である。 glibc でも使われている現在の I<socklen_t> に関して、 POSIX には少し混乱がある。 詳しくは B<accept>(2)  を参照のこと。"
1877
1878 #. type: Plain text
1879 #: build/C/man2/getsockname.2:121
1880 msgid "B<bind>(2), B<socket>(2), B<getifaddrs>(3), B<ip>(7), B<socket>(7), B<unix>(7)"
1881 msgstr "B<bind>(2), B<socket>(2), B<getifaddrs>(3), B<ip>(7), B<socket>(7), B<unix>(7)"
1882
1883 #. type: TH
1884 #: build/C/man2/getsockopt.2:44
1885 #, no-wrap
1886 msgid "GETSOCKOPT"
1887 msgstr "GETSOCKOPT"
1888
1889 #. type: TH
1890 #: build/C/man2/getsockopt.2:44
1891 #, no-wrap
1892 msgid "2014-04-28"
1893 msgstr "2014-04-28"
1894
1895 #. type: Plain text
1896 #: build/C/man2/getsockopt.2:47
1897 msgid "getsockopt, setsockopt - get and set options on sockets"
1898 msgstr "getsockopt, setsockopt - ソケットのオプションの設定と取得を行なう"
1899
1900 #. type: Plain text
1901 #: build/C/man2/getsockopt.2:57
1902 #, no-wrap
1903 msgid ""
1904 "B<int getsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1905 "B<               void *>I<optval>B<, socklen_t *>I<optlen>B<);>\n"
1906 "B<int setsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1907 "B<               const void *>I<optval>B<, socklen_t >I<optlen>B<);>\n"
1908 msgstr ""
1909 "B<int getsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1910 "B<               void *>I<optval>B<, socklen_t *>I<optlen>B<);>\n"
1911 "B<int setsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1912 "B<               const void *>I<optval>B<, socklen_t >I<optlen>B<);>\n"
1913
1914 #. type: Plain text
1915 #: build/C/man2/getsockopt.2:67
1916 msgid "B<getsockopt>()  and B<setsockopt>()  manipulate options for the socket referred to by the file descriptor I<sockfd>.  Options may exist at multiple protocol levels; they are always present at the uppermost socket level."
1917 msgstr "B<getsockopt>()  と B<setsockopt>()  は、ファイルディスクリプター I<socket> で参照されるソケットに関連するオプションの操作を行う。 オプションは複数のプロトコル層(level)に存在するかもしれないが、 これらは常に最上位のソケット層へと設定される。"
1918
1919 #. type: Plain text
1920 #: build/C/man2/getsockopt.2:86
1921 msgid "When manipulating socket options, the level at which the option resides and the name of the option must be specified.  To manipulate options at the sockets API level, I<level> is specified as B<SOL_SOCKET>.  To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied.  For example, to indicate that an option is to be interpreted by the B<TCP> protocol, I<level> should be set to the protocol number of B<TCP>; see B<getprotoent>(3)."
1922 msgstr "ソケットオプションを操作する際には、オプションの層 (level) と オプションの名前を指定しなければならない。 ソケット API 層でオプションを操作する為には、 I<level> を B<SOL_SOCKET> に指定する。 他の全ての層でオプションを操作する為には、与えられたオプションの 制御主体となるプロトコルのプロトコル番号を指定する。例えば、 オプションが B<TCP> プロトコルで解釈されるべきことを指示するには、 I<level> に B<TCP> のプロトコル番号を指定しなければならない。 B<getprotoent>(3)  を参照すること。"
1923
1924 #. type: Plain text
1925 #: build/C/man2/getsockopt.2:108
1926 msgid "The arguments I<optval> and I<optlen> are used to access option values for B<setsockopt>().  For B<getsockopt>()  they identify a buffer in which the value for the requested option(s) are to be returned.  For B<getsockopt>(), I<optlen> is a value-result argument, initially containing the size of the buffer pointed to by I<optval>, and modified on return to indicate the actual size of the value returned.  If no option value is to be supplied or returned, I<optval> may be NULL."
1927 msgstr "I<optval> と I<optlen> 引き数は B<setsockopt>()  のオプションの値にアクセスするために用いられる。 B<getsockopt>()  では要求したオプションの値を返すためのバッファーを指定する。 B<getsockopt>()  では I<optlen> は値と結果両用の引き数で、最初に I<optval> の指しているバッファーのサイズを与え、実際に返される値のサイズに 書き換えられる。もしオプション値を与えず、返されもしない場合には I<optval> は NULL でも良い。"
1928
1929 #. type: Plain text
1930 #: build/C/man2/getsockopt.2:118
1931 msgid "I<Optname> and any specified options are passed uninterpreted to the appropriate protocol module for interpretation.  The include file I<E<lt>sys/socket.hE<gt>> contains definitions for socket level options, described below.  Options at other protocol levels vary in format and name; consult the appropriate entries in section 4 of the manual."
1932 msgstr "I<optname> および指定されたオプションは解釈されずに、適切なプロトコルモジュールに 渡されて解釈される。インクルードファイル I<E<lt>sys/socket.hE<gt>> には後述のソケット層のオプションの定義が含まれている。 他のプロトコル層では名前や形式は異なる。 マニュアルのセクション 4 の適切なエントリを参照すること。"
1933
1934 #. type: Plain text
1935 #: build/C/man2/getsockopt.2:127
1936 msgid "Most socket-level options utilize an I<int> argument for I<optval>.  For B<setsockopt>(), the argument should be nonzero to enable a boolean option, or zero if the option is to be disabled."
1937 msgstr "ほとんどのソケット層のオプションは I<optval> に I<int> 引き数を利用する。 B<setsockopt>()  で、二値(boolean)オプションを有効(enable)にするにはゼロ以外を指定し、 無効(disable)にするにはゼロを指定する。"
1938
1939 #. type: Plain text
1940 #: build/C/man2/getsockopt.2:131
1941 msgid "For a description of the available socket options see B<socket>(7)  and the appropriate protocol man pages."
1942 msgstr "利用可能なソケットオプションの説明に関しては、 B<socket>(7)  と適切なプロトコルの man ページを参照のこと。"
1943
1944 #. type: Plain text
1945 #: build/C/man2/getsockopt.2:152
1946 msgid "The address pointed to by I<optval> is not in a valid part of the process address space.  For B<getsockopt>(), this error may also be returned if I<optlen> is not in a valid part of the process address space."
1947 msgstr "I<optval> で指定されたアドレスがプロセスのアドレス空間の有効な部分ではない。 B<getsockopt>()  の場合、 I<optlen> がプロセスのアドレス空間の有効な部分でない場合にもこのエラーが返される。"
1948
1949 #. type: Plain text
1950 #: build/C/man2/getsockopt.2:163
1951 msgid "I<optlen> invalid in B<setsockopt>().  In some cases this error can also occur for an invalid value in I<optval> (e.g., for the B<IP_ADD_MEMBERSHIP> option described in B<ip>(7))."
1952 msgstr "B<setsockopt>()  で I<option> が不正である。 I<optval> に無効な値が指定された場合にも、このエラーが発生する可能性がある (例えば、 B<ip>(7)  に説明がある B<IP_ADD_MEMBERSHIP> オプションなど)。"
1953
1954 #. type: TP
1955 #: build/C/man2/getsockopt.2:163
1956 #, no-wrap
1957 msgid "B<ENOPROTOOPT>"
1958 msgstr "B<ENOPROTOOPT>"
1959
1960 #. type: Plain text
1961 #: build/C/man2/getsockopt.2:166
1962 msgid "The option is unknown at the level indicated."
1963 msgstr "指定された層(level)にはこのオプションは存在しない。"
1964
1965 #.  SVr4 documents additional ENOMEM and ENOSR error codes, but does
1966 #.  not document the
1967 #.  .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
1968 #.  options
1969 #. type: Plain text
1970 #: build/C/man2/getsockopt.2:178
1971 msgid "SVr4, 4.4BSD (these system calls first appeared in 4.2BSD), POSIX.1-2001."
1972 msgstr "SVr4, 4.4BSD (これらのシステムコールは 4.2BSD で最初に現れた), POSIX.1-2001."
1973
1974 #. type: Plain text
1975 #: build/C/man2/getsockopt.2:199
1976 msgid "The I<optlen> argument of B<getsockopt>()  and B<setsockopt>()  is in reality an I<int [*]> (and this is what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
1977 msgstr "B<getsockopt>()  と B<setsockopt>()  の I<optlen> 引き数は実際は I<int [*]> である (そして 4.x BSD と libc4 と libc5 はそうなっている)。 POSIX では紆余曲折を経て現在の I<socklen_t> になっており、 glibc でも I<socklen_t> を使っている。 B<accept>(2)  も参照のこと。"
1978
1979 #. type: Plain text
1980 #: build/C/man2/getsockopt.2:202
1981 msgid "Several of the socket options should be handled at lower levels of the system."
1982 msgstr "ソケットのオプションのいくつかはシステムのより低い層で 処理されるべきである。"
1983
1984 #. type: Plain text
1985 #: build/C/man2/getsockopt.2:213
1986 msgid "B<ioctl>(2), B<socket>(2), B<getprotoent>(3), B<protocols>(5), B<ip>(7), B<packet>(7), B<socket>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
1987 msgstr "B<ioctl>(2), B<socket>(2), B<getprotoent>(3), B<protocols>(5), B<ip>(7), B<packet>(7), B<socket>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
1988
1989 #. type: TH
1990 #: build/C/man3/if_nameindex.3:26
1991 #, no-wrap
1992 msgid "IF_NAMEINDEX"
1993 msgstr "IF_NAMEINDEX"
1994
1995 #. type: TH
1996 #: build/C/man3/if_nameindex.3:26
1997 #, no-wrap
1998 msgid "2012-11-21"
1999 msgstr "2012-11-21"
2000
2001 #. type: Plain text
2002 #: build/C/man3/if_nameindex.3:29
2003 msgid "if_nameindex, if_freenameindex - get network interface names and indexes"
2004 msgstr "if_nameindex, if_freenameindex - ネットワークインターフェースの名前とインデックスを取得する"
2005
2006 #. type: Plain text
2007 #: build/C/man3/if_nameindex.3:32 build/C/man3/if_nametoindex.3:32
2008 #, no-wrap
2009 msgid "B<#include E<lt>net/if.hE<gt>>\n"
2010 msgstr "B<#include E<lt>net/if.hE<gt>>\n"
2011
2012 #. type: Plain text
2013 #: build/C/man3/if_nameindex.3:35
2014 #, no-wrap
2015 msgid ""
2016 "B<struct if_nameindex *if_nameindex(void);>\n"
2017 "B<void if_freenameindex(struct if_nameindex *>I<ptr>B<);>\n"
2018 msgstr ""
2019 "B<struct if_nameindex *if_nameindex(void);>\n"
2020 "B<void if_freenameindex(struct if_nameindex *>I<ptr>B<);>\n"
2021
2022 #. type: Plain text
2023 #: build/C/man3/if_nameindex.3:46
2024 msgid "The B<if_nameindex>()  function returns an array of I<if_nameindex> structures, each containing information about one of the network interfaces on the local system.  The I<if_nameindex> structure contains at least the following entries:"
2025 msgstr "B<if_nameindex>() 関数は I<if_nameindex> 構造体の配列を返す。 各構造体にはローカルシステムのネットワークインターフェースのいずれかの情報が入る。 I<if_nameindex> 構造体には少なくとも以下のフィールドがある。"
2026
2027 #. type: Plain text
2028 #: build/C/man3/if_nameindex.3:51
2029 #, no-wrap
2030 msgid ""
2031 "    unsigned int if_index; /* Index of interface (1, 2, ...) */\n"
2032 "    char        *if_name;  /* Null-terminated name (\"eth0\", etc.) */\n"
2033 msgstr ""
2034 "    unsigned int if_index; /* インターフェースのインデックス (1, 2, ...) */\n"
2035 "    char        *if_name;  /*ヌル終端された名前 (\"eth0\" など) */\n"
2036
2037 #. type: Plain text
2038 #: build/C/man3/if_nameindex.3:65
2039 msgid "The I<if_index> field contains the interface index.  The I<ifa_name> field points to the null-terminated interface name.  The end of the array is indicated by entry with I<if_index> set to zero and I<ifa_name> set to NULL."
2040 msgstr "I<if_index> フィールドにはインターフェースのインデックスが入る。 I<ifa_name> フィールドはヌル終端されたインターフェース名を指す。 配列の最後は、 I<if_index> が 0 で I<ifa_name> が NULL のエントリで示される。"
2041
2042 #. type: Plain text
2043 #: build/C/man3/if_nameindex.3:71
2044 msgid "The data structure returned by B<if_nameindex>()  is dynamically allocated and should be freed using B<if_freenameindex>()  when no longer needed."
2045 msgstr "B<if_nameindex>() が返すデータ構造体は動的に確保される。 必要なくなった際には B<if_freenameindex>() で解放すべきである。"
2046
2047 #. type: Plain text
2048 #: build/C/man3/if_nameindex.3:78
2049 msgid "On success, B<if_nameindex>()  returns pointer to the array; on error, NULL is returned, and I<errno> is set appropriately."
2050 msgstr "成功した場合には B<if_nameindex>() は配列へのポインターを返す。エラー時には NULL が返され、 I<errno> が適切に設定される。"
2051
2052 #. type: Plain text
2053 #: build/C/man3/if_nameindex.3:83
2054 msgid "B<if_nameindex>()  may fail and set I<errno> if:"
2055 msgstr "B<if_nameindex>() が失敗した場合には以下の I<errno> が設定される。"
2056
2057 #. type: Plain text
2058 #: build/C/man3/if_nameindex.3:86
2059 msgid "Insufficient resources available."
2060 msgstr "利用可能なリソースが十分にない。"
2061
2062 #. type: Plain text
2063 #: build/C/man3/if_nameindex.3:97
2064 msgid "B<if_nameindex>()  may also fail for any of the errors specified for B<socket>(2), B<bind>(2), B<ioctl>(2), B<getsockname>(2), B<recvmsg>(2), B<sendto>(2), or B<malloc>(3)."
2065 msgstr "B<if_nameindex>() は、 B<socket>(2), B<bind>(2), B<ioctl>(2), B<getsockname>(2), B<recvmsg>(2), B<sendto>(2), B<malloc>(3) に対して規定されているエラーのいずれかで失敗する場合がある。"
2066
2067 #. type: Plain text
2068 #: build/C/man3/if_nameindex.3:104
2069 msgid "The B<if_nameindex>()  function first appeared in glibc 2.1, but before glibc 2.3.4, the implementation supported only interfaces with IPv4 addresses.  Support of interfaces that don't have IPv4 addresses is available only on kernels that support netlink."
2070 msgstr "B<if_nameindex>() 関数は glibc 2.1 で初めて登場したが、 glibc 2.3.4 より前のバージョンの実装では IPv4 アドレスを持つインターフェースのみをサポートしていた。 IPv4 アドレスを持たないインターフェースがサポートされているのは、 netlink をサポートするカーネルにおいてのみである。"
2071
2072 #. type: Plain text
2073 #: build/C/man3/if_nameindex.3:106 build/C/man3/if_nametoindex.3:94
2074 msgid "RFC\\ 3493, POSIX.1-2001."
2075 msgstr "RFC\\ 3493, POSIX.1-2001."
2076
2077 #. type: Plain text
2078 #: build/C/man3/if_nameindex.3:108 build/C/man3/if_nametoindex.3:96
2079 msgid "This function first appeared in BSDi."
2080 msgstr "この関数は BSDi 初めて登場した。"
2081
2082 #. type: Plain text
2083 #: build/C/man3/if_nameindex.3:112
2084 msgid "The program below demonstrates the use of the functions described on this page.  An example of the output this program might produce is the following:"
2085 msgstr "以下のプログラムはこのページで説明した関数の使い方を示している。このプログラムが生成する出力は以下のようになる。"
2086
2087 #. type: Plain text
2088 #: build/C/man3/if_nameindex.3:119
2089 #, no-wrap
2090 msgid ""
2091 "$ B<./a.out>I<\n"
2092 "1: lo\n"
2093 "2: wlan0\n"
2094 "3: em1>\n"
2095 msgstr ""
2096 "$ B<./a.out>I<\n"
2097 "1: lo\n"
2098 "2: wlan0\n"
2099 "3: em1>\n"
2100
2101 #. type: Plain text
2102 #: build/C/man3/if_nameindex.3:127
2103 #, no-wrap
2104 msgid ""
2105 "#include E<lt>net/if.hE<gt>\n"
2106 "#include E<lt>stdio.hE<gt>\n"
2107 "#include E<lt>stdlib.hE<gt>\n"
2108 "#include E<lt>unistd.hE<gt>\n"
2109 msgstr ""
2110 "#include E<lt>net/if.hE<gt>\n"
2111 "#include E<lt>stdio.hE<gt>\n"
2112 "#include E<lt>stdlib.hE<gt>\n"
2113 "#include E<lt>unistd.hE<gt>\n"
2114
2115 #. type: Plain text
2116 #: build/C/man3/if_nameindex.3:132
2117 #, no-wrap
2118 msgid ""
2119 "int\n"
2120 "main(int argc, char *argv[])\n"
2121 "{\n"
2122 "    struct if_nameindex *if_ni, *i;\n"
2123 msgstr ""
2124 "int\n"
2125 "main(int argc, char *argv[])\n"
2126 "{\n"
2127 "    struct if_nameindex *if_ni, *i;\n"
2128
2129 #. type: Plain text
2130 #: build/C/man3/if_nameindex.3:138
2131 #, no-wrap
2132 msgid ""
2133 "    if_ni = if_nameindex();\n"
2134 "    if (if_ni == NULL) {\n"
2135 "        perror(\"if_nameindex\");\n"
2136 "        exit(EXIT_FAILURE);\n"
2137 "    }\n"
2138 msgstr ""
2139 "    if_ni = if_nameindex();\n"
2140 "    if (if_ni == NULL) {\n"
2141 "        perror(\"if_nameindex\");\n"
2142 "        exit(EXIT_FAILURE);\n"
2143 "    }\n"
2144
2145 #. type: Plain text
2146 #: build/C/man3/if_nameindex.3:141
2147 #, no-wrap
2148 msgid ""
2149 "    for (i = if_ni; ! (i-E<gt>if_index == 0 && i-E<gt>if_name == NULL); i++)\n"
2150 "        printf(\"%u: %s\\en\", i-E<gt>if_index, i-E<gt>if_name);\n"
2151 msgstr ""
2152 "    for (i = if_ni; ! (i-E<gt>if_index == 0 && i-E<gt>if_name == NULL); i++)\n"
2153 "        printf(\"%u: %s\\en\", i-E<gt>if_index, i-E<gt>if_name);\n"
2154
2155 #. type: Plain text
2156 #: build/C/man3/if_nameindex.3:143
2157 #, no-wrap
2158 msgid "    if_freenameindex(if_ni);\n"
2159 msgstr "    if_freenameindex(if_ni);\n"
2160
2161 #. type: Plain text
2162 #: build/C/man3/if_nameindex.3:146 build/C/man2/select.2:591
2163 #, no-wrap
2164 msgid ""
2165 "    exit(EXIT_SUCCESS);\n"
2166 "}\n"
2167 msgstr ""
2168 "    exit(EXIT_SUCCESS);\n"
2169 "}\n"
2170
2171 #. type: Plain text
2172 #: build/C/man3/if_nameindex.3:154
2173 msgid "B<getsockopt>(2), B<setsockopt>(2), B<getifaddrs>(3), B<if_indextoname>(3), B<if_nametoindex>(3), B<ifconfig>(8)"
2174 msgstr "B<getsockopt>(2), B<setsockopt>(2), B<getifaddrs>(3), B<if_indextoname>(3), B<if_nametoindex>(3), B<ifconfig>(8)"
2175
2176 #. type: TH
2177 #: build/C/man3/if_nametoindex.3:25
2178 #, no-wrap
2179 msgid "IF_NAMETOINDEX"
2180 msgstr "IF_NAMETOINDEX"
2181
2182 #. type: TH
2183 #: build/C/man3/if_nametoindex.3:25
2184 #, no-wrap
2185 msgid "2014-04-01"
2186 msgstr "2014-04-01"
2187
2188 #. type: Plain text
2189 #: build/C/man3/if_nametoindex.3:29
2190 msgid "if_nametoindex, if_indextoname - mappings between network interface names and indexes"
2191 msgstr "if_nametoindex, if_indextoname - ネットワークインターフェースの名前とインデックスのマッピングを行う"
2192
2193 #. type: Plain text
2194 #: build/C/man3/if_nametoindex.3:34
2195 #, no-wrap
2196 msgid "B<unsigned int if_nametoindex(const char *>I<ifname>B<);>\n"
2197 msgstr "B<unsigned int if_nametoindex(const char *>I<ifname>B<);>\n"
2198
2199 #. type: Plain text
2200 #: build/C/man3/if_nametoindex.3:36
2201 #, no-wrap
2202 msgid "B<char *if_indextoname(unsigned int ifindex, char *>I<ifname>B<);>\n"
2203 msgstr "B<char *if_indextoname(unsigned int ifindex, char *>I<ifname>B<);>\n"
2204
2205 #. type: Plain text
2206 #: build/C/man3/if_nametoindex.3:43
2207 msgid "The B<if_nametoindex>()  function returns the index of the network interface corresponding to the name I<ifname>."
2208 msgstr "B<if_nametoindex>() 関数は、 名前が I<ifname> のネットワークインターフェースのインデックスを返す。"
2209
2210 #. type: Plain text
2211 #: build/C/man3/if_nametoindex.3:54
2212 msgid "The B<if_indextoname>()  function returns the name of the network interface corresponding to the interface index I<ifindex>.  The name is placed in the buffer pointed to by I<ifname>.  The buffer must allow for the storage of at least B<IF_NAMESIZE> bytes."
2213 msgstr "B<if_indextoname>() 関数は、 インターフェースのインデックスが I<ifindex> に対応するネットワークインターフェースの名前を返す。 名前は I<ifname> が指すバッファーに格納される。 バッファーは少なくとも B<IF_NAMESIZE> バイトの領域が必要である。"
2214
2215 #. type: Plain text
2216 #: build/C/man3/if_nametoindex.3:61
2217 msgid "On success, B<if_nametoindex>()  returns the index number of the network interface; on error, 0 is returned and I<errno> is set appropriately."
2218 msgstr "成功した場合、 B<if_nametoindex>() はネットワークインターフェースのインデックス番号を返す。エラーの場合、 0 を返し、 I<errno> を適切に設定にする。"
2219
2220 #. type: Plain text
2221 #: build/C/man3/if_nametoindex.3:69
2222 msgid "On success, B<if_indextoname>()  returns I<ifname>; on error, NULL is returned and I<errno> is set appropriately."
2223 msgstr "成功した場合には B<if_indextoname>() は I<ifname> を返す。エラー時には NULL が返され、 I<errno> が適切に設定される。"
2224
2225 #. type: Plain text
2226 #: build/C/man3/if_nametoindex.3:74
2227 msgid "B<if_indextoname>()  may fail and set I<errno> if:"
2228 msgstr "B<if_indextoname>() は以下の I<errno> で失敗する場合がある。"
2229
2230 #. type: TP
2231 #: build/C/man3/if_nametoindex.3:74
2232 #, no-wrap
2233 msgid "B<ENXIO>"
2234 msgstr "B<ENXIO>"
2235
2236 #. type: Plain text
2237 #: build/C/man3/if_nametoindex.3:77
2238 msgid "No interface found for the index."
2239 msgstr "インデックスに対応するインターフェースがない。"
2240
2241 #. type: Plain text
2242 #: build/C/man3/if_nametoindex.3:85
2243 msgid "B<if_nametoindex>()  and B<if_indextoname>()  may also fail for any of the errors specified for B<socket>(2)  or B<ioctl>(2)."
2244 msgstr "B<if_nametoindex>() と B<if_indextoname>() は、 B<socket>(2) と B<ioctl>(2) に対して規定されているエラーのいずれかで失敗する場合がある。"
2245
2246 #. type: Plain text
2247 #: build/C/man3/if_nametoindex.3:92
2248 msgid "The B<if_nametoindex>()  and B<if_indextoname>()  functions are thread-safe."
2249 msgstr "関数 B<if_nametoindex>() と B<if_indextoname>() はスレッドセーフである。"
2250
2251 #. type: Plain text
2252 #: build/C/man3/if_nametoindex.3:100
2253 msgid "B<getifaddrs>(3), B<if_nameindex>(3), B<ifconfig>(8)"
2254 msgstr "B<getifaddrs>(3), B<if_nameindex>(3), B<ifconfig>(8)"
2255
2256 #. type: TH
2257 #: build/C/man2/listen.2:45
2258 #, no-wrap
2259 msgid "LISTEN"
2260 msgstr "LISTEN"
2261
2262 #. type: TH
2263 #: build/C/man2/listen.2:45
2264 #, no-wrap
2265 msgid "2014-05-10"
2266 msgstr "2014-05-10"
2267
2268 #. type: Plain text
2269 #: build/C/man2/listen.2:48
2270 msgid "listen - listen for connections on a socket"
2271 msgstr "listen - ソケット(socket)上の接続を待つ"
2272
2273 #. type: Plain text
2274 #: build/C/man2/listen.2:55
2275 #, no-wrap
2276 msgid "B<int listen(int >I<sockfd>B<, int >I<backlog>B<);>\n"
2277 msgstr "B<int listen(int >I<sockfd>B<, int >I<backlog>B<);>\n"
2278
2279 #. type: Plain text
2280 #: build/C/man2/listen.2:63
2281 msgid "B<listen>()  marks the socket referred to by I<sockfd> as a passive socket, that is, as a socket that will be used to accept incoming connection requests using B<accept>(2)."
2282 msgstr "B<listen>()  は I<sockfd> が参照するソケットを接続待ちソケット (passive socket) として印をつける。 接続待ちソケットとは、 B<accept>(2)  を使って到着した接続要求を受け付けるのに使用されるソケットである。"
2283
2284 #. type: Plain text
2285 #: build/C/man2/listen.2:70
2286 msgid "The I<sockfd> argument is a file descriptor that refers to a socket of type B<SOCK_STREAM> or B<SOCK_SEQPACKET>."
2287 msgstr "I<sockfd> 引き数は、 B<SOCK_STREAM> 型か B<SOCK_SEQPACKET> 型のソケットを参照するファイルディスクリプターである。"
2288
2289 #. type: Plain text
2290 #: build/C/man2/listen.2:82
2291 msgid "The I<backlog> argument defines the maximum length to which the queue of pending connections for I<sockfd> may grow.  If a connection request arrives when the queue is full, the client may receive an error with an indication of B<ECONNREFUSED> or, if the underlying protocol supports retransmission, the request may be ignored so that a later reattempt at connection succeeds."
2292 msgstr "I<backlog> 引き数は、 I<sockfd> についての保留中の接続のキューの最大長を指定する。 キューがいっぱいの状態で接続要求が到着すると、クライアントは B<ECONNREFUSED> というエラーを受け取る。下位層のプロトコルが再送信をサポート していれば、要求は無視され、これ以降の接続要求の再送信が成功するかもしれない。"
2293
2294 #. type: Plain text
2295 #: build/C/man2/listen.2:91
2296 msgid "Another socket is already listening on the same port."
2297 msgstr "別のソケットが既に同じポートを listen している。"
2298
2299 #. type: Plain text
2300 #: build/C/man2/listen.2:114 build/C/man2/send.2:386
2301 msgid "The argument I<sockfd> is not a socket."
2302 msgstr "引き数 I<sockfd> はソケットではない。"
2303
2304 #. type: Plain text
2305 #: build/C/man2/listen.2:119
2306 msgid "The socket is not of a type that supports the B<listen>()  operation."
2307 msgstr "ソケットは B<listen>()  がサポートしている型ではない。"
2308
2309 #. type: Plain text
2310 #: build/C/man2/listen.2:124
2311 msgid "4.4BSD, POSIX.1-2001.  The B<listen>()  function call first appeared in 4.2BSD."
2312 msgstr "4.4BSD, POSIX.1-2001.  B<listen>()  関数は 4.2BSDで初めて実装された。"
2313
2314 #. type: Plain text
2315 #: build/C/man2/listen.2:126
2316 msgid "To accept connections, the following steps are performed:"
2317 msgstr "接続を受け付けるには、以下の処理が実行される。"
2318
2319 #. type: TP
2320 #: build/C/man2/listen.2:127 build/C/man2/select_tut.2:347
2321 #, no-wrap
2322 msgid "1."
2323 msgstr "1."
2324
2325 #. type: Plain text
2326 #: build/C/man2/listen.2:130
2327 msgid "A socket is created with B<socket>(2)."
2328 msgstr "B<socket>(2)  でソケットを作成する。"
2329
2330 #. type: TP
2331 #: build/C/man2/listen.2:130 build/C/man2/select_tut.2:356
2332 #, no-wrap
2333 msgid "2."
2334 msgstr "2."
2335
2336 #. type: Plain text
2337 #: build/C/man2/listen.2:136
2338 msgid "The socket is bound to a local address using B<bind>(2), so that other sockets may be B<connect>(2)ed to it."
2339 msgstr "B<bind>(2)  を使ってソケットにローカルアドレスを割り当てて、 他のソケットがこのソケットに B<connect>(2)  できるようにする。"
2340
2341 #. type: TP
2342 #: build/C/man2/listen.2:136 build/C/man2/select_tut.2:360
2343 #, no-wrap
2344 msgid "3."
2345 msgstr "3."
2346
2347 #. type: Plain text
2348 #: build/C/man2/listen.2:140
2349 msgid "A willingness to accept incoming connections and a queue limit for incoming connections are specified with B<listen>()."
2350 msgstr "B<listen>()  を使って、接続要求を受け付ける意志と接続要求を入れるキュー長を指定する。"
2351
2352 #. type: TP
2353 #: build/C/man2/listen.2:140 build/C/man2/select_tut.2:367
2354 #, no-wrap
2355 msgid "4."
2356 msgstr "4."
2357
2358 #. type: Plain text
2359 #: build/C/man2/listen.2:143
2360 msgid "Connections are accepted with B<accept>(2)."
2361 msgstr "B<accept>(2)  を使って接続を受け付ける。"
2362
2363 #. type: Plain text
2364 #: build/C/man2/listen.2:166
2365 msgid "The behavior of the I<backlog> argument on TCP sockets changed with Linux 2.2.  Now it specifies the queue length for I<completely> established sockets waiting to be accepted, instead of the number of incomplete connection requests.  The maximum length of the queue for incomplete sockets can be set using I</proc/sys/net/ipv4/tcp_max_syn_backlog>.  When syncookies are enabled there is no logical maximum length and this setting is ignored.  See B<tcp>(7)  for more information."
2366 msgstr "TCP ソケットでの I<backlog> 引き数の振る舞いは Linux 2.2 で変更された。 現在ではこの引き数は、 受け付けられるのを待っている、 I<完全に> 確立されたソケットのキューの長さを指定する。 以前は不完全な接続要求の数であったが、これを置き換えた。 不完全なソケットのキューの最大長は I</proc/sys/net/ipv4/tcp_max_syn_backlog> を用いて設定できる。 syncookie が有効になっている場合、 論理的な最大長は存在せず、この設定は無視される。"
2367
2368 #.  The following is now rather historic information (MTK, Jun 05)
2369 #.  Don't rely on this value in portable applications since BSD
2370 #.  (and some BSD-derived systems) limit the backlog to 5.
2371 #. type: Plain text
2372 #: build/C/man2/listen.2:179
2373 msgid "If the I<backlog> argument is greater than the value in I</proc/sys/net/core/somaxconn>, then it is silently truncated to that value; the default value in this file is 128.  In kernels before 2.4.25, this limit was a hard coded value, B<SOMAXCONN>, with the value 128."
2374 msgstr "I<backlog> 引き数が I</proc/sys/net/core/somaxconn> の値よりも大きければ、 I<backlog> の値は暗黙のうちにこの値に切り詰められる。 このファイルのデフォルト値は 128 である。 バージョン 2.4.5 以前のカーネルでは、この上限値は コード埋め込みの固定値 B<SOMAXCONN> であり、その値は 128 であった。"
2375
2376 #. type: Plain text
2377 #: build/C/man2/listen.2:188
2378 msgid "B<accept>(2), B<bind>(2), B<connect>(2), B<socket>(2), B<socket>(7)"
2379 msgstr "B<accept>(2), B<bind>(2), B<connect>(2), B<socket>(2), B<socket>(7)"
2380
2381 #. type: TH
2382 #: build/C/man2/recv.2:41
2383 #, no-wrap
2384 msgid "RECV"
2385 msgstr "RECV"
2386
2387 #. type: Plain text
2388 #: build/C/man2/recv.2:44
2389 msgid "recv, recvfrom, recvmsg - receive a message from a socket"
2390 msgstr "recv, recvfrom, recvmsg - ソケットからメッセージを受け取る"
2391
2392 #. type: Plain text
2393 #: build/C/man2/recv.2:49 build/C/man2/select.2:53
2394 #: build/C/man2/select_tut.2:47
2395 #, no-wrap
2396 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
2397 msgstr "B<#include E<lt>sys/types.hE<gt>>\n"
2398
2399 #. type: Plain text
2400 #: build/C/man2/recv.2:53
2401 #, no-wrap
2402 msgid "B<ssize_t recv(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<);>\n"
2403 msgstr "B<ssize_t recv(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<);>\n"
2404
2405 #. type: Plain text
2406 #: build/C/man2/recv.2:56
2407 #, no-wrap
2408 msgid ""
2409 "B<ssize_t recvfrom(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<,>\n"
2410 "B<                 struct sockaddr *>I<src_addr>B<, socklen_t *>I<addrlen>B<);>\n"
2411 msgstr ""
2412 "B<ssize_t recvfrom(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<,>\n"
2413 "B<                 struct sockaddr *>I<src_addr>B<, socklen_t *>I<addrlen>B<);>\n"
2414
2415 #. type: Plain text
2416 #: build/C/man2/recv.2:58
2417 #, no-wrap
2418 msgid "B<ssize_t recvmsg(int >I<sockfd>B<, struct msghdr *>I<msg>B<, int >I<flags>B<);>\n"
2419 msgstr "B<ssize_t recvmsg(int >I<sockfd>B<, struct msghdr *>I<msg>B<, int >I<flags>B<);>\n"
2420
2421 #. type: Plain text
2422 #: build/C/man2/recv.2:70
2423 msgid "The B<recv>(), B<recvfrom>(), and B<recvmsg>()  calls are used to receive messages from a socket.  They may be used to receive data on both connectionless and connection-oriented sockets.  This page first describes common features of all three system calls, and then describes the differences between the calls."
2424 msgstr "B<recv>(), B<recvfrom>(), B<recvmsg>() コールは、 ソケットからメッセージを受け取るのに使用される。 これらはコネクションレス型のソケットにも接続指向 (connection-oriened) 型のソケットにも使用できる。 このページでは、まずこれら 3 つのシステムコールすべてに共通の機能について説明し、 システムコール間の違いについて説明する。"
2425
2426 #. type: Plain text
2427 #: build/C/man2/recv.2:76
2428 msgid "All three calls return the length of the message on successful completion.  If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from."
2429 msgstr "これらの三つのシステムコールはいずれも、成功した場合にはメッセージの長さを返す。 メッセージが長過ぎて指定されたバッファーに入り切らなかった場合には、 メッセージを受信したソケットの種類によっては余分のバイトが捨てられる かもしれない。"
2430
2431 #. type: Plain text
2432 #: build/C/man2/recv.2:86
2433 msgid "If no messages are available at the socket, the receive calls wait for a message to arrive, unless the socket is nonblocking (see B<fcntl>(2)), in which case the value -1 is returned and the external variable I<errno> is set to B<EAGAIN> or B<EWOULDBLOCK>.  The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested."
2434 msgstr "ソケットに受け取るメッセージが存在しなかった場合、 受信用のコールはメッセージが到着するまで待つ。 ただし、ソケットが非停止 (nonblocking)  に設定されていた場合 (B<fcntl>(2)  を参照) は -1 を返し、外部変数 I<errno> に B<EAGAIN> か B<EWOULDBLOCK> を設定する。 これらの受信用のコールは、受信したデータのサイズが要求したサイズに 達するまで待つのではなく、何らかのデータを受信すると復帰する (受信されるデータの最大サイズは要求したサイズである)。"
2435
2436 #. type: Plain text
2437 #: build/C/man2/recv.2:93
2438 msgid "An application can use B<select>(2), B<poll>(2), or B<epoll>(7)  to determine when more data arrives on a socket."
2439 msgstr "アプリケーションは B<select>(2), B<poll>(2), B<epoll>(7) を使って、ソケットにさらにデータが到着しているかを判定することができる。"
2440
2441 #. type: SS
2442 #: build/C/man2/recv.2:93 build/C/man2/send.2:160
2443 #, no-wrap
2444 msgid "The flags argument"
2445 msgstr "フラグ引き数"
2446
2447 #. type: Plain text
2448 #: build/C/man2/recv.2:97
2449 msgid "The I<flags> argument is formed by ORing one or more of the following values:"
2450 msgstr "I<flags> 引き数には、以下の値を 1つ以上、ビット単位の論理和 を取ったものを指定する:"
2451
2452 #. type: TP
2453 #: build/C/man2/recv.2:97
2454 #, no-wrap
2455 msgid "B<MSG_CMSG_CLOEXEC> (B<recvmsg>() only; since Linux 2.6.23)"
2456 msgstr "B<MSG_CMSG_CLOEXEC> (B<recvmsg>() のみ; Linux 2.6.23)"
2457
2458 #. type: Plain text
2459 #: build/C/man2/recv.2:108
2460 msgid "Set the close-on-exec flag for the file descriptor received via a UNIX domain file descriptor using the B<SCM_RIGHTS> operation (described in B<unix>(7)).  This flag is useful for the same reasons as the B<O_CLOEXEC> flag of B<open>(2)."
2461 msgstr "(B<unix>(7)  で説明されている)  B<SCM_RIGHTS> 操作を使って UNIX ドメインのファイルディスクリプター経由で受信した ファイルディスクリプターについて close-on-exec フラグをセットする。 このフラグは、 B<open>(2)  の B<O_CLOEXEC> フラグと同じ理由で有用である。"
2462
2463 #. type: TP
2464 #: build/C/man2/recv.2:108 build/C/man2/send.2:188
2465 #, no-wrap
2466 msgid "B<MSG_DONTWAIT> (since Linux 2.2)"
2467 msgstr "B<MSG_DONTWAIT> (Linux 2.2 以降)"
2468
2469 #. type: Plain text
2470 #: build/C/man2/recv.2:118
2471 msgid "Enables nonblocking operation; if the operation would block, the call fails with the error B<EAGAIN> or B<EWOULDBLOCK> (this can also be enabled using the B<O_NONBLOCK> flag with the B<F_SETFL> B<fcntl>(2))."
2472 msgstr "非停止 (nonblocking) 操作を有効にする。 操作が停止するような場合にエラー B<EAGAIN> か B<EWOULDBLOCK> で呼び出しが失敗する (B<fcntl>(2)  の B<F_SETFL> で B<O_NONBLOCK> フラグを指定することによっても有効にできる)。"
2473
2474 #. type: TP
2475 #: build/C/man2/recv.2:118
2476 #, no-wrap
2477 msgid "B<MSG_ERRQUEUE> (since Linux 2.2)"
2478 msgstr "B<MSG_ERRQUEUE> (Linux 2.2 以降)"
2479
2480 #. type: Plain text
2481 #: build/C/man2/recv.2:137
2482 msgid "This flag specifies that queued errors should be received from the socket error queue.  The error is passed in an ancillary message with a type dependent on the protocol (for IPv4 B<IP_RECVERR>).  The user should supply a buffer of sufficient size.  See B<cmsg>(3)  and B<ip>(7)  for more information.  The payload of the original packet that caused the error is passed as normal data via I<msg_iovec>.  The original destination address of the datagram that caused the error is supplied via I<msg_name>."
2483 msgstr "このフラグを指定すると、 キューに入れられたエラーをソケットのエラーキューから取りだせるようになる。 このエラーは補助メッセージに組み込まれて渡され、 この補助メッセージの種別はプロトコルに依存する (IPv4 の場合は B<IP_RECVERR>)。 ユーザーは十分なサイズのバッファーを用意しなければならない。 補助メッセージに関するより詳細な情報は B<cmsg>(3)  および B<ip>(7)  を参照のこと。 エラーの原因となったオリジナルパケットのペイロードは、 I<msg_iovec> 経由で通常のデータとして渡される。 エラーを起こしたデータグラムのオリジナルの宛先アドレスは、 I<msg_name> 経由で参照できる。"
2484
2485 #. type: Plain text
2486 #: build/C/man2/recv.2:149 build/C/man2/recv.2:212
2487 msgid "For local errors, no address is passed (this can be checked with the I<cmsg_len> member of the I<cmsghdr>).  For error receives, the B<MSG_ERRQUEUE> is set in the I<msghdr>.  After an error has been passed, the pending socket error is regenerated based on the next queued error and will be passed on the next socket operation."
2488 msgstr ""
2489 "ローカルなエラーの場合はアドレスは渡されない\n"
2490 "(これは I<cmsghdr> の I<cmsg_len> メンバーでチェックできる)。\n"
2491 "受信エラーの場合は B<MSG_ERRQUIE> が I<msghdr> にセットされる。\n"
2492 "エラーが渡された後には、キューに入っている次のエラーに基いて、\n"
2493 "処理待ちのソケットエラーが再生成され、次のソケット操作の際に渡される。"
2494
2495 #. type: Plain text
2496 #: build/C/man2/recv.2:153
2497 msgid "The error is supplied in a I<sock_extended_err> structure:"
2498 msgstr "このエラーは I<sock_extended_err> 構造体で提供される:"
2499
2500 #. type: Plain text
2501 #: build/C/man2/recv.2:160
2502 #, no-wrap
2503 msgid ""
2504 "#define SO_EE_ORIGIN_NONE    0\n"
2505 "#define SO_EE_ORIGIN_LOCAL   1\n"
2506 "#define SO_EE_ORIGIN_ICMP    2\n"
2507 "#define SO_EE_ORIGIN_ICMP6   3\n"
2508 msgstr ""
2509 "#define SO_EE_ORIGIN_NONE    0\n"
2510 "#define SO_EE_ORIGIN_LOCAL   1\n"
2511 "#define SO_EE_ORIGIN_ICMP    2\n"
2512 "#define SO_EE_ORIGIN_ICMP6   3\n"
2513
2514 #. type: Plain text
2515 #: build/C/man2/recv.2:172
2516 #, no-wrap
2517 msgid ""
2518 "struct sock_extended_err\n"
2519 "{\n"
2520 "    uint32_t ee_errno;   /* error number */\n"
2521 "    uint8_t  ee_origin;  /* where the error originated */\n"
2522 "    uint8_t  ee_type;    /* type */\n"
2523 "    uint8_t  ee_code;    /* code */\n"
2524 "    uint8_t  ee_pad;     /* padding */\n"
2525 "    uint32_t ee_info;    /* additional information */\n"
2526 "    uint32_t ee_data;    /* other data */\n"
2527 "    /* More data may follow */\n"
2528 "};\n"
2529 msgstr ""
2530 "struct sock_extended_err\n"
2531 "{\n"
2532 "    uint32_t ee_errno;   /* error number */\n"
2533 "    uint8_t  ee_origin;  /* where the error originated */\n"
2534 "    uint8_t  ee_type;    /* type */\n"
2535 "    uint8_t  ee_code;    /* code */\n"
2536 "    uint8_t  ee_pad;     /* padding */\n"
2537 "    uint32_t ee_info;    /* additional information */\n"
2538 "    uint32_t ee_data;    /* other data */\n"
2539 "    /* More data may follow */\n"
2540 "};\n"
2541
2542 #. type: Plain text
2543 #: build/C/man2/recv.2:174
2544 #, no-wrap
2545 msgid "struct sockaddr *SO_EE_OFFENDER(struct sock_extended_err *);\n"
2546 msgstr "struct sockaddr *SO_EE_OFFENDER(struct sock_extended_err *);\n"
2547
2548 #. type: Plain text
2549 #: build/C/man2/recv.2:198
2550 msgid "I<ee_errno> contains the I<errno> number of the queued error.  I<ee_origin> is the origin code of where the error originated.  The other fields are protocol-specific.  The macro B<SOCK_EE_OFFENDER> returns a pointer to the address of the network object where the error originated from given a pointer to the ancillary message.  If this address is not known, the I<sa_family> member of the I<sockaddr> contains B<AF_UNSPEC> and the other fields of the I<sockaddr> are undefined.  The payload of the packet that caused the error is passed as normal data."
2551 msgstr "I<ee_errno> にはキューに入れられたエラーの I<errno> が入っている。 I<ee_origin> にはエラーが発生した場所のオリジンコード (origin code) が入っている。 他のフィールドはプロトコル依存である。 B<SO_EE_OFFENDER> マクロは、この補助的なメッセージを引き数に取って、 エラーの発生したネットワークオブジェクトのアドレスへのポインターを返す。 アドレスが不明の場合には、 I<sockaddr> の I<sa_family> メンバーが B<AF_UNSPEC> になっている。 I<sockaddr> の他のフィールドは不定である。 エラーの発生したパケットのペイロードは通常のデータとして渡される。"
2552
2553 #. type: TP
2554 #: build/C/man2/recv.2:212 build/C/man2/recv.2:401 build/C/man2/send.2:230
2555 #, no-wrap
2556 msgid "B<MSG_OOB>"
2557 msgstr "B<MSG_OOB>"
2558
2559 #. type: Plain text
2560 #: build/C/man2/recv.2:219
2561 msgid "This flag requests receipt of out-of-band data that would not be received in the normal data stream.  Some protocols place expedited data at the head of the normal data queue, and thus this flag cannot be used with such protocols."
2562 msgstr "このフラグは、通常のデータストリームでは受信できない 帯域外 (out-of-band) データの受信を要求する。 プロトコルによっては、 通常のデータキューの先頭に速達データを置くものがあるが、 そのようなプロトコルではこのフラグは使用できない。"
2563
2564 #. type: TP
2565 #: build/C/man2/recv.2:219
2566 #, no-wrap
2567 msgid "B<MSG_PEEK>"
2568 msgstr "B<MSG_PEEK>"
2569
2570 #. type: Plain text
2571 #: build/C/man2/recv.2:226
2572 msgid "This flag causes the receive operation to return data from the beginning of the receive queue without removing that data from the queue.  Thus, a subsequent receive call will return the same data."
2573 msgstr "このフラグを指定すると、 受信キューの最初のデータを返すとき、キューからデータを削除しない。 したがって、この後でもう一度受信コールを呼び出すと、同じデータが返ることになる。"
2574
2575 #. type: TP
2576 #: build/C/man2/recv.2:226
2577 #, no-wrap
2578 msgid "B<MSG_TRUNC> (since Linux 2.2)"
2579 msgstr "B<MSG_TRUNC> (Linux 2.2 以降)"
2580
2581 #. type: Plain text
2582 #: build/C/man2/recv.2:234
2583 msgid "For raw (B<AF_PACKET>), Internet datagram (since Linux 2.4.27/2.6.8), netlink (since Linux 2.6.22), and UNIX datagram (since Linux 3.4) sockets: return the real length of the packet or datagram, even when it was longer than the passed buffer."
2584 msgstr "raw ソケット (B<AF_PACKET>)、 Internet datagram ソケット (Linux 2.4.27/2.6.8 以降)、 netlink (Linux 2.6.22 以降) ソケット、 UNIX datagram ソケット (Linux 3.4 以降) の場合、パケットやデータグラムの長さが渡したバッファーよりも長かった場合にも、 パケットやデータグラムの実際の長さを返す。"
2585
2586 #. type: Plain text
2587 #: build/C/man2/recv.2:237
2588 msgid "For use with Internet stream sockets, see B<tcp>(7)."
2589 msgstr "Internet ストリームソケットでの利用については B<tcp>(7)  を参照。"
2590
2591 #. type: TP
2592 #: build/C/man2/recv.2:237
2593 #, no-wrap
2594 msgid "B<MSG_WAITALL> (since Linux 2.2)"
2595 msgstr "B<MSG_WAITALL> (Linux 2.2 以降)"
2596
2597 #. type: Plain text
2598 #: build/C/man2/recv.2:245
2599 msgid "This flag requests that the operation block until the full request is satisfied.  However, the call may still return less data than requested if a signal is caught, an error or disconnect occurs, or the next data to be received is of a different type than that returned."
2600 msgstr "このフラグは、要求した量いっぱいのデータが到着するまで、 操作を停止 (block) するよう要求する。 但し、シグナルを受信したり、エラーや切断 (disconnect) が発生したり、 次に受信されるデータが異なる型だったりした場合には、 要求した量よりデータが少なくても返ることがある。"
2601
2602 #. type: SS
2603 #: build/C/man2/recv.2:245
2604 #, no-wrap
2605 msgid "recvfrom()"
2606 msgstr "recvfrom()"
2607
2608 #. type: Plain text
2609 #: build/C/man2/recv.2:251
2610 msgid "B<recvfrom>()  places the received message into the buffer I<buf>.  The caller must specify the size of the buffer in I<len>."
2611 msgstr "B<recvfrom>() は受信したメッセージをバッファー I<buf> に格納する。 呼び出し元はバッファーサイズを I<len> で指定しなければならない。"
2612
2613 #.  (Note: for datagram sockets in both the UNIX and Internet domains,
2614 #.  .I src_addr
2615 #.  is filled in.
2616 #.  .I src_addr
2617 #.  is also filled in for stream sockets in the UNIX domain, but is not
2618 #.  filled in for stream sockets in the Internet domain.)
2619 #.  [The above notes on AF_UNIX and AF_INET sockets apply as at
2620 #.  Kernel 2.4.18. (MTK, 22 Jul 02)]
2621 #. type: Plain text
2622 #: build/C/man2/recv.2:279
2623 msgid "If I<src_addr> is not NULL, and the underlying protocol provides the source address of the message, that source address is placed in the buffer pointed to by I<src_addr>.  In this case, I<addrlen> is a value-result argument.  Before the call, it should be initialized to the size of the buffer associated with I<src_addr>.  Upon return, I<addrlen> is updated to contain the actual size of the source address.  The returned address is truncated if the buffer provided is too small; in this case, I<addrlen> will return a value greater than was supplied to the call."
2624 msgstr "I<src_addr> が NULL 以外で、下層のプロトコルからメッセージの送信元アドレスが分かる場合、 この送信元アドレスが I<src_addr> が指すバッファーに格納される。 この場合、 I<addrlen> は入出力両用の引き数となる。 呼び出し前に、呼び出し元は I<src_addr> に割り当てたバッファーの大きさで初期化しておくべきである。 返ってくる時には、 I<addrlen> は送信元アドレスの実際の大きさに変更される。渡されたバッファーが小さ過ぎる場合には、返されるアドレスの末尾は 切り詰められる。この場合には、 I<addrlen> では、呼び出し時に渡された値よりも大きな値が返される。"
2625
2626 #. type: Plain text
2627 #: build/C/man2/recv.2:286
2628 msgid "If the caller is not interested in the source address, I<src_addr> and I<addrlen> should be specified as NULL."
2629 msgstr "呼び出し元が送信元アドレスを必要としない場合は、 I<src_addr> と I<addrlen> には NULL を指定すべきである。"
2630
2631 #. type: SS
2632 #: build/C/man2/recv.2:286
2633 #, no-wrap
2634 msgid "recv()"
2635 msgstr "recv()"
2636
2637 #. type: Plain text
2638 #: build/C/man2/recv.2:294
2639 msgid "The B<recv>()  call is normally used only on a I<connected> socket (see B<connect>(2)).  It is equivalent to the call:"
2640 msgstr "B<recv>()  コールは通常 I<接続済みの (connected)> ソケットに対してのみ使用される (B<connect>(2) 参照)。次の呼び出しと等価である。"
2641
2642 #. type: Plain text
2643 #: build/C/man2/recv.2:297
2644 #, no-wrap
2645 msgid "    recvfrom(fd, buf, len, flags, NULL, 0));\n"
2646 msgstr "    recvfrom(fd, buf, len, flags, NULL, 0));\n"
2647
2648 #. type: SS
2649 #: build/C/man2/recv.2:297
2650 #, no-wrap
2651 msgid "recvmsg()"
2652 msgstr "recvmsg()"
2653
2654 #. type: Plain text
2655 #: build/C/man2/recv.2:305
2656 msgid "The B<recvmsg>()  call uses a I<msghdr> structure to minimize the number of directly supplied arguments.  This structure is defined as follows in I<E<lt>sys/socket.hE<gt>>:"
2657 msgstr "B<recvmsg>()  コールは、直接渡す引き数の数を減らすために I<msghdr> 構造体を使用する。この構造体は I<E<lt>sys/socket.hE<gt>> で以下のように定義されている:"
2658
2659 #. type: Plain text
2660 #: build/C/man2/recv.2:312
2661 #, no-wrap
2662 msgid ""
2663 "struct iovec {                    /* Scatter/gather array items */\n"
2664 "    void  *iov_base;              /* Starting address */\n"
2665 "    size_t iov_len;               /* Number of bytes to transfer */\n"
2666 "};\n"
2667 msgstr ""
2668 "struct iovec {                    /* Scatter/gather array items */\n"
2669 "    void  *iov_base;              /* Starting address */\n"
2670 "    size_t iov_len;               /* Number of bytes to transfer */\n"
2671 "};\n"
2672
2673 #. type: Plain text
2674 #: build/C/man2/recv.2:322
2675 #, no-wrap
2676 msgid ""
2677 "struct msghdr {\n"
2678 "    void         *msg_name;       /* optional address */\n"
2679 "    socklen_t     msg_namelen;    /* size of address */\n"
2680 "    struct iovec *msg_iov;        /* scatter/gather array */\n"
2681 "    size_t        msg_iovlen;     /* # elements in msg_iov */\n"
2682 "    void         *msg_control;    /* ancillary data, see below */\n"
2683 "    size_t        msg_controllen; /* ancillary data buffer len */\n"
2684 "    int           msg_flags;      /* flags on received message */\n"
2685 "};\n"
2686 msgstr ""
2687 "struct msghdr {\n"
2688 "    void         *msg_name;       /* 追加のアドレス */\n"
2689 "    socklen_t     msg_namelen;    /* アドレスのサイズ */\n"
2690 "    struct iovec *msg_iov;        /* scatter/gather 配列 */\n"
2691 "    size_t        msg_iovlen;     /* msg_iov の要素数 */\n"
2692 "    void         *msg_control;    /* 補助データ (後述) */\n"
2693 "    size_t        msg_controllen; /* 補助データバッファー長 */\n"
2694 "    int           msg_flags;      /* 受信メッセージのフラグ */\n"
2695 "};\n"
2696
2697 #. type: Plain text
2698 #: build/C/man2/recv.2:338
2699 msgid "The I<msg_name> field points to a caller-allocated buffer that is used to return the source address if the socket is unconnected.  The caller should set I<msg_namelen> to the size of this buffer before this call; upon return from a successful call, I<msg_namelen> will contain the length of the returned address.  If the application does not need to know the source address, I<msg_name> can be specified as NULL."
2700 msgstr "フィールド I<msg_name> は、 ソケットが接続されていない場合に送信元アドレスを返すのに使用されるバッファーを指す。 このバッファーは呼び出し元が確保する。 呼び出し元は呼び出し前に I<msg_namelen> にこのバッファーの大きさを設定しなければならない。 呼び出しが成功した場合、呼び出しから返って来た際には I<msg_namelen> には返されるアドレスの長さが入っている。 アプリケーションが送信元アドレスを知る必要がない場合には、 I<msg_name> に NULL を指定することができる。"
2701
2702 #. type: Plain text
2703 #: build/C/man2/recv.2:345
2704 msgid "The fields I<msg_iov> and I<msg_iovlen> describe scatter-gather locations, as discussed in B<readv>(2)."
2705 msgstr "I<msg_iov> と I<msg_iovlen> フィールドは scatter-gather 用の場所を指定する。 B<readv>(2) に説明がある。"
2706
2707 #. type: Plain text
2708 #: build/C/man2/recv.2:360
2709 msgid "The field I<msg_control>, which has length I<msg_controllen>, points to a buffer for other protocol control-related messages or miscellaneous ancillary data.  When B<recvmsg>()  is called, I<msg_controllen> should contain the length of the available buffer in I<msg_control>; upon return from a successful call it will contain the length of the control message sequence."
2710 msgstr "I<msg_control> フィールドは I<msg_controllen> の長さを持ち、他のプロトコル制御メッセージや 種々の補助データのためのバッファーへのポインターである。 B<recvmsg>()  を呼ぶ際には、 I<msg_controllen> に I<msg_control> のバッファーの長さを入れておく必要がある。 コールが成功して返った場合、制御メッセージ列の長さが入っている。"
2711
2712 #. type: Plain text
2713 #: build/C/man2/recv.2:362
2714 msgid "The messages are of the form:"
2715 msgstr "メッセージの形式は以下の通り:"
2716
2717 #. type: Plain text
2718 #: build/C/man2/recv.2:372
2719 #, no-wrap
2720 msgid ""
2721 "struct cmsghdr {\n"
2722 "    socklen_t     cmsg_len;     /* data byte count, including hdr */\n"
2723 "    int           cmsg_level;   /* originating protocol */\n"
2724 "    int           cmsg_type;    /* protocol-specific type */\n"
2725 "/* followed by\n"
2726 "    unsigned char cmsg_data[]; */\n"
2727 "};\n"
2728 msgstr ""
2729 "struct cmsghdr {\n"
2730 "    socklen_t     cmsg_len;     /* data byte count, including hdr */\n"
2731 "    int           cmsg_level;   /* originating protocol */\n"
2732 "    int           cmsg_type;    /* protocol-specific type */\n"
2733 "/* followed by\n"
2734 "    unsigned char cmsg_data[]; */\n"
2735 "};\n"
2736
2737 #. type: Plain text
2738 #: build/C/man2/recv.2:377
2739 msgid "Ancillary data should be accessed only by the macros defined in B<cmsg>(3)."
2740 msgstr "補助データは、 B<cmsg>(3)  に定義されたマクロ経由でのみアクセスすべきである。"
2741
2742 #. type: Plain text
2743 #: build/C/man2/recv.2:380
2744 msgid "As an example, Linux uses this ancillary data mechanism to pass extended errors, IP options, or file descriptors over UNIX domain sockets."
2745 msgstr "例をあげると、 Linux はこの補助データのメカニズムを、 UNIX ドメインソケット上での拡張エラーや IP オプション、 ファイルディスクリプターの受け渡しに利用している。"
2746
2747 #. type: Plain text
2748 #: build/C/man2/recv.2:388
2749 msgid "The I<msg_flags> field in the I<msghdr> is set on return of B<recvmsg>().  It can contain several flags:"
2750 msgstr "I<msghdr> の I<msg_flags> フィールドは B<recvmsg>()  からのリターン時に設定される。ここにはいくつかのフラグが入る。"
2751
2752 #. type: TP
2753 #: build/C/man2/recv.2:388
2754 #, no-wrap
2755 msgid "B<MSG_EOR>"
2756 msgstr "B<MSG_EOR>"
2757
2758 #. type: Plain text
2759 #: build/C/man2/recv.2:393
2760 msgid "indicates end-of-record; the data returned completed a record (generally used with sockets of type B<SOCK_SEQPACKET>)."
2761 msgstr "これはレコードの終り (end-of-record) を示し、 返されたデータが完全なレコードであることを示す (一般的には B<SOCK_SEQPACKET> 型のソケットで使用される)。"
2762
2763 #. type: TP
2764 #: build/C/man2/recv.2:393
2765 #, no-wrap
2766 msgid "B<MSG_TRUNC>"
2767 msgstr "B<MSG_TRUNC>"
2768
2769 #. type: Plain text
2770 #: build/C/man2/recv.2:397
2771 msgid "indicates that the trailing portion of a datagram was discarded because the datagram was larger than the buffer supplied."
2772 msgstr "データグラムが与えられたバッファーより大きかったために、 データグラムのはみ出した部分が捨てられたことを示す。"
2773
2774 #. type: TP
2775 #: build/C/man2/recv.2:397
2776 #, no-wrap
2777 msgid "B<MSG_CTRUNC>"
2778 msgstr "B<MSG_CTRUNC>"
2779
2780 #. type: Plain text
2781 #: build/C/man2/recv.2:401
2782 msgid "indicates that some control data were discarded due to lack of space in the buffer for ancillary data."
2783 msgstr "補助データのためのバッファーが不足したために、 制御データの一部が捨てられたことを示す。"
2784
2785 #. type: Plain text
2786 #: build/C/man2/recv.2:404
2787 msgid "is returned to indicate that expedited or out-of-band data were received."
2788 msgstr "速達データや帯域外データを受信したことを示す。"
2789
2790 #. type: TP
2791 #: build/C/man2/recv.2:404
2792 #, no-wrap
2793 msgid "B<MSG_ERRQUEUE>"
2794 msgstr "B<MSG_ERRQUEUE>"
2795
2796 #. type: Plain text
2797 #: build/C/man2/recv.2:408
2798 msgid "indicates that no data was received but an extended error from the socket error queue."
2799 msgstr "データは受信しなかったが ソケットのエラーキューから拡張エラーを受信したことを示す。"
2800
2801 #. type: Plain text
2802 #: build/C/man2/recv.2:414
2803 msgid "These calls return the number of bytes received, or -1 if an error occurred.  In the event of an error, I<errno> is set to indicate the error."
2804 msgstr "これらのコールは受信したバイト数を返す。 エラーの場合は -1 を返し、 I<errno> にエラーを示す値を設定する。"
2805
2806 #. type: Plain text
2807 #: build/C/man2/recv.2:417
2808 msgid "When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional \"end-of-file\" return)."
2809 msgstr ""
2810 "ストリームソケットの接続相手が正しくシャットダウンを実行した場合は、\n"
2811 "返り値は 0 (昔ながらの \"end-of-file\" の戻り値) となる。"
2812
2813 #. type: Plain text
2814 #: build/C/man2/recv.2:421
2815 msgid "Datagram sockets in various domains (e.g., the UNIX and Internet domains)  permit zero-length datagrams.  When such a datagram is received, the return value is 0."
2816 msgstr "いくつかのドメインのデータグラムソケット (UNIX ドメインやインターネットドメインなど) では、長さ 0 のデータグラムが送信できる。 このようなデータグラムを受信した場合、 返り値は 0 となる。"
2817
2818 #. type: Plain text
2819 #: build/C/man2/recv.2:424
2820 msgid "The value 0 may also be returned if the requested number of bytes to receive from a stream socket was 0."
2821 msgstr "ストリームソケットに対する受信要求バイト数が 0 だった場合も、 値 0 が返される。"
2822
2823 #. type: Plain text
2824 #: build/C/man2/recv.2:429
2825 msgid "These are some standard errors generated by the socket layer.  Additional errors may be generated and returned from the underlying protocol modules; see their manual pages."
2826 msgstr "これらはソケット層で発生する一般的なエラーである。 他のエラーが下層のプロトコルモジュールで生成され、 返されるかもしれない。 それらのマニュアルを参照すること。"
2827
2828 #.  Actually EAGAIN on Linux
2829 #. type: Plain text
2830 #: build/C/man2/recv.2:438
2831 msgid "The socket is marked nonblocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received.  POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities."
2832 msgstr "ソケットが非停止 (nonblocking) に設定されていて 受信操作が停止するような状況になったか、 受信に時間切れ (timeout) が設定されていて データを受信する前に時間切れになった。 POSIX.1-2001 は、この場合にどちらのエラーを返すことも認めており、 これら 2 つの定数が同じ値を持つことも求めていない。 したがって、移植性が必要なアプリケーションでは、両方の可能性を 確認すべきである。"
2833
2834 #. type: Plain text
2835 #: build/C/man2/recv.2:443
2836 msgid "The argument I<sockfd> is an invalid descriptor."
2837 msgstr "引き数 I<sockfd> が不正なディスクリプターである。"
2838
2839 #. type: Plain text
2840 #: build/C/man2/recv.2:447
2841 msgid "A remote host refused to allow the network connection (typically because it is not running the requested service)."
2842 msgstr "リモートのホストでネットワーク接続が拒否された (よくある理由としては、要求したサービスが起動されていないなどがある)。"
2843
2844 #. type: Plain text
2845 #: build/C/man2/recv.2:451
2846 msgid "The receive buffer pointer(s) point outside the process's address space."
2847 msgstr "受信バッファーへのポインターがプロセスのアドレス空間外を指している。"
2848
2849 #. type: Plain text
2850 #: build/C/man2/recv.2:456
2851 msgid "The receive was interrupted by delivery of a signal before any data were available; see B<signal>(7)."
2852 msgstr "データを受信する前に、シグナルが配送されて割り込まれた。 B<signal>(7)  参照。"
2853
2854 #. type: Plain text
2855 #: build/C/man2/recv.2:460 build/C/man2/send.2:355
2856 msgid "Invalid argument passed."
2857 msgstr "不正な引き数が渡された。"
2858
2859 #. type: Plain text
2860 #: build/C/man2/recv.2:464
2861 msgid "Could not allocate memory for B<recvmsg>()."
2862 msgstr "B<recvmsg>()  のためのメモリーが確保できなかった。"
2863
2864 #. type: TP
2865 #: build/C/man2/recv.2:464 build/C/man2/send.2:378
2866 #, no-wrap
2867 msgid "B<ENOTCONN>"
2868 msgstr "B<ENOTCONN>"
2869
2870 #. type: Plain text
2871 #: build/C/man2/recv.2:471
2872 msgid "The socket is associated with a connection-oriented protocol and has not been connected (see B<connect>(2)  and B<accept>(2))."
2873 msgstr "ソケットに接続指向プロトコルが割り当てられており、 まだ接続されていない (B<connect>(2)  と B<accept>(2)  を参照のこと)。"
2874
2875 #. type: Plain text
2876 #: build/C/man2/recv.2:476
2877 msgid "The argument I<sockfd> does not refer to a socket."
2878 msgstr "引き数 I<sockfd> がソケットを参照していない。"
2879
2880 #. type: Plain text
2881 #: build/C/man2/recv.2:479
2882 msgid "4.4BSD (these function calls first appeared in 4.2BSD), POSIX.1-2001."
2883 msgstr "4.4BSD (これらの関数は 4.2BSD で現われた), POSIX.1-2001。"
2884
2885 #. type: Plain text
2886 #: build/C/man2/recv.2:486
2887 msgid "POSIX.1-2001 describes only the B<MSG_OOB>, B<MSG_PEEK>, and B<MSG_WAITALL> flags."
2888 msgstr "POSIX.1-2001 では、 B<MSG_OOB>, B<MSG_PEEK>, B<MSG_WAITALL> フラグだけが記載されている。"
2889
2890 #. type: Plain text
2891 #: build/C/man2/recv.2:492
2892 msgid "The I<socklen_t> type was invented by POSIX.  See also B<accept>(2)."
2893 msgstr "I<socklen_t> 型は POSIX で発案された。 B<accept>(2) も参照。"
2894
2895 #.  glibc bug raised 12 Mar 2006
2896 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=2448
2897 #.  The problem is an underlying kernel issue: the size of the
2898 #.  __kernel_size_t type used to type this field varies
2899 #.  across architectures, but socklen_t is always 32 bits.
2900 #. type: Plain text
2901 #: build/C/man2/recv.2:506 build/C/man2/send.2:428
2902 msgid "According to POSIX.1-2001, the I<msg_controllen> field of the I<msghdr> structure should be typed as I<socklen_t>, but glibc currently types it as I<size_t>."
2903 msgstr "POSIX.1-2001 では、構造体 I<msghdr> のフィールド I<msg_controllen> は I<socklen_t> 型であるべきだとされているが、 現在の glibc では I<size_t> 型である。"
2904
2905 #. type: Plain text
2906 #: build/C/man2/recv.2:511
2907 msgid "See B<recvmmsg>(2)  for information about a Linux-specific system call that can be used to receive multiple datagrams in a single call."
2908 msgstr "B<recvmmsg>(2)  には、一度の呼び出しでの複数のデータグラムに使用できる Linux 固有の システムコールに関する情報が書かれている。"
2909
2910 #. type: Plain text
2911 #: build/C/man2/recv.2:516
2912 msgid "An example of the use of B<recvfrom>()  is shown in B<getaddrinfo>(3)."
2913 msgstr "B<recvfrom>()  の利用例が B<getaddrinfo>(3)  に記載されている。"
2914
2915 #. type: Plain text
2916 #: build/C/man2/recv.2:527
2917 msgid "B<fcntl>(2), B<getsockopt>(2), B<read>(2), B<recvmmsg>(2), B<select>(2), B<shutdown>(2), B<socket>(2), B<cmsg>(3), B<sockatmark>(3), B<socket>(7)"
2918 msgstr "B<fcntl>(2), B<getsockopt>(2), B<read>(2), B<recvmmsg>(2), B<select>(2), B<shutdown>(2), B<socket>(2), B<cmsg>(3), B<sockatmark>(3), B<socket>(7)"
2919
2920 #. type: TH
2921 #: build/C/man2/recvmmsg.2:31
2922 #, no-wrap
2923 msgid "RECVMMSG"
2924 msgstr "RECVMMSG"
2925
2926 #. type: TH
2927 #: build/C/man2/recvmmsg.2:31
2928 #, no-wrap
2929 msgid "2014-06-13"
2930 msgstr "2014-06-13"
2931
2932 #. type: Plain text
2933 #: build/C/man2/recvmmsg.2:34
2934 msgid "recvmmsg - receive multiple messages on a socket"
2935 msgstr "recvmmsg - 複数のメッセージをソケットから受信する"
2936
2937 #. type: Plain text
2938 #: build/C/man2/recvmmsg.2:38 build/C/man2/sendmmsg.2:35
2939 #, no-wrap
2940 msgid ""
2941 "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
2942 "B<#include E<lt>sys/socket.hE<gt>>\n"
2943 msgstr ""
2944 "B<#define _GNU_SOURCE>         /* feature_test_macros(7) 参照 */\n"
2945 "B<#include E<lt>sys/socket.hE<gt>>\n"
2946
2947 #. type: Plain text
2948 #: build/C/man2/recvmmsg.2:41
2949 #, no-wrap
2950 msgid "B<int recvmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int >I<vlen>B<,>\n"
2951 msgstr "B<int recvmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int >I<vlen>B<,>\n"
2952
2953 #. type: Plain text
2954 #: build/C/man2/recvmmsg.2:43
2955 #, no-wrap
2956 msgid "B<             unsigned int >I<flags>B<, struct timespec *>I<timeout>B<);>\n"
2957 msgstr "B<             unsigned int >I<flags>B<, struct timespec *>I<timeout>B<);>\n"
2958
2959 #. type: Plain text
2960 #: build/C/man2/recvmmsg.2:55
2961 msgid "The B<recvmmsg>()  system call is an extension of B<recvmsg>(2)  that allows the caller to receive multiple messages from a socket using a single system call.  (This has performance benefits for some applications.)  A further extension over B<recvmsg>(2)  is support for a timeout on the receive operation."
2962 msgstr "B<recvmmsg>() システムコールは B<recvmsg>(2) の拡張で、 このシステムコールを使うと一度の呼び出しでソケットから複数のメッセージを受信することができる (アプリケーションによっては性能上のメリットがある)。 他に B<recvmsg>(2) から拡張されている点としては、受信操作におけるタイムアウトのサポートがある。"
2963
2964 #. type: Plain text
2965 #: build/C/man2/recvmmsg.2:59
2966 msgid "The I<sockfd> argument is the file descriptor of the socket to receive data from."
2967 msgstr "I<sockfd> 引き数は、データを受信するソケットのファイルディスクリプターである。"
2968
2969 #. type: Plain text
2970 #: build/C/man2/recvmmsg.2:67 build/C/man2/sendmmsg.2:62
2971 msgid "The I<msgvec> argument is a pointer to an array of I<mmsghdr> structures.  The size of this array is specified in I<vlen>."
2972 msgstr "I<msgvec> 引き数は I<mmsghdr> 構造体の配列である。 この配列の大きさは I<vlen> で指定する。"
2973
2974 #. type: Plain text
2975 #: build/C/man2/recvmmsg.2:73 build/C/man2/sendmmsg.2:68
2976 msgid "The I<mmsghdr> structure is defined in I<E<lt>sys/socket.hE<gt>> as:"
2977 msgstr "I<mmsghdr> 構造体は I<E<lt>sys/socket.hE<gt>> で次のように定義されている。"
2978
2979 #. type: Plain text
2980 #: build/C/man2/recvmmsg.2:80
2981 #, no-wrap
2982 msgid ""
2983 "struct mmsghdr {\n"
2984 "    struct msghdr msg_hdr;  /* Message header */\n"
2985 "    unsigned int  msg_len;  /* Number of received bytes for header */\n"
2986 "};\n"
2987 msgstr ""
2988 "struct mmsghdr {\n"
2989 "    struct msghdr msg_hdr;  /* メッセージヘッダ */\n"
2990 "    unsigned int  msg_len;  /* このヘッダで受信されたバイト数 */\n"
2991 "};\n"
2992
2993 #. type: Plain text
2994 #: build/C/man2/recvmmsg.2:95
2995 msgid "The I<msg_hdr> field is a I<msghdr> structure, as described in B<recvmsg>(2).  The I<msg_len> field is the number of bytes returned for the message in the entry.  This field has the same value as the return value of a single B<recvmsg>(2)  on the header."
2996 msgstr "I<msg_hdr> フィールドは、 B<recvmsg>(2) で説明されている I<msghdr> 構造体である。 I<msg_len> フィールドは、 このエントリで返されるメッセージのバイト数で、 このヘッダに対して B<recvmsg>(2) を呼び出した場合の返り値と同じ値が入る。"
2997
2998 #. type: Plain text
2999 #: build/C/man2/recvmmsg.2:102
3000 msgid "The I<flags> argument contains flags ORed together.  The flags are the same as documented for B<recvmsg>(2), with the following addition:"
3001 msgstr "I<flags> 引き数には複数のフラグを論理和 (OR) で指定できる。 フラグは、 B<recvmsg>(2) で説明されているものに加えて、以下が使用できる。"
3002
3003 #. type: TP
3004 #: build/C/man2/recvmmsg.2:102
3005 #, no-wrap
3006 msgid "B<MSG_WAITFORONE> (since Linux 2.6.34)"
3007 msgstr "B<MSG_WAITFORONE> (Linux 2.6.34 以降)"
3008
3009 #. type: Plain text
3010 #: build/C/man2/recvmmsg.2:107
3011 msgid "Turns on B<MSG_DONTWAIT> after the first message has been received."
3012 msgstr "最初のメッセージを受信後に B<MSG_DONTWAIT> を有効にする。"
3013
3014 #. type: Plain text
3015 #: build/C/man2/recvmmsg.2:122
3016 msgid "The I<timeout> argument points to a I<struct timespec> (see B<clock_gettime>(2))  defining a timeout (seconds plus nanoseconds) for the receive operation (I<but see BUGS!>).  (This interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the blocking interval may overrun by a small amount.)  If I<timeout> is NULL, then the operation blocks indefinitely."
3017 msgstr "I<timeout> 引き数は I<struct timespec> (B<clock_gettime>(2) 参照) へのポインターで、 この構造体で受信操作のタイムアウト (秒とナノ秒) を指定する (I<ただし、バグを参照のこと>) (待ち時間はシステムクロックの粒度に切り上げられ、カーネルのスケジューリング遅延により少しだけ長くなる可能性がある)。 I<timeout>が NULL の場合、 受信操作は無期限に停止 (block) する。"
3018
3019 #. type: Plain text
3020 #: build/C/man2/recvmmsg.2:133
3021 msgid "A blocking B<recvmmsg>()  call blocks until I<vlen> messages have been received or until the timeout expires.  A nonblocking call reads as many messages as are available (up to the limit specified by I<vlen>)  and returns immediately."
3022 msgstr "停止 (blocking) モードの B<recvmmsg>() の呼び出しは、 I<vlen> 個のメッセージを受信するか、タイムアウトが満了するまで停止する。 非停止 (nonblocking) モードの呼び出しでは、 読み出し可能なメッセージ (最大で I<vlen> 個) を読み出し、 すぐに返る。"
3023
3024 #. type: Plain text
3025 #: build/C/man2/recvmmsg.2:148
3026 msgid "On return from B<recvmmsg>(), successive elements of I<msgvec> are updated to contain information about each received message: I<msg_len> contains the size of the received message; the subfields of I<msg_hdr> are updated as described in B<recvmsg>(2).  The return value of the call indicates the number of elements of I<msgvec> that have been updated."
3027 msgstr "B<recvmmsg>() が返った際には、 I<msgvec> のうちデータが受信された要素には、受信したそれぞれのメッセージの情報が格納されている。 また、 I<msg_len> には受信したメッセージの大きさが入り、 I<msg_hdr> の各フィールドは B<recvmsg>(2) に書かれている通りに更新される。 呼び出しの返り値は、更新された I<msgvec> の要素数である。"
3028
3029 #. type: Plain text
3030 #: build/C/man2/recvmmsg.2:156
3031 msgid "On success, B<recvmmsg>()  returns the number of messages received in I<msgvec>; on error, -1 is returned, and I<errno> is set to indicate the error."
3032 msgstr "成功すると、 B<recvmmsg>() は I<msgvec> に受信されたメッセージ数を返す。 エラーの場合、 -1 を返し、 I<errno> にエラーを示す値を設定する。"
3033
3034 #. type: Plain text
3035 #: build/C/man2/recvmmsg.2:160
3036 msgid "Errors are as for B<recvmsg>(2).  In addition, the following error can occur:"
3037 msgstr "エラーは B<recvmsg>(2) と同じである。 これに加えて、以下のエラーが起こる場合がある。"
3038
3039 #. type: Plain text
3040 #: build/C/man2/recvmmsg.2:164
3041 msgid "I<timeout> is invalid."
3042 msgstr "I<timeout> が無効である。"
3043
3044 #. type: Plain text
3045 #: build/C/man2/recvmmsg.2:169
3046 msgid "The B<recvmmsg>()  system call was added in Linux 2.6.33.  Support in glibc was added in version 2.12."
3047 msgstr "B<recvmmsg>() システムコールは Linux 2.6.33 で追加された。 glibc でのサポートはバージョン 2.12 以降で利用可能である。"
3048
3049 #. type: Plain text
3050 #: build/C/man2/recvmmsg.2:172
3051 msgid "B<recvmmsg>()  is Linux-specific."
3052 msgstr "B<recvmmsg>() は Linux 固有である。"
3053
3054 #. type: Plain text
3055 #: build/C/man2/recvmmsg.2:180
3056 msgid "The following program uses B<recvmmsg>()  to receive multiple messages on a socket and stores them in multiple buffers.  The call returns if all buffers are filled or if the timeout specified has expired."
3057 msgstr "以下のプログラムは、 B<recvmmsg>() を使って複数のメッセージをソケットから受信し、それらを複数のバッファーに格納する。 呼び出しは、すべてのバッファーにメッセージが格納されるか、 指定したタイムアウト時間が経過すると返る。"
3058
3059 #. type: Plain text
3060 #: build/C/man2/recvmmsg.2:183
3061 msgid "The following snippet periodically generates UDP datagrams containing a random number:"
3062 msgstr "以下のコマンドは、 ランダムな数字が入った UDP データグラムを定期的に生成する。"
3063
3064 #. type: Plain text
3065 #: build/C/man2/recvmmsg.2:188
3066 #, no-wrap
3067 msgid ""
3068 "$B< while true; do echo $RANDOM E<gt> /dev/udp/127.0.0.1/1234; >\n"
3069 "B<sleep 0.25; done>\n"
3070 msgstr ""
3071 "$B< while true; do echo $RANDOM E<gt> /dev/udp/127.0.0.1/1234; >\n"
3072 "B<sleep 0.25; done>\n"
3073
3074 #. type: Plain text
3075 #: build/C/man2/recvmmsg.2:193
3076 msgid "These datagrams are read by the example application, which can give the following output:"
3077 msgstr "生成されたデータグラムをサンプルアプリケーションが読み出し、以下のような出力が得られる。"
3078
3079 #. type: Plain text
3080 #: build/C/man2/recvmmsg.2:203
3081 #, no-wrap
3082 msgid ""
3083 "$B< ./a.out>\n"
3084 "5 messages received\n"
3085 "1 11782\n"
3086 "2 11345\n"
3087 "3 304\n"
3088 "4 13514\n"
3089 "5 28421\n"
3090 msgstr ""
3091 "$B< ./a.out>\n"
3092 "5 messages received\n"
3093 "1 11782\n"
3094 "2 11345\n"
3095 "3 304\n"
3096 "4 13514\n"
3097 "5 28421\n"
3098
3099 #. type: Plain text
3100 #: build/C/man2/recvmmsg.2:214
3101 #, no-wrap
3102 msgid ""
3103 "#define _GNU_SOURCE\n"
3104 "#include E<lt>netinet/ip.hE<gt>\n"
3105 "#include E<lt>stdio.hE<gt>\n"
3106 "#include E<lt>stdlib.hE<gt>\n"
3107 "#include E<lt>string.hE<gt>\n"
3108 "#include E<lt>sys/socket.hE<gt>\n"
3109 msgstr ""
3110 "#define _GNU_SOURCE\n"
3111 "#include E<lt>netinet/ip.hE<gt>\n"
3112 "#include E<lt>stdio.hE<gt>\n"
3113 "#include E<lt>stdlib.hE<gt>\n"
3114 "#include E<lt>string.hE<gt>\n"
3115 "#include E<lt>sys/socket.hE<gt>\n"
3116
3117 #. type: Plain text
3118 #: build/C/man2/recvmmsg.2:227
3119 #, no-wrap
3120 msgid ""
3121 "int\n"
3122 "main(void)\n"
3123 "{\n"
3124 "#define VLEN 10\n"
3125 "#define BUFSIZE 200\n"
3126 "#define TIMEOUT 1\n"
3127 "    int sockfd, retval, i;\n"
3128 "    struct sockaddr_in sa;\n"
3129 "    struct mmsghdr msgs[VLEN];\n"
3130 "    struct iovec iovecs[VLEN];\n"
3131 "    char bufs[VLEN][BUFSIZE+1];\n"
3132 "    struct timespec timeout;\n"
3133 msgstr ""
3134 "int\n"
3135 "main(void)\n"
3136 "{\n"
3137 "#define VLEN 10\n"
3138 "#define BUFSIZE 200\n"
3139 "#define TIMEOUT 1\n"
3140 "    int sockfd, retval, i;\n"
3141 "    struct sockaddr_in sa;\n"
3142 "    struct mmsghdr msgs[VLEN];\n"
3143 "    struct iovec iovecs[VLEN];\n"
3144 "    char bufs[VLEN][BUFSIZE+1];\n"
3145 "    struct timespec timeout;\n"
3146
3147 #. type: Plain text
3148 #: build/C/man2/recvmmsg.2:233 build/C/man2/sendmmsg.2:201
3149 #, no-wrap
3150 msgid ""
3151 "    sockfd = socket(AF_INET, SOCK_DGRAM, 0);\n"
3152 "    if (sockfd == -1) {\n"
3153 "        perror(\"socket()\");\n"
3154 "        exit(EXIT_FAILURE);\n"
3155 "    }\n"
3156 msgstr ""
3157 "    sockfd = socket(AF_INET, SOCK_DGRAM, 0);\n"
3158 "    if (sockfd == -1) {\n"
3159 "        perror(\"socket()\");\n"
3160 "        exit(EXIT_FAILURE);\n"
3161 "    }\n"
3162
3163 #. type: Plain text
3164 #: build/C/man2/recvmmsg.2:241
3165 #, no-wrap
3166 msgid ""
3167 "    sa.sin_family = AF_INET;\n"
3168 "    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n"
3169 "    sa.sin_port = htons(1234);\n"
3170 "    if (bind(sockfd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {\n"
3171 "        perror(\"bind()\");\n"
3172 "        exit(EXIT_FAILURE);\n"
3173 "    }\n"
3174 msgstr ""
3175 "    sa.sin_family = AF_INET;\n"
3176 "    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n"
3177 "    sa.sin_port = htons(1234);\n"
3178 "    if (bind(sockfd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {\n"
3179 "        perror(\"bind()\");\n"
3180 "        exit(EXIT_FAILURE);\n"
3181 "    }\n"
3182
3183 #. type: Plain text
3184 #: build/C/man2/recvmmsg.2:249
3185 #, no-wrap
3186 msgid ""
3187 "    memset(msgs, 0, sizeof(msgs));\n"
3188 "    for (i = 0; i E<lt> VLEN; i++) {\n"
3189 "        iovecs[i].iov_base         = bufs[i];\n"
3190 "        iovecs[i].iov_len          = BUFSIZE;\n"
3191 "        msgs[i].msg_hdr.msg_iov    = &iovecs[i];\n"
3192 "        msgs[i].msg_hdr.msg_iovlen = 1;\n"
3193 "    }\n"
3194 msgstr ""
3195 "    memset(msgs, 0, sizeof(msgs));\n"
3196 "    for (i = 0; i E<lt> VLEN; i++) {\n"
3197 "        iovecs[i].iov_base         = bufs[i];\n"
3198 "        iovecs[i].iov_len          = BUFSIZE;\n"
3199 "        msgs[i].msg_hdr.msg_iov    = &iovecs[i];\n"
3200 "        msgs[i].msg_hdr.msg_iovlen = 1;\n"
3201 "    }\n"
3202
3203 #. type: Plain text
3204 #: build/C/man2/recvmmsg.2:252
3205 #, no-wrap
3206 msgid ""
3207 "    timeout.tv_sec = TIMEOUT;\n"
3208 "    timeout.tv_nsec = 0;\n"
3209 msgstr ""
3210 "    timeout.tv_sec = TIMEOUT;\n"
3211 "    timeout.tv_nsec = 0;\n"
3212
3213 #. type: Plain text
3214 #: build/C/man2/recvmmsg.2:258
3215 #, no-wrap
3216 msgid ""
3217 "    retval = recvmmsg(sockfd, msgs, VLEN, 0, &timeout);\n"
3218 "    if (retval == -1) {\n"
3219 "        perror(\"recvmmsg()\");\n"
3220 "        exit(EXIT_FAILURE);\n"
3221 "    }\n"
3222 msgstr ""
3223 "    retval = recvmmsg(sockfd, msgs, VLEN, 0, &timeout);\n"
3224 "    if (retval == -1) {\n"
3225 "        perror(\"recvmmsg()\");\n"
3226 "        exit(EXIT_FAILURE);\n"
3227 "    }\n"
3228
3229 #. type: Plain text
3230 #: build/C/man2/recvmmsg.2:266
3231 #, no-wrap
3232 msgid ""
3233 "    printf(\"%d messages received\\en\", retval);\n"
3234 "    for (i = 0; i E<lt> retval; i++) {\n"
3235 "        bufs[i][msgs[i].msg_len] = 0;\n"
3236 "        printf(\"%d %s\", i+1, bufs[i]);\n"
3237 "    }\n"
3238 "    exit(EXIT_SUCCESS);\n"
3239 "}\n"
3240 msgstr ""
3241 "    printf(\"%d messages received\\en\", retval);\n"
3242 "    for (i = 0; i E<lt> retval; i++) {\n"
3243 "        bufs[i][msgs[i].msg_len] = 0;\n"
3244 "        printf(\"%d %s\", i+1, bufs[i]);\n"
3245 "    }\n"
3246 "    exit(EXIT_SUCCESS);\n"
3247 "}\n"
3248
3249 #.  FIXME . https://bugzilla.kernel.org/show_bug.cgi?id=75371
3250 #.  http://thread.gmane.org/gmane.linux.man/5677
3251 #. type: Plain text
3252 #: build/C/man2/recvmmsg.2:278
3253 msgid "The I<timeout> argument does not work as intended.  The timeout is checked only after the receipt of each datagram, so that if up to I<vlen-1> datagrams are received before the timeout expires, but then no further datagrams are received, the call will block forever."
3254 msgstr "I<timeout> 引き数は意図した通りには動作しない。 タイムアウトは各データグラムの受信後にのみチェックされる。 そのため、 タイムアウトが満了する前に I<vlen-1> 個のデータグラムを受信し、 その後全くデータグラムを受信しなかった場合、 呼び出しはずっと停止し続けてしまう。"
3255
3256 #. type: Plain text
3257 #: build/C/man2/recvmmsg.2:285
3258 msgid "B<clock_gettime>(2), B<recvmsg>(2), B<sendmmsg>(2), B<sendmsg>(2), B<socket>(2), B<socket>(7)"
3259 msgstr "B<clock_gettime>(2), B<recvmsg>(2), B<sendmmsg>(2), B<sendmsg>(2), B<socket>(2), B<socket>(7)"
3260
3261 #. type: TH
3262 #: build/C/man2/select.2:38
3263 #, no-wrap
3264 msgid "SELECT"
3265 msgstr "SELECT"
3266
3267 #. type: TH
3268 #: build/C/man2/select.2:38
3269 #, no-wrap
3270 msgid "2015-01-22"
3271 msgstr "2015-01-22"
3272
3273 #. type: Plain text
3274 #: build/C/man2/select.2:42 build/C/man2/select_tut.2:36
3275 msgid "select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing"
3276 msgstr "select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - 同期 I/O の多重化"
3277
3278 #. type: Plain text
3279 #: build/C/man2/select.2:45 build/C/man2/select_tut.2:39
3280 #, no-wrap
3281 msgid "/* According to POSIX.1-2001 */\n"
3282 msgstr "/* POSIX.1-2001 に従う場合 */\n"
3283
3284 #. type: Plain text
3285 #: build/C/man2/select.2:47 build/C/man2/select.2:68
3286 #: build/C/man2/select_tut.2:41 build/C/man2/select_tut.2:62
3287 #, no-wrap
3288 msgid "B<#include E<lt>sys/select.hE<gt>>\n"
3289 msgstr "B<#include E<lt>sys/select.hE<gt>>\n"
3290
3291 #. type: Plain text
3292 #: build/C/man2/select.2:49 build/C/man2/select_tut.2:43
3293 #, no-wrap
3294 msgid "/* According to earlier standards */\n"
3295 msgstr "/* 以前の規格に従う場合 */\n"
3296
3297 #. type: Plain text
3298 #: build/C/man2/select.2:51 build/C/man2/select_tut.2:45
3299 #, no-wrap
3300 msgid "B<#include E<lt>sys/time.hE<gt>>\n"
3301 msgstr "B<#include E<lt>sys/time.hE<gt>>\n"
3302
3303 #. type: Plain text
3304 #: build/C/man2/select.2:55 build/C/man2/select_tut.2:49
3305 #, no-wrap
3306 msgid "B<#include E<lt>unistd.hE<gt>>\n"
3307 msgstr "B<#include E<lt>unistd.hE<gt>>\n"
3308
3309 #. type: Plain text
3310 #: build/C/man2/select.2:58
3311 #, no-wrap
3312 msgid ""
3313 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3314 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<timeout>B<);>\n"
3315 msgstr ""
3316 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3317 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<timeout>B<);>\n"
3318
3319 #. type: Plain text
3320 #: build/C/man2/select.2:60 build/C/man2/select_tut.2:54
3321 #, no-wrap
3322 msgid "B<void FD_CLR(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3323 msgstr "B<void FD_CLR(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3324
3325 #. type: Plain text
3326 #: build/C/man2/select.2:62 build/C/man2/select_tut.2:56
3327 #, no-wrap
3328 msgid "B<int  FD_ISSET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3329 msgstr "B<int  FD_ISSET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3330
3331 #. type: Plain text
3332 #: build/C/man2/select.2:64 build/C/man2/select_tut.2:58
3333 #, no-wrap
3334 msgid "B<void FD_SET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3335 msgstr "B<void FD_SET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
3336
3337 #. type: Plain text
3338 #: build/C/man2/select.2:66 build/C/man2/select_tut.2:60
3339 #, no-wrap
3340 msgid "B<void FD_ZERO(fd_set *>I<set>B<);>\n"
3341 msgstr "B<void FD_ZERO(fd_set *>I<set>B<);>\n"
3342
3343 #. type: Plain text
3344 #: build/C/man2/select.2:72
3345 #, no-wrap
3346 msgid ""
3347 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3348 "B<            fd_set *>I<exceptfds>B<, const struct timespec *>I<timeout>B<,>\n"
3349 "B<            const sigset_t *>I<sigmask>B<);>\n"
3350 msgstr ""
3351 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3352 "B<            fd_set *>I<exceptfds>B<, const struct timespec *>I<timeout>B<,>\n"
3353 "B<            const sigset_t *>I<sigmask>B<);>\n"
3354
3355 #. type: Plain text
3356 #: build/C/man2/select.2:77 build/C/man2/select_tut.2:71
3357 #: build/C/man3/sockatmark.3:36
3358 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
3359 msgstr "glibc 向けの機能検査マクロの要件 (B<feature_test_macros>(7)  参照):"
3360
3361 #. type: Plain text
3362 #: build/C/man2/select.2:81 build/C/man2/select_tut.2:75
3363 msgid "B<pselect>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
3364 msgstr "B<pselect>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
3365
3366 #. type: Plain text
3367 #: build/C/man2/select.2:93
3368 msgid "B<select>()  and B<pselect>()  allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become \"ready\" for some class of I/O operation (e.g., input possible).  A file descriptor is considered ready if it is possible to perform a corresponding I/O operation (e.g., B<read>(2)  without blocking, or a sufficiently small B<write>(2))."
3369 msgstr "B<select>()  や B<pselect>()  を使うと、プログラムで複数のファイルディスクリプターを監視し、 一つ以上のファイルディスクリプターがある種の I/O 操作の 「ready (準備ができた)」状態 (例えば、読み込み可能になった状態)  になるまで待つことができる。 ファイルディスクリプターが ready (準備ができた) とは、 (B<read>(2)  などの) 対応する I/O 操作が停止 (block) なしに実行したり、 十分小さな B<write>(2) を実行したりできる状態にあることを意味する。"
3370
3371 #. type: Plain text
3372 #: build/C/man2/select.2:99
3373 msgid "The operation of B<select>()  and B<pselect>()  is identical, other than these three differences:"
3374 msgstr "B<select>()  と B<pselect>()  の動作は同じであるが、以下の 3 点が異なる:"
3375
3376 #. type: TP
3377 #: build/C/man2/select.2:99
3378 #, no-wrap
3379 msgid "(i)"
3380 msgstr "(i)"
3381
3382 #. type: Plain text
3383 #: build/C/man2/select.2:109
3384 msgid "B<select>()  uses a timeout that is a I<struct timeval> (with seconds and microseconds), while B<pselect>()  uses a I<struct timespec> (with seconds and nanoseconds)."
3385 msgstr "B<select>()  では、タイムアウト時間の指定に構造体 I<struct timeval> (秒・マイクロ秒単位) を用いる。 一方、 B<pselect>()  関数では、構造体 I<struct timespec> (秒・ナノ秒単位) を用いる。"
3386
3387 #. type: TP
3388 #: build/C/man2/select.2:109
3389 #, no-wrap
3390 msgid "(ii)"
3391 msgstr "(ii)"
3392
3393 #. type: Plain text
3394 #: build/C/man2/select.2:117
3395 msgid "B<select>()  may update the I<timeout> argument to indicate how much time was left.  B<pselect>()  does not change this argument."
3396 msgstr "B<select>()  は残り時間を示す I<timeout> 引き数を更新することがある。 B<pselect>()  はこの引き数を変更しない。"
3397
3398 #. type: TP
3399 #: build/C/man2/select.2:117
3400 #, no-wrap
3401 msgid "(iii)"
3402 msgstr "(iii)"
3403
3404 #. type: Plain text
3405 #: build/C/man2/select.2:126
3406 msgid "B<select>()  has no I<sigmask> argument, and behaves as B<pselect>()  called with NULL I<sigmask>."
3407 msgstr "B<select>()  は I<sigmask> 引き数を持たない。その動作は I<sigmask> に NULL を指定した場合の B<pselect>()  と同じである。"
3408
3409 #. type: Plain text
3410 #: build/C/man2/select.2:144
3411 msgid "Three independent sets of file descriptors are watched.  Those listed in I<readfds> will be watched to see if characters become available for reading (more precisely, to see if a read will not block; in particular, a file descriptor is also ready on end-of-file), those in I<writefds> will be watched to see if space is available for write (though a large write may still block), and those in I<exceptfds> will be watched for exceptions.  On exit, the sets are modified in place to indicate which file descriptors actually changed status.  Each of the three file descriptor sets may be specified as NULL if no file descriptors are to be watched for the corresponding class of events."
3412 msgstr "3 つの独立したファイルディスクリプター集合の監視を行う。 I<readfds> に入れられたディスクリプターについては、読み込みが可能かどうかを 監視する (より正確にいうと、停止 (block) なしで読むことができるかを 調べる。ファイルの終端 (end-of-file) の場合も、 ファイルディスクリプターは読み込み可能として扱われる)。 I<writefds> に入れられたディスクリプターについては、書き込み用に利用可能な領域があるかを監視する (ただし、大きな書き込みの場合には停止する可能性はある)。 I<exceptfds> にあるものについては、例外の監視を行なう。システムコール終了時に、 どのファイルディスクリプターの状態が実際に変化したか示すために、 集合の内容が変更される。 ある種別のイベントを監視したいファイルディスクリプターが一つもない場合には、 対応するファイルディスクリプター集合に NULL を指定することができる。"
3413
3414 #. type: Plain text
3415 #: build/C/man2/select.2:157
3416 msgid "Four macros are provided to manipulate the sets.  B<FD_ZERO>()  clears a set.  B<FD_SET>()  and B<FD_CLR>()  respectively add and remove a given file descriptor from a set.  B<FD_ISSET>()  tests to see if a file descriptor is part of the set; this is useful after B<select>()  returns."
3417 msgstr "集合を操作するために 4 つのマクロが提供されている。 B<FD_ZERO>()  は集合を消去する。 B<FD_SET>()  と B<FD_CLR>()  はそれぞれ指定したファイルディスクリプターの集合への追加、削除を行う。 B<FD_ISSET>()  は集合にファイルディスクリプターがあるかどうか調べる; このマクロは B<select>()  が終了した後に使うと便利である。"
3418
3419 #. type: Plain text
3420 #: build/C/man2/select.2:160
3421 msgid "I<nfds> is the highest-numbered file descriptor in any of the three sets, plus 1."
3422 msgstr "I<nfds> は 3 つの集合に含まれるファイルディスクリプターの最大値に 1 を足したものである。"
3423
3424 #. type: Plain text
3425 #: build/C/man2/select.2:167
3426 msgid "The I<timeout> argument specifies the interval that B<select>()  should block waiting for a file descriptor to become ready.  The call will block until either:"
3427 msgstr "I<timeout> 引き数は、 B<select>() がファイルディスクリプターが ready になるのを待って停止する時間を指定する。 呼び出しは以下のいずれかになるまで停止する。"
3428
3429 #. type: IP
3430 #: build/C/man2/select.2:167 build/C/man2/select.2:169
3431 #: build/C/man2/select.2:171
3432 #, no-wrap
3433 msgid "*"
3434 msgstr "*"
3435
3436 #. type: Plain text
3437 #: build/C/man2/select.2:169
3438 msgid "a file descriptor becomes ready;"
3439 msgstr "ファイルディスクリプターが利用可能になる。"
3440
3441 #. type: Plain text
3442 #: build/C/man2/select.2:171
3443 msgid "the call is interrupted by a signal handler; or"
3444 msgstr "システムコールがシグナルハンドラーにより割り込まれた。"
3445
3446 #. type: Plain text
3447 #: build/C/man2/select.2:173
3448 msgid "the timeout expires."
3449 msgstr "タイムアウト時間が満了した。"
3450
3451 #. type: Plain text
3452 #: build/C/man2/select.2:190
3453 msgid "Note that the I<timeout> interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the blocking interval may overrun by a small amount.  If both fields of the I<timeval> structure are zero, then B<select>()  returns immediately.  (This is useful for polling.)  If I<timeout> is NULL (no timeout), B<select>()  can block indefinitely."
3454 msgstr "この I<timeout> 時間はシステムクロックの粒度に切り上げられ、 カーネルのスケジューリング遅延により少しだけ長くなる可能性がある点に注意すること。 I<timeval> 構造体の両方のフィールドが 0 の場合、 B<select>() はすぐに復帰する (この機能はポーリング (polling) を行うのに便利である)。 I<timeout> に NULL (タイムアウトなし) が指定されると、 B<select>() は無期限に停止 (block) する。"
3455
3456 #. type: Plain text
3457 #: build/C/man2/select.2:200
3458 msgid "I<sigmask> is a pointer to a signal mask (see B<sigprocmask>(2)); if it is not NULL, then B<pselect>()  first replaces the current signal mask by the one pointed to by I<sigmask>, then does the \"select\" function, and then restores the original signal mask."
3459 msgstr "I<sigmask> は、シグナルマスク (B<sigprocmask>(2)  を参照) へのポインターである。 I<sigmask> が NULL でない場合、 B<pselect>()  は I<sigmask> が指しているシグナルマスクで現在のシグナルマスクを置き換えてから、 \"select\" 関数を実行し、 終了後にシグナルマスクを元のシグナルマスクに戻す。"
3460
3461 #. type: Plain text
3462 #: build/C/man2/select.2:206
3463 msgid "Other than the difference in the precision of the I<timeout> argument, the following B<pselect>()  call:"
3464 msgstr "I<timeout> 引き数の精度の違いを除くと、以下の B<pselect>()  の呼び出しは、"
3465
3466 #. type: Plain text
3467 #: build/C/man2/select.2:210
3468 #, no-wrap
3469 msgid ""
3470 "    ready = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
3471 "                    timeout, &sigmask);\n"
3472 msgstr ""
3473 "    ready = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
3474 "                    timeout, &sigmask);\n"
3475
3476 #. type: Plain text
3477 #: build/C/man2/select.2:215
3478 msgid "is equivalent to I<atomically> executing the following calls:"
3479 msgstr "次のコールを I<atomic> に実行するのと等価である。"
3480
3481 #. type: Plain text
3482 #: build/C/man2/select.2:218
3483 #, no-wrap
3484 msgid "    sigset_t origmask;\n"
3485 msgstr "    sigset_t origmask;\n"
3486
3487 #. type: Plain text
3488 #: build/C/man2/select.2:222
3489 #, no-wrap
3490 msgid ""
3491 "    pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
3492 "    ready = select(nfds, &readfds, &writefds, &exceptfds, timeout);\n"
3493 "    pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
3494 msgstr ""
3495 "    pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);\n"
3496 "    ready = select(nfds, &readfds, &writefds, &exceptfds, timeout);\n"
3497 "    pthread_sigmask(SIG_SETMASK, &origmask, NULL);\n"
3498
3499 #. type: Plain text
3500 #: build/C/man2/select.2:243
3501 msgid "The reason that B<pselect>()  is needed is that if one wants to wait for either a signal or for a file descriptor to become ready, then an atomic test is needed to prevent race conditions.  (Suppose the signal handler sets a global flag and returns.  Then a test of this global flag followed by a call of B<select>()  could hang indefinitely if the signal arrived just after the test but just before the call.  By contrast, B<pselect>()  allows one to first block signals, handle the signals that have come in, then call B<pselect>()  with the desired I<sigmask>, avoiding the race.)"
3502 msgstr "B<pselect>()  が必要になる理由は、シグナルやファイルディスクリプターの状態変化を 待ちたいときには、競合状態を避けるために atomic なテストが必要になる からである。 (シグナルハンドラーが大域フラグを設定して戻る場合を考えてみよう。 この大域フラグのテストに続けて B<select>()  を呼び出すと、 シグナルがテストの直後かつ呼び出しの直前に届いた時には B<select>()  は永久にハングしてしまうかもしれない。 一方、 B<pselect>()  を使うと、まずシグナルを禁止 (block) して、入ってくるシグナルを操作し、 望みの I<sigmask> で B<pselect>()  を呼び出すことで、前記の競合を避けることができる。)"
3503
3504 #. type: SS
3505 #: build/C/man2/select.2:243
3506 #, no-wrap
3507 msgid "The timeout"
3508 msgstr "タイムアウト"
3509
3510 #. type: Plain text
3511 #: build/C/man2/select.2:247
3512 msgid "The time structures involved are defined in I<E<lt>sys/time.hE<gt>> and look like"
3513 msgstr "これらの関数で使用される時間関連の構造体は、 I<E<lt>sys/time.hE<gt>> で"
3514
3515 #. type: Plain text
3516 #: build/C/man2/select.2:254
3517 #, no-wrap
3518 msgid ""
3519 "struct timeval {\n"
3520 "    long    tv_sec;         /* seconds */\n"
3521 "    long    tv_usec;        /* microseconds */\n"
3522 "};\n"
3523 msgstr ""
3524 "struct timeval {\n"
3525 "    long    tv_sec;         /* 秒 */\n"
3526 "    long    tv_usec;        /* マイクロ秒 */\n"
3527 "};\n"
3528
3529 #. type: Plain text
3530 #: build/C/man2/select.2:258
3531 msgid "and"
3532 msgstr "や"
3533
3534 #. type: Plain text
3535 #: build/C/man2/select.2:265
3536 #, no-wrap
3537 msgid ""
3538 "struct timespec {\n"
3539 "    long    tv_sec;         /* seconds */\n"
3540 "    long    tv_nsec;        /* nanoseconds */\n"
3541 "};\n"
3542 msgstr ""
3543 "struct timespec {\n"
3544 "    long    tv_sec;         /* 秒 */\n"
3545 "    long    tv_nsec;        /* ナノ秒 */\n"
3546 "};\n"
3547
3548 #. type: Plain text
3549 #: build/C/man2/select.2:269
3550 msgid "(However, see below on the POSIX.1-2001 versions.)"
3551 msgstr "のように定義されている。 (POSIX.1-2001 での定義については下記の「注意」を参照)"
3552
3553 #. type: Plain text
3554 #: build/C/man2/select.2:277
3555 msgid "Some code calls B<select>()  with all three sets empty, I<nfds> zero, and a non-NULL I<timeout> as a fairly portable way to sleep with subsecond precision."
3556 msgstr "秒単位以下の精度でスリープを実現する 移植性の高い方法として、 3 つの集合全てを空、 I<nfds> を 0 、 I<timeout> を NULL でない値に設定して B<select>()  を呼び出すという方法を使っているコードもある。"
3557
3558 #.  .PP - it is rumored that:
3559 #.  On BSD, when a timeout occurs, the file descriptor bits are not changed.
3560 #.  - it is certainly true that:
3561 #.  Linux follows SUSv2 and sets the bit masks to zero upon a timeout.
3562 #. type: Plain text
3563 #: build/C/man2/select.2:300
3564 msgid "On Linux, B<select>()  modifies I<timeout> to reflect the amount of time not slept; most other implementations do not do this.  (POSIX.1-2001 permits either behavior.)  This causes problems both when Linux code which reads I<timeout> is ported to other operating systems, and when code is ported to Linux that reuses a I<struct timeval> for multiple B<select>()s in a loop without reinitializing it.  Consider I<timeout> to be undefined after B<select>()  returns."
3565 msgstr "Linux では、 B<select>()  は I<timeout> を変更し、残りの停止時間を反映するようになっているが、 他のほとんどの実装ではこのようになっていない (POSIX.1-2001 はどちらの動作も認めている)。 このため、 I<timeout> を参照している Linux のコードを他のオペレーティングシステムへ 移植する場合、問題が起こる。 また、ループの中で I<timeval> 構造体を初期化せずにそのまま再利用して B<select>()  を複数回行なっているコードを Linux へ移植する場合にも、問題が起こる。 B<select>()  から復帰した後は I<timeout> は未定義であると考えるべきである。"
3566
3567 #. type: Plain text
3568 #: build/C/man2/select.2:318
3569 msgid "On success, B<select>()  and B<pselect>()  return the number of file descriptors contained in the three returned descriptor sets (that is, the total number of bits that are set in I<readfds>, I<writefds>, I<exceptfds>)  which may be zero if the timeout expires before anything interesting happens.  On error, -1 is returned, and I<errno> is set to indicate the error; the file descriptor sets are unmodified, and I<timeout> becomes undefined."
3570 msgstr "成功した場合、 B<select>()  と B<pselect>()  は更新された 3 つのディスクリプター集合に含まれている ファイルディスクリプターの数 (つまり、 I<readfds>, I<writefds>, I<exceptfds> 中の 1 になっているビットの総数) を返す。 何も起こらずに時間切れになった場合、 ディスクリプターの数は 0 になることもある。 エラーならば -1 を返し、 I<errno> にエラーを示す値が設定される; ファイルディスクリプター集合は変更されず、 I<timeout> は不定となる。"
3571
3572 #. type: Plain text
3573 #: build/C/man2/select.2:324
3574 msgid "An invalid file descriptor was given in one of the sets.  (Perhaps a file descriptor that was already closed, or one on which an error has occurred.)"
3575 msgstr "いずれかの集合に無効なファイルディスクリプターが指定された (おそらくは、すでにクローズされたファイルディスクリプターか、 エラーが発生したファイルディスクリプターが指定された)。"
3576
3577 #. type: Plain text
3578 #: build/C/man2/select.2:328
3579 msgid "A signal was caught; see B<signal>(7)."
3580 msgstr "シグナルを受信した。"
3581
3582 #. type: Plain text
3583 #: build/C/man2/select.2:335
3584 msgid "I<nfds> is negative or exceeds the B<RLIMIT_NOFILE> resource limit (see B<getrlimit>(2))."
3585 msgstr "I<nfds> が負、 またはリソース上限 B<RLIMIT_NOFILE> (B<getrlimit>(2) 参照) より大きい。"
3586
3587 #. type: Plain text
3588 #: build/C/man2/select.2:340
3589 msgid "the value contained within I<timeout> is invalid."
3590 msgstr "I<timeout> に入っている値が不正である。"
3591
3592 #. type: Plain text
3593 #: build/C/man2/select.2:343
3594 msgid "unable to allocate memory for internal tables."
3595 msgstr "内部テーブルにメモリーを割り当てることができなかった。"
3596
3597 #. type: Plain text
3598 #: build/C/man2/select.2:349
3599 msgid "B<pselect>()  was added to Linux in kernel 2.6.16.  Prior to this, B<pselect>()  was emulated in glibc (but see BUGS)."
3600 msgstr "B<pselect>()  はカーネル 2.6.16 で Linux に追加された。 それ以前は、 B<pselect>()  は glibc でエミュレートされていた (「バグ」の章を参照)。"
3601
3602 #. type: Plain text
3603 #: build/C/man2/select.2:360
3604 msgid "B<select>()  conforms to POSIX.1-2001 and 4.4BSD (B<select>()  first appeared in 4.2BSD).  Generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System\\ V variants).  However, note that the System\\ V variant typically sets the timeout variable before exit, but the BSD variant does not."
3605 msgstr "B<select>()  は POSIX.1-2001 と 4.4BSD (B<select>()  は 4.2BSD で最初に登場した) に準拠する。 BSD ソケット層のクローンをサポートしている非 BSD システム (System\\ V 系も含む) との間でだいたい移植性がある。しかし System\\ V 系では たいがい timeout 変数を exit の前にセットするが、 BSD 系ではそうでないので注意すること。"
3606
3607 #. type: Plain text
3608 #: build/C/man2/select.2:364
3609 msgid "B<pselect>()  is defined in POSIX.1g, and in POSIX.1-2001."
3610 msgstr "B<pselect>()  は POSIX.1g と POSIX.1-2001 で定義されている。"
3611
3612 #. type: Plain text
3613 #: build/C/man2/select.2:381
3614 msgid "An I<fd_set> is a fixed size buffer.  Executing B<FD_CLR>()  or B<FD_SET>()  with a value of I<fd> that is negative or is equal to or larger than B<FD_SETSIZE> will result in undefined behavior.  Moreover, POSIX requires I<fd> to be a valid file descriptor."
3615 msgstr "I<fd_set> は固定サイズのバッファーである。 負や B<FD_SETSIZE> 以上の値を持つ I<fd> に対して B<FD_CLR>()  や B<FD_SET>()  を実行した場合、 どのような動作をするかは定義されていない。 また、 POSIX では I<fd> は有効なファイルディスクリプターでなければならないと規定されている。"
3616
3617 #. type: Plain text
3618 #: build/C/man2/select.2:390
3619 msgid "Concerning the types involved, the classical situation is that the two fields of a I<timeval> structure are typed as I<long> (as shown above), and the structure is defined in I<E<lt>sys/time.hE<gt>>.  The POSIX.1-2001 situation is"
3620 msgstr "型宣言に関しては、昔ながらの状況では I<timeval> 構造体の 2 つのフィールドは (上記のように) 両方とも I<long> 型であり、構造体は I<E<lt>sys/time.hE<gt>> で定義されている。 POSIX.1-2001 の下では、以下のようになっている。"
3621
3622 #. type: Plain text
3623 #: build/C/man2/select.2:397
3624 #, no-wrap
3625 msgid ""
3626 "struct timeval {\n"
3627 "    time_t         tv_sec;     /* seconds */\n"
3628 "    suseconds_t    tv_usec;    /* microseconds */\n"
3629 "};\n"
3630 msgstr ""
3631 "struct timeval {\n"
3632 "\t time_t         tv_sec;     /* 秒 */\n"
3633 "\t suseconds_t    tv_usec;    /* マイクロ秒 */\n"
3634 "};\n"
3635
3636 #. type: Plain text
3637 #: build/C/man2/select.2:408
3638 msgid "where the structure is defined in I<E<lt>sys/select.hE<gt>> and the data types I<time_t> and I<suseconds_t> are defined in I<E<lt>sys/types.hE<gt>>."
3639 msgstr "この構造体は I<E<lt>sys/select.hE<gt>> で定義されており、データ型 I<time_t> と I<suseconds_t> は I<E<lt>sys/types.hE<gt>> で定義されている。"
3640
3641 #. type: Plain text
3642 #: build/C/man2/select.2:420
3643 msgid "Concerning prototypes, the classical situation is that one should include I<E<lt>time.hE<gt>> for B<select>().  The POSIX.1-2001 situation is that one should include I<E<lt>sys/select.hE<gt>> for B<select>()  and B<pselect>()."
3644 msgstr "プロトタイプに関しては、昔ながらの状況で B<select>()  を使いたい場合は、 I<E<lt>time.hE<gt>> をインクルードすればよい。 POSIX.1-2001 の環境で B<select>()  と B<pselect>()  を使いたい場合は、 I<E<lt>sys/select.hE<gt>> をインクルードすればよい。"
3645
3646 #. type: Plain text
3647 #: build/C/man2/select.2:431
3648 msgid "Under glibc 2.0, I<E<lt>sys/select.hE<gt>> gives the wrong prototype for B<pselect>().  Under glibc 2.1 to 2.2.1, it gives B<pselect>()  when B<_GNU_SOURCE> is defined.  Since glibc 2.2.2, the requirements are as shown in the SYNOPSIS."
3649 msgstr "glibc 2.0 では I<E<lt>sys/select.hE<gt>> が提供する B<pselect>()  のプロトタイプが間違っている。 glibc 2.1 から 2.2.1 では B<_GNU_SOURCE> が定義されている場合に、 B<pselect>()  が提供される。 glibc 2.2.2 以降では、 B<pselect>()  を使用するには、「書式」に記載された要件を満たす必要がある。"
3650
3651 #. type: SS
3652 #: build/C/man2/select.2:431
3653 #, no-wrap
3654 msgid "Multithreaded applications"
3655 msgstr "マルチスレッドアプリケーション"
3656
3657 #. type: Plain text
3658 #: build/C/man2/select.2:448
3659 msgid "If a file descriptor being monitored by B<select>()  is closed in another thread, the result is unspecified.  On some UNIX systems, B<select>()  unblocks and returns, with an indication that the file descriptor is ready (a subsequent I/O operation will likely fail with an error, unless another the file descriptor reopened between the time B<select>()  returned and the I/O operations was performed).  On Linux (and some other systems), closing the file descriptor in another thread has no effect on B<select>().  In summary, any application that relies on a particular behavior in this scenario must be considered buggy."
3660 msgstr "B<select>() で監視中のファイルディスクリプターが別のスレッドでクローズされた場合、どのような結果になるかは規定されていない。いくつかの UNIX システムでは、 B<select>() は停止 (block) せず、すぐ返り、ファイルディスクリプターが ready だと報告される (B<select>() が返ってから I/O 操作が実行されるまでの間に、 別のファイルディスクリプターが再度オープンされない限り、 それ以降の I/O 操作はおそらく失敗するだろう)。 Linux (や他のいくつかのシステム) では、 別のスレッドでファイルディスクリプターがクローズされても B<select>() には影響を与えない。 まとめると、このような場合に特定の動作に依存しているアプリケーションは「バグっている」と考えなければならない。"
3661
3662 #. type: SS
3663 #: build/C/man2/select.2:448
3664 #, no-wrap
3665 msgid "C library/kernel ABI differences"
3666 msgstr "C ライブラリとカーネル ABI の違い"
3667
3668 #. type: Plain text
3669 #: build/C/man2/select.2:456
3670 msgid "The B<pselect>()  interface described in this page is implemented by glibc.  The underlying Linux system call is named B<pselect6>().  This system call has somewhat different behavior from the glibc wrapper function."
3671 msgstr ""
3672 "このページで説明している B<pselect>() のインターフェースは、glibc に\n"
3673 "実装されているものである。内部で呼び出される Linux のシステムコールは\n"
3674 "B<pselect6>() という名前である。このシステムコールは glibc のラッパー\n"
3675 "関数とは少し違った動作をする。"
3676
3677 #. type: Plain text
3678 #: build/C/man2/select.2:471
3679 msgid "The Linux B<pselect6>()  system call modifies its I<timeout> argument.  However, the glibc wrapper function hides this behavior by using a local variable for the timeout argument that is passed to the system call.  Thus, the glibc B<pselect>()  function does not modify its I<timeout> argument; this is the behavior required by POSIX.1-2001."
3680 msgstr ""
3681 "Linux の B<pselect6>() システムコールは I<timeout> 引き数を変更する。\n"
3682 "しかし、glibc のラッパー関数は、システムコールに渡す timeout 引き数と\n"
3683 "してローカル変数を使うことでこの動作を隠蔽している。このため、glibc の\n"
3684 "B<pselect>() 関数は I<timeout> 引き数を変更しない。\n"
3685 "これが POSIX.1-2001 が要求している動作である。"
3686
3687 #. type: Plain text
3688 #: build/C/man2/select.2:477
3689 msgid "The final argument of the B<pselect6>()  system call is not a I<sigset_t\\ *> pointer, but is instead a structure of the form:"
3690 msgstr ""
3691 "B<pselect6>() システムコールの最後の引き数は I<sigset_t\\ *> 型の\n"
3692 "ポインターではなく、以下に示す構造体である。"
3693
3694 #. type: Plain text
3695 #: build/C/man2/select.2:485
3696 #, no-wrap
3697 msgid ""
3698 "struct {\n"
3699 "    const sigset_t *ss;     /* Pointer to signal set */\n"
3700 "    size_t          ss_len; /* Size (in bytes) of object pointed\n"
3701 "                               to by 'ss' */\n"
3702 "};\n"
3703 msgstr ""
3704 "struct {\n"
3705 "    const sigset_t *ss;     /* シグナル集合へのポインター */\n"
3706 "    size_t          ss_len; /* 'ss' が指すオブジェクトのサイズ\n"
3707 "                               (バイト数) */\n"
3708 "};\n"
3709
3710 #. type: Plain text
3711 #: build/C/man2/select.2:492
3712 msgid "This allows the system call to obtain both a pointer to the signal set and its size, while allowing for the fact that most architectures support a maximum of 6 arguments to a system call."
3713 msgstr ""
3714 "このようにすることで、ほとんどのアーキテクチャーがサポートしている\n"
3715 "システムコールの引き数が最大で 6 個という事実を満たしつつ、\n"
3716 "B<pselect6>() システムコールがシグナル集合へのポインターとシグナル集合\n"
3717 "のサイズの両方を取得することができるのである。"
3718
3719 #. type: Plain text
3720 #: build/C/man2/select.2:498
3721 msgid "Glibc 2.0 provided a version of B<pselect>()  that did not take a I<sigmask> argument."
3722 msgstr "glibc 2.0 では、 I<sigmask> 引き数を取らないバージョンの B<pselect>()  が提供されていた。"
3723
3724 #. type: Plain text
3725 #: build/C/man2/select.2:511
3726 msgid "Starting with version 2.1, glibc provided an emulation of B<pselect>()  that was implemented using B<sigprocmask>(2)  and B<select>().  This implementation remained vulnerable to the very race condition that B<pselect>()  was designed to prevent.  Modern versions of glibc use the (race-free)  B<pselect>()  system call on kernels where it is provided."
3727 msgstr "バージョン 2.1 以降の glibc では、 B<pselect>()  は B<sigprocmask>(2)  と B<select>()  を使ってエミュレートされていた。 この実装にはきわどい競合条件において脆弱性が残っていた。 この競合条件における問題を防止するために B<pselect>()  は設計されたのである。 最近のバージョンの glibc では、カーネルがサポートしている場合には、 (競合が起こらない)  B<pselect>()  システムコールが使用される。"
3728
3729 #. type: Plain text
3730 #: build/C/man2/select.2:524
3731 msgid "On systems that lack B<pselect>(), reliable (and more portable) signal trapping can be achieved using the self-pipe trick.  In this technique, a signal handler writes a byte to a pipe whose other end is monitored by B<select>()  in the main program.  (To avoid possibly blocking when writing to a pipe that may be full or reading from a pipe that may be empty, nonblocking I/O is used when reading from and writing to the pipe.)"
3732 msgstr ""
3733 "B<pselect>() がないシステムにおいて、シグナルの捕捉を信頼性があり (移植\n"
3734 "性も高い) 方法で行うには、 自己パイプ (self-pipe) という技を使うとよい。\n"
3735 "この方法では、シグナルハンドラーはパイプへ 1 バイトのデータを書き込み、\n"
3736 "同じパイプのもう一端をメインプログラムの B<select>() で監視する (一杯に\n"
3737 "なったパイプへの書き込みや空のパイプから読み出しを行った際に起こるであ\n"
3738 "ろう停止 (blocking) を避けるためには、パイプへの読み書きの際には 非停止\n"
3739 "(nonblocking) I/O を使用するとよい)。"
3740
3741 #.  Stevens discusses a case where accept can block after select
3742 #.  returns successfully because of an intervening RST from the client.
3743 #.  Maybe the kernel should have returned EIO in such a situation?
3744 #. type: Plain text
3745 #: build/C/man2/select.2:540
3746 msgid "Under Linux, B<select>()  may report a socket file descriptor as \"ready for reading\", while nevertheless a subsequent read blocks.  This could for example happen when data has arrived but upon examination has wrong checksum and is discarded.  There may be other circumstances in which a file descriptor is spuriously reported as ready.  Thus it may be safer to use B<O_NONBLOCK> on sockets that should not block."
3747 msgstr "Linux では、 B<select>()  がソケットファイルディスクリプターで \"読み込みの準備ができた\" と報告した場合でも、 この後で read を行うと停止 (block) することがある。このような状況は、 例えば、データが到着したが、検査でチェックサム異常が見つかり廃棄された時 などに起こりえる。他にもファイルディスクリプターが準備できたと間違って 報告される状況が起こるかもしれない。 したがって、停止すべきではないソケットに対しては B<O_NONBLOCK> を使うとより安全であろう。"
3748
3749 #. type: Plain text
3750 #: build/C/man2/select.2:555
3751 msgid "On Linux, B<select>()  also modifies I<timeout> if the call is interrupted by a signal handler (i.e., the B<EINTR> error return).  This is not permitted by POSIX.1-2001.  The Linux B<pselect>()  system call has the same behavior, but the glibc wrapper hides this behavior by internally copying the I<timeout> to a local variable and passing that variable to the system call."
3752 msgstr "Linux では、 B<select>()  がシグナルハンドラーにより割り込まれた場合 (つまり B<EINTR> エラーが返る場合)、 I<timeout> も変更する。 これは POSIX.1-2001 では認められていない挙動である。 Linux の B<pselect>()  システムコールも同じ挙動をするが、 glibc のラッパー関数がこの挙動を隠蔽している。 具体的には、glibc のラッパー関数の内部で、 I<timeout> をローカル変数にコピーし、 このローカル変数をシステムコールに渡している。"
3753
3754 #. type: Plain text
3755 #: build/C/man2/select.2:562
3756 #, no-wrap
3757 msgid ""
3758 "#include E<lt>stdio.hE<gt>\n"
3759 "#include E<lt>stdlib.hE<gt>\n"
3760 "#include E<lt>sys/time.hE<gt>\n"
3761 "#include E<lt>sys/types.hE<gt>\n"
3762 "#include E<lt>unistd.hE<gt>\n"
3763 msgstr ""
3764 "#include E<lt>stdio.hE<gt>\n"
3765 "#include E<lt>stdlib.hE<gt>\n"
3766 "#include E<lt>sys/time.hE<gt>\n"
3767 "#include E<lt>sys/types.hE<gt>\n"
3768 "#include E<lt>unistd.hE<gt>\n"
3769
3770 #. type: Plain text
3771 #: build/C/man2/select.2:569
3772 #, no-wrap
3773 msgid ""
3774 "int\n"
3775 "main(void)\n"
3776 "{\n"
3777 "    fd_set rfds;\n"
3778 "    struct timeval tv;\n"
3779 "    int retval;\n"
3780 msgstr ""
3781 "int\n"
3782 "main(void)\n"
3783 "{\n"
3784 "    fd_set rfds;\n"
3785 "    struct timeval tv;\n"
3786 "    int retval;\n"
3787
3788 #. type: Plain text
3789 #: build/C/man2/select.2:573
3790 #, no-wrap
3791 msgid ""
3792 "    /* Watch stdin (fd 0) to see when it has input. */\n"
3793 "    FD_ZERO(&rfds);\n"
3794 "    FD_SET(0, &rfds);\n"
3795 msgstr ""
3796 "    /* stdin (fd 0) を監視し、入力があった場合に表示する。*/\n"
3797 "    FD_ZERO(&rfds);\n"
3798 "    FD_SET(0, &rfds);\n"
3799
3800 #. type: Plain text
3801 #: build/C/man2/select.2:577
3802 #, no-wrap
3803 msgid ""
3804 "    /* Wait up to five seconds. */\n"
3805 "    tv.tv_sec = 5;\n"
3806 "    tv.tv_usec = 0;\n"
3807 msgstr ""
3808 "    /* 5 秒間監視する。*/\n"
3809 "    tv.tv_sec = 5;\n"
3810 "    tv.tv_usec = 0;\n"
3811
3812 #. type: Plain text
3813 #: build/C/man2/select.2:580
3814 #, no-wrap
3815 msgid ""
3816 "    retval = select(1, &rfds, NULL, NULL, &tv);\n"
3817 "    /* Don't rely on the value of tv now! */\n"
3818 msgstr ""
3819 "    retval = select(1, &rfds, NULL, NULL, &tv);\n"
3820 "    /* この時点での tv の値を信頼してはならない。*/\n"
3821
3822 #. type: Plain text
3823 #: build/C/man2/select.2:588
3824 #, no-wrap
3825 msgid ""
3826 "    if (retval == -1)\n"
3827 "        perror(\"select()\");\n"
3828 "    else if (retval)\n"
3829 "        printf(\"Data is available now.\\en\");\n"
3830 "        /* FD_ISSET(0, &rfds) will be true. */\n"
3831 "    else\n"
3832 "        printf(\"No data within five seconds.\\en\");\n"
3833 msgstr ""
3834 "    if (retval == -1)\n"
3835 "\tperror(\"select()\");\n"
3836 "    else if (retval)\n"
3837 "        printf(\"今、データが取得できました。\\en\");\n"
3838 "        /* FD_ISSET(0, &rfds) が true になる。*/\n"
3839 "    else\n"
3840 "        printf(\"5 秒以内にデータが入力されませんでした。\\en\");\n"
3841
3842 #. type: Plain text
3843 #: build/C/man2/select.2:604
3844 msgid "B<accept>(2), B<connect>(2), B<poll>(2), B<read>(2), B<recv>(2), B<restart_syscall>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<epoll>(7), B<time>(7)"
3845 msgstr "B<accept>(2), B<connect>(2), B<poll>(2), B<read>(2), B<recv>(2), B<restart_syscall>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<epoll>(7), B<time>(7)"
3846
3847 #. type: Plain text
3848 #: build/C/man2/select.2:607
3849 msgid "For a tutorial with discussion and examples, see B<select_tut>(2)."
3850 msgstr "考察と使用例の書かれたチュートリアルとして、 B<select_tut>(2)  がある。"
3851
3852 #. type: TH
3853 #: build/C/man2/select_tut.2:32
3854 #, no-wrap
3855 msgid "SELECT_TUT"
3856 msgstr "SELECT_TUT"
3857
3858 #. type: TH
3859 #: build/C/man2/select_tut.2:32
3860 #, no-wrap
3861 msgid "2013-12-30"
3862 msgstr "2013-12-30"
3863
3864 #. type: Plain text
3865 #: build/C/man2/select_tut.2:52
3866 #, no-wrap
3867 msgid ""
3868 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3869 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<utimeout>B<);>\n"
3870 msgstr ""
3871 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3872 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<utimeout>B<);>\n"
3873
3874 #. type: Plain text
3875 #: build/C/man2/select_tut.2:66
3876 #, no-wrap
3877 msgid ""
3878 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3879 "B<            fd_set *>I<exceptfds>B<, const struct timespec *>I<ntimeout>B<,>\n"
3880 "B<            const sigset_t *>I<sigmask>B<);>\n"
3881 msgstr ""
3882 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set *>I<writefds>B<,>\n"
3883 "B<            fd_set *>I<exceptfds>B<, const struct timespec *>I<ntimeout>B<,>\n"
3884 "B<            const sigset_t *>I<sigmask>B<);>\n"
3885
3886 #. type: Plain text
3887 #: build/C/man2/select_tut.2:83
3888 msgid "B<select>()  (or B<pselect>())  is used to efficiently monitor multiple file descriptors, to see if any of them is, or becomes, \"ready\"; that is, to see whether I/O becomes possible, or an \"exceptional condition\" has occurred on any of the descriptors."
3889 msgstr "B<select>()  (や B<pselect>())  を使うと、効率的に複数のファイルディスクリプターを監視し、 そのファイルディスクリプターのいずれかが 「ready (準備ができた)」状態、つまり I/O (入出力) が可能になっているかや、 ファイルディスクリプターのいずれかが 「例外状態 (exceptional condition)」が発生したか、を調べることができる。"
3890
3891 #. type: Plain text
3892 #: build/C/man2/select_tut.2:108
3893 msgid "Its principal arguments are three \"sets\" of file descriptors: I<readfds>, I<writefds>, and I<exceptfds>.  Each set is declared as type I<fd_set>, and its contents can be manipulated with the macros B<FD_CLR>(), B<FD_ISSET>(), B<FD_SET>(), and B<FD_ZERO>().  A newly declared set should first be cleared using B<FD_ZERO>().  B<select>()  modifies the contents of the sets according to the rules described below; after calling B<select>()  you can test if a file descriptor is still present in a set with the B<FD_ISSET>()  macro.  B<FD_ISSET>()  returns nonzero if a specified file descriptor is present in a set and zero if it is not.  B<FD_CLR>()  removes a file descriptor from a set."
3894 msgstr "この関数の主要な引き数は、3種類のファイルディスクリプターの「集合」 I<readfds>, I<writefds>, I<exceptfds> である。 各々の集合は B<fd_set> として宣言され、その内容は B<FD_CLR>(), B<FD_ISSET>(), B<FD_SET>(), B<FD_ZERO>()  といったマクロによって操作できる。 新しく宣言された集合は、まず最初に B<FD_ZERO>()  を使ってクリアすべきである。 B<select>()  はこれらの集合の内容を、以降に述べる規則に従って修正する。 B<select>()  を呼んだ後、ファイルディスクリプターがまだ集合に存在しているかどうかは、 B<FD_ISSET>()  マクロによって調べることができる。 B<FD_ISSET>()  は指定されたディスクリプターが集合に存在していれば 0 以外の値を返し、 存在しなければ 0 を返す。 B<FD_CLR>()  は集合からのファイルディスクリプターの削除を行う。"
3895
3896 #. type: SS
3897 #: build/C/man2/select_tut.2:108
3898 #, no-wrap
3899 msgid "Arguments"
3900 msgstr "引き数"
3901
3902 #. type: TP
3903 #: build/C/man2/select_tut.2:109
3904 #, no-wrap
3905 msgid "I<readfds>"
3906 msgstr "I<readfds>"
3907
3908 #. type: Plain text
3909 #: build/C/man2/select_tut.2:118
3910 msgid "This set is watched to see if data is available for reading from any of its file descriptors.  After B<select>()  has returned, I<readfds> will be cleared of all file descriptors except for those that are immediately available for reading."
3911 msgstr "この集合に含まれるいずれかのファイルディスクリプターで、 データの読み込みが可能になったかどうかを監視する。 B<select>()  から戻る時に、I<readfds> のうち、 直ちに読み込み可能なファイルディスクリプター以外は 集合から削除される。"
3912
3913 #. type: TP
3914 #: build/C/man2/select_tut.2:118
3915 #, no-wrap
3916 msgid "I<writefds>"
3917 msgstr "I<writefds>"
3918
3919 #. type: Plain text
3920 #: build/C/man2/select_tut.2:127
3921 msgid "This set is watched to see if there is space to write data to any of its file descriptors.  After B<select>()  has returned, I<writefds> will be cleared of all file descriptors except for those that are immediately available for writing."
3922 msgstr "この集合に含まれるいずれかのファイルディスクリプターで、 データを書き込むスペースがあるかどうかを監視する。 B<select>()  から戻る時に、I<writefds> のうち、 直ちに書き込み可能なファイルディスクリプター以外は 集合から削除される。"
3923
3924 #. type: TP
3925 #: build/C/man2/select_tut.2:127
3926 #, no-wrap
3927 msgid "I<exceptfds>"
3928 msgstr "I<exceptfds>"
3929
3930 #. type: Plain text
3931 #: build/C/man2/select_tut.2:149
3932 msgid "This set is watched for \"exceptional conditions\".  In practice, only one such exceptional condition is common: the availability of I<out-of-band> (OOB) data for reading from a TCP socket.  See B<recv>(2), B<send>(2), and B<tcp>(7)  for more details about OOB data.  (One other less common case where B<select>(2)  indicates an exceptional condition occurs with pseudoterminals in packet mode; see B<tty_ioctl>(4).)  After B<select>()  has returned, I<exceptfds> will be cleared of all file descriptors except for those for which an exceptional condition has occurred."
3933 msgstr "この集合に含まれるいずれかのファイルディスクリプターで、 「例外状態 (exceptional condition)」が発生したかどうかを監視する。 実際の動作では、普通に起こり得る例外状態は一つだけであり、 それは TCP ソケットで I<帯域外 (out-of-band; OOB)> データが 読み込み可能な場合である。 OOB データの詳細については、 B<recv>(2), B<send>(2), B<tcp>(7)  を参照のこと。 (これ以外では、まれなことだが、 パケットモードの擬似端末 (pseudoterminals) で B<select>()  が例外状態を示すことがある。)  B<select>()  が返る時に、I<exceptfds> のうち、 例外状態が発生したディスクリプター以外は集合から削除される。"
3934
3935 #. type: TP
3936 #: build/C/man2/select_tut.2:149
3937 #, no-wrap
3938 msgid "I<nfds>"
3939 msgstr "I<nfds>"
3940
3941 #. type: Plain text
3942 #: build/C/man2/select_tut.2:156
3943 msgid "This is an integer one more than the maximum of any file descriptor in any of the sets.  In other words, while adding file descriptors to each of the sets, you must calculate the maximum integer value of all of them, then increment this value by one, and then pass this as I<nfds>."
3944 msgstr "全ての集合に含まれるファイルディスクリプターのうち、 値が最大のものに 1 を足した整数である。 すなわち、ファイルディスクリプターを各集合に加える作業の途中で、 全てのファイルディスクリプターを見て最大値を求め、 それに 1 を加えて I<nfds> として渡さないといけない、ということだ。"
3945
3946 #. type: TP
3947 #: build/C/man2/select_tut.2:156
3948 #, no-wrap
3949 msgid "I<utimeout>"
3950 msgstr "I<utimeout>"
3951
3952 #. type: Plain text
3953 #: build/C/man2/select_tut.2:169
3954 msgid "This is the longest time B<select>()  may wait before returning, even if nothing interesting happened.  If this value is passed as NULL, then B<select>()  blocks indefinitely waiting for a file descriptor to become ready.  I<utimeout> can be set to zero seconds, which causes B<select>()  to return immediately, with information about the readiness of file descriptors at the time of the call.  The structure I<struct timeval> is defined as:"
3955 msgstr "(何も起こらなかった場合に)  B<select>()  が戻る前に待つ最大時間である。 この値に NULL を渡すと、 B<select>()  はファイルディスクリプターのいずれかが ready (準備ができた) 状態に なるまで待ち続けてずっと停止する。 I<utimeout> は 0 秒にすることもでき、 この場合 B<select>()  は直ちに返り、呼び出し時点のファイルディスクリプターの状態に 関する情報が返される。 構造体 I<struct timeval> は次のように定義されている:"
3956
3957 #. type: Plain text
3958 #: build/C/man2/select_tut.2:176
3959 #, no-wrap
3960 msgid ""
3961 "struct timeval {\n"
3962 "    time_t tv_sec;    /* seconds */\n"
3963 "    long tv_usec;     /* microseconds */\n"
3964 "};\n"
3965 msgstr ""
3966 "struct timeval {\n"
3967 "    time_t tv_sec;    /* seconds */\n"
3968 "    long tv_usec;     /* microseconds */\n"
3969 "};\n"
3970
3971 #. type: TP
3972 #: build/C/man2/select_tut.2:178
3973 #, no-wrap
3974 msgid "I<ntimeout>"
3975 msgstr "I<ntimeout>"
3976
3977 #. type: Plain text
3978 #: build/C/man2/select_tut.2:187
3979 msgid "This argument for B<pselect>()  has the same meaning as I<utimeout>, but I<struct timespec> has nanosecond precision as follows:"
3980 msgstr "B<pselect>()  のこの引き数は I<utimeout> と同じ意味を持つが、 I<struct timespec> は次に示すようにナノ秒の精度を持つ。"
3981
3982 #. type: Plain text
3983 #: build/C/man2/select_tut.2:194
3984 #, no-wrap
3985 msgid ""
3986 "struct timespec {\n"
3987 "    long tv_sec;    /* seconds */\n"
3988 "    long tv_nsec;   /* nanoseconds */\n"
3989 "};\n"
3990 msgstr ""
3991 "struct timespec {\n"
3992 "    long tv_sec;    /* seconds */\n"
3993 "    long tv_nsec;   /* nanoseconds */\n"
3994 "};\n"
3995
3996 #. type: TP
3997 #: build/C/man2/select_tut.2:196
3998 #, no-wrap
3999 msgid "I<sigmask>"
4000 msgstr "I<sigmask>"
4001
4002 #. type: Plain text
4003 #: build/C/man2/select_tut.2:213
4004 msgid "This argument holds a set of signals that the kernel should unblock (i.e., remove from the signal mask of the calling thread), while the caller is blocked inside the B<pselect>()  call (see B<sigaddset>(3)  and B<sigprocmask>(2)).  It may be NULL, in which case the call does not modify the signal mask on entry and exit to the function.  In this case, B<pselect>()  will then behave just like B<select>()."
4005 msgstr "この引き数は、呼び出し側が B<pselect>()  内部で停止している間に、カーネルが通知を許可すべきシグナル集合 (すなわち、呼び出したスレッドのシグナルマスクから削除すべきシグナル集合)  を保持する (B<sigaddset>(3)  と B<sigprocmask>(2)  を参照)。 この引き数は NULL にすることもでき、その場合はこの関数へ 入るとき・出るときにシグナルマスクを変更しない。 この場合、 B<pselect>()  は B<select>()  と全く同じ動作となる。"
4006
4007 #. type: SS
4008 #: build/C/man2/select_tut.2:213
4009 #, no-wrap
4010 msgid "Combining signal and data events"
4011 msgstr "シグナルとデータイベントを組み合わせる"
4012
4013 #. type: Plain text
4014 #: build/C/man2/select_tut.2:257
4015 msgid "B<pselect>()  is useful if you are waiting for a signal as well as for file descriptor(s) to become ready for I/O.  Programs that receive signals normally use the signal handler only to raise a global flag.  The global flag will indicate that the event must be processed in the main loop of the program.  A signal will cause the B<select>()  (or B<pselect>())  call to return with I<errno> set to B<EINTR>.  This behavior is essential so that signals can be processed in the main loop of the program, otherwise B<select>()  would block indefinitely.  Now, somewhere in the main loop will be a conditional to check the global flag.  So we must ask: what if a signal arrives after the conditional, but before the B<select>()  call? The answer is that B<select>()  would block indefinitely, even though an event is actually pending.  This race condition is solved by the B<pselect>()  call.  This call can be used to set the signal mask to a set of signals that are only to be received within the B<pselect>()  call.  For instance, let us say that the event in question was the exit of a child process.  Before the start of the main loop, we would block B<SIGCHLD> using B<sigprocmask>(2).  Our B<pselect>()  call would enable B<SIGCHLD> by using an empty signal mask.  Our program would look like:"
4016 msgstr "ファイルディスクリプターが I/O 可能な状態になるのと同時に シグナルも待ちたい場合には、 B<pselect>()  が便利である。 シグナルを受信するプログラムは、通常は、 シグナルハンドラーをグローバルなフラグを立てるためだけに使う。 このグローバルなフラグは、 そのイベントをプログラムのメインループで 処理しなければならないことを示す。 シグナルを受けると B<select>()  (や B<pselect>())  は I<errno> に B<EINTR> をセットして戻ることになる。 シグナルがプログラムのメインループで処理されるためにはこの動作が不可欠で、 これがないと B<select>()  は永遠に停止し続けることになる。 さて、メインループのどこかにこのグローバルフラグをチェックする 条件文があるとしよう。ここで少し考えてみないといけない。 「シグナルが条件文の後、しかし B<select>()  コールの前に到着したら どうなるのか?」 答えは「その B<select>()  は、たとえ解決待ちのイベントがあったとしても、 永遠に停止する」である。 この競合状態は B<pselect>()  コールによって解決できる。 このコールを使うと、 B<pselect>()  で受信したいシグナルの集合だけをシグナルマスクに設定することができる。 例えば、問題となっているイベントが子プロセスの終了の場合を考えよう。 メインループが始まる前に、 B<SIGCHLD> を B<sigprocmask>(2)  でブロックする。 B<pselect>()  コールでは B<SIGCHLD> を、もともとのシグナルマスクを使って有効にするのだ。 このプログラムは次のようになる。"
4017
4018 #. type: Plain text
4019 #: build/C/man2/select_tut.2:260
4020 #, no-wrap
4021 msgid "static volatile sig_atomic_t got_SIGCHLD = 0;\n"
4022 msgstr "static volatile sig_atomic_t got_SIGCHLD = 0;\n"
4023
4024 #. type: Plain text
4025 #: build/C/man2/select_tut.2:266
4026 #, no-wrap
4027 msgid ""
4028 "static void\n"
4029 "child_sig_handler(int sig)\n"
4030 "{\n"
4031 "    got_SIGCHLD = 1;\n"
4032 "}\n"
4033 msgstr ""
4034 "static void\n"
4035 "child_sig_handler(int sig)\n"
4036 "{\n"
4037 "    got_SIGCHLD = 1;\n"
4038 "}\n"
4039
4040 #. type: Plain text
4041 #: build/C/man2/select_tut.2:274
4042 #, no-wrap
4043 msgid ""
4044 "int\n"
4045 "main(int argc, char *argv[])\n"
4046 "{\n"
4047 "    sigset_t sigmask, empty_mask;\n"
4048 "    struct sigaction sa;\n"
4049 "    fd_set readfds, writefds, exceptfds;\n"
4050 "    int r;\n"
4051 msgstr ""
4052 "int\n"
4053 "main(int argc, char *argv[])\n"
4054 "{\n"
4055 "    sigset_t sigmask, empty_mask;\n"
4056 "    struct sigaction sa;\n"
4057 "    fd_set readfds, writefds, exceptfds;\n"
4058 "    int r;\n"
4059
4060 #. type: Plain text
4061 #: build/C/man2/select_tut.2:281
4062 #, no-wrap
4063 msgid ""
4064 "    sigemptyset(&sigmask);\n"
4065 "    sigaddset(&sigmask, SIGCHLD);\n"
4066 "    if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n"
4067 "        perror(\"sigprocmask\");\n"
4068 "        exit(EXIT_FAILURE);\n"
4069 "    }\n"
4070 msgstr ""
4071 "    sigemptyset(&sigmask);\n"
4072 "    sigaddset(&sigmask, SIGCHLD);\n"
4073 "    if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n"
4074 "        perror(\"sigprocmask\");\n"
4075 "        exit(EXIT_FAILURE);\n"
4076 "    }\n"
4077
4078 #. type: Plain text
4079 #: build/C/man2/select_tut.2:289
4080 #, no-wrap
4081 msgid ""
4082 "    sa.sa_flags = 0;\n"
4083 "    sa.sa_handler = child_sig_handler;\n"
4084 "    sigemptyset(&sa.sa_mask);\n"
4085 "    if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n"
4086 "        perror(\"sigaction\");\n"
4087 "        exit(EXIT_FAILURE);\n"
4088 "    }\n"
4089 msgstr ""
4090 "    sa.sa_flags = 0;\n"
4091 "    sa.sa_handler = child_sig_handler;\n"
4092 "    sigemptyset(&sa.sa_mask);\n"
4093 "    if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n"
4094 "        perror(\"sigaction\");\n"
4095 "        exit(EXIT_FAILURE);\n"
4096 "    }\n"
4097
4098 #. type: Plain text
4099 #: build/C/man2/select_tut.2:291
4100 #, no-wrap
4101 msgid "    sigemptyset(&empty_mask);\n"
4102 msgstr "    sigemptyset(&empty_mask);\n"
4103
4104 #. type: Plain text
4105 #: build/C/man2/select_tut.2:295
4106 #, no-wrap
4107 msgid ""
4108 "    for (;;) {          /* main loop */\n"
4109 "        /* Initialize readfds, writefds, and exceptfds\n"
4110 "           before the pselect() call. (Code omitted.) */\n"
4111 msgstr ""
4112 "    for (;;) {          /* main loop */\n"
4113 "        /* Initialize readfds, writefds, and exceptfds\n"
4114 "           before the pselect() call. (Code omitted.) */\n"
4115
4116 #. type: Plain text
4117 #: build/C/man2/select_tut.2:301
4118 #, no-wrap
4119 msgid ""
4120 "        r = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
4121 "                    NULL, &empty_mask);\n"
4122 "        if (r == -1 && errno != EINTR) {\n"
4123 "            /* Handle error */\n"
4124 "        }\n"
4125 msgstr ""
4126 "        r = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
4127 "                    NULL, &empty_mask);\n"
4128 "        if (r == -1 && errno != EINTR) {\n"
4129 "            /* Handle error */\n"
4130 "        }\n"
4131
4132 #. type: Plain text
4133 #: build/C/man2/select_tut.2:304
4134 #, no-wrap
4135 msgid ""
4136 "        if (got_SIGCHLD) {\n"
4137 "            got_SIGCHLD = 0;\n"
4138 msgstr ""
4139 "        if (got_SIGCHLD) {\n"
4140 "            got_SIGCHLD = 0;\n"
4141
4142 #. type: Plain text
4143 #: build/C/man2/select_tut.2:308
4144 #, no-wrap
4145 msgid ""
4146 "            /* Handle signalled event here; e.g., wait() for all\n"
4147 "               terminated children. (Code omitted.) */\n"
4148 "        }\n"
4149 msgstr ""
4150 "            /* Handle signalled event here; e.g., wait() for all\n"
4151 "               terminated children. (Code omitted.) */\n"
4152 "        }\n"
4153
4154 #. type: Plain text
4155 #: build/C/man2/select_tut.2:312
4156 #, no-wrap
4157 msgid ""
4158 "        /* main body of program */\n"
4159 "    }\n"
4160 "}\n"
4161 msgstr ""
4162 "        /* main body of program */\n"
4163 "    }\n"
4164 "}\n"
4165
4166 #. type: SS
4167 #: build/C/man2/select_tut.2:313
4168 #, no-wrap
4169 msgid "Practical"
4170 msgstr "実例"
4171
4172 #. type: Plain text
4173 #: build/C/man2/select_tut.2:334
4174 msgid "So what is the point of B<select>()? Can't I just read and write to my descriptors whenever I want? The point of B<select>()  is that it watches multiple descriptors at the same time and properly puts the process to sleep if there is no activity.  UNIX programmers often find themselves in a position where they have to handle I/O from more than one file descriptor where the data flow may be intermittent.  If you were to merely create a sequence of B<read>(2)  and B<write>(2)  calls, you would find that one of your calls may block waiting for data from/to a file descriptor, while another file descriptor is unused though ready for I/O.  B<select>()  efficiently copes with this situation."
4175 msgstr "実際のところ B<select>()  の大事な点は何なのか? ディスクリプターは好きなときに読み書きできるんじゃないの? B<select>()  の重要なところは、複数のディスクリプターを同時に監視でき、 なんの動きもなければプロセスを適切にスリープ状態に移行するところにあるのだ。 UNIX プログラマは、 複数のファイルディスクリプターの入出力を同時に扱わねばならず、 しかもデータの流れは間欠的である、という状況によく出会う。 単に B<read>(2)  や B<write>(2)  コールのシーケンスを作るだけでは、それらのコールのどれかが ファイルディスクリプターからのデータを待ってブロックしており、 別のファイルディスクリプターには I/O が可能なのに使えない、 ということになってしまうだろう。 B<select>()  を使うとこの状況に効果的に対処できる。"
4176
4177 #. type: SS
4178 #: build/C/man2/select_tut.2:334
4179 #, no-wrap
4180 msgid "Select law"
4181 msgstr "SELECT の掟"
4182
4183 #. type: Plain text
4184 #: build/C/man2/select_tut.2:347
4185 msgid "Many people who try to use B<select>()  come across behavior that is difficult to understand and produces nonportable or borderline results.  For instance, the above program is carefully written not to block at any point, even though it does not set its file descriptors to nonblocking mode.  It is easy to introduce subtle errors that will remove the advantage of using B<select>(), so here is a list of essentials to watch for when using B<select>()."
4186 msgstr "B<select>()  を使おうとした多くの人は、理解しにくい挙動に出くわし、結果的に できたものは移植性がないか、よくてもギリギリのものになってしまう。 例えば、上記のプログラムは、 集合に含まれるファイルディスクリプターを非停止 (nonblocking) モード にしなくても、どこにもブロックが生じないよう注意して書かれている。 微妙な間違いによって、 B<select>()  を使う利点は簡単に失われてしまう。 そこで、 B<select>()  コールを使うときに注意すべき重要事項を列挙しておくことにする。"
4187
4188 #. type: Plain text
4189 #: build/C/man2/select_tut.2:356
4190 msgid "You should always try to use B<select>()  without a timeout.  Your program should have nothing to do if there is no data available.  Code that depends on timeouts is not usually portable and is difficult to debug."
4191 msgstr "B<select>()  を使うときは、タイムアウトは設定すべきでない。 処理するデータが無いときには、 あなたのプログラムには何もすることは無いはずである。 タイムアウトに依存したコードは通常移植性がなく、 デバッグも難しくなる。"
4192
4193 #. type: Plain text
4194 #: build/C/man2/select_tut.2:360
4195 msgid "The value I<nfds> must be properly calculated for efficiency as explained above."
4196 msgstr "上述したように、 効率的なプログラムを書くには I<nfds> の値を適切に計算して与えなければならない。"
4197
4198 #. type: Plain text
4199 #: build/C/man2/select_tut.2:367
4200 msgid "No file descriptor must be added to any set if you do not intend to check its result after the B<select>()  call, and respond appropriately.  See next rule."
4201 msgstr "B<select>()  コールの終了後に結果をチェックして、 適切に対応するつもりのないファイルディスクリプターは、 どの集合にも加えてはならない。 次のルールも参照。"
4202
4203 #. type: Plain text
4204 #: build/C/man2/select_tut.2:373
4205 msgid "After B<select>()  returns, all file descriptors in all sets should be checked to see if they are ready."
4206 msgstr "B<select>()  から返った後には、全ての集合の全てのファイルディスクリプターについて 読み書き可能な状態になっているかをチェックすべきである。"
4207
4208 #. type: TP
4209 #: build/C/man2/select_tut.2:373
4210 #, no-wrap
4211 msgid "5."
4212 msgstr "5."
4213
4214 #. type: Plain text
4215 #: build/C/man2/select_tut.2:388
4216 msgid "The functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  do I<not> necessarily read/write the full amount of data that you have requested.  If they do read/write the full amount, it's because you have a low traffic load and a fast stream.  This is not always going to be the case.  You should cope with the case of your functions managing to send or receive only a single byte."
4217 msgstr "B<read>(2), B<recv>(2), B<write>(2), B<send>(2)  といった関数は、こちらが要求した全データを読み書きする必要はI<ない>。 もし全データを読み書きするなら、それはトラフィックの負荷が小さく、 ストリームが速い場合だろう。この条件は常に満たされるとは限らない。 これらの関数が頑張っても 1 バイトしか送受信できないような場合も 考慮に入れてやらなければならない。"
4218
4219 #. type: TP
4220 #: build/C/man2/select_tut.2:388
4221 #, no-wrap
4222 msgid "6."
4223 msgstr "6."
4224
4225 #. type: Plain text
4226 #: build/C/man2/select_tut.2:396
4227 msgid "Never read/write only in single bytes at a time unless you are really sure that you have a small amount of data to process.  It is extremely inefficient not to read/write as much data as you can buffer each time.  The buffers in the example below are 1024 bytes although they could easily be made larger."
4228 msgstr "処理するデータ量が小さいことがはっきりとわかっている場合を除いて、 一度に 1 バイトずつ読み書きするようなことはしてはならない。 バッファーの許すかぎりのデータをまとめて読み書きしないと、 非常に効率が悪い。下記の例ではバッファーは 1024 バイトにしているが、 このサイズを大きくするのは簡単だろう。"
4229
4230 #. type: TP
4231 #: build/C/man2/select_tut.2:396
4232 #, no-wrap
4233 msgid "7."
4234 msgstr "7."
4235
4236 #.  Nonetheless, you should still cope with these errors for completeness.
4237 #. type: Plain text
4238 #: build/C/man2/select_tut.2:418
4239 msgid "The functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  as well as the B<select>()  call can return -1 with I<errno> set to B<EINTR>, or with I<errno> set to B<EAGAIN> (B<EWOULDBLOCK>).  These results must be properly managed (not done properly above).  If your program is not going to receive any signals, then it is unlikely you will get B<EINTR>.  If your program does not set nonblocking I/O, you will not get B<EAGAIN>."
4240 msgstr "B<read>(2), B<recv>(2), B<write>(2), B<send>(2)  などの関数や B<select>()  コールは、 I<errno> を B<EINTR や EAGAIN> (B<EWOULDBLOCK>)  にして -1 を返すことがある。 このような結果に対して適切に対応してやらなければならない (上記の例ではしていない)。 書いているプログラムがシグナルを受ける予定がなければ、 B<EINTR> が返されることはあまり考えられない。 書いているプログラムで非ブロック I/O をセットしていない場合は、 B<EAGAIN> が返されることはないだろう。"
4241
4242 #. type: TP
4243 #: build/C/man2/select_tut.2:418
4244 #, no-wrap
4245 msgid "8."
4246 msgstr "8."
4247
4248 #. type: Plain text
4249 #: build/C/man2/select_tut.2:427
4250 msgid "Never call B<read>(2), B<recv>(2), B<write>(2), or B<send>(2)  with a buffer length of zero."
4251 msgstr "決して、引き数に長さ 0 のバッファーを指定して B<read>(2), B<recv>(2), B<write>(2), B<send>(2)  を呼び出してはならない。"
4252
4253 #. type: TP
4254 #: build/C/man2/select_tut.2:427
4255 #, no-wrap
4256 msgid "9."
4257 msgstr "9."
4258
4259 #. type: Plain text
4260 #: build/C/man2/select_tut.2:443
4261 msgid "If the functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  fail with errors other than those listed in B<7.>, or one of the input functions returns 0, indicating end of file, then you should I<not> pass that descriptor to B<select>()  again.  In the example below, I close the descriptor immediately, and then set it to -1 to prevent it being included in a set."
4262 msgstr "B<read>(2), B<recv>(2), B<write>(2), B<send>(2)  が B<7.> に示した以外のエラーで失敗した場合や、 入力系の関数の一つがファイル末尾を表す 0 を返した場合は、 そのディスクリプターをもう一度 select に渡してはI<ならない>。 下記の例では、そのディスクリプターをただちにクローズし、 そこには -1 をセットして、 それが集合に含まれ続けるのを許さないようにしている。"
4263
4264 #. type: TP
4265 #: build/C/man2/select_tut.2:443
4266 #, no-wrap
4267 msgid "10."
4268 msgstr "10."
4269
4270 #. type: Plain text
4271 #: build/C/man2/select_tut.2:450
4272 msgid "The timeout value must be initialized with each new call to B<select>(), since some operating systems modify the structure.  B<pselect>()  however does not modify its timeout structure."
4273 msgstr "タイムアウトの値は B<select>()  を呼ぶたびに初期化すべきである。 OS によっては timeout 構造体が変更される場合があるからである。 但し、 B<pselect>()  は自分の timeout 構造体を変更することはない。"
4274
4275 #. type: TP
4276 #: build/C/man2/select_tut.2:450
4277 #, no-wrap
4278 msgid "11."
4279 msgstr "11."
4280
4281 #.  "I have heard" does not fill me with confidence, and doesn't
4282 #.  belong in a man page, so I've commented this point out.
4283 #.  .TP
4284 #.  11.
4285 #.  I have heard that the Windows socket layer does not cope with OOB data
4286 #.  properly.
4287 #.  It also does not cope with
4288 #.  .BR select ()
4289 #.  calls when no file descriptors are set at all.
4290 #.  Having no file descriptors set is a useful
4291 #.  way to sleep the process with subsecond precision by using the timeout.
4292 #.  (See further on.)
4293 #. type: Plain text
4294 #: build/C/man2/select_tut.2:469
4295 msgid "Since B<select>()  modifies its file descriptor sets, if the call is being used in a loop, then the sets must be reinitialized before each call."
4296 msgstr "B<select>()  はファイルディスクリプター集合を変更するので、 B<select>()  がループの中で使用されている場合には、呼び出しを行う前に毎回 ディスクリプター集合を初期化し直さなければならない。"
4297
4298 #. type: SS
4299 #: build/C/man2/select_tut.2:469
4300 #, no-wrap
4301 msgid "Usleep emulation"
4302 msgstr "usleep エミュレーション"
4303
4304 #. type: Plain text
4305 #: build/C/man2/select_tut.2:476
4306 msgid "On systems that do not have a B<usleep>(3)  function, you can call B<select>()  with a finite timeout and no file descriptors as follows:"
4307 msgstr "B<usleep>(3)  関数を持たないシステムでは、 有限のタイムアウトを指定し、ファイルディスクリプターを全くセットせずに B<select>()  を呼び出すことで、これを代用できる。 以下のようにする。"
4308
4309 #. type: Plain text
4310 #: build/C/man2/select_tut.2:482
4311 #, no-wrap
4312 msgid ""
4313 "    struct timeval tv;\n"
4314 "    tv.tv_sec = 0;\n"
4315 "    tv.tv_usec = 200000;  /* 0.2 seconds */\n"
4316 "    select(0, NULL, NULL, NULL, &tv);\n"
4317 msgstr ""
4318 "    struct timeval tv;\n"
4319 "    tv.tv_sec = 0;\n"
4320 "    tv.tv_usec = 200000;  /* 0.2 seconds */\n"
4321 "    select(0, NULL, NULL, NULL, &tv);\n"
4322
4323 #. type: Plain text
4324 #: build/C/man2/select_tut.2:485
4325 msgid "This is guaranteed to work only on UNIX systems, however."
4326 msgstr "但し、これが動くと保証されているのは UNIX システムに限られる。"
4327
4328 #. type: Plain text
4329 #: build/C/man2/select_tut.2:490
4330 msgid "On success, B<select>()  returns the total number of file descriptors still present in the file descriptor sets."
4331 msgstr "成功すると、 B<select>()  はファイルディスクリプター集合に残っている ファイルディスクリプターの総数を返す。"
4332
4333 #. type: Plain text
4334 #: build/C/man2/select_tut.2:496
4335 msgid "If B<select>()  timed out, then the return value will be zero.  The file descriptors set should be all empty (but may not be on some systems)."
4336 msgstr "B<select>()  がタイムアウトすると、返り値は 0 になる。 その時、ファイルディスクリプター集合はすべて空である (しかしそうならないシステムもある)。"
4337
4338 #. type: Plain text
4339 #: build/C/man2/select_tut.2:503
4340 msgid "A return value of -1 indicates an error, with I<errno> being set appropriately.  In the case of an error, the contents of the returned sets and the I<struct timeout> contents are undefined and should not be used.  B<pselect>()  however never modifies I<ntimeout>."
4341 msgstr "返り値が -1 の場合はエラーを意味し、 I<errno> が適切にセットされる。エラーが起こった場合、 返された集合の内容や構造体 I<struct timeout> の内容は 未定義となっており、使用すべきではない。 しかし B<pselect>()  は決して I<ntimeout> を変更しない。"
4342
4343 #. type: Plain text
4344 #: build/C/man2/select_tut.2:512
4345 msgid "Generally speaking, all operating systems that support sockets also support B<select>().  B<select>()  can be used to solve many problems in a portable and efficient way that naive programmers try to solve in a more complicated manner using threads, forking, IPCs, signals, memory sharing, and so on."
4346 msgstr "一般的に言って、ソケットをサポートする全てのオペレーティングシステムは B<select>()  もサポートしている。 B<select>()  を使うと、プログラマがスレッド、フォーク、IPC、シグナル、メモリー共有、 等々を使ってもっと複雑な方法で解決しようとする多くの問題が、 移植性がありかつ効率的な方法で解決できる。"
4347
4348 #. type: Plain text
4349 #: build/C/man2/select_tut.2:521
4350 msgid "The B<poll>(2)  system call has the same functionality as B<select>(), and is somewhat more efficient when monitoring sparse file descriptor sets.  It is nowadays widely available, but historically was less portable than B<select>()."
4351 msgstr "B<poll>(2)  システムコールは B<select>()  と同じ機能を持っており、 まばらなファイルディスクリプター集合を監視する場合に いくらか効率がよい。 現在では広く利用可能であるが、以前は B<select>()  より移植性の面で劣っていた。"
4352
4353 #. type: Plain text
4354 #: build/C/man2/select_tut.2:529
4355 msgid "The Linux-specific B<epoll>(7)  API provides an interface that is more efficient than B<select>(2)  and B<poll>(2)  when monitoring large numbers of file descriptors."
4356 msgstr "Linux 独自の B<epoll>(7)  API は、多数のファイルディスクリプターを監視する場合に B<select>(2)  や B<poll>(2)  よりも効率的なインターフェースを提供している。"
4357
4358 #. type: Plain text
4359 #: build/C/man2/select_tut.2:534
4360 msgid "Here is an example that better demonstrates the true utility of B<select>().  The listing below is a TCP forwarding program that forwards from one TCP port to another."
4361 msgstr "B<select>()  の本当に便利な点を示す、よい例を紹介する。 以下のリストは、ある TCP ポートから別のポートへ転送を行う TCP フォワードプログラムである。"
4362
4363 #. type: Plain text
4364 #: build/C/man2/select_tut.2:547
4365 #, no-wrap
4366 msgid ""
4367 "#include E<lt>stdlib.hE<gt>\n"
4368 "#include E<lt>stdio.hE<gt>\n"
4369 "#include E<lt>unistd.hE<gt>\n"
4370 "#include E<lt>sys/time.hE<gt>\n"
4371 "#include E<lt>sys/types.hE<gt>\n"
4372 "#include E<lt>string.hE<gt>\n"
4373 "#include E<lt>signal.hE<gt>\n"
4374 "#include E<lt>sys/socket.hE<gt>\n"
4375 "#include E<lt>netinet/in.hE<gt>\n"
4376 "#include E<lt>arpa/inet.hE<gt>\n"
4377 "#include E<lt>errno.hE<gt>\n"
4378 msgstr ""
4379 "#include E<lt>stdlib.hE<gt>\n"
4380 "#include E<lt>stdio.hE<gt>\n"
4381 "#include E<lt>unistd.hE<gt>\n"
4382 "#include E<lt>sys/time.hE<gt>\n"
4383 "#include E<lt>sys/types.hE<gt>\n"
4384 "#include E<lt>string.hE<gt>\n"
4385 "#include E<lt>signal.hE<gt>\n"
4386 "#include E<lt>sys/socket.hE<gt>\n"
4387 "#include E<lt>netinet/in.hE<gt>\n"
4388 "#include E<lt>arpa/inet.hE<gt>\n"
4389 "#include E<lt>errno.hE<gt>\n"
4390
4391 #. type: Plain text
4392 #: build/C/man2/select_tut.2:549
4393 #, no-wrap
4394 msgid "static int forward_port;\n"
4395 msgstr "static int forward_port;\n"
4396
4397 #. type: Plain text
4398 #: build/C/man2/select_tut.2:552
4399 #, no-wrap
4400 msgid ""
4401 "#undef max\n"
4402 "#define max(x,y) ((x) E<gt> (y) ? (x) : (y))\n"
4403 msgstr ""
4404 "#undef max\n"
4405 "#define max(x,y) ((x) E<gt> (y) ? (x) : (y))\n"
4406
4407 #. type: Plain text
4408 #: build/C/man2/select_tut.2:559
4409 #, no-wrap
4410 msgid ""
4411 "static int\n"
4412 "listen_socket(int listen_port)\n"
4413 "{\n"
4414 "    struct sockaddr_in a;\n"
4415 "    int s;\n"
4416 "    int yes;\n"
4417 msgstr ""
4418 "static int\n"
4419 "listen_socket(int listen_port)\n"
4420 "{\n"
4421 "    struct sockaddr_in a;\n"
4422 "    int s;\n"
4423 "    int yes;\n"
4424
4425 #. type: Plain text
4426 #: build/C/man2/select_tut.2:584
4427 #, no-wrap
4428 msgid ""
4429 "    s = socket(AF_INET, SOCK_STREAM, 0);\n"
4430 "    if (s == -1) {\n"
4431 "        perror(\"socket\");\n"
4432 "        return -1;\n"
4433 "    }\n"
4434 "    yes = 1;\n"
4435 "    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,\n"
4436 "            &yes, sizeof(yes)) == -1) {\n"
4437 "        perror(\"setsockopt\");\n"
4438 "        close(s);\n"
4439 "        return -1;\n"
4440 "    }\n"
4441 "    memset(&a, 0, sizeof(a));\n"
4442 "    a.sin_port = htons(listen_port);\n"
4443 "    a.sin_family = AF_INET;\n"
4444 "    if (bind(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4445 "        perror(\"bind\");\n"
4446 "        close(s);\n"
4447 "        return -1;\n"
4448 "    }\n"
4449 "    printf(\"accepting connections on port %d\\en\", listen_port);\n"
4450 "    listen(s, 10);\n"
4451 "    return s;\n"
4452 "}\n"
4453 msgstr ""
4454 "    if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {\n"
4455 "        perror(\"socket\");\n"
4456 "        return -1;\n"
4457 "    }\n"
4458 "    yes = 1;\n"
4459 "    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,\n"
4460 "            &yes, sizeof(yes)) == -1) {\n"
4461 "        perror(\"setsockopt\");\n"
4462 "        close(s);\n"
4463 "        return -1;\n"
4464 "    }\n"
4465 "    memset(&a, 0, sizeof(a));\n"
4466 "    a.sin_port = htons(listen_port);\n"
4467 "    a.sin_family = AF_INET;\n"
4468 "    if (bind(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4469 "        perror(\"bind\");\n"
4470 "        close(s);\n"
4471 "        return -1;\n"
4472 "    }\n"
4473 "    printf(\"accepting connections on port %d\\en\", listen_port);\n"
4474 "    listen(s, 10);\n"
4475 "    return s;\n"
4476 "}\n"
4477
4478 #. type: Plain text
4479 #: build/C/man2/select_tut.2:590
4480 #, no-wrap
4481 msgid ""
4482 "static int\n"
4483 "connect_socket(int connect_port, char *address)\n"
4484 "{\n"
4485 "    struct sockaddr_in a;\n"
4486 "    int s;\n"
4487 msgstr ""
4488 "static int\n"
4489 "connect_socket(int connect_port, char *address)\n"
4490 "{\n"
4491 "    struct sockaddr_in a;\n"
4492 "    int s;\n"
4493
4494 #. type: Plain text
4495 #: build/C/man2/select_tut.2:597
4496 #, no-wrap
4497 msgid ""
4498 "    s = socket(AF_INET, SOCK_STREAM, 0);\n"
4499 "    if (s == -1) {\n"
4500 "        perror(\"socket\");\n"
4501 "        close(s);\n"
4502 "        return -1;\n"
4503 "    }\n"
4504 msgstr ""
4505 "    s = socket(AF_INET, SOCK_STREAM, 0);\n"
4506 "    if (s == -1) {\n"
4507 "        perror(\"socket\");\n"
4508 "        close(s);\n"
4509 "        return -1;\n"
4510 "    }\n"
4511
4512 #. type: Plain text
4513 #: build/C/man2/select_tut.2:601
4514 #, no-wrap
4515 msgid ""
4516 "    memset(&a, 0, sizeof(a));\n"
4517 "    a.sin_port = htons(connect_port);\n"
4518 "    a.sin_family = AF_INET;\n"
4519 msgstr ""
4520 "    memset(&a, 0, sizeof(a));\n"
4521 "    a.sin_port = htons(connect_port);\n"
4522 "    a.sin_family = AF_INET;\n"
4523
4524 #. type: Plain text
4525 #: build/C/man2/select_tut.2:607
4526 #, no-wrap
4527 msgid ""
4528 "    if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {\n"
4529 "        perror(\"bad IP address format\");\n"
4530 "        close(s);\n"
4531 "        return -1;\n"
4532 "    }\n"
4533 msgstr ""
4534 "    if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {\n"
4535 "        perror(\"bad IP address format\");\n"
4536 "        close(s);\n"
4537 "        return -1;\n"
4538 "    }\n"
4539
4540 #. type: Plain text
4541 #: build/C/man2/select_tut.2:616
4542 #, no-wrap
4543 msgid ""
4544 "    if (connect(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4545 "        perror(\"connect()\");\n"
4546 "        shutdown(s, SHUT_RDWR);\n"
4547 "        close(s);\n"
4548 "        return -1;\n"
4549 "    }\n"
4550 "    return s;\n"
4551 "}\n"
4552 msgstr ""
4553 "    if (connect(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4554 "        perror(\"connect()\");\n"
4555 "        shutdown(s, SHUT_RDWR);\n"
4556 "        close(s);\n"
4557 "        return -1;\n"
4558 "    }\n"
4559 "    return s;\n"
4560 "}\n"
4561
4562 #. type: Plain text
4563 #: build/C/man2/select_tut.2:624
4564 #, no-wrap
4565 msgid ""
4566 "#define SHUT_FD1 do {                                \\e\n"
4567 "                     if (fd1 E<gt>= 0) {                 \\e\n"
4568 "                         shutdown(fd1, SHUT_RDWR);   \\e\n"
4569 "                         close(fd1);                 \\e\n"
4570 "                         fd1 = -1;                   \\e\n"
4571 "                     }                               \\e\n"
4572 "                 } while (0)\n"
4573 msgstr ""
4574 "#define SHUT_FD1 do {                                \\e\n"
4575 "                     if (fd1 E<gt>= 0) {                 \\e\n"
4576 "                         shutdown(fd1, SHUT_RDWR);   \\e\n"
4577 "                         close(fd1);                 \\e\n"
4578 "                         fd1 = -1;                   \\e\n"
4579 "                     }                               \\e\n"
4580 "                 } while (0)\n"
4581
4582 #. type: Plain text
4583 #: build/C/man2/select_tut.2:632
4584 #, no-wrap
4585 msgid ""
4586 "#define SHUT_FD2 do {                                \\e\n"
4587 "                     if (fd2 E<gt>= 0) {                 \\e\n"
4588 "                         shutdown(fd2, SHUT_RDWR);   \\e\n"
4589 "                         close(fd2);                 \\e\n"
4590 "                         fd2 = -1;                   \\e\n"
4591 "                     }                               \\e\n"
4592 "                 } while (0)\n"
4593 msgstr ""
4594 "#define SHUT_FD2 do {                                \\e\n"
4595 "                     if (fd2 E<gt>= 0) {                 \\e\n"
4596 "                         shutdown(fd2, SHUT_RDWR);   \\e\n"
4597 "                         close(fd2);                 \\e\n"
4598 "                         fd2 = -1;                   \\e\n"
4599 "                     }                               \\e\n"
4600 "                 } while (0)\n"
4601
4602 #. type: Plain text
4603 #: build/C/man2/select_tut.2:634
4604 #, no-wrap
4605 msgid "#define BUF_SIZE 1024\n"
4606 msgstr "#define BUF_SIZE 1024\n"
4607
4608 #. type: Plain text
4609 #: build/C/man2/select_tut.2:643
4610 #, no-wrap
4611 msgid ""
4612 "int\n"
4613 "main(int argc, char *argv[])\n"
4614 "{\n"
4615 "    int h;\n"
4616 "    int fd1 = -1, fd2 = -1;\n"
4617 "    char buf1[BUF_SIZE], buf2[BUF_SIZE];\n"
4618 "    int buf1_avail, buf1_written;\n"
4619 "    int buf2_avail, buf2_written;\n"
4620 msgstr ""
4621 "int\n"
4622 "main(int argc, char *argv[])\n"
4623 "{\n"
4624 "    int h;\n"
4625 "    int fd1 = -1, fd2 = -1;\n"
4626 "    char buf1[BUF_SIZE], buf2[BUF_SIZE];\n"
4627 "    int buf1_avail, buf1_written;\n"
4628 "    int buf2_avail, buf2_written;\n"
4629
4630 #. type: Plain text
4631 #: build/C/man2/select_tut.2:649
4632 #, no-wrap
4633 msgid ""
4634 "    if (argc != 4) {\n"
4635 "        fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n"
4636 "                 \"E<lt>forward-to-portE<gt> E<lt>forward-to-ip-addressE<gt>\\en\");\n"
4637 "        exit(EXIT_FAILURE);\n"
4638 "    }\n"
4639 msgstr ""
4640 "    if (argc != 4) {\n"
4641 "        fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n"
4642 "                 \"E<lt>forward-to-portE<gt> E<lt>forward-to-ip-addressE<gt>\\en\");\n"
4643 "        exit(EXIT_FAILURE);\n"
4644 "    }\n"
4645
4646 #. type: Plain text
4647 #: build/C/man2/select_tut.2:651
4648 #, no-wrap
4649 msgid "    signal(SIGPIPE, SIG_IGN);\n"
4650 msgstr "    signal(SIGPIPE, SIG_IGN);\n"
4651
4652 #. type: Plain text
4653 #: build/C/man2/select_tut.2:653
4654 #, no-wrap
4655 msgid "    forward_port = atoi(argv[2]);\n"
4656 msgstr "    forward_port = atoi(argv[2]);\n"
4657
4658 #. type: Plain text
4659 #: build/C/man2/select_tut.2:657
4660 #, no-wrap
4661 msgid ""
4662 "    h = listen_socket(atoi(argv[1]));\n"
4663 "    if (h == -1)\n"
4664 "        exit(EXIT_FAILURE);\n"
4665 msgstr ""
4666 "    h = listen_socket(atoi(argv[1]));\n"
4667 "    if (h == -1)\n"
4668 "        exit(EXIT_FAILURE);\n"
4669
4670 #. type: Plain text
4671 #: build/C/man2/select_tut.2:661
4672 #, no-wrap
4673 msgid ""
4674 "    for (;;) {\n"
4675 "        int r, nfds = 0;\n"
4676 "        fd_set rd, wr, er;\n"
4677 msgstr ""
4678 "    for (;;) {\n"
4679 "        int r, nfds = 0;\n"
4680 "        fd_set rd, wr, er;\n"
4681
4682 #. type: Plain text
4683 #: build/C/man2/select_tut.2:691
4684 #, no-wrap
4685 msgid ""
4686 "        FD_ZERO(&rd);\n"
4687 "        FD_ZERO(&wr);\n"
4688 "        FD_ZERO(&er);\n"
4689 "        FD_SET(h, &rd);\n"
4690 "        nfds = max(nfds, h);\n"
4691 "        if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE) {\n"
4692 "            FD_SET(fd1, &rd);\n"
4693 "            nfds = max(nfds, fd1);\n"
4694 "        }\n"
4695 "        if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE) {\n"
4696 "            FD_SET(fd2, &rd);\n"
4697 "            nfds = max(nfds, fd2);\n"
4698 "        }\n"
4699 "        if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0) {\n"
4700 "            FD_SET(fd1, &wr);\n"
4701 "            nfds = max(nfds, fd1);\n"
4702 "        }\n"
4703 "        if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0) {\n"
4704 "            FD_SET(fd2, &wr);\n"
4705 "            nfds = max(nfds, fd2);\n"
4706 "        }\n"
4707 "        if (fd1 E<gt> 0) {\n"
4708 "            FD_SET(fd1, &er);\n"
4709 "            nfds = max(nfds, fd1);\n"
4710 "        }\n"
4711 "        if (fd2 E<gt> 0) {\n"
4712 "            FD_SET(fd2, &er);\n"
4713 "            nfds = max(nfds, fd2);\n"
4714 "        }\n"
4715 msgstr ""
4716 "        FD_ZERO(&rd);\n"
4717 "        FD_ZERO(&wr);\n"
4718 "        FD_ZERO(&er);\n"
4719 "        FD_SET(h, &rd);\n"
4720 "        nfds = max(nfds, h);\n"
4721 "        if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE) {\n"
4722 "            FD_SET(fd1, &rd);\n"
4723 "            nfds = max(nfds, fd1);\n"
4724 "        }\n"
4725 "        if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE) {\n"
4726 "            FD_SET(fd2, &rd);\n"
4727 "            nfds = max(nfds, fd2);\n"
4728 "        }\n"
4729 "        if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0) {\n"
4730 "            FD_SET(fd1, &wr);\n"
4731 "            nfds = max(nfds, fd1);\n"
4732 "        }\n"
4733 "        if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0) {\n"
4734 "            FD_SET(fd2, &wr);\n"
4735 "            nfds = max(nfds, fd2);\n"
4736 "        }\n"
4737 "        if (fd1 E<gt> 0) {\n"
4738 "            FD_SET(fd1, &er);\n"
4739 "            nfds = max(nfds, fd1);\n"
4740 "        }\n"
4741 "        if (fd2 E<gt> 0) {\n"
4742 "            FD_SET(fd2, &er);\n"
4743 "            nfds = max(nfds, fd2);\n"
4744 "        }\n"
4745
4746 #. type: Plain text
4747 #: build/C/man2/select_tut.2:693
4748 #, no-wrap
4749 msgid "        r = select(nfds + 1, &rd, &wr, &er, NULL);\n"
4750 msgstr "        r = select(nfds + 1, &rd, &wr, &er, NULL);\n"
4751
4752 #. type: Plain text
4753 #: build/C/man2/select_tut.2:696
4754 #, no-wrap
4755 msgid ""
4756 "        if (r == -1 && errno == EINTR)\n"
4757 "            continue;\n"
4758 msgstr ""
4759 "        if (r == -1 && errno == EINTR)\n"
4760 "            continue;\n"
4761
4762 #. type: Plain text
4763 #: build/C/man2/select_tut.2:701
4764 #, no-wrap
4765 msgid ""
4766 "        if (r == -1) {\n"
4767 "            perror(\"select()\");\n"
4768 "            exit(EXIT_FAILURE);\n"
4769 "        }\n"
4770 msgstr ""
4771 "        if (r == -1) {\n"
4772 "            perror(\"select()\");\n"
4773 "            exit(EXIT_FAILURE);\n"
4774 "        }\n"
4775
4776 #. type: Plain text
4777 #: build/C/man2/select_tut.2:705
4778 #, no-wrap
4779 msgid ""
4780 "        if (FD_ISSET(h, &rd)) {\n"
4781 "            unsigned int l;\n"
4782 "            struct sockaddr_in client_address;\n"
4783 msgstr ""
4784 "        if (FD_ISSET(h, &rd)) {\n"
4785 "            unsigned int l;\n"
4786 "            struct sockaddr_in client_address;\n"
4787
4788 #. type: Plain text
4789 #: build/C/man2/select_tut.2:724
4790 #, no-wrap
4791 msgid ""
4792 "            memset(&client_address, 0, l = sizeof(client_address));\n"
4793 "            r = accept(h, (struct sockaddr *) &client_address, &l);\n"
4794 "            if (r == -1) {\n"
4795 "                perror(\"accept()\");\n"
4796 "            } else {\n"
4797 "                SHUT_FD1;\n"
4798 "                SHUT_FD2;\n"
4799 "                buf1_avail = buf1_written = 0;\n"
4800 "                buf2_avail = buf2_written = 0;\n"
4801 "                fd1 = r;\n"
4802 "                fd2 = connect_socket(forward_port, argv[3]);\n"
4803 "                if (fd2 == -1)\n"
4804 "                    SHUT_FD1;\n"
4805 "                else\n"
4806 "                    printf(\"connect from %s\\en\",\n"
4807 "                            inet_ntoa(client_address.sin_addr));\n"
4808 "            }\n"
4809 "        }\n"
4810 msgstr ""
4811 "            memset(&client_address, 0, l = sizeof(client_address));\n"
4812 "            r = accept(h, (struct sockaddr *) &client_address, &l);\n"
4813 "            if (r == -1) {\n"
4814 "                perror(\"accept()\");\n"
4815 "            } else {\n"
4816 "                SHUT_FD1;\n"
4817 "                SHUT_FD2;\n"
4818 "                buf1_avail = buf1_written = 0;\n"
4819 "                buf2_avail = buf2_written = 0;\n"
4820 "                fd1 = r;\n"
4821 "                fd2 = connect_socket(forward_port, argv[3]);\n"
4822 "                if (fd2 == -1)\n"
4823 "                    SHUT_FD1;\n"
4824 "                else\n"
4825 "                    printf(\"connect from %s\\en\",\n"
4826 "                            inet_ntoa(client_address.sin_addr));\n"
4827 "            }\n"
4828 "        }\n"
4829
4830 #. type: Plain text
4831 #: build/C/man2/select_tut.2:726
4832 #, no-wrap
4833 msgid "        /* NB: read oob data before normal reads */\n"
4834 msgstr "        /* NB: read oob data before normal reads */\n"
4835
4836 #. type: Plain text
4837 #: build/C/man2/select_tut.2:730
4838 #, no-wrap
4839 msgid ""
4840 "        if (fd1 E<gt> 0)\n"
4841 "            if (FD_ISSET(fd1, &er)) {\n"
4842 "                char c;\n"
4843 msgstr ""
4844 "        if (fd1 E<gt> 0)\n"
4845 "            if (FD_ISSET(fd1, &er)) {\n"
4846 "                char c;\n"
4847
4848 #. type: Plain text
4849 #: build/C/man2/select_tut.2:740
4850 #, no-wrap
4851 msgid ""
4852 "                r = recv(fd1, &c, 1, MSG_OOB);\n"
4853 "                if (r E<lt> 1)\n"
4854 "                    SHUT_FD1;\n"
4855 "                else\n"
4856 "                    send(fd2, &c, 1, MSG_OOB);\n"
4857 "            }\n"
4858 "        if (fd2 E<gt> 0)\n"
4859 "            if (FD_ISSET(fd2, &er)) {\n"
4860 "                char c;\n"
4861 msgstr ""
4862 "                r = recv(fd1, &c, 1, MSG_OOB);\n"
4863 "                if (r E<lt> 1)\n"
4864 "                    SHUT_FD1;\n"
4865 "                else\n"
4866 "                    send(fd2, &c, 1, MSG_OOB);\n"
4867 "            }\n"
4868 "        if (fd2 E<gt> 0)\n"
4869 "            if (FD_ISSET(fd2, &er)) {\n"
4870 "                char c;\n"
4871
4872 #. type: Plain text
4873 #: build/C/man2/select_tut.2:783
4874 #, no-wrap
4875 msgid ""
4876 "                r = recv(fd2, &c, 1, MSG_OOB);\n"
4877 "                if (r E<lt> 1)\n"
4878 "                    SHUT_FD2;\n"
4879 "                else\n"
4880 "                    send(fd1, &c, 1, MSG_OOB);\n"
4881 "            }\n"
4882 "        if (fd1 E<gt> 0)\n"
4883 "            if (FD_ISSET(fd1, &rd)) {\n"
4884 "                r = read(fd1, buf1 + buf1_avail,\n"
4885 "                          BUF_SIZE - buf1_avail);\n"
4886 "                if (r E<lt> 1)\n"
4887 "                    SHUT_FD1;\n"
4888 "                else\n"
4889 "                    buf1_avail += r;\n"
4890 "            }\n"
4891 "        if (fd2 E<gt> 0)\n"
4892 "            if (FD_ISSET(fd2, &rd)) {\n"
4893 "                r = read(fd2, buf2 + buf2_avail,\n"
4894 "                          BUF_SIZE - buf2_avail);\n"
4895 "                if (r E<lt> 1)\n"
4896 "                    SHUT_FD2;\n"
4897 "                else\n"
4898 "                    buf2_avail += r;\n"
4899 "            }\n"
4900 "        if (fd1 E<gt> 0)\n"
4901 "            if (FD_ISSET(fd1, &wr)) {\n"
4902 "                r = write(fd1, buf2 + buf2_written,\n"
4903 "                           buf2_avail - buf2_written);\n"
4904 "                if (r E<lt> 1)\n"
4905 "                    SHUT_FD1;\n"
4906 "                else\n"
4907 "                    buf2_written += r;\n"
4908 "            }\n"
4909 "        if (fd2 E<gt> 0)\n"
4910 "            if (FD_ISSET(fd2, &wr)) {\n"
4911 "                r = write(fd2, buf1 + buf1_written,\n"
4912 "                           buf1_avail - buf1_written);\n"
4913 "                if (r E<lt> 1)\n"
4914 "                    SHUT_FD2;\n"
4915 "                else\n"
4916 "                    buf1_written += r;\n"
4917 "            }\n"
4918 msgstr ""
4919 "                r = recv(fd2, &c, 1, MSG_OOB);\n"
4920 "                if (r E<lt> 1)\n"
4921 "                    SHUT_FD2;\n"
4922 "                else\n"
4923 "                    send(fd1, &c, 1, MSG_OOB);\n"
4924 "            }\n"
4925 "        if (fd1 E<gt> 0)\n"
4926 "            if (FD_ISSET(fd1, &rd)) {\n"
4927 "                r = read(fd1, buf1 + buf1_avail,\n"
4928 "                          BUF_SIZE - buf1_avail);\n"
4929 "                if (r E<lt> 1)\n"
4930 "                    SHUT_FD1;\n"
4931 "                else\n"
4932 "                    buf1_avail += r;\n"
4933 "            }\n"
4934 "        if (fd2 E<gt> 0)\n"
4935 "            if (FD_ISSET(fd2, &rd)) {\n"
4936 "                r = read(fd2, buf2 + buf2_avail,\n"
4937 "                          BUF_SIZE - buf2_avail);\n"
4938 "                if (r E<lt> 1)\n"
4939 "                    SHUT_FD2;\n"
4940 "                else\n"
4941 "                    buf2_avail += r;\n"
4942 "            }\n"
4943 "        if (fd1 E<gt> 0)\n"
4944 "            if (FD_ISSET(fd1, &wr)) {\n"
4945 "                r = write(fd1, buf2 + buf2_written,\n"
4946 "                           buf2_avail - buf2_written);\n"
4947 "                if (r E<lt> 1)\n"
4948 "                    SHUT_FD1;\n"
4949 "                else\n"
4950 "                    buf2_written += r;\n"
4951 "            }\n"
4952 "        if (fd2 E<gt> 0)\n"
4953 "            if (FD_ISSET(fd2, &wr)) {\n"
4954 "                r = write(fd2, buf1 + buf1_written,\n"
4955 "                           buf1_avail - buf1_written);\n"
4956 "                if (r E<lt> 1)\n"
4957 "                    SHUT_FD2;\n"
4958 "                else\n"
4959 "                    buf1_written += r;\n"
4960 "            }\n"
4961
4962 #. type: Plain text
4963 #: build/C/man2/select_tut.2:785
4964 #, no-wrap
4965 msgid "        /* check if write data has caught read data */\n"
4966 msgstr "        /* check if write data has caught read data */\n"
4967
4968 #. type: Plain text
4969 #: build/C/man2/select_tut.2:790
4970 #, no-wrap
4971 msgid ""
4972 "        if (buf1_written == buf1_avail)\n"
4973 "            buf1_written = buf1_avail = 0;\n"
4974 "        if (buf2_written == buf2_avail)\n"
4975 "            buf2_written = buf2_avail = 0;\n"
4976 msgstr ""
4977 "        if (buf1_written == buf1_avail)\n"
4978 "            buf1_written = buf1_avail = 0;\n"
4979 "        if (buf2_written == buf2_avail)\n"
4980 "            buf2_written = buf2_avail = 0;\n"
4981
4982 #. type: Plain text
4983 #: build/C/man2/select_tut.2:793
4984 #, no-wrap
4985 msgid ""
4986 "        /* one side has closed the connection, keep\n"
4987 "           writing to the other side until empty */\n"
4988 msgstr ""
4989 "        /* one side has closed the connection, keep\n"
4990 "           writing to the other side until empty */\n"
4991
4992 #. type: Plain text
4993 #: build/C/man2/select_tut.2:801
4994 #, no-wrap
4995 msgid ""
4996 "        if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n"
4997 "            SHUT_FD2;\n"
4998 "        if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n"
4999 "            SHUT_FD1;\n"
5000 "    }\n"
5001 "    exit(EXIT_SUCCESS);\n"
5002 "}\n"
5003 msgstr ""
5004 "        if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n"
5005 "            SHUT_FD2;\n"
5006 "        if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n"
5007 "            SHUT_FD1;\n"
5008 "    }\n"
5009 "    exit(EXIT_SUCCESS);\n"
5010 "}\n"
5011
5012 #. type: Plain text
5013 #: build/C/man2/select_tut.2:815
5014 msgid "The above program properly forwards most kinds of TCP connections including OOB signal data transmitted by B<telnet> servers.  It handles the tricky problem of having data flow in both directions simultaneously.  You might think it more efficient to use a B<fork>(2)  call and devote a thread to each stream.  This becomes more tricky than you might suspect.  Another idea is to set nonblocking I/O using B<fcntl>(2).  This also has its problems because you end up using inefficient timeouts."
5015 msgstr "上記のプログラムは、ほとんどの種類の TCP 接続をフォワードする。 B<telnet> サーバによって中継される OOB シグナルデータも扱える。 このプログラムは、データフローを双方向に同時に送るという、 ややこしい問題も処理できる。 B<fork>(2)  コールを使って、各ストリームごとに専用のスレッドを用いるほうが効率的だ、 という人もいるかもしれない。しかし、これは考えているよりずっとややこしい。 あるいは、 B<fcntl>(2)  を使って非ブロック I/O をセットすれば良い、というアイデアもあるだろう。 これにも実際には問題があり、タイムアウトが非効率的に起こってしまう。"
5016
5017 #. type: Plain text
5018 #: build/C/man2/select_tut.2:821
5019 msgid "The program does not handle more than one simultaneous connection at a time, although it could easily be extended to do this with a linked list of buffers\\(emone for each connection.  At the moment, new connections cause the current connection to be dropped."
5020 msgstr "このプログラムは一度にひとつ以上の同時接続を扱うことはできないが、 その様に拡張するのは簡単で、バッファーのリンクリストを (接続ごとにひとつずつ) 使えばよい。 現時点のものでは、新しい接続がくると古い接続は落ちてしまう。"
5021
5022 #.  .SH AUTHORS
5023 #.  This man page was written by Paul Sheer.
5024 #. type: Plain text
5025 #: build/C/man2/select_tut.2:840
5026 msgid "B<accept>(2), B<connect>(2), B<ioctl>(2), B<poll>(2), B<read>(2), B<recv>(2), B<select>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<sigaddset>(3), B<sigdelset>(3), B<sigemptyset>(3), B<sigfillset>(3), B<sigismember>(3), B<epoll>(7)"
5027 msgstr "B<accept>(2), B<connect>(2), B<ioctl>(2), B<poll>(2), B<read>(2), B<recv>(2), B<select>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<sigaddset>(3), B<sigdelset>(3), B<sigemptyset>(3), B<sigfillset>(3), B<sigismember>(3), B<epoll>(7)"
5028
5029 #. type: TH
5030 #: build/C/man2/send.2:40
5031 #, no-wrap
5032 msgid "SEND"
5033 msgstr "SEND"
5034
5035 #. type: Plain text
5036 #: build/C/man2/send.2:43
5037 msgid "send, sendto, sendmsg - send a message on a socket"
5038 msgstr "send, sendto, sendmsg - ソケットへメッセージを送る"
5039
5040 #. type: Plain text
5041 #: build/C/man2/send.2:47
5042 #, no-wrap
5043 msgid ""
5044 "B<#include E<lt>sys/types.hE<gt>>\n"
5045 "B<#include E<lt>sys/socket.hE<gt>>\n"
5046 msgstr ""
5047 "B<#include E<lt>sys/types.hE<gt>>\n"
5048 "B<#include E<lt>sys/socket.hE<gt>>\n"
5049
5050 #. type: Plain text
5051 #: build/C/man2/send.2:50
5052 #, no-wrap
5053 msgid "B<ssize_t send(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<);>\n"
5054 msgstr "B<ssize_t send(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<);>\n"
5055
5056 #. type: Plain text
5057 #: build/C/man2/send.2:54
5058 #, no-wrap
5059 msgid ""
5060 "B<ssize_t sendto(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<,>\n"
5061 "B<               const struct sockaddr *>I<dest_addr>B<, socklen_t >I<addrlen>B<);>\n"
5062 msgstr ""
5063 "B<ssize_t sendto(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, int >I<flags>B<,>\n"
5064 "B<               const struct sockaddr *>I<dest_addr>B<, socklen_t >I<addrlen>B<);>\n"
5065
5066 #. type: Plain text
5067 #: build/C/man2/send.2:57
5068 #, no-wrap
5069 msgid "B<ssize_t sendmsg(int >I<sockfd>B<, const struct msghdr *>I<msg>B<, int >I<flags>B<);>\n"
5070 msgstr "B<ssize_t sendmsg(int >I<sockfd>B<, const struct msghdr *>I<msg>B<, int >I<flags>B<);>\n"
5071
5072 #. type: Plain text
5073 #: build/C/man2/send.2:65
5074 msgid "The system calls B<send>(), B<sendto>(), and B<sendmsg>()  are used to transmit a message to another socket."
5075 msgstr "システムコール B<send>(), B<sendto>(), B<sendmsg>()  は、もう一方のソケットへメッセージを転送するのに使用される。"
5076
5077 #. type: Plain text
5078 #: build/C/man2/send.2:84
5079 msgid "The B<send>()  call may be used only when the socket is in a I<connected> state (so that the intended recipient is known).  The only difference between B<send>()  and B<write>(2)  is the presence of I<flags>.  With a zero I<flags> argument, B<send>()  is equivalent to B<write>(2).  Also, the following call"
5080 msgstr "B<send>()  は、ソケットが I<接続された (connected)> 状態にある場合にのみ使用できる (つまり、どの相手に送信するかは既知である)。 B<send>()  と B<write>(2)  の違いは、引き数に I<flags> があるかどうかだけである。 引き数 I<flags> にフラグが指定されない場合、 B<send>()  は B<write>(2)  と等価である。 また、"
5081
5082 #. type: Plain text
5083 #: build/C/man2/send.2:86
5084 #, no-wrap
5085 msgid "    send(sockfd, buf, len, flags);\n"
5086 msgstr "    send(sockfd, buf, len, flags);\n"
5087
5088 #. type: Plain text
5089 #: build/C/man2/send.2:88
5090 msgid "is equivalent to"
5091 msgstr "は以下と等価である。"
5092
5093 #. type: Plain text
5094 #: build/C/man2/send.2:90
5095 #, no-wrap
5096 msgid "    sendto(sockfd, buf, len, flags, NULL, 0);\n"
5097 msgstr "    sendto(sockfd, buf, len, flags, NULL, 0);\n"
5098
5099 #. type: Plain text
5100 #: build/C/man2/send.2:94
5101 msgid "The argument I<sockfd> is the file descriptor of the sending socket."
5102 msgstr "引き数 I<sockfd> は、データを送信するパケットのファイルディスクリプターである。"
5103
5104 #. type: Plain text
5105 #: build/C/man2/send.2:122
5106 msgid "If B<sendto>()  is used on a connection-mode (B<SOCK_STREAM>, B<SOCK_SEQPACKET>)  socket, the arguments I<dest_addr> and I<addrlen> are ignored (and the error B<EISCONN> may be returned when they are not NULL and 0), and the error B<ENOTCONN> is returned when the socket was not actually connected.  Otherwise, the address of the target is given by I<dest_addr> with I<addrlen> specifying its size.  For B<sendmsg>(), the address of the target is given by I<msg.msg_name>, with I<msg.msg_namelen> specifying its size."
5107 msgstr "B<sendto>()  は、接続型 (connection-mode) のソケット (B<SOCK_STREAM>, B<SOCK_SEQPACKET>)  で 使用された場合、引き数 I<dest_addr> と I<addrlen> は無視される (各々の引き数が NULL と 0 でない場合は B<EISCONN> エラーも返される)。 また、ソケットが実際には接続されていなかった時には B<ENOTCONN> エラーが返される。 接続型のソケット以外で使用された場合は、接続先のアドレスは I<dest_addr> で与えられ、そのサイズは I<addrlen> で指定される。 B<sendmsg>()  では、接続先のアドレスは I<msg.msg_name> で与えられ、そのサイズは I<msg.msg_namelen> で指定される。"
5108
5109 #. type: Plain text
5110 #: build/C/man2/send.2:138
5111 msgid "For B<send>()  and B<sendto>(), the message is found in I<buf> and has length I<len>.  For B<sendmsg>(), the message is pointed to by the elements of the array I<msg.msg_iov>.  The B<sendmsg>()  call also allows sending ancillary data (also known as control information)."
5112 msgstr "B<send>()  と B<sendto>()  では、メッセージは I<buf> に格納されており、その長さは I<len> であると解釈される。 B<sendmsg>()  では、メッセージは 配列 I<msg.msg_iov> の各要素が指す位置に格納されている。 B<sendmsg>()  では、補助データ (制御情報とも呼ばれる) を送信することもできる。"
5113
5114 #. type: Plain text
5115 #: build/C/man2/send.2:143
5116 msgid "If the message is too long to pass atomically through the underlying protocol, the error B<EMSGSIZE> is returned, and the message is not transmitted."
5117 msgstr "メッセージ長が長過ぎるために、そのソケットが使用するプロトコルでは、 メッセージをソケットに渡されたままの形で送信することができない場合、 B<EMSGSIZE> エラーが返され、そのメッセージは転送されない。"
5118
5119 #. type: Plain text
5120 #: build/C/man2/send.2:147
5121 msgid "No indication of failure to deliver is implicit in a B<send>().  Locally detected errors are indicated by a return value of -1."
5122 msgstr "B<send>()  では、配送の失敗の通知は明示的に行われる。 ローカル側でエラーが検出された場合は、返り値 -1 として通知される。"
5123
5124 #. type: Plain text
5125 #: build/C/man2/send.2:160
5126 msgid "When the message does not fit into the send buffer of the socket, B<send>()  normally blocks, unless the socket has been placed in nonblocking I/O mode.  In nonblocking mode it would fail with the error B<EAGAIN> or B<EWOULDBLOCK> in this case.  The B<select>(2)  call may be used to determine when it is possible to send more data."
5127 msgstr "メッセージがソケットの送信バッファーに入れることができない場合、 B<send>()  は通常は停止 (block) する (ソケットが非停止 (nonblocking) I/O モード でない場合)。非停止モードの場合にはエラー B<EAGAIN> か B<EWOULDBLOCK> で失敗する。 いつデータをさらに送信できるようになるかを知るために、 B<select>(2)  コールを使用することができる。"
5128
5129 #.  FIXME . ? document MSG_PROXY (which went away in 2.3.15)
5130 #. type: Plain text
5131 #: build/C/man2/send.2:166
5132 msgid "The I<flags> argument is the bitwise OR of zero or more of the following flags."
5133 msgstr "I<flags> 引き数は、以下のフラグの (0 個以上の) ビット単位の論理和を とったものを指定する。"
5134
5135 #. type: TP
5136 #: build/C/man2/send.2:166
5137 #, no-wrap
5138 msgid "B<MSG_CONFIRM> (since Linux 2.3.15)"
5139 msgstr "B<MSG_CONFIRM> (Linux 2.3.15 以降)"
5140
5141 #. type: Plain text
5142 #: build/C/man2/send.2:180
5143 msgid "Tell the link layer that forward progress happened: you got a successful reply from the other side.  If the link layer doesn't get this it will regularly reprobe the neighbor (e.g., via a unicast ARP).  Only valid on B<SOCK_DGRAM> and B<SOCK_RAW> sockets and currently implemented only for IPv4 and IPv6.  See B<arp>(7)  for details."
5144 msgstr "転送処理に進展があった、つまり相手側から成功の応答を受けたことをリンク層に 知らせる。リンク層がこの通知を受け取らなかった場合には、通常どおり (ユニキャスト ARP を使うなどの方法で) 近傍 (neighbor) の再検索を行う。 B<SOCK_DGRAM> と B<SOCK_RAW> のソケットに対してのみ有効で、現在のところ IPv4 と IPv6 のみ実装されている。 詳しくは B<arp>(7)  参照のこと。"
5145
5146 #. type: TP
5147 #: build/C/man2/send.2:180
5148 #, no-wrap
5149 msgid "B<MSG_DONTROUTE>"
5150 msgstr "B<MSG_DONTROUTE>"
5151
5152 #. type: Plain text
5153 #: build/C/man2/send.2:188
5154 msgid "Don't use a gateway to send out the packet, send to hosts only on directly connected networks.  This is usually used only by diagnostic or routing programs.  This is defined only for protocol families that route; packet sockets don't."
5155 msgstr "パケットを送り出すのにゲートウェイを使用せず、 直接接続されているネットワーク上のホストだけに送る。 通常、このフラグは診断 (diagnostic) やルーティングプログラムに よってのみ使用される。このフラグは、経路制御が行われるプロトコルファミリー に対してのみ定義されている。パケットソケットには定義されていない。"
5156
5157 #. type: Plain text
5158 #: build/C/man2/send.2:199
5159 msgid "Enables nonblocking operation; if the operation would block, B<EAGAIN> or B<EWOULDBLOCK> is returned (this can also be enabled using the B<O_NONBLOCK> flag with the B<F_SETFL> B<fcntl>(2))."
5160 msgstr "非停止 (nonblocking) 操作を有効にする。操作が停止されるような場合には B<EAGAIN> か B<EWOULDBLOCK> を返すようにする (B<fcntl>(2)  の B<F_SETFL> で B<O_NONBLOCK> フラグを指定することによっても有効にできる)。"
5161
5162 #. type: TP
5163 #: build/C/man2/send.2:199
5164 #, no-wrap
5165 msgid "B<MSG_EOR> (since Linux 2.2)"
5166 msgstr "B<MSG_EOR> (Linux 2.2 以降)"
5167
5168 #. type: Plain text
5169 #: build/C/man2/send.2:203
5170 msgid "Terminates a record (when this notion is supported, as for sockets of type B<SOCK_SEQPACKET>)."
5171 msgstr "レコードの終了を指示する (B<SOCK_SEQPACKET> のようにこの概念に対応しているソケット種別のときに有効)。"
5172
5173 #. type: TP
5174 #: build/C/man2/send.2:203
5175 #, no-wrap
5176 msgid "B<MSG_MORE> (since Linux 2.4.4)"
5177 msgstr "B<MSG_MORE> (Linux 2.4.4 以降)"
5178
5179 #. type: Plain text
5180 #: build/C/man2/send.2:212
5181 msgid "The caller has more data to send.  This flag is used with TCP sockets to obtain the same effect as the B<TCP_CORK> socket option (see B<tcp>(7)), with the difference that this flag can be set on a per-call basis."
5182 msgstr "呼び出し元にさらに送るデータがあることを示す。 このフラグは TCP ソケットとともに使用され、 B<TCP_CORK> ソケットオプションと同じ効果が得られる (B<tcp>(7)  を参照)。 B<TCP_CORK> との違いは、このフラグを使うと呼び出し単位で この機能を有効にできる点である。"
5183
5184 #. type: Plain text
5185 #: build/C/man2/send.2:221
5186 msgid "Since Linux 2.6, this flag is also supported for UDP sockets, and informs the kernel to package all of the data sent in calls with this flag set into a single datagram which is transmitted only when a call is performed that does not specify this flag.  (See also the B<UDP_CORK> socket option described in B<udp>(7).)"
5187 msgstr "Linux 2.6 以降では、このフラグは UDP ソケットでもサポートされており、 このフラグ付きで送信された全てのデータを一つのデータグラムにまとめて 送信することを、カーネルに知らせる。まとめられたデータグラムは、 このフラグを指定せずにこのシステムコールが実行された際に初めて送信される (B<udp>(7)  に記載されているソケットオプション B<UDP_CORK> も参照)。"
5188
5189 #. type: TP
5190 #: build/C/man2/send.2:221
5191 #, no-wrap
5192 msgid "B<MSG_NOSIGNAL> (since Linux 2.2)"
5193 msgstr "B<MSG_NOSIGNAL> (Linux 2.2 以降)"
5194
5195 #. type: Plain text
5196 #: build/C/man2/send.2:230
5197 msgid "Requests not to send B<SIGPIPE> on errors on stream oriented sockets when the other end breaks the connection.  The B<EPIPE> error is still returned."
5198 msgstr "ストリーム指向のソケットで相手側が接続を切断した時に、エラーとして B<SIGPIPE> を送信しないように要求する。この場合でも B<EPIPE> は返される。"
5199
5200 #. type: Plain text
5201 #: build/C/man2/send.2:239
5202 msgid "Sends I<out-of-band> data on sockets that support this notion (e.g., of type B<SOCK_STREAM>); the underlying protocol must also support I<out-of-band> data."
5203 msgstr "I<帯域外 (out-of-band)> データをサポートするソケット (例えば B<SOCK_STREAM>)  で I<帯域外> データを送る。下位プロトコルも I<帯域外> データをサポートしている必要がある。"
5204
5205 #. type: SS
5206 #: build/C/man2/send.2:239
5207 #, no-wrap
5208 msgid "sendmsg()"
5209 msgstr "sendmsg()"
5210
5211 #. type: Plain text
5212 #: build/C/man2/send.2:245
5213 msgid "The definition of the I<msghdr> structure employed by B<sendmsg>()  is as follows:"
5214 msgstr "B<sendmsg>() で利用されている I<msghdr> 構造体は以下の通り。"
5215
5216 #. type: Plain text
5217 #: build/C/man2/send.2:257
5218 #, no-wrap
5219 msgid ""
5220 "struct msghdr {\n"
5221 "    void         *msg_name;       /* optional address */\n"
5222 "    socklen_t     msg_namelen;    /* size of address */\n"
5223 "    struct iovec *msg_iov;        /* scatter/gather array */\n"
5224 "    size_t        msg_iovlen;     /* # elements in msg_iov */\n"
5225 "    void         *msg_control;    /* ancillary data, see below */\n"
5226 "    size_t        msg_controllen; /* ancillary data buffer len */\n"
5227 "    int           msg_flags;      /* flags (unused) */\n"
5228 "};\n"
5229 msgstr ""
5230 "struct msghdr {\n"
5231 "    void         *msg_name;       /* 追加のアドレス */\n"
5232 "    socklen_t     msg_namelen;    /* アドレスのサイズ */\n"
5233 "    struct iovec *msg_iov;        /* scatter/gather 配列 */\n"
5234 "    size_t        msg_iovlen;     /* msg_iov の要素数 */\n"
5235 "    void         *msg_control;    /* 補助データ (後述) */\n"
5236 "    size_t        msg_controllen; /* 補助データバッファー長 */\n"
5237 "    int           msg_flags;      /* フラグ (未使用) */\n"
5238 "};\n"
5239
5240 #. type: Plain text
5241 #: build/C/man2/send.2:269
5242 msgid "The I<msg_name> field is used on an unconnected socket to specify the target address for a datagram.  It points to a buffer containing the address; the I<msg_namelen> field should be set to the size of the address.  For a connected socket, these fields should be specified as NULL and 0, respectively."
5243 msgstr "フィールド I<msg_name> は、 未接続のソケットでデータグラムの宛先アドレスを指定するのに使用される。 このフィールドはアドレスを格納したバッファーを指す。 フィールド I<msg_namelen> にはアドレスの大きさを設定しなければならない。 接続済のソケットについては、これらのフィールドにはそれぞれ NULL と 0 を指定しなければならない。"
5244
5245 #. type: Plain text
5246 #: build/C/man2/send.2:276
5247 msgid "The I<msg_iov> and I<msg_iovlen> fields specify scatter-gather locations, as for B<writev>(2)."
5248 msgstr "フィールド B<msg_iov> と I<msg_iovlen> は scatter-gather 用の場所を指定する。 B<writev>(2) と同じ。"
5249
5250 #. type: Plain text
5251 #: build/C/man2/send.2:287
5252 msgid "You may send control information using the I<msg_control> and I<msg_controllen> members.  The maximum control buffer length the kernel can process is limited per socket by the value in I</proc/sys/net/core/optmem_max>; see B<socket>(7)."
5253 msgstr "フィールド I<msg_control> と I<msg_controllen> を使用して制御情報を送信することができる。 カーネルが処理できる制御バッファーのソケットあたりの最大長は、 I</proc/sys/net/core/optmem_max> の値に制限されている。 B<socket>(7)  を参照。"
5254
5255 #.  Still to be documented:
5256 #.   Send file descriptors and user credentials using the
5257 #.   msg_control* fields.
5258 #. type: Plain text
5259 #: build/C/man2/send.2:294
5260 msgid "The I<msg_flags> field is ignored."
5261 msgstr "フィールド I<msg_flags> は無視される。"
5262
5263 #. type: Plain text
5264 #: build/C/man2/send.2:299
5265 msgid "On success, these calls return the number of bytes sent.  On error, -1 is returned, and I<errno> is set appropriately."
5266 msgstr "成功した場合、これらのシステムコールは送信されたバイト数を返す。 エラーの場合、 -1 を返し、 I<errno> を適切に設定にする。"
5267
5268 #. type: Plain text
5269 #: build/C/man2/send.2:304
5270 msgid "These are some standard errors generated by the socket layer.  Additional errors may be generated and returned from the underlying protocol modules; see their respective manual pages."
5271 msgstr "これらはソケット層で発生する一般的なエラーである。これ以外に、下層の プロトコルモジュールで生成されたエラーが返されるかもしれない。 これらについては、それぞれのマニュアルを参照すること。"
5272
5273 #. type: Plain text
5274 #: build/C/man2/send.2:312
5275 msgid "(For UNIX domain sockets, which are identified by pathname)  Write permission is denied on the destination socket file, or search permission is denied for one of the directories the path prefix.  (See B<path_resolution>(7).)"
5276 msgstr ""
5277 "(UNIX ドメインソケットの場合; パス名で識別される。)\n"
5278 "\n"
5279 "ソケットファイルへの書き込み許可がなかったか、パス名へ到達するまでの\n"
5280 "ディレクトリのいずれかに対する検索許可がなかった。\n"
5281 "(B<path_resolution>(7) も参照のこと)"
5282
5283 #. type: Plain text
5284 #: build/C/man2/send.2:315
5285 msgid "(For UDP sockets) An attempt was made to send to a network/broadcast address as though it was a unicast address."
5286 msgstr ""
5287 "(UDP ソケットの場合) ユニキャストアドレスであるかのように、\n"
5288 "ネットワークアドレスやブロードキャストアドレスへの送信が試みられた。"
5289
5290 #.  Actually EAGAIN on Linux
5291 #. type: Plain text
5292 #: build/C/man2/send.2:323
5293 msgid "The socket is marked nonblocking and the requested operation would block.  POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities."
5294 msgstr "ソケットが非停止に設定されており、 要求された操作が停止した。 POSIX.1-2001 は、この場合にどちらのエラーを返すことも認めており、 これら 2 つの定数が同じ値を持つことも求めていない。 したがって、移植性が必要なアプリケーションでは、両方の可能性を 確認すべきである。"
5295
5296 #. type: Plain text
5297 #: build/C/man2/send.2:336
5298 msgid "(Internet domain datagram sockets)  The socket referred to by I<sockfd> had not previously been bound to an address and, upon attempting to bind it to an ephemeral port, it was determined that all port numbers in the ephemeral port range are currently in use.  See the discussion of I</proc/sys/net/ipv4/ip_local_port_range> in B<ip>(7)."
5299 msgstr "(インターネットドメインデータグラムソケットの場合) I<sockfd> が参照するソケットがそれ以前にアドレスにバインドされておらず、 そのソケットに一時ポートをバインドしようとした際に、 一時ポートとして使用する範囲のポート番号がすべて使用中であった。 B<ip>(7) の I</proc/sys/net/ipv4/ip_local_port_range> の議論を参照のこと。"
5300
5301 #. type: Plain text
5302 #: build/C/man2/send.2:339
5303 msgid "An invalid descriptor was specified."
5304 msgstr "無効なディスクリプターが指定された。"
5305
5306 #. type: TP
5307 #: build/C/man2/send.2:339
5308 #, no-wrap
5309 msgid "B<ECONNRESET>"
5310 msgstr "B<ECONNRESET>"
5311
5312 #. type: Plain text
5313 #: build/C/man2/send.2:342
5314 msgid "Connection reset by peer."
5315 msgstr "接続が接続相手によりリセットされた。"
5316
5317 #. type: TP
5318 #: build/C/man2/send.2:342
5319 #, no-wrap
5320 msgid "B<EDESTADDRREQ>"
5321 msgstr "B<EDESTADDRREQ>"
5322
5323 #. type: Plain text
5324 #: build/C/man2/send.2:345
5325 msgid "The socket is not connection-mode, and no peer address is set."
5326 msgstr "ソケットが接続型 (connection-mode) ではなく、 かつ送信先のアドレスが設定されていない。"
5327
5328 #. type: Plain text
5329 #: build/C/man2/send.2:348
5330 msgid "An invalid user space address was specified for an argument."
5331 msgstr "ユーザー空間として不正なアドレスがパラメーターとして指定された。"
5332
5333 #. type: Plain text
5334 #: build/C/man2/send.2:352
5335 msgid "A signal occurred before any data was transmitted; see B<signal>(7)."
5336 msgstr "データが送信される前に、シグナルが発生した。 B<signal>(7)  参照。"
5337
5338 #. type: Plain text
5339 #: build/C/man2/send.2:361
5340 msgid "The connection-mode socket was connected already but a recipient was specified.  (Now either this error is returned, or the recipient specification is ignored.)"
5341 msgstr "接続型ソケットの接続がすでに確立していたが、受信者が指定されていた。 (現在のところ、この状況では、このエラーが返されるか、 受信者の指定が無視されるか、のいずれかとなる)"
5342
5343 #. type: TP
5344 #: build/C/man2/send.2:361
5345 #, no-wrap
5346 msgid "B<EMSGSIZE>"
5347 msgstr "B<EMSGSIZE>"
5348
5349 #.  (e.g., SOCK_DGRAM )
5350 #. type: Plain text
5351 #: build/C/man2/send.2:367
5352 msgid "The socket type requires that message be sent atomically, and the size of the message to be sent made this impossible."
5353 msgstr "そのソケット種別 ではソケットに渡されたままの形でメッセージを送信する必要があるが、 メッセージが大き過ぎるため送信することができない。"
5354
5355 #. type: Plain text
5356 #: build/C/man2/send.2:375
5357 msgid "The output queue for a network interface was full.  This generally indicates that the interface has stopped sending, but may be caused by transient congestion.  (Normally, this does not occur in Linux.  Packets are just silently dropped when a device queue overflows.)"
5358 msgstr "ネットワークインターフェースの出力キューが一杯である。 一般的には、一時的な輻輳 (congestion) のためにインターフェースが 送信を止めていることを意味する。 (通常、Linux ではこのようなことは起こらない。デバイスのキューが オーバーフローした場合にはパケットは黙って捨てられる)"
5359
5360 #. type: Plain text
5361 #: build/C/man2/send.2:378
5362 msgid "No memory available."
5363 msgstr "メモリーが足りない。"
5364
5365 #. type: Plain text
5366 #: build/C/man2/send.2:381
5367 msgid "The socket is not connected, and no target has been given."
5368 msgstr "ソケットが接続されておらず、接続先も指定されていない。"
5369
5370 #. type: Plain text
5371 #: build/C/man2/send.2:391
5372 msgid "Some bit in the I<flags> argument is inappropriate for the socket type."
5373 msgstr "引き数 I<flags> のいくつかのビットが、そのソケット種別では不適切なものである。"
5374
5375 #. type: TP
5376 #: build/C/man2/send.2:391
5377 #, no-wrap
5378 msgid "B<EPIPE>"
5379 msgstr "B<EPIPE>"
5380
5381 #. type: Plain text
5382 #: build/C/man2/send.2:400
5383 msgid "The local end has been shut down on a connection oriented socket.  In this case, the process will also receive a B<SIGPIPE> unless B<MSG_NOSIGNAL> is set."
5384 msgstr "接続指向のソケットでローカル側が閉じられている。 この場合、 B<MSG_NOSIGNAL> が設定されていなければ、プロセスには B<SIGPIPE> も同時に送られる。"
5385
5386 #. type: Plain text
5387 #: build/C/man2/send.2:403
5388 msgid "4.4BSD, SVr4, POSIX.1-2001.  These function calls appeared in 4.2BSD."
5389 msgstr "4.4BSD, SVr4, POSIX.1-2001.  (これらの関数コールは 4.2BSD で最初に登場した)。"
5390
5391 #. type: Plain text
5392 #: build/C/man2/send.2:414
5393 msgid "POSIX.1-2001 describes only the B<MSG_OOB> and B<MSG_EOR> flags.  POSIX.1-2008 adds a specification of B<MSG_NOSIGNAL>.  The B<MSG_CONFIRM> flag is a Linux extension."
5394 msgstr "POSIX.1-2001 には、 B<MSG_OOB> と B<MSG_EOR> フラグだけが記載されている。 POSIX.1-2008 では B<MSG_NOSIGNAL> が規格に追加されている。 B<MSG_CONFIRM> フラグは Linux での拡張である。"
5395
5396 #. type: Plain text
5397 #: build/C/man2/send.2:433
5398 msgid "See B<sendmmsg>(2)  for information about a Linux-specific system call that can be used to transmit multiple datagrams in a single call."
5399 msgstr ""
5400 "B<sendmmsg>(2)  には、一度の呼び出しでの複数のデータグラムの送信に使用できる\n"
5401 "Linux 固有の システムコールに関する情報が書かれている。"
5402
5403 #. type: Plain text
5404 #: build/C/man2/send.2:438
5405 msgid "Linux may return B<EPIPE> instead of B<ENOTCONN>."
5406 msgstr "Linux は B<ENOTCONN> を返す状況で B<EPIPE> を返すことがある。"
5407
5408 #. type: Plain text
5409 #: build/C/man2/send.2:443
5410 msgid "An example of the use of B<sendto>()  is shown in B<getaddrinfo>(3)."
5411 msgstr "B<sendto>()  の利用例が B<getaddrinfo>(3)  に記載されている。"
5412
5413 #. type: Plain text
5414 #: build/C/man2/send.2:458
5415 msgid "B<fcntl>(2), B<getsockopt>(2), B<recv>(2), B<select>(2), B<sendfile>(2), B<sendmmsg>(2), B<shutdown>(2), B<socket>(2), B<write>(2), B<cmsg>(3), B<ip>(7), B<socket>(7), B<tcp>(7), B<udp>(7)"
5416 msgstr "B<fcntl>(2), B<getsockopt>(2), B<recv>(2), B<select>(2), B<sendfile>(2), B<sendmmsg>(2), B<shutdown>(2), B<socket>(2), B<write>(2), B<cmsg>(3), B<ip>(7), B<socket>(7), B<tcp>(7), B<udp>(7)"
5417
5418 #. type: TH
5419 #: build/C/man2/sendmmsg.2:28
5420 #, no-wrap
5421 msgid "SENDMMSG"
5422 msgstr "SENDMMSG"
5423
5424 #. type: TH
5425 #: build/C/man2/sendmmsg.2:28 build/C/man7/socket.7:58
5426 #, no-wrap
5427 msgid "2014-07-08"
5428 msgstr "2014-07-08"
5429
5430 #. type: Plain text
5431 #: build/C/man2/sendmmsg.2:31
5432 msgid "sendmmsg - send multiple messages on a socket"
5433 msgstr "sendmmsg - 複数のメッセージをソケットへ送信する"
5434
5435 #. type: Plain text
5436 #: build/C/man2/sendmmsg.2:39
5437 #, no-wrap
5438 msgid ""
5439 "B<int sendmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int >I<vlen>B<,>\n"
5440 "B<             unsigned int >I<flags>B<);>\n"
5441 msgstr ""
5442 "B<int sendmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int >I<vlen>B<,>\n"
5443 "B<             unsigned int >I<flags>B<);>\n"
5444
5445 #.  See commit 228e548e602061b08ee8e8966f567c12aa079682
5446 #. type: Plain text
5447 #: build/C/man2/sendmmsg.2:49
5448 msgid "The B<sendmmsg>()  system call is an extension of B<sendmsg>(2)  that allows the caller to transmit multiple messages on a socket using a single system call.  (This has performance benefits for some applications.)"
5449 msgstr "B<sendmmsg>() システムコールは B<sendmsg>(2) の拡張で、 このシステムコールを使うと一度の呼び出しでソケットに複数のメッセージを送信できる (アプリケーションによっては性能上のメリットがある)。"
5450
5451 #. type: Plain text
5452 #: build/C/man2/sendmmsg.2:54
5453 msgid "The I<sockfd> argument is the file descriptor of the socket on which data is to be transmitted."
5454 msgstr "I<sockfd> 引き数は、 データを送信するソケットのファイルディスクリプターである。"
5455
5456 #. type: Plain text
5457 #: build/C/man2/sendmmsg.2:75
5458 #, no-wrap
5459 msgid ""
5460 "struct mmsghdr {\n"
5461 "    struct msghdr msg_hdr;  /* Message header */\n"
5462 "    unsigned int  msg_len;  /* Number of bytes transmitted */\n"
5463 "};\n"
5464 msgstr ""
5465 "struct mmsghdr {\n"
5466 "    struct msghdr msg_hdr;  /* メッセージヘッダ */\n"
5467 "    unsigned int  msg_len;  /* 送信されたバイト数 */\n"
5468 "};\n"
5469
5470 #. type: Plain text
5471 #: build/C/man2/sendmmsg.2:91
5472 msgid "The I<msg_hdr> field is a I<msghdr> structure, as described in B<sendmsg>(2).  The I<msg_len> field is used to return the number of bytes sent from the message in I<msg_hdr> (i.e., the same as the return value from a single B<sendmsg>(2)  call)."
5473 msgstr "I<msg_hdr> フィールドは、 B<sendmsg>(2) で説明されている I<msghdr> 構造体である。 I<msg_len> フィールドは I<msg_hdr> から送信されたメッセージのバイト数を返すのに使用される。 この値は B<sendmsg>(2) をこのヘッダに対して呼び出した場合の返り値と同じである。"
5474
5475 #. type: Plain text
5476 #: build/C/man2/sendmmsg.2:97
5477 msgid "The I<flags> argument contains flags ORed together.  The flags are the same as for B<sendmsg>(2)."
5478 msgstr "I<flags> 引き数には複数のフラグを論理和 (OR) で指定できる。フラグは B<sendmsg>(2) と同じである。"
5479
5480 #. type: Plain text
5481 #: build/C/man2/sendmmsg.2:107
5482 msgid "A blocking B<sendmmsg>()  call blocks until I<vlen> messages have been sent.  A nonblocking call sends as many messages as possible (up to the limit specified by I<vlen>)  and returns immediately."
5483 msgstr "停止 (blocking) モードの B<sendmmsg>() の呼び出しは、 I<vlen> 個のメッセージが送信されるまで停止する。 非停止 (nonblocking) モードの呼び出しでは、 送信できるだけのメッセージ (最大で I<vlen> 個) を送信し、 すぐに返る。"
5484
5485 #. type: Plain text
5486 #: build/C/man2/sendmmsg.2:119
5487 msgid "On return from B<sendmmsg>(), the I<msg_len> fields of successive elements of I<msgvec> are updated to contain the number of bytes transmitted from the corresponding I<msg_hdr>.  The return value of the call indicates the number of elements of I<msgvec> that have been updated."
5488 msgstr "B<sendmmsg>() が返った際には、 I<msgvec> の送信が行われた要素の I<msg_len> フィールドは、対応する I<msg_hdr> から送信されたバイト数が入っている。 呼び出しの返り値は、更新された I<msgvec> の要素数である。"
5489
5490 #. type: Plain text
5491 #: build/C/man2/sendmmsg.2:129
5492 msgid "On success, B<sendmmsg>()  returns the number of messages sent from I<msgvec>; if this is less than I<vlen>, the caller can retry with a further B<sendmmsg>()  call to send the remaining messages."
5493 msgstr "成功すると、 B<sendmmsg>() は I<msgvec> から送信されたメッセージ数を返す。 返り値が I<vlen> よりも小さい場合、 呼び出した側では再度 B<sendmmsg> を呼び出して残りのメッセージを送信することができる。"
5494
5495 #. type: Plain text
5496 #: build/C/man2/sendmmsg.2:133
5497 msgid "On error, -1 is returned, and I<errno> is set to indicate the error."
5498 msgstr "エラーの場合、 -1 を返し、 I<errno> にエラーを示す値を設定する。"
5499
5500 #
5501 #.  commit 728ffb86f10873aaf4abd26dde691ee40ae731fe
5502 #.      ... only return an error if no datagrams could be sent.
5503 #.      If less than the requested number of messages were sent, the application
5504 #.      must retry starting at the first failed one and if the problem is
5505 #.      persistent the error will be returned.
5506 #.      This matches the behavior of other syscalls like read/write - it
5507 #.      is not an error if less than the requested number of elements are sent.
5508 #. type: Plain text
5509 #: build/C/man2/sendmmsg.2:145
5510 msgid "Errors are as for B<sendmsg>(2).  An error is returned only if no datagrams could be sent."
5511 msgstr "エラーは B<sendmsg>(2) と同じである。 エラーが返されるのは、 データグラムが全く送信できなかった場合のみである。"
5512
5513 #. type: Plain text
5514 #: build/C/man2/sendmmsg.2:150
5515 msgid "The B<sendmmsg>()  system call was added in Linux 3.0.  Support in glibc was added in version 2.14."
5516 msgstr "B<sendmmsg>() システムコールは Linux 3.0 で追加された。 glibc でのサポートはバージョン 2.14 で追加された。"
5517
5518 #. type: Plain text
5519 #: build/C/man2/sendmmsg.2:153
5520 msgid "B<sendmmsg>()  is Linux-specific."
5521 msgstr "B<sendmmsg>() は Linux 固有である。"
5522
5523 #
5524 #
5525 #.  commit 98382f419f32d2c12d021943b87dea555677144b
5526 #.      net: Cap number of elements for sendmmsg
5527 #.      To limit the amount of time we can spend in sendmmsg, cap the
5528 #.      number of elements to UIO_MAXIOV (currently 1024).
5529 #.      For error handling an application using sendmmsg needs to retry at
5530 #.      the first unsent message, so capping is simpler and requires less
5531 #.      application logic than returning EINVAL.
5532 #. type: Plain text
5533 #: build/C/man2/sendmmsg.2:168
5534 msgid "The value specified in I<vlen> is capped to B<UIO_MAXIOV> (1024)."
5535 msgstr "I<vlen> に指定できる値の最大値は B<UIO_MAXIOV> (1024) である。"
5536
5537 #. type: Plain text
5538 #: build/C/man2/sendmmsg.2:177
5539 msgid "The example below uses B<sendmmsg>()  to send I<onetwo> and I<three> in two distinct UDP datagrams using one system call.  The contents of the first datagram originates from a pair of buffers."
5540 msgstr "以下の例では、 B<sendmmsg>() を使って、 一度のシステムコールで、 I<onetwo> と I<three> を二つの別々の UDP データグラムで送信する。 一つ目のデータグラムの内容は、二つのバッファーから取得される。"
5541
5542 #. type: Plain text
5543 #: build/C/man2/sendmmsg.2:186
5544 #, no-wrap
5545 msgid ""
5546 "#define _GNU_SOURCE\n"
5547 "#include E<lt>netinet/ip.hE<gt>\n"
5548 "#include E<lt>stdio.hE<gt>\n"
5549 "#include E<lt>stdlib.hE<gt>\n"
5550 "#include E<lt>string.hE<gt>\n"
5551 "#include E<lt>sys/types.hE<gt>\n"
5552 "#include E<lt>sys/socket.hE<gt>\n"
5553 msgstr ""
5554 "#define _GNU_SOURCE\n"
5555 "#include E<lt>netinet/ip.hE<gt>\n"
5556 "#include E<lt>stdio.hE<gt>\n"
5557 "#include E<lt>stdlib.hE<gt>\n"
5558 "#include E<lt>string.hE<gt>\n"
5559 "#include E<lt>sys/types.hE<gt>\n"
5560 "#include E<lt>sys/socket.hE<gt>\n"
5561
5562 #. type: Plain text
5563 #: build/C/man2/sendmmsg.2:195
5564 #, no-wrap
5565 msgid ""
5566 "int\n"
5567 "main(void)\n"
5568 "{\n"
5569 "    int sockfd;\n"
5570 "    struct sockaddr_in sa;\n"
5571 "    struct mmsghdr msg[2];\n"
5572 "    struct iovec msg1[2], msg2;\n"
5573 "    int retval;\n"
5574 msgstr ""
5575 "int\n"
5576 "main(void)\n"
5577 "{\n"
5578 "    int sockfd;\n"
5579 "    struct sockaddr_in sa;\n"
5580 "    struct mmsghdr msg[2];\n"
5581 "    struct iovec msg1[2], msg2;\n"
5582 "    int retval;\n"
5583
5584 #. type: Plain text
5585 #: build/C/man2/sendmmsg.2:209
5586 #, no-wrap
5587 msgid ""
5588 "    sa.sin_family = AF_INET;\n"
5589 "    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n"
5590 "    sa.sin_port = htons(1234);\n"
5591 "    if (connect(sockfd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {\n"
5592 "        perror(\"connect()\");\n"
5593 "        exit(EXIT_FAILURE);\n"
5594 "    }\n"
5595 msgstr ""
5596 "    sa.sin_family = AF_INET;\n"
5597 "    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n"
5598 "    sa.sin_port = htons(1234);\n"
5599 "    if (connect(sockfd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {\n"
5600 "        perror(\"connect()\");\n"
5601 "        exit(EXIT_FAILURE);\n"
5602 "    }\n"
5603
5604 #. type: Plain text
5605 #: build/C/man2/sendmmsg.2:215
5606 #, no-wrap
5607 msgid ""
5608 "    memset(msg1, 0, sizeof(msg1));\n"
5609 "    msg1[0].iov_base = \"one\";\n"
5610 "    msg1[0].iov_len = 3;\n"
5611 "    msg1[1].iov_base = \"two\";\n"
5612 "    msg1[1].iov_len = 3;\n"
5613 msgstr ""
5614 "    memset(msg1, 0, sizeof(msg1));\n"
5615 "    msg1[0].iov_base = \"one\";\n"
5616 "    msg1[0].iov_len = 3;\n"
5617 "    msg1[1].iov_base = \"two\";\n"
5618 "    msg1[1].iov_len = 3;\n"
5619
5620 #. type: Plain text
5621 #: build/C/man2/sendmmsg.2:219
5622 #, no-wrap
5623 msgid ""
5624 "    memset(&msg2, 0, sizeof(msg2));\n"
5625 "    msg2.iov_base = \"three\";\n"
5626 "    msg2.iov_len = 5;\n"
5627 msgstr ""
5628 "    memset(&msg2, 0, sizeof(msg2));\n"
5629 "    msg2.iov_base = \"three\";\n"
5630 "    msg2.iov_len = 5;\n"
5631
5632 #. type: Plain text
5633 #: build/C/man2/sendmmsg.2:223
5634 #, no-wrap
5635 msgid ""
5636 "    memset(msg, 0, sizeof(msg));\n"
5637 "    msg[0].msg_hdr.msg_iov = msg1;\n"
5638 "    msg[0].msg_hdr.msg_iovlen = 2;\n"
5639 msgstr ""
5640 "    memset(msg, 0, sizeof(msg));\n"
5641 "    msg[0].msg_hdr.msg_iov = msg1;\n"
5642 "    msg[0].msg_hdr.msg_iovlen = 2;\n"
5643
5644 #. type: Plain text
5645 #: build/C/man2/sendmmsg.2:226
5646 #, no-wrap
5647 msgid ""
5648 "    msg[1].msg_hdr.msg_iov = &msg2;\n"
5649 "    msg[1].msg_hdr.msg_iovlen = 1;\n"
5650 msgstr ""
5651 "    msg[1].msg_hdr.msg_iov = &msg2;\n"
5652 "    msg[1].msg_hdr.msg_iovlen = 1;\n"
5653
5654 #. type: Plain text
5655 #: build/C/man2/sendmmsg.2:232
5656 #, no-wrap
5657 msgid ""
5658 "    retval = sendmmsg(sockfd, msg, 2, 0);\n"
5659 "    if (retval == -1)\n"
5660 "        perror(\"sendmmsg()\");\n"
5661 "    else\n"
5662 "        printf(\"%d messages sent\\en\", retval);\n"
5663 msgstr ""
5664 "    retval = sendmmsg(sockfd, msg, 2, 0);\n"
5665 "    if (retval == -1)\n"
5666 "        perror(\"sendmmsg()\");\n"
5667 "    else\n"
5668 "        printf(\"%d messages sent\\en\", retval);\n"
5669
5670 #. type: Plain text
5671 #: build/C/man2/sendmmsg.2:235
5672 #, no-wrap
5673 msgid ""
5674 "    exit(0);\n"
5675 "}\n"
5676 msgstr ""
5677 "    exit(0);\n"
5678 "}\n"
5679
5680 #. type: Plain text
5681 #: build/C/man2/sendmmsg.2:241
5682 msgid "B<recvmmsg>(2), B<sendmsg>(2), B<socket>(2), B<socket>(7)"
5683 msgstr "B<recvmmsg>(2), B<sendmsg>(2), B<socket>(2), B<socket>(7)"
5684
5685 #. type: TH
5686 #: build/C/man3/sockatmark.3:25
5687 #, no-wrap
5688 msgid "SOCKATMARK"
5689 msgstr "SOCKATMARK"
5690
5691 #. type: TH
5692 #: build/C/man3/sockatmark.3:25
5693 #, no-wrap
5694 msgid "2014-02-28"
5695 msgstr "2014-02-28"
5696
5697 #. type: Plain text
5698 #: build/C/man3/sockatmark.3:28
5699 msgid "sockatmark - determine whether socket is at out-of-band mark"
5700 msgstr "sockatmark - どのソケットに帯域外 (out-of-band) マークが付けられているかを調べる"
5701
5702 #. type: Plain text
5703 #: build/C/man3/sockatmark.3:30 build/C/man2/socket.2:50
5704 #: build/C/man7/socket.7:63 build/C/man2/socketpair.2:49
5705 msgid "B<#include E<lt>sys/socket.hE<gt>>"
5706 msgstr "B<#include E<lt>sys/socket.hE<gt>>"
5707
5708 #. type: Plain text
5709 #: build/C/man3/sockatmark.3:32
5710 msgid "B<int sockatmark(int >I<sockfd>B<);>"
5711 msgstr "B<int sockatmark(int >I<sockfd>B<);>"
5712
5713 #. type: Plain text
5714 #: build/C/man3/sockatmark.3:41
5715 msgid "B<sockatmark>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
5716 msgstr "B<sockatmark>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
5717
5718 #. type: Plain text
5719 #: build/C/man3/sockatmark.3:51
5720 msgid "B<sockatmark>()  returns a value indicating whether or not the socket referred to by the file descriptor I<sockfd> is at the out-of-band mark.  If the socket is at the mark, then 1 is returned; if the socket is not at the mark, 0 is returned.  This function does not remove the out-of-band mark."
5721 msgstr "B<sockatmark>()  はファイルディスクリプター I<sockfd> で参照されるソケットに帯域外マークが付けられているか否かを返す。 ソケットにマークが付けられている場合は、1 が返される。 ソケットにマークが付けられていない場合は、0 が返される。 この関数は帯域外マークを削除しない。"
5722
5723 #. type: Plain text
5724 #: build/C/man3/sockatmark.3:58
5725 msgid "A successful call to B<sockatmark>()  returns 1 if the socket is at the out-of-band mark, or 0 if it is not.  On error, -1 is returned and I<errno> is set to indicate the error."
5726 msgstr "B<sockatmark>()  の呼び出しが成功した場合、ソケットに帯域外マークが 付けられていれば 1 を返し、付けられていなければ 0 を返す。 エラーの場合は -1 が返され、エラーを表す I<errno> が設定される。"
5727
5728 #. type: Plain text
5729 #: build/C/man3/sockatmark.3:63
5730 msgid "I<sockfd> is not a valid file descriptor."
5731 msgstr "I<sockfd> が有効なファイルディスクリプターでない。"
5732
5733 #.  POSIX.1 says ENOTTY for this case
5734 #. type: Plain text
5735 #: build/C/man3/sockatmark.3:70
5736 msgid "I<sockfd> is not a file descriptor to which B<sockatmark>()  can be applied."
5737 msgstr "I<sockfd> は B<sockatmark>()  が適用できないファイルディスクリプターである。"
5738
5739 #. type: Plain text
5740 #: build/C/man3/sockatmark.3:73
5741 msgid "B<sockatmark>()  was added to glibc in version 2.2.4."
5742 msgstr "B<sockatmark>()  は glibc バージョン 2.2.4 で追加された。"
5743
5744 #. type: Plain text
5745 #: build/C/man3/sockatmark.3:78
5746 msgid "The B<sockatmark>()  function is thread-safe."
5747 msgstr "B<sockatmark>() 関数はスレッドセーフである。"
5748
5749 #. type: Plain text
5750 #: build/C/man3/sockatmark.3:80
5751 msgid "POSIX.1-2001."
5752 msgstr "POSIX.1-2001."
5753
5754 #. type: Plain text
5755 #: build/C/man3/sockatmark.3:87
5756 msgid "If B<sockatmark>()  returns 1, then the out-of-band data can be read using the B<MSG_OOB> flag of B<recv>(2)."
5757 msgstr "B<sockatmark>()  が 1 を返す場合、帯域外データは B<MSG_OOB> を指定した B<recv>(2)  で読み込むことができる。"
5758
5759 #. type: Plain text
5760 #: build/C/man3/sockatmark.3:89
5761 msgid "Out-of-band data is supported only on some stream socket protocols."
5762 msgstr "帯域外データは、いくつかのストリームソケットプロトコルでしか サポートされていない。"
5763
5764 #. type: Plain text
5765 #: build/C/man3/sockatmark.3:94
5766 msgid "B<sockatmark>()  can safely be called from a handler for the B<SIGURG> signal."
5767 msgstr "B<sockatmark>()  は B<SIGURG> シグナルのハンドラーから安全に呼び出すことができる。"
5768
5769 #. type: Plain text
5770 #: build/C/man3/sockatmark.3:100
5771 msgid "B<sockatmark>()  is implemented using the B<SIOCATMARK> B<ioctl>(2)  operation."
5772 msgstr "B<sockatmark>()  は B<SIOCATMARK> B<ioctl>(2)  操作を使って実装されている。"
5773
5774 #. type: Plain text
5775 #: build/C/man3/sockatmark.3:104
5776 msgid "Prior to glibc 2.4, B<sockatmark>()  did not work."
5777 msgstr "glibc 2.4 より前のバージョンでは、 B<sockatmark>()  は動作しない。"
5778
5779 #. type: Plain text
5780 #: build/C/man3/sockatmark.3:109
5781 msgid "The following code can be used after receipt of a B<SIGURG> signal to read (and discard) all data up to the mark, and then read the byte of data at the mark:"
5782 msgstr "以下のコードは、 B<SIGURG> シグナルを受け取った後にマークまでの全てのデータを読み込んで (破棄し)、 マークされたデータのバイトを読み込むのに使用できる。"
5783
5784 #. type: Plain text
5785 #: build/C/man3/sockatmark.3:114
5786 #, no-wrap
5787 msgid ""
5788 "    char buf[BUF_LEN];\n"
5789 "    char oobdata;\n"
5790 "    int atmark, s;\n"
5791 msgstr ""
5792 "    char buf[BUF_LEN];\n"
5793 "    char oobdata;\n"
5794 "    int atmark, s;\n"
5795
5796 #. type: Plain text
5797 #: build/C/man3/sockatmark.3:121
5798 #, no-wrap
5799 msgid ""
5800 "    for (;;) {\n"
5801 "        atmark = sockatmark(sockfd);\n"
5802 "        if (atmark == -1) {\n"
5803 "            perror(\"sockatmark\");\n"
5804 "            break;\n"
5805 "        }\n"
5806 msgstr ""
5807 "    for (;;) {\n"
5808 "        atmark = sockatmark(sockfd);\n"
5809 "        if (atmark == -1) {\n"
5810 "            perror(\"sockatmark\");\n"
5811 "            break;\n"
5812 "        }\n"
5813
5814 #. type: Plain text
5815 #: build/C/man3/sockatmark.3:124
5816 #, no-wrap
5817 msgid ""
5818 "        if (atmark)\n"
5819 "            break;\n"
5820 msgstr ""
5821 "        if (atmark)\n"
5822 "            break;\n"
5823
5824 #. type: Plain text
5825 #: build/C/man3/sockatmark.3:131
5826 #, no-wrap
5827 msgid ""
5828 "        s = read(sockfd, buf, BUF_LEN) E<lt>= 0);\n"
5829 "        if (s == -1)\n"
5830 "            perror(\"read\");\n"
5831 "        if (s E<lt>= 0)\n"
5832 "            break;\n"
5833 "    }\n"
5834 msgstr ""
5835 "        s = read(sockfd, buf, BUF_LEN) E<lt>= 0);\n"
5836 "        if (s == -1)\n"
5837 "            perror(\"read\");\n"
5838 "        if (s E<lt>= 0)\n"
5839 "            break;\n"
5840 "    }\n"
5841
5842 #. type: Plain text
5843 #: build/C/man3/sockatmark.3:138
5844 #, no-wrap
5845 msgid ""
5846 "    if (atmark == 1) {\n"
5847 "        if (recv(sockfd, &oobdata, 1, MSG_OOB) == -1) {\n"
5848 "            perror(\"recv\");\n"
5849 "            ...\n"
5850 "        }\n"
5851 "    }\n"
5852 msgstr ""
5853 "    if (atmark == 1) {\n"
5854 "        if (recv(sockfd, &oobdata, 1, MSG_OOB) == -1) {\n"
5855 "            perror(\"recv\");\n"
5856 "            ...\n"
5857 "        }\n"
5858 "    }\n"
5859
5860 #. type: Plain text
5861 #: build/C/man3/sockatmark.3:144
5862 msgid "B<fcntl>(2), B<recv>(2), B<send>(2), B<tcp>(7)"
5863 msgstr "B<fcntl>(2), B<recv>(2), B<send>(2), B<tcp>(7)"
5864
5865 #. type: TH
5866 #: build/C/man2/socket.2:43 build/C/man7/socket.7:58
5867 #, no-wrap
5868 msgid "SOCKET"
5869 msgstr "SOCKET"
5870
5871 #. type: TH
5872 #: build/C/man2/socket.2:43
5873 #, no-wrap
5874 msgid "2013-12-31"
5875 msgstr "2013-12-31"
5876
5877 #. type: Plain text
5878 #: build/C/man2/socket.2:46
5879 msgid "socket - create an endpoint for communication"
5880 msgstr "socket - 通信のための端点(endpoint)を作成する"
5881
5882 #. type: Plain text
5883 #: build/C/man2/socket.2:48 build/C/man2/socketpair.2:47
5884 msgid "B<#include E<lt>sys/types.hE<gt>> /* See NOTES */"
5885 msgstr "B<#include E<lt>sys/types.hE<gt>> /* 「注意」参照 */"
5886
5887 #. type: Plain text
5888 #: build/C/man2/socket.2:52
5889 msgid "B<int socket(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<);>"
5890 msgstr "B<int socket(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<);>"
5891
5892 #. type: Plain text
5893 #: build/C/man2/socket.2:55
5894 msgid "B<socket>()  creates an endpoint for communication and returns a descriptor."
5895 msgstr "B<socket>()  は通信のための端点(endpoint)を作成し、ディスクリプター(descriptor)を返す。"
5896
5897 #. type: Plain text
5898 #: build/C/man2/socket.2:63
5899 msgid "The I<domain> argument specifies a communication domain; this selects the protocol family which will be used for communication.  These families are defined in I<E<lt>sys/socket.hE<gt>>.  The currently understood formats include:"
5900 msgstr "I<domain> 引数は通信を行なうドメインを指定する; これはどの プロトコルファミリー(protocol family)を通信に使用するかを指定する。 これらのファミリーは I<E<lt>sys/socket.hE<gt>> に定義されている。 現在、理解できるフォーマットは以下の通り。"
5901
5902 #. type: tbl table
5903 #: build/C/man2/socket.2:66
5904 #, no-wrap
5905 msgid "Name:Purpose:Man page\n"
5906 msgstr "名前:目的:マニュアル\n"
5907
5908 #. type: tbl table
5909 #: build/C/man2/socket.2:67 build/C/man2/socket.2:74 build/C/man2/socket.2:79
5910 #: build/C/man2/socket.2:84 build/C/man2/socket.2:87 build/C/man2/socket.2:94
5911 #: build/C/man2/socket.2:99 build/C/man2/socket.2:104
5912 #: build/C/man2/socket.2:107 build/C/man2/socket.2:112
5913 #, no-wrap
5914 msgid "T{\n"
5915 msgstr "T{\n"
5916
5917 #. type: tbl table
5918 #: build/C/man2/socket.2:68
5919 #, no-wrap
5920 msgid "B<AF_UNIX>, B<AF_LOCAL>\n"
5921 msgstr "B<AF_UNIX>, B<AF_LOCAL>\n"
5922
5923 #. type: tbl table
5924 #: build/C/man2/socket.2:69 build/C/man2/socket.2:71 build/C/man2/socket.2:89
5925 #: build/C/man2/socket.2:91 build/C/man2/socket.2:101
5926 #: build/C/man2/socket.2:114 build/C/man2/socket.2:116
5927 #: build/C/man7/socket.7:194
5928 #, no-wrap
5929 msgid "T}:T{\n"
5930 msgstr "T}:T{\n"
5931
5932 #. type: tbl table
5933 #: build/C/man2/socket.2:70
5934 #, no-wrap
5935 msgid "Local communication\n"
5936 msgstr "ローカル通信\n"
5937
5938 #. type: tbl table
5939 #: build/C/man2/socket.2:72
5940 #, no-wrap
5941 msgid "B<unix>(7)\n"
5942 msgstr "B<unix>(7)\n"
5943
5944 #. type: tbl table
5945 #: build/C/man2/socket.2:73 build/C/man2/socket.2:78 build/C/man2/socket.2:83
5946 #: build/C/man2/socket.2:93 build/C/man2/socket.2:98 build/C/man2/socket.2:111
5947 #: build/C/man2/socket.2:118 build/C/man7/socket.7:173
5948 #: build/C/man7/socket.7:177 build/C/man7/socket.7:180
5949 #: build/C/man7/socket.7:186 build/C/man7/socket.7:189
5950 #: build/C/man7/socket.7:198 build/C/man7/socket.7:205
5951 #, no-wrap
5952 msgid "T}\n"
5953 msgstr "T}\n"
5954
5955 #. type: tbl table
5956 #: build/C/man2/socket.2:75
5957 #, no-wrap
5958 msgid "B<AF_INET>\n"
5959 msgstr "B<AF_INET>\n"
5960
5961 #. type: tbl table
5962 #: build/C/man2/socket.2:76
5963 #, no-wrap
5964 msgid "T}:IPv4 Internet protocols:T{\n"
5965 msgstr "T}:IPv4 インターネットプロトコル:T{\n"
5966
5967 #. type: tbl table
5968 #: build/C/man2/socket.2:77
5969 #, no-wrap
5970 msgid "B<ip>(7)\n"
5971 msgstr "B<ip>(7)\n"
5972
5973 #. type: tbl table
5974 #: build/C/man2/socket.2:80
5975 #, no-wrap
5976 msgid "B<AF_INET6>\n"
5977 msgstr "B<AF_INET6>\n"
5978
5979 #. type: tbl table
5980 #: build/C/man2/socket.2:81
5981 #, no-wrap
5982 msgid "T}:IPv6 Internet protocols:T{\n"
5983 msgstr "T}:IPv6 インターネットプロトコル:T{\n"
5984
5985 #. type: tbl table
5986 #: build/C/man2/socket.2:82
5987 #, no-wrap
5988 msgid "B<ipv6>(7)\n"
5989 msgstr "B<ipv6>(7)\n"
5990
5991 #. type: tbl table
5992 #: build/C/man2/socket.2:85
5993 #, no-wrap
5994 msgid "B<AF_IPX>\n"
5995 msgstr "B<AF_IPX>\n"
5996
5997 #. type: tbl table
5998 #: build/C/man2/socket.2:86
5999 #, no-wrap
6000 msgid "T}:IPX - Novell protocols:\n"
6001 msgstr "T}:IPX - Novell プロトコル:\n"
6002
6003 #. type: tbl table
6004 #: build/C/man2/socket.2:88
6005 #, no-wrap
6006 msgid "B<AF_NETLINK>\n"
6007 msgstr "B<AF_NETLINK>\n"
6008
6009 #. type: tbl table
6010 #: build/C/man2/socket.2:90
6011 #, no-wrap
6012 msgid "Kernel user interface device\n"
6013 msgstr "カーネルユーザーインターフェースデバイス\n"
6014
6015 #. type: tbl table
6016 #: build/C/man2/socket.2:92
6017 #, no-wrap
6018 msgid "B<netlink>(7)\n"
6019 msgstr "B<netlink>(7)\n"
6020
6021 #. type: tbl table
6022 #: build/C/man2/socket.2:95
6023 #, no-wrap
6024 msgid "B<AF_X25>\n"
6025 msgstr "B<AF_X25>\n"
6026
6027 #. type: tbl table
6028 #: build/C/man2/socket.2:96
6029 #, no-wrap
6030 msgid "T}:ITU-T X.25 / ISO-8208 protocol:T{\n"
6031 msgstr "T}:ITU-T X.25 / ISO-8208 プロトコル:T{\n"
6032
6033 #. type: tbl table
6034 #: build/C/man2/socket.2:97
6035 #, no-wrap
6036 msgid "B<x25>(7)\n"
6037 msgstr "B<x25>(7)\n"
6038
6039 #. type: tbl table
6040 #: build/C/man2/socket.2:100
6041 #, no-wrap
6042 msgid "B<AF_AX25>\n"
6043 msgstr "B<AF_AX25>\n"
6044
6045 #. type: tbl table
6046 #: build/C/man2/socket.2:102
6047 #, no-wrap
6048 msgid "Amateur radio AX.25 protocol\n"
6049 msgstr "アマチュア無線 AX.25 プロトコル\n"
6050
6051 #. type: tbl table
6052 #: build/C/man2/socket.2:103
6053 #, no-wrap
6054 msgid "T}:\n"
6055 msgstr "T}:\n"
6056
6057 #. type: tbl table
6058 #: build/C/man2/socket.2:105
6059 #, no-wrap
6060 msgid "B<AF_ATMPVC>\n"
6061 msgstr "B<AF_ATMPVC>\n"
6062
6063 #. type: tbl table
6064 #: build/C/man2/socket.2:106
6065 #, no-wrap
6066 msgid "T}:Access to raw ATM PVCs:\n"
6067 msgstr "T}:生の ATM PVC にアクセスする:\n"
6068
6069 #. type: tbl table
6070 #: build/C/man2/socket.2:108
6071 #, no-wrap
6072 msgid "B<AF_APPLETALK>\n"
6073 msgstr "B<AF_APPLETALK>\n"
6074
6075 #. type: tbl table
6076 #: build/C/man2/socket.2:109
6077 #, no-wrap
6078 msgid "T}:AppleTalk:T{\n"
6079 msgstr "T}:AppleTalk:T{\n"
6080
6081 #. type: tbl table
6082 #: build/C/man2/socket.2:110
6083 #, no-wrap
6084 msgid "B<ddp>(7)\n"
6085 msgstr "B<ddp>(7)\n"
6086
6087 #. type: tbl table
6088 #: build/C/man2/socket.2:113
6089 #, no-wrap
6090 msgid "B<AF_PACKET>\n"
6091 msgstr "B<AF_PACKET>\n"
6092
6093 #. type: tbl table
6094 #: build/C/man2/socket.2:115
6095 #, no-wrap
6096 msgid "Low level packet interface\n"
6097 msgstr "低レベルのパケットインターフェース\n"
6098
6099 #. type: tbl table
6100 #: build/C/man2/socket.2:117
6101 #, no-wrap
6102 msgid "B<packet>(7)\n"
6103 msgstr "B<packet>(7)\n"
6104
6105 #. type: Plain text
6106 #: build/C/man2/socket.2:126
6107 msgid "The socket has the indicated I<type>, which specifies the communication semantics.  Currently defined types are:"
6108 msgstr "ソケットは I<type> で指定される型を持ち、それは通信方式(semantics)を指定する。 定義されている型は現在以下の通り。"
6109
6110 #. type: TP
6111 #: build/C/man2/socket.2:126
6112 #, no-wrap
6113 msgid "B<SOCK_STREAM>"
6114 msgstr "B<SOCK_STREAM>"
6115
6116 #. type: Plain text
6117 #: build/C/man2/socket.2:130
6118 msgid "Provides sequenced, reliable, two-way, connection-based byte streams.  An out-of-band data transmission mechanism may be supported."
6119 msgstr "順序性と信頼性があり、双方向の、接続された バイトストリーム(byte stream)を提供する。 帯域外(out-of-band)データ転送メカニズムもサポートされる。"
6120
6121 #. type: TP
6122 #: build/C/man2/socket.2:130
6123 #, no-wrap
6124 msgid "B<SOCK_DGRAM>"
6125 msgstr "B<SOCK_DGRAM>"
6126
6127 #. type: Plain text
6128 #: build/C/man2/socket.2:134
6129 msgid "Supports datagrams (connectionless, unreliable messages of a fixed maximum length)."
6130 msgstr "データグラム (コネクションレス、信頼性無し、固定最大長メッセージ) をサポートする。"
6131
6132 #. type: TP
6133 #: build/C/man2/socket.2:134
6134 #, no-wrap
6135 msgid "B<SOCK_SEQPACKET>"
6136 msgstr "B<SOCK_SEQPACKET>"
6137
6138 #. type: Plain text
6139 #: build/C/man2/socket.2:139
6140 msgid "Provides a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each input system call."
6141 msgstr "固定最大長のデータグラム転送パスに基づいた順序性、信頼性のある 双方向の接続に基づいた通信を提供する。受け取り側ではそれぞれの入力 システムコールでパケット全体を読み取ることが要求される。"
6142
6143 #. type: TP
6144 #: build/C/man2/socket.2:139
6145 #, no-wrap
6146 msgid "B<SOCK_RAW>"
6147 msgstr "B<SOCK_RAW>"
6148
6149 #. type: Plain text
6150 #: build/C/man2/socket.2:142
6151 msgid "Provides raw network protocol access."
6152 msgstr "生のネットワークプロトコルへのアクセスを提供する。"
6153
6154 #. type: TP
6155 #: build/C/man2/socket.2:142
6156 #, no-wrap
6157 msgid "B<SOCK_RDM>"
6158 msgstr "B<SOCK_RDM>"
6159
6160 #. type: Plain text
6161 #: build/C/man2/socket.2:145
6162 msgid "Provides a reliable datagram layer that does not guarantee ordering."
6163 msgstr "信頼性はあるが、順序は保証しないデータグラム層を提供する。"
6164
6165 #. type: TP
6166 #: build/C/man2/socket.2:145
6167 #, no-wrap
6168 msgid "B<SOCK_PACKET>"
6169 msgstr "B<SOCK_PACKET>"
6170
6171 #. type: Plain text
6172 #: build/C/man2/socket.2:150
6173 msgid "Obsolete and should not be used in new programs; see B<packet>(7)."
6174 msgstr "廃止されており新しいプログラムで使用してはいけない。 B<packet>(7)  を参照すること"
6175
6176 #. type: Plain text
6177 #: build/C/man2/socket.2:152
6178 msgid "Some socket types may not be implemented by all protocol families."
6179 msgstr "ある種のソケット型が全てのプロトコルファミリーで実装されているわけではない。"
6180
6181 #. type: Plain text
6182 #: build/C/man2/socket.2:160
6183 msgid "Since Linux 2.6.27, the I<type> argument serves a second purpose: in addition to specifying a socket type, it may include the bitwise OR of any of the following values, to modify the behavior of B<socket>():"
6184 msgstr "Linux 2.6.27 以降では、 I<type> 引数は二つ目の目的にも使用される。 ソケットの型を指定するのに加えて、 以下の値のいくつかをビット単位の論理和 (OR) で指定することで、 B<socket>()  の振舞いを変更することができる。"
6185
6186 #. type: Plain text
6187 #: build/C/man2/socket.2:194
6188 msgid "The I<protocol> specifies a particular protocol to be used with the socket.  Normally only a single protocol exists to support a particular socket type within a given protocol family, in which case I<protocol> can be specified as 0.  However, it is possible that many protocols may exist, in which case a particular protocol must be specified in this manner.  The protocol number to use is specific to the ``communication domain'' in which communication is to take place; see B<protocols>(5).  See B<getprotoent>(3)  on how to map protocol name strings to protocol numbers."
6189 msgstr "I<protocol> はソケットによって使用される固有のプロトコルを指定する。通常それぞれの ソケットは、与えられたプロトコルファミリーの種類ごとに一つのプロトコルのみを サポートする。 その場合は I<protocol> に 0 を指定できる。 しかし、多くのプロトコルが存在してもかまわない。 この場合にはこの方法により固有のプロトコルを指定する必要がある。 使用されるプロトコル番号は通信の行なわれる``通信ドメイン''に 固有である; B<protocols>(5)  を参照すること。 プロトコル名をどうやってプロトコル番号に対応させるかについては B<getprotoent>(3)  を参照すること。"
6190
6191 #. type: Plain text
6192 #: build/C/man2/socket.2:224
6193 msgid "Sockets of type B<SOCK_STREAM> are full-duplex byte streams.  They do not preserve record boundaries.  A stream socket must be in a I<connected> state before any data may be sent or received on it.  A connection to another socket is created with a B<connect>(2)  call.  Once connected, data may be transferred using B<read>(2)  and B<write>(2)  calls or some variant of the B<send>(2)  and B<recv>(2)  calls.  When a session has been completed a B<close>(2)  may be performed.  Out-of-band data may also be transmitted as described in B<send>(2)  and received as described in B<recv>(2)."
6194 msgstr "B<SOCK_STREAM> 型のソケットは全二重バイトストリームである。 これらはレコード境界を保存しない。 ストリームは、ソケットがデータを送ったり受けたりする前に I<接続された> 状態になってなければならない。他のソケットへの接続は B<connect>(2)  コールによって行なわれる。一度接続したらデータは B<read>(2)  と B<write>(2)  コールや B<send>(2)  と B<recv>(2)  コールの変種を使用して転送できる。 セッションが完了したら B<close>(2)  が行なわれる。帯域外データの転送も B<send>(2)  に記述されており、 受信も B<recv>(2)  に記述されている。"
6195
6196 #. type: Plain text
6197 #: build/C/man2/socket.2:250
6198 msgid "The communications protocols which implement a B<SOCK_STREAM> ensure that data is not lost or duplicated.  If a piece of data for which the peer protocol has buffer space cannot be successfully transmitted within a reasonable length of time, then the connection is considered to be dead.  When B<SO_KEEPALIVE> is enabled on the socket the protocol checks in a protocol-specific manner if the other end is still alive.  A B<SIGPIPE> signal is raised if a process sends or receives on a broken stream; this causes naive processes, which do not handle the signal, to exit.  B<SOCK_SEQPACKET> sockets employ the same system calls as B<SOCK_STREAM> sockets.  The only difference is that B<read>(2)  calls will return only the amount of data requested, and any data remaining in the arriving packet will be discarded.  Also all message boundaries in incoming datagrams are preserved."
6199 msgstr "B<SOCK_STREAM> を実装した通信プロトコルはデータに損失や重複がないことを保証する。 もし相手のプロトコルがバッファー空間を持つ データの断片を適当な時間のうちに転送できなければ、 接続は断たれたとみなす。そのソケット B<SO_KEEPALIVE> が有効になっている場合、プロトコル独自の方法で接続の相手側がまだ 有効であるかをチェックする。 もしプロセスが、壊れたストリームでデータを送受信しようとした場合には B<SIGPIPE> シグナルが送られる; これは通常のそのシグナルを扱っていないプロセスを 終了させる。 B<SOCK_SEQPACKET> ソケットは B<SOCK_STREAM> ソケットと同じシステムコールを使用する。 唯一の違いは B<read>(2)  コールが要求された量のデータのみを返し、到着したパケットの残りの部分を 捨ててしまうことである。同様に入ってくるデータグラムの全てのメッセージ境界は 保存される。"
6200
6201 #. type: Plain text
6202 #: build/C/man2/socket.2:260
6203 msgid "B<SOCK_DGRAM> and B<SOCK_RAW> sockets allow sending of datagrams to correspondents named in B<sendto>(2)  calls.  Datagrams are generally received with B<recvfrom>(2), which returns the next datagram along with the address of its sender."
6204 msgstr "B<SOCK_DGRAM> と B<SOCK_RAW> ソケットは B<sendto>(2)  コールで指定された相手へデータグラムを送ることが許されている。 データグラムは一般に B<recvfrom>(2)  で受けとり、 このコールは次のデータグラムを送信者のアドレスと一緒に返す。"
6205
6206 #. type: Plain text
6207 #: build/C/man2/socket.2:267
6208 msgid "B<SOCK_PACKET> is an obsolete socket type to receive raw packets directly from the device driver.  Use B<packet>(7)  instead."
6209 msgstr "B<SOCK_PACKET> は古いソケット型で、生(raw)のパケットをデバイスドライバから 直接受信するためのものである。 今は代わりに B<packet>(7)  を用いること。"
6210
6211 #. type: Plain text
6212 #: build/C/man2/socket.2:290
6213 msgid "An B<fcntl>(2)  B<F_SETOWN> operation can be used to specify a process or process group to receive a B<SIGURG> signal when the out-of-band data arrives or B<SIGPIPE> signal when a B<SOCK_STREAM> connection breaks unexpectedly.  This operation may also be used to set the process or process group that receives the I/O and asynchronous notification of I/O events via B<SIGIO>.  Using B<F_SETOWN> is equivalent to an B<ioctl>(2)  call with the B<FIOSETOWN> or B<SIOCSPGRP> argument."
6214 msgstr "B<fcntl>(2)  の B<F_SETOWN> 操作を使って、シグナル B<SIGURG> や B<SIGPIPE> を受けとるプロセスグループを指定できる。 B<SIGURG> シグナルは帯域外データが到着した時に、 B<SIGPIPE> シグナルは B<SOCK_STREAM> 接続が予期せず切断された時に送られる。 また、 B<F_SETOWN> 操作は、I/O や I/O イベントの非同期 (asynchronous) 通知を B<SIGIO> を経由で受け取るプロセスやプロセスグループを設定するのにも使用できる。 B<F_SETOWN> を使用することは B<FIOSETOWN> または B<SIOCSPGRP> の引数で B<ioctl>(2)  を使用することと等価である。"
6215
6216 #. type: Plain text
6217 #: build/C/man2/socket.2:300
6218 msgid "When the network signals an error condition to the protocol module (e.g., using a ICMP message for IP) the pending error flag is set for the socket.  The next operation on this socket will return the error code of the pending error.  For some protocols it is possible to enable a per-socket error queue to retrieve detailed information about the error; see B<IP_RECVERR> in B<ip>(7)."
6219 msgstr "ネットワークがプロトコルモジュールにエラー状態を伝えた場合 (例えば、IP の ICMP メッセージを使用して)には、ソケットの ペンディングエラーフラグが設定される。次にこのソケットを操作した 時にペンディングされていたエラーコードが返される。プロトコルによっては エラーについてのより詳しい情報を受け取るためにソケットごとのエラーキューを 受け取ることが可能である。 B<ip>(7)  の B<IP_RECVERR> を参照すること。"
6220
6221 #. type: Plain text
6222 #: build/C/man2/socket.2:310
6223 msgid "The operation of sockets is controlled by socket level I<options>.  These options are defined in I<E<lt>sys/socket.hE<gt>>.  The functions B<setsockopt>(2)  and B<getsockopt>(2)  are used to set and get options, respectively."
6224 msgstr "ソケットの操作はソケットレベル I<options> によって制御される。 これらのオプションは I<E<lt>sys/socket.hE<gt>> に定義されている。 B<setsockopt>(2)  と B<getsockopt>(2)  関数はそれぞれオプションの設定と取得を行なう。"
6225
6226 #. type: Plain text
6227 #: build/C/man2/socket.2:315
6228 msgid "On success, a file descriptor for the new socket is returned.  On error, -1 is returned, and I<errno> is set appropriately."
6229 msgstr "成功した場合、新しいソケットのファイルディスクリプターを返す。 エラーが発生した場合は -1 を返し、 I<errno> を適切に設定する。"
6230
6231 #. type: Plain text
6232 #: build/C/man2/socket.2:320
6233 msgid "Permission to create a socket of the specified type and/or protocol is denied."
6234 msgstr "指定されたタイプまたはプロトコルのソケットを作成する許可が与えられていない。"
6235
6236 #. type: Plain text
6237 #: build/C/man2/socket.2:323
6238 msgid "The implementation does not support the specified address family."
6239 msgstr "指定されたアドレスファミリーがサポートされていない。"
6240
6241 #. type: Plain text
6242 #: build/C/man2/socket.2:326
6243 msgid "Unknown protocol, or protocol family not available."
6244 msgstr "知らないプロトコル、または利用できないプロトコルファミリーである。"
6245
6246 #.  Since Linux 2.6.27
6247 #. type: Plain text
6248 #: build/C/man2/socket.2:331
6249 msgid "Invalid flags in I<type>."
6250 msgstr "I<type> に無効なフラグが指定されている。"
6251
6252 #. type: Plain text
6253 #: build/C/man2/socket.2:334
6254 msgid "Process file table overflow."
6255 msgstr "プロセスのファイルテーブルが溢れている。"
6256
6257 #. type: TP
6258 #: build/C/man2/socket.2:337
6259 #, no-wrap
6260 msgid "B<ENOBUFS> or B<ENOMEM>"
6261 msgstr "B<ENOBUFS> または B<ENOMEM>"
6262
6263 #. type: Plain text
6264 #: build/C/man2/socket.2:342
6265 msgid "Insufficient memory is available.  The socket cannot be created until sufficient resources are freed."
6266 msgstr "十分なメモリーがない。十分な資源が解放されるまではソケットを 作成することはできない。"
6267
6268 #. type: TP
6269 #: build/C/man2/socket.2:342 build/C/man2/socketpair.2:92
6270 #, no-wrap
6271 msgid "B<EPROTONOSUPPORT>"
6272 msgstr "B<EPROTONOSUPPORT>"
6273
6274 #. type: Plain text
6275 #: build/C/man2/socket.2:346
6276 msgid "The protocol type or the specified protocol is not supported within this domain."
6277 msgstr "このドメインでは指定されたプロトコルまたはプロトコルタイプが サポートされていない。"
6278
6279 #. type: Plain text
6280 #: build/C/man2/socket.2:348
6281 msgid "Other errors may be generated by the underlying protocol modules."
6282 msgstr "下位のプロトコルモジュールから他のエラーが生成されるかもしれない。"
6283
6284 #. type: Plain text
6285 #: build/C/man2/socket.2:350
6286 msgid "4.4BSD, POSIX.1-2001."
6287 msgstr "4.4BSD, POSIX.1-2001."
6288
6289 #. type: Plain text
6290 #: build/C/man2/socket.2:356
6291 msgid "The B<SOCK_NONBLOCK> and B<SOCK_CLOEXEC> flags are Linux-specific."
6292 msgstr "フラグ B<SOCK_NONBLOCK>, B<SOCK_CLOEXEC> は Linux 固有である。"
6293
6294 #. type: Plain text
6295 #: build/C/man2/socket.2:362
6296 msgid "B<socket>()  appeared in 4.2BSD.  It is generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System\\ V variants)."
6297 msgstr "B<socket>()  は 4.2BSD で登場した。一般に、(System\\ V の変種を含めて)  BSD のソケット層の互換性をサポートしている BSD 以外のシステムへの、 または、BSD 以外のシステムからの移植ができる。"
6298
6299 #. type: Plain text
6300 #: build/C/man2/socket.2:381
6301 msgid "The manifest constants used under 4.x BSD for protocol families are B<PF_UNIX>, B<PF_INET>, and so on, while B<AF_UNIX>, B<AF_INET>, and so on are used for address families.  However, already the BSD man page promises: \"The protocol family generally is the same as the address family\", and subsequent standards use AF_* everywhere."
6302 msgstr ""
6303 "4.x BSD において定数を使用する場合、プロトコルファミリーには\n"
6304 "B<PF_UNIX>, B<PF_INET> 等を使用している。一方でアドレスファミリーには\n"
6305 "B<AF_UNIX>, B<AF_INET> 等が使用されている。\n"
6306 "しかしながら BSD のマニュアルでは 「一般にプロトコルファミリーは\n"
6307 "アドレスファミリーと同じものである。」 と保証している。\n"
6308 "それ以外の規格では全ての場所で AF_* が使用されている。"
6309
6310 #. type: Plain text
6311 #: build/C/man2/socket.2:386
6312 msgid "An example of the use of B<socket>()  is shown in B<getaddrinfo>(3)."
6313 msgstr "B<socket>()  の利用例が B<getaddrinfo>(3)  に記載されている。"
6314
6315 #. type: Plain text
6316 #: build/C/man2/socket.2:409
6317 msgid "B<accept>(2), B<bind>(2), B<connect>(2), B<fcntl>(2), B<getpeername>(2), B<getsockname>(2), B<getsockopt>(2), B<ioctl>(2), B<listen>(2), B<read>(2), B<recv>(2), B<select>(2), B<send>(2), B<shutdown>(2), B<socketpair>(2), B<write>(2), B<getprotoent>(3), B<ip>(7), B<socket>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
6318 msgstr "B<accept>(2), B<bind>(2), B<connect>(2), B<fcntl>(2), B<getpeername>(2), B<getsockname>(2), B<getsockopt>(2), B<ioctl>(2), B<listen>(2), B<read>(2), B<recv>(2), B<select>(2), B<send>(2), B<shutdown>(2), B<socketpair>(2), B<write>(2), B<getprotoent>(3), B<ip>(7), B<socket>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
6319
6320 #. type: Plain text
6321 #: build/C/man2/socket.2:415
6322 msgid "\\(lqAn Introductory 4.3BSD Interprocess Communication Tutorial\\(rq and \\(lqBSD Interprocess Communication Tutorial\\(rq, reprinted in I<UNIX Programmer's Supplementary Documents Volume 1.>"
6323 msgstr "\\(lqAn Introductory 4.3BSD Interprocess Communication Tutorial\\(rq and \\(lqBSD Interprocess Communication Tutorial\\(rq, (I<UNIX Programmer's Supplementary Documents Volume 1.> として再版された)"
6324
6325 #. type: Plain text
6326 #: build/C/man7/socket.7:61
6327 msgid "socket - Linux socket interface"
6328 msgstr "socket - Linux のソケットインターフェース"
6329
6330 #. type: Plain text
6331 #: build/C/man7/socket.7:65
6332 msgid "I<sockfd>B< = socket(int >I<socket_family>B<, int >I<socket_type>B<, int >I<protocol>B<);>"
6333 msgstr "I<sockfd>B< = socket(int >I<socket_family>B<, int >I<socket_type>B<, int >I<protocol>B<);>"
6334
6335 #. type: Plain text
6336 #: build/C/man7/socket.7:84
6337 msgid "This manual page describes the Linux networking socket layer user interface.  The BSD compatible sockets are the uniform interface between the user process and the network protocol stacks in the kernel.  The protocol modules are grouped into I<protocol families> such as B<AF_INET>, B<AF_IPX>, and B<AF_PACKET>, and I<socket types> such as B<SOCK_STREAM> or B<SOCK_DGRAM>.  See B<socket>(2)  for more information on families and types."
6338 msgstr "このマニュアルページは Linux ネットワークのソケット層に対する ユーザーインターフェースを記述するものである。 BSD 互換ソケットは、ユーザープロセスとカーネル内部の ネットワークプロトコルスタック群との間に、 統一的なインターフェースを提供するものである。 プロトコルモジュールは I<プロトコルファミリー (protocol familiy)> (例: B<AF_INET>, B<AF_IPX>, B<AF_PACKET>)  と I<ソケットタイプ (socket types)> (例: B<SOCK_STREAM>, B<SOCK_DGRAM>)  に分類できる。 これらに関するより詳しい情報は B<socket>(2)  を参照のこと。"
6339
6340 #. type: SS
6341 #: build/C/man7/socket.7:84
6342 #, no-wrap
6343 msgid "Socket-layer functions"
6344 msgstr "ソケット層の関数群"
6345
6346 #. type: Plain text
6347 #: build/C/man7/socket.7:88
6348 msgid "These functions are used by the user process to send or receive packets and to do other socket operations.  For more information see their respective manual pages."
6349 msgstr "これらの関数はユーザープロセスがパケットを送受信したり、その他のソケット操作を 行ったりするために用いられる。詳細はそれぞれのマニュアルページを 見てほしい。"
6350
6351 #. type: Plain text
6352 #: build/C/man7/socket.7:104
6353 msgid "B<socket>(2)  creates a socket, B<connect>(2)  connects a socket to a remote socket address, the B<bind>(2)  function binds a socket to a local socket address, B<listen>(2)  tells the socket that new connections shall be accepted, and B<accept>(2)  is used to get a new socket with a new incoming connection.  B<socketpair>(2)  returns two connected anonymous sockets (implemented only for a few local families like B<AF_UNIX>)"
6354 msgstr "B<socket>(2)  はソケットを生成する。 B<connect>(2)  はソケットをリモートのソケットアドレスに接続する。 B<bind>(2)  はソケットをローカルのソケットアドレスにバインドする。 B<listen>(2)  はソケットに新しい接続が来たら受信するように伝え、 B<accept>(2)  は外部からやってきた接続に対して新しいソケットを得るために用いられる。 B<socketpair>(2)  は互いに接続された二つの名前無しソケット (anonymous socket) を返す (B<AF_UNIX> のような、いくつかのローカルなファミリーでしか実装されていない)。"
6355
6356 #. type: Plain text
6357 #: build/C/man7/socket.7:126
6358 msgid "B<send>(2), B<sendto>(2), and B<sendmsg>(2)  send data over a socket, and B<recv>(2), B<recvfrom>(2), B<recvmsg>(2)  receive data from a socket.  B<poll>(2)  and B<select>(2)  wait for arriving data or a readiness to send data.  In addition, the standard I/O operations like B<write>(2), B<writev>(2), B<sendfile>(2), B<read>(2), and B<readv>(2)  can be used to read and write data."
6359 msgstr "B<send>(2), B<sendto>(2), B<sendmsg>(2)  はソケットを通してデータを送信し、 B<recv>(2)  B<recvfrom>(2), B<recvmsg>(2)  はソケットからデータを受信する。 B<poll>(2)  と B<select>(2)  はデータの到着を待ったり、データ送信の準備ができるまで待ったりする。 さらに、 B<write>(2), B<writev>(2), B<sendfile>(2), B<read>(2), B<readv>(2)  のような標準的な I/O 操作もデータの読み書きに用いることができる。"
6360
6361 #. type: Plain text
6362 #: build/C/man7/socket.7:137
6363 msgid "B<getsockname>(2)  returns the local socket address and B<getpeername>(2)  returns the remote socket address.  B<getsockopt>(2)  and B<setsockopt>(2)  are used to set or get socket layer or protocol options.  B<ioctl>(2)  can be used to set or read some other options."
6364 msgstr "B<getsockbyname>(2)  はローカルのソケットアドレスを返し、 B<getpeername>(2)  はリモートのソケットアドレスを返す。 B<getsockopt>(2)  と B<setsockopt>(2)  はソケット層のオプションやプロトコルオプションの取得・設定に用いられる。 他のいくつかのオプションの取得・設定には B<ioctl>(2)  を使うことができる。"
6365
6366 #. type: Plain text
6367 #: build/C/man7/socket.7:142
6368 msgid "B<close>(2)  is used to close a socket.  B<shutdown>(2)  closes parts of a full-duplex socket connection."
6369 msgstr "B<close>(2)  はソケットをクローズする。 B<shutdown>(2)  は全二重なソケット接続を部分的にクローズする。"
6370
6371 #. type: Plain text
6372 #: build/C/man7/socket.7:148
6373 msgid "Seeking, or calling B<pread>(2)  or B<pwrite>(2)  with a nonzero position is not supported on sockets."
6374 msgstr "シーク動作や、 0 以外の位置に対する B<pread>(2)  や B<pwrite>(2)  はソケットではサポートされていない。"
6375
6376 #. type: Plain text
6377 #: build/C/man7/socket.7:165
6378 msgid "It is possible to do nonblocking I/O on sockets by setting the B<O_NONBLOCK> flag on a socket file descriptor using B<fcntl>(2).  Then all operations that would block will (usually)  return with B<EAGAIN> (operation should be retried later); B<connect>(2)  will return B<EINPROGRESS> error.  The user can then wait for various events via B<poll>(2)  or B<select>(2)."
6379 msgstr "非ブロッキングな I/O をソケットで行うことは可能で、 B<fcntl>(2)  を使ってソケットのファイルディスクリプターに B<O_NONBLOCK> フラグをセットすれば良い。 こうするとブロックされる操作は、 (通常)  B<EAGAIN> エラーで戻ることになる (後で処理が再試行されることが期待されている)。 B<connect>(2)  では B<EINPROGRESS> エラーが返される。 この場合、ユーザーはさまざまなイベントを B<poll>(2)  や B<select>(2)  を使って待つことができる。"
6380
6381 #. type: tbl table
6382 #: build/C/man7/socket.7:169
6383 #, no-wrap
6384 msgid "I/O events\n"
6385 msgstr "I/O イベント\n"
6386
6387 #. type: tbl table
6388 #: build/C/man7/socket.7:170
6389 #, no-wrap
6390 msgid "Event:Poll flag:Occurrence\n"
6391 msgstr "イベント:poll フラグ:内容\n"
6392
6393 #. type: tbl table
6394 #: build/C/man7/socket.7:171 build/C/man7/socket.7:174
6395 #, no-wrap
6396 msgid "Read:POLLIN:T{\n"
6397 msgstr "Read:POLLIN:T{\n"
6398
6399 #. type: tbl table
6400 #: build/C/man7/socket.7:172
6401 #, no-wrap
6402 msgid "New data arrived.\n"
6403 msgstr "新しいデータが到着した。\n"
6404
6405 #. type: tbl table
6406 #: build/C/man7/socket.7:175
6407 #, no-wrap
6408 msgid "A connection setup has been completed\n"
6409 msgstr "(接続志向のソケットで)\n"
6410
6411 #. type: tbl table
6412 #: build/C/man7/socket.7:176
6413 #, no-wrap
6414 msgid "(for connection-oriented sockets)\n"
6415 msgstr "接続の設定が終了した。\n"
6416
6417 #. type: tbl table
6418 #: build/C/man7/socket.7:178 build/C/man7/socket.7:181
6419 #, no-wrap
6420 msgid "Read:POLLHUP:T{\n"
6421 msgstr "Read:POLLHUP:T{\n"
6422
6423 #. type: tbl table
6424 #: build/C/man7/socket.7:179
6425 #, no-wrap
6426 msgid "A disconnection request has been initiated by the other end.\n"
6427 msgstr "接続先で切断要求が生成された。\n"
6428
6429 #. type: tbl table
6430 #: build/C/man7/socket.7:182
6431 #, no-wrap
6432 msgid "A connection is broken (only for connection-oriented protocols).\n"
6433 msgstr "接続が壊れた (接続志向のプロトコルのみ)。\n"
6434
6435 #. type: tbl table
6436 #: build/C/man7/socket.7:183
6437 #, no-wrap
6438 msgid "When the socket is written\n"
6439 msgstr "この場合、ソケットに書き込みが行われると\n"
6440
6441 #. type: tbl table
6442 #: build/C/man7/socket.7:184
6443 #, no-wrap
6444 msgid "B<SIGPIPE>\n"
6445 msgstr "B<SIGPIPE>\n"
6446
6447 #. type: tbl table
6448 #: build/C/man7/socket.7:185
6449 #, no-wrap
6450 msgid "is also sent.\n"
6451 msgstr "も送信される。\n"
6452
6453 #. type: tbl table
6454 #: build/C/man7/socket.7:187
6455 #, no-wrap
6456 msgid "Write:POLLOUT:T{\n"
6457 msgstr "Write:POLLOUT:T{\n"
6458
6459 #. type: tbl table
6460 #: build/C/man7/socket.7:188
6461 #, no-wrap
6462 msgid "Socket has enough send buffer space for writing new data.\n"
6463 msgstr "ソケットには新しいデータを書き込むのに十分なバッファーがある。\n"
6464
6465 #. type: tbl table
6466 #: build/C/man7/socket.7:190
6467 #, no-wrap
6468 msgid "Read/Write:T{\n"
6469 msgstr "Read/Write:T{\n"
6470
6471 #. type: tbl table
6472 #: build/C/man7/socket.7:191
6473 #, no-wrap
6474 msgid "POLLIN|\n"
6475 msgstr "POLLIN|\n"
6476
6477 #. type: tbl table
6478 #: build/C/man7/socket.7:192
6479 #, no-wrap
6480 msgid ".br\n"
6481 msgstr ".br\n"
6482
6483 #. type: tbl table
6484 #: build/C/man7/socket.7:193
6485 #, no-wrap
6486 msgid "POLLOUT\n"
6487 msgstr "POLLOUT\n"
6488
6489 #. type: tbl table
6490 #: build/C/man7/socket.7:195
6491 #, no-wrap
6492 msgid "An outgoing\n"
6493 msgstr "外部向けの\n"
6494
6495 #. type: tbl table
6496 #: build/C/man7/socket.7:196
6497 #, no-wrap
6498 msgid "B<connect>(2)\n"
6499 msgstr "B<connect>(2)\n"
6500
6501 #. type: tbl table
6502 #: build/C/man7/socket.7:197
6503 #, no-wrap
6504 msgid "finished.\n"
6505 msgstr "が終了した。\n"
6506
6507 #. type: tbl table
6508 #: build/C/man7/socket.7:199
6509 #, no-wrap
6510 msgid "Read/Write:POLLERR:An asynchronous error occurred.\n"
6511 msgstr "Read/Write:POLLERR:非同期的 (asynchronous) なエラーが起こった。\n"
6512
6513 #. type: tbl table
6514 #: build/C/man7/socket.7:200
6515 #, no-wrap
6516 msgid "Read/Write:POLLHUP:The other end has shut down one direction.\n"
6517 msgstr "Read/Write:POLLHUP:接続先が片方向を切断した。\n"
6518
6519 #. type: tbl table
6520 #: build/C/man7/socket.7:201
6521 #, no-wrap
6522 msgid "Exception:POLLPRI:T{\n"
6523 msgstr "Exception:POLLPRI:T{\n"
6524
6525 #. type: tbl table
6526 #: build/C/man7/socket.7:202
6527 #, no-wrap
6528 msgid "Urgent data arrived.\n"
6529 msgstr "緊急データ (urgent data) が到着した。この場合は\n"
6530
6531 #. type: tbl table
6532 #: build/C/man7/socket.7:203
6533 #, no-wrap
6534 msgid "B<SIGURG>\n"
6535 msgstr "B<SIGURG>\n"
6536
6537 #. type: tbl table
6538 #: build/C/man7/socket.7:204
6539 #, no-wrap
6540 msgid "is sent then.\n"
6541 msgstr "が送信される。\n"
6542
6543 #. type: Plain text
6544 #: build/C/man7/socket.7:233
6545 msgid "An alternative to B<poll>(2)  and B<select>(2)  is to let the kernel inform the application about events via a B<SIGIO> signal.  For that the B<O_ASYNC> flag must be set on a socket file descriptor via B<fcntl>(2)  and a valid signal handler for B<SIGIO> must be installed via B<sigaction>(2).  See the I<Signals> discussion below."
6546 msgstr "B<poll>(2)  や B<select>(2)  を使う代わりに、カーネルからアプリケーションに イベントを通知させるのに B<SIGIO> シグナルを使う方法もある。 この方法を使うには、 B<fcntl>(2)  を用いてソケットのファイルディスクリプターに B<O_ASYNC> フラグをセットし、 B<SIGIO> に対する有効なシグナルハンドラーを B<sigaction>(2)  によって設定しておく必要がある。 後述の I<シグナル> に関する議論も参考にすること。"
6547
6548 #. type: SS
6549 #: build/C/man7/socket.7:233
6550 #, no-wrap
6551 msgid "Socket address structures"
6552 msgstr "ソケットアドレス構造体"
6553
6554 #. type: Plain text
6555 #: build/C/man7/socket.7:249
6556 msgid "Each socket domain has its own format for socket addresses, with a domain-specific address structure.  Each of these structures begins with an integer \"family\" field (typed as I<sa_family_t>)  that indicates the type of the address structure.  This allows the various system calls (e.g., B<connect>(2), B<bind>(2), B<accept>(2), B<getsockname>(2), B<getpeername>(2)), which are generic to all socket domains, to determine the domain of a particular socket address."
6557 msgstr "各ソケットドメインにはそれぞれ独自のソケットアドレス形式があり、ドメイン固有のアドレス構造体を持っている。 これらの構造体の先頭には、アドレス構造体の種類を示す整数の \"family\" フィールド (型は I<sa_family_t>) がある。 このフィールドにより、 すべてのソケットドメインで汎用的に使用されるシステムコール (例えば、 B<connect>(2), B<bind>(2), B<accept>(2), B<getsockname>(2), B<getpeername>(2) など) が、特定のソケットアドレスのドメインを判定することができる。"
6558
6559 #. type: Plain text
6560 #: build/C/man7/socket.7:259
6561 msgid "To allow any type of socket address to be passed to interfaces in the sockets API, the type I<struct sockaddr> is defined.  The purpose of this type is purely to allow casting of domain-specific socket address types to a \"generic\" type, so as to avoid compiler warnings about type mismatches in calls to the sockets API."
6562 msgstr "任意の種類のソケットアドレスをソケット API のインターフェースに渡せるように、 I<struct sockaddr> 型が定義されている。 この型の目的は、 純粋に、 ドメイン固有のソケットアドレスを 「汎用的な」型にキャストできるようにする点にある。 これにより、 ソケット API 呼び出しにおいて、 コンパイラが型の不一致の警告を出すのを避けることができる。"
6563
6564 #. type: Plain text
6565 #: build/C/man7/socket.7:269
6566 msgid "In addition, the sockets API provides the data type I<struct sockaddr_storage>.  This type is suitable to accommodate all supported domain-specific socket address structures; it is large enough and is aligned properly.  (In particular, it is large enough to hold IPv6 socket addresses.)  The structure includes the following field, which can be used to identify the type of socket address actually stored in the structure:"
6567 msgstr "これに加えて、ソケット API ではデータ型 I<struct sockaddr_storage> が提供されている。 サポートしているすべてのドメイン固有のソケットアドレス構造体を収容するのに、この型を使うことができる。 この型は十分な大きさがあり、(メモリー境界への) アラインも適切に行われている (特に、 IPv6 ソケットアドレスを収容するのにも十分な大きさである)。 この構造体には次のフィールドがあり、 このフィールドを使って、 この構造体に実際に格納されているソケットアドレスの型を特定することができる。"
6568
6569 #. type: Plain text
6570 #: build/C/man7/socket.7:273
6571 #, no-wrap
6572 msgid "    sa_family_t ss_family;\n"
6573 msgstr "    sa_family_t ss_family;\n"
6574
6575 #. type: Plain text
6576 #: build/C/man7/socket.7:281
6577 msgid "The I<sockaddr_storage> structure is useful in programs that must handle socket addresses in a generic way (e.g., programs that must deal with both IPv4 and IPv6 socket addresses)."
6578 msgstr "I<sockaddr_storage> 構造体は、 ソケットアドレスを汎用的な方法で扱う必要があるプログラム (例えば、 IPv4 と IPv6 の両方のソケットアドレスを扱う必要があるプログラム) で有用である。"
6579
6580 #. type: SS
6581 #: build/C/man7/socket.7:281
6582 #, no-wrap
6583 msgid "Socket options"
6584 msgstr "ソケットオプション"
6585
6586 #.  FIXME .
6587 #.  In the list below, the text used to describe argument types
6588 #.  for each socket option should be more consistent
6589 #.  SO_ACCEPTCONN is in POSIX.1-2001, and its origin is explained in
6590 #.  W R Stevens, UNPv1
6591 #. type: Plain text
6592 #: build/C/man7/socket.7:299
6593 msgid "The socket options listed below can be set by using B<setsockopt>(2)  and read with B<getsockopt>(2)  with the socket level set to B<SOL_SOCKET> for all sockets.  Unless otherwise noted, I<optval> is a pointer to an I<int>."
6594 msgstr "これらのソケットオプションは、 B<setsockopt>(2)  を用いれば設定でき、 B<getsockopt>(2)  を用いれば取得できる。 但し、どのソケットの場合も ソケットレベルには B<SOL_SOCKET> を指定すること。 注釈がない限り、 I<optval> は I<int> へのポインターである。"
6595
6596 #. type: TP
6597 #: build/C/man7/socket.7:299
6598 #, no-wrap
6599 msgid "B<SO_ACCEPTCONN>"
6600 msgstr "B<SO_ACCEPTCONN>"
6601
6602 #. type: Plain text
6603 #: build/C/man7/socket.7:307
6604 msgid "Returns a value indicating whether or not this socket has been marked to accept connections with B<listen>(2).  The value 0 indicates that this is not a listening socket, the value 1 indicates that this is a listening socket.  This socket option is read-only."
6605 msgstr "このソケットが B<listen>(2)  によって接続待ち受け状態に設定されているかどうかを示す値を返す。 値 0 は listen 状態のソケットでないことを、 値 1 は listen 状態のソケットであることを示す。このソケットオプションは読み込み専用である。"
6606
6607 #. type: TP
6608 #: build/C/man7/socket.7:307
6609 #, no-wrap
6610 msgid "B<SO_BINDTODEVICE>"
6611 msgstr "B<SO_BINDTODEVICE>"
6612
6613 #. type: Plain text
6614 #: build/C/man7/socket.7:326
6615 msgid "Bind this socket to a particular device like \\(lqeth0\\(rq, as specified in the passed interface name.  If the name is an empty string or the option length is zero, the socket device binding is removed.  The passed option is a variable-length null-terminated interface name string with the maximum size of B<IFNAMSIZ>.  If a socket is bound to an interface, only packets received from that particular interface are processed by the socket.  Note that this works only for some socket types, particularly B<AF_INET> sockets.  It is not supported for packet sockets (use normal B<bind>(2)  there)."
6616 msgstr "このソケットを、引き数で渡したインターフェース名で指定される (\\(lqeth0\\(rq のような) 特定のデバイスにバインドする。 名前が空文字列だったり、オプションの長さ (optlen) が 0 の場合には、 ソケットのバインドが削除される。 渡すオプションは、インターフェース名が 入ったヌル文字で終端された可変長の文字列である。 文字列の最大のサイズは B<IFNAMSIX> である。 ソケットがインターフェースにバインドされると、 その特定のインターフェースから受信されたパケットだけを処理する。 このオプションはいくつかのソケットタイプ、 特に B<AF_INET> に対してのみ動作する点に注意すること。 パケットソケットではサポートされていない (通常の B<bind>(2) を使うこと)。"
6617
6618 #. type: Plain text
6619 #: build/C/man7/socket.7:340
6620 msgid "Before Linux 3.8, this socket option could be set, but could not retrieved with B<getsockopt>(2).  Since Linux 3.8, it is readable.  The I<optlen> argument should contain the buffer size available to receive the device name and is recommended to be B<IFNAMSZ> bytes.  The real device name length is reported back in the I<optlen> argument."
6621 msgstr "Linux 3.8 より前のバージョンでは、このソケットオプションは B<getsockname>(2) で設定することはできたが、取得することができなかった。 Linux 3.8 以降では、読み出すことができる。 I<optlen> 引き数には、 デバイス名を格納するのに十分なバッファーサイズを渡すべきであり、 B<IFNAMSIZ> バイトにすることを推奨する。 実際のデバイス名の長さは I<optlen> 引き数に格納されて返される。"
6622
6623 #. type: TP
6624 #: build/C/man7/socket.7:340
6625 #, no-wrap
6626 msgid "B<SO_BROADCAST>"
6627 msgstr "B<SO_BROADCAST>"
6628
6629 #. type: Plain text
6630 #: build/C/man7/socket.7:346
6631 msgid "Set or get the broadcast flag.  When enabled, datagram sockets are allowed to send packets to a broadcast address.  This option has no effect on stream-oriented sockets."
6632 msgstr ""
6633 "ブロードキャストフラグを設定・取得する。有効になっていると、データグラ\n"
6634 "ムソケットはブロードキャストアドレスにパケットを送信できるようになる。\n"
6635 "ストリーム指向のソケットには何の効果もない。"
6636
6637 #. type: TP
6638 #: build/C/man7/socket.7:346
6639 #, no-wrap
6640 msgid "B<SO_BSDCOMPAT>"
6641 msgstr "B<SO_BSDCOMPAT>"
6642
6643 #. type: Plain text
6644 #: build/C/man7/socket.7:358
6645 msgid "Enable BSD bug-to-bug compatibility.  This is used by the UDP protocol module in Linux 2.0 and 2.2.  If enabled, ICMP errors received for a UDP socket will not be passed to the user program.  In later kernel versions, support for this option has been phased out: Linux 2.4 silently ignores it, and Linux 2.6 generates a kernel warning (printk()) if a program uses this option.  Linux 2.0 also enabled BSD bug-to-bug compatibility options (random header changing, skipping of the broadcast flag) for raw sockets with this option, but that was removed in Linux 2.2."
6646 msgstr "BSD のバグに対して互換性を取るための機能を有効にする。 この機能は Linux 2.0 と 2.2 の UDP プロトコルモジュールで使用されている。 有効になっていると、 UDP ソケットで受信された ICMP エラーは ユーザープログラムに渡されない。 これ以降のバージョンのカーネルでは、このオプションのサポートは 段階的に廃止されてきた。 Linux 2.4 ではこのオプションは黙って無視され、 Linux 2.6 ではプログラムがこのオプションを使用すると (printk() を使って)  カーネルの警告メッセージが出力される。 Linux 2.0 では、このオプションを指定すると、 raw ソケットにおいても BSD のバグ (ランダムヘッダ変更、 ブロードキャストフラグのスキップ)  に対する互換機能が有効になっていた。 しかし、こちらは Linux 2.2 で削除された。"
6647
6648 #. type: TP
6649 #: build/C/man7/socket.7:358
6650 #, no-wrap
6651 msgid "B<SO_DEBUG>"
6652 msgstr "B<SO_DEBUG>"
6653
6654 #. type: Plain text
6655 #: build/C/man7/socket.7:364
6656 msgid "Enable socket debugging.  Only allowed for processes with the B<CAP_NET_ADMIN> capability or an effective user ID of 0."
6657 msgstr "ソケットのデバッグ機能を有効にする。 B<CAP_NET_ADMIN> 権限を持つプロセスか、実効ユーザー ID が 0 のプロセスでしか 利用できない。"
6658
6659 #. type: TP
6660 #: build/C/man7/socket.7:364
6661 #, no-wrap
6662 msgid "B<SO_DOMAIN> (since Linux 2.6.32)"
6663 msgstr "B<SO_DOMAIN> (Linux 2.6.32 以降)"
6664
6665 #. type: Plain text
6666 #: build/C/man7/socket.7:372
6667 msgid "Retrieves the socket domain as an integer, returning a value such as B<AF_INET6>.  See B<socket>(2)  for details.  This socket option is read-only."
6668 msgstr ""
6669 "ソケットドメインを整数で取得する。 B<AF_INET6> のような値が返される。\n"
6670 "詳細は B<socket>(2) を参照。このソケットオプションは読み込み専用である。"
6671
6672 #. type: TP
6673 #: build/C/man7/socket.7:372
6674 #, no-wrap
6675 msgid "B<SO_ERROR>"
6676 msgstr "B<SO_ERROR>"
6677
6678 #. type: Plain text
6679 #: build/C/man7/socket.7:377
6680 msgid "Get and clear the pending socket error.  This socket option is read-only.  Expects an integer."
6681 msgstr ""
6682 "保留になっていたソケットエラーを取得してクリアする。\n"
6683 "このソケットオプションは読み込み専用である。整数値をとる。"
6684
6685 #. type: TP
6686 #: build/C/man7/socket.7:377
6687 #, no-wrap
6688 msgid "B<SO_DONTROUTE>"
6689 msgstr "B<SO_DONTROUTE>"
6690
6691 #. type: Plain text
6692 #: build/C/man7/socket.7:386
6693 msgid "Don't send via a gateway, send only to directly connected hosts.  The same effect can be achieved by setting the B<MSG_DONTROUTE> flag on a socket B<send>(2)  operation.  Expects an integer boolean flag."
6694 msgstr "ゲートウェイを経由せず、直接接続されているホストにのみ送信する。 B<send>(2)  操作で B<MSG_DONTROUTE> フラグをセットした場合も同じ効果が得られる。 ブール整数のフラグを取る。"
6695
6696 #. type: TP
6697 #: build/C/man7/socket.7:386
6698 #, no-wrap
6699 msgid "B<SO_KEEPALIVE>"
6700 msgstr "B<SO_KEEPALIVE>"
6701
6702 #. type: Plain text
6703 #: build/C/man7/socket.7:390
6704 msgid "Enable sending of keep-alive messages on connection-oriented sockets.  Expects an integer boolean flag."
6705 msgstr "接続志向のソケットに対する keep-alive メッセージの送信を有効にする。 ブール値の整数フラグをとる。"
6706
6707 #. type: TP
6708 #: build/C/man7/socket.7:390
6709 #, no-wrap
6710 msgid "B<SO_LINGER>"
6711 msgstr "B<SO_LINGER>"
6712
6713 #. type: Plain text
6714 #: build/C/man7/socket.7:398
6715 msgid "Sets or gets the B<SO_LINGER> option.  The argument is a I<linger> structure."
6716 msgstr "B<SO_LINGER> オプションを取得・設定する。引き数には I<linger> 構造体を取る。"
6717
6718 #. type: Plain text
6719 #: build/C/man7/socket.7:405
6720 #, no-wrap
6721 msgid ""
6722 "struct linger {\n"
6723 "    int l_onoff;    /* linger active */\n"
6724 "    int l_linger;   /* how many seconds to linger for */\n"
6725 "};\n"
6726 msgstr ""
6727 "struct linger {\n"
6728 "    int l_onoff;    /* linger active */\n"
6729 "    int l_linger;   /* how many seconds to linger for */\n"
6730 "};\n"
6731
6732 #. type: Plain text
6733 #: build/C/man7/socket.7:419
6734 msgid "When enabled, a B<close>(2)  or B<shutdown>(2)  will not return until all queued messages for the socket have been successfully sent or the linger timeout has been reached.  Otherwise, the call returns immediately and the closing is done in the background.  When the socket is closed as part of B<exit>(2), it always lingers in the background."
6735 msgstr "有効になっていると、 B<close>(2)  や B<shutdown>(2)  は、そのソケットにキューイングされたメッセージがすべて送信完了するか、 linger (居残り) タイムアウトになるまで返らない。無効になっていると、 これらのコールはただちに戻り、クローズ動作はバックグラウンドで行われる。 ソケットのクローズを B<exit>(2)  の一部として行った場合には、残っているソケットの クローズ動作は必ずバックグラウンドに送られる。"
6736
6737 #. type: TP
6738 #: build/C/man7/socket.7:419
6739 #, no-wrap
6740 msgid "B<SO_MARK> (since Linux 2.6.25)"
6741 msgstr "B<SO_MARK> (Linux 2.6.25 以降)"
6742
6743 #.  commit 4a19ec5800fc3bb64e2d87c4d9fdd9e636086fe0
6744 #.  and    914a9ab386a288d0f22252fc268ecbc048cdcbd5
6745 #. type: Plain text
6746 #: build/C/man7/socket.7:430
6747 msgid "Set the mark for each packet sent through this socket (similar to the netfilter MARK target but socket-based).  Changing the mark can be used for mark-based routing without netfilter or for packet filtering.  Setting this option requires the B<CAP_NET_ADMIN> capability."
6748 msgstr "このソケットから送信される各パケットにマークをセットする (netfilter の MARK ターゲットと似ているが、ソケット単位である点が異なる)。 マークの変更は、 netfilter なしでのマークに基づいてのルーティングや、 パケットフィルタリングに使うことができる。 このオプションを変更するには B<CAP_NET_ADMIN> ケーパビリティが必要である。"
6749
6750 #. type: TP
6751 #: build/C/man7/socket.7:430
6752 #, no-wrap
6753 msgid "B<SO_OOBINLINE>"
6754 msgstr "B<SO_OOBINLINE>"
6755
6756 #.  don't document it because it can do too much harm.
6757 #. .B SO_NO_CHECK
6758 #. type: Plain text
6759 #: build/C/man7/socket.7:439
6760 msgid "If this option is enabled, out-of-band data is directly placed into the receive data stream.  Otherwise, out-of-band data is passed only when the B<MSG_OOB> flag is set during receiving."
6761 msgstr "このオプションを有効にすると、帯域外データ (out-of-band data) は 受信データストリーム中に置かれる。有効にしなければ、 帯域外データは受信時に B<MSG_OOB> フラグがセットされている場合に限って渡される。"
6762
6763 #. type: TP
6764 #: build/C/man7/socket.7:439
6765 #, no-wrap
6766 msgid "B<SO_PASSCRED>"
6767 msgstr "B<SO_PASSCRED>"
6768
6769 #.  FIXME Document SO_PASSSEC, added in 2.6.18; there is some info
6770 #.  in the 2.6.18 ChangeLog
6771 #. type: Plain text
6772 #: build/C/man7/socket.7:448
6773 msgid "Enable or disable the receiving of the B<SCM_CREDENTIALS> control message.  For more information see B<unix>(7)."
6774 msgstr "B<SCM_CREDENTIALS> 制御メッセージの受信を有効/無効にする。詳細は B<unix>(7)  を参照のこと。"
6775
6776 #. type: TP
6777 #: build/C/man7/socket.7:448
6778 #, no-wrap
6779 msgid "B<SO_PEEK_OFF> (since Linux 3.4)"
6780 msgstr "B<SO_PEEK_OFF> (Linux 3.4 以降)"
6781
6782 #.  commit ef64a54f6e558155b4f149bb10666b9e914b6c54
6783 #. type: Plain text
6784 #: build/C/man7/socket.7:458
6785 msgid "This option, which is currently supported only for B<unix>(7)  sockets, sets the value of the \"peek offset\" for the B<recv>(2)  system call when used with B<MSG_PEEK> flag."
6786 msgstr "B<MSG_PEEK> フラグと一緒に使用された場合 B<recv>(2) システムコールの \"peek offset\" にこのオプションの値が設定される。現在のところ、このオプションは B<unix>(7) ソケットでのみサポートされている。"
6787
6788 #. type: Plain text
6789 #: build/C/man7/socket.7:466
6790 msgid "When this option is set to a negative value (it is set to -1 for all new sockets), traditional behavior is provided: B<recv>(2)  with the B<MSG_PEEK> flag will peek data from the front of the queue."
6791 msgstr "このオプションが負の値に設定された場合、従来の動作となる。 つまり B<MSG_PEEK> フラグが指定された B<recv>(2) は、キューの先頭のデータに対して peek 処理を行う (データを読み出すが、キューからデータの削除を行わない)。 新規のソケットではこのオプションの値は必ず -1 に設定される。"
6792
6793 #. type: Plain text
6794 #: build/C/man7/socket.7:473
6795 msgid "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."
6796 msgstr "このオプションに 0 以上の値が設定されると、 そのソケットのキュー上のオプション値で指定されたバイトオフセットにあるデータが次の peek 処理で返される。 同時に、 \"peek offset\" がキューから peek 処理されたバイト数だけ加算される。したがって、次の peek 処理ではキューのその次にあるデータが返される。"
6797
6798 #. type: Plain text
6799 #: build/C/man7/socket.7:485
6800 msgid "If data is removed from the front of the queue via a call to B<recv>(2)  (or similar) without the B<MSG_PEEK> flag, the \"peek offset\" will be decreased by the number of bytes removed.  In other words, receiving data without the B<MSG_PEEK> 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."
6801 msgstr "B<recv>(2) (や同様のシステムコール) の B<MSG_PEEK> フラグなしの呼び出しでキューの先頭のデータが削除された場合、 \"peek offset\" は削除されたバイト数だけ減算される。 言い換えると、 B<MSG_PEEK> フラグなしでデータを受信すると、 \"peek offset\" が指すキュー内の相対的な位置が狂わないように調整され、この後の peek では、 データ削除が行われなかった場合に返されたのと同じ値が返されるということである。"
6802
6803 #. type: Plain text
6804 #: build/C/man7/socket.7:490
6805 msgid "For datagram sockets, if the \"peek offset\" points to the middle of a packet, the data returned will be marked with the B<MSG_TRUNC> flag."
6806 msgstr "データグラムソケットでは、 \"peek offset\" がパケットの途中を指している場合には、 返されるデータには B<MSG_TRUNC> フラグが付与される。"
6807
6808 #. type: Plain text
6809 #: build/C/man7/socket.7:494
6810 msgid "The following example serves to illustrate the use of B<SO_PEEK_OFF>.  Suppose a stream socket has the following queued input data:"
6811 msgstr "以下の例は B<SO_PEEK_OFF> の利用例を示している。ストリームソケットのキューに以下の入力データが入っているものとする。"
6812
6813 #. type: Plain text
6814 #: build/C/man7/socket.7:496
6815 #, no-wrap
6816 msgid "    aabbccddeeff\n"
6817 msgstr "    aabbccddeeff\n"
6818
6819 #. type: Plain text
6820 #: build/C/man7/socket.7:501
6821 msgid "The following sequence of B<recv>(2)  calls would have the effect noted in the comments:"
6822 msgstr "以下の順序で B<recv>(2) の呼び出しを行うと、コメントに書かれた結果となる。"
6823
6824 #. type: Plain text
6825 #: build/C/man7/socket.7:506
6826 #, no-wrap
6827 msgid ""
6828 "int ov = 4;                  // Set peek offset to 4\n"
6829 "setsockopt(fd, SOL_SOCKET, SO_PEEK_OFF, &ov, sizeof(ov));\n"
6830 msgstr ""
6831 "int ov = 4;                  // Set peek offset to 4\n"
6832 "setsockopt(fd, SOL_SOCKET, SO_PEEK_OFF, &ov, sizeof(ov));\n"
6833
6834 #. type: Plain text
6835 #: build/C/man7/socket.7:511
6836 #, no-wrap
6837 msgid ""
6838 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"cc\"; offset set to 6\n"
6839 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"dd\"; offset set to 8\n"
6840 "recv(fd, buf, 2, 0);         // Reads \"aa\"; offset set to 6\n"
6841 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"ee\"; offset set to 8\n"
6842 msgstr ""
6843 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"cc\"; offset set to 6\n"
6844 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"dd\"; offset set to 8\n"
6845 "recv(fd, buf, 2, 0);         // Reads \"aa\"; offset set to 6\n"
6846 "recv(fd, buf, 2, MSG_PEEK);  // Peeks \"ee\"; offset set to 8\n"
6847
6848 #. type: TP
6849 #: build/C/man7/socket.7:513
6850 #, no-wrap
6851 msgid "B<SO_PEERCRED>"
6852 msgstr "B<SO_PEERCRED>"
6853
6854 #. type: Plain text
6855 #: build/C/man7/socket.7:536
6856 msgid "Return the credentials of the foreign process connected to this socket.  This is possible only for connected B<AF_UNIX> stream sockets and B<AF_UNIX> stream and datagram socket pairs created using B<socketpair>(2); see B<unix>(7).  The returned credentials are those that were in effect at the time of the call to B<connect>(2)  or B<socketpair>(2).  The argument is a I<ucred> structure; define the B<_GNU_SOURCE> feature test macro to obtain the definition of that structure from I<E<lt>sys/socket.hE<gt>>.  This socket option is read-only."
6857 msgstr "このソケットに接続してきた外部プロセスの信任状 (credential) を返す。このソケットオプションが利用できるのは、接続された B<AF_UNIX> ストリームソケット間、および B<socketpair>(2) を使って作成された B<AF_UNIX> のストリームソケットとデータグラムソケットのペアだけである。 B<unix>(7)  を参照のこと。 B<connect>(2) や B<socketpair>(2) が呼ばれた時に有効であった信任状が返される。 引き数は I<ucred> 構造体である。この構造体の定義を I<E<lt>sys/socket.hE<gt>> を得るには、 機能検査マクロ B<_GNU_SOURCE> を定義すること。 このソケットオプションは読み込み専用である。"
6858
6859 #. type: TP
6860 #: build/C/man7/socket.7:536
6861 #, no-wrap
6862 msgid "B<SO_PRIORITY>"
6863 msgstr "B<SO_PRIORITY>"
6864
6865 #. type: Plain text
6866 #: build/C/man7/socket.7:549
6867 msgid "Set the protocol-defined priority for all packets to be sent on this socket.  Linux uses this value to order the networking queues: packets with a higher priority may be processed first depending on the selected device queueing discipline.  For B<ip>(7), this also sets the IP type-of-service (TOS) field for outgoing packets.  Setting a priority outside the range 0 to 6 requires the B<CAP_NET_ADMIN> capability."
6868 msgstr "プロトコルで定義された優先度を、このソケットから 送信される全てのパケットにセットする。 Linux はネットワークキュー内部の 整列にこの値を用いる。高い優先度を持っているパケットは先に処理される。 ただしそのデバイスのキュー処理のやり方に依存する。 B<ip>(7)  では、外向けパケットの IP type-of-service (TOS) フィールドにもこの値が設定される。 0 から 6 以外の優先度をセットするには B<CAP_NET_ADMIN> ケーパビリティが必要である。"
6869
6870 #. type: TP
6871 #: build/C/man7/socket.7:549
6872 #, no-wrap
6873 msgid "B<SO_PROTOCOL> (since Linux 2.6.32)"
6874 msgstr "B<SO_PROTOCOL> (Linux 2.6.32 以降)"
6875
6876 #. type: Plain text
6877 #: build/C/man7/socket.7:557
6878 msgid "Retrieves the socket protocol as an integer, returning a value such as B<IPPROTO_SCTP>.  See B<socket>(2)  for details.  This socket option is read-only."
6879 msgstr ""
6880 "ソケットのプロトコルを整数で取得する。 B<IPPROTO_SCTP> のような値が返される。\n"
6881 "詳細は B<socket>(2) を参照。このソケットオプションは読み込み専用である。"
6882
6883 #. type: TP
6884 #: build/C/man7/socket.7:557
6885 #, no-wrap
6886 msgid "B<SO_RCVBUF>"
6887 msgstr "B<SO_RCVBUF>"
6888
6889 #.  Most (all?) other implementations do not do this -- MTK, Dec 05
6890 #.  The following thread on LMKL is quite informative:
6891 #.  getsockopt/setsockopt with SO_RCVBUF and SO_SNDBUF "non-standard" behavior
6892 #.  17 July 2012
6893 #.  http://thread.gmane.org/gmane.linux.kernel/1328935
6894 #. type: Plain text
6895 #: build/C/man7/socket.7:576
6896 msgid "Sets or gets the maximum socket receive buffer in bytes.  The kernel doubles this value (to allow space for bookkeeping overhead)  when it is set using B<setsockopt>(2), and this doubled value is returned by B<getsockopt>(2).  The default value is set by the I</proc/sys/net/core/rmem_default> file, and the maximum allowed value is set by the I</proc/sys/net/core/rmem_max> file.  The minimum (doubled) value for this option is 256."
6897 msgstr "ソケットの受信バッファーの最大サイズを設定・取得する (バイト単位)。 B<setsockopt>(2)  を使って値が設定されたときに (管理オーバヘッド用の領域を確保するために)  カーネルはこの値を 2倍し、 B<getsockopt>(2)  はこの 2倍された値を返す。 デフォルトの値は I</proc/sys/net/core/rmem_default> ファイルで設定され、許容される最大の値は I</proc/sys/net/core/rmem_max> ファイルで設定される。 このオプションの最小値は (2倍した値で) 256 である。"
6898
6899 #. type: TP
6900 #: build/C/man7/socket.7:576
6901 #, no-wrap
6902 msgid "B<SO_RCVBUFFORCE> (since Linux 2.6.14)"
6903 msgstr "B<SO_RCVBUFFORCE> (Linux 2.6.14 以降)"
6904
6905 #. type: Plain text
6906 #: build/C/man7/socket.7:585
6907 msgid "Using this socket option, a privileged (B<CAP_NET_ADMIN>)  process can perform the same task as B<SO_RCVBUF>, but the I<rmem_max> limit can be overridden."
6908 msgstr "このソケットオプションを使うと、特権プロセス (B<CAP_NET_ADMIN> を持つプロセス) は B<SO_RCVBUF> と同じことを実行できる。 ただし、上限 I<rmem_max> を上書きすることができる。"
6909
6910 #. type: TP
6911 #: build/C/man7/socket.7:585
6912 #, no-wrap
6913 msgid "B<SO_RCVLOWAT> and B<SO_SNDLOWAT>"
6914 msgstr "B<SO_RCVLOWAT> と B<SO_SNDLOWAT>"
6915
6916 #.  See http://marc.theaimsgroup.com/?l=linux-kernel&m=111049368106984&w=2
6917 #.  Tested on kernel 2.6.14 -- mtk, 30 Nov 05
6918 #. type: Plain text
6919 #: build/C/man7/socket.7:614
6920 msgid "Specify the minimum number of bytes in the buffer until the socket layer will pass the data to the protocol (B<SO_SNDLOWAT>)  or the user on receiving (B<SO_RCVLOWAT>).  These two values are initialized to 1.  B<SO_SNDLOWAT> is not changeable on Linux (B<setsockopt>(2)  fails with the error B<ENOPROTOOPT>).  B<SO_RCVLOWAT> is changeable only since Linux 2.4.  The B<select>(2)  and B<poll>(2)  system calls currently do not respect the B<SO_RCVLOWAT> setting on Linux, and mark a socket readable when even a single byte of data is available.  A subsequent read from the socket will block until B<SO_RCVLOWAT> bytes are available."
6921 msgstr "バッファー中に溜めることのできるデータの最小値を指定する。 このサイズを越えると、ソケット層はそのデータをプロトコルに渡し (B<SO_SNDLOWAT>)、 受信時にはユーザーに渡す (B<SO_RCVLOWAT>)。 これら二つの値は 1 に初期化される。 B<SO_SNDLOWAT> は Linux では変更できない (B<setsockopt>(2)  は B<ENOPROTOOPT> エラーで失敗する)。 B<SO_RCVLOWAT> は Linux 2.4 以降でのみ変更可能である。 現状、Linux ではシステムコール B<select>(2)  と B<poll>(2)  は B<SO_RCVLOWAT> の設定を考慮に入れずに動作し、 データが1バイト利用可能になっただけでも、 ソケットは読み出し可能とのマークをつける。 一方、それに続けて行うソケットからの read は B<SO_RCVLOWAT> バイトのデータが利用可能になるまで停止してしまう。"
6922
6923 #. type: TP
6924 #: build/C/man7/socket.7:614
6925 #, no-wrap
6926 msgid "B<SO_RCVTIMEO> and B<SO_SNDTIMEO>"
6927 msgstr "B<SO_RCVTIMEO> と B<SO_SNDTIMEO>"
6928
6929 #.  Not implemented in 2.0.
6930 #.  Implemented in 2.1.11 for getsockopt: always return a zero struct.
6931 #.  Implemented in 2.3.41 for setsockopt, and actually used.
6932 #.  in fact to EAGAIN
6933 #. type: Plain text
6934 #: build/C/man7/socket.7:649
6935 msgid "Specify the receiving or sending timeouts until reporting an error.  The argument is a I<struct timeval>.  If an input or output function blocks for this period of time, and data has been sent or received, the return value of that function will be the amount of data transferred; if no data has been transferred and the timeout has been reached, then -1 is returned with I<errno> set to B<EAGAIN> or B<EWOULDBLOCK>, or B<EINPROGRESS> (for B<connect>(2))  just as if the socket was specified to be nonblocking.  If the timeout is set to zero (the default), then the operation will never timeout.  Timeouts only have effect for system calls that perform socket I/O (e.g., B<read>(2), B<recvmsg>(2), B<send>(2), B<sendmsg>(2)); timeouts have no effect for B<select>(2), B<poll>(2), B<epoll_wait>(2), and so on."
6936 msgstr "送信・受信のタイムアウトを指定する。これを越えるとエラーを報告する。 引き数は I<struct timeval> である。 入出力関数がタイムアウト時間の間ブロックされ、かつデータの送信または 受信が行われていた場合は、転送されたデータ量が関数の返り値となる。 何もデータが転送されずにタイムアウトに達した場合は、 -1 を返し、 I<errno> に B<EAGAIN> か B<EWOULDBLOCK> か B<EINPROGRESS> (B<connect>(2) の場合) が設定され、 あたかもソケットに非ブロッキングが指定されたように見える。 タイムアウト値に (デフォルト値である) 0 に設定すると、 操作は決してタイムアウトしなくなる。 タイムアウトが影響を及ぼすのは、 ソケット I/O を実行するシステムコールだけ (例えば B<read>(2), B<recvmsg>(2), B<send>(2), B<sendmsg>(2))  である。 B<select>(2), B<poll>(2), B<epoll_wait>(2)  などにはタイムアウトは影響を及ぼさない。"
6937
6938 #. type: TP
6939 #: build/C/man7/socket.7:649
6940 #, no-wrap
6941 msgid "B<SO_REUSEADDR>"
6942 msgstr "B<SO_REUSEADDR>"
6943
6944 #. type: Plain text
6945 #: build/C/man7/socket.7:664
6946 msgid "Indicates that the rules used in validating addresses supplied in a B<bind>(2)  call should allow reuse of local addresses.  For B<AF_INET> sockets this means that a socket may bind, except when there is an active listening socket bound to the address.  When the listening socket is bound to B<INADDR_ANY> with a specific port then it is not possible to bind to this port for any local address.  Argument is an integer boolean flag."
6947 msgstr "B<bind>(2)  コールに与えられたアドレスが正しいかを判断するルールで、 ローカルアドレスの再利用を可能にする。 つまり B<AF_INET> ソケットなら、そのアドレスにバインドされたアクティブな listen 状態のソケットが存在しない限り、バインドが行える。 listen 状態のソケットがアドレス B<INADDR_ANY> で特定のポートにバインドされている場合には、 このポートに対しては、どんなローカルアドレスでもバインドできない。 引き数はブール整数のフラグである。"
6948
6949 #. type: TP
6950 #: build/C/man7/socket.7:664
6951 #, no-wrap
6952 msgid "B<SO_RXQ_OVFL> (since Linux 2.6.33)"
6953 msgstr "B<SO_RXQ_OVFL> (Linux 2.6.33 以降)"
6954
6955 #.  commit 3b885787ea4112eaa80945999ea0901bf742707f
6956 #. type: Plain text
6957 #: build/C/man7/socket.7:671
6958 msgid "Indicates that an unsigned 32-bit value ancillary message (cmsg)  should be attached to received skbs indicating the number of packets dropped by the socket between the last received packet and this received packet."
6959 msgstr "最後の受信パケットとこの受信パケットの間にそのソケットで捨てられた (ドロップされた) パケット数を示す、unsigned 32 ビット値の補助メッセージ (cmsg) を受信した skb に付与することを指示する。"
6960
6961 #. type: TP
6962 #: build/C/man7/socket.7:671
6963 #, no-wrap
6964 msgid "B<SO_SNDBUF>"
6965 msgstr "B<SO_SNDBUF>"
6966
6967 #.  Most (all?) other implementations do not do this -- MTK, Dec 05
6968 #.  See also the comment to SO_RCVBUF (17 Jul 2012 LKML mail)
6969 #. type: Plain text
6970 #: build/C/man7/socket.7:687
6971 msgid "Sets or gets the maximum socket send buffer in bytes.  The kernel doubles this value (to allow space for bookkeeping overhead)  when it is set using B<setsockopt>(2), and this doubled value is returned by B<getsockopt>(2).  The default value is set by the I</proc/sys/net/core/wmem_default> file and the maximum allowed value is set by the I</proc/sys/net/core/wmem_max> file.  The minimum (doubled) value for this option is 2048."
6972 msgstr "ソケットの送信バッファーの最大サイズを設定・取得する (バイト単位)。 B<setsockopt>(2)  を使って値が設定されたときに (管理オーバヘッド用の領域を確保するために)  カーネルはこの値を 2倍し、 B<getsockopt>(2)  はこの 2倍された値を返す。 デフォルトの値は I</proc/sys/net/core/wmem_default> ファイルで設定され、許容される最大の値は I</proc/sys/net/core/wmem_max> ファイルで設定される。 このオプションの最小値は (2倍した値で) 2048 である。"
6973
6974 #. type: TP
6975 #: build/C/man7/socket.7:687
6976 #, no-wrap
6977 msgid "B<SO_SNDBUFFORCE> (since Linux 2.6.14)"
6978 msgstr "B<SO_SNDBUFFORCE> (Linux 2.6.14 以降)"
6979
6980 #. type: Plain text
6981 #: build/C/man7/socket.7:696
6982 msgid "Using this socket option, a privileged (B<CAP_NET_ADMIN>)  process can perform the same task as B<SO_SNDBUF>, but the I<wmem_max> limit can be overridden."
6983 msgstr "このソケットオプションを使うと、特権プロセス (B<CAP_NET_ADMIN> を持つプロセス) は B<SO_SNDBUF> と同じことを実行できる。 ただし、上限 I<wmem_max> を上書きすることができる。"
6984
6985 #. type: TP
6986 #: build/C/man7/socket.7:696
6987 #, no-wrap
6988 msgid "B<SO_TIMESTAMP>"
6989 msgstr "B<SO_TIMESTAMP>"
6990
6991 #. type: Plain text
6992 #: build/C/man7/socket.7:712
6993 msgid "Enable or disable the receiving of the B<SO_TIMESTAMP> control message.  The timestamp control message is sent with level B<SOL_SOCKET> and the I<cmsg_data> field is a I<struct timeval> indicating the reception time of the last packet passed to the user in this call.  See B<cmsg>(3)  for details on control messages."
6994 msgstr "B<SO_TIMESTAMP> 制御メッセージの受信を有効/無効にする。 タイムスタンプ制御メッセージはレベル B<SOL_SOCKET> で送信され、 I<cmsg_data> フィールドはこのシステムコールでユーザーに渡した 最後のパケットの受信時刻を示す I<struct timeval> である。 制御メッセージの詳細については B<cmsg>(3)  を参照。"
6995
6996 #. type: TP
6997 #: build/C/man7/socket.7:712
6998 #, no-wrap
6999 msgid "B<SO_TYPE>"
7000 msgstr "B<SO_TYPE>"
7001
7002 #. type: Plain text
7003 #: build/C/man7/socket.7:717
7004 msgid "Gets the socket type as an integer (e.g., B<SOCK_STREAM>).  This socket option is read-only."
7005 msgstr ""
7006 "ソケットのタイプを整数で取得する (例: B<SOCK_STREAM>)。\n"
7007 "このソケットオプションは読み出し専用である。"
7008
7009 #. type: TP
7010 #: build/C/man7/socket.7:717
7011 #, no-wrap
7012 msgid "B<SO_BUSY_POLL> (since Linux 3.11)"
7013 msgstr "B<SO_BUSY_POLL> (Linux 3.11 以降)"
7014
7015 #. type: Plain text
7016 #: build/C/man7/socket.7:726
7017 msgid "Sets the approximate time in microseconds to busy poll on a blocking receive when there is no data.  Increasing this value requires B<CAP_NET_ADMIN>.  The default for this option is controlled by the I</proc/sys/net/core/busy_read> file."
7018 msgstr "データがなかった際にブロッキング受信での busy polling のおおよその時間をマイクロ秒単位で設定する。 この値を増やすには B<CAP_NET_ADMIN> ケーパビリティが必要である。 このオプションのデフォルト値は I</proc/sys/net/core/busy_read> で制御できる。"
7019
7020 #. type: Plain text
7021 #: build/C/man7/socket.7:736
7022 msgid "The value in the I</proc/sys/net/core/busy_poll> file determines how long B<select>(2)  and B<poll>(2)  will busy poll when they operate on sockets with B<SO_BUSY_POLL> set and no events to report are found."
7023 msgstr "I</proc/sys/net/core/busy_poll> の値により、 B<SO_BUSY_POLL> がセットされたソケットに対して B<select>(2) や B<poll>(2) を行い、報告すべきイベントがない場合に、 B<select>(2) や B<poll>(2) が busy polling をどのくらいの時間行うかが決まる。"
7024
7025 #. type: Plain text
7026 #: build/C/man7/socket.7:740
7027 msgid "In both cases, busy polling will only be done when the socket last received data from a network device that supports this option."
7028 msgstr "どちらの場合も、busy polling は、そのソケットが最後にデータを受信したネットワークデバイスがこのオプションに対応している場合のみ行われる。"
7029
7030 #. type: Plain text
7031 #: build/C/man7/socket.7:744
7032 msgid "While busy polling may improve latency of some applications, care must be taken when using it since this will increase both CPU utilization and power usage."
7033 msgstr "busy polling により遅延が改善されるはアプリケーションもあるが、 busy polling は CPU 使用率と電力使用量をともに増加させることになるので、使用する際は注意して行うこと。"
7034
7035 #. type: SS
7036 #: build/C/man7/socket.7:744
7037 #, no-wrap
7038 msgid "Signals"
7039 msgstr "シグナル"
7040
7041 #. type: Plain text
7042 #: build/C/man7/socket.7:755
7043 msgid "When writing onto a connection-oriented socket that has been shut down (by the local or the remote end)  B<SIGPIPE> is sent to the writing process and B<EPIPE> is returned.  The signal is not sent when the write call specified the B<MSG_NOSIGNAL> flag."
7044 msgstr "(ローカルもしくはリモート側で) 切断された 接続指向 (connection-oriented) のソケットに対して 書き込みを行うと、その書き込みを行ったプロセスに B<SIGPIPE> が送られ、 B<EPIPE> が返される。 write 呼び出しに B<MSG_NOSIGNAL> フラグを指定していた場合はシグナルは送られない。"
7045
7046 #. type: Plain text
7047 #: build/C/man7/socket.7:780
7048 msgid "When requested with the B<FIOSETOWN> B<fcntl>(2)  or B<SIOCSPGRP> B<ioctl>(2), B<SIGIO> is sent when an I/O event occurs.  It is possible to use B<poll>(2)  or B<select>(2)  in the signal handler to find out which socket the event occurred on.  An alternative (in Linux 2.2) is to set a real-time signal using the B<F_SETSIG> B<fcntl>(2); the handler of the real time signal will be called with the file descriptor in the I<si_fd> field of its I<siginfo_t>.  See B<fcntl>(2)  for more information."
7049 msgstr "B<FIOSETOWN> B<fcntl>(2)  や B<SIOCSPGRP> B<ioctl>(2)  をプロセスまたはプロセスグループに指定しておくと、 I/O イベントが起きたときに B<SIGIO> が送られる。 B<poll>(2)  や B<select>(2)  をシグナルハンドラー内で用いれば、どのソケットでイベントが起こったかを 知ることができる。 (Linux 2.2 における) 別の方法としては、 B<F_SETSIG> B<fcntl>(2)  を用いてリアルタイムシグナルを設定するやり方もある。 リアルタイムシグナルのハンドラーは、 I<siginfo_t> の I<si_fd> フィールドにファイルディスクリプターが入った状態で呼び出される。 詳細は B<fcntl>(2)  を参照のこと。"
7050
7051 #.  .SS Ancillary messages
7052 #. type: Plain text
7053 #: build/C/man7/socket.7:788
7054 msgid "Under some circumstances (e.g., multiple processes accessing a single socket), the condition that caused the B<SIGIO> may have already disappeared when the process reacts to the signal.  If this happens, the process should wait again because Linux will resend the signal later."
7055 msgstr "状況によっては (例えば複数のプロセスが一つのソケットにアクセスしているなど)、 B<SIGIO> の原因となった状態は、プロセスがそのシグナルへの対応を行ったときには 消えてしまっているかもしれない。 この場合は、プロセスは再び待つようにすべきである。 Linux は同じシグナルを後で再送するからである。"
7056
7057 #. type: SS
7058 #: build/C/man7/socket.7:788
7059 #, no-wrap
7060 msgid "/proc interfaces"
7061 msgstr "/proc インターフェース"
7062
7063 #. type: Plain text
7064 #: build/C/man7/socket.7:792
7065 msgid "The core socket networking parameters can be accessed via files in the directory I</proc/sys/net/core/>."
7066 msgstr "core のソケットのネットワーキングパラメーターには、 I</proc/sys/net/core/> ディレクトリ内のファイルを通してアクセスできる。"
7067
7068 #. type: TP
7069 #: build/C/man7/socket.7:792
7070 #, no-wrap
7071 msgid "I<rmem_default>"
7072 msgstr "I<rmem_default>"
7073
7074 #. type: Plain text
7075 #: build/C/man7/socket.7:795
7076 msgid "contains the default setting in bytes of the socket receive buffer."
7077 msgstr "ソケットの受信バッファーサイズのデフォルト値 (バイト単位)。"
7078
7079 #. type: TP
7080 #: build/C/man7/socket.7:795
7081 #, no-wrap
7082 msgid "I<rmem_max>"
7083 msgstr "I<rmem_max>"
7084
7085 #. type: Plain text
7086 #: build/C/man7/socket.7:801
7087 msgid "contains the maximum socket receive buffer size in bytes which a user may set by using the B<SO_RCVBUF> socket option."
7088 msgstr "B<SO_RCVBUF> ソケットオプションを用いてユーザーが設定できる ソケットの受信バッファーサイズの最大値 (バイト単位)。"
7089
7090 #. type: TP
7091 #: build/C/man7/socket.7:801
7092 #, no-wrap
7093 msgid "I<wmem_default>"
7094 msgstr "I<wmem_default>"
7095
7096 #. type: Plain text
7097 #: build/C/man7/socket.7:804
7098 msgid "contains the default setting in bytes of the socket send buffer."
7099 msgstr "ソケットの送信バッファーサイズのデフォルト値 (バイト単位)。"
7100
7101 #. type: TP
7102 #: build/C/man7/socket.7:804
7103 #, no-wrap
7104 msgid "I<wmem_max>"
7105 msgstr "I<wmem_max>"
7106
7107 #. type: Plain text
7108 #: build/C/man7/socket.7:810
7109 msgid "contains the maximum socket send buffer size in bytes which a user may set by using the B<SO_SNDBUF> socket option."
7110 msgstr "B<SO_SNDBUF> ソケットオプションを用いてユーザーが設定できる ソケットの送信バッファーサイズの最大値 (バイト単位)。"
7111
7112 #. type: TP
7113 #: build/C/man7/socket.7:810
7114 #, no-wrap
7115 msgid "I<message_cost> and I<message_burst>"
7116 msgstr "I<message_cost> と I<message_burst>"
7117
7118 #. type: Plain text
7119 #: build/C/man7/socket.7:814
7120 msgid "configure the token bucket filter used to load limit warning messages caused by external network events."
7121 msgstr "トークンバケットフィルターを設定する。 これは外部のネットワークイベントによって引き起こされた 負荷限界の警告メッセージに用いられる。"
7122
7123 #. type: TP
7124 #: build/C/man7/socket.7:814
7125 #, no-wrap
7126 msgid "I<netdev_max_backlog>"
7127 msgstr "I<netdev_max_backlog>"
7128
7129 #. type: Plain text
7130 #: build/C/man7/socket.7:817
7131 msgid "Maximum number of packets in the global input queue."
7132 msgstr "グローバルな入力キューにおける最大のパケット数。"
7133
7134 #. type: TP
7135 #: build/C/man7/socket.7:817
7136 #, no-wrap
7137 msgid "I<optmem_max>"
7138 msgstr "I<optmem_max>"
7139
7140 #.  netdev_fastroute is not documented because it is experimental
7141 #. type: Plain text
7142 #: build/C/man7/socket.7:822
7143 msgid "Maximum length of ancillary data and user control data like the iovecs per socket."
7144 msgstr "ソケットあたりの、補助データ (ancillary data) とユーザー制御データ (iovecs のようなもの) との和の最大長。"
7145
7146 #. type: SS
7147 #: build/C/man7/socket.7:822
7148 #, no-wrap
7149 msgid "Ioctls"
7150 msgstr "ioctl"
7151
7152 #. type: Plain text
7153 #: build/C/man7/socket.7:825
7154 msgid "These operations can be accessed using B<ioctl>(2):"
7155 msgstr "以下に示す操作には B<ioctl>(2)  を用いてアクセスできる。"
7156
7157 #. type: Plain text
7158 #: build/C/man7/socket.7:829
7159 #, no-wrap
7160 msgid "I<error>B< = ioctl(>I<ip_socket>B<, >I<ioctl_type>B<, >I<&value_result>B<);>\n"
7161 msgstr "I<error>B< = ioctl(>I<ip_socket>B<, >I<ioctl_type>B<, >I<&value_result>B<);>\n"
7162
7163 #. type: TP
7164 #: build/C/man7/socket.7:831
7165 #, no-wrap
7166 msgid "B<SIOCGSTAMP>"
7167 msgstr "B<SIOCGSTAMP>"
7168
7169 #. type: Plain text
7170 #: build/C/man7/socket.7:855
7171 msgid "Return a I<struct timeval> with the receive timestamp of the last packet passed to the user.  This is useful for accurate round trip time measurements.  See B<setitimer>(2)  for a description of I<struct timeval>.  This ioctl should be used only if the socket option B<SO_TIMESTAMP> is not set on the socket.  Otherwise, it returns the timestamp of the last packet that was received while B<SO_TIMESTAMP> was not set, or it fails if no such packet has been received, (i.e., B<ioctl>(2)  returns -1 with I<errno> set to B<ENOENT>)."
7172 msgstr "最後にユーザーに渡されたパケットの受信タイムスタンプを I<struct timeval> に入れて返す。 これは round trip 時間を正確に測りたいときに便利である。 I<struct timeval> の説明は B<setitimer>(2)  を見てほしい。 この ioctl は、ソケットオプション B<SO_TIMESTAMP> がソケットにセットされていない場合にのみ使用すべきである。 さもなければ、この ioctl は B<SO_TIMESTAMP> がセットされていなかった間に受信した最後のパケットの時刻を返すか、 そのようなパケットを受信していない場合には失敗する (つまり、 B<ioctl>(2)  は -1 を返し、 I<errno> に B<ENOENT> をセットする)。"
7173
7174 #. type: TP
7175 #: build/C/man7/socket.7:855
7176 #, no-wrap
7177 msgid "B<SIOCSPGRP>"
7178 msgstr "B<SIOCSPGRP>"
7179
7180 #. type: Plain text
7181 #: build/C/man7/socket.7:874
7182 msgid "Set the process or process group to send B<SIGIO> or B<SIGURG> signals to when an asynchronous I/O operation has finished or urgent data is available.  The argument is a pointer to a I<pid_t>.  If the argument is positive, send the signals to that process.  If the argument is negative, send the signals to the process group with the ID of the absolute value of the argument.  The process may only choose itself or its own process group to receive signals unless it has the B<CAP_KILL> capability or an effective UID of 0."
7183 msgstr "非同期 I/O 操作の終了時や緊急データの受信時に B<SIGIO> や B<SIGURG> シグナル群を送るプロセスやプロセスグループを設定する。 引き数は I<pid_t> へのポインターである。 引き数が正だと、そのプロセスにシグナルが送られる。負だと、 引き数の絶対値を ID に持つプロセスグループにシグナルが送られる。 シグナル受信先には、自分自身のプロセス / 自分の所属するプロセスグループ しか指定できない。但し、 B<CAP_KILL> ケーパビリティを持っている場合、及び実効ユーザー ID が 0 のプロセスの場合は この限りではない。"
7184
7185 #. type: TP
7186 #: build/C/man7/socket.7:874
7187 #, no-wrap
7188 msgid "B<FIOASYNC>"
7189 msgstr "B<FIOASYNC>"
7190
7191 #. type: Plain text
7192 #: build/C/man7/socket.7:884
7193 msgid "Change the B<O_ASYNC> flag to enable or disable asynchronous I/O mode of the socket.  Asynchronous I/O mode means that the B<SIGIO> signal or the signal set with B<F_SETSIG> is raised when a new I/O event occurs."
7194 msgstr "B<O_ASYNC> フラグを変更し、ソケットの非同期 (asynchronous) I/O モードを 有効/無効にする。非同期 I/O モードでは、 新しい I/O イベントが起きたときに、 B<SIGIO> シグナルや B<F_SETSIG> で設定されたシグナルセットが発行される。"
7195
7196 #. type: Plain text
7197 #: build/C/man7/socket.7:892
7198 msgid "Argument is an integer boolean flag.  (This operation is synonymous with the use of B<fcntl>(2)  to set the B<O_ASYNC> flag.)"
7199 msgstr "引き数はブール整数のフラグである。 (この操作は B<fcntl>(2)  を使って B<O_ASYNC> フラグをセットするのと同じ意味である。)"
7200
7201 #. type: TP
7202 #: build/C/man7/socket.7:892
7203 #, no-wrap
7204 msgid "B<SIOCGPGRP>"
7205 msgstr "B<SIOCGPGRP>"
7206
7207 #. type: Plain text
7208 #: build/C/man7/socket.7:901
7209 msgid "Get the current process or process group that receives B<SIGIO> or B<SIGURG> signals, or 0 when none is set."
7210 msgstr "B<SIGIO> や B<SIGURG> を受信したカレントプロセスかプロセスグループを取得する。 ない場合は 0 が返る。"
7211
7212 #. type: Plain text
7213 #: build/C/man7/socket.7:905
7214 msgid "Valid B<fcntl>(2)  operations:"
7215 msgstr "有効な B<fcntl>(2)  操作:"
7216
7217 #. type: TP
7218 #: build/C/man7/socket.7:905
7219 #, no-wrap
7220 msgid "B<FIOGETOWN>"
7221 msgstr "B<FIOGETOWN>"
7222
7223 #. type: Plain text
7224 #: build/C/man7/socket.7:910
7225 msgid "The same as the B<SIOCGPGRP> B<ioctl>(2)."
7226 msgstr "B<SIOCGPGRP> B<ioctl>(2)  と同じ。"
7227
7228 #. type: TP
7229 #: build/C/man7/socket.7:910
7230 #, no-wrap
7231 msgid "B<FIOSETOWN>"
7232 msgstr "B<FIOSETOWN>"
7233
7234 #. type: Plain text
7235 #: build/C/man7/socket.7:915
7236 msgid "The same as the B<SIOCSPGRP> B<ioctl>(2)."
7237 msgstr "B<SIOCSPGRP> B<ioctl>(2)  と同じ。"
7238
7239 #. type: Plain text
7240 #: build/C/man7/socket.7:929
7241 msgid "B<SO_BINDTODEVICE> was introduced in Linux 2.0.30.  B<SO_PASSCRED> is new in Linux 2.2.  The I</proc> interfaces was introduced in Linux 2.2.  B<SO_RCVTIMEO> and B<SO_SNDTIMEO> are supported since Linux 2.3.41.  Earlier, timeouts were fixed to a protocol-specific setting, and could not be read or written."
7242 msgstr "B<SO_BINDTODEVICE> は Linux 2.0.30 で導入された。 B<SO_PASSCRED> は Linux 2.2 で登場した。 I</proc> インターフェースは Linux 2.2 で導入された。 B<SO_RCVTIMEO> と B<SO_SNDTIMEO> は Linux 2.3.41 以降でサポートされている。 それ以前は、タイムアウトはプロトコル固有の固定の設定値で、 読み書きをすることはできなかった。"
7243
7244 #. type: Plain text
7245 #: build/C/man7/socket.7:934
7246 msgid "Linux assumes that half of the send/receive buffer is used for internal kernel structures; thus the values in the corresponding I</proc> files are twice what can be observed on the wire."
7247 msgstr "Linux は、送受信バッファーの半分を内部のカーネル構造体で用いると仮定している。 したがって、対応する I</proc> ファイルはネットワーク回線上での大きさの 2 倍になる。"
7248
7249 #. type: Plain text
7250 #: build/C/man7/socket.7:947
7251 msgid "Linux will only allow port reuse with the B<SO_REUSEADDR> option when this option was set both in the previous program that performed a B<bind>(2)  to the port and in the program that wants to reuse the port.  This differs from some implementations (e.g., FreeBSD)  where only the later program needs to set the B<SO_REUSEADDR> option.  Typically this difference is invisible, since, for example, a server program is designed to always set this option."
7252 msgstr "Linux では、 B<SO_REUSEADDR> オプションでポートの再利用が許可されるのは、 そのポートに対して B<bind>(2)  を前に実行したプログラムとそのポートを再利用 しようとするプログラムの両方で B<SO_REUSEADDR> がセットされた場合のみである。 この動作は (FreeBSD などの) いくつかの実装とは異なる。これらでは、 後でポートを再利用しようとするプログラムで B<SO_REUSEADDR> オプションをセットするだけでよい。 たいていはこの違いは見えない。なぜなら、例えばサーバプログラムは 常にこのオプションをセットするように設計されるからである。"
7253
7254 #.  FIXME Document SO_ATTACH_FILTER and SO_DETACH_FILTER
7255 #.  .SH AUTHORS
7256 #.  This man page was written by Andi Kleen.
7257 #. type: Plain text
7258 #: build/C/man7/socket.7:960
7259 msgid "The B<CONFIG_FILTER> socket options B<SO_ATTACH_FILTER> and B<SO_DETACH_FILTER> are not documented.  The suggested interface to use them is via the libpcap library."
7260 msgstr "B<CONFIG_FILTER> ソケットオプションである B<SO_ATTACH_FILTER> と B<SO_DETACH_FILTER> について記載されていない。これらは libpcap ライブラリを通して 用いる方が良い。"
7261
7262 #. type: Plain text
7263 #: build/C/man7/socket.7:972
7264 msgid "B<connect>(2), B<getsockopt>(2), B<setsockopt>(2), B<socket>(2), B<capabilities>(7), B<ddp>(7), B<ip>(7), B<packet>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
7265 msgstr "B<connect>(2), B<getsockopt>(2), B<setsockopt>(2), B<socket>(2), B<capabilities>(7), B<ddp>(7), B<ip>(7), B<packet>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
7266
7267 #. type: TH
7268 #: build/C/man2/socketcall.2:25
7269 #, no-wrap
7270 msgid "SOCKETCALL"
7271 msgstr "SOCKETCALL"
7272
7273 #. type: TH
7274 #: build/C/man2/socketcall.2:25
7275 #, no-wrap
7276 msgid "2012-10-16"
7277 msgstr "2012-10-16"
7278
7279 #. type: Plain text
7280 #: build/C/man2/socketcall.2:28
7281 msgid "socketcall - socket system calls"
7282 msgstr "socketcall - ソケットシステムコール"
7283
7284 #. type: Plain text
7285 #: build/C/man2/socketcall.2:30
7286 msgid "B<int socketcall(int >I<call>B<, unsigned long *>I<args>B<);>"
7287 msgstr "B<int socketcall(int >I<call>B<, unsigned long *>I<args>B<);>"
7288
7289 #. type: Plain text
7290 #: build/C/man2/socketcall.2:38
7291 msgid "B<socketcall>()  is a common kernel entry point for the socket system calls.  I<call> determines which socket function to invoke.  I<args> points to a block containing the actual arguments, which are passed through to the appropriate call."
7292 msgstr "B<socketcall>()  はソケットシステムコールのための共通のカーネルエントリ ポイント(kernel entry point)である。 I<call> はどのソケット関数を呼び出すかを指定する。 I<args> は適切なコールに渡すための実際の引き数を含んでいるブロックを指す。"
7293
7294 #. type: Plain text
7295 #: build/C/man2/socketcall.2:42
7296 msgid "User programs should call the appropriate functions by their usual names.  Only standard library implementors and kernel hackers need to know about B<socketcall>()."
7297 msgstr "ユーザープログラムは通常の名前を使用して適切な関数を呼び出すべきである。 標準ライブラリの実装者やカーネルハッカーのみが B<socketcall>()  について知る必要がある。"
7298
7299 #. type: Plain text
7300 #: build/C/man2/socketcall.2:45
7301 msgid "This call is specific to Linux, and should not be used in programs intended to be portable."
7302 msgstr "このコールは Linux 特有であり、移植を意図したプログラムで 使用してはいけない。"
7303
7304 #. type: Plain text
7305 #: build/C/man2/socketcall.2:53
7306 msgid "On a some architectures\\(emfor example, x86-64 and ARM\\(emthere is no B<socketcall>()  system call; instead B<socket>(2), B<accept>(2), B<bind>(2), and so on really are implemented as separate system calls."
7307 msgstr "いくつかのアーキテクチャー\\\\(emfor 例えば x86-64 や ARM\\\\(emでは、システムコール B<socketcall>()  が存在しない。実際には、その代わりに B<socket>(2), B<accept>(2), B<bind>(2)  などが独立したシステムコールとして実装されている。"
7308
7309 #. type: Plain text
7310 #: build/C/man2/socketcall.2:71
7311 msgid "B<accept>(2), B<bind>(2), B<connect>(2), B<getpeername>(2), B<getsockname>(2), B<getsockopt>(2), B<listen>(2), B<recv>(2), B<recvfrom>(2), B<recvmsg>(2), B<send>(2), B<sendmsg>(2), B<sendto>(2), B<setsockopt>(2), B<shutdown>(2), B<socket>(2), B<socketpair>(2)"
7312 msgstr "B<accept>(2), B<bind>(2), B<connect>(2), B<getpeername>(2), B<getsockname>(2), B<getsockopt>(2), B<listen>(2), B<recv>(2), B<recvfrom>(2), B<recvmsg>(2), B<send>(2), B<sendmsg>(2), B<sendto>(2), B<setsockopt>(2), B<shutdown>(2), B<socket>(2), B<socketpair>(2)"
7313
7314 #. type: TH
7315 #: build/C/man2/socketpair.2:42
7316 #, no-wrap
7317 msgid "SOCKETPAIR"
7318 msgstr "SOCKETPAIR"
7319
7320 #. type: TH
7321 #: build/C/man2/socketpair.2:42
7322 #, no-wrap
7323 msgid "2008-10-11"
7324 msgstr "2008-10-11"
7325
7326 #. type: Plain text
7327 #: build/C/man2/socketpair.2:45
7328 msgid "socketpair - create a pair of connected sockets"
7329 msgstr "socketpair - 接続されたソケットのペアを作成する"
7330
7331 #. type: Plain text
7332 #: build/C/man2/socketpair.2:52
7333 msgid "B<int socketpair(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<, int >I<sv>B<[2]);>"
7334 msgstr "B<int socketpair(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<, int >I<sv>B<[2]);>"
7335
7336 #. type: Plain text
7337 #: build/C/man2/socketpair.2:63
7338 msgid "The B<socketpair>()  call creates an unnamed pair of connected sockets in the specified I<domain>, of the specified I<type>, and using the optionally specified I<protocol>.  For further details of these arguments, see B<socket>(2)."
7339 msgstr "B<socketpair>()  は、指定されたドメイン I<domain> に指定された種類 I<type> で名前のないソケットの接続されたペアを作成する。 I<protocol> が指定されると、このプロトコルを用いる。 これらの引き数の詳細は B<socket>(2)  を参照のこと。"
7340
7341 #. type: Plain text
7342 #: build/C/man2/socketpair.2:69
7343 msgid "The descriptors used in referencing the new sockets are returned in I<sv>[0] and I<sv>[1].  The two sockets are indistinguishable."
7344 msgstr "新しいソケットの参照に使用するディスクリプター (descriptor) が I<sv>[0] と I<sv>[1] に返される。 二つのソケットは全く同じである。"
7345
7346 #. type: Plain text
7347 #: build/C/man2/socketpair.2:78
7348 msgid "The specified address family is not supported on this machine."
7349 msgstr "このマシンでは指定されたアドレスファミリーがサポートされていない。"
7350
7351 #. type: Plain text
7352 #: build/C/man2/socketpair.2:83
7353 msgid "The address I<sv> does not specify a valid part of the process address space."
7354 msgstr "アドレス I<sv> がこのプロセスで使えるアドレス空間を指定していない。"
7355
7356 #. type: Plain text
7357 #: build/C/man2/socketpair.2:86
7358 msgid "Too many descriptors are in use by this process."
7359 msgstr "このプロセスが使用しているディスクリプターの数が多すぎる。"
7360
7361 #. type: Plain text
7362 #: build/C/man2/socketpair.2:92
7363 msgid "The specified protocol does not support creation of socket pairs."
7364 msgstr "指定されたプロトコルではソケットのペアの作成がサポートされていない。"
7365
7366 #. type: Plain text
7367 #: build/C/man2/socketpair.2:95
7368 msgid "The specified protocol is not supported on this machine."
7369 msgstr "このマシンでは指定されたプロトコルがサポートされていない。"
7370
7371 #. type: Plain text
7372 #: build/C/man2/socketpair.2:103
7373 msgid "4.4BSD, POSIX.1-2001.  The B<socketpair>()  function call appeared in 4.2BSD.  It is generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System\\ V variants)."
7374 msgstr "4.4BSD, POSIX.1-2001.  B<socketpair>()  関数コールは 4.2BSD で現われた。一般に (System\\ V の変種を含めて)  BSD のソケット層のクローンをサポートしている、BSD 以外のシステムと、 互いに移植性がある。"
7375
7376 #. type: Plain text
7377 #: build/C/man2/socketpair.2:109
7378 msgid "On Linux, the only supported domain for this call is B<AF_UNIX> (or synonymously, B<AF_LOCAL>).  (Most implementations have the same restriction.)"
7379 msgstr "Linux では、この関数でサポートされているドメインは B<AF_UNIX> (または同義語である B<AF_LOCAL>)  だけである。 (ほとんどの実装で同じ制限がある)"
7380
7381 #. type: Plain text
7382 #: build/C/man2/socketpair.2:118
7383 msgid "Since Linux 2.6.27, B<socketpair>()  supports the B<SOCK_NONBLOCK> and B<SOCK_CLOEXEC> flags described in B<socket>(2)."
7384 msgstr "Linux 2.6.27 以降では、 B<socketpair>()  は、フラグ B<SOCK_NONBLOCK> と B<SOCK_CLOEXEC> に対応している。フラグの説明は B<socket>(2)  を参照のこと。"
7385
7386 #. type: Plain text
7387 #: build/C/man2/socketpair.2:131
7388 msgid "B<pipe>(2), B<read>(2), B<socket>(2), B<write>(2), B<socket>(7), B<unix>(7)"
7389 msgstr "B<pipe>(2), B<read>(2), B<socket>(2), B<write>(2), B<socket>(7), B<unix>(7)"