OSDN Git Service

(split) LDP: Update POT and ja.po to LDP v3.39.
[linuxjm/LDP_man-pages.git] / po4a / socket / po / socket.pot
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 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-04-25 05:36+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=CHARSET\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man2/accept.2:39
21 #, no-wrap
22 msgid "ACCEPT"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man2/accept.2:39
27 #, no-wrap
28 msgid "2010-09-10"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man2/accept.2:39 build/C/man2/bind.2:66 build/C/man2/connect.2:65 build/C/man2/getsockname.2:38 build/C/man2/getsockopt.2:42 build/C/man2/listen.2:43 build/C/man2/recv.2:39 build/C/man2/recvmmsg.2:26 build/C/man2/select.2:38 build/C/man2/select_tut.2:30 build/C/man2/send.2:38 build/C/man2/sendmmsg.2:28 build/C/man3/sockatmark.3:23 build/C/man2/socket.2:41 build/C/man7/socket.7:26 build/C/man2/socketcall.2:26 build/C/man2/socketpair.2:40
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man2/accept.2:39 build/C/man2/bind.2:66 build/C/man3/bindresvport.3:27 build/C/man2/connect.2:65 build/C/man3/getifaddrs.3:33 build/C/man2/getsockname.2:38 build/C/man2/getsockopt.2:42 build/C/man2/listen.2:43 build/C/man2/recv.2:39 build/C/man2/recvmmsg.2:26 build/C/man2/select.2:38 build/C/man2/select_tut.2:30 build/C/man2/send.2:38 build/C/man2/sendmmsg.2:28 build/C/man3/sockatmark.3:23 build/C/man2/socket.2:41 build/C/man7/socket.7:26 build/C/man2/socketcall.2:26 build/C/man2/socketpair.2:40
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man2/accept.2:40 build/C/man2/bind.2:67 build/C/man3/bindresvport.3:28 build/C/man2/connect.2:66 build/C/man3/getifaddrs.3:34 build/C/man2/getsockname.2:39 build/C/man2/getsockopt.2:43 build/C/man2/listen.2:44 build/C/man2/recv.2:40 build/C/man2/recvmmsg.2:27 build/C/man2/select.2:39 build/C/man2/select_tut.2:31 build/C/man2/send.2:39 build/C/man2/sendmmsg.2:29 build/C/man3/sockatmark.3:24 build/C/man2/socket.2:42 build/C/man7/socket.7:27 build/C/man2/socketcall.2:27 build/C/man2/socketpair.2:41
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man2/accept.2:42
51 msgid "accept - accept a connection on a socket"
52 msgstr ""
53
54 #. type: SH
55 #: build/C/man2/accept.2:42 build/C/man2/bind.2:69 build/C/man3/bindresvport.3:30 build/C/man2/connect.2:68 build/C/man3/getifaddrs.3:36 build/C/man2/getsockname.2:41 build/C/man2/getsockopt.2:45 build/C/man2/listen.2:46 build/C/man2/recv.2:42 build/C/man2/recvmmsg.2:29 build/C/man2/select.2:42 build/C/man2/select_tut.2:34 build/C/man2/send.2:41 build/C/man2/sendmmsg.2:31 build/C/man3/sockatmark.3:26 build/C/man2/socket.2:44 build/C/man7/socket.7:29 build/C/man2/socketcall.2:29 build/C/man2/socketpair.2:43
56 #, no-wrap
57 msgid "SYNOPSIS"
58 msgstr ""
59
60 #. type: Plain text
61 #: build/C/man2/accept.2:46 build/C/man2/bind.2:73
62 #, no-wrap
63 msgid ""
64 "B<#include E<lt>sys/types.hE<gt>>          /* See NOTES */\n"
65 "B<#include E<lt>sys/socket.hE<gt>>\n"
66 msgstr ""
67
68 #. type: Plain text
69 #: build/C/man2/accept.2:48
70 #, no-wrap
71 msgid ""
72 "B<int accept(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t "
73 "*>I<addrlen>B<);>\n"
74 msgstr ""
75
76 #. type: Plain text
77 #: build/C/man2/accept.2:51
78 #, no-wrap
79 msgid ""
80 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
81 "B<#include E<lt>sys/socket.hE<gt>>\n"
82 msgstr ""
83
84 #. type: Plain text
85 #: build/C/man2/accept.2:54
86 #, no-wrap
87 msgid ""
88 "B<int accept4(int >I<sockfd>B<, struct sockaddr *>I<addr>B<,>\n"
89 "B<            socklen_t *>I<addrlen>B<, int >I<flags>B<);>\n"
90 msgstr ""
91
92 #. type: SH
93 #: build/C/man2/accept.2:55 build/C/man2/bind.2:77 build/C/man3/bindresvport.3:37 build/C/man2/connect.2:77 build/C/man3/getifaddrs.3:45 build/C/man2/getsockname.2:48 build/C/man2/getsockopt.2:56 build/C/man2/listen.2:54 build/C/man2/recv.2:57 build/C/man2/recvmmsg.2:39 build/C/man2/select.2:81 build/C/man2/select_tut.2:73 build/C/man2/send.2:56 build/C/man2/sendmmsg.2:40 build/C/man3/sockatmark.3:40 build/C/man2/socket.2:50 build/C/man7/socket.7:33 build/C/man2/socketcall.2:31 build/C/man2/socketpair.2:50
94 #, no-wrap
95 msgid "DESCRIPTION"
96 msgstr ""
97
98 #. type: Plain text
99 #: build/C/man2/accept.2:70
100 msgid ""
101 "The B<accept>()  system call is used with connection-based socket types "
102 "(B<SOCK_STREAM>, B<SOCK_SEQPACKET>).  It extracts the first connection "
103 "request on the queue of pending connections for the listening socket, "
104 "I<sockfd>, creates a new connected socket, and returns a new file descriptor "
105 "referring to that socket.  The newly created socket is not in the listening "
106 "state.  The original socket I<sockfd> is unaffected by this call."
107 msgstr ""
108
109 #. type: Plain text
110 #: build/C/man2/accept.2:79
111 msgid ""
112 "The argument I<sockfd> is a socket that has been created with B<socket>(2), "
113 "bound to a local address with B<bind>(2), and is listening for connections "
114 "after a B<listen>(2)."
115 msgstr ""
116
117 #. type: Plain text
118 #: build/C/man2/accept.2:97
119 msgid ""
120 "The argument I<addr> is a pointer to a I<sockaddr> structure.  This "
121 "structure is filled in with the address of the peer socket, as known to the "
122 "communications layer.  The exact format of the address returned I<addr> is "
123 "determined by the socket's address family (see B<socket>(2)  and the "
124 "respective protocol man pages).  When I<addr> is NULL, nothing is filled in; "
125 "in this case, I<addrlen> is not used, and should also be NULL."
126 msgstr ""
127
128 #. type: Plain text
129 #: build/C/man2/accept.2:105
130 msgid ""
131 "The I<addrlen> argument is a value-result argument: the caller must "
132 "initialize it to contain the size (in bytes) of the structure pointed to by "
133 "I<addr>; on return it will contain the actual size of the peer address."
134 msgstr ""
135
136 #. type: Plain text
137 #: build/C/man2/accept.2:110 build/C/man2/getsockname.2:65
138 msgid ""
139 "The returned address is truncated if the buffer provided is too small; in "
140 "this case, I<addrlen> will return a value greater than was supplied to the "
141 "call."
142 msgstr ""
143
144 #. type: Plain text
145 #: build/C/man2/accept.2:123
146 msgid ""
147 "If no pending connections are present on the queue, and the socket is not "
148 "marked as nonblocking, B<accept>()  blocks the caller until a connection is "
149 "present.  If the socket is marked nonblocking and no pending connections are "
150 "present on the queue, B<accept>()  fails with the error B<EAGAIN> or "
151 "B<EWOULDBLOCK>."
152 msgstr ""
153
154 #. type: Plain text
155 #: build/C/man2/accept.2:137
156 msgid ""
157 "In order to be notified of incoming connections on a socket, you can use "
158 "B<select>(2)  or B<poll>(2).  A readable event will be delivered when a new "
159 "connection is attempted and you may then call B<accept>()  to get a socket "
160 "for that connection.  Alternatively, you can set the socket to deliver "
161 "B<SIGIO> when activity occurs on a socket; see B<socket>(7)  for details."
162 msgstr ""
163
164 #. type: Plain text
165 #: build/C/man2/accept.2:150
166 msgid ""
167 "For certain protocols which require an explicit confirmation, such as "
168 "DECNet, B<accept>()  can be thought of as merely dequeuing the next "
169 "connection request and not implying confirmation.  Confirmation can be "
170 "implied by a normal read or write on the new file descriptor, and rejection "
171 "can be implied by closing the new socket.  Currently only DECNet has these "
172 "semantics on Linux."
173 msgstr ""
174
175 #. type: Plain text
176 #: build/C/man2/accept.2:160
177 msgid ""
178 "If I<flags> is 0, then B<accept4>()  is the same as B<accept>().  The "
179 "following values can be bitwise ORed in I<flags> to obtain different "
180 "behavior:"
181 msgstr ""
182
183 #. type: TP
184 #: build/C/man2/accept.2:160 build/C/man2/socket.2:162
185 #, no-wrap
186 msgid "B<SOCK_NONBLOCK>"
187 msgstr ""
188
189 #. type: Plain text
190 #: build/C/man2/accept.2:168 build/C/man2/socket.2:170
191 msgid ""
192 "Set the B<O_NONBLOCK> file status flag on the new open file description.  "
193 "Using this flag saves extra calls to B<fcntl>(2)  to achieve the same "
194 "result."
195 msgstr ""
196
197 #. type: TP
198 #: build/C/man2/accept.2:168 build/C/man2/socket.2:170
199 #, no-wrap
200 msgid "B<SOCK_CLOEXEC>"
201 msgstr ""
202
203 #. type: Plain text
204 #: build/C/man2/accept.2:178 build/C/man2/socket.2:180
205 msgid ""
206 "Set the close-on-exec (B<FD_CLOEXEC>)  flag on the new file descriptor.  See "
207 "the description of the B<O_CLOEXEC> flag in B<open>(2)  for reasons why this "
208 "may be useful."
209 msgstr ""
210
211 #. type: SH
212 #: build/C/man2/accept.2:178 build/C/man2/bind.2:150 build/C/man3/bindresvport.3:64 build/C/man2/connect.2:125 build/C/man3/getifaddrs.3:137 build/C/man2/getsockname.2:65 build/C/man2/getsockopt.2:129 build/C/man2/listen.2:80 build/C/man2/recv.2:386 build/C/man2/recvmmsg.2:141 build/C/man2/select.2:285 build/C/man2/select_tut.2:483 build/C/man2/send.2:273 build/C/man2/sendmmsg.2:119 build/C/man3/sockatmark.3:49 build/C/man2/socket.2:312 build/C/man2/socketpair.2:67
213 #, no-wrap
214 msgid "RETURN VALUE"
215 msgstr ""
216
217 #. type: Plain text
218 #: build/C/man2/accept.2:185
219 msgid ""
220 "On success, these system calls return a nonnegative integer that is a "
221 "descriptor for the accepted socket.  On error, -1 is returned, and I<errno> "
222 "is set appropriately."
223 msgstr ""
224
225 #. type: SS
226 #: build/C/man2/accept.2:185
227 #, no-wrap
228 msgid "Error Handling"
229 msgstr ""
230
231 #. type: Plain text
232 #: build/C/man2/accept.2:212
233 msgid ""
234 "Linux B<accept>()  (and B<accept4>())  passes already-pending network errors "
235 "on the new socket as an error code from B<accept>().  This behavior differs "
236 "from other BSD socket implementations.  For reliable operation the "
237 "application should detect the network errors defined for the protocol after "
238 "B<accept>()  and treat them like B<EAGAIN> by retrying.  In case of TCP/IP "
239 "these are B<ENETDOWN>, B<EPROTO>, B<ENOPROTOOPT>, B<EHOSTDOWN>, B<ENONET>, "
240 "B<EHOSTUNREACH>, B<EOPNOTSUPP>, and B<ENETUNREACH>."
241 msgstr ""
242
243 #. type: SH
244 #: build/C/man2/accept.2:212 build/C/man2/bind.2:155 build/C/man3/bindresvport.3:69 build/C/man2/connect.2:130 build/C/man3/getifaddrs.3:144 build/C/man2/getsockname.2:70 build/C/man2/getsockopt.2:134 build/C/man2/listen.2:85 build/C/man2/recv.2:391 build/C/man2/recvmmsg.2:149 build/C/man2/select.2:302 build/C/man2/send.2:278 build/C/man2/sendmmsg.2:133 build/C/man3/sockatmark.3:54 build/C/man2/socket.2:317 build/C/man2/socketpair.2:72
245 #, no-wrap
246 msgid "ERRORS"
247 msgstr ""
248
249 #. type: TP
250 #: build/C/man2/accept.2:213 build/C/man2/recv.2:396 build/C/man2/send.2:291
251 #, no-wrap
252 msgid "B<EAGAIN> or B<EWOULDBLOCK>"
253 msgstr ""
254
255 #.  Actually EAGAIN on Linux
256 #. type: Plain text
257 #: build/C/man2/accept.2:221
258 msgid ""
259 "The socket is marked nonblocking and no connections are present to be "
260 "accepted.  POSIX.1-2001 allows either error to be returned for this case, "
261 "and does not require these constants to have the same value, so a portable "
262 "application should check for both possibilities."
263 msgstr ""
264
265 #. type: TP
266 #: build/C/man2/accept.2:221 build/C/man2/bind.2:163 build/C/man2/connect.2:167 build/C/man2/getsockname.2:71 build/C/man2/getsockopt.2:135 build/C/man2/listen.2:89 build/C/man2/recv.2:405 build/C/man2/select.2:303 build/C/man2/send.2:299 build/C/man3/sockatmark.3:55
267 #, no-wrap
268 msgid "B<EBADF>"
269 msgstr ""
270
271 #. type: Plain text
272 #: build/C/man2/accept.2:224
273 msgid "The descriptor is invalid."
274 msgstr ""
275
276 #. type: TP
277 #: build/C/man2/accept.2:224
278 #, no-wrap
279 msgid "B<ECONNABORTED>"
280 msgstr ""
281
282 #. type: Plain text
283 #: build/C/man2/accept.2:227
284 msgid "A connection has been aborted."
285 msgstr ""
286
287 #. type: TP
288 #: build/C/man2/accept.2:227 build/C/man2/bind.2:189 build/C/man2/connect.2:173 build/C/man2/getsockname.2:76 build/C/man2/getsockopt.2:140 build/C/man2/recv.2:414 build/C/man2/send.2:308 build/C/man2/socketpair.2:76
289 #, no-wrap
290 msgid "B<EFAULT>"
291 msgstr ""
292
293 #. type: Plain text
294 #: build/C/man2/accept.2:232
295 msgid "The I<addr> argument is not in a writable part of the user address space."
296 msgstr ""
297
298 #. type: TP
299 #: build/C/man2/accept.2:232 build/C/man2/connect.2:201 build/C/man2/recv.2:418 build/C/man2/select.2:308 build/C/man2/send.2:311
300 #, no-wrap
301 msgid "B<EINTR>"
302 msgstr ""
303
304 #. type: Plain text
305 #: build/C/man2/accept.2:237
306 msgid ""
307 "The system call was interrupted by a signal that was caught before a valid "
308 "connection arrived; see B<signal>(7)."
309 msgstr ""
310
311 #. type: TP
312 #: build/C/man2/accept.2:237 build/C/man2/accept.2:242 build/C/man2/bind.2:167 build/C/man2/bind.2:193 build/C/man2/getsockname.2:82 build/C/man2/getsockopt.2:150 build/C/man2/recv.2:423 build/C/man2/recvmmsg.2:153 build/C/man2/select.2:312 build/C/man2/send.2:315 build/C/man3/sockatmark.3:59 build/C/man2/socket.2:325 build/C/man2/socket.2:328
313 #, no-wrap
314 msgid "B<EINVAL>"
315 msgstr ""
316
317 #. type: Plain text
318 #: build/C/man2/accept.2:242
319 msgid ""
320 "Socket is not listening for connections, or I<addrlen> is invalid (e.g., is "
321 "negative)."
322 msgstr ""
323
324 #. type: Plain text
325 #: build/C/man2/accept.2:247
326 msgid "(B<accept4>())  invalid value in I<flags>."
327 msgstr ""
328
329 #. type: TP
330 #: build/C/man2/accept.2:247 build/C/man2/socket.2:333 build/C/man2/socketpair.2:81
331 #, no-wrap
332 msgid "B<EMFILE>"
333 msgstr ""
334
335 #. type: Plain text
336 #: build/C/man2/accept.2:250
337 msgid "The per-process limit of open file descriptors has been reached."
338 msgstr ""
339
340 #. type: TP
341 #: build/C/man2/accept.2:250 build/C/man2/socket.2:336 build/C/man2/socketpair.2:84
342 #, no-wrap
343 msgid "B<ENFILE>"
344 msgstr ""
345
346 #. type: Plain text
347 #: build/C/man2/accept.2:253 build/C/man2/socket.2:339 build/C/man2/socketpair.2:87
348 msgid "The system limit on the total number of open files has been reached."
349 msgstr ""
350
351 #. type: TP
352 #: build/C/man2/accept.2:253
353 #, no-wrap
354 msgid "B<ENOBUFS>, B<ENOMEM>"
355 msgstr ""
356
357 #. type: Plain text
358 #: build/C/man2/accept.2:258
359 msgid ""
360 "Not enough free memory.  This often means that the memory allocation is "
361 "limited by the socket buffer limits, not by the system memory."
362 msgstr ""
363
364 #. type: TP
365 #: build/C/man2/accept.2:258 build/C/man2/bind.2:172 build/C/man2/connect.2:213 build/C/man2/getsockname.2:90 build/C/man2/getsockopt.2:164 build/C/man2/listen.2:94 build/C/man2/recv.2:438 build/C/man2/send.2:344
366 #, no-wrap
367 msgid "B<ENOTSOCK>"
368 msgstr ""
369
370 #. type: Plain text
371 #: build/C/man2/accept.2:261
372 msgid "The descriptor references a file, not a socket."
373 msgstr ""
374
375 #. type: TP
376 #: build/C/man2/accept.2:261 build/C/man2/listen.2:99 build/C/man2/send.2:349 build/C/man2/socketpair.2:87
377 #, no-wrap
378 msgid "B<EOPNOTSUPP>"
379 msgstr ""
380
381 #. type: Plain text
382 #: build/C/man2/accept.2:265
383 msgid "The referenced socket is not of type B<SOCK_STREAM>."
384 msgstr ""
385
386 #. type: TP
387 #: build/C/man2/accept.2:265
388 #, no-wrap
389 msgid "B<EPROTO>"
390 msgstr ""
391
392 #. type: Plain text
393 #: build/C/man2/accept.2:268
394 msgid "Protocol error."
395 msgstr ""
396
397 #. type: Plain text
398 #: build/C/man2/accept.2:272
399 msgid "In addition, Linux B<accept>()  may fail if:"
400 msgstr ""
401
402 #. type: TP
403 #: build/C/man2/accept.2:272
404 #, no-wrap
405 msgid "B<EPERM>"
406 msgstr ""
407
408 #. type: Plain text
409 #: build/C/man2/accept.2:275
410 msgid "Firewall rules forbid connection."
411 msgstr ""
412
413 #. type: Plain text
414 #: build/C/man2/accept.2:287
415 msgid ""
416 "In addition, network errors for the new socket and as defined for the "
417 "protocol may be returned.  Various Linux kernels can return other errors "
418 "such as B<ENOSR>, B<ESOCKTNOSUPPORT>, B<EPROTONOSUPPORT>, B<ETIMEDOUT>.  The "
419 "value B<ERESTARTSYS> may be seen during a trace."
420 msgstr ""
421
422 #. type: SH
423 #: build/C/man2/accept.2:287 build/C/man3/getifaddrs.3:157 build/C/man2/recvmmsg.2:157 build/C/man2/select.2:321 build/C/man2/sendmmsg.2:145 build/C/man3/sockatmark.3:66 build/C/man7/socket.7:697
424 #, no-wrap
425 msgid "VERSIONS"
426 msgstr ""
427
428 #. type: Plain text
429 #: build/C/man2/accept.2:292
430 msgid ""
431 "The B<accept4>()  system call is available starting with Linux 2.6.28; "
432 "support in glibc is available starting with version 2.10."
433 msgstr ""
434
435 #. type: SH
436 #: build/C/man2/accept.2:292 build/C/man2/bind.2:220 build/C/man3/bindresvport.3:89 build/C/man2/connect.2:223 build/C/man3/getifaddrs.3:165 build/C/man2/getsockname.2:95 build/C/man2/getsockopt.2:169 build/C/man2/listen.2:104 build/C/man2/recv.2:443 build/C/man2/recvmmsg.2:162 build/C/man2/select.2:327 build/C/man2/send.2:363 build/C/man2/sendmmsg.2:150 build/C/man3/sockatmark.3:69 build/C/man2/socket.2:350 build/C/man2/socketcall.2:43 build/C/man2/socketpair.2:93
437 #, no-wrap
438 msgid "CONFORMING TO"
439 msgstr ""
440
441 #.  The BSD man page documents five possible error returns
442 #.  (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
443 #.  POSIX.1-2001 documents errors
444 #.  EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
445 #.  ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK.
446 #.  In addition, SUSv2 documents EFAULT and ENOSR.
447 #. type: Plain text
448 #: build/C/man2/accept.2:304
449 msgid ""
450 "B<accept>(): POSIX.1-2001, SVr4, 4.4BSD, (B<accept>()  first appeared in "
451 "4.2BSD)."
452 msgstr ""
453
454 #. type: Plain text
455 #: build/C/man2/accept.2:307
456 msgid "B<accept4>()  is a nonstandard Linux extension."
457 msgstr ""
458
459 #.  Some testing seems to show that Tru64 5.1 and HP-UX 11 also
460 #.  do not inherit file status flags -- MTK Jun 05
461 #. type: Plain text
462 #: build/C/man2/accept.2:322
463 msgid ""
464 "On Linux, the new socket returned by B<accept>()  does I<not> inherit file "
465 "status flags such as B<O_NONBLOCK> and B<O_ASYNC> from the listening "
466 "socket.  This behavior differs from the canonical BSD sockets "
467 "implementation.  Portable programs should not rely on inheritance or "
468 "noninheritance of file status flags and always explicitly set all required "
469 "flags on the socket returned from B<accept>()."
470 msgstr ""
471
472 #. type: SH
473 #: build/C/man2/accept.2:322 build/C/man2/bind.2:232 build/C/man3/bindresvport.3:92 build/C/man2/connect.2:239 build/C/man3/getifaddrs.3:185 build/C/man2/getsockname.2:101 build/C/man2/getsockopt.2:176 build/C/man2/listen.2:109 build/C/man2/recv.2:453 build/C/man2/select.2:342 build/C/man2/select_tut.2:501 build/C/man2/send.2:377 build/C/man2/sendmmsg.2:153 build/C/man3/sockatmark.3:71 build/C/man2/socket.2:364 build/C/man7/socket.7:711 build/C/man2/socketcall.2:46 build/C/man2/socketpair.2:101
474 #, no-wrap
475 msgid "NOTES"
476 msgstr ""
477
478 #. type: Plain text
479 #: build/C/man2/accept.2:328 build/C/man2/bind.2:238 build/C/man2/connect.2:245 build/C/man2/getsockopt.2:182 build/C/man2/listen.2:135 build/C/man2/socket.2:370 build/C/man2/socketpair.2:122
480 msgid ""
481 "POSIX.1-2001 does not require the inclusion of I<E<lt>sys/types.hE<gt>>, and "
482 "this header file is not required on Linux.  However, some historical (BSD) "
483 "implementations required this header file, and portable applications are "
484 "probably wise to include it."
485 msgstr ""
486
487 #. type: Plain text
488 #: build/C/man2/accept.2:349
489 msgid ""
490 "There may not always be a connection waiting after a B<SIGIO> is delivered "
491 "or B<select>(2)  or B<poll>(2)  return a readability event because the "
492 "connection might have been removed by an asynchronous network error or "
493 "another thread before B<accept>()  is called.  If this happens then the call "
494 "will block waiting for the next connection to arrive.  To ensure that "
495 "B<accept>()  never blocks, the passed socket I<sockfd> needs to have the "
496 "B<O_NONBLOCK> flag set (see B<socket>(7))."
497 msgstr ""
498
499 #. type: SS
500 #: build/C/man2/accept.2:349
501 #, no-wrap
502 msgid "The socklen_t type"
503 msgstr ""
504
505 #. type: Plain text
506 #: build/C/man2/accept.2:359
507 msgid ""
508 "The third argument of B<accept>()  was originally declared as an I<int *> "
509 "(and is that under libc4 and libc5 and on many other systems like 4.x BSD, "
510 "SunOS 4, SGI); a POSIX.1g draft standard wanted to change it into a I<size_t "
511 "*>, and that is what it is for SunOS 5.  Later POSIX drafts have I<socklen_t "
512 "*>, and so do the Single UNIX Specification and glibc2.  Quoting Linus "
513 "Torvalds:"
514 msgstr ""
515
516 #.  .I fails: only italicizes a single line
517 #. type: Plain text
518 #: build/C/man2/accept.2:376
519 msgid ""
520 "\"_Any_ sane library _must_ have \"socklen_t\" be the same size as int.  "
521 "Anything else breaks any BSD socket layer stuff.  POSIX initially I<did> "
522 "make it a size_t, and I (and hopefully others, but obviously not too many) "
523 "complained to them very loudly indeed.  Making it a size_t is completely "
524 "broken, exactly because size_t very seldom is the same size as \"int\" on "
525 "64-bit architectures, for example.  And it I<has> to be the same size as "
526 "\"int\" because that's what the BSD socket interface is.  Anyway, the POSIX "
527 "people eventually got a clue, and created \"socklen_t\".  They shouldn't "
528 "have touched it in the first place, but once they did they felt it had to "
529 "have a named type for some unfathomable reason (probably somebody didn't "
530 "like losing face over having done the original stupid thing, so they "
531 "silently just renamed their blunder).\""
532 msgstr ""
533
534 #. type: SH
535 #: build/C/man2/accept.2:376 build/C/man2/bind.2:252 build/C/man2/connect.2:256 build/C/man3/getifaddrs.3:198 build/C/man2/listen.2:164 build/C/man2/recv.2:488 build/C/man2/select.2:484 build/C/man2/select_tut.2:527 build/C/man2/send.2:414 build/C/man3/sockatmark.3:95 build/C/man2/socket.2:382
536 #, no-wrap
537 msgid "EXAMPLE"
538 msgstr ""
539
540 #. type: Plain text
541 #: build/C/man2/accept.2:379 build/C/man2/listen.2:167
542 msgid "See B<bind>(2)."
543 msgstr ""
544
545 #. type: SH
546 #: build/C/man2/accept.2:379 build/C/man2/bind.2:317 build/C/man3/bindresvport.3:98 build/C/man2/connect.2:261 build/C/man3/getifaddrs.3:281 build/C/man2/getsockname.2:110 build/C/man2/getsockopt.2:200 build/C/man2/listen.2:167 build/C/man2/recv.2:493 build/C/man2/recvmmsg.2:165 build/C/man2/select.2:521 build/C/man2/select_tut.2:817 build/C/man2/send.2:419 build/C/man2/sendmmsg.2:168 build/C/man3/sockatmark.3:130 build/C/man2/socket.2:387 build/C/man7/socket.7:742 build/C/man2/socketcall.2:54 build/C/man2/socketpair.2:122
547 #, no-wrap
548 msgid "SEE ALSO"
549 msgstr ""
550
551 #. type: Plain text
552 #: build/C/man2/accept.2:385
553 msgid ""
554 "B<bind>(2), B<connect>(2), B<listen>(2), B<select>(2), B<socket>(2), "
555 "B<socket>(7)"
556 msgstr ""
557
558 #. type: TH
559 #: build/C/man2/bind.2:66
560 #, no-wrap
561 msgid "BIND"
562 msgstr ""
563
564 #. type: TH
565 #: build/C/man2/bind.2:66
566 #, no-wrap
567 msgid "2007-12-28"
568 msgstr ""
569
570 #. type: Plain text
571 #: build/C/man2/bind.2:69
572 msgid "bind - bind a name to a socket"
573 msgstr ""
574
575 #. type: Plain text
576 #: build/C/man2/bind.2:76
577 #, no-wrap
578 msgid ""
579 "B<int bind(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
580 "B<         socklen_t >I<addrlen>B<);>\n"
581 msgstr ""
582
583 #. type: Plain text
584 #: build/C/man2/bind.2:90
585 msgid ""
586 "When a socket is created with B<socket>(2), it exists in a name space "
587 "(address family) but has no address assigned to it.  B<bind>()  assigns the "
588 "address specified to by I<addr> to the socket referred to by the file "
589 "descriptor I<sockfd>.  I<addrlen> specifies the size, in bytes, of the "
590 "address structure pointed to by I<addr>.  Traditionally, this operation is "
591 "called \\(lqassigning a name to a socket\\(rq."
592 msgstr ""
593
594 #. type: Plain text
595 #: build/C/man2/bind.2:97
596 msgid ""
597 "It is normally necessary to assign a local address using B<bind>()  before a "
598 "B<SOCK_STREAM> socket may receive connections (see B<accept>(2))."
599 msgstr ""
600
601 #. type: Plain text
602 #: build/C/man2/bind.2:128
603 msgid ""
604 "The rules used in name binding vary between address families.  Consult the "
605 "manual entries in Section 7 for detailed information.  For B<AF_INET> see "
606 "B<ip>(7), for B<AF_INET6> see B<ipv6>(7), for B<AF_UNIX> see B<unix>(7), for "
607 "B<AF_APPLETALK> see B<ddp>(7), for B<AF_PACKET> see B<packet>(7), for "
608 "B<AF_X25> see B<x25>(7)  and for B<AF_NETLINK> see B<netlink>(7)."
609 msgstr ""
610
611 #. type: Plain text
612 #: build/C/man2/bind.2:135
613 msgid ""
614 "The actual structure passed for the I<addr> argument will depend on the "
615 "address family.  The I<sockaddr> structure is defined as something like:"
616 msgstr ""
617
618 #. type: Plain text
619 #: build/C/man2/bind.2:142
620 #, no-wrap
621 msgid ""
622 "struct sockaddr {\n"
623 "    sa_family_t sa_family;\n"
624 "    char        sa_data[14];\n"
625 "}\n"
626 msgstr ""
627
628 #. type: Plain text
629 #: build/C/man2/bind.2:150
630 msgid ""
631 "The only purpose of this structure is to cast the structure pointer passed "
632 "in I<addr> in order to avoid compiler warnings.  See EXAMPLE below."
633 msgstr ""
634
635 #. type: Plain text
636 #: build/C/man2/bind.2:155 build/C/man2/getsockname.2:70 build/C/man2/getsockopt.2:134 build/C/man2/listen.2:85 build/C/man2/socketpair.2:72
637 msgid ""
638 "On success, zero is returned.  On error, -1 is returned, and I<errno> is set "
639 "appropriately."
640 msgstr ""
641
642 #. type: TP
643 #: build/C/man2/bind.2:156 build/C/man2/bind.2:180 build/C/man3/bindresvport.3:74 build/C/man2/connect.2:133 build/C/man2/send.2:283 build/C/man2/socket.2:318
644 #, no-wrap
645 msgid "B<EACCES>"
646 msgstr ""
647
648 #.  e.g., privileged port in AF_INET domain
649 #. type: Plain text
650 #: build/C/man2/bind.2:160
651 msgid "The address is protected, and the user is not the superuser."
652 msgstr ""
653
654 #. type: TP
655 #: build/C/man2/bind.2:160 build/C/man3/bindresvport.3:79 build/C/man2/connect.2:146 build/C/man2/listen.2:86
656 #, no-wrap
657 msgid "B<EADDRINUSE>"
658 msgstr ""
659
660 #. type: Plain text
661 #: build/C/man2/bind.2:163
662 msgid "The given address is already in use."
663 msgstr ""
664
665 #. type: Plain text
666 #: build/C/man2/bind.2:167
667 msgid "I<sockfd> is not a valid descriptor."
668 msgstr ""
669
670 #.  This may change in the future: see
671 #.  .I linux/unix/sock.c for details.
672 #. type: Plain text
673 #: build/C/man2/bind.2:172
674 msgid "The socket is already bound to an address."
675 msgstr ""
676
677 #. type: Plain text
678 #: build/C/man2/bind.2:176
679 msgid "I<sockfd> is a descriptor for a file, not a socket."
680 msgstr ""
681
682 #. type: Plain text
683 #: build/C/man2/bind.2:180
684 msgid "The following errors are specific to UNIX domain (B<AF_UNIX>)  sockets:"
685 msgstr ""
686
687 #. type: Plain text
688 #: build/C/man2/bind.2:185
689 msgid ""
690 "Search permission is denied on a component of the path prefix.  (See also "
691 "B<path_resolution>(7).)"
692 msgstr ""
693
694 #. type: TP
695 #: build/C/man2/bind.2:185
696 #, no-wrap
697 msgid "B<EADDRNOTAVAIL>"
698 msgstr ""
699
700 #. type: Plain text
701 #: build/C/man2/bind.2:189
702 msgid ""
703 "A nonexistent interface was requested or the requested address was not "
704 "local."
705 msgstr ""
706
707 #. type: Plain text
708 #: build/C/man2/bind.2:193
709 msgid "I<addr> points outside the user's accessible address space."
710 msgstr ""
711
712 #. type: Plain text
713 #: build/C/man2/bind.2:200
714 msgid "The I<addrlen> is wrong, or the socket was not in the B<AF_UNIX> family."
715 msgstr ""
716
717 #. type: TP
718 #: build/C/man2/bind.2:200
719 #, no-wrap
720 msgid "B<ELOOP>"
721 msgstr ""
722
723 #. type: Plain text
724 #: build/C/man2/bind.2:204
725 msgid "Too many symbolic links were encountered in resolving I<addr>."
726 msgstr ""
727
728 #. type: TP
729 #: build/C/man2/bind.2:204
730 #, no-wrap
731 msgid "B<ENAMETOOLONG>"
732 msgstr ""
733
734 #. type: Plain text
735 #: build/C/man2/bind.2:208
736 msgid "I<addr> is too long."
737 msgstr ""
738
739 #. type: TP
740 #: build/C/man2/bind.2:208
741 #, no-wrap
742 msgid "B<ENOENT>"
743 msgstr ""
744
745 #. type: Plain text
746 #: build/C/man2/bind.2:211
747 msgid "The file does not exist."
748 msgstr ""
749
750 #. type: TP
751 #: build/C/man2/bind.2:211 build/C/man2/recv.2:427 build/C/man2/select.2:318 build/C/man2/send.2:338
752 #, no-wrap
753 msgid "B<ENOMEM>"
754 msgstr ""
755
756 #. type: Plain text
757 #: build/C/man2/bind.2:214
758 msgid "Insufficient kernel memory was available."
759 msgstr ""
760
761 #. type: TP
762 #: build/C/man2/bind.2:214
763 #, no-wrap
764 msgid "B<ENOTDIR>"
765 msgstr ""
766
767 #. type: Plain text
768 #: build/C/man2/bind.2:217
769 msgid "A component of the path prefix is not a directory."
770 msgstr ""
771
772 #. type: TP
773 #: build/C/man2/bind.2:217
774 #, no-wrap
775 msgid "B<EROFS>"
776 msgstr ""
777
778 #. type: Plain text
779 #: build/C/man2/bind.2:220
780 msgid "The socket inode would reside on a read-only file system."
781 msgstr ""
782
783 #.  SVr4 documents an additional
784 #.  .B ENOSR
785 #.  general error condition, and
786 #.  additional
787 #.  .B EIO
788 #.  and
789 #.  .B EISDIR
790 #.  UNIX-domain error conditions.
791 #. type: Plain text
792 #: build/C/man2/bind.2:232
793 msgid "SVr4, 4.4BSD, POSIX.1-2001 (B<bind>()  first appeared in 4.2BSD)."
794 msgstr ""
795
796 #. type: Plain text
797 #: build/C/man2/bind.2:249
798 msgid ""
799 "The third argument of B<bind>()  is in reality an I<int> (and this is what "
800 "4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in the "
801 "present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
802 msgstr ""
803
804 #. type: SH
805 #: build/C/man2/bind.2:249 build/C/man2/getsockopt.2:197 build/C/man2/select.2:425 build/C/man2/send.2:409 build/C/man3/sockatmark.3:91 build/C/man7/socket.7:729
806 #, no-wrap
807 msgid "BUGS"
808 msgstr ""
809
810 #.  FIXME What *are* transparent proxy options?
811 #. type: Plain text
812 #: build/C/man2/bind.2:252
813 msgid "The transparent proxy options are not described."
814 msgstr ""
815
816 #. type: Plain text
817 #: build/C/man2/bind.2:257
818 msgid ""
819 "An example of the use of B<bind>()  with Internet domain sockets can be "
820 "found in B<getaddrinfo>(3)."
821 msgstr ""
822
823 #.  listen.7 refers to this example.
824 #.  accept.7 refers to this example.
825 #.  unix.7 refers to this example.
826 #. type: Plain text
827 #: build/C/man2/bind.2:264
828 msgid ""
829 "The following example shows how to bind a stream socket in the UNIX "
830 "(B<AF_UNIX>)  domain, and accept connections:"
831 msgstr ""
832
833 #. type: Plain text
834 #: build/C/man2/bind.2:271
835 #, no-wrap
836 msgid ""
837 "#include E<lt>sys/socket.hE<gt>\n"
838 "#include E<lt>sys/un.hE<gt>\n"
839 "#include E<lt>stdlib.hE<gt>\n"
840 "#include E<lt>stdio.hE<gt>\n"
841 "#include E<lt>string.hE<gt>\n"
842 msgstr ""
843
844 #. type: Plain text
845 #: build/C/man2/bind.2:274
846 #, no-wrap
847 msgid ""
848 "#define MY_SOCK_PATH \"/somepath\"\n"
849 "#define LISTEN_BACKLOG 50\n"
850 msgstr ""
851
852 #. type: Plain text
853 #: build/C/man2/bind.2:277
854 #, no-wrap
855 msgid ""
856 "#define handle_error(msg) \\e\n"
857 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
858 msgstr ""
859
860 #. type: Plain text
861 #: build/C/man2/bind.2:284
862 #, no-wrap
863 msgid ""
864 "int\n"
865 "main(int argc, char *argv[])\n"
866 "{\n"
867 "    int sfd, cfd;\n"
868 "    struct sockaddr_un my_addr, peer_addr;\n"
869 "    socklen_t peer_addr_size;\n"
870 msgstr ""
871
872 #. type: Plain text
873 #: build/C/man2/bind.2:288
874 #, no-wrap
875 msgid ""
876 "    sfd = socket(AF_UNIX, SOCK_STREAM, 0);\n"
877 "    if (sfd == -1)\n"
878 "        handle_error(\"socket\");\n"
879 msgstr ""
880
881 #. type: Plain text
882 #: build/C/man2/bind.2:294
883 #, no-wrap
884 msgid ""
885 "    memset(&my_addr, 0, sizeof(struct sockaddr_un));\n"
886 "                        /* Clear structure */\n"
887 "    my_addr.sun_family = AF_UNIX;\n"
888 "    strncpy(my_addr.sun_path, MY_SOCK_PATH,\n"
889 "            sizeof(my_addr.sun_path) - 1);\n"
890 msgstr ""
891
892 #. type: Plain text
893 #: build/C/man2/bind.2:298
894 #, no-wrap
895 msgid ""
896 "    if (bind(sfd, (struct sockaddr *) &my_addr,\n"
897 "            sizeof(struct sockaddr_un)) == -1)\n"
898 "        handle_error(\"bind\");\n"
899 msgstr ""
900
901 #. type: Plain text
902 #: build/C/man2/bind.2:301
903 #, no-wrap
904 msgid ""
905 "    if (listen(sfd, LISTEN_BACKLOG) == -1)\n"
906 "        handle_error(\"listen\");\n"
907 msgstr ""
908
909 #. type: Plain text
910 #: build/C/man2/bind.2:304
911 #, no-wrap
912 msgid ""
913 "    /* Now we can accept incoming connections one\n"
914 "       at a time using accept(2) */\n"
915 msgstr ""
916
917 #. type: Plain text
918 #: build/C/man2/bind.2:310
919 #, no-wrap
920 msgid ""
921 "    peer_addr_size = sizeof(struct sockaddr_un);\n"
922 "    cfd = accept(sfd, (struct sockaddr *) &peer_addr,\n"
923 "                 &peer_addr_size);\n"
924 "    if (cfd == -1)\n"
925 "        handle_error(\"accept\");\n"
926 msgstr ""
927
928 #. type: Plain text
929 #: build/C/man2/bind.2:312
930 #, no-wrap
931 msgid "    /* Code to deal with incoming connection(s)... */\n"
932 msgstr ""
933
934 #. type: Plain text
935 #: build/C/man2/bind.2:316
936 #, no-wrap
937 msgid ""
938 "    /* When no longer required, the socket pathname, MY_SOCK_PATH\n"
939 "       should be deleted using unlink(2) or remove(3) */\n"
940 "}\n"
941 msgstr ""
942
943 #. type: Plain text
944 #: build/C/man2/bind.2:329
945 msgid ""
946 "B<accept>(2), B<connect>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), "
947 "B<getaddrinfo>(3), B<getifaddrs>(3), B<ip>(7), B<ipv6>(7), "
948 "B<path_resolution>(7), B<socket>(7), B<unix>(7)"
949 msgstr ""
950
951 #. type: TH
952 #: build/C/man3/bindresvport.3:27
953 #, no-wrap
954 msgid "BINDRESVPORT"
955 msgstr ""
956
957 #. type: TH
958 #: build/C/man3/bindresvport.3:27 build/C/man2/connect.2:65 build/C/man2/getsockname.2:38 build/C/man2/getsockopt.2:42 build/C/man3/sockatmark.3:23
959 #, no-wrap
960 msgid "2008-12-03"
961 msgstr ""
962
963 #. type: Plain text
964 #: build/C/man3/bindresvport.3:30
965 msgid "bindresvport - bind a socket to a privileged IP port"
966 msgstr ""
967
968 #. type: Plain text
969 #: build/C/man3/bindresvport.3:34
970 #, no-wrap
971 msgid ""
972 "B<#include E<lt>sys/types.hE<gt>>\n"
973 "B<#include E<lt>netinet/in.hE<gt>>\n"
974 msgstr ""
975
976 #. type: Plain text
977 #: build/C/man3/bindresvport.3:36
978 #, no-wrap
979 msgid "B<int bindresvport(int >I<sockfd>B<, struct sockaddr_in *>I<sin>B<);>\n"
980 msgstr ""
981
982 #.  Glibc actually starts searching with a port # in the range 600 to 1023
983 #. type: Plain text
984 #: build/C/man3/bindresvport.3:43
985 msgid ""
986 "B<bindresvport>()  is used to bind a socket descriptor to a privileged "
987 "anonymous IP port, that is, a port number arbitrarily selected from the "
988 "range 512 to 1023."
989 msgstr ""
990
991 #. type: Plain text
992 #: build/C/man3/bindresvport.3:53
993 msgid ""
994 "If the B<bind>(2)  performed by B<bindresvport>()  is successful, and I<sin> "
995 "is not NULL, then I<sin-E<gt>sin_port> returns the port number actually "
996 "allocated."
997 msgstr ""
998
999 #. type: Plain text
1000 #: build/C/man3/bindresvport.3:64
1001 msgid ""
1002 "I<sin> can be NULL, in which case I<sin-E<gt>sin_family> is implicitly taken "
1003 "to be B<AF_INET>.  However, in this case, B<bindresvport>()  has no way to "
1004 "return the port number actually allocated.  (This information can later be "
1005 "obtained using B<getsockname>(2).)"
1006 msgstr ""
1007
1008 #. type: Plain text
1009 #: build/C/man3/bindresvport.3:69
1010 msgid ""
1011 "B<bindresvport>()  returns 0 on success; otherwise -1 is returned and "
1012 "I<errno> set to indicate the cause of the error."
1013 msgstr ""
1014
1015 #. type: Plain text
1016 #: build/C/man3/bindresvport.3:74
1017 msgid ""
1018 "B<bindresvport>()  can fail for any of the same reasons as B<bind>(2).  In "
1019 "addition, the following errors may occur:"
1020 msgstr ""
1021
1022 #. type: Plain text
1023 #: build/C/man3/bindresvport.3:79
1024 msgid ""
1025 "The caller did not have superuser privilege (to be precise: the "
1026 "B<CAP_NET_BIND_SERVICE> capability is required)."
1027 msgstr ""
1028
1029 #. type: Plain text
1030 #: build/C/man3/bindresvport.3:82
1031 msgid "All privileged ports are in use."
1032 msgstr ""
1033
1034 #. type: TP
1035 #: build/C/man3/bindresvport.3:82
1036 #, no-wrap
1037 msgid "B<EAFNOSUPPORT> (B<EPFNOSUPPORT> in glibc 2.7 and earlier)"
1038 msgstr ""
1039
1040 #. type: Plain text
1041 #: build/C/man3/bindresvport.3:89
1042 msgid "I<sin> is not NULL and I<sin-E<gt>sin_family> is not B<AF_INET>."
1043 msgstr ""
1044
1045 #. type: Plain text
1046 #: build/C/man3/bindresvport.3:92
1047 msgid "Not in POSIX.1-2001.  Present on the BSDs, Solaris, and many other systems."
1048 msgstr ""
1049
1050 #. type: Plain text
1051 #: build/C/man3/bindresvport.3:98
1052 msgid ""
1053 "Unlike some B<bindresvport>()  implementations, the glibc implementation "
1054 "ignores any value that the caller supplies in I<sin-E<gt>sin_port>."
1055 msgstr ""
1056
1057 #. type: Plain text
1058 #: build/C/man3/bindresvport.3:100
1059 msgid "B<bind>(2), B<getsockname>(2)"
1060 msgstr ""
1061
1062 #. type: TH
1063 #: build/C/man2/connect.2:65
1064 #, no-wrap
1065 msgid "CONNECT"
1066 msgstr ""
1067
1068 #. type: Plain text
1069 #: build/C/man2/connect.2:68
1070 msgid "connect - initiate a connection on a socket"
1071 msgstr ""
1072
1073 #. type: Plain text
1074 #: build/C/man2/connect.2:71 build/C/man2/getsockopt.2:48 build/C/man2/listen.2:49
1075 #, no-wrap
1076 msgid "B<#include E<lt>sys/types.hE<gt>>          /* See NOTES */\n"
1077 msgstr ""
1078
1079 #. type: Plain text
1080 #: build/C/man2/connect.2:73 build/C/man2/getsockname.2:44 build/C/man2/getsockopt.2:50 build/C/man2/listen.2:51 build/C/man2/recv.2:49
1081 #, no-wrap
1082 msgid "B<#include E<lt>sys/socket.hE<gt>>\n"
1083 msgstr ""
1084
1085 #. type: Plain text
1086 #: build/C/man2/connect.2:76
1087 #, no-wrap
1088 msgid ""
1089 "B<int connect(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
1090 "B<            socklen_t >I<addrlen>B<);>\n"
1091 msgstr ""
1092
1093 #. type: Plain text
1094 #: build/C/man2/connect.2:95
1095 msgid ""
1096 "The B<connect>()  system call connects the socket referred to by the file "
1097 "descriptor I<sockfd> to the address specified by I<addr>.  The I<addrlen> "
1098 "argument specifies the size of I<addr>.  The format of the address in "
1099 "I<addr> is determined by the address space of the socket I<sockfd>; see "
1100 "B<socket>(2)  for further details."
1101 msgstr ""
1102
1103 #. type: Plain text
1104 #: build/C/man2/connect.2:111
1105 msgid ""
1106 "If the socket I<sockfd> is of type B<SOCK_DGRAM> then I<addr> is the address "
1107 "to which datagrams are sent by default, and the only address from which "
1108 "datagrams are received.  If the socket is of type B<SOCK_STREAM> or "
1109 "B<SOCK_SEQPACKET>, this call attempts to make a connection to the socket "
1110 "that is bound to the address specified by I<addr>."
1111 msgstr ""
1112
1113 #. type: Plain text
1114 #: build/C/man2/connect.2:125
1115 msgid ""
1116 "Generally, connection-based protocol sockets may successfully B<connect>()  "
1117 "only once; connectionless protocol sockets may use B<connect>()  multiple "
1118 "times to change their association.  Connectionless sockets may dissolve the "
1119 "association by connecting to an address with the I<sa_family> member of "
1120 "I<sockaddr> set to B<AF_UNSPEC> (supported on Linux since kernel 2.2)."
1121 msgstr ""
1122
1123 #. type: Plain text
1124 #: build/C/man2/connect.2:130
1125 msgid ""
1126 "If the connection or binding succeeds, zero is returned.  On error, -1 is "
1127 "returned, and I<errno> is set appropriately."
1128 msgstr ""
1129
1130 #. type: Plain text
1131 #: build/C/man2/connect.2:133
1132 msgid ""
1133 "The following are general socket errors only.  There may be other "
1134 "domain-specific error codes."
1135 msgstr ""
1136
1137 #. type: Plain text
1138 #: build/C/man2/connect.2:141
1139 msgid ""
1140 "For UNIX domain sockets, which are identified by pathname: Write permission "
1141 "is denied on the socket file, or search permission is denied for one of the "
1142 "directories in the path prefix.  (See also B<path_resolution>(7).)"
1143 msgstr ""
1144
1145 #. type: TP
1146 #: build/C/man2/connect.2:141
1147 #, no-wrap
1148 msgid "B<EACCES>, B<EPERM>"
1149 msgstr ""
1150
1151 #. type: Plain text
1152 #: build/C/man2/connect.2:146
1153 msgid ""
1154 "The user tried to connect to a broadcast address without having the socket "
1155 "broadcast flag enabled or the connection request failed because of a local "
1156 "firewall rule."
1157 msgstr ""
1158
1159 #. type: Plain text
1160 #: build/C/man2/connect.2:149
1161 msgid "Local address is already in use."
1162 msgstr ""
1163
1164 #. type: TP
1165 #: build/C/man2/connect.2:149 build/C/man2/socket.2:322 build/C/man2/socketpair.2:73
1166 #, no-wrap
1167 msgid "B<EAFNOSUPPORT>"
1168 msgstr ""
1169
1170 #. type: Plain text
1171 #: build/C/man2/connect.2:154
1172 msgid ""
1173 "The passed address didn't have the correct address family in its "
1174 "I<sa_family> field."
1175 msgstr ""
1176
1177 #. type: TP
1178 #: build/C/man2/connect.2:154
1179 #, no-wrap
1180 msgid "B<EAGAIN>"
1181 msgstr ""
1182
1183 #. type: Plain text
1184 #: build/C/man2/connect.2:163
1185 msgid ""
1186 "No more free local ports or insufficient entries in the routing cache.  For "
1187 "B<AF_INET> see the description of I</proc/sys/net/ipv4/ip_local_port_range> "
1188 "B<ip>(7)  for information on how to increase the number of local ports."
1189 msgstr ""
1190
1191 #. type: TP
1192 #: build/C/man2/connect.2:163
1193 #, no-wrap
1194 msgid "B<EALREADY>"
1195 msgstr ""
1196
1197 #. type: Plain text
1198 #: build/C/man2/connect.2:167
1199 msgid ""
1200 "The socket is nonblocking and a previous connection attempt has not yet been "
1201 "completed."
1202 msgstr ""
1203
1204 #. type: Plain text
1205 #: build/C/man2/connect.2:170
1206 msgid "The file descriptor is not a valid index in the descriptor table."
1207 msgstr ""
1208
1209 #. type: TP
1210 #: build/C/man2/connect.2:170 build/C/man2/recv.2:410
1211 #, no-wrap
1212 msgid "B<ECONNREFUSED>"
1213 msgstr ""
1214
1215 #. type: Plain text
1216 #: build/C/man2/connect.2:173
1217 msgid "No-one listening on the remote address."
1218 msgstr ""
1219
1220 #. type: Plain text
1221 #: build/C/man2/connect.2:176
1222 msgid "The socket structure address is outside the user's address space."
1223 msgstr ""
1224
1225 #. type: TP
1226 #: build/C/man2/connect.2:176
1227 #, no-wrap
1228 msgid "B<EINPROGRESS>"
1229 msgstr ""
1230
1231 #. type: Plain text
1232 #: build/C/man2/connect.2:201
1233 msgid ""
1234 "The socket is nonblocking and the connection cannot be completed "
1235 "immediately.  It is possible to B<select>(2)  or B<poll>(2)  for completion "
1236 "by selecting the socket for writing.  After B<select>(2)  indicates "
1237 "writability, use B<getsockopt>(2)  to read the B<SO_ERROR> option at level "
1238 "B<SOL_SOCKET> to determine whether B<connect>()  completed successfully "
1239 "(B<SO_ERROR> is zero) or unsuccessfully (B<SO_ERROR> is one of the usual "
1240 "error codes listed here, explaining the reason for the failure)."
1241 msgstr ""
1242
1243 #.  For TCP, the connection will complete asynchronously.
1244 #.  See http://lkml.org/lkml/2005/7/12/254
1245 #. type: Plain text
1246 #: build/C/man2/connect.2:207
1247 msgid ""
1248 "The system call was interrupted by a signal that was caught; see "
1249 "B<signal>(7)."
1250 msgstr ""
1251
1252 #. type: TP
1253 #: build/C/man2/connect.2:207 build/C/man2/send.2:318
1254 #, no-wrap
1255 msgid "B<EISCONN>"
1256 msgstr ""
1257
1258 #. type: Plain text
1259 #: build/C/man2/connect.2:210
1260 msgid "The socket is already connected."
1261 msgstr ""
1262
1263 #. type: TP
1264 #: build/C/man2/connect.2:210
1265 #, no-wrap
1266 msgid "B<ENETUNREACH>"
1267 msgstr ""
1268
1269 #. type: Plain text
1270 #: build/C/man2/connect.2:213
1271 msgid "Network is unreachable."
1272 msgstr ""
1273
1274 #. type: Plain text
1275 #: build/C/man2/connect.2:216
1276 msgid "The file descriptor is not associated with a socket."
1277 msgstr ""
1278
1279 #. type: TP
1280 #: build/C/man2/connect.2:216
1281 #, no-wrap
1282 msgid "B<ETIMEDOUT>"
1283 msgstr ""
1284
1285 #. type: Plain text
1286 #: build/C/man2/connect.2:223
1287 msgid ""
1288 "Timeout while attempting connection.  The server may be too busy to accept "
1289 "new connections.  Note that for IP sockets the timeout may be very long when "
1290 "syncookies are enabled on the server."
1291 msgstr ""
1292
1293 #.  SVr4 documents the additional
1294 #.  general error codes
1295 #.  .BR EADDRNOTAVAIL ,
1296 #.  .BR EINVAL ,
1297 #.  .BR EAFNOSUPPORT ,
1298 #.  .BR EALREADY ,
1299 #.  .BR EINTR ,
1300 #.  .BR EPROTOTYPE ,
1301 #.  and
1302 #.  .BR ENOSR .
1303 #.  It also
1304 #.  documents many additional error conditions not described here.
1305 #. type: Plain text
1306 #: build/C/man2/connect.2:239
1307 msgid ""
1308 "SVr4, 4.4BSD, (the B<connect>()  function first appeared in 4.2BSD), "
1309 "POSIX.1-2001."
1310 msgstr ""
1311
1312 #. type: Plain text
1313 #: build/C/man2/connect.2:256
1314 msgid ""
1315 "The third argument of B<connect>()  is in reality an I<int> (and this is "
1316 "what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in "
1317 "the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
1318 msgstr ""
1319
1320 #. type: Plain text
1321 #: build/C/man2/connect.2:261
1322 msgid "An example of the use of B<connect>()  is shown in B<getaddrinfo>(3)."
1323 msgstr ""
1324
1325 #. type: Plain text
1326 #: build/C/man2/connect.2:267
1327 msgid ""
1328 "B<accept>(2), B<bind>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), "
1329 "B<path_resolution>(7)"
1330 msgstr ""
1331
1332 #. type: TH
1333 #: build/C/man3/getifaddrs.3:33
1334 #, no-wrap
1335 msgid "GETIFADDRS"
1336 msgstr ""
1337
1338 #. type: TH
1339 #: build/C/man3/getifaddrs.3:33
1340 #, no-wrap
1341 msgid "2010-10-06"
1342 msgstr ""
1343
1344 #. type: TH
1345 #: build/C/man3/getifaddrs.3:33
1346 #, no-wrap
1347 msgid "GNU"
1348 msgstr ""
1349
1350 #. type: Plain text
1351 #: build/C/man3/getifaddrs.3:36
1352 msgid "getifaddrs, freeifaddrs - get interface addresses"
1353 msgstr ""
1354
1355 #. type: Plain text
1356 #: build/C/man3/getifaddrs.3:40
1357 #, no-wrap
1358 msgid ""
1359 "B<#include E<lt>sys/types.hE<gt>>\n"
1360 "B<#include E<lt>ifaddrs.hE<gt>>\n"
1361 msgstr ""
1362
1363 #. type: Plain text
1364 #: build/C/man3/getifaddrs.3:42
1365 #, no-wrap
1366 msgid "B<int getifaddrs(struct ifaddrs **>I<ifap>B<);>\n"
1367 msgstr ""
1368
1369 #. type: Plain text
1370 #: build/C/man3/getifaddrs.3:44
1371 #, no-wrap
1372 msgid "B<void freeifaddrs(struct ifaddrs *>I<ifa>B<);>\n"
1373 msgstr ""
1374
1375 #. type: Plain text
1376 #: build/C/man3/getifaddrs.3:55
1377 msgid ""
1378 "The B<getifaddrs>()  function creates a linked list of structures describing "
1379 "the network interfaces of the local system, and stores the address of the "
1380 "first item of the list in I<*ifap>.  The list consists of I<ifaddrs> "
1381 "structures, defined as follows:"
1382 msgstr ""
1383
1384 #. type: Plain text
1385 #: build/C/man3/getifaddrs.3:74
1386 #, no-wrap
1387 msgid ""
1388 "struct ifaddrs {\n"
1389 "    struct ifaddrs  *ifa_next;    /* Next item in list */\n"
1390 "    char            *ifa_name;    /* Name of interface */\n"
1391 "    unsigned int     ifa_flags;   /* Flags from SIOCGIFFLAGS */\n"
1392 "    struct sockaddr *ifa_addr;    /* Address of interface */\n"
1393 "    struct sockaddr *ifa_netmask; /* Netmask of interface */\n"
1394 "    union {\n"
1395 "        struct sockaddr *ifu_broadaddr;\n"
1396 "                         /* Broadcast address of interface */\n"
1397 "        struct sockaddr *ifu_dstaddr;\n"
1398 "                         /* Point-to-point destination address */\n"
1399 "    } ifa_ifu;\n"
1400 "#define              ifa_broadaddr ifa_ifu.ifu_broadaddr\n"
1401 "#define              ifa_dstaddr   ifa_ifu.ifu_dstaddr\n"
1402 "    void            *ifa_data;    /* Address-specific data */\n"
1403 "};\n"
1404 msgstr ""
1405
1406 #. type: Plain text
1407 #: build/C/man3/getifaddrs.3:81
1408 msgid ""
1409 "The I<ifa_next> field contains a pointer to the next structure on the list, "
1410 "or NULL if this is the last item of the list."
1411 msgstr ""
1412
1413 #.  The constant
1414 #.  .B IF NAMESIZE
1415 #.  indicates the maximum length of this field.
1416 #. type: Plain text
1417 #: build/C/man3/getifaddrs.3:88
1418 msgid "The I<ifa_name> points to the null-terminated interface name."
1419 msgstr ""
1420
1421 #. type: Plain text
1422 #: build/C/man3/getifaddrs.3:97
1423 msgid ""
1424 "The I<ifa_flags> field contains the interface flags, as returned by the "
1425 "B<SIOCGIFFLAGS> B<ioctl>(2)  operation (see B<netdevice>(7)  for a list of "
1426 "these flags)."
1427 msgstr ""
1428
1429 #. type: Plain text
1430 #: build/C/man3/getifaddrs.3:105
1431 msgid ""
1432 "The I<ifa_addr> field points to a structure containing the interface "
1433 "address.  (The I<sa_family> subfield should be consulted to determine the "
1434 "format of the address structure.)"
1435 msgstr ""
1436
1437 #. type: Plain text
1438 #: build/C/man3/getifaddrs.3:111
1439 msgid ""
1440 "The I<ifa_netmask> field points to a structure containing the netmask "
1441 "associated with I<ifa_addr>, if applicable for the address family."
1442 msgstr ""
1443
1444 #. type: Plain text
1445 #: build/C/man3/getifaddrs.3:126
1446 msgid ""
1447 "Depending on whether the bit B<IFF_BROADCAST> or B<IFF_POINTOPOINT> is set "
1448 "in I<ifa_flags> (only one can be set at a time), either I<ifa_broadaddr> "
1449 "will contain the broadcast address associated with I<ifa_addr> (if "
1450 "applicable for the address family) or I<ifa_dstaddr> will contain the "
1451 "destination address of the point-to-point interface."
1452 msgstr ""
1453
1454 #. type: Plain text
1455 #: build/C/man3/getifaddrs.3:131
1456 msgid ""
1457 "The I<ifa_data> field points to a buffer containing address-family-specific "
1458 "data; this field may be NULL if there is no such data for this interface."
1459 msgstr ""
1460
1461 #. type: Plain text
1462 #: build/C/man3/getifaddrs.3:137
1463 msgid ""
1464 "The data returned by B<getifaddrs>()  is dynamically allocated and should be "
1465 "freed using B<freeifaddrs>()  when no longer needed."
1466 msgstr ""
1467
1468 #. type: Plain text
1469 #: build/C/man3/getifaddrs.3:144
1470 msgid ""
1471 "On success, B<getifaddrs>()  returns zero; on error, -1 is returned, and "
1472 "I<errno> is set appropriately."
1473 msgstr ""
1474
1475 #. type: Plain text
1476 #: build/C/man3/getifaddrs.3:157
1477 msgid ""
1478 "B<getifaddrs>()  may fail and set I<errno> for any of the errors specified "
1479 "for B<socket>(2), B<bind>(2), B<getsockname>(2), B<recvmsg>(2), "
1480 "B<sendto>(2), B<malloc>(3), or B<realloc>(3)."
1481 msgstr ""
1482
1483 #. type: Plain text
1484 #: build/C/man3/getifaddrs.3:165
1485 msgid ""
1486 "The B<getifaddrs>()  function first appeared in glibc 2.3, but before glibc "
1487 "2.3.3, the implementation only supported IPv4 addresses; IPv6 support was "
1488 "added in glibc 2.3.3.  Support of address families other than IPv4 is only "
1489 "available on kernels that support netlink."
1490 msgstr ""
1491
1492 #.  , but the BSD-derived documentation generally
1493 #.  appears to be confused and obsolete on this point.
1494 #.  i.e., commonly it still says one of them will be NULL, even if
1495 #.  the ifa_ifu union is already present
1496 #. type: Plain text
1497 #: build/C/man3/getifaddrs.3:185
1498 msgid ""
1499 "Not in POSIX.1-2001.  This function first appeared in BSDi and is present on "
1500 "the BSD systems, but with slightly different semantics "
1501 "documented\\(emreturning one entry per interface, not per address.  This "
1502 "means I<ifa_addr> and other fields can actually be NULL if the interface has "
1503 "no address, and no link-level address is returned if the interface has an IP "
1504 "address assigned.  Also, the way of choosing either I<ifa_broadaddr> or "
1505 "I<ifa_dstaddr> differs on various systems."
1506 msgstr ""
1507
1508 #. type: Plain text
1509 #: build/C/man3/getifaddrs.3:198
1510 msgid ""
1511 "The addresses returned on Linux will usually be the IPv4 and IPv6 addresses "
1512 "assigned to the interface, but also one B<AF_PACKET> address per interface "
1513 "containing lower-level details about the interface and its physical layer.  "
1514 "In this case, the I<ifa_data> field may contain a pointer to a I<struct "
1515 "net_device_stats>, defined in I<E<lt>linux/netdevice.hE<gt>>, which contains "
1516 "various interface attributes and statistics."
1517 msgstr ""
1518
1519 #. type: Plain text
1520 #: build/C/man3/getifaddrs.3:205
1521 msgid ""
1522 "The program below demonstrates the use of B<getifaddrs>(), B<freeifaddrs>(), "
1523 "and B<getnameinfo>(3).  Here is what we see when running this program on one "
1524 "system:"
1525 msgstr ""
1526
1527 #. type: Plain text
1528 #: build/C/man3/getifaddrs.3:219
1529 #, no-wrap
1530 msgid ""
1531 "$ B<./a.out>\n"
1532 "lo      address family: 17 (AF_PACKET)\n"
1533 "eth0    address family: 17 (AF_PACKET)\n"
1534 "lo      address family: 2 (AF_INET)\n"
1535 "        address: E<lt>127.0.0.1E<gt>\n"
1536 "eth0    address family: 2 (AF_INET)\n"
1537 "        address: E<lt>10.1.1.4E<gt>\n"
1538 "lo      address family: 10 (AF_INET6)\n"
1539 "        address: E<lt>::1E<gt>\n"
1540 "eth0    address family: 10 (AF_INET6)\n"
1541 "        address: E<lt>fe80::2d0:59ff:feda:eb51%eth0E<gt>\n"
1542 msgstr ""
1543
1544 #. type: SS
1545 #: build/C/man3/getifaddrs.3:221
1546 #, no-wrap
1547 msgid "Program source"
1548 msgstr ""
1549
1550 #. type: Plain text
1551 #: build/C/man3/getifaddrs.3:231
1552 #, no-wrap
1553 msgid ""
1554 "#include E<lt>arpa/inet.hE<gt>\n"
1555 "#include E<lt>sys/socket.hE<gt>\n"
1556 "#include E<lt>netdb.hE<gt>\n"
1557 "#include E<lt>ifaddrs.hE<gt>\n"
1558 "#include E<lt>stdio.hE<gt>\n"
1559 "#include E<lt>stdlib.hE<gt>\n"
1560 "#include E<lt>unistd.hE<gt>\n"
1561 msgstr ""
1562
1563 #. type: Plain text
1564 #: build/C/man3/getifaddrs.3:238
1565 #, no-wrap
1566 msgid ""
1567 "int\n"
1568 "main(int argc, char *argv[])\n"
1569 "{\n"
1570 "    struct ifaddrs *ifaddr, *ifa;\n"
1571 "    int family, s;\n"
1572 "    char host[NI_MAXHOST];\n"
1573 msgstr ""
1574
1575 #. type: Plain text
1576 #: build/C/man3/getifaddrs.3:243
1577 #, no-wrap
1578 msgid ""
1579 "    if (getifaddrs(&ifaddr) == -1) {\n"
1580 "        perror(\"getifaddrs\");\n"
1581 "        exit(EXIT_FAILURE);\n"
1582 "    }\n"
1583 msgstr ""
1584
1585 #. type: Plain text
1586 #: build/C/man3/getifaddrs.3:246
1587 #, no-wrap
1588 msgid ""
1589 "    /* Walk through linked list, maintaining head pointer so we\n"
1590 "       can free list later */\n"
1591 msgstr ""
1592
1593 #. type: Plain text
1594 #: build/C/man3/getifaddrs.3:250
1595 #, no-wrap
1596 msgid ""
1597 "    for (ifa = ifaddr; ifa != NULL; ifa = ifa-E<gt>ifa_next) {\n"
1598 "        if (ifa-E<gt>ifa_addr == NULL)\n"
1599 "            continue;\n"
1600 msgstr ""
1601
1602 #. type: Plain text
1603 #: build/C/man3/getifaddrs.3:252
1604 #, no-wrap
1605 msgid "        family = ifa-E<gt>ifa_addr-E<gt>sa_family;\n"
1606 msgstr ""
1607
1608 #. type: Plain text
1609 #: build/C/man3/getifaddrs.3:255
1610 #, no-wrap
1611 msgid ""
1612 "        /* Display interface name and family (including symbolic\n"
1613 "           form of the latter for the common families) */\n"
1614 msgstr ""
1615
1616 #. type: Plain text
1617 #: build/C/man3/getifaddrs.3:261
1618 #, no-wrap
1619 msgid ""
1620 "        printf(\"%s\\t  address family: %d%s\\en\",\n"
1621 "                ifa-E<gt>ifa_name, family,\n"
1622 "                (family == AF_PACKET) ? \" (AF_PACKET)\" :\n"
1623 "                (family == AF_INET) ?   \" (AF_INET)\" :\n"
1624 "                (family == AF_INET6) ?  \" (AF_INET6)\" : \"\");\n"
1625 msgstr ""
1626
1627 #. type: Plain text
1628 #: build/C/man3/getifaddrs.3:263
1629 #, no-wrap
1630 msgid "        /* For an AF_INET* interface address, display the address */\n"
1631 msgstr ""
1632
1633 #. type: Plain text
1634 #: build/C/man3/getifaddrs.3:276
1635 #, no-wrap
1636 msgid ""
1637 "        if (family == AF_INET || family == AF_INET6) {\n"
1638 "            s = getnameinfo(ifa-E<gt>ifa_addr,\n"
1639 "                    (family == AF_INET) ? sizeof(struct sockaddr_in) :\n"
1640 "                                          sizeof(struct sockaddr_in6),\n"
1641 "                    host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);\n"
1642 "            if (s != 0) {\n"
1643 "                printf(\"getnameinfo() failed: %s\\en\", gai_strerror(s));\n"
1644 "                exit(EXIT_FAILURE);\n"
1645 "            }\n"
1646 "            printf(\"\\etaddress: E<lt>%sE<gt>\\en\", host);\n"
1647 "        }\n"
1648 "    }\n"
1649 msgstr ""
1650
1651 #. type: Plain text
1652 #: build/C/man3/getifaddrs.3:280
1653 #, no-wrap
1654 msgid ""
1655 "    freeifaddrs(ifaddr);\n"
1656 "    exit(EXIT_SUCCESS);\n"
1657 "}\n"
1658 msgstr ""
1659
1660 #. type: Plain text
1661 #: build/C/man3/getifaddrs.3:286
1662 msgid "B<bind>(2), B<getsockname>(2), B<socket>(2), B<packet>(7), B<ifconfig>(8)"
1663 msgstr ""
1664
1665 #. type: TH
1666 #: build/C/man2/getsockname.2:38
1667 #, no-wrap
1668 msgid "GETSOCKNAME"
1669 msgstr ""
1670
1671 #. type: Plain text
1672 #: build/C/man2/getsockname.2:41
1673 msgid "getsockname - get socket name"
1674 msgstr ""
1675
1676 #. type: Plain text
1677 #: build/C/man2/getsockname.2:47
1678 #, no-wrap
1679 msgid ""
1680 "B<int getsockname(int >I<sockfd>B<, struct sockaddr *>I<addr>B<, socklen_t "
1681 "*>I<addrlen>B<);>\n"
1682 msgstr ""
1683
1684 #. type: Plain text
1685 #: build/C/man2/getsockname.2:60
1686 msgid ""
1687 "B<getsockname>()  returns the current address to which the socket I<sockfd> "
1688 "is bound, in the buffer pointed to by I<addr>.  The I<addrlen> argument "
1689 "should be initialized to indicate the amount of space (in bytes) pointed to "
1690 "by I<addr>.  On return it contains the actual size of the socket address."
1691 msgstr ""
1692
1693 #. type: Plain text
1694 #: build/C/man2/getsockname.2:76 build/C/man2/getsockopt.2:140 build/C/man2/listen.2:94
1695 msgid "The argument I<sockfd> is not a valid descriptor."
1696 msgstr ""
1697
1698 #. type: Plain text
1699 #: build/C/man2/getsockname.2:82
1700 msgid ""
1701 "The I<addr> argument points to memory not in a valid part of the process "
1702 "address space."
1703 msgstr ""
1704
1705 #. type: Plain text
1706 #: build/C/man2/getsockname.2:86
1707 msgid "I<addrlen> is invalid (e.g., is negative)."
1708 msgstr ""
1709
1710 #. type: TP
1711 #: build/C/man2/getsockname.2:86 build/C/man2/send.2:330
1712 #, no-wrap
1713 msgid "B<ENOBUFS>"
1714 msgstr ""
1715
1716 #. type: Plain text
1717 #: build/C/man2/getsockname.2:90
1718 msgid ""
1719 "Insufficient resources were available in the system to perform the "
1720 "operation."
1721 msgstr ""
1722
1723 #. type: Plain text
1724 #: build/C/man2/getsockname.2:95 build/C/man2/getsockopt.2:169
1725 msgid "The argument I<sockfd> is a file, not a socket."
1726 msgstr ""
1727
1728 #.  SVr4 documents additional ENOMEM
1729 #.  and ENOSR error codes.
1730 #. type: Plain text
1731 #: build/C/man2/getsockname.2:101
1732 msgid ""
1733 "SVr4, 4.4BSD (the B<getsockname>()  function call appeared in 4.2BSD), "
1734 "POSIX.1-2001."
1735 msgstr ""
1736
1737 #. type: Plain text
1738 #: build/C/man2/getsockname.2:110
1739 msgid ""
1740 "The third argument of B<getsockname>()  is in reality an I<int *> (and this "
1741 "is what 4.x BSD and libc4 and libc5 have).  Some POSIX confusion resulted in "
1742 "the present I<socklen_t>, also used by glibc.  See also B<accept>(2)."
1743 msgstr ""
1744
1745 #. type: Plain text
1746 #: build/C/man2/getsockname.2:116
1747 msgid ""
1748 "B<bind>(2), B<socket>(2), B<getifaddrs>(3), B<ip>(7), B<socket>(7), "
1749 "B<unix>(7)"
1750 msgstr ""
1751
1752 #. type: TH
1753 #: build/C/man2/getsockopt.2:42
1754 #, no-wrap
1755 msgid "GETSOCKOPT"
1756 msgstr ""
1757
1758 #. type: Plain text
1759 #: build/C/man2/getsockopt.2:45
1760 msgid "getsockopt, setsockopt - get and set options on sockets"
1761 msgstr ""
1762
1763 #. type: Plain text
1764 #: build/C/man2/getsockopt.2:55
1765 #, no-wrap
1766 msgid ""
1767 "B<int getsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1768 "B<               void *>I<optval>B<, socklen_t *>I<optlen>B<);>\n"
1769 "B<int setsockopt(int >I<sockfd>B<, int >I<level>B<, int >I<optname>B<,>\n"
1770 "B<               const void *>I<optval>B<, socklen_t >I<optlen>B<);>\n"
1771 msgstr ""
1772
1773 #. type: Plain text
1774 #: build/C/man2/getsockopt.2:65
1775 msgid ""
1776 "B<getsockopt>()  and B<setsockopt>()  manipulate options for the socket "
1777 "referred to by the file descriptor I<sockfd>.  Options may exist at multiple "
1778 "protocol levels; they are always present at the uppermost socket level."
1779 msgstr ""
1780
1781 #. type: Plain text
1782 #: build/C/man2/getsockopt.2:84
1783 msgid ""
1784 "When manipulating socket options, the level at which the option resides and "
1785 "the name of the option must be specified.  To manipulate options at the "
1786 "sockets API level, I<level> is specified as B<SOL_SOCKET>.  To manipulate "
1787 "options at any other level the protocol number of the appropriate protocol "
1788 "controlling the option is supplied.  For example, to indicate that an option "
1789 "is to be interpreted by the B<TCP> protocol, I<level> should be set to the "
1790 "protocol number of B<TCP>; see B<getprotoent>(3)."
1791 msgstr ""
1792
1793 #. type: Plain text
1794 #: build/C/man2/getsockopt.2:106
1795 msgid ""
1796 "The arguments I<optval> and I<optlen> are used to access option values for "
1797 "B<setsockopt>().  For B<getsockopt>()  they identify a buffer in which the "
1798 "value for the requested option(s) are to be returned.  For B<getsockopt>(), "
1799 "I<optlen> is a value-result argument, initially containing the size of the "
1800 "buffer pointed to by I<optval>, and modified on return to indicate the "
1801 "actual size of the value returned.  If no option value is to be supplied or "
1802 "returned, I<optval> may be NULL."
1803 msgstr ""
1804
1805 #. type: Plain text
1806 #: build/C/man2/getsockopt.2:116
1807 msgid ""
1808 "I<Optname> and any specified options are passed uninterpreted to the "
1809 "appropriate protocol module for interpretation.  The include file "
1810 "I<E<lt>sys/socket.hE<gt>> contains definitions for socket level options, "
1811 "described below.  Options at other protocol levels vary in format and name; "
1812 "consult the appropriate entries in section 4 of the manual."
1813 msgstr ""
1814
1815 #. type: Plain text
1816 #: build/C/man2/getsockopt.2:125
1817 msgid ""
1818 "Most socket-level options utilize an I<int> argument for I<optval>.  For "
1819 "B<setsockopt>(), the argument should be nonzero to enable a boolean option, "
1820 "or zero if the option is to be disabled."
1821 msgstr ""
1822
1823 #. type: Plain text
1824 #: build/C/man2/getsockopt.2:129
1825 msgid ""
1826 "For a description of the available socket options see B<socket>(7)  and the "
1827 "appropriate protocol man pages."
1828 msgstr ""
1829
1830 #. type: Plain text
1831 #: build/C/man2/getsockopt.2:150
1832 msgid ""
1833 "The address pointed to by I<optval> is not in a valid part of the process "
1834 "address space.  For B<getsockopt>(), this error may also be returned if "
1835 "I<optlen> is not in a valid part of the process address space."
1836 msgstr ""
1837
1838 #. type: Plain text
1839 #: build/C/man2/getsockopt.2:161
1840 msgid ""
1841 "I<optlen> invalid in B<setsockopt>().  In some cases this error can also "
1842 "occur for an invalid value in I<optval> (e.g., for the B<IP_ADD_MEMBERSHIP> "
1843 "option described in B<ip>(7))."
1844 msgstr ""
1845
1846 #. type: TP
1847 #: build/C/man2/getsockopt.2:161
1848 #, no-wrap
1849 msgid "B<ENOPROTOOPT>"
1850 msgstr ""
1851
1852 #. type: Plain text
1853 #: build/C/man2/getsockopt.2:164
1854 msgid "The option is unknown at the level indicated."
1855 msgstr ""
1856
1857 #.  SVr4 documents additional ENOMEM and ENOSR error codes, but does
1858 #.  not document the
1859 #.  .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
1860 #.  options
1861 #. type: Plain text
1862 #: build/C/man2/getsockopt.2:176
1863 msgid "SVr4, 4.4BSD (these system calls first appeared in 4.2BSD), POSIX.1-2001."
1864 msgstr ""
1865
1866 #. type: Plain text
1867 #: build/C/man2/getsockopt.2:197
1868 msgid ""
1869 "The I<optlen> argument of B<getsockopt>()  and B<setsockopt>()  is in "
1870 "reality an I<int [*]> (and this is what 4.x BSD and libc4 and libc5 have).  "
1871 "Some POSIX confusion resulted in the present I<socklen_t>, also used by "
1872 "glibc.  See also B<accept>(2)."
1873 msgstr ""
1874
1875 #. type: Plain text
1876 #: build/C/man2/getsockopt.2:200
1877 msgid ""
1878 "Several of the socket options should be handled at lower levels of the "
1879 "system."
1880 msgstr ""
1881
1882 #. type: Plain text
1883 #: build/C/man2/getsockopt.2:207
1884 msgid ""
1885 "B<ioctl>(2), B<socket>(2), B<getprotoent>(3), B<protocols>(5), B<socket>(7), "
1886 "B<tcp>(7), B<unix>(7)"
1887 msgstr ""
1888
1889 #. type: TH
1890 #: build/C/man2/listen.2:43
1891 #, no-wrap
1892 msgid "LISTEN"
1893 msgstr ""
1894
1895 #. type: TH
1896 #: build/C/man2/listen.2:43
1897 #, no-wrap
1898 msgid "2008-11-20"
1899 msgstr ""
1900
1901 #. type: Plain text
1902 #: build/C/man2/listen.2:46
1903 msgid "listen - listen for connections on a socket"
1904 msgstr ""
1905
1906 #. type: Plain text
1907 #: build/C/man2/listen.2:53
1908 #, no-wrap
1909 msgid "B<int listen(int >I<sockfd>B<, int >I<backlog>B<);>\n"
1910 msgstr ""
1911
1912 #. type: Plain text
1913 #: build/C/man2/listen.2:61
1914 msgid ""
1915 "B<listen>()  marks the socket referred to by I<sockfd> as a passive socket, "
1916 "that is, as a socket that will be used to accept incoming connection "
1917 "requests using B<accept>(2)."
1918 msgstr ""
1919
1920 #. type: Plain text
1921 #: build/C/man2/listen.2:68
1922 msgid ""
1923 "The I<sockfd> argument is a file descriptor that refers to a socket of type "
1924 "B<SOCK_STREAM> or B<SOCK_SEQPACKET>."
1925 msgstr ""
1926
1927 #. type: Plain text
1928 #: build/C/man2/listen.2:80
1929 msgid ""
1930 "The I<backlog> argument defines the maximum length to which the queue of "
1931 "pending connections for I<sockfd> may grow.  If a connection request arrives "
1932 "when the queue is full, the client may receive an error with an indication "
1933 "of B<ECONNREFUSED> or, if the underlying protocol supports retransmission, "
1934 "the request may be ignored so that a later reattempt at connection succeeds."
1935 msgstr ""
1936
1937 #. type: Plain text
1938 #: build/C/man2/listen.2:89
1939 msgid "Another socket is already listening on the same port."
1940 msgstr ""
1941
1942 #. type: Plain text
1943 #: build/C/man2/listen.2:99 build/C/man2/send.2:349
1944 msgid "The argument I<sockfd> is not a socket."
1945 msgstr ""
1946
1947 #. type: Plain text
1948 #: build/C/man2/listen.2:104
1949 msgid "The socket is not of a type that supports the B<listen>()  operation."
1950 msgstr ""
1951
1952 #. type: Plain text
1953 #: build/C/man2/listen.2:109
1954 msgid ""
1955 "4.4BSD, POSIX.1-2001.  The B<listen>()  function call first appeared in "
1956 "4.2BSD."
1957 msgstr ""
1958
1959 #. type: Plain text
1960 #: build/C/man2/listen.2:111
1961 msgid "To accept connections, the following steps are performed:"
1962 msgstr ""
1963
1964 #. type: TP
1965 #: build/C/man2/listen.2:112 build/C/man2/select_tut.2:345
1966 #, no-wrap
1967 msgid "1."
1968 msgstr ""
1969
1970 #. type: Plain text
1971 #: build/C/man2/listen.2:115
1972 msgid "A socket is created with B<socket>(2)."
1973 msgstr ""
1974
1975 #. type: TP
1976 #: build/C/man2/listen.2:115 build/C/man2/select_tut.2:354
1977 #, no-wrap
1978 msgid "2."
1979 msgstr ""
1980
1981 #. type: Plain text
1982 #: build/C/man2/listen.2:121
1983 msgid ""
1984 "The socket is bound to a local address using B<bind>(2), so that other "
1985 "sockets may be B<connect>(2)ed to it."
1986 msgstr ""
1987
1988 #. type: TP
1989 #: build/C/man2/listen.2:121 build/C/man2/select_tut.2:358
1990 #, no-wrap
1991 msgid "3."
1992 msgstr ""
1993
1994 #. type: Plain text
1995 #: build/C/man2/listen.2:125
1996 msgid ""
1997 "A willingness to accept incoming connections and a queue limit for incoming "
1998 "connections are specified with B<listen>()."
1999 msgstr ""
2000
2001 #. type: TP
2002 #: build/C/man2/listen.2:125 build/C/man2/select_tut.2:365
2003 #, no-wrap
2004 msgid "4."
2005 msgstr ""
2006
2007 #. type: Plain text
2008 #: build/C/man2/listen.2:128
2009 msgid "Connections are accepted with B<accept>(2)."
2010 msgstr ""
2011
2012 #. type: Plain text
2013 #: build/C/man2/listen.2:151
2014 msgid ""
2015 "The behavior of the I<backlog> argument on TCP sockets changed with Linux "
2016 "2.2.  Now it specifies the queue length for I<completely> established "
2017 "sockets waiting to be accepted, instead of the number of incomplete "
2018 "connection requests.  The maximum length of the queue for incomplete sockets "
2019 "can be set using I</proc/sys/net/ipv4/tcp_max_syn_backlog>.  When syncookies "
2020 "are enabled there is no logical maximum length and this setting is ignored.  "
2021 "See B<tcp>(7)  for more information."
2022 msgstr ""
2023
2024 #.  The following is now rather historic information (MTK, Jun 05)
2025 #.  Don't rely on this value in portable applications since BSD
2026 #.  (and some BSD-derived systems) limit the backlog to 5.
2027 #. type: Plain text
2028 #: build/C/man2/listen.2:164
2029 msgid ""
2030 "If the I<backlog> argument is greater than the value in "
2031 "I</proc/sys/net/core/somaxconn>, then it is silently truncated to that "
2032 "value; the default value in this file is 128.  In kernels before 2.4.25, "
2033 "this limit was a hard coded value, B<SOMAXCONN>, with the value 128."
2034 msgstr ""
2035
2036 #. type: Plain text
2037 #: build/C/man2/listen.2:172
2038 msgid "B<accept>(2), B<bind>(2), B<connect>(2), B<socket>(2), B<socket>(7)"
2039 msgstr ""
2040
2041 #. type: TH
2042 #: build/C/man2/recv.2:39
2043 #, no-wrap
2044 msgid "RECV"
2045 msgstr ""
2046
2047 #. type: TH
2048 #: build/C/man2/recv.2:39
2049 #, no-wrap
2050 msgid "2011-09-16"
2051 msgstr ""
2052
2053 #. type: Plain text
2054 #: build/C/man2/recv.2:42
2055 msgid "recv, recvfrom, recvmsg - receive a message from a socket"
2056 msgstr ""
2057
2058 #. type: Plain text
2059 #: build/C/man2/recv.2:47 build/C/man2/select.2:53 build/C/man2/select_tut.2:45
2060 #, no-wrap
2061 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
2062 msgstr ""
2063
2064 #. type: Plain text
2065 #: build/C/man2/recv.2:51
2066 #, no-wrap
2067 msgid ""
2068 "B<ssize_t recv(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int "
2069 ">I<flags>B<);>\n"
2070 msgstr ""
2071
2072 #. type: Plain text
2073 #: build/C/man2/recv.2:54
2074 #, no-wrap
2075 msgid ""
2076 "B<ssize_t recvfrom(int >I<sockfd>B<, void *>I<buf>B<, size_t >I<len>B<, int "
2077 ">I<flags>B<,>\n"
2078 "B<                 struct sockaddr *>I<src_addr>B<, socklen_t "
2079 "*>I<addrlen>B<);>\n"
2080 msgstr ""
2081
2082 #. type: Plain text
2083 #: build/C/man2/recv.2:56
2084 #, no-wrap
2085 msgid ""
2086 "B<ssize_t recvmsg(int >I<sockfd>B<, struct msghdr *>I<msg>B<, int "
2087 ">I<flags>B<);>\n"
2088 msgstr ""
2089
2090 #. type: Plain text
2091 #: build/C/man2/recv.2:64
2092 msgid ""
2093 "The B<recvfrom>()  and B<recvmsg>()  calls are used to receive messages from "
2094 "a socket, and may be used to receive data on a socket whether or not it is "
2095 "connection-oriented."
2096 msgstr ""
2097
2098 #.  (Note: for datagram sockets in both the UNIX and Internet domains,
2099 #.  .I src_addr
2100 #.  is filled in.
2101 #.  .I src_addr
2102 #.  is also filled in for stream sockets in the UNIX domain, but is not
2103 #.  filled in for stream sockets in the Internet domain.)
2104 #.  [The above notes on AF_UNIX and AF_INET sockets apply as at
2105 #.  Kernel 2.4.18. (MTK, 22 Jul 02)]
2106 #. type: Plain text
2107 #: build/C/man2/recv.2:93
2108 msgid ""
2109 "If I<src_addr> is not NULL, and the underlying protocol provides the source "
2110 "address, this source address is filled in.  When I<src_addr> is NULL, "
2111 "nothing is filled in; in this case, I<addrlen> is not used, and should also "
2112 "be NULL.  The argument I<addrlen> is a value-result argument, which the "
2113 "caller should initialize before the call to the size of the buffer "
2114 "associated with I<src_addr>, and modified on return to indicate the actual "
2115 "size of the source address.  The returned address is truncated if the buffer "
2116 "provided is too small; in this case, I<addrlen> will return a value greater "
2117 "than was supplied to the call."
2118 msgstr ""
2119
2120 #. type: Plain text
2121 #: build/C/man2/recv.2:105
2122 msgid ""
2123 "The B<recv>()  call is normally used only on a I<connected> socket (see "
2124 "B<connect>(2))  and is identical to B<recvfrom>()  with a NULL I<src_addr> "
2125 "argument."
2126 msgstr ""
2127
2128 #. type: Plain text
2129 #: build/C/man2/recv.2:111
2130 msgid ""
2131 "All three routines return the length of the message on successful "
2132 "completion.  If a message is too long to fit in the supplied buffer, excess "
2133 "bytes may be discarded depending on the type of socket the message is "
2134 "received from."
2135 msgstr ""
2136
2137 #. type: Plain text
2138 #: build/C/man2/recv.2:121
2139 msgid ""
2140 "If no messages are available at the socket, the receive calls wait for a "
2141 "message to arrive, unless the socket is nonblocking (see B<fcntl>(2)), in "
2142 "which case the value -1 is returned and the external variable I<errno> is "
2143 "set to B<EAGAIN> or B<EWOULDBLOCK>.  The receive calls normally return any "
2144 "data available, up to the requested amount, rather than waiting for receipt "
2145 "of the full amount requested."
2146 msgstr ""
2147
2148 #. type: Plain text
2149 #: build/C/man2/recv.2:127
2150 msgid ""
2151 "The B<select>(2)  or B<poll>(2)  call may be used to determine when more "
2152 "data arrives."
2153 msgstr ""
2154
2155 #. type: Plain text
2156 #: build/C/man2/recv.2:133
2157 msgid ""
2158 "The I<flags> argument to a B<recv>()  call is formed by ORing one or more of "
2159 "the following values:"
2160 msgstr ""
2161
2162 #. type: TP
2163 #: build/C/man2/recv.2:133
2164 #, no-wrap
2165 msgid "B<MSG_CMSG_CLOEXEC> (B<recvmsg>() only; since Linux 2.6.23)"
2166 msgstr ""
2167
2168 #. type: Plain text
2169 #: build/C/man2/recv.2:144
2170 msgid ""
2171 "Set the close-on-exec flag for the file descriptor received via a UNIX "
2172 "domain file descriptor using the B<SCM_RIGHTS> operation (described in "
2173 "B<unix>(7)).  This flag is useful for the same reasons as the B<O_CLOEXEC> "
2174 "flag of B<open>(2)."
2175 msgstr ""
2176
2177 #. type: TP
2178 #: build/C/man2/recv.2:144 build/C/man2/send.2:186
2179 #, no-wrap
2180 msgid "B<MSG_DONTWAIT> (since Linux 2.2)"
2181 msgstr ""
2182
2183 #. type: Plain text
2184 #: build/C/man2/recv.2:154
2185 msgid ""
2186 "Enables nonblocking operation; if the operation would block, the call fails "
2187 "with the error B<EAGAIN> or B<EWOULDBLOCK> (this can also be enabled using "
2188 "the B<O_NONBLOCK> flag with the B<F_SETFL> B<fcntl>(2))."
2189 msgstr ""
2190
2191 #. type: TP
2192 #: build/C/man2/recv.2:154
2193 #, no-wrap
2194 msgid "B<MSG_ERRQUEUE> (since Linux 2.2)"
2195 msgstr ""
2196
2197 #. type: Plain text
2198 #: build/C/man2/recv.2:173
2199 msgid ""
2200 "This flag specifies that queued errors should be received from the socket "
2201 "error queue.  The error is passed in an ancillary message with a type "
2202 "dependent on the protocol (for IPv4 B<IP_RECVERR>).  The user should supply "
2203 "a buffer of sufficient size.  See B<cmsg>(3)  and B<ip>(7)  for more "
2204 "information.  The payload of the original packet that caused the error is "
2205 "passed as normal data via I<msg_iovec>.  The original destination address of "
2206 "the datagram that caused the error is supplied via I<msg_name>."
2207 msgstr ""
2208
2209 #. type: Plain text
2210 #: build/C/man2/recv.2:185 build/C/man2/recv.2:248
2211 msgid ""
2212 "For local errors, no address is passed (this can be checked with the "
2213 "I<cmsg_len> member of the I<cmsghdr>).  For error receives, the "
2214 "B<MSG_ERRQUEUE> is set in the I<msghdr>.  After an error has been passed, "
2215 "the pending socket error is regenerated based on the next queued error and "
2216 "will be passed on the next socket operation."
2217 msgstr ""
2218
2219 #. type: Plain text
2220 #: build/C/man2/recv.2:189
2221 msgid "The error is supplied in a I<sock_extended_err> structure:"
2222 msgstr ""
2223
2224 #. type: Plain text
2225 #: build/C/man2/recv.2:196
2226 #, no-wrap
2227 msgid ""
2228 "#define SO_EE_ORIGIN_NONE    0\n"
2229 "#define SO_EE_ORIGIN_LOCAL   1\n"
2230 "#define SO_EE_ORIGIN_ICMP    2\n"
2231 "#define SO_EE_ORIGIN_ICMP6   3\n"
2232 msgstr ""
2233
2234 #. type: Plain text
2235 #: build/C/man2/recv.2:208
2236 #, no-wrap
2237 msgid ""
2238 "struct sock_extended_err\n"
2239 "{\n"
2240 "    uint32_t ee_errno;   /* error number */\n"
2241 "    uint8_t  ee_origin;  /* where the error originated */\n"
2242 "    uint8_t  ee_type;    /* type */\n"
2243 "    uint8_t  ee_code;    /* code */\n"
2244 "    uint8_t  ee_pad;     /* padding */\n"
2245 "    uint32_t ee_info;    /* additional information */\n"
2246 "    uint32_t ee_data;    /* other data */\n"
2247 "    /* More data may follow */\n"
2248 "};\n"
2249 msgstr ""
2250
2251 #. type: Plain text
2252 #: build/C/man2/recv.2:210
2253 #, no-wrap
2254 msgid "struct sockaddr *SO_EE_OFFENDER(struct sock_extended_err *);\n"
2255 msgstr ""
2256
2257 #. type: Plain text
2258 #: build/C/man2/recv.2:234
2259 msgid ""
2260 "I<ee_errno> contains the I<errno> number of the queued error.  I<ee_origin> "
2261 "is the origin code of where the error originated.  The other fields are "
2262 "protocol-specific.  The macro B<SOCK_EE_OFFENDER> returns a pointer to the "
2263 "address of the network object where the error originated from given a "
2264 "pointer to the ancillary message.  If this address is not known, the "
2265 "I<sa_family> member of the I<sockaddr> contains B<AF_UNSPEC> and the other "
2266 "fields of the I<sockaddr> are undefined.  The payload of the packet that "
2267 "caused the error is passed as normal data."
2268 msgstr ""
2269
2270 #. type: TP
2271 #: build/C/man2/recv.2:248 build/C/man2/recv.2:379 build/C/man2/send.2:228
2272 #, no-wrap
2273 msgid "B<MSG_OOB>"
2274 msgstr ""
2275
2276 #. type: Plain text
2277 #: build/C/man2/recv.2:255
2278 msgid ""
2279 "This flag requests receipt of out-of-band data that would not be received in "
2280 "the normal data stream.  Some protocols place expedited data at the head of "
2281 "the normal data queue, and thus this flag cannot be used with such "
2282 "protocols."
2283 msgstr ""
2284
2285 #. type: TP
2286 #: build/C/man2/recv.2:255
2287 #, no-wrap
2288 msgid "B<MSG_PEEK>"
2289 msgstr ""
2290
2291 #. type: Plain text
2292 #: build/C/man2/recv.2:262
2293 msgid ""
2294 "This flag causes the receive operation to return data from the beginning of "
2295 "the receive queue without removing that data from the queue.  Thus, a "
2296 "subsequent receive call will return the same data."
2297 msgstr ""
2298
2299 #. type: TP
2300 #: build/C/man2/recv.2:262
2301 #, no-wrap
2302 msgid "B<MSG_TRUNC> (since Linux 2.2)"
2303 msgstr ""
2304
2305 #. type: Plain text
2306 #: build/C/man2/recv.2:273
2307 msgid ""
2308 "For raw (B<AF_PACKET>), Internet datagram (since Linux 2.4.27/2.6.8), and "
2309 "netlink (since Linux 2.6.22) sockets: return the real length of the packet "
2310 "or datagram, even when it was longer than the passed buffer.  Not "
2311 "implemented for UNIX domain (B<unix>(7))  sockets."
2312 msgstr ""
2313
2314 #. type: Plain text
2315 #: build/C/man2/recv.2:276
2316 msgid "For use with Internet stream sockets, see B<tcp>(7)."
2317 msgstr ""
2318
2319 #. type: TP
2320 #: build/C/man2/recv.2:276
2321 #, no-wrap
2322 msgid "B<MSG_WAITALL> (since Linux 2.2)"
2323 msgstr ""
2324
2325 #. type: Plain text
2326 #: build/C/man2/recv.2:283
2327 msgid ""
2328 "This flag requests that the operation block until the full request is "
2329 "satisfied.  However, the call may still return less data than requested if a "
2330 "signal is caught, an error or disconnect occurs, or the next data to be "
2331 "received is of a different type than that returned."
2332 msgstr ""
2333
2334 #. type: Plain text
2335 #: build/C/man2/recv.2:291
2336 msgid ""
2337 "The B<recvmsg>()  call uses a I<msghdr> structure to minimize the number of "
2338 "directly supplied arguments.  This structure is defined as follows in "
2339 "I<E<lt>sys/socket.hE<gt>>:"
2340 msgstr ""
2341
2342 #. type: Plain text
2343 #: build/C/man2/recv.2:298
2344 #, no-wrap
2345 msgid ""
2346 "struct iovec {                    /* Scatter/gather array items */\n"
2347 "    void  *iov_base;              /* Starting address */\n"
2348 "    size_t iov_len;               /* Number of bytes to transfer */\n"
2349 "};\n"
2350 msgstr ""
2351
2352 #. type: Plain text
2353 #: build/C/man2/recv.2:308 build/C/man2/send.2:256
2354 #, no-wrap
2355 msgid ""
2356 "struct msghdr {\n"
2357 "    void         *msg_name;       /* optional address */\n"
2358 "    socklen_t     msg_namelen;    /* size of address */\n"
2359 "    struct iovec *msg_iov;        /* scatter/gather array */\n"
2360 "    size_t        msg_iovlen;     /* # elements in msg_iov */\n"
2361 "    void         *msg_control;    /* ancillary data, see below */\n"
2362 "    size_t        msg_controllen; /* ancillary data buffer len */\n"
2363 "    int           msg_flags;      /* flags on received message */\n"
2364 "};\n"
2365 msgstr ""
2366
2367 #. type: Plain text
2368 #: build/C/man2/recv.2:338
2369 msgid ""
2370 "Here I<msg_name> and I<msg_namelen> specify the source address if the socket "
2371 "is unconnected; I<msg_name> may be given as a NULL pointer if no names are "
2372 "desired or required.  The fields I<msg_iov> and I<msg_iovlen> describe "
2373 "scatter-gather locations, as discussed in B<readv>(2).  The field "
2374 "I<msg_control>, which has length I<msg_controllen>, points to a buffer for "
2375 "other protocol control-related messages or miscellaneous ancillary data.  "
2376 "When B<recvmsg>()  is called, I<msg_controllen> should contain the length of "
2377 "the available buffer in I<msg_control>; upon return from a successful call "
2378 "it will contain the length of the control message sequence."
2379 msgstr ""
2380
2381 #. type: Plain text
2382 #: build/C/man2/recv.2:340
2383 msgid "The messages are of the form:"
2384 msgstr ""
2385
2386 #. type: Plain text
2387 #: build/C/man2/recv.2:350
2388 #, no-wrap
2389 msgid ""
2390 "struct cmsghdr {\n"
2391 "    socklen_t     cmsg_len;     /* data byte count, including hdr */\n"
2392 "    int           cmsg_level;   /* originating protocol */\n"
2393 "    int           cmsg_type;    /* protocol-specific type */\n"
2394 "/* followed by\n"
2395 "    unsigned char cmsg_data[]; */\n"
2396 "};\n"
2397 msgstr ""
2398
2399 #. type: Plain text
2400 #: build/C/man2/recv.2:355
2401 msgid "Ancillary data should only be accessed by the macros defined in B<cmsg>(3)."
2402 msgstr ""
2403
2404 #. type: Plain text
2405 #: build/C/man2/recv.2:358
2406 msgid ""
2407 "As an example, Linux uses this ancillary data mechanism to pass extended "
2408 "errors, IP options, or file descriptors over UNIX domain sockets."
2409 msgstr ""
2410
2411 #. type: Plain text
2412 #: build/C/man2/recv.2:366
2413 msgid ""
2414 "The I<msg_flags> field in the I<msghdr> is set on return of B<recvmsg>().  "
2415 "It can contain several flags:"
2416 msgstr ""
2417
2418 #. type: TP
2419 #: build/C/man2/recv.2:366
2420 #, no-wrap
2421 msgid "B<MSG_EOR>"
2422 msgstr ""
2423
2424 #. type: Plain text
2425 #: build/C/man2/recv.2:371
2426 msgid ""
2427 "indicates end-of-record; the data returned completed a record (generally "
2428 "used with sockets of type B<SOCK_SEQPACKET>)."
2429 msgstr ""
2430
2431 #. type: TP
2432 #: build/C/man2/recv.2:371
2433 #, no-wrap
2434 msgid "B<MSG_TRUNC>"
2435 msgstr ""
2436
2437 #. type: Plain text
2438 #: build/C/man2/recv.2:375
2439 msgid ""
2440 "indicates that the trailing portion of a datagram was discarded because the "
2441 "datagram was larger than the buffer supplied."
2442 msgstr ""
2443
2444 #. type: TP
2445 #: build/C/man2/recv.2:375
2446 #, no-wrap
2447 msgid "B<MSG_CTRUNC>"
2448 msgstr ""
2449
2450 #. type: Plain text
2451 #: build/C/man2/recv.2:379
2452 msgid ""
2453 "indicates that some control data were discarded due to lack of space in the "
2454 "buffer for ancillary data."
2455 msgstr ""
2456
2457 #. type: Plain text
2458 #: build/C/man2/recv.2:382
2459 msgid "is returned to indicate that expedited or out-of-band data were received."
2460 msgstr ""
2461
2462 #. type: TP
2463 #: build/C/man2/recv.2:382
2464 #, no-wrap
2465 msgid "B<MSG_ERRQUEUE>"
2466 msgstr ""
2467
2468 #. type: Plain text
2469 #: build/C/man2/recv.2:386
2470 msgid ""
2471 "indicates that no data was received but an extended error from the socket "
2472 "error queue."
2473 msgstr ""
2474
2475 #. type: Plain text
2476 #: build/C/man2/recv.2:391
2477 msgid ""
2478 "These calls return the number of bytes received, or -1 if an error "
2479 "occurred.  The return value will be 0 when the peer has performed an orderly "
2480 "shutdown."
2481 msgstr ""
2482
2483 #. type: Plain text
2484 #: build/C/man2/recv.2:396
2485 msgid ""
2486 "These are some standard errors generated by the socket layer.  Additional "
2487 "errors may be generated and returned from the underlying protocol modules; "
2488 "see their manual pages."
2489 msgstr ""
2490
2491 #.  Actually EAGAIN on Linux
2492 #. type: Plain text
2493 #: build/C/man2/recv.2:405
2494 msgid ""
2495 "The socket is marked nonblocking and the receive operation would block, or a "
2496 "receive timeout had been set and the timeout expired before data was "
2497 "received.  POSIX.1-2001 allows either error to be returned for this case, "
2498 "and does not require these constants to have the same value, so a portable "
2499 "application should check for both possibilities."
2500 msgstr ""
2501
2502 #. type: Plain text
2503 #: build/C/man2/recv.2:410
2504 msgid "The argument I<sockfd> is an invalid descriptor."
2505 msgstr ""
2506
2507 #. type: Plain text
2508 #: build/C/man2/recv.2:414
2509 msgid ""
2510 "A remote host refused to allow the network connection (typically because it "
2511 "is not running the requested service)."
2512 msgstr ""
2513
2514 #. type: Plain text
2515 #: build/C/man2/recv.2:418
2516 msgid "The receive buffer pointer(s) point outside the process's address space."
2517 msgstr ""
2518
2519 #. type: Plain text
2520 #: build/C/man2/recv.2:423
2521 msgid ""
2522 "The receive was interrupted by delivery of a signal before any data were "
2523 "available; see B<signal>(7)."
2524 msgstr ""
2525
2526 #. type: Plain text
2527 #: build/C/man2/recv.2:427 build/C/man2/send.2:318
2528 msgid "Invalid argument passed."
2529 msgstr ""
2530
2531 #. type: Plain text
2532 #: build/C/man2/recv.2:431
2533 msgid "Could not allocate memory for B<recvmsg>()."
2534 msgstr ""
2535
2536 #. type: TP
2537 #: build/C/man2/recv.2:431 build/C/man2/send.2:341
2538 #, no-wrap
2539 msgid "B<ENOTCONN>"
2540 msgstr ""
2541
2542 #. type: Plain text
2543 #: build/C/man2/recv.2:438
2544 msgid ""
2545 "The socket is associated with a connection-oriented protocol and has not "
2546 "been connected (see B<connect>(2)  and B<accept>(2))."
2547 msgstr ""
2548
2549 #. type: Plain text
2550 #: build/C/man2/recv.2:443
2551 msgid "The argument I<sockfd> does not refer to a socket."
2552 msgstr ""
2553
2554 #. type: Plain text
2555 #: build/C/man2/recv.2:446
2556 msgid "4.4BSD (these function calls first appeared in 4.2BSD), POSIX.1-2001."
2557 msgstr ""
2558
2559 #. type: Plain text
2560 #: build/C/man2/recv.2:453
2561 msgid ""
2562 "POSIX.1-2001 only describes the B<MSG_OOB>, B<MSG_PEEK>, and B<MSG_WAITALL> "
2563 "flags."
2564 msgstr ""
2565
2566 #. type: Plain text
2567 #: build/C/man2/recv.2:469
2568 msgid ""
2569 "The prototypes given above follow glibc2.  The Single UNIX Specification "
2570 "agrees, except that it has return values of type I<ssize_t> (while 4.x BSD "
2571 "and libc4 and libc5 all have I<int>).  The I<flags> argument is I<int> in "
2572 "4.x BSD, but I<unsigned int> in libc4 and libc5.  The I<len> argument is "
2573 "I<int> in 4.x BSD, but I<size_t> in libc4 and libc5.  The I<addrlen> "
2574 "argument is I<int\\ *> in 4.x BSD, libc4 and libc5.  The present "
2575 "I<socklen_t\\ *> was invented by POSIX.  See also B<accept>(2)."
2576 msgstr ""
2577
2578 #.  glibc bug raised 12 Mar 2006
2579 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=2448
2580 #.  The problem is an underlying kernel issue: the size of the
2581 #.  __kernel_size_t type used to type this field varies
2582 #.  across architectures, but socklen_t is always 32 bits.
2583 #. type: Plain text
2584 #: build/C/man2/recv.2:483 build/C/man2/send.2:404
2585 msgid ""
2586 "According to POSIX.1-2001, the I<msg_controllen> field of the I<msghdr> "
2587 "structure should be typed as I<socklen_t>, but glibc currently types it as "
2588 "I<size_t>."
2589 msgstr ""
2590
2591 #. type: Plain text
2592 #: build/C/man2/recv.2:488
2593 msgid ""
2594 "See B<recvmmsg(2)> for information about a Linux-specific system call that "
2595 "can be used to receive multiple datagrams in a single call."
2596 msgstr ""
2597
2598 #. type: Plain text
2599 #: build/C/man2/recv.2:493
2600 msgid "An example of the use of B<recvfrom>()  is shown in B<getaddrinfo>(3)."
2601 msgstr ""
2602
2603 #. type: Plain text
2604 #: build/C/man2/recv.2:503
2605 msgid ""
2606 "B<fcntl>(2), B<getsockopt>(2), B<read>(2), B<recvmmsg>(2), B<select>(2), "
2607 "B<shutdown>(2), B<socket>(2), B<cmsg>(3), B<sockatmark>(3), B<socket>(7)"
2608 msgstr ""
2609
2610 #. type: TH
2611 #: build/C/man2/recvmmsg.2:26
2612 #, no-wrap
2613 msgid "RECVMMSG"
2614 msgstr ""
2615
2616 #. type: TH
2617 #: build/C/man2/recvmmsg.2:26
2618 #, no-wrap
2619 msgid "2011-10-04"
2620 msgstr ""
2621
2622 #. type: Plain text
2623 #: build/C/man2/recvmmsg.2:29
2624 msgid "recvmmsg - receive multiple messages on a socket"
2625 msgstr ""
2626
2627 #. type: Plain text
2628 #: build/C/man2/recvmmsg.2:33 build/C/man2/sendmmsg.2:35
2629 #, no-wrap
2630 msgid ""
2631 "B<#define _GNU_SOURCE>\n"
2632 "B<#include E<lt>sys/socket.hE<gt>>\n"
2633 msgstr ""
2634
2635 #. type: Plain text
2636 #: build/C/man2/recvmmsg.2:36
2637 #, no-wrap
2638 msgid ""
2639 "B<int recvmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int "
2640 ">I<vlen>B<,>\n"
2641 msgstr ""
2642
2643 #. type: Plain text
2644 #: build/C/man2/recvmmsg.2:38
2645 #, no-wrap
2646 msgid "B<             unsigned int >I<flags>B<, struct timespec *>I<timeout>B<);>\n"
2647 msgstr ""
2648
2649 #. type: Plain text
2650 #: build/C/man2/recvmmsg.2:50
2651 msgid ""
2652 "The B<recvmmsg>()  system call is an extension of B<recvmsg>(2)  that allows "
2653 "the caller to receive multiple messages from a socket using a single system "
2654 "call.  (This has performance benefits for some applications.)  A further "
2655 "extension over B<recvmsg>(2)  is support for a timeout on the receive "
2656 "operation."
2657 msgstr ""
2658
2659 #. type: Plain text
2660 #: build/C/man2/recvmmsg.2:54
2661 msgid ""
2662 "The I<sockfd> argument is the file descriptor of the socket to receive data "
2663 "from."
2664 msgstr ""
2665
2666 #. type: Plain text
2667 #: build/C/man2/recvmmsg.2:62 build/C/man2/sendmmsg.2:62
2668 msgid ""
2669 "The I<msgvec> argument is a pointer to an array of I<mmsghdr> structures.  "
2670 "The size of this array is specified in I<vlen>."
2671 msgstr ""
2672
2673 #. type: Plain text
2674 #: build/C/man2/recvmmsg.2:68 build/C/man2/sendmmsg.2:68
2675 msgid "The I<mmsghdr> structure is defined in I<E<lt>sys/socket.hE<gt>> as:"
2676 msgstr ""
2677
2678 #. type: Plain text
2679 #: build/C/man2/recvmmsg.2:75
2680 #, no-wrap
2681 msgid ""
2682 "struct mmsghdr {\n"
2683 "    struct msghdr msg_hdr;  /* Message header */\n"
2684 "    unsigned int  msg_len;  /* Number of received bytes for header */\n"
2685 "};\n"
2686 msgstr ""
2687
2688 #. type: Plain text
2689 #: build/C/man2/recvmmsg.2:90
2690 msgid ""
2691 "The I<msg_hdr> field is a I<msghdr> structure, as described in "
2692 "B<recvmsg>(2).  The I<msg_len> field is the number of bytes returned for the "
2693 "message in the entry.  This field has the same value as the return value of "
2694 "a single B<recvmsg>(2)  on the header."
2695 msgstr ""
2696
2697 #. type: Plain text
2698 #: build/C/man2/recvmmsg.2:97
2699 msgid ""
2700 "The I<flags> argument contains flags ORed together.  The flags are the same "
2701 "as documented for B<recvmsg>(2), with the following addition:"
2702 msgstr ""
2703
2704 #. type: TP
2705 #: build/C/man2/recvmmsg.2:97
2706 #, no-wrap
2707 msgid "B<MSG_WAITFORONE>"
2708 msgstr ""
2709
2710 #. type: Plain text
2711 #: build/C/man2/recvmmsg.2:102
2712 msgid "Turns on B<MSG_DONTWAIT> after the first message has been received."
2713 msgstr ""
2714
2715 #. type: Plain text
2716 #: build/C/man2/recvmmsg.2:115
2717 msgid ""
2718 "The I<timeout> argument points to a I<struct timespec> (see "
2719 "B<clock_gettime>(2))  defining a timeout (seconds plus nanoseconds) for the "
2720 "receive operation.  If I<timeout> is I<NULL> then the operation blocks "
2721 "indefinitely."
2722 msgstr ""
2723
2724 #. type: Plain text
2725 #: build/C/man2/recvmmsg.2:126
2726 msgid ""
2727 "A blocking B<recvmmsg>()  call blocks until I<vlen> messages have been "
2728 "received or until the timeout expires.  A nonblocking call reads as many "
2729 "messages as are available (up to the limit specified by I<vlen>)  and "
2730 "returns immediately."
2731 msgstr ""
2732
2733 #. type: Plain text
2734 #: build/C/man2/recvmmsg.2:141
2735 msgid ""
2736 "On return from B<recvmmsg>(), successive elements of I<msgvec> are updated "
2737 "to contain information about each received message: I<msg_len> contains the "
2738 "size of the received message; the subfields of I<msg_hdr> are updated as "
2739 "described in B<recvmsg>(2).  The return value of the call indicates the "
2740 "number of elements of I<msgvec> that have been updated."
2741 msgstr ""
2742
2743 #. type: Plain text
2744 #: build/C/man2/recvmmsg.2:149
2745 msgid ""
2746 "On success, B<recvmmsg>()  returns the number of messages received in "
2747 "I<msgvec>; on error, -1 is returned, and I<errno> is set to indicate the "
2748 "error."
2749 msgstr ""
2750
2751 #. type: Plain text
2752 #: build/C/man2/recvmmsg.2:153
2753 msgid ""
2754 "Errors are as for B<recvmsg>(2).  In addition, the following error can "
2755 "occur:"
2756 msgstr ""
2757
2758 #. type: Plain text
2759 #: build/C/man2/recvmmsg.2:157
2760 msgid "I<timeout> is invalid."
2761 msgstr ""
2762
2763 #. type: Plain text
2764 #: build/C/man2/recvmmsg.2:162
2765 msgid ""
2766 "The B<recvmmsg>()  system call was added in Linux 2.6.32.  Support in glibc "
2767 "was added in version 2.12."
2768 msgstr ""
2769
2770 #. type: Plain text
2771 #: build/C/man2/recvmmsg.2:165
2772 msgid "B<recvmmsg>()  is Linux-specific."
2773 msgstr ""
2774
2775 #. type: Plain text
2776 #: build/C/man2/recvmmsg.2:171
2777 msgid ""
2778 "B<clock_gettime>(2), B<recvmsg>(2), B<sendmmsg>(2), B<sendmsg>(2), "
2779 "B<socket>(2), B<socket>(7)"
2780 msgstr ""
2781
2782 #. type: TH
2783 #: build/C/man2/select.2:38
2784 #, no-wrap
2785 msgid "SELECT"
2786 msgstr ""
2787
2788 #. type: TH
2789 #: build/C/man2/select.2:38
2790 #, no-wrap
2791 msgid "2010-08-31"
2792 msgstr ""
2793
2794 #. type: Plain text
2795 #: build/C/man2/select.2:42 build/C/man2/select_tut.2:34
2796 msgid ""
2797 "select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O "
2798 "multiplexing"
2799 msgstr ""
2800
2801 #. type: Plain text
2802 #: build/C/man2/select.2:45 build/C/man2/select_tut.2:37
2803 #, no-wrap
2804 msgid "/* According to POSIX.1-2001 */\n"
2805 msgstr ""
2806
2807 #. type: Plain text
2808 #: build/C/man2/select.2:47 build/C/man2/select.2:68 build/C/man2/select_tut.2:39 build/C/man2/select_tut.2:60
2809 #, no-wrap
2810 msgid "B<#include E<lt>sys/select.hE<gt>>\n"
2811 msgstr ""
2812
2813 #. type: Plain text
2814 #: build/C/man2/select.2:49 build/C/man2/select_tut.2:41
2815 #, no-wrap
2816 msgid "/* According to earlier standards */\n"
2817 msgstr ""
2818
2819 #. type: Plain text
2820 #: build/C/man2/select.2:51 build/C/man2/select_tut.2:43
2821 #, no-wrap
2822 msgid "B<#include E<lt>sys/time.hE<gt>>\n"
2823 msgstr ""
2824
2825 #. type: Plain text
2826 #: build/C/man2/select.2:55 build/C/man2/select_tut.2:47
2827 #, no-wrap
2828 msgid "B<#include E<lt>unistd.hE<gt>>\n"
2829 msgstr ""
2830
2831 #. type: Plain text
2832 #: build/C/man2/select.2:58
2833 #, no-wrap
2834 msgid ""
2835 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set "
2836 "*>I<writefds>B<,>\n"
2837 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<timeout>B<);>\n"
2838 msgstr ""
2839
2840 #. type: Plain text
2841 #: build/C/man2/select.2:60 build/C/man2/select_tut.2:52
2842 #, no-wrap
2843 msgid "B<void FD_CLR(int >I<fd>B<, fd_set *>I<set>B<);>\n"
2844 msgstr ""
2845
2846 #. type: Plain text
2847 #: build/C/man2/select.2:62 build/C/man2/select_tut.2:54
2848 #, no-wrap
2849 msgid "B<int  FD_ISSET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
2850 msgstr ""
2851
2852 #. type: Plain text
2853 #: build/C/man2/select.2:64 build/C/man2/select_tut.2:56
2854 #, no-wrap
2855 msgid "B<void FD_SET(int >I<fd>B<, fd_set *>I<set>B<);>\n"
2856 msgstr ""
2857
2858 #. type: Plain text
2859 #: build/C/man2/select.2:66 build/C/man2/select_tut.2:58
2860 #, no-wrap
2861 msgid "B<void FD_ZERO(fd_set *>I<set>B<);>\n"
2862 msgstr ""
2863
2864 #. type: Plain text
2865 #: build/C/man2/select.2:72
2866 #, no-wrap
2867 msgid ""
2868 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set "
2869 "*>I<writefds>B<,>\n"
2870 "B<            fd_set *>I<exceptfds>B<, const struct timespec "
2871 "*>I<timeout>B<,>\n"
2872 "B<            const sigset_t *>I<sigmask>B<);>\n"
2873 msgstr ""
2874
2875 #. type: Plain text
2876 #: build/C/man2/select.2:77 build/C/man2/select_tut.2:69 build/C/man3/sockatmark.3:34
2877 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
2878 msgstr ""
2879
2880 #. type: Plain text
2881 #: build/C/man2/select.2:81 build/C/man2/select_tut.2:73
2882 msgid ""
2883 "B<pselect>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ "
2884 "600"
2885 msgstr ""
2886
2887 #. type: Plain text
2888 #: build/C/man2/select.2:92
2889 msgid ""
2890 "B<select>()  and B<pselect>()  allow a program to monitor multiple file "
2891 "descriptors, waiting until one or more of the file descriptors become "
2892 "\"ready\" for some class of I/O operation (e.g., input possible).  A file "
2893 "descriptor is considered ready if it is possible to perform the "
2894 "corresponding I/O operation (e.g., B<read>(2))  without blocking."
2895 msgstr ""
2896
2897 #. type: Plain text
2898 #: build/C/man2/select.2:98
2899 msgid ""
2900 "The operation of B<select>()  and B<pselect>()  is identical, with three "
2901 "differences:"
2902 msgstr ""
2903
2904 #. type: TP
2905 #: build/C/man2/select.2:98
2906 #, no-wrap
2907 msgid "(i)"
2908 msgstr ""
2909
2910 #. type: Plain text
2911 #: build/C/man2/select.2:108
2912 msgid ""
2913 "B<select>()  uses a timeout that is a I<struct timeval> (with seconds and "
2914 "microseconds), while B<pselect>()  uses a I<struct timespec> (with seconds "
2915 "and nanoseconds)."
2916 msgstr ""
2917
2918 #. type: TP
2919 #: build/C/man2/select.2:108
2920 #, no-wrap
2921 msgid "(ii)"
2922 msgstr ""
2923
2924 #. type: Plain text
2925 #: build/C/man2/select.2:116
2926 msgid ""
2927 "B<select>()  may update the I<timeout> argument to indicate how much time "
2928 "was left.  B<pselect>()  does not change this argument."
2929 msgstr ""
2930
2931 #. type: TP
2932 #: build/C/man2/select.2:116
2933 #, no-wrap
2934 msgid "(iii)"
2935 msgstr ""
2936
2937 #. type: Plain text
2938 #: build/C/man2/select.2:125
2939 msgid ""
2940 "B<select>()  has no I<sigmask> argument, and behaves as B<pselect>()  called "
2941 "with NULL I<sigmask>."
2942 msgstr ""
2943
2944 #. type: Plain text
2945 #: build/C/man2/select.2:143
2946 msgid ""
2947 "Three independent sets of file descriptors are watched.  Those listed in "
2948 "I<readfds> will be watched to see if characters become available for reading "
2949 "(more precisely, to see if a read will not block; in particular, a file "
2950 "descriptor is also ready on end-of-file), those in I<writefds> will be "
2951 "watched to see if a write will not block, and those in I<exceptfds> will be "
2952 "watched for exceptions.  On exit, the sets are modified in place to indicate "
2953 "which file descriptors actually changed status.  Each of the three file "
2954 "descriptor sets may be specified as NULL if no file descriptors are to be "
2955 "watched for the corresponding class of events."
2956 msgstr ""
2957
2958 #. type: Plain text
2959 #: build/C/man2/select.2:156
2960 msgid ""
2961 "Four macros are provided to manipulate the sets.  B<FD_ZERO>()  clears a "
2962 "set.  B<FD_SET>()  and B<FD_CLR>()  respectively add and remove a given file "
2963 "descriptor from a set.  B<FD_ISSET>()  tests to see if a file descriptor is "
2964 "part of the set; this is useful after B<select>()  returns."
2965 msgstr ""
2966
2967 #. type: Plain text
2968 #: build/C/man2/select.2:159
2969 msgid ""
2970 "I<nfds> is the highest-numbered file descriptor in any of the three sets, "
2971 "plus 1."
2972 msgstr ""
2973
2974 #. type: Plain text
2975 #: build/C/man2/select.2:175
2976 msgid ""
2977 "I<timeout> is an upper bound on the amount of time elapsed before "
2978 "B<select>()  returns.  If both fields of the I<timeval> structure are zero, "
2979 "then B<select>()  returns immediately.  (This is useful for polling.)  If "
2980 "I<timeout> is NULL (no timeout), B<select>()  can block indefinitely."
2981 msgstr ""
2982
2983 #. type: Plain text
2984 #: build/C/man2/select.2:185
2985 msgid ""
2986 "I<sigmask> is a pointer to a signal mask (see B<sigprocmask>(2)); if it is "
2987 "not NULL, then B<pselect>()  first replaces the current signal mask by the "
2988 "one pointed to by I<sigmask>, then does the \"select\" function, and then "
2989 "restores the original signal mask."
2990 msgstr ""
2991
2992 #. type: Plain text
2993 #: build/C/man2/select.2:191
2994 msgid ""
2995 "Other than the difference in the precision of the I<timeout> argument, the "
2996 "following B<pselect>()  call:"
2997 msgstr ""
2998
2999 #. type: Plain text
3000 #: build/C/man2/select.2:195
3001 #, no-wrap
3002 msgid ""
3003 "    ready = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
3004 "                    timeout, &sigmask);\n"
3005 msgstr ""
3006
3007 #. type: Plain text
3008 #: build/C/man2/select.2:200
3009 msgid "is equivalent to I<atomically> executing the following calls:"
3010 msgstr ""
3011
3012 #. type: Plain text
3013 #: build/C/man2/select.2:203
3014 #, no-wrap
3015 msgid "    sigset_t origmask;\n"
3016 msgstr ""
3017
3018 #. type: Plain text
3019 #: build/C/man2/select.2:207
3020 #, no-wrap
3021 msgid ""
3022 "    sigprocmask(SIG_SETMASK, &sigmask, &origmask);\n"
3023 "    ready = select(nfds, &readfds, &writefds, &exceptfds, timeout);\n"
3024 "    sigprocmask(SIG_SETMASK, &origmask, NULL);\n"
3025 msgstr ""
3026
3027 #. type: Plain text
3028 #: build/C/man2/select.2:228
3029 msgid ""
3030 "The reason that B<pselect>()  is needed is that if one wants to wait for "
3031 "either a signal or for a file descriptor to become ready, then an atomic "
3032 "test is needed to prevent race conditions.  (Suppose the signal handler sets "
3033 "a global flag and returns.  Then a test of this global flag followed by a "
3034 "call of B<select>()  could hang indefinitely if the signal arrived just "
3035 "after the test but just before the call.  By contrast, B<pselect>()  allows "
3036 "one to first block signals, handle the signals that have come in, then call "
3037 "B<pselect>()  with the desired I<sigmask>, avoiding the race.)"
3038 msgstr ""
3039
3040 #. type: SS
3041 #: build/C/man2/select.2:228
3042 #, no-wrap
3043 msgid "The timeout"
3044 msgstr ""
3045
3046 #. type: Plain text
3047 #: build/C/man2/select.2:232
3048 msgid ""
3049 "The time structures involved are defined in I<E<lt>sys/time.hE<gt>> and look "
3050 "like"
3051 msgstr ""
3052
3053 #. type: Plain text
3054 #: build/C/man2/select.2:239
3055 #, no-wrap
3056 msgid ""
3057 "struct timeval {\n"
3058 "    long    tv_sec;         /* seconds */\n"
3059 "    long    tv_usec;        /* microseconds */\n"
3060 "};\n"
3061 msgstr ""
3062
3063 #. type: Plain text
3064 #: build/C/man2/select.2:243
3065 msgid "and"
3066 msgstr ""
3067
3068 #. type: Plain text
3069 #: build/C/man2/select.2:250
3070 #, no-wrap
3071 msgid ""
3072 "struct timespec {\n"
3073 "    long    tv_sec;         /* seconds */\n"
3074 "    long    tv_nsec;        /* nanoseconds */\n"
3075 "};\n"
3076 msgstr ""
3077
3078 #. type: Plain text
3079 #: build/C/man2/select.2:254
3080 msgid "(However, see below on the POSIX.1-2001 versions.)"
3081 msgstr ""
3082
3083 #. type: Plain text
3084 #: build/C/man2/select.2:262
3085 msgid ""
3086 "Some code calls B<select>()  with all three sets empty, I<nfds> zero, and a "
3087 "non-NULL I<timeout> as a fairly portable way to sleep with subsecond "
3088 "precision."
3089 msgstr ""
3090
3091 #.  .PP - it is rumored that:
3092 #.  On BSD, when a timeout occurs, the file descriptor bits are not changed.
3093 #.  - it is certainly true that:
3094 #.  Linux follows SUSv2 and sets the bit masks to zero upon a timeout.
3095 #. type: Plain text
3096 #: build/C/man2/select.2:285
3097 msgid ""
3098 "On Linux, B<select>()  modifies I<timeout> to reflect the amount of time not "
3099 "slept; most other implementations do not do this.  (POSIX.1-2001 permits "
3100 "either behavior.)  This causes problems both when Linux code which reads "
3101 "I<timeout> is ported to other operating systems, and when code is ported to "
3102 "Linux that reuses a I<struct timeval> for multiple B<select>()s in a loop "
3103 "without reinitializing it.  Consider I<timeout> to be undefined after "
3104 "B<select>()  returns."
3105 msgstr ""
3106
3107 #. type: Plain text
3108 #: build/C/man2/select.2:302
3109 msgid ""
3110 "On success, B<select>()  and B<pselect>()  return the number of file "
3111 "descriptors contained in the three returned descriptor sets (that is, the "
3112 "total number of bits that are set in I<readfds>, I<writefds>, I<exceptfds>)  "
3113 "which may be zero if the timeout expires before anything interesting "
3114 "happens.  On error, -1 is returned, and I<errno> is set appropriately; the "
3115 "sets and I<timeout> become undefined, so do not rely on their contents after "
3116 "an error."
3117 msgstr ""
3118
3119 #. type: Plain text
3120 #: build/C/man2/select.2:308
3121 msgid ""
3122 "An invalid file descriptor was given in one of the sets.  (Perhaps a file "
3123 "descriptor that was already closed, or one on which an error has occurred.)"
3124 msgstr ""
3125
3126 #. type: Plain text
3127 #: build/C/man2/select.2:312
3128 msgid "A signal was caught; see B<signal>(7)."
3129 msgstr ""
3130
3131 #. type: Plain text
3132 #: build/C/man2/select.2:318
3133 msgid "I<nfds> is negative or the value contained within I<timeout> is invalid."
3134 msgstr ""
3135
3136 #. type: Plain text
3137 #: build/C/man2/select.2:321
3138 msgid "unable to allocate memory for internal tables."
3139 msgstr ""
3140
3141 #. type: Plain text
3142 #: build/C/man2/select.2:327
3143 msgid ""
3144 "B<pselect>()  was added to Linux in kernel 2.6.16.  Prior to this, "
3145 "B<pselect>()  was emulated in glibc (but see BUGS)."
3146 msgstr ""
3147
3148 #. type: Plain text
3149 #: build/C/man2/select.2:338
3150 msgid ""
3151 "B<select>()  conforms to POSIX.1-2001 and 4.4BSD (B<select>()  first "
3152 "appeared in 4.2BSD).  Generally portable to/from non-BSD systems supporting "
3153 "clones of the BSD socket layer (including System V variants).  However, note "
3154 "that the System V variant typically sets the timeout variable before exit, "
3155 "but the BSD variant does not."
3156 msgstr ""
3157
3158 #. type: Plain text
3159 #: build/C/man2/select.2:342
3160 msgid "B<pselect>()  is defined in POSIX.1g, and in POSIX.1-2001."
3161 msgstr ""
3162
3163 #. type: Plain text
3164 #: build/C/man2/select.2:359
3165 msgid ""
3166 "An I<fd_set> is a fixed size buffer.  Executing B<FD_CLR>()  or B<FD_SET>()  "
3167 "with a value of I<fd> that is negative or is equal to or larger than "
3168 "B<FD_SETSIZE> will result in undefined behavior.  Moreover, POSIX requires "
3169 "I<fd> to be a valid file descriptor."
3170 msgstr ""
3171
3172 #. type: Plain text
3173 #: build/C/man2/select.2:368
3174 msgid ""
3175 "Concerning the types involved, the classical situation is that the two "
3176 "fields of a I<timeval> structure are typed as I<long> (as shown above), and "
3177 "the structure is defined in I<E<lt>sys/time.hE<gt>>.  The POSIX.1-2001 "
3178 "situation is"
3179 msgstr ""
3180
3181 #. type: Plain text
3182 #: build/C/man2/select.2:375
3183 #, no-wrap
3184 msgid ""
3185 "struct timeval {\n"
3186 "    time_t         tv_sec;     /* seconds */\n"
3187 "    suseconds_t    tv_usec;    /* microseconds */\n"
3188 "};\n"
3189 msgstr ""
3190
3191 #. type: Plain text
3192 #: build/C/man2/select.2:386
3193 msgid ""
3194 "where the structure is defined in I<E<lt>sys/select.hE<gt>> and the data "
3195 "types I<time_t> and I<suseconds_t> are defined in I<E<lt>sys/types.hE<gt>>."
3196 msgstr ""
3197
3198 #. type: Plain text
3199 #: build/C/man2/select.2:398
3200 msgid ""
3201 "Concerning prototypes, the classical situation is that one should include "
3202 "I<E<lt>time.hE<gt>> for B<select>().  The POSIX.1-2001 situation is that one "
3203 "should include I<E<lt>sys/select.hE<gt>> for B<select>()  and B<pselect>()."
3204 msgstr ""
3205
3206 #. type: Plain text
3207 #: build/C/man2/select.2:410
3208 msgid ""
3209 "Libc4 and libc5 do not have a I<E<lt>sys/select.hE<gt>> header; under glibc "
3210 "2.0 and later this header exists.  Under glibc 2.0 it unconditionally gives "
3211 "the wrong prototype for B<pselect>().  Under glibc 2.1 to 2.2.1 it gives "
3212 "B<pselect>()  when B<_GNU_SOURCE> is defined.  Since glibc 2.2.2 the "
3213 "requirements are as shown in the SYNOPSIS."
3214 msgstr ""
3215
3216 #. type: SS
3217 #: build/C/man2/select.2:410
3218 #, no-wrap
3219 msgid "Linux Notes"
3220 msgstr ""
3221
3222 #. type: Plain text
3223 #: build/C/man2/select.2:425
3224 msgid ""
3225 "The Linux B<pselect>()  system call modifies its I<timeout> argument.  "
3226 "However, the glibc wrapper function hides this behavior by using a local "
3227 "variable for the timeout argument that is passed to the system call.  Thus, "
3228 "the glibc B<pselect>()  function does not modify its I<timeout> argument; "
3229 "this is the behavior required by POSIX.1-2001."
3230 msgstr ""
3231
3232 #. type: Plain text
3233 #: build/C/man2/select.2:431
3234 msgid ""
3235 "Glibc 2.0 provided a version of B<pselect>()  that did not take a I<sigmask> "
3236 "argument."
3237 msgstr ""
3238
3239 #. type: Plain text
3240 #: build/C/man2/select.2:444
3241 msgid ""
3242 "Starting with version 2.1, glibc provided an emulation of B<pselect>()  that "
3243 "was implemented using B<sigprocmask>(2)  and B<select>().  This "
3244 "implementation remained vulnerable to the very race condition that "
3245 "B<pselect>()  was designed to prevent.  Modern versions of glibc use the "
3246 "(race-free)  B<pselect>()  system call on kernels where it is provided."
3247 msgstr ""
3248
3249 #. type: Plain text
3250 #: build/C/man2/select.2:453
3251 msgid ""
3252 "On systems that lack B<pselect>(), reliable (and more portable) signal "
3253 "trapping can be achieved using the self-pipe trick (where a signal handler "
3254 "writes a byte to a pipe whose other end is monitored by B<select>()  in the "
3255 "main program.)"
3256 msgstr ""
3257
3258 #.  Stevens discusses a case where accept can block after select
3259 #.  returns successfully because of an intervening RST from the client.
3260 #.  Maybe the kernel should have returned EIO in such a situation?
3261 #. type: Plain text
3262 #: build/C/man2/select.2:469
3263 msgid ""
3264 "Under Linux, B<select>()  may report a socket file descriptor as \"ready for "
3265 "reading\", while nevertheless a subsequent read blocks.  This could for "
3266 "example happen when data has arrived but upon examination has wrong checksum "
3267 "and is discarded.  There may be other circumstances in which a file "
3268 "descriptor is spuriously reported as ready.  Thus it may be safer to use "
3269 "B<O_NONBLOCK> on sockets that should not block."
3270 msgstr ""
3271
3272 #. type: Plain text
3273 #: build/C/man2/select.2:484
3274 msgid ""
3275 "On Linux, B<select>()  also modifies I<timeout> if the call is interrupted "
3276 "by a signal handler (i.e., the B<EINTR> error return).  This is not "
3277 "permitted by POSIX.1-2001.  The Linux B<pselect>()  system call has the same "
3278 "behavior, but the glibc wrapper hides this behavior by internally copying "
3279 "the I<timeout> to a local variable and passing that variable to the system "
3280 "call."
3281 msgstr ""
3282
3283 #. type: Plain text
3284 #: build/C/man2/select.2:491
3285 #, no-wrap
3286 msgid ""
3287 "#include E<lt>stdio.hE<gt>\n"
3288 "#include E<lt>stdlib.hE<gt>\n"
3289 "#include E<lt>sys/time.hE<gt>\n"
3290 "#include E<lt>sys/types.hE<gt>\n"
3291 "#include E<lt>unistd.hE<gt>\n"
3292 msgstr ""
3293
3294 #. type: Plain text
3295 #: build/C/man2/select.2:498
3296 #, no-wrap
3297 msgid ""
3298 "int\n"
3299 "main(void)\n"
3300 "{\n"
3301 "    fd_set rfds;\n"
3302 "    struct timeval tv;\n"
3303 "    int retval;\n"
3304 msgstr ""
3305
3306 #. type: Plain text
3307 #: build/C/man2/select.2:502
3308 #, no-wrap
3309 msgid ""
3310 "    /* Watch stdin (fd 0) to see when it has input. */\n"
3311 "    FD_ZERO(&rfds);\n"
3312 "    FD_SET(0, &rfds);\n"
3313 msgstr ""
3314
3315 #. type: Plain text
3316 #: build/C/man2/select.2:506
3317 #, no-wrap
3318 msgid ""
3319 "    /* Wait up to five seconds. */\n"
3320 "    tv.tv_sec = 5;\n"
3321 "    tv.tv_usec = 0;\n"
3322 msgstr ""
3323
3324 #. type: Plain text
3325 #: build/C/man2/select.2:509
3326 #, no-wrap
3327 msgid ""
3328 "    retval = select(1, &rfds, NULL, NULL, &tv);\n"
3329 "    /* Don't rely on the value of tv now! */\n"
3330 msgstr ""
3331
3332 #. type: Plain text
3333 #: build/C/man2/select.2:517
3334 #, no-wrap
3335 msgid ""
3336 "    if (retval == -1)\n"
3337 "        perror(\"select()\");\n"
3338 "    else if (retval)\n"
3339 "        printf(\"Data is available now.\\en\");\n"
3340 "        /* FD_ISSET(0, &rfds) will be true. */\n"
3341 "    else\n"
3342 "        printf(\"No data within five seconds.\\en\");\n"
3343 msgstr ""
3344
3345 #. type: Plain text
3346 #: build/C/man2/select.2:520
3347 #, no-wrap
3348 msgid ""
3349 "    exit(EXIT_SUCCESS);\n"
3350 "}\n"
3351 msgstr ""
3352
3353 #. type: Plain text
3354 #: build/C/man2/select.2:524
3355 msgid "For a tutorial with discussion and examples, see B<select_tut>(2)."
3356 msgstr ""
3357
3358 #. type: Plain text
3359 #: build/C/man2/select.2:535
3360 msgid ""
3361 "For vaguely related stuff, see B<accept>(2), B<connect>(2), B<poll>(2), "
3362 "B<read>(2), B<recv>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), "
3363 "B<epoll>(7), B<time>(7)"
3364 msgstr ""
3365
3366 #. type: TH
3367 #: build/C/man2/select_tut.2:30
3368 #, no-wrap
3369 msgid "SELECT_TUT"
3370 msgstr ""
3371
3372 #. type: TH
3373 #: build/C/man2/select_tut.2:30
3374 #, no-wrap
3375 msgid "2010-06-10"
3376 msgstr ""
3377
3378 #. type: Plain text
3379 #: build/C/man2/select_tut.2:50
3380 #, no-wrap
3381 msgid ""
3382 "B<int select(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set "
3383 "*>I<writefds>B<,>\n"
3384 "B<           fd_set *>I<exceptfds>B<, struct timeval *>I<utimeout>B<);>\n"
3385 msgstr ""
3386
3387 #. type: Plain text
3388 #: build/C/man2/select_tut.2:64
3389 #, no-wrap
3390 msgid ""
3391 "B<int pselect(int >I<nfds>B<, fd_set *>I<readfds>B<, fd_set "
3392 "*>I<writefds>B<,>\n"
3393 "B<            fd_set *>I<exceptfds>B<, const struct timespec "
3394 "*>I<ntimeout>B<,>\n"
3395 "B<            const sigset_t *>I<sigmask>B<);>\n"
3396 msgstr ""
3397
3398 #. type: Plain text
3399 #: build/C/man2/select_tut.2:81
3400 msgid ""
3401 "B<select>()  (or B<pselect>())  is used to efficiently monitor multiple file "
3402 "descriptors, to see if any of them is, or becomes, \"ready\"; that is, to "
3403 "see whether I/O becomes possible, or an \"exceptional condition\" has "
3404 "occurred on any of the descriptors."
3405 msgstr ""
3406
3407 #. type: Plain text
3408 #: build/C/man2/select_tut.2:106
3409 msgid ""
3410 "Its principal arguments are three \"sets\" of file descriptors: I<readfds>, "
3411 "I<writefds>, and I<exceptfds>.  Each set is declared as type I<fd_set>, and "
3412 "its contents can be manipulated with the macros B<FD_CLR>(), B<FD_ISSET>(), "
3413 "B<FD_SET>(), and B<FD_ZERO>().  A newly declared set should first be cleared "
3414 "using B<FD_ZERO>().  B<select>()  modifies the contents of the sets "
3415 "according to the rules described below; after calling B<select>()  you can "
3416 "test if a file descriptor is still present in a set with the B<FD_ISSET>()  "
3417 "macro.  B<FD_ISSET>()  returns nonzero if a specified file descriptor is "
3418 "present in a set and zero if it is not.  B<FD_CLR>()  removes a file "
3419 "descriptor from a set."
3420 msgstr ""
3421
3422 #. type: SS
3423 #: build/C/man2/select_tut.2:106
3424 #, no-wrap
3425 msgid "Arguments"
3426 msgstr ""
3427
3428 #. type: TP
3429 #: build/C/man2/select_tut.2:107
3430 #, no-wrap
3431 msgid "I<readfds>"
3432 msgstr ""
3433
3434 #. type: Plain text
3435 #: build/C/man2/select_tut.2:116
3436 msgid ""
3437 "This set is watched to see if data is available for reading from any of its "
3438 "file descriptors.  After B<select>()  has returned, I<readfds> will be "
3439 "cleared of all file descriptors except for those that are immediately "
3440 "available for reading."
3441 msgstr ""
3442
3443 #. type: TP
3444 #: build/C/man2/select_tut.2:116
3445 #, no-wrap
3446 msgid "I<writefds>"
3447 msgstr ""
3448
3449 #. type: Plain text
3450 #: build/C/man2/select_tut.2:125
3451 msgid ""
3452 "This set is watched to see if there is space to write data to any of its "
3453 "file descriptors.  After B<select>()  has returned, I<writefds> will be "
3454 "cleared of all file descriptors except for those that are immediately "
3455 "available for writing."
3456 msgstr ""
3457
3458 #. type: TP
3459 #: build/C/man2/select_tut.2:125
3460 #, no-wrap
3461 msgid "I<exceptfds>"
3462 msgstr ""
3463
3464 #. type: Plain text
3465 #: build/C/man2/select_tut.2:147
3466 msgid ""
3467 "This set is watched for \"exceptional conditions\".  In practice, only one "
3468 "such exceptional condition is common: the availability of I<out-of-band> "
3469 "(OOB) data for reading from a TCP socket.  See B<recv>(2), B<send>(2), and "
3470 "B<tcp>(7)  for more details about OOB data.  (One other less common case "
3471 "where B<select>(2)  indicates an exceptional condition occurs with "
3472 "pseudoterminals in packet mode; see B<tty_ioctl>(4).)  After B<select>()  "
3473 "has returned, I<exceptfds> will be cleared of all file descriptors except "
3474 "for those for which an exceptional condition has occurred."
3475 msgstr ""
3476
3477 #. type: TP
3478 #: build/C/man2/select_tut.2:147
3479 #, no-wrap
3480 msgid "I<nfds>"
3481 msgstr ""
3482
3483 #. type: Plain text
3484 #: build/C/man2/select_tut.2:154
3485 msgid ""
3486 "This is an integer one more than the maximum of any file descriptor in any "
3487 "of the sets.  In other words, while adding file descriptors to each of the "
3488 "sets, you must calculate the maximum integer value of all of them, then "
3489 "increment this value by one, and then pass this as I<nfds>."
3490 msgstr ""
3491
3492 #. type: TP
3493 #: build/C/man2/select_tut.2:154
3494 #, no-wrap
3495 msgid "I<utimeout>"
3496 msgstr ""
3497
3498 #. type: Plain text
3499 #: build/C/man2/select_tut.2:167
3500 msgid ""
3501 "This is the longest time B<select>()  may wait before returning, even if "
3502 "nothing interesting happened.  If this value is passed as NULL, then "
3503 "B<select>()  blocks indefinitely waiting for a file descriptor to become "
3504 "ready.  I<utimeout> can be set to zero seconds, which causes B<select>()  to "
3505 "return immediately, with information about the readiness of file descriptors "
3506 "at the time of the call.  The structure I<struct timeval> is defined as:"
3507 msgstr ""
3508
3509 #. type: Plain text
3510 #: build/C/man2/select_tut.2:174
3511 #, no-wrap
3512 msgid ""
3513 "struct timeval {\n"
3514 "    time_t tv_sec;    /* seconds */\n"
3515 "    long tv_usec;     /* microseconds */\n"
3516 "};\n"
3517 msgstr ""
3518
3519 #. type: TP
3520 #: build/C/man2/select_tut.2:176
3521 #, no-wrap
3522 msgid "I<ntimeout>"
3523 msgstr ""
3524
3525 #. type: Plain text
3526 #: build/C/man2/select_tut.2:185
3527 msgid ""
3528 "This argument for B<pselect>()  has the same meaning as I<utimeout>, but "
3529 "I<struct timespec> has nanosecond precision as follows:"
3530 msgstr ""
3531
3532 #. type: Plain text
3533 #: build/C/man2/select_tut.2:192
3534 #, no-wrap
3535 msgid ""
3536 "struct timespec {\n"
3537 "    long tv_sec;    /* seconds */\n"
3538 "    long tv_nsec;   /* nanoseconds */\n"
3539 "};\n"
3540 msgstr ""
3541
3542 #. type: TP
3543 #: build/C/man2/select_tut.2:194
3544 #, no-wrap
3545 msgid "I<sigmask>"
3546 msgstr ""
3547
3548 #. type: Plain text
3549 #: build/C/man2/select_tut.2:211
3550 msgid ""
3551 "This argument holds a set of signals that the kernel should unblock (i.e., "
3552 "remove from the signal mask of the calling thread), while the caller is "
3553 "blocked inside the B<pselect>()  call (see B<sigaddset>(3)  and "
3554 "B<sigprocmask>(2)).  It may be NULL, in which case the call does not modify "
3555 "the signal mask on entry and exit to the function.  In this case, "
3556 "B<pselect>()  will then behave just like B<select>()."
3557 msgstr ""
3558
3559 #. type: SS
3560 #: build/C/man2/select_tut.2:211
3561 #, no-wrap
3562 msgid "Combining Signal and Data Events"
3563 msgstr ""
3564
3565 #. type: Plain text
3566 #: build/C/man2/select_tut.2:255
3567 msgid ""
3568 "B<pselect>()  is useful if you are waiting for a signal as well as for file "
3569 "descriptor(s) to become ready for I/O.  Programs that receive signals "
3570 "normally use the signal handler only to raise a global flag.  The global "
3571 "flag will indicate that the event must be processed in the main loop of the "
3572 "program.  A signal will cause the B<select>()  (or B<pselect>())  call to "
3573 "return with I<errno> set to B<EINTR>.  This behavior is essential so that "
3574 "signals can be processed in the main loop of the program, otherwise "
3575 "B<select>()  would block indefinitely.  Now, somewhere in the main loop will "
3576 "be a conditional to check the global flag.  So we must ask: what if a signal "
3577 "arrives after the conditional, but before the B<select>()  call? The answer "
3578 "is that B<select>()  would block indefinitely, even though an event is "
3579 "actually pending.  This race condition is solved by the B<pselect>()  call.  "
3580 "This call can be used to set the signal mask to a set of signals that are "
3581 "only to be received within the B<pselect>()  call.  For instance, let us say "
3582 "that the event in question was the exit of a child process.  Before the "
3583 "start of the main loop, we would block B<SIGCHLD> using B<sigprocmask>(2).  "
3584 "Our B<pselect>()  call would enable B<SIGCHLD> by using an empty signal "
3585 "mask.  Our program would look like:"
3586 msgstr ""
3587
3588 #. type: Plain text
3589 #: build/C/man2/select_tut.2:258
3590 #, no-wrap
3591 msgid "static volatile sig_atomic_t got_SIGCHLD = 0;\n"
3592 msgstr ""
3593
3594 #. type: Plain text
3595 #: build/C/man2/select_tut.2:264
3596 #, no-wrap
3597 msgid ""
3598 "static void\n"
3599 "child_sig_handler(int sig)\n"
3600 "{\n"
3601 "    got_SIGCHLD = 1;\n"
3602 "}\n"
3603 msgstr ""
3604
3605 #. type: Plain text
3606 #: build/C/man2/select_tut.2:272
3607 #, no-wrap
3608 msgid ""
3609 "int\n"
3610 "main(int argc, char *argv[])\n"
3611 "{\n"
3612 "    sigset_t sigmask, empty_mask;\n"
3613 "    struct sigaction sa;\n"
3614 "    fd_set readfds, writefds, exceptfds;\n"
3615 "    int r;\n"
3616 msgstr ""
3617
3618 #. type: Plain text
3619 #: build/C/man2/select_tut.2:279
3620 #, no-wrap
3621 msgid ""
3622 "    sigemptyset(&sigmask);\n"
3623 "    sigaddset(&sigmask, SIGCHLD);\n"
3624 "    if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n"
3625 "        perror(\"sigprocmask\");\n"
3626 "        exit(EXIT_FAILURE);\n"
3627 "    }\n"
3628 msgstr ""
3629
3630 #. type: Plain text
3631 #: build/C/man2/select_tut.2:287
3632 #, no-wrap
3633 msgid ""
3634 "    sa.sa_flags = 0;\n"
3635 "    sa.sa_handler = child_sig_handler;\n"
3636 "    sigemptyset(&sa.sa_mask);\n"
3637 "    if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n"
3638 "        perror(\"sigaction\");\n"
3639 "        exit(EXIT_FAILURE);\n"
3640 "    }\n"
3641 msgstr ""
3642
3643 #. type: Plain text
3644 #: build/C/man2/select_tut.2:289
3645 #, no-wrap
3646 msgid "    sigemptyset(&empty_mask);\n"
3647 msgstr ""
3648
3649 #. type: Plain text
3650 #: build/C/man2/select_tut.2:293
3651 #, no-wrap
3652 msgid ""
3653 "    for (;;) {          /* main loop */\n"
3654 "        /* Initialize readfds, writefds, and exceptfds\n"
3655 "           before the pselect() call. (Code omitted.) */\n"
3656 msgstr ""
3657
3658 #. type: Plain text
3659 #: build/C/man2/select_tut.2:299
3660 #, no-wrap
3661 msgid ""
3662 "        r = pselect(nfds, &readfds, &writefds, &exceptfds,\n"
3663 "                    NULL, &empty_mask);\n"
3664 "        if (r == -1 && errno != EINTR) {\n"
3665 "            /* Handle error */\n"
3666 "        }\n"
3667 msgstr ""
3668
3669 #. type: Plain text
3670 #: build/C/man2/select_tut.2:302
3671 #, no-wrap
3672 msgid ""
3673 "        if (got_SIGCHLD) {\n"
3674 "            got_SIGCHLD = 0;\n"
3675 msgstr ""
3676
3677 #. type: Plain text
3678 #: build/C/man2/select_tut.2:306
3679 #, no-wrap
3680 msgid ""
3681 "            /* Handle signalled event here; e.g., wait() for all\n"
3682 "               terminated children. (Code omitted.) */\n"
3683 "        }\n"
3684 msgstr ""
3685
3686 #. type: Plain text
3687 #: build/C/man2/select_tut.2:310
3688 #, no-wrap
3689 msgid ""
3690 "        /* main body of program */\n"
3691 "    }\n"
3692 "}\n"
3693 msgstr ""
3694
3695 #. type: SS
3696 #: build/C/man2/select_tut.2:311
3697 #, no-wrap
3698 msgid "Practical"
3699 msgstr ""
3700
3701 #. type: Plain text
3702 #: build/C/man2/select_tut.2:332
3703 msgid ""
3704 "So what is the point of B<select>()? Can't I just read and write to my "
3705 "descriptors whenever I want? The point of B<select>()  is that it watches "
3706 "multiple descriptors at the same time and properly puts the process to sleep "
3707 "if there is no activity.  UNIX programmers often find themselves in a "
3708 "position where they have to handle I/O from more than one file descriptor "
3709 "where the data flow may be intermittent.  If you were to merely create a "
3710 "sequence of B<read>(2)  and B<write>(2)  calls, you would find that one of "
3711 "your calls may block waiting for data from/to a file descriptor, while "
3712 "another file descriptor is unused though ready for I/O.  B<select>()  "
3713 "efficiently copes with this situation."
3714 msgstr ""
3715
3716 #. type: SS
3717 #: build/C/man2/select_tut.2:332
3718 #, no-wrap
3719 msgid "Select Law"
3720 msgstr ""
3721
3722 #. type: Plain text
3723 #: build/C/man2/select_tut.2:345
3724 msgid ""
3725 "Many people who try to use B<select>()  come across behavior that is "
3726 "difficult to understand and produces nonportable or borderline results.  For "
3727 "instance, the above program is carefully written not to block at any point, "
3728 "even though it does not set its file descriptors to nonblocking mode.  It is "
3729 "easy to introduce subtle errors that will remove the advantage of using "
3730 "B<select>(), so here is a list of essentials to watch for when using "
3731 "B<select>()."
3732 msgstr ""
3733
3734 #. type: Plain text
3735 #: build/C/man2/select_tut.2:354
3736 msgid ""
3737 "You should always try to use B<select>()  without a timeout.  Your program "
3738 "should have nothing to do if there is no data available.  Code that depends "
3739 "on timeouts is not usually portable and is difficult to debug."
3740 msgstr ""
3741
3742 #. type: Plain text
3743 #: build/C/man2/select_tut.2:358
3744 msgid ""
3745 "The value I<nfds> must be properly calculated for efficiency as explained "
3746 "above."
3747 msgstr ""
3748
3749 #. type: Plain text
3750 #: build/C/man2/select_tut.2:365
3751 msgid ""
3752 "No file descriptor must be added to any set if you do not intend to check "
3753 "its result after the B<select>()  call, and respond appropriately.  See next "
3754 "rule."
3755 msgstr ""
3756
3757 #. type: Plain text
3758 #: build/C/man2/select_tut.2:371
3759 msgid ""
3760 "After B<select>()  returns, all file descriptors in all sets should be "
3761 "checked to see if they are ready."
3762 msgstr ""
3763
3764 #. type: TP
3765 #: build/C/man2/select_tut.2:371
3766 #, no-wrap
3767 msgid "5."
3768 msgstr ""
3769
3770 #. type: Plain text
3771 #: build/C/man2/select_tut.2:386
3772 msgid ""
3773 "The functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  do I<not> "
3774 "necessarily read/write the full amount of data that you have requested.  If "
3775 "they do read/write the full amount, it's because you have a low traffic load "
3776 "and a fast stream.  This is not always going to be the case.  You should "
3777 "cope with the case of your functions only managing to send or receive a "
3778 "single byte."
3779 msgstr ""
3780
3781 #. type: TP
3782 #: build/C/man2/select_tut.2:386
3783 #, no-wrap
3784 msgid "6."
3785 msgstr ""
3786
3787 #. type: Plain text
3788 #: build/C/man2/select_tut.2:394
3789 msgid ""
3790 "Never read/write only in single bytes at a time unless you are really sure "
3791 "that you have a small amount of data to process.  It is extremely "
3792 "inefficient not to read/write as much data as you can buffer each time.  The "
3793 "buffers in the example below are 1024 bytes although they could easily be "
3794 "made larger."
3795 msgstr ""
3796
3797 #. type: TP
3798 #: build/C/man2/select_tut.2:394
3799 #, no-wrap
3800 msgid "7."
3801 msgstr ""
3802
3803 #.  Nonetheless, you should still cope with these errors for completeness.
3804 #. type: Plain text
3805 #: build/C/man2/select_tut.2:416
3806 msgid ""
3807 "The functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  as well "
3808 "as the B<select>()  call can return -1 with I<errno> set to B<EINTR>, or "
3809 "with I<errno> set to B<EAGAIN> (B<EWOULDBLOCK>).  These results must be "
3810 "properly managed (not done properly above).  If your program is not going to "
3811 "receive any signals, then it is unlikely you will get B<EINTR>.  If your "
3812 "program does not set nonblocking I/O, you will not get B<EAGAIN>."
3813 msgstr ""
3814
3815 #. type: TP
3816 #: build/C/man2/select_tut.2:416
3817 #, no-wrap
3818 msgid "8."
3819 msgstr ""
3820
3821 #. type: Plain text
3822 #: build/C/man2/select_tut.2:425
3823 msgid ""
3824 "Never call B<read>(2), B<recv>(2), B<write>(2), or B<send>(2)  with a buffer "
3825 "length of zero."
3826 msgstr ""
3827
3828 #. type: TP
3829 #: build/C/man2/select_tut.2:425
3830 #, no-wrap
3831 msgid "9."
3832 msgstr ""
3833
3834 #. type: Plain text
3835 #: build/C/man2/select_tut.2:441
3836 msgid ""
3837 "If the functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2)  fail "
3838 "with errors other than those listed in B<7.>, or one of the input functions "
3839 "returns 0, indicating end of file, then you should I<not> pass that "
3840 "descriptor to B<select>()  again.  In the example below, I close the "
3841 "descriptor immediately, and then set it to -1 to prevent it being included "
3842 "in a set."
3843 msgstr ""
3844
3845 #. type: TP
3846 #: build/C/man2/select_tut.2:441
3847 #, no-wrap
3848 msgid "10."
3849 msgstr ""
3850
3851 #. type: Plain text
3852 #: build/C/man2/select_tut.2:448
3853 msgid ""
3854 "The timeout value must be initialized with each new call to B<select>(), "
3855 "since some operating systems modify the structure.  B<pselect>()  however "
3856 "does not modify its timeout structure."
3857 msgstr ""
3858
3859 #. type: TP
3860 #: build/C/man2/select_tut.2:448
3861 #, no-wrap
3862 msgid "11."
3863 msgstr ""
3864
3865 #.  "I have heard" does not fill me with confidence, and doesn't
3866 #.  belong in a man page, so I've commented this point out.
3867 #.  .TP
3868 #.  11.
3869 #.  I have heard that the Windows socket layer does not cope with OOB data
3870 #.  properly.
3871 #.  It also does not cope with
3872 #.  .BR select ()
3873 #.  calls when no file descriptors are set at all.
3874 #.  Having no file descriptors set is a useful
3875 #.  way to sleep the process with subsecond precision by using the timeout.
3876 #.  (See further on.)
3877 #. type: Plain text
3878 #: build/C/man2/select_tut.2:467
3879 msgid ""
3880 "Since B<select>()  modifies its file descriptor sets, if the call is being "
3881 "used in a loop, then the sets must be reinitialized before each call."
3882 msgstr ""
3883
3884 #. type: SS
3885 #: build/C/man2/select_tut.2:467
3886 #, no-wrap
3887 msgid "Usleep Emulation"
3888 msgstr ""
3889
3890 #. type: Plain text
3891 #: build/C/man2/select_tut.2:474
3892 msgid ""
3893 "On systems that do not have a B<usleep>(3)  function, you can call "
3894 "B<select>()  with a finite timeout and no file descriptors as follows:"
3895 msgstr ""
3896
3897 #. type: Plain text
3898 #: build/C/man2/select_tut.2:480
3899 #, no-wrap
3900 msgid ""
3901 "    struct timeval tv;\n"
3902 "    tv.tv_sec = 0;\n"
3903 "    tv.tv_usec = 200000;  /* 0.2 seconds */\n"
3904 "    select(0, NULL, NULL, NULL, &tv);\n"
3905 msgstr ""
3906
3907 #. type: Plain text
3908 #: build/C/man2/select_tut.2:483
3909 msgid "This is only guaranteed to work on UNIX systems, however."
3910 msgstr ""
3911
3912 #. type: Plain text
3913 #: build/C/man2/select_tut.2:488
3914 msgid ""
3915 "On success, B<select>()  returns the total number of file descriptors still "
3916 "present in the file descriptor sets."
3917 msgstr ""
3918
3919 #. type: Plain text
3920 #: build/C/man2/select_tut.2:494
3921 msgid ""
3922 "If B<select>()  timed out, then the return value will be zero.  The file "
3923 "descriptors set should be all empty (but may not be on some systems)."
3924 msgstr ""
3925
3926 #. type: Plain text
3927 #: build/C/man2/select_tut.2:501
3928 msgid ""
3929 "A return value of -1 indicates an error, with I<errno> being set "
3930 "appropriately.  In the case of an error, the contents of the returned sets "
3931 "and the I<struct timeout> contents are undefined and should not be used.  "
3932 "B<pselect>()  however never modifies I<ntimeout>."
3933 msgstr ""
3934
3935 #. type: Plain text
3936 #: build/C/man2/select_tut.2:510
3937 msgid ""
3938 "Generally speaking, all operating systems that support sockets also support "
3939 "B<select>().  B<select>()  can be used to solve many problems in a portable "
3940 "and efficient way that naive programmers try to solve in a more complicated "
3941 "manner using threads, forking, IPCs, signals, memory sharing, and so on."
3942 msgstr ""
3943
3944 #. type: Plain text
3945 #: build/C/man2/select_tut.2:519
3946 msgid ""
3947 "The B<poll>(2)  system call has the same functionality as B<select>(), and "
3948 "is somewhat more efficient when monitoring sparse file descriptor sets.  It "
3949 "is nowadays widely available, but historically was less portable than "
3950 "B<select>()."
3951 msgstr ""
3952
3953 #. type: Plain text
3954 #: build/C/man2/select_tut.2:527
3955 msgid ""
3956 "The Linux-specific B<epoll>(7)  API provides an interface that is more "
3957 "efficient than B<select>(2)  and B<poll>(2)  when monitoring large numbers "
3958 "of file descriptors."
3959 msgstr ""
3960
3961 #. type: Plain text
3962 #: build/C/man2/select_tut.2:532
3963 msgid ""
3964 "Here is an example that better demonstrates the true utility of "
3965 "B<select>().  The listing below is a TCP forwarding program that forwards "
3966 "from one TCP port to another."
3967 msgstr ""
3968
3969 #. type: Plain text
3970 #: build/C/man2/select_tut.2:545
3971 #, no-wrap
3972 msgid ""
3973 "#include E<lt>stdlib.hE<gt>\n"
3974 "#include E<lt>stdio.hE<gt>\n"
3975 "#include E<lt>unistd.hE<gt>\n"
3976 "#include E<lt>sys/time.hE<gt>\n"
3977 "#include E<lt>sys/types.hE<gt>\n"
3978 "#include E<lt>string.hE<gt>\n"
3979 "#include E<lt>signal.hE<gt>\n"
3980 "#include E<lt>sys/socket.hE<gt>\n"
3981 "#include E<lt>netinet/in.hE<gt>\n"
3982 "#include E<lt>arpa/inet.hE<gt>\n"
3983 "#include E<lt>errno.hE<gt>\n"
3984 msgstr ""
3985
3986 #. type: Plain text
3987 #: build/C/man2/select_tut.2:547
3988 #, no-wrap
3989 msgid "static int forward_port;\n"
3990 msgstr ""
3991
3992 #. type: Plain text
3993 #: build/C/man2/select_tut.2:550
3994 #, no-wrap
3995 msgid ""
3996 "#undef max\n"
3997 "#define max(x,y) ((x) E<gt> (y) ? (x) : (y))\n"
3998 msgstr ""
3999
4000 #. type: Plain text
4001 #: build/C/man2/select_tut.2:557
4002 #, no-wrap
4003 msgid ""
4004 "static int\n"
4005 "listen_socket(int listen_port)\n"
4006 "{\n"
4007 "    struct sockaddr_in a;\n"
4008 "    int s;\n"
4009 "    int yes;\n"
4010 msgstr ""
4011
4012 #. type: Plain text
4013 #: build/C/man2/select_tut.2:581
4014 #, no-wrap
4015 msgid ""
4016 "    if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {\n"
4017 "        perror(\"socket\");\n"
4018 "        return -1;\n"
4019 "    }\n"
4020 "    yes = 1;\n"
4021 "    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,\n"
4022 "            (char *) &yes, sizeof(yes)) == -1) {\n"
4023 "        perror(\"setsockopt\");\n"
4024 "        close(s);\n"
4025 "        return -1;\n"
4026 "    }\n"
4027 "    memset(&a, 0, sizeof(a));\n"
4028 "    a.sin_port = htons(listen_port);\n"
4029 "    a.sin_family = AF_INET;\n"
4030 "    if (bind(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4031 "        perror(\"bind\");\n"
4032 "        close(s);\n"
4033 "        return -1;\n"
4034 "    }\n"
4035 "    printf(\"accepting connections on port %d\\en\", listen_port);\n"
4036 "    listen(s, 10);\n"
4037 "    return s;\n"
4038 "}\n"
4039 msgstr ""
4040
4041 #. type: Plain text
4042 #: build/C/man2/select_tut.2:587
4043 #, no-wrap
4044 msgid ""
4045 "static int\n"
4046 "connect_socket(int connect_port, char *address)\n"
4047 "{\n"
4048 "    struct sockaddr_in a;\n"
4049 "    int s;\n"
4050 msgstr ""
4051
4052 #. type: Plain text
4053 #: build/C/man2/select_tut.2:593
4054 #, no-wrap
4055 msgid ""
4056 "    if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {\n"
4057 "        perror(\"socket\");\n"
4058 "        close(s);\n"
4059 "        return -1;\n"
4060 "    }\n"
4061 msgstr ""
4062
4063 #. type: Plain text
4064 #: build/C/man2/select_tut.2:597
4065 #, no-wrap
4066 msgid ""
4067 "    memset(&a, 0, sizeof(a));\n"
4068 "    a.sin_port = htons(connect_port);\n"
4069 "    a.sin_family = AF_INET;\n"
4070 msgstr ""
4071
4072 #. type: Plain text
4073 #: build/C/man2/select_tut.2:603
4074 #, no-wrap
4075 msgid ""
4076 "    if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {\n"
4077 "        perror(\"bad IP address format\");\n"
4078 "        close(s);\n"
4079 "        return -1;\n"
4080 "    }\n"
4081 msgstr ""
4082
4083 #. type: Plain text
4084 #: build/C/man2/select_tut.2:612
4085 #, no-wrap
4086 msgid ""
4087 "    if (connect(s, (struct sockaddr *) &a, sizeof(a)) == -1) {\n"
4088 "        perror(\"connect()\");\n"
4089 "        shutdown(s, SHUT_RDWR);\n"
4090 "        close(s);\n"
4091 "        return -1;\n"
4092 "    }\n"
4093 "    return s;\n"
4094 "}\n"
4095 msgstr ""
4096
4097 #. type: Plain text
4098 #: build/C/man2/select_tut.2:620
4099 #, no-wrap
4100 msgid ""
4101 "#define SHUT_FD1 do {                                \\e\n"
4102 "                     if (fd1 E<gt>= 0) {                 \\e\n"
4103 "                         shutdown(fd1, SHUT_RDWR);   \\e\n"
4104 "                         close(fd1);                 \\e\n"
4105 "                         fd1 = -1;                   \\e\n"
4106 "                     }                               \\e\n"
4107 "                 } while (0)\n"
4108 msgstr ""
4109
4110 #. type: Plain text
4111 #: build/C/man2/select_tut.2:628
4112 #, no-wrap
4113 msgid ""
4114 "#define SHUT_FD2 do {                                \\e\n"
4115 "                     if (fd2 E<gt>= 0) {                 \\e\n"
4116 "                         shutdown(fd2, SHUT_RDWR);   \\e\n"
4117 "                         close(fd2);                 \\e\n"
4118 "                         fd2 = -1;                   \\e\n"
4119 "                     }                               \\e\n"
4120 "                 } while (0)\n"
4121 msgstr ""
4122
4123 #. type: Plain text
4124 #: build/C/man2/select_tut.2:630
4125 #, no-wrap
4126 msgid "#define BUF_SIZE 1024\n"
4127 msgstr ""
4128
4129 #. type: Plain text
4130 #: build/C/man2/select_tut.2:639
4131 #, no-wrap
4132 msgid ""
4133 "int\n"
4134 "main(int argc, char *argv[])\n"
4135 "{\n"
4136 "    int h;\n"
4137 "    int fd1 = -1, fd2 = -1;\n"
4138 "    char buf1[BUF_SIZE], buf2[BUF_SIZE];\n"
4139 "    int buf1_avail, buf1_written;\n"
4140 "    int buf2_avail, buf2_written;\n"
4141 msgstr ""
4142
4143 #. type: Plain text
4144 #: build/C/man2/select_tut.2:645
4145 #, no-wrap
4146 msgid ""
4147 "    if (argc != 4) {\n"
4148 "        fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n"
4149 "                 \"E<lt>forward-to-portE<gt> "
4150 "E<lt>forward-to-ip-addressE<gt>\\en\");\n"
4151 "        exit(EXIT_FAILURE);\n"
4152 "    }\n"
4153 msgstr ""
4154
4155 #. type: Plain text
4156 #: build/C/man2/select_tut.2:647
4157 #, no-wrap
4158 msgid "    signal(SIGPIPE, SIG_IGN);\n"
4159 msgstr ""
4160
4161 #. type: Plain text
4162 #: build/C/man2/select_tut.2:649
4163 #, no-wrap
4164 msgid "    forward_port = atoi(argv[2]);\n"
4165 msgstr ""
4166
4167 #. type: Plain text
4168 #: build/C/man2/select_tut.2:653
4169 #, no-wrap
4170 msgid ""
4171 "    h = listen_socket(atoi(argv[1]));\n"
4172 "    if (h == -1)\n"
4173 "        exit(EXIT_FAILURE);\n"
4174 msgstr ""
4175
4176 #. type: Plain text
4177 #: build/C/man2/select_tut.2:657
4178 #, no-wrap
4179 msgid ""
4180 "    for (;;) {\n"
4181 "        int r, nfds = 0;\n"
4182 "        fd_set rd, wr, er;\n"
4183 msgstr ""
4184
4185 #. type: Plain text
4186 #: build/C/man2/select_tut.2:687
4187 #, no-wrap
4188 msgid ""
4189 "        FD_ZERO(&rd);\n"
4190 "        FD_ZERO(&wr);\n"
4191 "        FD_ZERO(&er);\n"
4192 "        FD_SET(h, &rd);\n"
4193 "        nfds = max(nfds, h);\n"
4194 "        if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE) {\n"
4195 "            FD_SET(fd1, &rd);\n"
4196 "            nfds = max(nfds, fd1);\n"
4197 "        }\n"
4198 "        if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE) {\n"
4199 "            FD_SET(fd2, &rd);\n"
4200 "            nfds = max(nfds, fd2);\n"
4201 "        }\n"
4202 "        if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0) {\n"
4203 "            FD_SET(fd1, &wr);\n"
4204 "            nfds = max(nfds, fd1);\n"
4205 "        }\n"
4206 "        if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0) {\n"
4207 "            FD_SET(fd2, &wr);\n"
4208 "            nfds = max(nfds, fd2);\n"
4209 "        }\n"
4210 "        if (fd1 E<gt> 0) {\n"
4211 "            FD_SET(fd1, &er);\n"
4212 "            nfds = max(nfds, fd1);\n"
4213 "        }\n"
4214 "        if (fd2 E<gt> 0) {\n"
4215 "            FD_SET(fd2, &er);\n"
4216 "            nfds = max(nfds, fd2);\n"
4217 "        }\n"
4218 msgstr ""
4219
4220 #. type: Plain text
4221 #: build/C/man2/select_tut.2:689
4222 #, no-wrap
4223 msgid "        r = select(nfds + 1, &rd, &wr, &er, NULL);\n"
4224 msgstr ""
4225
4226 #. type: Plain text
4227 #: build/C/man2/select_tut.2:692
4228 #, no-wrap
4229 msgid ""
4230 "        if (r == -1 && errno == EINTR)\n"
4231 "            continue;\n"
4232 msgstr ""
4233
4234 #. type: Plain text
4235 #: build/C/man2/select_tut.2:697
4236 #, no-wrap
4237 msgid ""
4238 "        if (r == -1) {\n"
4239 "            perror(\"select()\");\n"
4240 "            exit(EXIT_FAILURE);\n"
4241 "        }\n"
4242 msgstr ""
4243
4244 #. type: Plain text
4245 #: build/C/man2/select_tut.2:701
4246 #, no-wrap
4247 msgid ""
4248 "        if (FD_ISSET(h, &rd)) {\n"
4249 "            unsigned int l;\n"
4250 "            struct sockaddr_in client_address;\n"
4251 msgstr ""
4252
4253 #. type: Plain text
4254 #: build/C/man2/select_tut.2:720
4255 #, no-wrap
4256 msgid ""
4257 "            memset(&client_address, 0, l = sizeof(client_address));\n"
4258 "            r = accept(h, (struct sockaddr *) &client_address, &l);\n"
4259 "            if (r == -1) {\n"
4260 "                perror(\"accept()\");\n"
4261 "            } else {\n"
4262 "                SHUT_FD1;\n"
4263 "                SHUT_FD2;\n"
4264 "                buf1_avail = buf1_written = 0;\n"
4265 "                buf2_avail = buf2_written = 0;\n"
4266 "                fd1 = r;\n"
4267 "                fd2 = connect_socket(forward_port, argv[3]);\n"
4268 "                if (fd2 == -1)\n"
4269 "                    SHUT_FD1;\n"
4270 "                else\n"
4271 "                    printf(\"connect from %s\\en\",\n"
4272 "                            inet_ntoa(client_address.sin_addr));\n"
4273 "            }\n"
4274 "        }\n"
4275 msgstr ""
4276
4277 #. type: Plain text
4278 #: build/C/man2/select_tut.2:722
4279 #, no-wrap
4280 msgid "        /* NB: read oob data before normal reads */\n"
4281 msgstr ""
4282
4283 #. type: Plain text
4284 #: build/C/man2/select_tut.2:726
4285 #, no-wrap
4286 msgid ""
4287 "        if (fd1 E<gt> 0)\n"
4288 "            if (FD_ISSET(fd1, &er)) {\n"
4289 "                char c;\n"
4290 msgstr ""
4291
4292 #. type: Plain text
4293 #: build/C/man2/select_tut.2:736
4294 #, no-wrap
4295 msgid ""
4296 "                r = recv(fd1, &c, 1, MSG_OOB);\n"
4297 "                if (r E<lt> 1)\n"
4298 "                    SHUT_FD1;\n"
4299 "                else\n"
4300 "                    send(fd2, &c, 1, MSG_OOB);\n"
4301 "            }\n"
4302 "        if (fd2 E<gt> 0)\n"
4303 "            if (FD_ISSET(fd2, &er)) {\n"
4304 "                char c;\n"
4305 msgstr ""
4306
4307 #. type: Plain text
4308 #: build/C/man2/select_tut.2:779
4309 #, no-wrap
4310 msgid ""
4311 "                r = recv(fd2, &c, 1, MSG_OOB);\n"
4312 "                if (r E<lt> 1)\n"
4313 "                    SHUT_FD2;\n"
4314 "                else\n"
4315 "                    send(fd1, &c, 1, MSG_OOB);\n"
4316 "            }\n"
4317 "        if (fd1 E<gt> 0)\n"
4318 "            if (FD_ISSET(fd1, &rd)) {\n"
4319 "                r = read(fd1, buf1 + buf1_avail,\n"
4320 "                          BUF_SIZE - buf1_avail);\n"
4321 "                if (r E<lt> 1)\n"
4322 "                    SHUT_FD1;\n"
4323 "                else\n"
4324 "                    buf1_avail += r;\n"
4325 "            }\n"
4326 "        if (fd2 E<gt> 0)\n"
4327 "            if (FD_ISSET(fd2, &rd)) {\n"
4328 "                r = read(fd2, buf2 + buf2_avail,\n"
4329 "                          BUF_SIZE - buf2_avail);\n"
4330 "                if (r E<lt> 1)\n"
4331 "                    SHUT_FD2;\n"
4332 "                else\n"
4333 "                    buf2_avail += r;\n"
4334 "            }\n"
4335 "        if (fd1 E<gt> 0)\n"
4336 "            if (FD_ISSET(fd1, &wr)) {\n"
4337 "                r = write(fd1, buf2 + buf2_written,\n"
4338 "                           buf2_avail - buf2_written);\n"
4339 "                if (r E<lt> 1)\n"
4340 "                    SHUT_FD1;\n"
4341 "                else\n"
4342 "                    buf2_written += r;\n"
4343 "            }\n"
4344 "        if (fd2 E<gt> 0)\n"
4345 "            if (FD_ISSET(fd2, &wr)) {\n"
4346 "                r = write(fd2, buf1 + buf1_written,\n"
4347 "                           buf1_avail - buf1_written);\n"
4348 "                if (r E<lt> 1)\n"
4349 "                    SHUT_FD2;\n"
4350 "                else\n"
4351 "                    buf1_written += r;\n"
4352 "            }\n"
4353 msgstr ""
4354
4355 #. type: Plain text
4356 #: build/C/man2/select_tut.2:781
4357 #, no-wrap
4358 msgid "        /* check if write data has caught read data */\n"
4359 msgstr ""
4360
4361 #. type: Plain text
4362 #: build/C/man2/select_tut.2:786
4363 #, no-wrap
4364 msgid ""
4365 "        if (buf1_written == buf1_avail)\n"
4366 "            buf1_written = buf1_avail = 0;\n"
4367 "        if (buf2_written == buf2_avail)\n"
4368 "            buf2_written = buf2_avail = 0;\n"
4369 msgstr ""
4370
4371 #. type: Plain text
4372 #: build/C/man2/select_tut.2:789
4373 #, no-wrap
4374 msgid ""
4375 "        /* one side has closed the connection, keep\n"
4376 "           writing to the other side until empty */\n"
4377 msgstr ""
4378
4379 #. type: Plain text
4380 #: build/C/man2/select_tut.2:797
4381 #, no-wrap
4382 msgid ""
4383 "        if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n"
4384 "            SHUT_FD2;\n"
4385 "        if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n"
4386 "            SHUT_FD1;\n"
4387 "    }\n"
4388 "    exit(EXIT_SUCCESS);\n"
4389 "}\n"
4390 msgstr ""
4391
4392 #. type: Plain text
4393 #: build/C/man2/select_tut.2:811
4394 msgid ""
4395 "The above program properly forwards most kinds of TCP connections including "
4396 "OOB signal data transmitted by B<telnet> servers.  It handles the tricky "
4397 "problem of having data flow in both directions simultaneously.  You might "
4398 "think it more efficient to use a B<fork>(2)  call and devote a thread to "
4399 "each stream.  This becomes more tricky than you might suspect.  Another idea "
4400 "is to set nonblocking I/O using B<fcntl>(2).  This also has its problems "
4401 "because you end up using inefficient timeouts."
4402 msgstr ""
4403
4404 #. type: Plain text
4405 #: build/C/man2/select_tut.2:817
4406 msgid ""
4407 "The program does not handle more than one simultaneous connection at a time, "
4408 "although it could easily be extended to do this with a linked list of "
4409 "buffers\\(emone for each connection.  At the moment, new connections cause "
4410 "the current connection to be dropped."
4411 msgstr ""
4412
4413 #. type: Plain text
4414 #: build/C/man2/select_tut.2:833
4415 msgid ""
4416 "B<accept>(2), B<connect>(2), B<ioctl>(2), B<poll>(2), B<read>(2), "
4417 "B<recv>(2), B<select>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), "
4418 "B<sigaddset>(3), B<sigdelset>(3), B<sigemptyset>(3), B<sigfillset>(3), "
4419 "B<sigismember>(3), B<epoll>(7)"
4420 msgstr ""
4421
4422 #. type: TH
4423 #: build/C/man2/send.2:38
4424 #, no-wrap
4425 msgid "SEND"
4426 msgstr ""
4427
4428 #. type: TH
4429 #: build/C/man2/send.2:38 build/C/man2/sendmmsg.2:28
4430 #, no-wrap
4431 msgid "2012-02-27"
4432 msgstr ""
4433
4434 #. type: Plain text
4435 #: build/C/man2/send.2:41
4436 msgid "send, sendto, sendmsg - send a message on a socket"
4437 msgstr ""
4438
4439 #. type: Plain text
4440 #: build/C/man2/send.2:45
4441 #, no-wrap
4442 msgid ""
4443 "B<#include E<lt>sys/types.hE<gt>>\n"
4444 "B<#include E<lt>sys/socket.hE<gt>>\n"
4445 msgstr ""
4446
4447 #. type: Plain text
4448 #: build/C/man2/send.2:48
4449 #, no-wrap
4450 msgid ""
4451 "B<ssize_t send(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, "
4452 "int >I<flags>B<);>\n"
4453 msgstr ""
4454
4455 #. type: Plain text
4456 #: build/C/man2/send.2:52
4457 #, no-wrap
4458 msgid ""
4459 "B<ssize_t sendto(int >I<sockfd>B<, const void *>I<buf>B<, size_t >I<len>B<, "
4460 "int >I<flags>B<,>\n"
4461 "B<               const struct sockaddr *>I<dest_addr>B<, socklen_t "
4462 ">I<addrlen>B<);>\n"
4463 msgstr ""
4464
4465 #. type: Plain text
4466 #: build/C/man2/send.2:55
4467 #, no-wrap
4468 msgid ""
4469 "B<ssize_t sendmsg(int >I<sockfd>B<, const struct msghdr *>I<msg>B<, int "
4470 ">I<flags>B<);>\n"
4471 msgstr ""
4472
4473 #. type: Plain text
4474 #: build/C/man2/send.2:63
4475 msgid ""
4476 "The system calls B<send>(), B<sendto>(), and B<sendmsg>()  are used to "
4477 "transmit a message to another socket."
4478 msgstr ""
4479
4480 #. type: Plain text
4481 #: build/C/man2/send.2:82
4482 msgid ""
4483 "The B<send>()  call may be used only when the socket is in a I<connected> "
4484 "state (so that the intended recipient is known).  The only difference "
4485 "between B<send>()  and B<write>(2)  is the presence of I<flags>.  With a "
4486 "zero I<flags> argument, B<send>()  is equivalent to B<write>(2).  Also, the "
4487 "following call"
4488 msgstr ""
4489
4490 #. type: Plain text
4491 #: build/C/man2/send.2:84
4492 #, no-wrap
4493 msgid "    send(sockfd, buf, len, flags);\n"
4494 msgstr ""
4495
4496 #. type: Plain text
4497 #: build/C/man2/send.2:86
4498 msgid "is equivalent to"
4499 msgstr ""
4500
4501 #. type: Plain text
4502 #: build/C/man2/send.2:88
4503 #, no-wrap
4504 msgid "    sendto(sockfd, buf, len, flags, NULL, 0);\n"
4505 msgstr ""
4506
4507 #. type: Plain text
4508 #: build/C/man2/send.2:92
4509 msgid "The argument I<sockfd> is the file descriptor of the sending socket."
4510 msgstr ""
4511
4512 #. type: Plain text
4513 #: build/C/man2/send.2:120
4514 msgid ""
4515 "If B<sendto>()  is used on a connection-mode (B<SOCK_STREAM>, "
4516 "B<SOCK_SEQPACKET>)  socket, the arguments I<dest_addr> and I<addrlen> are "
4517 "ignored (and the error B<EISCONN> may be returned when they are not NULL and "
4518 "0), and the error B<ENOTCONN> is returned when the socket was not actually "
4519 "connected.  Otherwise, the address of the target is given by I<dest_addr> "
4520 "with I<addrlen> specifying its size.  For B<sendmsg>(), the address of the "
4521 "target is given by I<msg.msg_name>, with I<msg.msg_namelen> specifying its "
4522 "size."
4523 msgstr ""
4524
4525 #. type: Plain text
4526 #: build/C/man2/send.2:136
4527 msgid ""
4528 "For B<send>()  and B<sendto>(), the message is found in I<buf> and has "
4529 "length I<len>.  For B<sendmsg>(), the message is pointed to by the elements "
4530 "of the array I<msg.msg_iov>.  The B<sendmsg>()  call also allows sending "
4531 "ancillary data (also known as control information)."
4532 msgstr ""
4533
4534 #. type: Plain text
4535 #: build/C/man2/send.2:141
4536 msgid ""
4537 "If the message is too long to pass atomically through the underlying "
4538 "protocol, the error B<EMSGSIZE> is returned, and the message is not "
4539 "transmitted."
4540 msgstr ""
4541
4542 #. type: Plain text
4543 #: build/C/man2/send.2:145
4544 msgid ""
4545 "No indication of failure to deliver is implicit in a B<send>().  Locally "
4546 "detected errors are indicated by a return value of -1."
4547 msgstr ""
4548
4549 #. type: Plain text
4550 #: build/C/man2/send.2:158
4551 msgid ""
4552 "When the message does not fit into the send buffer of the socket, B<send>()  "
4553 "normally blocks, unless the socket has been placed in nonblocking I/O mode.  "
4554 "In nonblocking mode it would fail with the error B<EAGAIN> or B<EWOULDBLOCK> "
4555 "in this case.  The B<select>(2)  call may be used to determine when it is "
4556 "possible to send more data."
4557 msgstr ""
4558
4559 #.  FIXME ? document MSG_PROXY (which went away in 2.3.15)
4560 #. type: Plain text
4561 #: build/C/man2/send.2:164
4562 msgid ""
4563 "The I<flags> argument is the bitwise OR of zero or more of the following "
4564 "flags."
4565 msgstr ""
4566
4567 #. type: TP
4568 #: build/C/man2/send.2:164
4569 #, no-wrap
4570 msgid "B<MSG_CONFIRM> (Since Linux 2.3.15)"
4571 msgstr ""
4572
4573 #. type: Plain text
4574 #: build/C/man2/send.2:178
4575 msgid ""
4576 "Tell the link layer that forward progress happened: you got a successful "
4577 "reply from the other side.  If the link layer doesn't get this it will "
4578 "regularly reprobe the neighbor (e.g., via a unicast ARP).  Only valid on "
4579 "B<SOCK_DGRAM> and B<SOCK_RAW> sockets and currently only implemented for "
4580 "IPv4 and IPv6.  See B<arp>(7)  for details."
4581 msgstr ""
4582
4583 #. type: TP
4584 #: build/C/man2/send.2:178
4585 #, no-wrap
4586 msgid "B<MSG_DONTROUTE>"
4587 msgstr ""
4588
4589 #. type: Plain text
4590 #: build/C/man2/send.2:186
4591 msgid ""
4592 "Don't use a gateway to send out the packet, only send to hosts on directly "
4593 "connected networks.  This is usually used only by diagnostic or routing "
4594 "programs.  This is only defined for protocol families that route; packet "
4595 "sockets don't."
4596 msgstr ""
4597
4598 #. type: Plain text
4599 #: build/C/man2/send.2:197
4600 msgid ""
4601 "Enables nonblocking operation; if the operation would block, B<EAGAIN> or "
4602 "B<EWOULDBLOCK> is returned (this can also be enabled using the B<O_NONBLOCK> "
4603 "flag with the B<F_SETFL> B<fcntl>(2))."
4604 msgstr ""
4605
4606 #. type: TP
4607 #: build/C/man2/send.2:197
4608 #, no-wrap
4609 msgid "B<MSG_EOR> (since Linux 2.2)"
4610 msgstr ""
4611
4612 #. type: Plain text
4613 #: build/C/man2/send.2:201
4614 msgid ""
4615 "Terminates a record (when this notion is supported, as for sockets of type "
4616 "B<SOCK_SEQPACKET>)."
4617 msgstr ""
4618
4619 #. type: TP
4620 #: build/C/man2/send.2:201
4621 #, no-wrap
4622 msgid "B<MSG_MORE> (Since Linux 2.4.4)"
4623 msgstr ""
4624
4625 #. type: Plain text
4626 #: build/C/man2/send.2:210
4627 msgid ""
4628 "The caller has more data to send.  This flag is used with TCP sockets to "
4629 "obtain the same effect as the B<TCP_CORK> socket option (see B<tcp>(7)), "
4630 "with the difference that this flag can be set on a per-call basis."
4631 msgstr ""
4632
4633 #. type: Plain text
4634 #: build/C/man2/send.2:219
4635 msgid ""
4636 "Since Linux 2.6, this flag is also supported for UDP sockets, and informs "
4637 "the kernel to package all of the data sent in calls with this flag set into "
4638 "a single datagram which is only transmitted when a call is performed that "
4639 "does not specify this flag.  (See also the B<UDP_CORK> socket option "
4640 "described in B<udp>(7).)"
4641 msgstr ""
4642
4643 #. type: TP
4644 #: build/C/man2/send.2:219
4645 #, no-wrap
4646 msgid "B<MSG_NOSIGNAL> (since Linux 2.2)"
4647 msgstr ""
4648
4649 #. type: Plain text
4650 #: build/C/man2/send.2:228
4651 msgid ""
4652 "Requests not to send B<SIGPIPE> on errors on stream oriented sockets when "
4653 "the other end breaks the connection.  The B<EPIPE> error is still returned."
4654 msgstr ""
4655
4656 #. type: Plain text
4657 #: build/C/man2/send.2:237
4658 msgid ""
4659 "Sends I<out-of-band> data on sockets that support this notion (e.g., of type "
4660 "B<SOCK_STREAM>); the underlying protocol must also support I<out-of-band> "
4661 "data."
4662 msgstr ""
4663
4664 #. type: Plain text
4665 #: build/C/man2/send.2:244
4666 msgid ""
4667 "The definition of the I<msghdr> structure follows.  See B<recv>(2)  and "
4668 "below for an exact description of its fields."
4669 msgstr ""
4670
4671 #.  Still to be documented:
4672 #.   Send file descriptors and user credentials using the
4673 #.   msg_control* fields.
4674 #.   The flags returned in msg_flags.
4675 #. type: Plain text
4676 #: build/C/man2/send.2:273
4677 msgid ""
4678 "You may send control information using the I<msg_control> and "
4679 "I<msg_controllen> members.  The maximum control buffer length the kernel can "
4680 "process is limited per socket by the value in "
4681 "I</proc/sys/net/core/optmem_max>; see B<socket>(7)."
4682 msgstr ""
4683
4684 #. type: Plain text
4685 #: build/C/man2/send.2:278
4686 msgid ""
4687 "On success, these calls return the number of characters sent.  On error, -1 "
4688 "is returned, and I<errno> is set appropriately."
4689 msgstr ""
4690
4691 #. type: Plain text
4692 #: build/C/man2/send.2:283
4693 msgid ""
4694 "These are some standard errors generated by the socket layer.  Additional "
4695 "errors may be generated and returned from the underlying protocol modules; "
4696 "see their respective manual pages."
4697 msgstr ""
4698
4699 #. type: Plain text
4700 #: build/C/man2/send.2:291
4701 msgid ""
4702 "(For UNIX domain sockets, which are identified by pathname)  Write "
4703 "permission is denied on the destination socket file, or search permission is "
4704 "denied for one of the directories the path prefix.  (See "
4705 "B<path_resolution>(7).)"
4706 msgstr ""
4707
4708 #.  Actually EAGAIN on Linux
4709 #. type: Plain text
4710 #: build/C/man2/send.2:299
4711 msgid ""
4712 "The socket is marked nonblocking and the requested operation would block.  "
4713 "POSIX.1-2001 allows either error to be returned for this case, and does not "
4714 "require these constants to have the same value, so a portable application "
4715 "should check for both possibilities."
4716 msgstr ""
4717
4718 #. type: Plain text
4719 #: build/C/man2/send.2:302
4720 msgid "An invalid descriptor was specified."
4721 msgstr ""
4722
4723 #. type: TP
4724 #: build/C/man2/send.2:302
4725 #, no-wrap
4726 msgid "B<ECONNRESET>"
4727 msgstr ""
4728
4729 #. type: Plain text
4730 #: build/C/man2/send.2:305
4731 msgid "Connection reset by peer."
4732 msgstr ""
4733
4734 #. type: TP
4735 #: build/C/man2/send.2:305
4736 #, no-wrap
4737 msgid "B<EDESTADDRREQ>"
4738 msgstr ""
4739
4740 #. type: Plain text
4741 #: build/C/man2/send.2:308
4742 msgid "The socket is not connection-mode, and no peer address is set."
4743 msgstr ""
4744
4745 #. type: Plain text
4746 #: build/C/man2/send.2:311
4747 msgid "An invalid user space address was specified for an argument."
4748 msgstr ""
4749
4750 #. type: Plain text
4751 #: build/C/man2/send.2:315
4752 msgid "A signal occurred before any data was transmitted; see B<signal>(7)."
4753 msgstr ""
4754
4755 #. type: Plain text
4756 #: build/C/man2/send.2:324
4757 msgid ""
4758 "The connection-mode socket was connected already but a recipient was "
4759 "specified.  (Now either this error is returned, or the recipient "
4760 "specification is ignored.)"
4761 msgstr ""
4762
4763 #. type: TP
4764 #: build/C/man2/send.2:324
4765 #, no-wrap
4766 msgid "B<EMSGSIZE>"
4767 msgstr ""
4768
4769 #.  (e.g., SOCK_DGRAM )
4770 #. type: Plain text
4771 #: build/C/man2/send.2:330
4772 msgid ""
4773 "The socket type requires that message be sent atomically, and the size of "
4774 "the message to be sent made this impossible."
4775 msgstr ""
4776
4777 #. type: Plain text
4778 #: build/C/man2/send.2:338
4779 msgid ""
4780 "The output queue for a network interface was full.  This generally indicates "
4781 "that the interface has stopped sending, but may be caused by transient "
4782 "congestion.  (Normally, this does not occur in Linux.  Packets are just "
4783 "silently dropped when a device queue overflows.)"
4784 msgstr ""
4785
4786 #. type: Plain text
4787 #: build/C/man2/send.2:341
4788 msgid "No memory available."
4789 msgstr ""
4790
4791 #. type: Plain text
4792 #: build/C/man2/send.2:344
4793 msgid "The socket is not connected, and no target has been given."
4794 msgstr ""
4795
4796 #. type: Plain text
4797 #: build/C/man2/send.2:354
4798 msgid "Some bit in the I<flags> argument is inappropriate for the socket type."
4799 msgstr ""
4800
4801 #. type: TP
4802 #: build/C/man2/send.2:354
4803 #, no-wrap
4804 msgid "B<EPIPE>"
4805 msgstr ""
4806
4807 #. type: Plain text
4808 #: build/C/man2/send.2:363
4809 msgid ""
4810 "The local end has been shut down on a connection oriented socket.  In this "
4811 "case the process will also receive a B<SIGPIPE> unless B<MSG_NOSIGNAL> is "
4812 "set."
4813 msgstr ""
4814
4815 #. type: Plain text
4816 #: build/C/man2/send.2:366
4817 msgid "4.4BSD, SVr4, POSIX.1-2001.  These function calls appeared in 4.2BSD."
4818 msgstr ""
4819
4820 #. type: Plain text
4821 #: build/C/man2/send.2:377
4822 msgid ""
4823 "POSIX.1-2001 only describes the B<MSG_OOB> and B<MSG_EOR> flags.  "
4824 "POSIX.1-2008 adds a specification of B<MSG_NOSIGNAL>.  The B<MSG_CONFIRM> "
4825 "flag is a Linux extension."
4826 msgstr ""
4827
4828 #. type: Plain text
4829 #: build/C/man2/send.2:390
4830 msgid ""
4831 "The prototypes given above follow the Single UNIX Specification, as glibc2 "
4832 "also does; the I<flags> argument was I<int> in 4.x BSD, but I<unsigned int> "
4833 "in libc4 and libc5; the I<len> argument was I<int> in 4.x BSD and libc4, but "
4834 "I<size_t> in libc5; the I<addrlen> argument was I<int> in 4.x BSD and libc4 "
4835 "and libc5.  See also B<accept>(2)."
4836 msgstr ""
4837
4838 #. type: Plain text
4839 #: build/C/man2/send.2:409
4840 msgid ""
4841 "See B<sendmmsg(2)> for information about a Linux-specific system call that "
4842 "can be used to transmit multiple datagrams in a single call."
4843 msgstr ""
4844
4845 #. type: Plain text
4846 #: build/C/man2/send.2:414
4847 msgid "Linux may return B<EPIPE> instead of B<ENOTCONN>."
4848 msgstr ""
4849
4850 #. type: Plain text
4851 #: build/C/man2/send.2:419
4852 msgid "An example of the use of B<sendto>()  is shown in B<getaddrinfo>(3)."
4853 msgstr ""
4854
4855 #. type: Plain text
4856 #: build/C/man2/send.2:433
4857 msgid ""
4858 "B<fcntl>(2), B<getsockopt>(2), B<recv>(2), B<select>(2), B<sendfile>(2), "
4859 "B<sendmmsg>(2), B<shutdown>(2), B<socket>(2), B<write>(2), B<cmsg>(3), "
4860 "B<ip>(7), B<socket>(7), B<tcp>(7), B<udp>(7)"
4861 msgstr ""
4862
4863 #. type: TH
4864 #: build/C/man2/sendmmsg.2:28
4865 #, no-wrap
4866 msgid "SENDMMSG"
4867 msgstr ""
4868
4869 #. type: Plain text
4870 #: build/C/man2/sendmmsg.2:31
4871 msgid "sendmmsg - send multiple messages on a socket"
4872 msgstr ""
4873
4874 #. type: Plain text
4875 #: build/C/man2/sendmmsg.2:39
4876 #, no-wrap
4877 msgid ""
4878 "B<int sendmmsg(int >I<sockfd>B<, struct mmsghdr *>I<msgvec>B<, unsigned int "
4879 ">I<vlen>B<,>\n"
4880 "B<             unsigned int >I<flags>B<);>\n"
4881 msgstr ""
4882
4883 #.  See commit 228e548e602061b08ee8e8966f567c12aa079682
4884 #. type: Plain text
4885 #: build/C/man2/sendmmsg.2:49
4886 msgid ""
4887 "The B<sendmmsg>()  system call is an extension of B<sendmsg>(2)  that allows "
4888 "the caller to transmit multiple messages on a socket using a single system "
4889 "call.  (This has performance benefits for some applications.)"
4890 msgstr ""
4891
4892 #. type: Plain text
4893 #: build/C/man2/sendmmsg.2:54
4894 msgid ""
4895 "The I<sockfd> argument is the file descriptor of the socket on which data is "
4896 "to be transmitted."
4897 msgstr ""
4898
4899 #. type: Plain text
4900 #: build/C/man2/sendmmsg.2:75
4901 #, no-wrap
4902 msgid ""
4903 "struct mmsghdr {\n"
4904 "    struct msghdr msg_hdr;  /* Message header */\n"
4905 "    unsigned int  msg_len;  /* Number of bytes transmitted */\n"
4906 "};\n"
4907 msgstr ""
4908
4909 #. type: Plain text
4910 #: build/C/man2/sendmmsg.2:91
4911 msgid ""
4912 "The I<msg_hdr> field is a I<msghdr> structure, as described in "
4913 "B<sendmsg>(2).  The I<msg_len> field is used to return the number of bytes "
4914 "sent from the message in I<msg_hdr> (i.e., the same as the return value from "
4915 "a single B<sendmsg>(2)  call)."
4916 msgstr ""
4917
4918 #. type: Plain text
4919 #: build/C/man2/sendmmsg.2:97
4920 msgid ""
4921 "The I<flags> argument contains flags ORed together.  The flags are the same "
4922 "as for B<sendmsg>(2)."
4923 msgstr ""
4924
4925 #. type: Plain text
4926 #: build/C/man2/sendmmsg.2:107
4927 msgid ""
4928 "A blocking B<sendmmsg>()  call blocks until I<vlen> messages have been "
4929 "sent.  A nonblocking call sends as many messages as possible (up to the "
4930 "limit specified by I<vlen>)  and returns immediately."
4931 msgstr ""
4932
4933 #. type: Plain text
4934 #: build/C/man2/sendmmsg.2:119
4935 msgid ""
4936 "On return from B<sendmmsg>(), the I<msg_len> fields of successive elements "
4937 "of I<msgvec> are updated to contain the number of bytes transmitted from the "
4938 "corresponding I<msg_hdr>.  The return value of the call indicates the number "
4939 "of elements of I<msgvec> that have been updated."
4940 msgstr ""
4941
4942 #. type: Plain text
4943 #: build/C/man2/sendmmsg.2:129
4944 msgid ""
4945 "On success, B<sendmmsg>()  returns the number of messages sent from "
4946 "I<msgvec>; if this is less than I<vlen>, the caller can retry with a further "
4947 "B<sendmmsg>()  call to send the remaining messages."
4948 msgstr ""
4949
4950 #. type: Plain text
4951 #: build/C/man2/sendmmsg.2:133
4952 msgid "On error, -1 is returned, and I<errno> is set to indicate the error."
4953 msgstr ""
4954
4955 #.  commit 728ffb86f10873aaf4abd26dde691ee40ae731fe
4956 #.      ... only return an error if no datagrams could be sent.
4957 #.      If less than the requested number of messages were sent, the application
4958 #.      must retry starting at the first failed one and if the problem is
4959 #.      persistent the error will be returned.
4960 #
4961 #.      This matches the behaviour of other syscalls like read/write - it
4962 #.      is not an error if less than the requested number of elements are sent.
4963 #. type: Plain text
4964 #: build/C/man2/sendmmsg.2:145
4965 msgid ""
4966 "Errors are as for B<sendmsg>(2).  An error is returned only if no datagrams "
4967 "could be sent."
4968 msgstr ""
4969
4970 #. type: Plain text
4971 #: build/C/man2/sendmmsg.2:150
4972 msgid ""
4973 "The B<sendmmsg>()  system call was added in Linux 3.0.  Support in glibc was "
4974 "added in version 2.14."
4975 msgstr ""
4976
4977 #. type: Plain text
4978 #: build/C/man2/sendmmsg.2:153
4979 msgid "B<sendmmsg>()  is Linux-specific."
4980 msgstr ""
4981
4982 #.  commit 98382f419f32d2c12d021943b87dea555677144b
4983 #.      net: Cap number of elements for sendmmsg
4984 #
4985 #.      To limit the amount of time we can spend in sendmmsg, cap the
4986 #.      number of elements to UIO_MAXIOV (currently 1024).
4987 #
4988 #.      For error handling an application using sendmmsg needs to retry at
4989 #.      the first unsent message, so capping is simpler and requires less
4990 #.      application logic than returning EINVAL.
4991 #. type: Plain text
4992 #: build/C/man2/sendmmsg.2:168
4993 msgid "The value specified in I<vlen> is capped to B<UIO_MAXIOV> (1024)."
4994 msgstr ""
4995
4996 #. type: Plain text
4997 #: build/C/man2/sendmmsg.2:172
4998 msgid "B<recvmmsg>(2), B<sendmsg>(2), B<socket>(2), B<socket>(7)"
4999 msgstr ""
5000
5001 #. type: TH
5002 #: build/C/man3/sockatmark.3:23
5003 #, no-wrap
5004 msgid "SOCKATMARK"
5005 msgstr ""
5006
5007 #. type: Plain text
5008 #: build/C/man3/sockatmark.3:26
5009 msgid "sockatmark - determine whether socket is at out-of-band mark"
5010 msgstr ""
5011
5012 #. type: Plain text
5013 #: build/C/man3/sockatmark.3:28 build/C/man2/socket.2:48 build/C/man7/socket.7:31 build/C/man2/socketpair.2:47
5014 msgid "B<#include E<lt>sys/socket.hE<gt>>"
5015 msgstr ""
5016
5017 #. type: Plain text
5018 #: build/C/man3/sockatmark.3:30
5019 msgid "B<int sockatmark(int >I<sockfd>B<);>"
5020 msgstr ""
5021
5022 #. type: Plain text
5023 #: build/C/man3/sockatmark.3:39
5024 msgid ""
5025 "B<sockatmark>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ "
5026 "E<gt>=\\ 600"
5027 msgstr ""
5028
5029 #. type: Plain text
5030 #: build/C/man3/sockatmark.3:49
5031 msgid ""
5032 "B<sockatmark>()  returns a value indicating whether or not the socket "
5033 "referred to by the file descriptor I<sockfd> is at the out-of-band mark.  If "
5034 "the socket is at the mark, then 1 is returned; if the socket is not at the "
5035 "mark, 0 is returned.  This function does not remove the out-of-band mark."
5036 msgstr ""
5037
5038 #. type: Plain text
5039 #: build/C/man3/sockatmark.3:54
5040 msgid ""
5041 "A successful call to B<sockatmark>()  returns 1 if the socket is at the "
5042 "out-of-band mark, or 0 if it is not.  On error, -1 is returned and I<errno> "
5043 "is set to indicate the error."
5044 msgstr ""
5045
5046 #. type: Plain text
5047 #: build/C/man3/sockatmark.3:59
5048 msgid "I<sockfd> is not a valid file descriptor."
5049 msgstr ""
5050
5051 #.  POSIX.1 says ENOTTY for this case
5052 #. type: Plain text
5053 #: build/C/man3/sockatmark.3:66
5054 msgid "I<sockfd> is not a file descriptor to which B<sockatmark>()  can be applied."
5055 msgstr ""
5056
5057 #. type: Plain text
5058 #: build/C/man3/sockatmark.3:69
5059 msgid "B<sockatmark>()  was added to glibc in version 2.2.4."
5060 msgstr ""
5061
5062 #. type: Plain text
5063 #: build/C/man3/sockatmark.3:71
5064 msgid "POSIX.1-2001."
5065 msgstr ""
5066
5067 #. type: Plain text
5068 #: build/C/man3/sockatmark.3:78
5069 msgid ""
5070 "If B<sockatmark>()  returns 1, then the out-of-band data can be read using "
5071 "the B<MSG_OOB> flag of B<recv>(2)."
5072 msgstr ""
5073
5074 #. type: Plain text
5075 #: build/C/man3/sockatmark.3:80
5076 msgid "Out-of-band data is only supported on some stream socket protocols."
5077 msgstr ""
5078
5079 #. type: Plain text
5080 #: build/C/man3/sockatmark.3:85
5081 msgid ""
5082 "B<sockatmark>()  can safely be called from a handler for the B<SIGURG> "
5083 "signal."
5084 msgstr ""
5085
5086 #. type: Plain text
5087 #: build/C/man3/sockatmark.3:91
5088 msgid ""
5089 "B<sockatmark>()  is implemented using the B<SIOCATMARK> B<ioctl>(2)  "
5090 "operation."
5091 msgstr ""
5092
5093 #. type: Plain text
5094 #: build/C/man3/sockatmark.3:95
5095 msgid "Prior to glibc 2.4, B<sockatmark>()  did not work."
5096 msgstr ""
5097
5098 #. type: Plain text
5099 #: build/C/man3/sockatmark.3:100
5100 msgid ""
5101 "The following code can be used after receipt of a B<SIGURG> signal to read "
5102 "(and discard) all data up to the mark, and then read the byte of data at the "
5103 "mark:"
5104 msgstr ""
5105
5106 #. type: Plain text
5107 #: build/C/man3/sockatmark.3:105
5108 #, no-wrap
5109 msgid ""
5110 "    char buf[BUF_LEN];\n"
5111 "    char oobdata;\n"
5112 "    int atmark, s;\n"
5113 msgstr ""
5114
5115 #. type: Plain text
5116 #: build/C/man3/sockatmark.3:112
5117 #, no-wrap
5118 msgid ""
5119 "    for (;;) {\n"
5120 "        atmark = sockatmark(sockfd);\n"
5121 "        if (atmark == -1) {\n"
5122 "            perror(\"sockatmark\");\n"
5123 "            break;\n"
5124 "        }\n"
5125 msgstr ""
5126
5127 #. type: Plain text
5128 #: build/C/man3/sockatmark.3:115
5129 #, no-wrap
5130 msgid ""
5131 "        if (atmark)\n"
5132 "            break;\n"
5133 msgstr ""
5134
5135 #. type: Plain text
5136 #: build/C/man3/sockatmark.3:122
5137 #, no-wrap
5138 msgid ""
5139 "        s = read(sockfd, buf, BUF_LEN) E<lt>= 0);\n"
5140 "        if (s == -1)\n"
5141 "            perror(\"read\");\n"
5142 "        if (s E<lt>= 0)\n"
5143 "            break;\n"
5144 "    }\n"
5145 msgstr ""
5146
5147 #. type: Plain text
5148 #: build/C/man3/sockatmark.3:129
5149 #, no-wrap
5150 msgid ""
5151 "    if (atmark == 1) {\n"
5152 "        if (recv(sockfd, &oobdata, 1, MSG_OOB) == -1) {\n"
5153 "            perror(\"recv\");\n"
5154 "            ...\n"
5155 "        }\n"
5156 "    }\n"
5157 msgstr ""
5158
5159 #. type: Plain text
5160 #: build/C/man3/sockatmark.3:134
5161 msgid "B<fcntl>(2), B<recv>(2), B<send>(2), B<tcp>(7)"
5162 msgstr ""
5163
5164 #. type: TH
5165 #: build/C/man2/socket.2:41 build/C/man7/socket.7:26
5166 #, no-wrap
5167 msgid "SOCKET"
5168 msgstr ""
5169
5170 #. type: TH
5171 #: build/C/man2/socket.2:41
5172 #, no-wrap
5173 msgid "2009-01-19"
5174 msgstr ""
5175
5176 #. type: Plain text
5177 #: build/C/man2/socket.2:44
5178 msgid "socket - create an endpoint for communication"
5179 msgstr ""
5180
5181 #. type: Plain text
5182 #: build/C/man2/socket.2:46 build/C/man2/socketpair.2:45
5183 msgid "B<#include E<lt>sys/types.hE<gt>> /* See NOTES */"
5184 msgstr ""
5185
5186 #. type: Plain text
5187 #: build/C/man2/socket.2:50
5188 msgid "B<int socket(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<);>"
5189 msgstr ""
5190
5191 #. type: Plain text
5192 #: build/C/man2/socket.2:53
5193 msgid "B<socket>()  creates an endpoint for communication and returns a descriptor."
5194 msgstr ""
5195
5196 #. type: Plain text
5197 #: build/C/man2/socket.2:61
5198 msgid ""
5199 "The I<domain> argument specifies a communication domain; this selects the "
5200 "protocol family which will be used for communication.  These families are "
5201 "defined in I<E<lt>sys/socket.hE<gt>>.  The currently understood formats "
5202 "include:"
5203 msgstr ""
5204
5205 #. type: tbl table
5206 #: build/C/man2/socket.2:64
5207 #, no-wrap
5208 msgid "Name:Purpose:Man page\n"
5209 msgstr ""
5210
5211 #. type: tbl table
5212 #: build/C/man2/socket.2:65 build/C/man2/socket.2:72 build/C/man2/socket.2:77 build/C/man2/socket.2:82 build/C/man2/socket.2:85 build/C/man2/socket.2:92 build/C/man2/socket.2:97 build/C/man2/socket.2:102 build/C/man2/socket.2:105 build/C/man2/socket.2:110
5213 #, no-wrap
5214 msgid "T{\n"
5215 msgstr ""
5216
5217 #. type: tbl table
5218 #: build/C/man2/socket.2:66
5219 #, no-wrap
5220 msgid "B<AF_UNIX>, B<AF_LOCAL>\n"
5221 msgstr ""
5222
5223 #. type: tbl table
5224 #: build/C/man2/socket.2:67 build/C/man2/socket.2:69 build/C/man2/socket.2:87 build/C/man2/socket.2:89 build/C/man2/socket.2:99 build/C/man2/socket.2:112 build/C/man2/socket.2:114 build/C/man7/socket.7:162
5225 #, no-wrap
5226 msgid "T}:T{\n"
5227 msgstr ""
5228
5229 #. type: tbl table
5230 #: build/C/man2/socket.2:68
5231 #, no-wrap
5232 msgid "Local communication\n"
5233 msgstr ""
5234
5235 #. type: tbl table
5236 #: build/C/man2/socket.2:70
5237 #, no-wrap
5238 msgid "B<unix>(7)\n"
5239 msgstr ""
5240
5241 #. type: tbl table
5242 #: build/C/man2/socket.2:71 build/C/man2/socket.2:76 build/C/man2/socket.2:81 build/C/man2/socket.2:91 build/C/man2/socket.2:96 build/C/man2/socket.2:109 build/C/man2/socket.2:116 build/C/man7/socket.7:141 build/C/man7/socket.7:145 build/C/man7/socket.7:148 build/C/man7/socket.7:154 build/C/man7/socket.7:157 build/C/man7/socket.7:166 build/C/man7/socket.7:173
5243 #, no-wrap
5244 msgid "T}\n"
5245 msgstr ""
5246
5247 #. type: tbl table
5248 #: build/C/man2/socket.2:73
5249 #, no-wrap
5250 msgid "B<AF_INET>\n"
5251 msgstr ""
5252
5253 #. type: tbl table
5254 #: build/C/man2/socket.2:74
5255 #, no-wrap
5256 msgid "T}:IPv4 Internet protocols:T{\n"
5257 msgstr ""
5258
5259 #. type: tbl table
5260 #: build/C/man2/socket.2:75
5261 #, no-wrap
5262 msgid "B<ip>(7)\n"
5263 msgstr ""
5264
5265 #. type: tbl table
5266 #: build/C/man2/socket.2:78
5267 #, no-wrap
5268 msgid "B<AF_INET6>\n"
5269 msgstr ""
5270
5271 #. type: tbl table
5272 #: build/C/man2/socket.2:79
5273 #, no-wrap
5274 msgid "T}:IPv6 Internet protocols:T{\n"
5275 msgstr ""
5276
5277 #. type: tbl table
5278 #: build/C/man2/socket.2:80
5279 #, no-wrap
5280 msgid "B<ipv6>(7)\n"
5281 msgstr ""
5282
5283 #. type: tbl table
5284 #: build/C/man2/socket.2:83
5285 #, no-wrap
5286 msgid "B<AF_IPX>\n"
5287 msgstr ""
5288
5289 #. type: tbl table
5290 #: build/C/man2/socket.2:84
5291 #, no-wrap
5292 msgid "T}:IPX - Novell protocols:\n"
5293 msgstr ""
5294
5295 #. type: tbl table
5296 #: build/C/man2/socket.2:86
5297 #, no-wrap
5298 msgid "B<AF_NETLINK>\n"
5299 msgstr ""
5300
5301 #. type: tbl table
5302 #: build/C/man2/socket.2:88
5303 #, no-wrap
5304 msgid "Kernel user interface device\n"
5305 msgstr ""
5306
5307 #. type: tbl table
5308 #: build/C/man2/socket.2:90
5309 #, no-wrap
5310 msgid "B<netlink>(7)\n"
5311 msgstr ""
5312
5313 #. type: tbl table
5314 #: build/C/man2/socket.2:93
5315 #, no-wrap
5316 msgid "B<AF_X25>\n"
5317 msgstr ""
5318
5319 #. type: tbl table
5320 #: build/C/man2/socket.2:94
5321 #, no-wrap
5322 msgid "T}:ITU-T X.25 / ISO-8208 protocol:T{\n"
5323 msgstr ""
5324
5325 #. type: tbl table
5326 #: build/C/man2/socket.2:95
5327 #, no-wrap
5328 msgid "B<x25>(7)\n"
5329 msgstr ""
5330
5331 #. type: tbl table
5332 #: build/C/man2/socket.2:98
5333 #, no-wrap
5334 msgid "B<AF_AX25>\n"
5335 msgstr ""
5336
5337 #. type: tbl table
5338 #: build/C/man2/socket.2:100
5339 #, no-wrap
5340 msgid "Amateur radio AX.25 protocol\n"
5341 msgstr ""
5342
5343 #. type: tbl table
5344 #: build/C/man2/socket.2:101
5345 #, no-wrap
5346 msgid "T}:\n"
5347 msgstr ""
5348
5349 #. type: tbl table
5350 #: build/C/man2/socket.2:103
5351 #, no-wrap
5352 msgid "B<AF_ATMPVC>\n"
5353 msgstr ""
5354
5355 #. type: tbl table
5356 #: build/C/man2/socket.2:104
5357 #, no-wrap
5358 msgid "T}:Access to raw ATM PVCs:\n"
5359 msgstr ""
5360
5361 #. type: tbl table
5362 #: build/C/man2/socket.2:106
5363 #, no-wrap
5364 msgid "B<AF_APPLETALK>\n"
5365 msgstr ""
5366
5367 #. type: tbl table
5368 #: build/C/man2/socket.2:107
5369 #, no-wrap
5370 msgid "T}:Appletalk:T{\n"
5371 msgstr ""
5372
5373 #. type: tbl table
5374 #: build/C/man2/socket.2:108
5375 #, no-wrap
5376 msgid "B<ddp>(7)\n"
5377 msgstr ""
5378
5379 #. type: tbl table
5380 #: build/C/man2/socket.2:111
5381 #, no-wrap
5382 msgid "B<AF_PACKET>\n"
5383 msgstr ""
5384
5385 #. type: tbl table
5386 #: build/C/man2/socket.2:113
5387 #, no-wrap
5388 msgid "Low level packet interface\n"
5389 msgstr ""
5390
5391 #. type: tbl table
5392 #: build/C/man2/socket.2:115
5393 #, no-wrap
5394 msgid "B<packet>(7)\n"
5395 msgstr ""
5396
5397 #. type: Plain text
5398 #: build/C/man2/socket.2:124
5399 msgid ""
5400 "The socket has the indicated I<type>, which specifies the communication "
5401 "semantics.  Currently defined types are:"
5402 msgstr ""
5403
5404 #. type: TP
5405 #: build/C/man2/socket.2:124
5406 #, no-wrap
5407 msgid "B<SOCK_STREAM>"
5408 msgstr ""
5409
5410 #. type: Plain text
5411 #: build/C/man2/socket.2:128
5412 msgid ""
5413 "Provides sequenced, reliable, two-way, connection-based byte streams.  An "
5414 "out-of-band data transmission mechanism may be supported."
5415 msgstr ""
5416
5417 #. type: TP
5418 #: build/C/man2/socket.2:128
5419 #, no-wrap
5420 msgid "B<SOCK_DGRAM>"
5421 msgstr ""
5422
5423 #. type: Plain text
5424 #: build/C/man2/socket.2:132
5425 msgid ""
5426 "Supports datagrams (connectionless, unreliable messages of a fixed maximum "
5427 "length)."
5428 msgstr ""
5429
5430 #. type: TP
5431 #: build/C/man2/socket.2:132
5432 #, no-wrap
5433 msgid "B<SOCK_SEQPACKET>"
5434 msgstr ""
5435
5436 #. type: Plain text
5437 #: build/C/man2/socket.2:137
5438 msgid ""
5439 "Provides a sequenced, reliable, two-way connection-based data transmission "
5440 "path for datagrams of fixed maximum length; a consumer is required to read "
5441 "an entire packet with each input system call."
5442 msgstr ""
5443
5444 #. type: TP
5445 #: build/C/man2/socket.2:137
5446 #, no-wrap
5447 msgid "B<SOCK_RAW>"
5448 msgstr ""
5449
5450 #. type: Plain text
5451 #: build/C/man2/socket.2:140
5452 msgid "Provides raw network protocol access."
5453 msgstr ""
5454
5455 #. type: TP
5456 #: build/C/man2/socket.2:140
5457 #, no-wrap
5458 msgid "B<SOCK_RDM>"
5459 msgstr ""
5460
5461 #. type: Plain text
5462 #: build/C/man2/socket.2:143
5463 msgid "Provides a reliable datagram layer that does not guarantee ordering."
5464 msgstr ""
5465
5466 #. type: TP
5467 #: build/C/man2/socket.2:143
5468 #, no-wrap
5469 msgid "B<SOCK_PACKET>"
5470 msgstr ""
5471
5472 #. type: Plain text
5473 #: build/C/man2/socket.2:148
5474 msgid "Obsolete and should not be used in new programs; see B<packet>(7)."
5475 msgstr ""
5476
5477 #. type: Plain text
5478 #: build/C/man2/socket.2:154
5479 msgid ""
5480 "Some socket types may not be implemented by all protocol families; for "
5481 "example, B<SOCK_SEQPACKET> is not implemented for B<AF_INET>."
5482 msgstr ""
5483
5484 #. type: Plain text
5485 #: build/C/man2/socket.2:162
5486 msgid ""
5487 "Since Linux 2.6.27, the I<type> argument serves a second purpose: in "
5488 "addition to specifying a socket type, it may include the bitwise OR of any "
5489 "of the following values, to modify the behavior of B<socket>():"
5490 msgstr ""
5491
5492 #. type: Plain text
5493 #: build/C/man2/socket.2:196
5494 msgid ""
5495 "The I<protocol> specifies a particular protocol to be used with the socket.  "
5496 "Normally only a single protocol exists to support a particular socket type "
5497 "within a given protocol family, in which case I<protocol> can be specified "
5498 "as 0.  However, it is possible that many protocols may exist, in which case "
5499 "a particular protocol must be specified in this manner.  The protocol number "
5500 "to use is specific to the ``communication domain'' in which communication is "
5501 "to take place; see B<protocols>(5).  See B<getprotoent>(3)  on how to map "
5502 "protocol name strings to protocol numbers."
5503 msgstr ""
5504
5505 #. type: Plain text
5506 #: build/C/man2/socket.2:226
5507 msgid ""
5508 "Sockets of type B<SOCK_STREAM> are full-duplex byte streams, similar to "
5509 "pipes.  They do not preserve record boundaries.  A stream socket must be in "
5510 "a I<connected> state before any data may be sent or received on it.  A "
5511 "connection to another socket is created with a B<connect>(2)  call.  Once "
5512 "connected, data may be transferred using B<read>(2)  and B<write>(2)  calls "
5513 "or some variant of the B<send>(2)  and B<recv>(2)  calls.  When a session "
5514 "has been completed a B<close>(2)  may be performed.  Out-of-band data may "
5515 "also be transmitted as described in B<send>(2)  and received as described in "
5516 "B<recv>(2)."
5517 msgstr ""
5518
5519 #. type: Plain text
5520 #: build/C/man2/socket.2:252
5521 msgid ""
5522 "The communications protocols which implement a B<SOCK_STREAM> ensure that "
5523 "data is not lost or duplicated.  If a piece of data for which the peer "
5524 "protocol has buffer space cannot be successfully transmitted within a "
5525 "reasonable length of time, then the connection is considered to be dead.  "
5526 "When B<SO_KEEPALIVE> is enabled on the socket the protocol checks in a "
5527 "protocol-specific manner if the other end is still alive.  A B<SIGPIPE> "
5528 "signal is raised if a process sends or receives on a broken stream; this "
5529 "causes naive processes, which do not handle the signal, to exit.  "
5530 "B<SOCK_SEQPACKET> sockets employ the same system calls as B<SOCK_STREAM> "
5531 "sockets.  The only difference is that B<read>(2)  calls will return only the "
5532 "amount of data requested, and any data remaining in the arriving packet will "
5533 "be discarded.  Also all message boundaries in incoming datagrams are "
5534 "preserved."
5535 msgstr ""
5536
5537 #. type: Plain text
5538 #: build/C/man2/socket.2:262
5539 msgid ""
5540 "B<SOCK_DGRAM> and B<SOCK_RAW> sockets allow sending of datagrams to "
5541 "correspondents named in B<sendto>(2)  calls.  Datagrams are generally "
5542 "received with B<recvfrom>(2), which returns the next datagram along with the "
5543 "address of its sender."
5544 msgstr ""
5545
5546 #. type: Plain text
5547 #: build/C/man2/socket.2:269
5548 msgid ""
5549 "B<SOCK_PACKET> is an obsolete socket type to receive raw packets directly "
5550 "from the device driver.  Use B<packet>(7)  instead."
5551 msgstr ""
5552
5553 #. type: Plain text
5554 #: build/C/man2/socket.2:292
5555 msgid ""
5556 "An B<fcntl>(2)  B<F_SETOWN> operation can be used to specify a process or "
5557 "process group to receive a B<SIGURG> signal when the out-of-band data "
5558 "arrives or B<SIGPIPE> signal when a B<SOCK_STREAM> connection breaks "
5559 "unexpectedly.  This operation may also be used to set the process or process "
5560 "group that receives the I/O and asynchronous notification of I/O events via "
5561 "B<SIGIO>.  Using B<F_SETOWN> is equivalent to an B<ioctl>(2)  call with the "
5562 "B<FIOSETOWN> or B<SIOCSPGRP> argument."
5563 msgstr ""
5564
5565 #. type: Plain text
5566 #: build/C/man2/socket.2:302
5567 msgid ""
5568 "When the network signals an error condition to the protocol module (e.g., "
5569 "using a ICMP message for IP) the pending error flag is set for the socket.  "
5570 "The next operation on this socket will return the error code of the pending "
5571 "error.  For some protocols it is possible to enable a per-socket error queue "
5572 "to retrieve detailed information about the error; see B<IP_RECVERR> in "
5573 "B<ip>(7)."
5574 msgstr ""
5575
5576 #. type: Plain text
5577 #: build/C/man2/socket.2:312
5578 msgid ""
5579 "The operation of sockets is controlled by socket level I<options>.  These "
5580 "options are defined in I<E<lt>sys/socket.hE<gt>>.  The functions "
5581 "B<setsockopt>(2)  and B<getsockopt>(2)  are used to set and get options, "
5582 "respectively."
5583 msgstr ""
5584
5585 #. type: Plain text
5586 #: build/C/man2/socket.2:317
5587 msgid ""
5588 "On success, a file descriptor for the new socket is returned.  On error, -1 "
5589 "is returned, and I<errno> is set appropriately."
5590 msgstr ""
5591
5592 #. type: Plain text
5593 #: build/C/man2/socket.2:322
5594 msgid ""
5595 "Permission to create a socket of the specified type and/or protocol is "
5596 "denied."
5597 msgstr ""
5598
5599 #. type: Plain text
5600 #: build/C/man2/socket.2:325
5601 msgid "The implementation does not support the specified address family."
5602 msgstr ""
5603
5604 #. type: Plain text
5605 #: build/C/man2/socket.2:328
5606 msgid "Unknown protocol, or protocol family not available."
5607 msgstr ""
5608
5609 #.  Since Linux 2.6.27
5610 #. type: Plain text
5611 #: build/C/man2/socket.2:333
5612 msgid "Invalid flags in I<type>."
5613 msgstr ""
5614
5615 #. type: Plain text
5616 #: build/C/man2/socket.2:336
5617 msgid "Process file table overflow."
5618 msgstr ""
5619
5620 #. type: TP
5621 #: build/C/man2/socket.2:339
5622 #, no-wrap
5623 msgid "B<ENOBUFS> or B<ENOMEM>"
5624 msgstr ""
5625
5626 #. type: Plain text
5627 #: build/C/man2/socket.2:344
5628 msgid ""
5629 "Insufficient memory is available.  The socket cannot be created until "
5630 "sufficient resources are freed."
5631 msgstr ""
5632
5633 #. type: TP
5634 #: build/C/man2/socket.2:344 build/C/man2/socketpair.2:90
5635 #, no-wrap
5636 msgid "B<EPROTONOSUPPORT>"
5637 msgstr ""
5638
5639 #. type: Plain text
5640 #: build/C/man2/socket.2:348
5641 msgid ""
5642 "The protocol type or the specified protocol is not supported within this "
5643 "domain."
5644 msgstr ""
5645
5646 #. type: Plain text
5647 #: build/C/man2/socket.2:350
5648 msgid "Other errors may be generated by the underlying protocol modules."
5649 msgstr ""
5650
5651 #. type: Plain text
5652 #: build/C/man2/socket.2:352
5653 msgid "4.4BSD, POSIX.1-2001."
5654 msgstr ""
5655
5656 #. type: Plain text
5657 #: build/C/man2/socket.2:358
5658 msgid "The B<SOCK_NONBLOCK> and B<SOCK_CLOEXEC> flags are Linux-specific."
5659 msgstr ""
5660
5661 #. type: Plain text
5662 #: build/C/man2/socket.2:364
5663 msgid ""
5664 "B<socket>()  appeared in 4.2BSD.  It is generally portable to/from non-BSD "
5665 "systems supporting clones of the BSD socket layer (including System V "
5666 "variants)."
5667 msgstr ""
5668
5669 #. type: Plain text
5670 #: build/C/man2/socket.2:382
5671 msgid ""
5672 "The manifest constants used under 4.x BSD for protocol families are "
5673 "B<PF_UNIX>, B<PF_INET>, etc., while B<AF_UNIX> etc. are used for address "
5674 "families.  However, already the BSD man page promises: \"The protocol family "
5675 "generally is the same as the address family\", and subsequent standards use "
5676 "AF_* everywhere."
5677 msgstr ""
5678
5679 #. type: Plain text
5680 #: build/C/man2/socket.2:387
5681 msgid "An example of the use of B<socket>()  is shown in B<getaddrinfo>(3)."
5682 msgstr ""
5683
5684 #. type: Plain text
5685 #: build/C/man2/socket.2:410
5686 msgid ""
5687 "B<accept>(2), B<bind>(2), B<connect>(2), B<fcntl>(2), B<getpeername>(2), "
5688 "B<getsockname>(2), B<getsockopt>(2), B<ioctl>(2), B<listen>(2), B<read>(2), "
5689 "B<recv>(2), B<select>(2), B<send>(2), B<shutdown>(2), B<socketpair>(2), "
5690 "B<write>(2), B<getprotoent>(3), B<ip>(7), B<socket>(7), B<tcp>(7), "
5691 "B<udp>(7), B<unix>(7)"
5692 msgstr ""
5693
5694 #. type: Plain text
5695 #: build/C/man2/socket.2:414
5696 msgid ""
5697 "\\(lqAn Introductory 4.3BSD Interprocess Communication Tutorial\\(rq is "
5698 "reprinted in I<UNIX Programmer's Supplementary Documents Volume 1.>"
5699 msgstr ""
5700
5701 #. type: Plain text
5702 #: build/C/man2/socket.2:417
5703 msgid ""
5704 "\\(lqBSD Interprocess Communication Tutorial\\(rq is reprinted in I<UNIX "
5705 "Programmer's Supplementary Documents Volume 1.>"
5706 msgstr ""
5707
5708 #. type: TH
5709 #: build/C/man7/socket.7:26
5710 #, no-wrap
5711 msgid "2010-06-13"
5712 msgstr ""
5713
5714 #. type: Plain text
5715 #: build/C/man7/socket.7:29
5716 msgid "socket - Linux socket interface"
5717 msgstr ""
5718
5719 #. type: Plain text
5720 #: build/C/man7/socket.7:33
5721 msgid ""
5722 "I<sockfd>B< = socket(int >I<socket_family>B<, int >I<socket_type>B<, int "
5723 ">I<protocol>B<);>"
5724 msgstr ""
5725
5726 #. type: Plain text
5727 #: build/C/man7/socket.7:52
5728 msgid ""
5729 "This manual page describes the Linux networking socket layer user "
5730 "interface.  The BSD compatible sockets are the uniform interface between the "
5731 "user process and the network protocol stacks in the kernel.  The protocol "
5732 "modules are grouped into I<protocol families> like B<AF_INET>, B<AF_IPX>, "
5733 "B<AF_PACKET> and I<socket types> like B<SOCK_STREAM> or B<SOCK_DGRAM>.  See "
5734 "B<socket>(2)  for more information on families and types."
5735 msgstr ""
5736
5737 #. type: SS
5738 #: build/C/man7/socket.7:52
5739 #, no-wrap
5740 msgid "Socket Layer Functions"
5741 msgstr ""
5742
5743 #. type: Plain text
5744 #: build/C/man7/socket.7:56
5745 msgid ""
5746 "These functions are used by the user process to send or receive packets and "
5747 "to do other socket operations.  For more information see their respective "
5748 "manual pages."
5749 msgstr ""
5750
5751 #. type: Plain text
5752 #: build/C/man7/socket.7:72
5753 msgid ""
5754 "B<socket>(2)  creates a socket, B<connect>(2)  connects a socket to a remote "
5755 "socket address, the B<bind>(2)  function binds a socket to a local socket "
5756 "address, B<listen>(2)  tells the socket that new connections shall be "
5757 "accepted, and B<accept>(2)  is used to get a new socket with a new incoming "
5758 "connection.  B<socketpair>(2)  returns two connected anonymous sockets (only "
5759 "implemented for a few local families like B<AF_UNIX>)"
5760 msgstr ""
5761
5762 #. type: Plain text
5763 #: build/C/man7/socket.7:94
5764 msgid ""
5765 "B<send>(2), B<sendto>(2), and B<sendmsg>(2)  send data over a socket, and "
5766 "B<recv>(2), B<recvfrom>(2), B<recvmsg>(2)  receive data from a socket.  "
5767 "B<poll>(2)  and B<select>(2)  wait for arriving data or a readiness to send "
5768 "data.  In addition, the standard I/O operations like B<write>(2), "
5769 "B<writev>(2), B<sendfile>(2), B<read>(2), and B<readv>(2)  can be used to "
5770 "read and write data."
5771 msgstr ""
5772
5773 #. type: Plain text
5774 #: build/C/man7/socket.7:105
5775 msgid ""
5776 "B<getsockname>(2)  returns the local socket address and B<getpeername>(2)  "
5777 "returns the remote socket address.  B<getsockopt>(2)  and B<setsockopt>(2)  "
5778 "are used to set or get socket layer or protocol options.  B<ioctl>(2)  can "
5779 "be used to set or read some other options."
5780 msgstr ""
5781
5782 #. type: Plain text
5783 #: build/C/man7/socket.7:110
5784 msgid ""
5785 "B<close>(2)  is used to close a socket.  B<shutdown>(2)  closes parts of a "
5786 "full-duplex socket connection."
5787 msgstr ""
5788
5789 #. type: Plain text
5790 #: build/C/man7/socket.7:116
5791 msgid ""
5792 "Seeking, or calling B<pread>(2)  or B<pwrite>(2)  with a nonzero position is "
5793 "not supported on sockets."
5794 msgstr ""
5795
5796 #. type: Plain text
5797 #: build/C/man7/socket.7:133
5798 msgid ""
5799 "It is possible to do nonblocking I/O on sockets by setting the B<O_NONBLOCK> "
5800 "flag on a socket file descriptor using B<fcntl>(2).  Then all operations "
5801 "that would block will (usually)  return with B<EAGAIN> (operation should be "
5802 "retried later); B<connect>(2)  will return B<EINPROGRESS> error.  The user "
5803 "can then wait for various events via B<poll>(2)  or B<select>(2)."
5804 msgstr ""
5805
5806 #. type: tbl table
5807 #: build/C/man7/socket.7:137
5808 #, no-wrap
5809 msgid "I/O events\n"
5810 msgstr ""
5811
5812 #. type: tbl table
5813 #: build/C/man7/socket.7:138
5814 #, no-wrap
5815 msgid "Event:Poll flag:Occurrence\n"
5816 msgstr ""
5817
5818 #. type: tbl table
5819 #: build/C/man7/socket.7:139 build/C/man7/socket.7:142
5820 #, no-wrap
5821 msgid "Read:POLLIN:T{\n"
5822 msgstr ""
5823
5824 #. type: tbl table
5825 #: build/C/man7/socket.7:140
5826 #, no-wrap
5827 msgid "New data arrived.\n"
5828 msgstr ""
5829
5830 #. type: tbl table
5831 #: build/C/man7/socket.7:143
5832 #, no-wrap
5833 msgid "A connection setup has been completed\n"
5834 msgstr ""
5835
5836 #. type: tbl table
5837 #: build/C/man7/socket.7:144
5838 #, no-wrap
5839 msgid "(for connection-oriented sockets)\n"
5840 msgstr ""
5841
5842 #. type: tbl table
5843 #: build/C/man7/socket.7:146 build/C/man7/socket.7:149
5844 #, no-wrap
5845 msgid "Read:POLLHUP:T{\n"
5846 msgstr ""
5847
5848 #. type: tbl table
5849 #: build/C/man7/socket.7:147
5850 #, no-wrap
5851 msgid "A disconnection request has been initiated by the other end.\n"
5852 msgstr ""
5853
5854 #. type: tbl table
5855 #: build/C/man7/socket.7:150
5856 #, no-wrap
5857 msgid "A connection is broken (only for connection-oriented protocols).\n"
5858 msgstr ""
5859
5860 #. type: tbl table
5861 #: build/C/man7/socket.7:151
5862 #, no-wrap
5863 msgid "When the socket is written\n"
5864 msgstr ""
5865
5866 #. type: tbl table
5867 #: build/C/man7/socket.7:152
5868 #, no-wrap
5869 msgid "B<SIGPIPE>\n"
5870 msgstr ""
5871
5872 #. type: tbl table
5873 #: build/C/man7/socket.7:153
5874 #, no-wrap
5875 msgid "is also sent.\n"
5876 msgstr ""
5877
5878 #. type: tbl table
5879 #: build/C/man7/socket.7:155
5880 #, no-wrap
5881 msgid "Write:POLLOUT:T{\n"
5882 msgstr ""
5883
5884 #. type: tbl table
5885 #: build/C/man7/socket.7:156
5886 #, no-wrap
5887 msgid "Socket has enough send buffer space for writing new data.\n"
5888 msgstr ""
5889
5890 #. type: tbl table
5891 #: build/C/man7/socket.7:158
5892 #, no-wrap
5893 msgid "Read/Write:T{\n"
5894 msgstr ""
5895
5896 #. type: tbl table
5897 #: build/C/man7/socket.7:159
5898 #, no-wrap
5899 msgid "POLLIN|\n"
5900 msgstr ""
5901
5902 #. type: tbl table
5903 #: build/C/man7/socket.7:160
5904 #, no-wrap
5905 msgid ".br\n"
5906 msgstr ""
5907
5908 #. type: tbl table
5909 #: build/C/man7/socket.7:161
5910 #, no-wrap
5911 msgid "POLLOUT\n"
5912 msgstr ""
5913
5914 #. type: tbl table
5915 #: build/C/man7/socket.7:163
5916 #, no-wrap
5917 msgid "An outgoing\n"
5918 msgstr ""
5919
5920 #. type: tbl table
5921 #: build/C/man7/socket.7:164
5922 #, no-wrap
5923 msgid "B<connect>(2)\n"
5924 msgstr ""
5925
5926 #. type: tbl table
5927 #: build/C/man7/socket.7:165
5928 #, no-wrap
5929 msgid "finished.\n"
5930 msgstr ""
5931
5932 #. type: tbl table
5933 #: build/C/man7/socket.7:167
5934 #, no-wrap
5935 msgid "Read/Write:POLLERR:An asynchronous error occurred.\n"
5936 msgstr ""
5937
5938 #. type: tbl table
5939 #: build/C/man7/socket.7:168
5940 #, no-wrap
5941 msgid "Read/Write:POLLHUP:The other end has shut down one direction.\n"
5942 msgstr ""
5943
5944 #. type: tbl table
5945 #: build/C/man7/socket.7:169
5946 #, no-wrap
5947 msgid "Exception:POLLPRI:T{\n"
5948 msgstr ""
5949
5950 #. type: tbl table
5951 #: build/C/man7/socket.7:170
5952 #, no-wrap
5953 msgid "Urgent data arrived.\n"
5954 msgstr ""
5955
5956 #. type: tbl table
5957 #: build/C/man7/socket.7:171
5958 #, no-wrap
5959 msgid "B<SIGURG>\n"
5960 msgstr ""
5961
5962 #. type: tbl table
5963 #: build/C/man7/socket.7:172
5964 #, no-wrap
5965 msgid "is sent then.\n"
5966 msgstr ""
5967
5968 #. type: Plain text
5969 #: build/C/man7/socket.7:202
5970 msgid ""
5971 "An alternative to B<poll>(2)  and B<select>(2)  is to let the kernel inform "
5972 "the application about events via a B<SIGIO> signal.  For that the B<O_ASYNC> "
5973 "flag must be set on a socket file descriptor via B<fcntl>(2)  and a valid "
5974 "signal handler for B<SIGIO> must be installed via B<sigaction>(2).  See the "
5975 "I<Signals> discussion below."
5976 msgstr ""
5977
5978 #. type: SS
5979 #: build/C/man7/socket.7:202
5980 #, no-wrap
5981 msgid "Socket Options"
5982 msgstr ""
5983
5984 #.  FIXME
5985 #.  In the list below, the text used to describe argument types
5986 #.  for each socket option should be more consistent
5987 #
5988 #.  SO_ACCEPTCONN is in POSIX.1-2001, and its origin is explained in
5989 #.  W R Stevens, UNPv1
5990 #. type: Plain text
5991 #: build/C/man7/socket.7:216
5992 msgid ""
5993 "These socket options can be set by using B<setsockopt>(2)  and read with "
5994 "B<getsockopt>(2)  with the socket level set to B<SOL_SOCKET> for all "
5995 "sockets:"
5996 msgstr ""
5997
5998 #. type: TP
5999 #: build/C/man7/socket.7:216
6000 #, no-wrap
6001 msgid "B<SO_ACCEPTCONN>"
6002 msgstr ""
6003
6004 #. type: Plain text
6005 #: build/C/man7/socket.7:224
6006 msgid ""
6007 "Returns a value indicating whether or not this socket has been marked to "
6008 "accept connections with B<listen>(2).  The value 0 indicates that this is "
6009 "not a listening socket, the value 1 indicates that this is a listening "
6010 "socket.  This socket option is read-only."
6011 msgstr ""
6012
6013 #. type: TP
6014 #: build/C/man7/socket.7:224
6015 #, no-wrap
6016 msgid "B<SO_BINDTODEVICE>"
6017 msgstr ""
6018
6019 #. type: Plain text
6020 #: build/C/man7/socket.7:243
6021 msgid ""
6022 "Bind this socket to a particular device like \\(lqeth0\\(rq, as specified in "
6023 "the passed interface name.  If the name is an empty string or the option "
6024 "length is zero, the socket device binding is removed.  The passed option is "
6025 "a variable-length null-terminated interface name string with the maximum "
6026 "size of B<IFNAMSIZ>.  If a socket is bound to an interface, only packets "
6027 "received from that particular interface are processed by the socket.  Note "
6028 "that this only works for some socket types, particularly B<AF_INET> "
6029 "sockets.  It is not supported for packet sockets (use normal B<bind>(2)  "
6030 "there)."
6031 msgstr ""
6032
6033 #. type: TP
6034 #: build/C/man7/socket.7:243
6035 #, no-wrap
6036 msgid "B<SO_BROADCAST>"
6037 msgstr ""
6038
6039 #. type: Plain text
6040 #: build/C/man7/socket.7:250
6041 msgid ""
6042 "Set or get the broadcast flag.  When enabled, datagram sockets receive "
6043 "packets sent to a broadcast address and they are allowed to send packets to "
6044 "a broadcast address.  This option has no effect on stream-oriented sockets."
6045 msgstr ""
6046
6047 #. type: TP
6048 #: build/C/man7/socket.7:250
6049 #, no-wrap
6050 msgid "B<SO_BSDCOMPAT>"
6051 msgstr ""
6052
6053 #. type: Plain text
6054 #: build/C/man7/socket.7:262
6055 msgid ""
6056 "Enable BSD bug-to-bug compatibility.  This is used by the UDP protocol "
6057 "module in Linux 2.0 and 2.2.  If enabled ICMP errors received for a UDP "
6058 "socket will not be passed to the user program.  In later kernel versions, "
6059 "support for this option has been phased out: Linux 2.4 silently ignores it, "
6060 "and Linux 2.6 generates a kernel warning (printk()) if a program uses this "
6061 "option.  Linux 2.0 also enabled BSD bug-to-bug compatibility options (random "
6062 "header changing, skipping of the broadcast flag) for raw sockets with this "
6063 "option, but that was removed in Linux 2.2."
6064 msgstr ""
6065
6066 #. type: TP
6067 #: build/C/man7/socket.7:262
6068 #, no-wrap
6069 msgid "B<SO_DEBUG>"
6070 msgstr ""
6071
6072 #. type: Plain text
6073 #: build/C/man7/socket.7:268
6074 msgid ""
6075 "Enable socket debugging.  Only allowed for processes with the "
6076 "B<CAP_NET_ADMIN> capability or an effective user ID of 0."
6077 msgstr ""
6078
6079 #. type: TP
6080 #: build/C/man7/socket.7:268
6081 #, no-wrap
6082 msgid "B<SO_DOMAIN> (since Linux 2.6.32)"
6083 msgstr ""
6084
6085 #. type: Plain text
6086 #: build/C/man7/socket.7:276
6087 msgid ""
6088 "Retrieves the socket domain as an integer, returning a value such as "
6089 "B<AF_INET6>.  See B<socket>(2)  for details.  This socket option is "
6090 "read-only."
6091 msgstr ""
6092
6093 #. type: TP
6094 #: build/C/man7/socket.7:276
6095 #, no-wrap
6096 msgid "B<SO_ERROR>"
6097 msgstr ""
6098
6099 #. type: Plain text
6100 #: build/C/man7/socket.7:281
6101 msgid ""
6102 "Get and clear the pending socket error.  This socket option is read-only.  "
6103 "Expects an integer."
6104 msgstr ""
6105
6106 #. type: TP
6107 #: build/C/man7/socket.7:281
6108 #, no-wrap
6109 msgid "B<SO_DONTROUTE>"
6110 msgstr ""
6111
6112 #. type: Plain text
6113 #: build/C/man7/socket.7:290
6114 msgid ""
6115 "Don't send via a gateway, only send to directly connected hosts.  The same "
6116 "effect can be achieved by setting the B<MSG_DONTROUTE> flag on a socket "
6117 "B<send>(2)  operation.  Expects an integer boolean flag."
6118 msgstr ""
6119
6120 #. type: TP
6121 #: build/C/man7/socket.7:290
6122 #, no-wrap
6123 msgid "B<SO_KEEPALIVE>"
6124 msgstr ""
6125
6126 #. type: Plain text
6127 #: build/C/man7/socket.7:294
6128 msgid ""
6129 "Enable sending of keep-alive messages on connection-oriented sockets.  "
6130 "Expects an integer boolean flag."
6131 msgstr ""
6132
6133 #. type: TP
6134 #: build/C/man7/socket.7:294
6135 #, no-wrap
6136 msgid "B<SO_LINGER>"
6137 msgstr ""
6138
6139 #. type: Plain text
6140 #: build/C/man7/socket.7:302
6141 msgid ""
6142 "Sets or gets the B<SO_LINGER> option.  The argument is a I<linger> "
6143 "structure."
6144 msgstr ""
6145
6146 #. type: Plain text
6147 #: build/C/man7/socket.7:309
6148 #, no-wrap
6149 msgid ""
6150 "struct linger {\n"
6151 "    int l_onoff;    /* linger active */\n"
6152 "    int l_linger;   /* how many seconds to linger for */\n"
6153 "};\n"
6154 msgstr ""
6155
6156 #. type: Plain text
6157 #: build/C/man7/socket.7:323
6158 msgid ""
6159 "When enabled, a B<close>(2)  or B<shutdown>(2)  will not return until all "
6160 "queued messages for the socket have been successfully sent or the linger "
6161 "timeout has been reached.  Otherwise, the call returns immediately and the "
6162 "closing is done in the background.  When the socket is closed as part of "
6163 "B<exit>(2), it always lingers in the background."
6164 msgstr ""
6165
6166 #. type: TP
6167 #: build/C/man7/socket.7:323
6168 #, no-wrap
6169 msgid "B<SO_OOBINLINE>"
6170 msgstr ""
6171
6172 #.  don't document it because it can do too much harm.
6173 #. .B SO_NO_CHECK
6174 #. type: Plain text
6175 #: build/C/man7/socket.7:332
6176 msgid ""
6177 "If this option is enabled, out-of-band data is directly placed into the "
6178 "receive data stream.  Otherwise out-of-band data is only passed when the "
6179 "B<MSG_OOB> flag is set during receiving."
6180 msgstr ""
6181
6182 #. type: TP
6183 #: build/C/man7/socket.7:332
6184 #, no-wrap
6185 msgid "B<SO_PASSCRED>"
6186 msgstr ""
6187
6188 #.  FIXME Document SO_PASSSEC, added in 2.6.18; there is some info
6189 #.  in the 2.6.18 ChangeLog
6190 #. type: Plain text
6191 #: build/C/man7/socket.7:341
6192 msgid ""
6193 "Enable or disable the receiving of the B<SCM_CREDENTIALS> control message.  "
6194 "For more information see B<unix>(7)."
6195 msgstr ""
6196
6197 #. type: TP
6198 #: build/C/man7/socket.7:341
6199 #, no-wrap
6200 msgid "B<SO_PEERCRED>"
6201 msgstr ""
6202
6203 #. type: Plain text
6204 #: build/C/man7/socket.7:361
6205 msgid ""
6206 "Return the credentials of the foreign process connected to this socket.  "
6207 "This is only possible for connected B<AF_UNIX> stream sockets and B<AF_UNIX> "
6208 "stream and datagram socket pairs created using B<socketpair>(2); see "
6209 "B<unix>(7).  The returned credentials are those that were in effect at the "
6210 "time of the call to B<connect>(2)  or B<socketpair>(2).  Argument is a "
6211 "I<ucred> structure.  This socket option is read-only."
6212 msgstr ""
6213
6214 #. type: TP
6215 #: build/C/man7/socket.7:361
6216 #, no-wrap
6217 msgid "B<SO_PRIORITY>"
6218 msgstr ""
6219
6220 #. type: Plain text
6221 #: build/C/man7/socket.7:374
6222 msgid ""
6223 "Set the protocol-defined priority for all packets to be sent on this "
6224 "socket.  Linux uses this value to order the networking queues: packets with "
6225 "a higher priority may be processed first depending on the selected device "
6226 "queueing discipline.  For B<ip>(7), this also sets the IP type-of-service "
6227 "(TOS) field for outgoing packets.  Setting a priority outside the range 0 to "
6228 "6 requires the B<CAP_NET_ADMIN> capability."
6229 msgstr ""
6230
6231 #. type: TP
6232 #: build/C/man7/socket.7:374
6233 #, no-wrap
6234 msgid "B<SO_PROTOCOL> (since Linux 2.6.32)"
6235 msgstr ""
6236
6237 #. type: Plain text
6238 #: build/C/man7/socket.7:382
6239 msgid ""
6240 "Retrieves the socket protocol as an integer, returning a value such as "
6241 "B<IPPROTO_SCTP>.  See B<socket>(2)  for details.  This socket option is "
6242 "read-only."
6243 msgstr ""
6244
6245 #. type: TP
6246 #: build/C/man7/socket.7:382
6247 #, no-wrap
6248 msgid "B<SO_RCVBUF>"
6249 msgstr ""
6250
6251 #.  Most (all?) other implementations do not do this -- MTK, Dec 05
6252 #. type: Plain text
6253 #: build/C/man7/socket.7:397
6254 msgid ""
6255 "Sets or gets the maximum socket receive buffer in bytes.  The kernel doubles "
6256 "this value (to allow space for bookkeeping overhead)  when it is set using "
6257 "B<setsockopt>(2), and this doubled value is returned by B<getsockopt>(2).  "
6258 "The default value is set by the I</proc/sys/net/core/rmem_default> file, and "
6259 "the maximum allowed value is set by the I</proc/sys/net/core/rmem_max> "
6260 "file.  The minimum (doubled) value for this option is 256."
6261 msgstr ""
6262
6263 #. type: TP
6264 #: build/C/man7/socket.7:397
6265 #, no-wrap
6266 msgid "B<SO_RCVBUFFORCE> (since Linux 2.6.14)"
6267 msgstr ""
6268
6269 #. type: Plain text
6270 #: build/C/man7/socket.7:406
6271 msgid ""
6272 "Using this socket option, a privileged (B<CAP_NET_ADMIN>)  process can "
6273 "perform the same task as B<SO_RCVBUF>, but the I<rmem_max> limit can be "
6274 "overridden."
6275 msgstr ""
6276
6277 #. type: TP
6278 #: build/C/man7/socket.7:406
6279 #, no-wrap
6280 msgid "B<SO_RCVLOWAT> and B<SO_SNDLOWAT>"
6281 msgstr ""
6282
6283 #.  See http://marc.theaimsgroup.com/?l=linux-kernel&m=111049368106984&w=2
6284 #.  Tested on kernel 2.6.14 -- mtk, 30 Nov 05
6285 #. type: Plain text
6286 #: build/C/man7/socket.7:435
6287 msgid ""
6288 "Specify the minimum number of bytes in the buffer until the socket layer "
6289 "will pass the data to the protocol (B<SO_SNDLOWAT>)  or the user on "
6290 "receiving (B<SO_RCVLOWAT>).  These two values are initialized to 1.  "
6291 "B<SO_SNDLOWAT> is not changeable on Linux (B<setsockopt>(2)  fails with the "
6292 "error B<ENOPROTOOPT>).  B<SO_RCVLOWAT> is changeable only since Linux 2.4.  "
6293 "The B<select>(2)  and B<poll>(2)  system calls currently do not respect the "
6294 "B<SO_RCVLOWAT> setting on Linux, and mark a socket readable when even a "
6295 "single byte of data is available.  A subsequent read from the socket will "
6296 "block until B<SO_RCVLOWAT> bytes are available."
6297 msgstr ""
6298
6299 #. type: TP
6300 #: build/C/man7/socket.7:435
6301 #, no-wrap
6302 msgid "B<SO_RCVTIMEO> and B<SO_SNDTIMEO>"
6303 msgstr ""
6304
6305 #.  Not implemented in 2.0.
6306 #.  Implemented in 2.1.11 for getsockopt: always return a zero struct.
6307 #.  Implemented in 2.3.41 for setsockopt, and actually used.
6308 #.  in fact to EAGAIN
6309 #. type: Plain text
6310 #: build/C/man7/socket.7:466
6311 msgid ""
6312 "Specify the receiving or sending timeouts until reporting an error.  The "
6313 "argument is a I<struct timeval>.  If an input or output function blocks for "
6314 "this period of time, and data has been sent or received, the return value of "
6315 "that function will be the amount of data transferred; if no data has been "
6316 "transferred and the timeout has been reached then -1 is returned with "
6317 "I<errno> set to B<EAGAIN> or B<EWOULDBLOCK> just as if the socket was "
6318 "specified to be nonblocking.  If the timeout is set to zero (the default)  "
6319 "then the operation will never timeout.  Timeouts only have effect for system "
6320 "calls that perform socket I/O (e.g., B<read>(2), B<recvmsg>(2), B<send>(2), "
6321 "B<sendmsg>(2)); timeouts have no effect for B<select>(2), B<poll>(2), "
6322 "B<epoll_wait>(2), etc."
6323 msgstr ""
6324
6325 #. type: TP
6326 #: build/C/man7/socket.7:466
6327 #, no-wrap
6328 msgid "B<SO_REUSEADDR>"
6329 msgstr ""
6330
6331 #. type: Plain text
6332 #: build/C/man7/socket.7:481
6333 msgid ""
6334 "Indicates that the rules used in validating addresses supplied in a "
6335 "B<bind>(2)  call should allow reuse of local addresses.  For B<AF_INET> "
6336 "sockets this means that a socket may bind, except when there is an active "
6337 "listening socket bound to the address.  When the listening socket is bound "
6338 "to B<INADDR_ANY> with a specific port then it is not possible to bind to "
6339 "this port for any local address.  Argument is an integer boolean flag."
6340 msgstr ""
6341
6342 #. type: TP
6343 #: build/C/man7/socket.7:481
6344 #, no-wrap
6345 msgid "B<SO_SNDBUF>"
6346 msgstr ""
6347
6348 #.  Most (all?) other implementations do not do this -- MTK, Dec 05
6349 #. type: Plain text
6350 #: build/C/man7/socket.7:496
6351 msgid ""
6352 "Sets or gets the maximum socket send buffer in bytes.  The kernel doubles "
6353 "this value (to allow space for bookkeeping overhead)  when it is set using "
6354 "B<setsockopt>(2), and this doubled value is returned by B<getsockopt>(2).  "
6355 "The default value is set by the I</proc/sys/net/core/wmem_default> file and "
6356 "the maximum allowed value is set by the I</proc/sys/net/core/wmem_max> "
6357 "file.  The minimum (doubled) value for this option is 2048."
6358 msgstr ""
6359
6360 #. type: TP
6361 #: build/C/man7/socket.7:496
6362 #, no-wrap
6363 msgid "B<SO_SNDBUFFORCE> (since Linux 2.6.14)"
6364 msgstr ""
6365
6366 #. type: Plain text
6367 #: build/C/man7/socket.7:505
6368 msgid ""
6369 "Using this socket option, a privileged (B<CAP_NET_ADMIN>)  process can "
6370 "perform the same task as B<SO_SNDBUF>, but the I<wmem_max> limit can be "
6371 "overridden."
6372 msgstr ""
6373
6374 #. type: TP
6375 #: build/C/man7/socket.7:505
6376 #, no-wrap
6377 msgid "B<SO_TIMESTAMP>"
6378 msgstr ""
6379
6380 #. type: Plain text
6381 #: build/C/man7/socket.7:521
6382 msgid ""
6383 "Enable or disable the receiving of the B<SO_TIMESTAMP> control message.  The "
6384 "timestamp control message is sent with level B<SOL_SOCKET> and the "
6385 "I<cmsg_data> field is a I<struct timeval> indicating the reception time of "
6386 "the last packet passed to the user in this call.  See B<cmsg>(3)  for "
6387 "details on control messages."
6388 msgstr ""
6389
6390 #. type: TP
6391 #: build/C/man7/socket.7:521
6392 #, no-wrap
6393 msgid "B<SO_TYPE>"
6394 msgstr ""
6395
6396 #. type: Plain text
6397 #: build/C/man7/socket.7:526
6398 msgid ""
6399 "Gets the socket type as an integer (e.g., B<SOCK_STREAM>).  This socket "
6400 "option is read-only."
6401 msgstr ""
6402
6403 #. type: SS
6404 #: build/C/man7/socket.7:526
6405 #, no-wrap
6406 msgid "Signals"
6407 msgstr ""
6408
6409 #. type: Plain text
6410 #: build/C/man7/socket.7:537
6411 msgid ""
6412 "When writing onto a connection-oriented socket that has been shut down (by "
6413 "the local or the remote end)  B<SIGPIPE> is sent to the writing process and "
6414 "B<EPIPE> is returned.  The signal is not sent when the write call specified "
6415 "the B<MSG_NOSIGNAL> flag."
6416 msgstr ""
6417
6418 #. type: Plain text
6419 #: build/C/man7/socket.7:562
6420 msgid ""
6421 "When requested with the B<FIOSETOWN> B<fcntl>(2)  or B<SIOCSPGRP> "
6422 "B<ioctl>(2), B<SIGIO> is sent when an I/O event occurs.  It is possible to "
6423 "use B<poll>(2)  or B<select>(2)  in the signal handler to find out which "
6424 "socket the event occurred on.  An alternative (in Linux 2.2) is to set a "
6425 "real-time signal using the B<F_SETSIG> B<fcntl>(2); the handler of the real "
6426 "time signal will be called with the file descriptor in the I<si_fd> field of "
6427 "its I<siginfo_t>.  See B<fcntl>(2)  for more information."
6428 msgstr ""
6429
6430 #.  .SS Ancillary Messages
6431 #. type: Plain text
6432 #: build/C/man7/socket.7:570
6433 msgid ""
6434 "Under some circumstances (e.g., multiple processes accessing a single "
6435 "socket), the condition that caused the B<SIGIO> may have already disappeared "
6436 "when the process reacts to the signal.  If this happens, the process should "
6437 "wait again because Linux will resend the signal later."
6438 msgstr ""
6439
6440 #. type: SS
6441 #: build/C/man7/socket.7:570
6442 #, no-wrap
6443 msgid "/proc interfaces"
6444 msgstr ""
6445
6446 #. type: Plain text
6447 #: build/C/man7/socket.7:574
6448 msgid ""
6449 "The core socket networking parameters can be accessed via files in the "
6450 "directory I</proc/sys/net/core/>."
6451 msgstr ""
6452
6453 #. type: TP
6454 #: build/C/man7/socket.7:574
6455 #, no-wrap
6456 msgid "I<rmem_default>"
6457 msgstr ""
6458
6459 #. type: Plain text
6460 #: build/C/man7/socket.7:577
6461 msgid "contains the default setting in bytes of the socket receive buffer."
6462 msgstr ""
6463
6464 #. type: TP
6465 #: build/C/man7/socket.7:577
6466 #, no-wrap
6467 msgid "I<rmem_max>"
6468 msgstr ""
6469
6470 #. type: Plain text
6471 #: build/C/man7/socket.7:583
6472 msgid ""
6473 "contains the maximum socket receive buffer size in bytes which a user may "
6474 "set by using the B<SO_RCVBUF> socket option."
6475 msgstr ""
6476
6477 #. type: TP
6478 #: build/C/man7/socket.7:583
6479 #, no-wrap
6480 msgid "I<wmem_default>"
6481 msgstr ""
6482
6483 #. type: Plain text
6484 #: build/C/man7/socket.7:586
6485 msgid "contains the default setting in bytes of the socket send buffer."
6486 msgstr ""
6487
6488 #. type: TP
6489 #: build/C/man7/socket.7:586
6490 #, no-wrap
6491 msgid "I<wmem_max>"
6492 msgstr ""
6493
6494 #. type: Plain text
6495 #: build/C/man7/socket.7:592
6496 msgid ""
6497 "contains the maximum socket send buffer size in bytes which a user may set "
6498 "by using the B<SO_SNDBUF> socket option."
6499 msgstr ""
6500
6501 #. type: TP
6502 #: build/C/man7/socket.7:592
6503 #, no-wrap
6504 msgid "I<message_cost> and I<message_burst>"
6505 msgstr ""
6506
6507 #. type: Plain text
6508 #: build/C/man7/socket.7:596
6509 msgid ""
6510 "configure the token bucket filter used to load limit warning messages caused "
6511 "by external network events."
6512 msgstr ""
6513
6514 #. type: TP
6515 #: build/C/man7/socket.7:596
6516 #, no-wrap
6517 msgid "I<netdev_max_backlog>"
6518 msgstr ""
6519
6520 #. type: Plain text
6521 #: build/C/man7/socket.7:599
6522 msgid "Maximum number of packets in the global input queue."
6523 msgstr ""
6524
6525 #. type: TP
6526 #: build/C/man7/socket.7:599
6527 #, no-wrap
6528 msgid "I<optmem_max>"
6529 msgstr ""
6530
6531 #.  netdev_fastroute is not documented because it is experimental
6532 #. type: Plain text
6533 #: build/C/man7/socket.7:604
6534 msgid ""
6535 "Maximum length of ancillary data and user control data like the iovecs per "
6536 "socket."
6537 msgstr ""
6538
6539 #. type: SS
6540 #: build/C/man7/socket.7:604
6541 #, no-wrap
6542 msgid "Ioctls"
6543 msgstr ""
6544
6545 #. type: Plain text
6546 #: build/C/man7/socket.7:607
6547 msgid "These operations can be accessed using B<ioctl>(2):"
6548 msgstr ""
6549
6550 #. type: Plain text
6551 #: build/C/man7/socket.7:611
6552 #, no-wrap
6553 msgid ""
6554 "I<error>B< = ioctl(>I<ip_socket>B<, >I<ioctl_type>B<, "
6555 ">I<&value_result>B<);>\n"
6556 msgstr ""
6557
6558 #. type: TP
6559 #: build/C/man7/socket.7:613
6560 #, no-wrap
6561 msgid "B<SIOCGSTAMP>"
6562 msgstr ""
6563
6564 #. type: Plain text
6565 #: build/C/man7/socket.7:637
6566 msgid ""
6567 "Return a I<struct timeval> with the receive timestamp of the last packet "
6568 "passed to the user.  This is useful for accurate round trip time "
6569 "measurements.  See B<setitimer>(2)  for a description of I<struct timeval>.  "
6570 "This ioctl should only be used if the socket option B<SO_TIMESTAMP> is not "
6571 "set on the socket.  Otherwise, it returns the timestamp of the last packet "
6572 "that was received while B<SO_TIMESTAMP> was not set, or it fails if no such "
6573 "packet has been received, (i.e., B<ioctl>(2)  returns -1 with I<errno> set "
6574 "to B<ENOENT>)."
6575 msgstr ""
6576
6577 #. type: TP
6578 #: build/C/man7/socket.7:637
6579 #, no-wrap
6580 msgid "B<SIOCSPGRP>"
6581 msgstr ""
6582
6583 #. type: Plain text
6584 #: build/C/man7/socket.7:656
6585 msgid ""
6586 "Set the process or process group to send B<SIGIO> or B<SIGURG> signals to "
6587 "when an asynchronous I/O operation has finished or urgent data is "
6588 "available.  The argument is a pointer to a I<pid_t>.  If the argument is "
6589 "positive, send the signals to that process.  If the argument is negative, "
6590 "send the signals to the process group with the ID of the absolute value of "
6591 "the argument.  The process may only choose itself or its own process group "
6592 "to receive signals unless it has the B<CAP_KILL> capability or an effective "
6593 "UID of 0."
6594 msgstr ""
6595
6596 #. type: TP
6597 #: build/C/man7/socket.7:656
6598 #, no-wrap
6599 msgid "B<FIOASYNC>"
6600 msgstr ""
6601
6602 #. type: Plain text
6603 #: build/C/man7/socket.7:666
6604 msgid ""
6605 "Change the B<O_ASYNC> flag to enable or disable asynchronous I/O mode of the "
6606 "socket.  Asynchronous I/O mode means that the B<SIGIO> signal or the signal "
6607 "set with B<F_SETSIG> is raised when a new I/O event occurs."
6608 msgstr ""
6609
6610 #. type: Plain text
6611 #: build/C/man7/socket.7:674
6612 msgid ""
6613 "Argument is an integer boolean flag.  (This operation is synonymous with the "
6614 "use of B<fcntl>(2)  to set the B<O_ASYNC> flag.)"
6615 msgstr ""
6616
6617 #. type: TP
6618 #: build/C/man7/socket.7:674
6619 #, no-wrap
6620 msgid "B<SIOCGPGRP>"
6621 msgstr ""
6622
6623 #. type: Plain text
6624 #: build/C/man7/socket.7:683
6625 msgid ""
6626 "Get the current process or process group that receives B<SIGIO> or B<SIGURG> "
6627 "signals, or 0 when none is set."
6628 msgstr ""
6629
6630 #. type: Plain text
6631 #: build/C/man7/socket.7:687
6632 msgid "Valid B<fcntl>(2)  operations:"
6633 msgstr ""
6634
6635 #. type: TP
6636 #: build/C/man7/socket.7:687
6637 #, no-wrap
6638 msgid "B<FIOGETOWN>"
6639 msgstr ""
6640
6641 #. type: Plain text
6642 #: build/C/man7/socket.7:692
6643 msgid "The same as the B<SIOCGPGRP> B<ioctl>(2)."
6644 msgstr ""
6645
6646 #. type: TP
6647 #: build/C/man7/socket.7:692
6648 #, no-wrap
6649 msgid "B<FIOSETOWN>"
6650 msgstr ""
6651
6652 #. type: Plain text
6653 #: build/C/man7/socket.7:697
6654 msgid "The same as the B<SIOCSPGRP> B<ioctl>(2)."
6655 msgstr ""
6656
6657 #. type: Plain text
6658 #: build/C/man7/socket.7:711
6659 msgid ""
6660 "B<SO_BINDTODEVICE> was introduced in Linux 2.0.30.  B<SO_PASSCRED> is new in "
6661 "Linux 2.2.  The I</proc> interfaces was introduced in Linux 2.2.  "
6662 "B<SO_RCVTIMEO> and B<SO_SNDTIMEO> are supported since Linux 2.3.41.  "
6663 "Earlier, timeouts were fixed to a protocol-specific setting, and could not "
6664 "be read or written."
6665 msgstr ""
6666
6667 #. type: Plain text
6668 #: build/C/man7/socket.7:716
6669 msgid ""
6670 "Linux assumes that half of the send/receive buffer is used for internal "
6671 "kernel structures; thus the values in the corresponding I</proc> files are "
6672 "twice what can be observed on the wire."
6673 msgstr ""
6674
6675 #. type: Plain text
6676 #: build/C/man7/socket.7:729
6677 msgid ""
6678 "Linux will only allow port reuse with the B<SO_REUSEADDR> option when this "
6679 "option was set both in the previous program that performed a B<bind>(2)  to "
6680 "the port and in the program that wants to reuse the port.  This differs from "
6681 "some implementations (e.g., FreeBSD)  where only the later program needs to "
6682 "set the B<SO_REUSEADDR> option.  Typically this difference is invisible, "
6683 "since, for example, a server program is designed to always set this option."
6684 msgstr ""
6685
6686 #.  FIXME Document SO_ATTACH_FILTER and SO_DETACH_FILTER
6687 #.  .SH AUTHORS
6688 #.  This man page was written by Andi Kleen.
6689 #. type: Plain text
6690 #: build/C/man7/socket.7:742
6691 msgid ""
6692 "The B<CONFIG_FILTER> socket options B<SO_ATTACH_FILTER> and "
6693 "B<SO_DETACH_FILTER> are not documented.  The suggested interface to use them "
6694 "is via the libpcap library."
6695 msgstr ""
6696
6697 #. type: Plain text
6698 #: build/C/man7/socket.7:752
6699 msgid ""
6700 "B<getsockopt>(2), B<setsockopt>(2), B<socket>(2), B<capabilities>(7), "
6701 "B<ddp>(7), B<ip>(7), B<packet>(7), B<tcp>(7), B<udp>(7), B<unix>(7)"
6702 msgstr ""
6703
6704 #. type: TH
6705 #: build/C/man2/socketcall.2:26
6706 #, no-wrap
6707 msgid "SOCKETCALL"
6708 msgstr ""
6709
6710 #. type: TH
6711 #: build/C/man2/socketcall.2:26
6712 #, no-wrap
6713 msgid "2007-06-28"
6714 msgstr ""
6715
6716 #. type: Plain text
6717 #: build/C/man2/socketcall.2:29
6718 msgid "socketcall - socket system calls"
6719 msgstr ""
6720
6721 #. type: Plain text
6722 #: build/C/man2/socketcall.2:31
6723 msgid "B<int socketcall(int >I<call>B<, unsigned long *>I<args>B<);>"
6724 msgstr ""
6725
6726 #. type: Plain text
6727 #: build/C/man2/socketcall.2:39
6728 msgid ""
6729 "B<socketcall>()  is a common kernel entry point for the socket system "
6730 "calls.  I<call> determines which socket function to invoke.  I<args> points "
6731 "to a block containing the actual arguments, which are passed through to the "
6732 "appropriate call."
6733 msgstr ""
6734
6735 #. type: Plain text
6736 #: build/C/man2/socketcall.2:43
6737 msgid ""
6738 "User programs should call the appropriate functions by their usual names.  "
6739 "Only standard library implementors and kernel hackers need to know about "
6740 "B<socketcall>()."
6741 msgstr ""
6742
6743 #. type: Plain text
6744 #: build/C/man2/socketcall.2:46
6745 msgid ""
6746 "This call is specific to Linux, and should not be used in programs intended "
6747 "to be portable."
6748 msgstr ""
6749
6750 #. type: Plain text
6751 #: build/C/man2/socketcall.2:54
6752 msgid ""
6753 "On a few architectures, for example ia64, there is no B<socketcall>()  "
6754 "system call; instead B<socket>(2), B<accept>(2), B<bind>(2), and so on "
6755 "really are implemented as separate system calls."
6756 msgstr ""
6757
6758 #. type: Plain text
6759 #: build/C/man2/socketcall.2:71
6760 msgid ""
6761 "B<accept>(2), B<bind>(2), B<connect>(2), B<getpeername>(2), "
6762 "B<getsockname>(2), B<getsockopt>(2), B<listen>(2), B<recv>(2), "
6763 "B<recvfrom>(2), B<recvmsg>(2), B<send>(2), B<sendmsg>(2), B<sendto>(2), "
6764 "B<setsockopt>(2), B<shutdown>(2), B<socket>(2), B<socketpair>(2)"
6765 msgstr ""
6766
6767 #. type: TH
6768 #: build/C/man2/socketpair.2:40
6769 #, no-wrap
6770 msgid "SOCKETPAIR"
6771 msgstr ""
6772
6773 #. type: TH
6774 #: build/C/man2/socketpair.2:40
6775 #, no-wrap
6776 msgid "2008-10-11"
6777 msgstr ""
6778
6779 #. type: Plain text
6780 #: build/C/man2/socketpair.2:43
6781 msgid "socketpair - create a pair of connected sockets"
6782 msgstr ""
6783
6784 #. type: Plain text
6785 #: build/C/man2/socketpair.2:50
6786 msgid ""
6787 "B<int socketpair(int >I<domain>B<, int >I<type>B<, int >I<protocol>B<, int "
6788 ">I<sv>B<[2]);>"
6789 msgstr ""
6790
6791 #. type: Plain text
6792 #: build/C/man2/socketpair.2:61
6793 msgid ""
6794 "The B<socketpair>()  call creates an unnamed pair of connected sockets in "
6795 "the specified I<domain>, of the specified I<type>, and using the optionally "
6796 "specified I<protocol>.  For further details of these arguments, see "
6797 "B<socket>(2)."
6798 msgstr ""
6799
6800 #. type: Plain text
6801 #: build/C/man2/socketpair.2:67
6802 msgid ""
6803 "The descriptors used in referencing the new sockets are returned in I<sv>[0] "
6804 "and I<sv>[1].  The two sockets are indistinguishable."
6805 msgstr ""
6806
6807 #. type: Plain text
6808 #: build/C/man2/socketpair.2:76
6809 msgid "The specified address family is not supported on this machine."
6810 msgstr ""
6811
6812 #. type: Plain text
6813 #: build/C/man2/socketpair.2:81
6814 msgid ""
6815 "The address I<sv> does not specify a valid part of the process address "
6816 "space."
6817 msgstr ""
6818
6819 #. type: Plain text
6820 #: build/C/man2/socketpair.2:84
6821 msgid "Too many descriptors are in use by this process."
6822 msgstr ""
6823
6824 #. type: Plain text
6825 #: build/C/man2/socketpair.2:90
6826 msgid "The specified protocol does not support creation of socket pairs."
6827 msgstr ""
6828
6829 #. type: Plain text
6830 #: build/C/man2/socketpair.2:93
6831 msgid "The specified protocol is not supported on this machine."
6832 msgstr ""
6833
6834 #. type: Plain text
6835 #: build/C/man2/socketpair.2:101
6836 msgid ""
6837 "4.4BSD, POSIX.1-2001.  The B<socketpair>()  function call appeared in "
6838 "4.2BSD.  It is generally portable to/from non-BSD systems supporting clones "
6839 "of the BSD socket layer (including System V variants)."
6840 msgstr ""
6841
6842 #. type: Plain text
6843 #: build/C/man2/socketpair.2:107
6844 msgid ""
6845 "On Linux, the only supported domain for this call is B<AF_UNIX> (or "
6846 "synonymously, B<AF_LOCAL>).  (Most implementations have the same "
6847 "restriction.)"
6848 msgstr ""
6849
6850 #. type: Plain text
6851 #: build/C/man2/socketpair.2:116
6852 msgid ""
6853 "Since Linux 2.6.27, B<socketpair>()  supports the B<SOCK_NONBLOCK> and "
6854 "B<SOCK_CLOEXEC> flags described in B<socket>(2)."
6855 msgstr ""
6856
6857 #. type: Plain text
6858 #: build/C/man2/socketpair.2:128
6859 msgid "B<pipe>(2), B<read>(2), B<socket>(2), B<write>(2), B<socket>(7), B<unix>(7)"
6860 msgstr ""