Debian Codegraph @

templates/man7/unix.7.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:50+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 "UNIX"
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 "unix - sockets for local interprocess communication"
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 "SYNOPSIS"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
61 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
62 #, no-wrap
63 msgid ""
64 "B<#include E<lt>sys/socket.hE<gt>>\n"
65 "B<#include E<lt>sys/un.hE<gt>>\n"
66 msgstr ""
67
68 #. type: Plain text
69 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
70 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
71 #, no-wrap
72 msgid ""
73 "I<unix_socket>B< = socket(AF_UNIX, type, 0);>\n"
74 "I<error>B< = socketpair(AF_UNIX, type, 0, int *>I<sv>B<);>\n"
75 msgstr ""
76
77 #. type: SH
78 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
79 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
80 #, no-wrap
81 msgid "DESCRIPTION"
82 msgstr ""
83
84 #. type: Plain text
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 msgid ""
88 "The B<AF_UNIX> (also known as B<AF_LOCAL>) socket family is used to "
89 "communicate between processes on the same machine efficiently. "
90 "Traditionally, UNIX domain sockets can be either unnamed, or bound to a "
91 "filesystem pathname (marked as being of type socket). Linux also supports "
92 "an abstract namespace which is independent of the filesystem."
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 "Valid socket types in the UNIX domain are: B<SOCK_STREAM>, for a stream-"
100 "oriented socket; B<SOCK_DGRAM>, for a datagram-oriented socket that "
101 "preserves message boundaries (as on most UNIX implementations, UNIX domain "
102 "datagram sockets are always reliable and don't reorder datagrams); and "
103 "(since Linux 2.6.4) B<SOCK_SEQPACKET>, for a sequenced-packet socket that "
104 "is connection-oriented, preserves message boundaries, and delivers messages "
105 "in the order that they were sent."
106 msgstr ""
107
108 #. type: Plain text
109 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
110 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
111 msgid ""
112 "UNIX domain sockets support passing file descriptors or process credentials "
113 "to other processes using ancillary data."
114 msgstr ""
115
116 #. type: SS
117 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
118 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
119 #, no-wrap
120 msgid "Address format"
121 msgstr ""
122
123 #. type: Plain text
124 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
125 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
126 msgid "A UNIX domain socket address is represented in the following structure:"
127 msgstr ""
128
129 #. #define UNIX_PATH_MAX 108
130 #. type: Plain text
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 #, no-wrap
134 msgid ""
135 "struct sockaddr_un {\n"
136 " sa_family_t sun_family; /* AF_UNIX */\n"
137 " char sun_path[108]; /* Pathname */\n"
138 "};\n"
139 msgstr ""
140
141 #. type: Plain text
142 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
143 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
144 msgid ""
145 "The I<sun_family> field always contains B<AF_UNIX>. On Linux, I<sun_path> "
146 "is 108 bytes in size; see also BUGS, below."
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "Various system calls (for example, B<bind>(2), B<connect>(2), and "
154 "B<sendto>(2)) take a I<sockaddr_un> argument as input. Some other system "
155 "calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), "
156 "and B<accept>(2)) return an argument of this type."
157 msgstr ""
158
159 #. type: Plain text
160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
162 msgid ""
163 "Three types of address are distinguished in the I<sockaddr_un> structure:"
164 msgstr ""
165
166 #. type: TP
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 #, no-wrap
170 msgid "pathname"
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid ""
177 "a UNIX domain socket can be bound to a null-terminated filesystem pathname "
178 "using B<bind>(2). When the address of a pathname socket is returned (by one "
179 "of the system calls noted above), its length is"
180 msgstr ""
181
182 #. type: Plain text
183 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
184 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
185 #, no-wrap
186 msgid "offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1\n"
187 msgstr ""
188
189 #. type: Plain text
190 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
191 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
192 msgid ""
193 "and I<sun_path> contains the null-terminated pathname. (On Linux, the above "
194 "B<offsetof>() expression equates to the same value as "
195 "I<sizeof(sa_family_t)>, but some other implementations include other fields "
196 "before I<sun_path>, so the B<offsetof>() expression more portably describes "
197 "the size of the address structure.)"
198 msgstr ""
199
200 #. type: Plain text
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 msgid "For further details of pathname sockets, see below."
204 msgstr ""
205
206 #. type: TP
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 #, no-wrap
210 msgid "unnamed"
211 msgstr ""
212
213 #. There is quite some variation across implementations: FreeBSD
214 #. says the length is 16 bytes, HP-UX 11 says it's zero bytes.
215 #. type: Plain text
216 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
217 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
218 msgid ""
219 "A stream socket that has not been bound to a pathname using B<bind>(2) has "
220 "no name. Likewise, the two sockets created by B<socketpair>(2) are "
221 "unnamed. When the address of an unnamed socket is returned, its length is "
222 "I<sizeof(sa_family_t)>, and I<sun_path> should not be inspected."
223 msgstr ""
224
225 #. type: TP
226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
228 #, no-wrap
229 msgid "abstract"
230 msgstr ""
231
232 #. type: Plain text
233 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
234 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
235 msgid ""
236 "an abstract socket address is distinguished (from a pathname socket) by the "
237 "fact that I<sun_path[0]> is a null byte (\\[aq]\\[rs]0\\[aq]). The socket's "
238 "address in this namespace is given by the additional bytes in I<sun_path> "
239 "that are covered by the specified length of the address structure. (Null "
240 "bytes in the name have no special significance.) The name has no connection "
241 "with filesystem pathnames. When the address of an abstract socket is "
242 "returned, the returned I<addrlen> is greater than I<sizeof(sa_family_t)> "
243 "(i.e., greater than 2), and the name of the socket is contained in the first "
244 "I<(addrlen - sizeof(sa_family_t))> bytes of I<sun_path>."
245 msgstr ""
246
247 #. type: SS
248 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
249 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
250 #, no-wrap
251 msgid "Pathname sockets"
252 msgstr ""
253
254 #. type: Plain text
255 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
256 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
257 msgid ""
258 "When binding a socket to a pathname, a few rules should be observed for "
259 "maximum portability and ease of coding:"
260 msgstr ""
261
262 #. type: IP
263 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
264 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
265 #, no-wrap
266 msgid "\\[bu]"
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 "The pathname in I<sun_path> should be null-terminated."
273 msgstr ""
274
275 #. type: Plain text
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 msgid ""
279 "The length of the pathname, including the terminating null byte, should not "
280 "exceed the size of I<sun_path>."
281 msgstr ""
282
283 #. type: Plain text
284 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
285 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
286 msgid ""
287 "The I<addrlen> argument that describes the enclosing I<sockaddr_un> "
288 "structure should have a value of at least:"
289 msgstr ""
290
291 #. type: Plain text
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 #, no-wrap
295 msgid "offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1\n"
296 msgstr ""
297
298 #. type: Plain text
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 msgid ""
302 "or, more simply, I<addrlen> can be specified as I<sizeof(struct "
303 "sockaddr_un)>."
304 msgstr ""
305
306 #. Linux does this, including for the case where the supplied path
307 #. is 108 bytes
308 #. type: Plain text
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 msgid ""
312 "There is some variation in how implementations handle UNIX domain socket "
313 "addresses that do not follow the above rules. For example, some (but not "
314 "all) implementations append a null terminator if none is present in the "
315 "supplied I<sun_path>."
316 msgstr ""
317
318 #. HP-UX
319 #. Modern BSDs generally have 104, Tru64 and AIX have 104,
320 #. Solaris and Irix have 108
321 #. type: Plain text
322 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
323 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
324 msgid ""
325 "When coding portable applications, keep in mind that some implementations "
326 "have I<sun_path> as short as 92 bytes."
327 msgstr ""
328
329 #. type: Plain text
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 msgid ""
333 "Various system calls (B<accept>(2), B<recvfrom>(2), B<getsockname>(2), "
334 "B<getpeername>(2)) return socket address structures. When applied to UNIX "
335 "domain sockets, the value-result I<addrlen> argument supplied to the call "
336 "should be initialized as above. Upon return, the argument is set to "
337 "indicate the I<actual> size of the address structure. The caller should "
338 "check the value returned in this argument: if the output value exceeds the "
339 "input value, then there is no guarantee that a null terminator is present in "
340 "I<sun_path>. (See BUGS.)"
341 msgstr ""
342
343 #. type: SS
344 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
345 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
346 #, no-wrap
347 msgid "Pathname socket ownership and permissions"
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 ""
354 "In the Linux implementation, pathname sockets honor the permissions of the "
355 "directory they are in. Creation of a new socket fails if the process does "
356 "not have write and search (execute) permission on the directory in which the "
357 "socket is created."
358 msgstr ""
359
360 #. type: Plain text
361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
363 msgid ""
364 "On Linux, connecting to a stream socket object requires write permission on "
365 "that socket; sending a datagram to a datagram socket likewise requires write "
366 "permission on that socket. POSIX does not make any statement about the "
367 "effect of the permissions on a socket file, and on some systems (e.g., older "
368 "BSDs), the socket permissions are ignored. Portable programs should not "
369 "rely on this feature for security."
370 msgstr ""
371
372 #. type: Plain text
373 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
374 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
375 msgid ""
376 "When creating a new socket, the owner and group of the socket file are set "
377 "according to the usual rules. The socket file has all permissions enabled, "
378 "other than those that are turned off by the process B<umask>(2)."
379 msgstr ""
380
381 #. However, fchown() and fchmod() do not seem to have an effect
382 #. type: Plain text
383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
385 msgid ""
386 "The owner, group, and permissions of a pathname socket can be changed (using "
387 "B<chown>(2) and B<chmod>(2))."
388 msgstr ""
389
390 #. type: SS
391 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
392 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
393 #, no-wrap
394 msgid "Abstract sockets"
395 msgstr ""
396
397 #. type: Plain text
398 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
399 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
400 msgid ""
401 "Socket permissions have no meaning for abstract sockets: the process "
402 "B<umask>(2) has no effect when binding an abstract socket, and changing the "
403 "ownership and permissions of the object (via B<fchown>(2) and "
404 "B<fchmod>(2)) has no effect on the accessibility of the socket."
405 msgstr ""
406
407 #. type: Plain text
408 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
409 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
410 msgid ""
411 "Abstract sockets automatically disappear when all open references to the "
412 "socket are closed."
413 msgstr ""
414
415 #. type: Plain text
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 msgid "The abstract socket namespace is a nonportable Linux extension."
419 msgstr ""
420
421 #. type: SS
422 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
423 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
424 #, no-wrap
425 msgid "Socket options"
426 msgstr ""
427
428 #. type: Plain text
429 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
430 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
431 msgid ""
432 "For historical reasons, these socket options are specified with a "
433 "B<SOL_SOCKET> type even though they are B<AF_UNIX> specific. They can be "
434 "set with B<setsockopt>(2) and read with B<getsockopt>(2) by specifying "
435 "B<SOL_SOCKET> as the socket family."
436 msgstr ""
437
438 #. type: TP
439 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
440 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
441 #, no-wrap
442 msgid "B<SO_PASSCRED>"
443 msgstr ""
444
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 ""
449 "Enabling this socket option causes receipt of the credentials of the sending "
450 "process in an B<SCM_CREDENTIALS ancillary> message in each subsequently "
451 "received message. The returned credentials are those specified by the "
452 "sender using B<SCM_CREDENTIALS>, or a default that includes the sender's "
453 "PID, real user ID, and real group ID, if the sender did not specify "
454 "B<SCM_CREDENTIALS> ancillary data."
455 msgstr ""
456
457 #. type: Plain text
458 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
459 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
460 msgid ""
461 "When this option is set and the socket is not yet connected, a unique name "
462 "in the abstract namespace will be generated automatically."
463 msgstr ""
464
465 #. type: Plain text
466 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
467 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
468 msgid ""
469 "The value given as an argument to B<setsockopt>(2) and returned as the "
470 "result of B<getsockopt>(2) is an integer boolean flag."
471 msgstr ""
472
473 #. type: TP
474 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
475 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
476 #, no-wrap
477 msgid "B<SO_PASSSEC>"
478 msgstr ""
479
480 #. type: Plain text
481 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
482 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
483 msgid ""
484 "Enables receiving of the SELinux security label of the peer socket in an "
485 "ancillary message of type B<SCM_SECURITY> (see below)."
486 msgstr ""
487
488 #. commit 877ce7c1b3afd69a9b1caeb1b9964c992641f52a
489 #. commit 37a9a8df8ce9de6ea73349c9ac8bdf6ba4ec4f70
490 #. type: Plain text
491 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
492 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
493 msgid ""
494 "The B<SO_PASSSEC> option is supported for UNIX domain datagram sockets since "
495 "Linux 2.6.18; support for UNIX domain stream sockets was added in Linux 4.2."
496 msgstr ""
497
498 #. type: TP
499 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
500 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
501 #, no-wrap
502 msgid "B<SO_PEEK_OFF>"
503 msgstr ""
504
505 #. type: Plain text
506 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
507 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
508 msgid "See B<socket>(7)."
509 msgstr ""
510
511 #. type: TP
512 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
513 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
514 #, no-wrap
515 msgid "B<SO_PEERCRED>"
516 msgstr ""
517
518 #. type: Plain text
519 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
520 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
521 msgid ""
522 "This read-only socket option returns the credentials of the peer process "
523 "connected to this socket. The returned credentials are those that were in "
524 "effect at the time of the call to B<connect>(2), B<listen>(2), or "
525 "B<socketpair>(2)."
526 msgstr ""
527
528 #. type: Plain text
529 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
530 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
531 msgid ""
532 "The argument to B<getsockopt>(2) is a pointer to a I<ucred> structure; "
533 "define the B<_GNU_SOURCE> feature test macro to obtain the definition of "
534 "that structure from I<E<lt>sys/socket.hE<gt>>."
535 msgstr ""
536
537 #. type: Plain text
538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
540 msgid ""
541 "The use of this option is possible only for connected B<AF_UNIX> stream "
542 "sockets and for B<AF_UNIX> stream and datagram socket pairs created using "
543 "B<socketpair>(2)."
544 msgstr ""
545
546 #. type: SS
547 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
548 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
549 #, no-wrap
550 msgid "Autobind feature"
551 msgstr ""
552
553 #. i.e., sizeof(short)
554 #. type: Plain text
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 msgid ""
558 "If a B<bind>(2) call specifies I<addrlen> as I<sizeof(sa_family_t)>, or the "
559 "B<SO_PASSCRED> socket option was specified for a socket that was not "
560 "explicitly bound to an address, then the socket is autobound to an abstract "
561 "address. The address consists of a null byte followed by 5 bytes in the "
562 "character set I<[0-9a-f]>. Thus, there is a limit of 2\\[ha]20 autobind "
563 "addresses. (From Linux 2.1.15, when the autobind feature was added, 8 bytes "
564 "were used, and the limit was thus 2\\[ha]32 autobind addresses. The change "
565 "to 5 bytes came in Linux 2.3.15.)"
566 msgstr ""
567
568 #. type: SS
569 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
570 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
571 #, no-wrap
572 msgid "Sockets API"
573 msgstr ""
574
575 #. type: Plain text
576 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
577 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
578 msgid ""
579 "The following paragraphs describe domain-specific details and unsupported "
580 "features of the sockets API for UNIX domain sockets on Linux."
581 msgstr ""
582
583 #. type: Plain text
584 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
585 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
586 msgid ""
587 "UNIX domain sockets do not support the transmission of out-of-band data (the "
588 "B<MSG_OOB> flag for B<send>(2) and B<recv>(2))."
589 msgstr ""
590
591 #. type: Plain text
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 msgid ""
595 "The B<send>(2) B<MSG_MORE> flag is not supported by UNIX domain sockets."
596 msgstr ""
597
598 #. commit 9f6f9af7694ede6314bed281eec74d588ba9474f
599 #. type: Plain text
600 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
601 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
602 msgid ""
603 "Before Linux 3.4, the use of B<MSG_TRUNC> in the I<flags> argument of "
604 "B<recv>(2) was not supported by UNIX domain sockets."
605 msgstr ""
606
607 #. type: Plain text
608 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
609 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
610 msgid ""
611 "The B<SO_SNDBUF> socket option does have an effect for UNIX domain sockets, "
612 "but the B<SO_RCVBUF> option does not. For datagram sockets, the "
613 "B<SO_SNDBUF> value imposes an upper limit on the size of outgoing "
614 "datagrams. This limit is calculated as the doubled (see B<socket>(7)) "
615 "option value less 32 bytes used for overhead."
616 msgstr ""
617
618 #. type: SS
619 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
620 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
621 #, no-wrap
622 msgid "Ancillary messages"
623 msgstr ""
624
625 #. type: Plain text
626 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
627 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
628 msgid ""
629 "Ancillary data is sent and received using B<sendmsg>(2) and B<recvmsg>(2). "
630 "For historical reasons, the ancillary message types listed below are "
631 "specified with a B<SOL_SOCKET> type even though they are B<AF_UNIX> "
632 "specific. To send them, set the I<cmsg_level> field of the struct "
633 "I<cmsghdr> to B<SOL_SOCKET> and the I<cmsg_type> field to the type. For "
634 "more information, see B<cmsg>(3)."
635 msgstr ""
636
637 #. type: TP
638 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
639 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
640 #, no-wrap
641 msgid "B<SCM_RIGHTS>"
642 msgstr ""
643
644 #. type: Plain text
645 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
646 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
647 msgid ""
648 "Send or receive a set of open file descriptors from another process. The "
649 "data portion contains an integer array of the file descriptors."
650 msgstr ""
651
652 #. type: Plain text
653 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
654 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
655 msgid ""
656 "Commonly, this operation is referred to as \"passing a file descriptor\" to "
657 "another process. However, more accurately, what is being passed is a "
658 "reference to an open file description (see B<open>(2)), and in the receiving "
659 "process it is likely that a different file descriptor number will be used. "
660 "Semantically, this operation is equivalent to duplicating (B<dup>(2)) a "
661 "file descriptor into the file descriptor table of another process."
662 msgstr ""
663
664 #. type: Plain text
665 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
666 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
667 msgid ""
668 "If the buffer used to receive the ancillary data containing file descriptors "
669 "is too small (or is absent), then the ancillary data is truncated (or "
670 "discarded) and the excess file descriptors are automatically closed in the "
671 "receiving process."
672 msgstr ""
673
674 #. type: Plain text
675 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
676 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
677 msgid ""
678 "If the number of file descriptors received in the ancillary data would cause "
679 "the process to exceed its B<RLIMIT_NOFILE> resource limit (see "
680 "B<getrlimit>(2)), the excess file descriptors are automatically closed in "
681 "the receiving process."
682 msgstr ""
683
684 #. commit bba14de98753cb6599a2dae0e520714b2153522d
685 #. type: Plain text
686 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
687 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
688 msgid ""
689 "The kernel constant B<SCM_MAX_FD> defines a limit on the number of file "
690 "descriptors in the array. Attempting to send an array larger than this "
691 "limit causes B<sendmsg>(2) to fail with the error B<EINVAL>. B<SCM_MAX_FD> "
692 "has the value 253 (or 255 before Linux 2.6.38)."
693 msgstr ""
694
695 #. type: TP
696 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
697 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
698 #, no-wrap
699 msgid "B<SCM_CREDENTIALS>"
700 msgstr ""
701
702 #. type: Plain text
703 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
704 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
705 msgid ""
706 "Send or receive UNIX credentials. This can be used for authentication. The "
707 "credentials are passed as a I<struct ucred> ancillary message. This "
708 "structure is defined in I<E<lt>sys/socket.hE<gt>> as follows:"
709 msgstr ""
710
711 #. type: Plain text
712 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
713 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
714 #, no-wrap
715 msgid ""
716 "struct ucred {\n"
717 " pid_t pid; /* Process ID of the sending process */\n"
718 " uid_t uid; /* User ID of the sending process */\n"
719 " gid_t gid; /* Group ID of the sending process */\n"
720 "};\n"
721 msgstr ""
722
723 #. type: Plain text
724 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
725 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
726 msgid ""
727 "Since glibc 2.8, the B<_GNU_SOURCE> feature test macro must be defined "
728 "(before including I<any> header files) in order to obtain the definition of "
729 "this structure."
730 msgstr ""
731
732 #. type: Plain text
733 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
734 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
735 msgid ""
736 "The credentials which the sender specifies are checked by the kernel. A "
737 "privileged process is allowed to specify values that do not match its own. "
738 "The sender must specify its own process ID (unless it has the capability "
739 "B<CAP_SYS_ADMIN>, in which case the PID of any existing process may be "
740 "specified), its real user ID, effective user ID, or saved set-user-ID "
741 "(unless it has B<CAP_SETUID>), and its real group ID, effective group ID, or "
742 "saved set-group-ID (unless it has B<CAP_SETGID>)."
743 msgstr ""
744
745 #. type: Plain text
746 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
747 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
748 msgid ""
749 "To receive a I<struct ucred> message, the B<SO_PASSCRED> option must be "
750 "enabled on the socket."
751 msgstr ""
752
753 #. type: TP
754 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
755 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
756 #, no-wrap
757 msgid "B<SCM_SECURITY>"
758 msgstr ""
759
760 #. type: Plain text
761 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
762 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
763 msgid ""
764 "Receive the SELinux security context (the security label) of the peer "
765 "socket. The received ancillary data is a null-terminated string containing "
766 "the security context. The receiver should allocate at least B<NAME_MAX> "
767 "bytes in the data portion of the ancillary message for this data."
768 msgstr ""
769
770 #. type: Plain text
771 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
772 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
773 msgid ""
774 "To receive the security context, the B<SO_PASSSEC> option must be enabled on "
775 "the socket (see above)."
776 msgstr ""
777
778 #. type: Plain text
779 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
780 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
781 msgid ""
782 "When sending ancillary data with B<sendmsg>(2), only one item of each of the "
783 "above types may be included in the sent message."
784 msgstr ""
785
786 #. type: Plain text
787 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
788 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
789 msgid ""
790 "At least one byte of real data should be sent when sending ancillary data. "
791 "On Linux, this is required to successfully send ancillary data over a UNIX "
792 "domain stream socket. When sending ancillary data over a UNIX domain "
793 "datagram socket, it is not necessary on Linux to send any accompanying real "
794 "data. However, portable applications should also include at least one byte "
795 "of real data when sending ancillary data over a datagram socket."
796 msgstr ""
797
798 #. type: Plain text
799 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
800 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
801 msgid ""
802 "When receiving from a stream socket, ancillary data forms a kind of barrier "
803 "for the received data. For example, suppose that the sender transmits as "
804 "follows:"
805 msgstr ""
806
807 #. type: IP
808 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
809 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
810 #, no-wrap
811 msgid "(1)"
812 msgstr ""
813
814 #. type: Plain text
815 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
816 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
817 msgid "B<sendmsg>(2) of four bytes, with no ancillary data."
818 msgstr ""
819
820 #. type: IP
821 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
822 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
823 #, no-wrap
824 msgid "(2)"
825 msgstr ""
826
827 #. type: Plain text
828 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
829 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
830 msgid "B<sendmsg>(2) of one byte, with ancillary data."
831 msgstr ""
832
833 #. type: IP
834 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
835 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
836 #, no-wrap
837 msgid "(3)"
838 msgstr ""
839
840 #. type: Plain text
841 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
842 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
843 msgid ""
844 "Suppose that the receiver now performs B<recvmsg>(2) calls each with a "
845 "buffer size of 20 bytes. The first call will receive five bytes of data, "
846 "along with the ancillary data sent by the second B<sendmsg>(2) call. The "
847 "next call will receive the remaining four bytes of data."
848 msgstr ""
849
850 #. type: Plain text
851 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
852 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
853 msgid ""
854 "If the space allocated for receiving incoming ancillary data is too small "
855 "then the ancillary data is truncated to the number of headers that will fit "
856 "in the supplied buffer (or, in the case of an B<SCM_RIGHTS> file descriptor "
857 "list, the list of file descriptors may be truncated). If no buffer is "
858 "provided for incoming ancillary data (i.e., the I<msg_control> field of the "
859 "I<msghdr> structure supplied to B<recvmsg>(2) is NULL), then the incoming "
860 "ancillary data is discarded. In both of these cases, the B<MSG_CTRUNC> flag "
861 "will be set in the I<msg.msg_flags> value returned by B<recvmsg>(2)."
862 msgstr ""
863
864 #. type: SS
865 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
866 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
867 #, no-wrap
868 msgid "Ioctls"
869 msgstr ""
870
871 #. type: Plain text
872 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
873 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
874 msgid ""
875 "The following B<ioctl>(2) calls return information in I<value>. The "
876 "correct syntax is:"
877 msgstr ""
878
879 #. type: Plain text
880 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
881 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
882 #, no-wrap
883 msgid ""
884 "B<int>I< value>B<;>\n"
885 "I<error>B< = ioctl(>I<unix_socket>B<, >I<ioctl_type>B<, &>I<value>B<);>\n"
886 msgstr ""
887
888 #. type: Plain text
889 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
890 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
891 msgid "I<ioctl_type> can be:"
892 msgstr ""
893
894 #. type: TP
895 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
896 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
897 #, no-wrap
898 msgid "B<SIOCINQ>"
899 msgstr ""
900
901 #. #-#-#-#-# archlinux: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
902 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
903 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
904 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
905 #. quite what userland might expect. It seems to return the number
906 #. of bytes allocated for buffers containing pending output.
907 #. That number is normally larger than the number of bytes of pending
908 #. output. Since this info is, from userland's point of view, imprecise,
909 #. and it may well change, probably best not to document this now.
910 #. type: Plain text
911 #. #-#-#-#-# debian-trixie: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
912 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
913 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
914 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
915 #. quite what userland might expect. It seems to return the number
916 #. of bytes allocated for buffers containing pending output.
917 #. That number is normally larger than the number of bytes of pending
918 #. output. Since this info is, from userland's point of view, imprecise,
919 #. and it may well change, probably best not to document this now.
920 #. type: Plain text
921 #. #-#-#-#-# debian-unstable: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
922 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
923 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
924 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
925 #. quite what userland might expect. It seems to return the number
926 #. of bytes allocated for buffers containing pending output.
927 #. That number is normally larger than the number of bytes of pending
928 #. output. Since this info is, from userland's point of view, imprecise,
929 #. and it may well change, probably best not to document this now.
930 #. type: Plain text
931 #. #-#-#-#-# fedora-44: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
932 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
933 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
934 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
935 #. quite what userland might expect. It seems to return the number
936 #. of bytes allocated for buffers containing pending output.
937 #. That number is normally larger than the number of bytes of pending
938 #. output. Since this info is, from userland's point of view, imprecise,
939 #. and it may well change, probably best not to document this now.
940 #. type: Plain text
941 #. #-#-#-#-# fedora-rawhide: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
942 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
943 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
944 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
945 #. quite what userland might expect. It seems to return the number
946 #. of bytes allocated for buffers containing pending output.
947 #. That number is normally larger than the number of bytes of pending
948 #. output. Since this info is, from userland's point of view, imprecise,
949 #. and it may well change, probably best not to document this now.
950 #. type: Plain text
951 #. #-#-#-#-# mageia-cauldron: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
952 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
953 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
954 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
955 #. quite what userland might expect. It seems to return the number
956 #. of bytes allocated for buffers containing pending output.
957 #. That number is normally larger than the number of bytes of pending
958 #. output. Since this info is, from userland's point of view, imprecise,
959 #. and it may well change, probably best not to document this now.
960 #. type: Plain text
961 #. #-#-#-#-# opensuse-leap-16-1: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
962 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
963 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
964 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
965 #. quite what userland might expect. It seems to return the number
966 #. of bytes allocated for buffers containing pending output.
967 #. That number is normally larger than the number of bytes of pending
968 #. output. Since this info is, from userland's point of view, imprecise,
969 #. and it may well change, probably best not to document this now.
970 #. type: Plain text
971 #. #-#-#-#-# opensuse-tumbleweed: unix.7.pot (PACKAGE VERSION) #-#-#-#-#
972 #. FIXME . https://www.sourceware.org/bugzilla/show_bug.cgi?id=12002,
973 #. filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
974 #. SIOCOUTQ also has an effect for UNIX domain sockets, but not
975 #. quite what userland might expect. It seems to return the number
976 #. of bytes allocated for buffers containing pending output.
977 #. That number is normally larger than the number of bytes of pending
978 #. output. Since this info is, from userland's point of view, imprecise,
979 #. and it may well change, probably best not to document this now.
980 #. type: Plain text
981 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
982 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
983 msgid ""
984 "For B<SOCK_STREAM> sockets, this call returns the number of unread bytes in "
985 "the receive buffer. The socket must not be in LISTEN state, otherwise an "
986 "error (B<EINVAL>) is returned. B<SIOCINQ> is defined in I<E<lt>linux/"
987 "sockios.hE<gt>>. Alternatively, you can use the synonymous B<FIONREAD>, "
988 "defined in I<E<lt>sys/ioctl.hE<gt>>. For B<SOCK_DGRAM> sockets, the "
989 "returned value is the same as for Internet domain datagram sockets; see "
990 "B<udp>(7)."
991 msgstr ""
992
993 #. type: SH
994 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
995 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
996 #, no-wrap
997 msgid "ERRORS"
998 msgstr ""
999
1000 #. type: TP
1001 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1002 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1003 #, no-wrap
1004 msgid "B<EADDRINUSE>"
1005 msgstr ""
1006
1007 #. type: Plain text
1008 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1009 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1010 msgid ""
1011 "The specified local address is already in use or the filesystem socket "
1012 "object already exists."
1013 msgstr ""
1014
1015 #. type: TP
1016 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1017 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1018 #, no-wrap
1019 msgid "B<EBADF>"
1020 msgstr ""
1021
1022 #. type: Plain text
1023 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1024 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1025 msgid ""
1026 "This error can occur for B<sendmsg>(2) when sending a file descriptor as "
1027 "ancillary data over a UNIX domain socket (see the description of "
1028 "B<SCM_RIGHTS>, above), and indicates that the file descriptor number that is "
1029 "being sent is not valid (e.g., it is not an open file descriptor)."
1030 msgstr ""
1031
1032 #. type: TP
1033 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1034 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1035 #, no-wrap
1036 msgid "B<ECONNREFUSED>"
1037 msgstr ""
1038
1039 #. type: Plain text
1040 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1041 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1042 msgid ""
1043 "The remote address specified by B<connect>(2) was not a listening socket. "
1044 "This error can also occur if the target pathname is not a socket."
1045 msgstr ""
1046
1047 #. type: TP
1048 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1049 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1050 #, no-wrap
1051 msgid "B<ECONNRESET>"
1052 msgstr ""
1053
1054 #. type: Plain text
1055 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1056 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1057 msgid "Remote socket was unexpectedly closed."
1058 msgstr ""
1059
1060 #. type: TP
1061 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1062 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1063 #, no-wrap
1064 msgid "B<EFAULT>"
1065 msgstr ""
1066
1067 #. type: Plain text
1068 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1069 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1070 msgid "User memory address was not valid."
1071 msgstr ""
1072
1073 #. type: TP
1074 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1075 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1076 #, no-wrap
1077 msgid "B<EINVAL>"
1078 msgstr ""
1079
1080 #. type: Plain text
1081 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1082 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1083 msgid ""
1084 "Invalid argument passed. A common cause is that the value B<AF_UNIX> was "
1085 "not specified in the I<sun_type> field of passed addresses, or the socket "
1086 "was in an invalid state for the applied operation."
1087 msgstr ""
1088
1089 #. type: TP
1090 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1091 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1092 #, no-wrap
1093 msgid "B<EISCONN>"
1094 msgstr ""
1095
1096 #. type: Plain text
1097 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1098 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1099 msgid ""
1100 "B<connect>(2) called on an already connected socket or a target address was "
1101 "specified on a connected socket."
1102 msgstr ""
1103
1104 #. type: TP
1105 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1106 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1107 #, no-wrap
1108 msgid "B<ENFILE>"
1109 msgstr ""
1110
1111 #. type: Plain text
1112 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1113 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1114 msgid ""
1115 "The system-wide limit on the total number of open files has been reached."
1116 msgstr ""
1117
1118 #. type: TP
1119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1121 #, no-wrap
1122 msgid "B<ENOENT>"
1123 msgstr ""
1124
1125 #. type: Plain text
1126 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1127 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1128 msgid ""
1129 "The pathname in the remote address specified to B<connect>(2) did not exist."
1130 msgstr ""
1131
1132 #. type: TP
1133 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1134 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1135 #, no-wrap
1136 msgid "B<ENOMEM>"
1137 msgstr ""
1138
1139 #. type: Plain text
1140 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1141 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1142 msgid "Out of memory."
1143 msgstr ""
1144
1145 #. type: TP
1146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1148 #, no-wrap
1149 msgid "B<ENOTCONN>"
1150 msgstr ""
1151
1152 #. type: Plain text
1153 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1154 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1155 msgid ""
1156 "Socket operation needs a target address, but the socket is not connected."
1157 msgstr ""
1158
1159 #. type: TP
1160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1162 #, no-wrap
1163 msgid "B<EOPNOTSUPP>"
1164 msgstr ""
1165
1166 #. type: Plain text
1167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1169 msgid ""
1170 "Stream operation called on non-stream oriented socket or tried to use the "
1171 "out-of-band data option."
1172 msgstr ""
1173
1174 #. type: TP
1175 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1176 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1177 #, no-wrap
1178 msgid "B<EPERM>"
1179 msgstr ""
1180
1181 #. type: Plain text
1182 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1183 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1184 msgid "The sender passed invalid credentials in the I<struct ucred>."
1185 msgstr ""
1186
1187 #. type: TP
1188 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1189 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1190 #, no-wrap
1191 msgid "B<EPIPE>"
1192 msgstr ""
1193
1194 #. type: Plain text
1195 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1196 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1197 msgid ""
1198 "Remote socket was closed on a stream socket. If enabled, a B<SIGPIPE> is "
1199 "sent as well. This can be avoided by passing the B<MSG_NOSIGNAL> flag to "
1200 "B<send>(2) or B<sendmsg>(2)."
1201 msgstr ""
1202
1203 #. type: TP
1204 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1205 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1206 #, no-wrap
1207 msgid "B<EPROTONOSUPPORT>"
1208 msgstr ""
1209
1210 #. type: Plain text
1211 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1212 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1213 msgid "Passed protocol is not B<AF_UNIX>."
1214 msgstr ""
1215
1216 #. type: TP
1217 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1218 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1219 #, no-wrap
1220 msgid "B<EPROTOTYPE>"
1221 msgstr ""
1222
1223 #. type: Plain text
1224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1226 msgid ""
1227 "Remote socket does not match the local socket type (B<SOCK_DGRAM> versus "
1228 "B<SOCK_STREAM>)."
1229 msgstr ""
1230
1231 #. type: TP
1232 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1233 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1234 #, no-wrap
1235 msgid "B<ESOCKTNOSUPPORT>"
1236 msgstr ""
1237
1238 #. type: Plain text
1239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1241 msgid "Unknown socket type."
1242 msgstr ""
1243
1244 #. type: TP
1245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1247 #, no-wrap
1248 msgid "B<ESRCH>"
1249 msgstr ""
1250
1251 #. type: Plain text
1252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1254 msgid ""
1255 "While sending an ancillary message containing credentials "
1256 "(B<SCM_CREDENTIALS>), the caller specified a PID that does not match any "
1257 "existing process."
1258 msgstr ""
1259
1260 #. type: TP
1261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1263 #, no-wrap
1264 msgid "B<ETOOMANYREFS>"
1265 msgstr ""
1266
1267 #. type: Plain text
1268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1270 msgid ""
1271 "This error can occur for B<sendmsg>(2) when sending a file descriptor as "
1272 "ancillary data over a UNIX domain socket (see the description of "
1273 "B<SCM_RIGHTS>, above). It occurs if the number of \"in-flight\" file "
1274 "descriptors exceeds the B<RLIMIT_NOFILE> resource limit and the caller does "
1275 "not have the B<CAP_SYS_RESOURCE> capability. An in-flight file descriptor "
1276 "is one that has been sent using B<sendmsg>(2) but has not yet been accepted "
1277 "in the recipient process using B<recvmsg>(2)."
1278 msgstr ""
1279
1280 #. commit 712f4aad406bb1ed67f3f98d04c044191f0ff593
1281 #. type: Plain text
1282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1284 msgid ""
1285 "This error is diagnosed since mainline Linux 4.5 (and in some earlier kernel "
1286 "versions where the fix has been backported). In earlier kernel versions, it "
1287 "was possible to place an unlimited number of file descriptors in flight, by "
1288 "sending each file descriptor with B<sendmsg>(2) and then closing the file "
1289 "descriptor so that it was not accounted against the B<RLIMIT_NOFILE> "
1290 "resource limit."
1291 msgstr ""
1292
1293 #. type: Plain text
1294 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1295 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1296 msgid ""
1297 "Other errors can be generated by the generic socket layer or by the "
1298 "filesystem while generating a filesystem socket object. See the appropriate "
1299 "manual pages for more information."
1300 msgstr ""
1301
1302 #. type: SH
1303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1305 #, no-wrap
1306 msgid "VERSIONS"
1307 msgstr ""
1308
1309 #. type: Plain text
1310 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1311 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1312 msgid ""
1313 "B<SCM_CREDENTIALS> and the abstract namespace were introduced with Linux 2.2 "
1314 "and should not be used in portable programs. (Some BSD-derived systems also "
1315 "support credential passing, but the implementation details differ.)"
1316 msgstr ""
1317
1318 #. type: SH
1319 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1320 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1321 #, no-wrap
1322 msgid "NOTES"
1323 msgstr ""
1324
1325 #. type: Plain text
1326 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1327 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1328 msgid ""
1329 "Binding to a socket with a filename creates a socket in the filesystem that "
1330 "must be deleted by the caller when it is no longer needed (using "
1331 "B<unlink>(2)). The usual UNIX close-behind semantics apply; the socket can "
1332 "be unlinked at any time and will be finally removed from the filesystem when "
1333 "the last reference to it is closed."
1334 msgstr ""
1335
1336 #. type: Plain text
1337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1339 msgid ""
1340 "To pass file descriptors or credentials over a B<SOCK_STREAM> socket, you "
1341 "must send or receive at least one byte of nonancillary data in the same "
1342 "B<sendmsg>(2) or B<recvmsg>(2) call."
1343 msgstr ""
1344
1345 #. type: Plain text
1346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1348 msgid ""
1349 "UNIX domain stream sockets do not support the notion of out-of-band data."
1350 msgstr ""
1351
1352 #. type: SH
1353 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1354 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1355 #, no-wrap
1356 msgid "BUGS"
1357 msgstr ""
1358
1359 #. The behavior on Solaris is quite similar.
1360 #. type: Plain text
1361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1363 msgid ""
1364 "When binding a socket to an address, Linux is one of the implementations "
1365 "that append a null terminator if none is supplied in I<sun_path>. In most "
1366 "cases this is unproblematic: when the socket address is retrieved, it will "
1367 "be one byte longer than that supplied when the socket was bound. However, "
1368 "there is one case where confusing behavior can result: if 108 non-null bytes "
1369 "are supplied when a socket is bound, then the addition of the null "
1370 "terminator takes the length of the pathname beyond I<sizeof(sun_path)>. "
1371 "Consequently, when retrieving the socket address (for example, via "
1372 "B<accept>(2)), if the input I<addrlen> argument for the retrieving call is "
1373 "specified as I<sizeof(struct sockaddr_un)>, then the returned address "
1374 "structure I<won't> have a null terminator in I<sun_path>."
1375 msgstr ""
1376
1377 #. i.e., traditional BSD
1378 #. type: Plain text
1379 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1380 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1381 msgid ""
1382 "In addition, some implementations don't require a null terminator when "
1383 "binding a socket (the I<addrlen> argument is used to determine the length of "
1384 "I<sun_path>) and when the socket address is retrieved on these "
1385 "implementations, there is no null terminator in I<sun_path>."
1386 msgstr ""
1387
1388 #. type: Plain text
1389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1391 msgid ""
1392 "Applications that retrieve socket addresses can (portably) code to handle "
1393 "the possibility that there is no null terminator in I<sun_path> by "
1394 "respecting the fact that the number of valid bytes in the pathname is:"
1395 msgstr ""
1396
1397 #. type: Plain text
1398 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1399 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1400 #, no-wrap
1401 msgid "strnlen(addr.sun_path, addrlen - offsetof(sockaddr_un, sun_path))\n"
1402 msgstr ""
1403
1404 #. type: Plain text
1405 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1406 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1407 msgid ""
1408 "Alternatively, an application can retrieve the socket address by allocating "
1409 "a buffer of size I<sizeof(struct sockaddr_un)+1> that is zeroed out before "
1410 "the retrieval. The retrieving call can specify I<addrlen> as "
1411 "I<sizeof(struct sockaddr_un)>, and the extra zero byte ensures that there "
1412 "will be a null terminator for the string returned in I<sun_path>:"
1413 msgstr ""
1414
1415 #. type: Plain text
1416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1418 #, no-wrap
1419 msgid ""
1420 "void *addrp;\n"
1421 "\\&\n"
1422 "addrlen = sizeof(struct sockaddr_un);\n"
1423 "addrp = malloc(addrlen + 1);\n"
1424 "if (addrp == NULL)\n"
1425 " /* Handle error */ ;\n"
1426 "memset(addrp, 0, addrlen + 1);\n"
1427 "\\&\n"
1428 "if (getsockname(sfd, (struct sockaddr *) addrp, &addrlen)) == -1)\n"
1429 " /* handle error */ ;\n"
1430 "\\&\n"
1431 "printf(\"sun_path = %s\\[rs]n\", ((struct sockaddr_un *) addrp)-E<gt>sun_path);\n"
1432 msgstr ""
1433
1434 #. type: Plain text
1435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1437 msgid ""
1438 "This sort of messiness can be avoided if it is guaranteed that the "
1439 "applications that I<create> pathname sockets follow the rules outlined above "
1440 "under I<Pathname sockets>."
1441 msgstr ""
1442
1443 #. type: SH
1444 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1445 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1446 #, no-wrap
1447 msgid "EXAMPLES"
1448 msgstr ""
1449
1450 #. type: Plain text
1451 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1452 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1453 msgid ""
1454 "The following code demonstrates the use of sequenced-packet sockets for "
1455 "local interprocess communication. It consists of two programs. The server "
1456 "program waits for a connection from the client program. The client sends "
1457 "each of its command-line arguments in separate messages. The server treats "
1458 "the incoming messages as integers and adds them up. The client sends the "
1459 "command string \"END\". The server sends back a message containing the sum "
1460 "of the client's integers. The client prints the sum and exits. The server "
1461 "waits for the next client to connect. To stop the server, the client is "
1462 "called with the command-line argument \"DOWN\"."
1463 msgstr ""
1464
1465 #. type: Plain text
1466 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1467 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1468 msgid ""
1469 "The following output was recorded while running the server in the background "
1470 "and repeatedly executing the client. Execution of the server program ends "
1471 "when it receives the \"DOWN\" command."
1472 msgstr ""
1473
1474 #. type: SS
1475 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1476 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1477 #, no-wrap
1478 msgid "Example output"
1479 msgstr ""
1480
1481 #. type: Plain text
1482 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1483 #: opensuse-tumbleweed
1484 #, no-wrap
1485 msgid ""
1486 "$B< ./server &>\n"
1487 "[1] 25887\n"
1488 "$B< ./client 3 4>;\n"
1489 "Result = 7\n"
1490 "$B< ./client 11 -5>;\n"
1491 "Result = 6\n"
1492 "$B< ./client DOWN>;\n"
1493 "Result = 0\n"
1494 "[1]+ Done ./server\n"
1495 "$\n"
1496 msgstr ""
1497
1498 #. type: SS
1499 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1500 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1501 #, no-wrap
1502 msgid "Program source"
1503 msgstr ""
1504
1505 #. type: Plain text
1506 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1507 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1508 #, no-wrap
1509 msgid ""
1510 "/*\n"
1511 " * File connection.h\n"
1512 " */\n"
1513 "#ifndef CONNECTION_H\n"
1514 "#define CONNECTION_H\n"
1515 "\\&\n"
1516 "#define SOCKET_NAME \"/tmp/9Lq7BNBnBycd6nxy.socket\"\n"
1517 "#define BUFFER_SIZE 12\n"
1518 "\\&\n"
1519 "#endif // include guard\n"
1520 msgstr ""
1521
1522 #. type: Plain text
1523 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1524 #: opensuse-tumbleweed
1525 #, no-wrap
1526 msgid ""
1527 "/*\n"
1528 " * File server.c\n"
1529 " */\n"
1530 "\\&\n"
1531 "#include E<lt>stdio.hE<gt>\n"
1532 "#include E<lt>stdlib.hE<gt>\n"
1533 "#include E<lt>string.hE<gt>\n"
1534 "#include E<lt>sys/socket.hE<gt>\n"
1535 "#include E<lt>sys/types.hE<gt>\n"
1536 "#include E<lt>sys/un.hE<gt>\n"
1537 "#include E<lt>unistd.hE<gt>\n"
1538 "\\&\n"
1539 "#include \"connection.h\"\n"
1540 "\\&\n"
1541 "int\n"
1542 "main(void)\n"
1543 "{\n"
1544 " int down_flag = 0;\n"
1545 " int ret;\n"
1546 " int connection_socket;\n"
1547 " int data_socket;\n"
1548 " int result;\n"
1549 " ssize_t r, w;\n"
1550 " struct sockaddr_un name;\n"
1551 " char buffer[BUFFER_SIZE];\n"
1552 "\\&\n"
1553 " /* Create local socket. */\n"
1554 "\\&\n"
1555 " connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
1556 " if (connection_socket == -1) {\n"
1557 " perror(\"socket\");\n"
1558 " exit(EXIT_FAILURE);\n"
1559 " }\n"
1560 "\\&\n"
1561 " /*\n"
1562 " * For portability clear the whole structure, since some\n"
1563 " * implementations have additional (nonstandard) fields in\n"
1564 " * the structure.\n"
1565 " */\n"
1566 "\\&\n"
1567 " memset(&name, 0, sizeof(name));\n"
1568 "\\&\n"
1569 " /* Bind socket to socket name. */\n"
1570 "\\&\n"
1571 " name.sun_family = AF_UNIX;\n"
1572 " strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n"
1573 "\\&\n"
1574 " ret = bind(connection_socket, (const struct sockaddr *) &name,\n"
1575 " sizeof(name));\n"
1576 " if (ret == -1) {\n"
1577 " perror(\"bind\");\n"
1578 " exit(EXIT_FAILURE);\n"
1579 " }\n"
1580 "\\&\n"
1581 " /*\n"
1582 " * Prepare for accepting connections. The backlog size is set\n"
1583 " * to 20. So while one request is being processed other requests\n"
1584 " * can be waiting.\n"
1585 " */\n"
1586 "\\&\n"
1587 " ret = listen(connection_socket, 20);\n"
1588 " if (ret == -1) {\n"
1589 " perror(\"listen\");\n"
1590 " exit(EXIT_FAILURE);\n"
1591 " }\n"
1592 "\\&\n"
1593 " /* This is the main loop for handling connections. */\n"
1594 "\\&\n"
1595 " for (;;) {\n"
1596 "\\&\n"
1597 " /* Wait for incoming connection. */\n"
1598 "\\&\n"
1599 " data_socket = accept(connection_socket, NULL, NULL);\n"
1600 " if (data_socket == -1) {\n"
1601 " perror(\"accept\");\n"
1602 " exit(EXIT_FAILURE);\n"
1603 " }\n"
1604 "\\&\n"
1605 " result = 0;\n"
1606 " for (;;) {\n"
1607 "\\&\n"
1608 " /* Wait for next data packet. */\n"
1609 "\\&\n"
1610 " r = read(data_socket, buffer, sizeof(buffer));\n"
1611 " if (r == -1) {\n"
1612 " perror(\"read\");\n"
1613 " exit(EXIT_FAILURE);\n"
1614 " }\n"
1615 "\\&\n"
1616 " /* Ensure buffer is 0-terminated. */\n"
1617 "\\&\n"
1618 " buffer[sizeof(buffer) - 1] = 0;\n"
1619 "\\&\n"
1620 " /* Handle commands. */\n"
1621 "\\&\n"
1622 " if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n"
1623 " down_flag = 1;\n"
1624 " continue;\n"
1625 " }\n"
1626 "\\&\n"
1627 " if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n"
1628 " break;\n"
1629 " }\n"
1630 "\\&\n"
1631 " if (down_flag) {\n"
1632 " continue;\n"
1633 " }\n"
1634 "\\&\n"
1635 " /* Add received summand. */\n"
1636 "\\&\n"
1637 " result += atoi(buffer);\n"
1638 " }\n"
1639 "\\&\n"
1640 " /* Send result. */\n"
1641 "\\&\n"
1642 " sprintf(buffer, \"%d\", result);\n"
1643 " w = write(data_socket, buffer, sizeof(buffer));\n"
1644 " if (w == -1) {\n"
1645 " perror(\"write\");\n"
1646 " exit(EXIT_FAILURE);\n"
1647 " }\n"
1648 "\\&\n"
1649 " /* Close socket. */\n"
1650 "\\&\n"
1651 " close(data_socket);\n"
1652 "\\&\n"
1653 " /* Quit on DOWN command. */\n"
1654 "\\&\n"
1655 " if (down_flag) {\n"
1656 " break;\n"
1657 " }\n"
1658 " }\n"
1659 "\\&\n"
1660 " close(connection_socket);\n"
1661 "\\&\n"
1662 " /* Unlink the socket. */\n"
1663 "\\&\n"
1664 " unlink(SOCKET_NAME);\n"
1665 "\\&\n"
1666 " exit(EXIT_SUCCESS);\n"
1667 "}\n"
1668 msgstr ""
1669
1670 #. type: Plain text
1671 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1672 #: opensuse-tumbleweed
1673 #, no-wrap
1674 msgid ""
1675 "/*\n"
1676 " * File client.c\n"
1677 " */\n"
1678 "\\&\n"
1679 "#include E<lt>stdio.hE<gt>\n"
1680 "#include E<lt>stdlib.hE<gt>\n"
1681 "#include E<lt>string.hE<gt>\n"
1682 "#include E<lt>sys/socket.hE<gt>\n"
1683 "#include E<lt>sys/types.hE<gt>\n"
1684 "#include E<lt>sys/un.hE<gt>\n"
1685 "#include E<lt>unistd.hE<gt>\n"
1686 "\\&\n"
1687 "#include \"connection.h\"\n"
1688 "\\&\n"
1689 "int\n"
1690 "main(int argc, char *argv[])\n"
1691 "{\n"
1692 " int ret;\n"
1693 " int data_socket;\n"
1694 " ssize_t r, w;\n"
1695 " struct sockaddr_un addr;\n"
1696 " char buffer[BUFFER_SIZE];\n"
1697 "\\&\n"
1698 " /* Create local socket. */\n"
1699 "\\&\n"
1700 " data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
1701 " if (data_socket == -1) {\n"
1702 " perror(\"socket\");\n"
1703 " exit(EXIT_FAILURE);\n"
1704 " }\n"
1705 "\\&\n"
1706 " /*\n"
1707 " * For portability clear the whole structure, since some\n"
1708 " * implementations have additional (nonstandard) fields in\n"
1709 " * the structure.\n"
1710 " */\n"
1711 "\\&\n"
1712 " memset(&addr, 0, sizeof(addr));\n"
1713 "\\&\n"
1714 " /* Connect socket to socket address. */\n"
1715 "\\&\n"
1716 " addr.sun_family = AF_UNIX;\n"
1717 " strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n"
1718 "\\&\n"
1719 " ret = connect(data_socket, (const struct sockaddr *) &addr,\n"
1720 " sizeof(addr));\n"
1721 " if (ret == -1) {\n"
1722 " fprintf(stderr, \"The server is down.\\[rs]n\");\n"
1723 " exit(EXIT_FAILURE);\n"
1724 " }\n"
1725 "\\&\n"
1726 " /* Send arguments. */\n"
1727 "\\&\n"
1728 " for (int i = 1; i E<lt> argc; ++i) {\n"
1729 " w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
1730 " if (w == -1) {\n"
1731 " perror(\"write\");\n"
1732 " break;\n"
1733 " }\n"
1734 " }\n"
1735 "\\&\n"
1736 " /* Request result. */\n"
1737 "\\&\n"
1738 " strcpy(buffer, \"END\");\n"
1739 " w = write(data_socket, buffer, strlen(buffer) + 1);\n"
1740 " if (w == -1) {\n"
1741 " perror(\"write\");\n"
1742 " exit(EXIT_FAILURE);\n"
1743 " }\n"
1744 "\\&\n"
1745 " /* Receive result. */\n"
1746 "\\&\n"
1747 " r = read(data_socket, buffer, sizeof(buffer));\n"
1748 " if (r == -1) {\n"
1749 " perror(\"read\");\n"
1750 " exit(EXIT_FAILURE);\n"
1751 " }\n"
1752 "\\&\n"
1753 " /* Ensure buffer is 0-terminated. */\n"
1754 "\\&\n"
1755 " buffer[sizeof(buffer) - 1] = 0;\n"
1756 "\\&\n"
1757 " printf(\"Result = %s\\[rs]n\", buffer);\n"
1758 "\\&\n"
1759 " /* Close socket. */\n"
1760 "\\&\n"
1761 " close(data_socket);\n"
1762 "\\&\n"
1763 " exit(EXIT_SUCCESS);\n"
1764 "}\n"
1765 msgstr ""
1766
1767 #. type: Plain text
1768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1770 msgid ""
1771 "For examples of the use of B<SCM_RIGHTS>, see B<cmsg>(3) and "
1772 "B<seccomp_unotify>(2)."
1773 msgstr ""
1774
1775 #. type: SH
1776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1778 #, no-wrap
1779 msgid "SEE ALSO"
1780 msgstr ""
1781
1782 #. type: Plain text
1783 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1784 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1785 msgid ""
1786 "B<recvmsg>(2), B<sendmsg>(2), B<socket>(2), B<socketpair>(2), B<cmsg>(3), "
1787 "B<capabilities>(7), B<credentials>(7), B<socket>(7), B<udp>(7)"
1788 msgstr ""
1789
1790 #. type: TH
1791 #: debian-trixie fedora-44 fedora-rawhide
1792 #, no-wrap
1793 msgid "2024-06-15"
1794 msgstr ""
1795
1796 #. type: TH
1797 #: debian-trixie
1798 #, no-wrap
1799 msgid "Linux man-pages 6.9.1"
1800 msgstr ""
1801
1802 #. type: TP
1803 #: debian-trixie fedora-44 fedora-rawhide
1804 #, no-wrap
1805 msgid "B<SO_PEERSEC>"
1806 msgstr ""
1807
1808 #. type: Plain text
1809 #: debian-trixie fedora-44 fedora-rawhide
1810 msgid ""
1811 "This read-only socket option returns the security context of the peer socket "
1812 "connected to this socket. By default, this will be the same as the security "
1813 "context of the process that created the peer socket unless overridden by the "
1814 "policy or by a process with the required permissions."
1815 msgstr ""
1816
1817 #. type: Plain text
1818 #: debian-trixie fedora-44 fedora-rawhide
1819 msgid ""
1820 "The argument to B<getsockopt>(2) is a pointer to a buffer of the specified "
1821 "length in bytes into which the security context string will be copied. If "
1822 "the buffer length is less than the length of the security context string, "
1823 "then B<getsockopt>(2) returns -1, sets I<errno> to B<ERANGE>, and returns "
1824 "the required length via I<optlen>. The caller should allocate at least "
1825 "B<NAME_MAX> bytes for the buffer initially, although this is not guaranteed "
1826 "to be sufficient. Resizing the buffer to the returned length and retrying "
1827 "may be necessary."
1828 msgstr ""
1829
1830 #. type: Plain text
1831 #: debian-trixie fedora-44 fedora-rawhide
1832 msgid ""
1833 "The security context string may include a terminating null character in the "
1834 "returned length, but is not guaranteed to do so: a security context \"foo\" "
1835 "might be represented as either {'f','o','o'} of length 3 or "
1836 "{'f','o','o','\\e0'} of length 4, which are considered to be "
1837 "interchangeable. The string is printable, does not contain non-terminating "
1838 "null characters, and is in an unspecified encoding (in particular, it is not "
1839 "guaranteed to be ASCII or UTF-8)."
1840 msgstr ""
1841
1842 #. commit 0b811db2cb2aabc910e53d34ebb95a15997c33e7
1843 #. type: Plain text
1844 #: debian-trixie fedora-44 fedora-rawhide
1845 msgid ""
1846 "The use of this option for sockets in the B<AF_UNIX> address family is "
1847 "supported since Linux 2.6.2 for connected stream sockets, and since Linux "
1848 "4.18 also for stream and datagram socket pairs created using "
1849 "B<socketpair>(2)."
1850 msgstr ""
1851
1852 #. type: Plain text
1853 #: debian-trixie fedora-44 fedora-rawhide
1854 #, no-wrap
1855 msgid ""
1856 "$ B<./server &>\n"
1857 "[1] 25887\n"
1858 "$ B<./client 3 4>\n"
1859 "Result = 7\n"
1860 "$ B<./client 11 -5>\n"
1861 "Result = 6\n"
1862 "$ B<./client DOWN>\n"
1863 "Result = 0\n"
1864 "[1]+ Done ./server\n"
1865 "$\n"
1866 msgstr ""
1867
1868 #. type: Plain text
1869 #: debian-trixie fedora-44 fedora-rawhide
1870 #, no-wrap
1871 msgid ""
1872 "/*\n"
1873 " * File server.c\n"
1874 " */\n"
1875 "\\&\n"
1876 "#include E<lt>stdio.hE<gt>\n"
1877 "#include E<lt>stdlib.hE<gt>\n"
1878 "#include E<lt>string.hE<gt>\n"
1879 "#include E<lt>sys/socket.hE<gt>\n"
1880 "#include E<lt>sys/types.hE<gt>\n"
1881 "#include E<lt>sys/un.hE<gt>\n"
1882 "#include E<lt>unistd.hE<gt>\n"
1883 "\\&\n"
1884 "#include \"connection.h\"\n"
1885 "\\&\n"
1886 "int\n"
1887 "main(void)\n"
1888 "{\n"
1889 " int down_flag = 0;\n"
1890 " int ret;\n"
1891 " int connection_socket;\n"
1892 " int data_socket;\n"
1893 " int result;\n"
1894 " ssize_t r, w;\n"
1895 " struct sockaddr_un name;\n"
1896 " char buffer[BUFFER_SIZE];\n"
1897 "\\&\n"
1898 " /* Create local socket. */\n"
1899 "\\&\n"
1900 " connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
1901 " if (connection_socket == -1) {\n"
1902 " perror(\"socket\");\n"
1903 " exit(EXIT_FAILURE);\n"
1904 " }\n"
1905 "\\&\n"
1906 " /*\n"
1907 " * For portability clear the whole structure, since some\n"
1908 " * implementations have additional (nonstandard) fields in\n"
1909 " * the structure.\n"
1910 " */\n"
1911 "\\&\n"
1912 " memset(&name, 0, sizeof(name));\n"
1913 "\\&\n"
1914 " /* Bind socket to socket name. */\n"
1915 "\\&\n"
1916 " name.sun_family = AF_UNIX;\n"
1917 " strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1);\n"
1918 "\\&\n"
1919 " ret = bind(connection_socket, (const struct sockaddr *) &name,\n"
1920 " sizeof(name));\n"
1921 " if (ret == -1) {\n"
1922 " perror(\"bind\");\n"
1923 " exit(EXIT_FAILURE);\n"
1924 " }\n"
1925 "\\&\n"
1926 " /*\n"
1927 " * Prepare for accepting connections. The backlog size is set\n"
1928 " * to 20. So while one request is being processed other requests\n"
1929 " * can be waiting.\n"
1930 " */\n"
1931 "\\&\n"
1932 " ret = listen(connection_socket, 20);\n"
1933 " if (ret == -1) {\n"
1934 " perror(\"listen\");\n"
1935 " exit(EXIT_FAILURE);\n"
1936 " }\n"
1937 "\\&\n"
1938 " /* This is the main loop for handling connections. */\n"
1939 "\\&\n"
1940 " for (;;) {\n"
1941 "\\&\n"
1942 " /* Wait for incoming connection. */\n"
1943 "\\&\n"
1944 " data_socket = accept(connection_socket, NULL, NULL);\n"
1945 " if (data_socket == -1) {\n"
1946 " perror(\"accept\");\n"
1947 " exit(EXIT_FAILURE);\n"
1948 " }\n"
1949 "\\&\n"
1950 " result = 0;\n"
1951 " for (;;) {\n"
1952 "\\&\n"
1953 " /* Wait for next data packet. */\n"
1954 "\\&\n"
1955 " r = read(data_socket, buffer, sizeof(buffer));\n"
1956 " if (r == -1) {\n"
1957 " perror(\"read\");\n"
1958 " exit(EXIT_FAILURE);\n"
1959 " }\n"
1960 "\\&\n"
1961 " /* Ensure buffer is 0-terminated. */\n"
1962 "\\&\n"
1963 " buffer[sizeof(buffer) - 1] = 0;\n"
1964 "\\&\n"
1965 " /* Handle commands. */\n"
1966 "\\&\n"
1967 " if (!strncmp(buffer, \"DOWN\", sizeof(buffer))) {\n"
1968 " down_flag = 1;\n"
1969 " continue;\n"
1970 " }\n"
1971 "\\&\n"
1972 " if (!strncmp(buffer, \"END\", sizeof(buffer))) {\n"
1973 " break;\n"
1974 " }\n"
1975 "\\&\n"
1976 " if (down_flag) {\n"
1977 " continue;\n"
1978 " }\n"
1979 "\\&\n"
1980 " /* Add received summand. */\n"
1981 "\\&\n"
1982 " result += atoi(buffer);\n"
1983 " }\n"
1984 "\\&\n"
1985 " /* Send result. */\n"
1986 "\\&\n"
1987 " sprintf(buffer, \"%d\", result);\n"
1988 " w = write(data_socket, buffer, sizeof(buffer));\n"
1989 " if (w == -1) {\n"
1990 " perror(\"write\");\n"
1991 " exit(EXIT_FAILURE);\n"
1992 " }\n"
1993 "\\&\n"
1994 " /* Close socket. */\n"
1995 "\\&\n"
1996 " close(data_socket);\n"
1997 "\\&\n"
1998 " /* Quit on DOWN command. */\n"
1999 "\\&\n"
2000 " if (down_flag) {\n"
2001 " break;\n"
2002 " }\n"
2003 " }\n"
2004 "\\&\n"
2005 " close(connection_socket);\n"
2006 "\\&\n"
2007 " /* Unlink the socket. */\n"
2008 "\\&\n"
2009 " unlink(SOCKET_NAME);\n"
2010 "\\&\n"
2011 " exit(EXIT_SUCCESS);\n"
2012 "}\n"
2013 msgstr ""
2014
2015 #. type: Plain text
2016 #: debian-trixie fedora-44 fedora-rawhide
2017 #, no-wrap
2018 msgid ""
2019 "/*\n"
2020 " * File client.c\n"
2021 " */\n"
2022 "\\&\n"
2023 "#include E<lt>stdio.hE<gt>\n"
2024 "#include E<lt>stdlib.hE<gt>\n"
2025 "#include E<lt>string.hE<gt>\n"
2026 "#include E<lt>sys/socket.hE<gt>\n"
2027 "#include E<lt>sys/types.hE<gt>\n"
2028 "#include E<lt>sys/un.hE<gt>\n"
2029 "#include E<lt>unistd.hE<gt>\n"
2030 "\\&\n"
2031 "#include \"connection.h\"\n"
2032 "\\&\n"
2033 "int\n"
2034 "main(int argc, char *argv[])\n"
2035 "{\n"
2036 " int ret;\n"
2037 " int data_socket;\n"
2038 " ssize_t r, w;\n"
2039 " struct sockaddr_un addr;\n"
2040 " char buffer[BUFFER_SIZE];\n"
2041 "\\&\n"
2042 " /* Create local socket. */\n"
2043 "\\&\n"
2044 " data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);\n"
2045 " if (data_socket == -1) {\n"
2046 " perror(\"socket\");\n"
2047 " exit(EXIT_FAILURE);\n"
2048 " }\n"
2049 "\\&\n"
2050 " /*\n"
2051 " * For portability clear the whole structure, since some\n"
2052 " * implementations have additional (nonstandard) fields in\n"
2053 " * the structure.\n"
2054 " */\n"
2055 "\\&\n"
2056 " memset(&addr, 0, sizeof(addr));\n"
2057 "\\&\n"
2058 " /* Connect socket to socket address. */\n"
2059 "\\&\n"
2060 " addr.sun_family = AF_UNIX;\n"
2061 " strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1);\n"
2062 "\\&\n"
2063 " ret = connect(data_socket, (const struct sockaddr *) &addr,\n"
2064 " sizeof(addr));\n"
2065 " if (ret == -1) {\n"
2066 " fprintf(stderr, \"The server is down.\\[rs]n\");\n"
2067 " exit(EXIT_FAILURE);\n"
2068 " }\n"
2069 "\\&\n"
2070 " /* Send arguments. */\n"
2071 "\\&\n"
2072 " for (int i = 1; i E<lt> argc; ++i) {\n"
2073 " w = write(data_socket, argv[i], strlen(argv[i]) + 1);\n"
2074 " if (w == -1) {\n"
2075 " perror(\"write\");\n"
2076 " break;\n"
2077 " }\n"
2078 " }\n"
2079 "\\&\n"
2080 " /* Request result. */\n"
2081 "\\&\n"
2082 " strcpy(buffer, \"END\");\n"
2083 " w = write(data_socket, buffer, strlen(buffer) + 1);\n"
2084 " if (w == -1) {\n"
2085 " perror(\"write\");\n"
2086 " exit(EXIT_FAILURE);\n"
2087 " }\n"
2088 "\\&\n"
2089 " /* Receive result. */\n"
2090 "\\&\n"
2091 " r = read(data_socket, buffer, sizeof(buffer));\n"
2092 " if (r == -1) {\n"
2093 " perror(\"read\");\n"
2094 " exit(EXIT_FAILURE);\n"
2095 " }\n"
2096 "\\&\n"
2097 " /* Ensure buffer is 0-terminated. */\n"
2098 "\\&\n"
2099 " buffer[sizeof(buffer) - 1] = 0;\n"
2100 "\\&\n"
2101 " printf(\"Result = %s\\[rs]n\", buffer);\n"
2102 "\\&\n"
2103 " /* Close socket. */\n"
2104 "\\&\n"
2105 " close(data_socket);\n"
2106 "\\&\n"
2107 " exit(EXIT_SUCCESS);\n"
2108 "}\n"
2109 msgstr ""
2110
2111 #. type: TH
2112 #: fedora-44 fedora-rawhide
2113 #, no-wrap
2114 msgid "Linux man-pages 6.13"
2115 msgstr ""
2116
2117 #. type: TH
2118 #: mageia-cauldron
2119 #, no-wrap
2120 msgid "Linux man-pages 6.17"
2121 msgstr ""
2122
2123 #. type: TH
2124 #: opensuse-leap-16-1 opensuse-tumbleweed
2125 #, no-wrap
2126 msgid "Linux man-pages (unreleased)"
2127 msgstr ""