Debian Codegraph @

templates/man2/pipe.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:35+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 "pipe"
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 "pipe, pipe2 - create pipe"
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>unistd.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 "B<int pipe(int >I<pipefd>B<[2]);>\n"
84 msgstr ""
85
86 #. type: Plain text
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid ""
91 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
92 "B<#include E<lt>fcntl.hE<gt>> /* Definition of B<O_*> constants */\n"
93 "B<#include E<lt>unistd.hE<gt>>\n"
94 msgstr ""
95
96 #. type: Plain text
97 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
98 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
99 #, no-wrap
100 msgid "B<int pipe2(int >I<pipefd>B<[2], int >I<flags>B<);>\n"
101 msgstr ""
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 #, no-wrap
107 msgid ""
108 "/* On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the\n"
109 " following prototype; see VERSIONS */\n"
110 msgstr ""
111
112 #. type: Plain text
113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
115 #, no-wrap
116 msgid ""
117 "B<struct fd_pair {>\n"
118 "B<long fd[2];>\n"
119 "B<};>\n"
120 "B<struct fd_pair pipe(void);>\n"
121 msgstr ""
122
123 #. type: SH
124 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
125 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
126 #, no-wrap
127 msgid "DESCRIPTION"
128 msgstr ""
129
130 #. type: Plain text
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 msgid ""
134 "B<pipe>() creates a pipe, a unidirectional data channel that can be used "
135 "for interprocess communication. The array I<pipefd> is used to return two "
136 "file descriptors referring to the ends of the pipe. I<pipefd[0]> refers to "
137 "the read end of the pipe. I<pipefd[1]> refers to the write end of the "
138 "pipe. Data written to the write end of the pipe is buffered by the kernel "
139 "until it is read from the read end of the pipe. For further details, see "
140 "B<pipe>(7)."
141 msgstr ""
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid ""
147 "If I<flags> is 0, then B<pipe2>() is the same as B<pipe>(). The following "
148 "values can be bitwise ORed in I<flags> to obtain different behavior:"
149 msgstr ""
150
151 #. type: TP
152 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
153 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
154 #, no-wrap
155 msgid "B<O_CLOEXEC>"
156 msgstr ""
157
158 #. type: Plain text
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 msgid ""
162 "Set the close-on-exec (B<FD_CLOEXEC>) flag on the two new file "
163 "descriptors. See the description of the same flag in B<open>(2) for "
164 "reasons why this may be useful."
165 msgstr ""
166
167 #. type: TP
168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
170 #, no-wrap
171 msgid "B<O_DIRECT> (since Linux 3.4)"
172 msgstr ""
173
174 #. commit 9883035ae7edef3ec62ad215611cb8e17d6a1a5d
175 #. type: Plain text
176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
178 msgid ""
179 "Create a pipe that performs I/O in \"packet\" mode. Each B<write>(2) to "
180 "the pipe is dealt with as a separate packet, and B<read>(2)s from the pipe "
181 "will read one packet at a time. Note the following points:"
182 msgstr ""
183
184 #. type: IP
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 #, no-wrap
188 msgid "\\[bu]"
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 msgid ""
195 "Writes of greater than B<PIPE_BUF> bytes (see B<pipe>(7)) will be split "
196 "into multiple packets. The constant B<PIPE_BUF> is defined in "
197 "I<E<lt>limits.hE<gt>>."
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 ""
204 "If a B<read>(2) specifies a buffer size that is smaller than the next "
205 "packet, then the requested number of bytes are read, and the excess bytes in "
206 "the packet are discarded. Specifying a buffer size of B<PIPE_BUF> will be "
207 "sufficient to read the largest possible packets (see the previous point)."
208 msgstr ""
209
210 #. type: Plain text
211 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
212 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
213 msgid ""
214 "Zero-length packets are not supported. (A B<read>(2) that specifies a "
215 "buffer size of zero is a no-op, and returns 0.)"
216 msgstr ""
217
218 #. type: Plain text
219 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
220 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
221 msgid ""
222 "Older kernels that do not support this flag will indicate this via an "
223 "B<EINVAL> error."
224 msgstr ""
225
226 #. commit 0dbf5f20652108106cb822ad7662c786baaa03ff
227 #. FIXME . But, it is not possible to specify O_DIRECT when opening a FIFO
228 #. type: Plain text
229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
231 msgid ""
232 "Since Linux 4.5, it is possible to change the B<O_DIRECT> setting of a pipe "
233 "file descriptor using B<fcntl>(2)."
234 msgstr ""
235
236 #. type: TP
237 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
238 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
239 #, no-wrap
240 msgid "B<O_NONBLOCK>"
241 msgstr ""
242
243 #. type: Plain text
244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
246 msgid ""
247 "Set the B<O_NONBLOCK> file status flag on the open file descriptions "
248 "referred to by the new file descriptors. Using this flag saves extra calls "
249 "to B<fcntl>(2) to achieve the same result."
250 msgstr ""
251
252 #. type: TP
253 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
254 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
255 #, no-wrap
256 msgid "B<O_NOTIFICATION_PIPE>"
257 msgstr ""
258
259 #. commit c73be61cede5882f9605a852414db559c0ebedfd
260 #. type: Plain text
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 msgid ""
264 "Since Linux 5.8, general notification mechanism is built on the top of the "
265 "pipe where kernel splices notification messages into pipes opened by user "
266 "space. The owner of the pipe has to tell the kernel which sources of events "
267 "to watch and filters can also be applied to select which subevents should be "
268 "placed into the pipe."
269 msgstr ""
270
271 #. type: SH
272 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
273 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
274 #, no-wrap
275 msgid "RETURN VALUE"
276 msgstr ""
277
278 #. type: Plain text
279 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
280 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
281 msgid ""
282 "On success, zero is returned. On error, -1 is returned, I<errno> is set to "
283 "indicate the error, and I<pipefd> is left unchanged."
284 msgstr ""
285
286 #. http://austingroupbugs.net/view.php?id=467
287 #. type: Plain text
288 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
289 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
290 msgid ""
291 "On Linux (and other systems), B<pipe>() does not modify I<pipefd> on "
292 "failure. A requirement standardizing this behavior was added in "
293 "POSIX.1-2008 TC2. The Linux-specific B<pipe2>() system call likewise does "
294 "not modify I<pipefd> on failure."
295 msgstr ""
296
297 #. type: SH
298 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
299 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
300 #, no-wrap
301 msgid "ERRORS"
302 msgstr ""
303
304 #. type: TP
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 #, no-wrap
308 msgid "B<EFAULT>"
309 msgstr ""
310
311 #. type: Plain text
312 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
313 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
314 msgid "I<pipefd> is not valid."
315 msgstr ""
316
317 #. type: TP
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid "B<EINVAL>"
322 msgstr ""
323
324 #. type: Plain text
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 msgid "(B<pipe2>()) Invalid value in I<flags>."
328 msgstr ""
329
330 #. type: TP
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid "B<EMFILE>"
335 msgstr ""
336
337 #. type: Plain text
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 msgid ""
341 "The per-process limit on the number of open file descriptors has been "
342 "reached."
343 msgstr ""
344
345 #. type: TP
346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
348 #, no-wrap
349 msgid "B<ENFILE>"
350 msgstr ""
351
352 #. type: Plain text
353 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
354 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
355 msgid ""
356 "The system-wide limit on the total number of open files has been reached."
357 msgstr ""
358
359 #. type: Plain text
360 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
361 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
362 msgid ""
363 "The user hard limit on memory that can be allocated for pipes has been "
364 "reached and the caller is not privileged; see B<pipe>(7)."
365 msgstr ""
366
367 #. type: TP
368 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
369 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
370 #, no-wrap
371 msgid "B<ENOPKG>"
372 msgstr ""
373
374 #. type: Plain text
375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
377 msgid ""
378 "(B<pipe2>()) B<O_NOTIFICATION_PIPE> was passed in I<flags> and support for "
379 "notifications (B<CONFIG_WATCH_QUEUE>) is not compiled into the kernel."
380 msgstr ""
381
382 #. type: SH
383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
385 #, no-wrap
386 msgid "VERSIONS"
387 msgstr ""
388
389 #. See http://math-atlas.sourceforge.net/devel/assembly/64.psabi.1.33.ps.Z
390 #. for example, section 3.2.1 "Registers and the Stack Frame".
391 #. type: Plain text
392 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
393 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
394 msgid ""
395 "The System V ABI on some architectures allows the use of more than one "
396 "register for returning multiple values; several architectures (namely, "
397 "Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64) (ab)use this feature in "
398 "order to implement the B<pipe>() system call in a functional manner: the "
399 "call doesn't take any arguments and returns a pair of file descriptors as "
400 "the return value on success. The glibc B<pipe>() wrapper function "
401 "transparently deals with this. See B<syscall>(2) for information regarding "
402 "registers used for storing second file descriptor."
403 msgstr ""
404
405 #. type: SH
406 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
407 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
408 #, no-wrap
409 msgid "STANDARDS"
410 msgstr ""
411
412 #. type: Plain text
413 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
414 #: opensuse-tumbleweed
415 msgid "POSIX.1-2024."
416 msgstr ""
417
418 #. type: SH
419 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
420 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
421 #, no-wrap
422 msgid "HISTORY"
423 msgstr ""
424
425 #. type: TP
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 #, no-wrap
429 msgid "B<pipe>()"
430 msgstr ""
431
432 #. type: Plain text
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 msgid "POSIX.1-2001."
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<pipe2>()"
443 msgstr ""
444
445 #. type: Plain text
446 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
447 #: opensuse-tumbleweed
448 msgid "POSIX.1-2024. Linux 2.6.27, glibc 2.9."
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 #. fork.2 refers to this example program.
459 #. type: Plain text
460 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
461 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
462 msgid ""
463 "The following program creates a pipe, and then B<fork>(2)s to create a child "
464 "process; the child inherits a duplicate set of file descriptors that refer "
465 "to the same pipe. After the B<fork>(2), each process closes the file "
466 "descriptors that it doesn't need for the pipe (see B<pipe>(7)). The parent "
467 "then writes the string contained in the program's command-line argument to "
468 "the pipe, and the child reads this string a byte at a time from the pipe and "
469 "echoes it on standard output."
470 msgstr ""
471
472 #. type: SS
473 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
474 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
475 #, no-wrap
476 msgid "Program source"
477 msgstr ""
478
479 #. type: Plain text
480 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
481 #: opensuse-leap-16-1 opensuse-tumbleweed
482 #, no-wrap
483 msgid ""
484 "#include E<lt>err.hE<gt>\n"
485 "#include E<lt>stdio.hE<gt>\n"
486 "#include E<lt>stdlib.hE<gt>\n"
487 "#include E<lt>string.hE<gt>\n"
488 "#include E<lt>sys/types.hE<gt>\n"
489 "#include E<lt>sys/wait.hE<gt>\n"
490 "#include E<lt>unistd.hE<gt>\n"
491 "\\&\n"
492 "int\n"
493 "main(int argc, char *argv[])\n"
494 "{\n"
495 " int pipefd[2];\n"
496 " char buf;\n"
497 " pid_t cpid;\n"
498 "\\&\n"
499 " if (argc != 2) {\n"
500 " fprintf(stderr, \"Usage: %s E<lt>stringE<gt>\\[rs]n\", argv[0]);\n"
501 " exit(EXIT_FAILURE);\n"
502 " }\n"
503 "\\&\n"
504 " if (pipe(pipefd) == -1)\n"
505 " err(EXIT_FAILURE, \"pipe\");\n"
506 "\\&\n"
507 " cpid = fork();\n"
508 " if (cpid == -1)\n"
509 " err(EXIT_FAILURE, \"fork\");\n"
510 "\\&\n"
511 " if (cpid == 0) { /* Child reads from pipe */\n"
512 " if (close(pipefd[1]) == -1) /* Close unused write end */\n"
513 " err(EXIT_FAILURE, \"close\");\n"
514 "\\&\n"
515 " while (read(pipefd[0], &buf, 1) E<gt> 0) {\n"
516 " if (write(STDOUT_FILENO, &buf, 1) != 1)\n"
517 " err(EXIT_FAILURE, \"write\");\n"
518 " }\n"
519 "\\&\n"
520 " if (write(STDOUT_FILENO, \"\\[rs]n\", 1) != 1)\n"
521 " err(EXIT_FAILURE, \"write\");\n"
522 " if (close(pipefd[0]) == -1)\n"
523 " err(EXIT_FAILURE, \"close\");\n"
524 " _exit(EXIT_SUCCESS);\n"
525 "\\&\n"
526 " } else { /* Parent writes argv[1] to pipe */\n"
527 " if (close(pipefd[0]) == -1) /* Close unused read end */\n"
528 " err(EXIT_FAILURE, \"close\");\n"
529 " if (write(pipefd[1], argv[1], strlen(argv[1])) != strlen(argv[1]))\n"
530 " err(EXIT_FAILURE, \"write\");\n"
531 " if (close(pipefd[1]) == -1) /* Reader will see EOF */\n"
532 " err(EXIT_FAILURE, \"close\");\n"
533 " if (wait(NULL) == -1) /* Wait for child */\n"
534 " err(EXIT_FAILURE, \"wait\");\n"
535 " exit(EXIT_SUCCESS);\n"
536 " }\n"
537 "}\n"
538 msgstr ""
539
540 #. SRC END
541 #. type: SH
542 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
543 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
544 #, no-wrap
545 msgid "SEE ALSO"
546 msgstr ""
547
548 #. type: Plain text
549 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
550 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
551 msgid ""
552 "B<fork>(2), B<read>(2), B<socketpair>(2), B<splice>(2), B<tee>(2), "
553 "B<vmsplice>(2), B<write>(2), B<popen>(3), B<pipe>(7)"
554 msgstr ""
555
556 #. type: TH
557 #: debian-trixie
558 #, no-wrap
559 msgid "2024-06-15"
560 msgstr ""
561
562 #. type: TH
563 #: debian-trixie
564 #, no-wrap
565 msgid "Linux man-pages 6.9.1"
566 msgstr ""
567
568 #. type: Plain text
569 #: debian-trixie
570 msgid "Standard C library (I<libc>, I<-lc>)"
571 msgstr ""
572
573 #. type: Plain text
574 #: debian-trixie fedora-44 fedora-rawhide
575 msgid "POSIX.1-2008."
576 msgstr ""
577
578 #. type: Plain text
579 #: debian-trixie fedora-44 fedora-rawhide
580 msgid "Linux."
581 msgstr ""
582
583 #. type: Plain text
584 #: debian-trixie fedora-44 fedora-rawhide
585 msgid "Linux 2.6.27, glibc 2.9."
586 msgstr ""
587
588 #. type: Plain text
589 #: debian-trixie
590 #, no-wrap
591 msgid ""
592 "#include E<lt>stdio.hE<gt>\n"
593 "#include E<lt>stdlib.hE<gt>\n"
594 "#include E<lt>string.hE<gt>\n"
595 "#include E<lt>sys/types.hE<gt>\n"
596 "#include E<lt>sys/wait.hE<gt>\n"
597 "#include E<lt>unistd.hE<gt>\n"
598 "\\&\n"
599 "int\n"
600 "main(int argc, char *argv[])\n"
601 "{\n"
602 " int pipefd[2];\n"
603 " char buf;\n"
604 " pid_t cpid;\n"
605 "\\&\n"
606 " if (argc != 2) {\n"
607 " fprintf(stderr, \"Usage: %s E<lt>stringE<gt>\\[rs]n\", argv[0]);\n"
608 " exit(EXIT_FAILURE);\n"
609 " }\n"
610 "\\&\n"
611 " if (pipe(pipefd) == -1) {\n"
612 " perror(\"pipe\");\n"
613 " exit(EXIT_FAILURE);\n"
614 " }\n"
615 "\\&\n"
616 " cpid = fork();\n"
617 " if (cpid == -1) {\n"
618 " perror(\"fork\");\n"
619 " exit(EXIT_FAILURE);\n"
620 " }\n"
621 "\\&\n"
622 " if (cpid == 0) { /* Child reads from pipe */\n"
623 " close(pipefd[1]); /* Close unused write end */\n"
624 "\\&\n"
625 " while (read(pipefd[0], &buf, 1) E<gt> 0)\n"
626 " write(STDOUT_FILENO, &buf, 1);\n"
627 "\\&\n"
628 " write(STDOUT_FILENO, \"\\[rs]n\", 1);\n"
629 " close(pipefd[0]);\n"
630 " _exit(EXIT_SUCCESS);\n"
631 "\\&\n"
632 " } else { /* Parent writes argv[1] to pipe */\n"
633 " close(pipefd[0]); /* Close unused read end */\n"
634 " write(pipefd[1], argv[1], strlen(argv[1]));\n"
635 " close(pipefd[1]); /* Reader will see EOF */\n"
636 " wait(NULL); /* Wait for child */\n"
637 " exit(EXIT_SUCCESS);\n"
638 " }\n"
639 "}\n"
640 msgstr ""
641
642 #. type: TH
643 #: fedora-44 fedora-rawhide
644 #, no-wrap
645 msgid "2024-07-23"
646 msgstr ""
647
648 #. type: TH
649 #: fedora-44 fedora-rawhide
650 #, no-wrap
651 msgid "Linux man-pages 6.13"
652 msgstr ""
653
654 #. type: TH
655 #: mageia-cauldron
656 #, no-wrap
657 msgid "Linux man-pages 6.17"
658 msgstr ""
659
660 #. type: TH
661 #: opensuse-leap-16-1 opensuse-tumbleweed
662 #, no-wrap
663 msgid "Linux man-pages (unreleased)"
664 msgstr ""