Debian Codegraph @

templates/man2/bind.2.pot

raw
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: 2026-06-05 06:19+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "bind"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "bind - bind a name to a socket"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Standard C library (I<libc>,\\ I<-lc>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>sys/socket.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<int bind(int >I<sockfd>B<, const struct sockaddr *>I<addr>B<,>\n"
85 "B< socklen_t >I<addrlen>B<);>\n"
86 msgstr ""
87
88 #. type: SH
89 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
90 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
91 #, no-wrap
92 msgid "DESCRIPTION"
93 msgstr ""
94
95 #. type: Plain text
96 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
97 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
98 msgid ""
99 "When a socket is created with B<socket>(2), it exists in a name space "
100 "(address family) but has no address assigned to it. B<bind>() assigns the "
101 "address specified by I<addr> to the socket referred to by the file "
102 "descriptor I<sockfd>. I<addrlen> specifies the size, in bytes, of the "
103 "address structure pointed to by I<addr>. Traditionally, this operation is "
104 "called \\[lq]assigning a name to a socket\\[rq]."
105 msgstr ""
106
107 #. type: Plain text
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 msgid ""
111 "It is normally necessary to assign a local address using B<bind>() before a "
112 "B<SOCK_STREAM> socket may receive connections (see B<accept>(2))."
113 msgstr ""
114
115 #. type: Plain text
116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
118 msgid ""
119 "The rules used in name binding vary between address families. Consult the "
120 "manual entries in Section 7 for detailed information. For B<AF_INET>, see "
121 "B<ip>(7); for B<AF_INET6>, see B<ipv6>(7); for B<AF_UNIX>, see B<unix>(7); "
122 "for B<AF_APPLETALK>, see B<ddp>(7); for B<AF_PACKET>, see B<packet>(7); for "
123 "B<AF_X25>, see B<x25>(7); and for B<AF_NETLINK>, see B<netlink>(7)."
124 msgstr ""
125
126 #. type: Plain text
127 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
128 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
129 msgid ""
130 "The actual structure passed for the I<addr> argument will depend on the "
131 "address family. The I<sockaddr> structure is defined as something like:"
132 msgstr ""
133
134 #. type: Plain text
135 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
136 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
137 #, no-wrap
138 msgid ""
139 "struct sockaddr {\n"
140 " sa_family_t sa_family;\n"
141 " char sa_data[14];\n"
142 "}\n"
143 msgstr ""
144
145 #. type: Plain text
146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
148 msgid ""
149 "The only purpose of this structure is to cast the structure pointer passed "
150 "in I<addr> in order to avoid compiler warnings. See EXAMPLES below."
151 msgstr ""
152
153 #. type: SH
154 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
155 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
156 #, no-wrap
157 msgid "RETURN VALUE"
158 msgstr ""
159
160 #. type: Plain text
161 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
162 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
163 msgid ""
164 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
165 "to indicate the error."
166 msgstr ""
167
168 #. type: SH
169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
171 #, no-wrap
172 msgid "ERRORS"
173 msgstr ""
174
175 #. type: TP
176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
178 #, no-wrap
179 msgid "B<EACCES>"
180 msgstr ""
181
182 #. e.g., privileged port in AF_INET domain
183 #. type: Plain text
184 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
185 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
186 msgid "The address is protected, and the user is not the superuser."
187 msgstr ""
188
189 #. type: TP
190 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
191 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
192 #, no-wrap
193 msgid "B<EADDRINUSE>"
194 msgstr ""
195
196 #. type: Plain text
197 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
198 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
199 msgid "The given address is already in use."
200 msgstr ""
201
202 #. type: Plain text
203 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
204 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
205 msgid ""
206 "(Internet domain sockets) The port number was specified as zero in the "
207 "socket address structure, but, upon attempting to bind to an ephemeral port, "
208 "it was determined that all port numbers in the ephemeral port range are "
209 "currently in use. See the discussion of I</proc/sys/net/ipv4/"
210 "ip_local_port_range> B<ip>(7)."
211 msgstr ""
212
213 #. type: TP
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 #, no-wrap
217 msgid "B<EBADF>"
218 msgstr ""
219
220 #. type: Plain text
221 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
222 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
223 msgid "I<sockfd> is not a valid file descriptor."
224 msgstr ""
225
226 #. type: TP
227 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
228 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
229 #, no-wrap
230 msgid "B<EINVAL>"
231 msgstr ""
232
233 #. This may change in the future: see
234 #. .I linux/unix/sock.c for details.
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid "The socket is already bound to an address."
239 msgstr ""
240
241 #. type: Plain text
242 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
243 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
244 msgid ""
245 "I<addrlen> is wrong, or I<addr> is not a valid address for this socket's "
246 "domain."
247 msgstr ""
248
249 #. type: TP
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 #, no-wrap
253 msgid "B<ENOTSOCK>"
254 msgstr ""
255
256 #. type: Plain text
257 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
258 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
259 msgid "The file descriptor I<sockfd> does not refer to a socket."
260 msgstr ""
261
262 #. type: TP
263 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
264 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
265 #, no-wrap
266 msgid "B<EADDRNOTAVAIL>"
267 msgstr ""
268
269 #. type: Plain text
270 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
271 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
272 msgid ""
273 "A nonexistent interface was requested or the requested address was not local."
274 msgstr ""
275
276 #. type: Plain text
277 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
278 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
279 msgid "The following errors are specific to UNIX domain (B<AF_UNIX>) sockets:"
280 msgstr ""
281
282 #. type: Plain text
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 msgid ""
286 "Search permission is denied on a component of the path prefix. (See also "
287 "B<path_resolution>(7).)"
288 msgstr ""
289
290 #. type: TP
291 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
292 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
293 #, no-wrap
294 msgid "B<EFAULT>"
295 msgstr ""
296
297 #. type: Plain text
298 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
299 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
300 msgid "I<addr> points outside the user's accessible address space."
301 msgstr ""
302
303 #. type: TP
304 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
305 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
306 #, no-wrap
307 msgid "B<ELOOP>"
308 msgstr ""
309
310 #. type: Plain text
311 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
312 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
313 msgid "Too many symbolic links were encountered in resolving I<addr>."
314 msgstr ""
315
316 #. type: TP
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 #, no-wrap
320 msgid "B<ENAMETOOLONG>"
321 msgstr ""
322
323 #. type: Plain text
324 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
325 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
326 msgid "I<addr> is too long."
327 msgstr ""
328
329 #. type: TP
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 #, no-wrap
333 msgid "B<ENOENT>"
334 msgstr ""
335
336 #. type: Plain text
337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
339 msgid ""
340 "A component in the directory prefix of the socket pathname does not exist."
341 msgstr ""
342
343 #. type: TP
344 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
345 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
346 #, no-wrap
347 msgid "B<ENOMEM>"
348 msgstr ""
349
350 #. type: Plain text
351 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
352 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
353 msgid "Insufficient kernel memory was available."
354 msgstr ""
355
356 #. type: TP
357 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
358 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
359 #, no-wrap
360 msgid "B<ENOTDIR>"
361 msgstr ""
362
363 #. type: Plain text
364 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
365 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
366 msgid "A component of the path prefix is not a directory."
367 msgstr ""
368
369 #. type: TP
370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
372 #, no-wrap
373 msgid "B<EROFS>"
374 msgstr ""
375
376 #. type: Plain text
377 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
378 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
379 msgid "The socket inode would reside on a read-only filesystem."
380 msgstr ""
381
382 #. type: Plain text
383 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
384 #: opensuse-leap-16-1 opensuse-tumbleweed
385 msgid "Other errors may be generated by the underlying protocol modules."
386 msgstr ""
387
388 #. type: SH
389 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
390 #: opensuse-tumbleweed
391 #, no-wrap
392 msgid "VERSIONS"
393 msgstr ""
394
395 #. type: Plain text
396 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
397 #: opensuse-tumbleweed
398 msgid ""
399 "Portable programs must ensure that I<addr.sun_path> is a null-terminated "
400 "string for B<AF_UNIX> sockets."
401 msgstr ""
402
403 #. type: SH
404 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
405 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
406 #, no-wrap
407 msgid "STANDARDS"
408 msgstr ""
409
410 #. type: Plain text
411 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
412 #: opensuse-tumbleweed
413 msgid "POSIX.1-2024."
414 msgstr ""
415
416 #. type: SH
417 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
418 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
419 #, no-wrap
420 msgid "HISTORY"
421 msgstr ""
422
423 #. SVr4 documents an additional
424 #. .B ENOSR
425 #. general error condition, and
426 #. additional
427 #. .B EIO
428 #. and
429 #. .B EISDIR
430 #. UNIX-domain error conditions.
431 #. type: Plain text
432 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
433 #: opensuse-tumbleweed
434 msgid "POSIX.1-2001, SVr4, 4.2BSD."
435 msgstr ""
436
437 #. type: SH
438 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
439 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
440 #, no-wrap
441 msgid "BUGS"
442 msgstr ""
443
444 #. FIXME Document transparent proxy options
445 #. type: Plain text
446 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
447 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
448 msgid "The transparent proxy options are not described."
449 msgstr ""
450
451 #. type: SH
452 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
453 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
454 #, no-wrap
455 msgid "EXAMPLES"
456 msgstr ""
457
458 #. type: Plain text
459 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
460 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
461 msgid ""
462 "An example of the use of B<bind>() with Internet domain sockets can be "
463 "found in B<getaddrinfo>(3)."
464 msgstr ""
465
466 #. listen.7 refers to this example.
467 #. accept.7 refers to this example.
468 #. unix.7 refers to this example.
469 #. type: Plain text
470 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
471 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
472 msgid ""
473 "The following example shows how to bind a stream socket in the UNIX "
474 "(B<AF_UNIX>) domain, and accept connections:"
475 msgstr ""
476
477 #. type: Plain text
478 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
479 #: opensuse-tumbleweed
480 #, no-wrap
481 msgid ""
482 "#include E<lt>err.hE<gt>\n"
483 "#include E<lt>stdlib.hE<gt>\n"
484 "#include E<lt>string.hE<gt>\n"
485 "#include E<lt>sys/socket.hE<gt>\n"
486 "#include E<lt>sys/un.hE<gt>\n"
487 "#include E<lt>unistd.hE<gt>\n"
488 "\\&\n"
489 "#define MY_SOCK_PATH \"/somepath\"\n"
490 "#define LISTEN_BACKLOG 50\n"
491 "\\&\n"
492 "int\n"
493 "main(void)\n"
494 "{\n"
495 " int sfd, cfd;\n"
496 " socklen_t peer_addr_size;\n"
497 " struct sockaddr_un my_addr, peer_addr;\n"
498 "\\&\n"
499 " sfd = socket(AF_UNIX, SOCK_STREAM, 0);\n"
500 " if (sfd == -1)\n"
501 " err(EXIT_FAILURE, \"socket\");\n"
502 "\\&\n"
503 " memset(&my_addr, 0, sizeof(my_addr));\n"
504 " my_addr.sun_family = AF_UNIX;\n"
505 " strncpy(my_addr.sun_path, MY_SOCK_PATH,\n"
506 " sizeof(my_addr.sun_path) - 1);\n"
507 "\\&\n"
508 " if (bind(sfd, (struct sockaddr *) &my_addr,\n"
509 " sizeof(my_addr)) == -1)\n"
510 " err(EXIT_FAILURE, \"bind\");\n"
511 "\\&\n"
512 " if (listen(sfd, LISTEN_BACKLOG) == -1)\n"
513 " err(EXIT_FAILURE, \"listen\");\n"
514 "\\&\n"
515 " /* Now we can accept incoming connections one\n"
516 " at a time using accept(2). */\n"
517 "\\&\n"
518 " peer_addr_size = sizeof(peer_addr);\n"
519 " cfd = accept(sfd, (struct sockaddr *) &peer_addr,\n"
520 " &peer_addr_size);\n"
521 " if (cfd == -1)\n"
522 " err(EXIT_FAILURE, \"accept\");\n"
523 "\\&\n"
524 " /* Code to deal with incoming connection(s)... */\n"
525 "\\&\n"
526 " if (close(sfd) == -1)\n"
527 " err(EXIT_FAILURE, \"close\");\n"
528 "\\&\n"
529 " if (unlink(MY_SOCK_PATH) == -1)\n"
530 " err(EXIT_FAILURE, \"unlink\");\n"
531 "}\n"
532 msgstr ""
533
534 #. SRC END
535 #. type: SH
536 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
537 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
538 #, no-wrap
539 msgid "SEE ALSO"
540 msgstr ""
541
542 #. type: Plain text
543 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
544 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
545 msgid ""
546 "B<accept>(2), B<connect>(2), B<getsockname>(2), B<listen>(2), B<socket>(2), "
547 "B<getaddrinfo>(3), B<getifaddrs>(3), B<ip>(7), B<ipv6>(7), "
548 "B<path_resolution>(7), B<socket>(7), B<unix>(7)"
549 msgstr ""
550
551 #. type: TH
552 #: debian-trixie
553 #, no-wrap
554 msgid "2024-06-15"
555 msgstr ""
556
557 #. type: TH
558 #: debian-trixie
559 #, no-wrap
560 msgid "Linux man-pages 6.9.1"
561 msgstr ""
562
563 #. type: Plain text
564 #: debian-trixie
565 msgid "Standard C library (I<libc>, I<-lc>)"
566 msgstr ""
567
568 #. type: Plain text
569 #: debian-trixie fedora-44 fedora-rawhide
570 msgid "POSIX.1-2008."
571 msgstr ""
572
573 #. SVr4 documents an additional
574 #. .B ENOSR
575 #. general error condition, and
576 #. additional
577 #. .B EIO
578 #. and
579 #. .B EISDIR
580 #. UNIX-domain error conditions.
581 #. type: Plain text
582 #: debian-trixie fedora-44 fedora-rawhide
583 msgid "POSIX.1-2001, SVr4, 4.4BSD (B<bind>() first appeared in 4.2BSD)."
584 msgstr ""
585
586 #. type: Plain text
587 #: debian-trixie fedora-44 fedora-rawhide
588 #, no-wrap
589 msgid ""
590 "#include E<lt>stdio.hE<gt>\n"
591 "#include E<lt>stdlib.hE<gt>\n"
592 "#include E<lt>string.hE<gt>\n"
593 "#include E<lt>sys/socket.hE<gt>\n"
594 "#include E<lt>sys/un.hE<gt>\n"
595 "#include E<lt>unistd.hE<gt>\n"
596 "\\&\n"
597 "#define MY_SOCK_PATH \"/somepath\"\n"
598 "#define LISTEN_BACKLOG 50\n"
599 "\\&\n"
600 "#define handle_error(msg) \\[rs]\n"
601 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
602 "\\&\n"
603 "int\n"
604 "main(void)\n"
605 "{\n"
606 " int sfd, cfd;\n"
607 " socklen_t peer_addr_size;\n"
608 " struct sockaddr_un my_addr, peer_addr;\n"
609 "\\&\n"
610 " sfd = socket(AF_UNIX, SOCK_STREAM, 0);\n"
611 " if (sfd == -1)\n"
612 " handle_error(\"socket\");\n"
613 "\\&\n"
614 " memset(&my_addr, 0, sizeof(my_addr));\n"
615 " my_addr.sun_family = AF_UNIX;\n"
616 " strncpy(my_addr.sun_path, MY_SOCK_PATH,\n"
617 " sizeof(my_addr.sun_path) - 1);\n"
618 "\\&\n"
619 " if (bind(sfd, (struct sockaddr *) &my_addr,\n"
620 " sizeof(my_addr)) == -1)\n"
621 " handle_error(\"bind\");\n"
622 "\\&\n"
623 " if (listen(sfd, LISTEN_BACKLOG) == -1)\n"
624 " handle_error(\"listen\");\n"
625 "\\&\n"
626 " /* Now we can accept incoming connections one\n"
627 " at a time using accept(2). */\n"
628 "\\&\n"
629 " peer_addr_size = sizeof(peer_addr);\n"
630 " cfd = accept(sfd, (struct sockaddr *) &peer_addr,\n"
631 " &peer_addr_size);\n"
632 " if (cfd == -1)\n"
633 " handle_error(\"accept\");\n"
634 "\\&\n"
635 " /* Code to deal with incoming connection(s)... */\n"
636 "\\&\n"
637 " if (close(sfd) == -1)\n"
638 " handle_error(\"close\");\n"
639 "\\&\n"
640 " if (unlink(MY_SOCK_PATH) == -1)\n"
641 " handle_error(\"unlink\");\n"
642 "}\n"
643 msgstr ""
644
645 #. type: TH
646 #: fedora-44 fedora-rawhide
647 #, no-wrap
648 msgid "2024-11-06"
649 msgstr ""
650
651 #. type: TH
652 #: fedora-44 fedora-rawhide
653 #, no-wrap
654 msgid "Linux man-pages 6.13"
655 msgstr ""
656
657 #. type: TH
658 #: mageia-cauldron
659 #, no-wrap
660 msgid "Linux man-pages 6.17"
661 msgstr ""
662
663 #. type: TH
664 #: opensuse-leap-16-1 opensuse-tumbleweed
665 #, no-wrap
666 msgid "Linux man-pages (unreleased)"
667 msgstr ""