summaryrefslogtreecommitdiffstats
path: root/templates/man2/close_range.2.pot
blob: bbc52caac1c08428d0a8e9f74b867053fdddac08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-06-01 05:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: TH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "close_range"
msgstr ""

#. type: TH
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid "2024-05-02"
msgstr ""

#. type: TH
#: archlinux debian-unstable
#, no-wrap
msgid "Linux man-pages 6.8"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "NAME"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "close_range - close all file descriptors in a given range"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "LIBRARY"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Standard C library (I<libc>, I<-lc>)"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "SYNOPSIS"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
#, no-wrap
msgid ""
"B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
"B<#include E<lt>unistd.hE<gt>>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
#, no-wrap
msgid ""
"B<#include E<lt>linux/close_range.hE<gt>> /* Definition of B<CLOSE_RANGE_*>\n"
"                                  constants */\n"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
#, no-wrap
msgid "B<int close_range(unsigned int >I<first>B<, unsigned int >I<last>B<, int >I<flags>B<);>\n"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "DESCRIPTION"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The B<close_range>()  system call closes all open file descriptors from "
"I<first> to I<last> (included)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Errors closing a given file descriptor are currently ignored."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "I<flags> is a bit mask containing 0 or more of the following:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<CLOSE_RANGE_CLOEXEC> (since Linux 5.11)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Set the close-on-exec flag on the specified file descriptors, rather than "
"immediately closing them."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<CLOSE_RANGE_UNSHARE>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Unshare the specified file descriptors from any other processes before "
"closing them, avoiding races with other threads sharing the file descriptor "
"table."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "RETURN VALUE"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"On success, B<close_range>()  returns 0.  On error, -1 is returned and "
"I<errno> is set to indicate the error."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "ERRORS"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<EINVAL>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "I<flags> is not valid, or I<first> is greater than I<last>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The following can occur with B<CLOSE_RANGE_UNSHARE> (when constructing the "
"new descriptor table):"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<EMFILE>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The number of open file descriptors exceeds the limit specified in I</proc/"
"sys/fs/nr_open> (see B<proc>(5)).  This error can occur in situations where "
"that limit was lowered before a call to B<close_range>()  where the "
"B<CLOSE_RANGE_UNSHARE> flag is specified."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<ENOMEM>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Insufficient kernel memory was available."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "STANDARDS"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
msgid "None."
msgstr ""

#. type: SH
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "HISTORY"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
msgid "FreeBSD.  Linux 5.9, glibc 2.34."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "NOTES"
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Closing all open file descriptors"
msgstr ""

#.  278a5fbaed89dacd04e9d052f4594ffd0e0585de
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"To avoid blindly closing file descriptors in the range of possible file "
"descriptors, this is sometimes implemented (on Linux)  by listing open file "
"descriptors in I</proc/self/fd/> and calling B<close>(2)  on each one.  "
"B<close_range>()  can take care of this without requiring I</proc> and "
"within a single system call, which provides significant performance benefits."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Closing file descriptors before exec"
msgstr ""

#.  60997c3d45d9a67daf01c56d805ae4fec37e0bd8
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "File descriptors can be closed safely using"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid ""
"/* we don't want anything past stderr here */\n"
"close_range(3, \\[ti]0U, CLOSE_RANGE_UNSHARE);\n"
"execve(....);\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "B<CLOSE_RANGE_UNSHARE> is conceptually equivalent to"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid ""
"unshare(CLONE_FILES);\n"
"close_range(first, last, 0);\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"but can be more efficient: if the unshared range extends past the current "
"maximum number of file descriptors allocated in the caller's file descriptor "
"table (the common case when I<last> is \\[ti]0U), the kernel will unshare a "
"new file descriptor table for the caller up to I<first>, copying as few file "
"descriptors as possible.  This avoids subsequent B<close>(2)  calls "
"entirely; the whole operation is complete once the table is unshared."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Closing files on exec"
msgstr ""

#.  582f1fb6b721facf04848d2ca57f34468da1813e
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"This is particularly useful in cases where multiple pre-B<exec> setup steps "
"risk conflicting with each other.  For example, setting up a B<seccomp>(2)  "
"profile can conflict with a B<close_range>()  call: if the file descriptors "
"are closed before the B<seccomp>(2)  profile is set up, the profile setup "
"can't use them itself, or control their closure; if the file descriptors are "
"closed afterwards, the seccomp profile can't block the B<close_range>()  "
"call or any fallbacks.  Using B<CLOSE_RANGE_CLOEXEC> avoids this: the "
"descriptors can be marked before the B<seccomp>(2)  profile is set up, and "
"the profile can control access to B<close_range>()  without affecting the "
"calling process."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "EXAMPLES"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The program shown below opens the files named in its command-line arguments, "
"displays the list of files that it has opened (by iterating through the "
"entries in I</proc/PID/fd>), uses B<close_range>()  to close all file "
"descriptors greater than or equal to 3, and then once more displays the "
"process's list of open files.  The following example demonstrates the use of "
"the program:"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid ""
"$ B<touch /tmp/a /tmp/b /tmp/c>\n"
"$ B<./a.out /tmp/a /tmp/b /tmp/c>\n"
"/tmp/a opened as FD 3\n"
"/tmp/b opened as FD 4\n"
"/tmp/c opened as FD 5\n"
"/proc/self/fd/0 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/1 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/2 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/3 ==E<gt> /tmp/a\n"
"/proc/self/fd/4 ==E<gt> /tmp/b\n"
"/proc/self/fd/5 ==E<gt> /tmp/b\n"
"/proc/self/fd/6 ==E<gt> /proc/9005/fd\n"
"========= About to call close_range() =======\n"
"/proc/self/fd/0 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/1 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/2 ==E<gt> /dev/pts/1\n"
"/proc/self/fd/3 ==E<gt> /proc/9005/fd\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Note that the lines showing the pathname I</proc/9005/fd> result from the "
"calls to B<opendir>(3)."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Program source"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid ""
"#define _GNU_SOURCE\n"
"#include E<lt>dirent.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>limits.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>sys/types.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
"\\&\n"
"/* Show the contents of the symbolic links in /proc/self/fd */\n"
"\\&\n"
"static void\n"
"show_fds(void)\n"
"{\n"
"    DIR            *dirp;\n"
"    char           path[PATH_MAX], target[PATH_MAX];\n"
"    ssize_t        len;\n"
"    struct dirent  *dp;\n"
"\\&\n"
"    dirp = opendir(\"/proc/self/fd\");\n"
"    if (dirp  == NULL) {\n"
"        perror(\"opendir\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    for (;;) {\n"
"        dp = readdir(dirp);\n"
"        if (dp == NULL)\n"
"            break;\n"
"\\&\n"
"        if (dp-E<gt>d_type == DT_LNK) {\n"
"            snprintf(path, sizeof(path), \"/proc/self/fd/%s\",\n"
"                     dp-E<gt>d_name);\n"
"\\&\n"
"            len = readlink(path, target, sizeof(target));\n"
"            printf(\"%s ==E<gt> %.*s\\en\", path, (int) len, target);\n"
"        }\n"
"    }\n"
"\\&\n"
"    closedir(dirp);\n"
"}\n"
"\\&\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int  fd;\n"
"\\&\n"
"    for (size_t j = 1; j E<lt> argc; j++) {\n"
"        fd = open(argv[j], O_RDONLY);\n"
"        if (fd == -1) {\n"
"            perror(argv[j]);\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"        printf(\"%s opened as FD %d\\en\", argv[j], fd);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"\\&\n"
"    printf(\"========= About to call close_range() =======\\en\");\n"
"\\&\n"
"    if (close_range(3, \\[ti]0U, 0) == -1) {\n"
"        perror(\"close_range\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"    exit(EXIT_FAILURE);\n"
"}\n"
msgstr ""

#.  SRC END
#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "SEE ALSO"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "B<close>(2)"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "2023-02-10"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "Linux man-pages 6.03"
msgstr ""

#. type: Plain text
#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6
#, no-wrap
msgid "B<#include E<lt>linux/close_range.hE<gt>>\n"
msgstr ""

#. type: Plain text
#: debian-bookworm fedora-40 mageia-cauldron opensuse-leap-15-6
#, no-wrap
msgid ""
"B<int close_range(unsigned int >I<first>B<, unsigned int >I<last>B<,>\n"
"B<                unsigned int >I<flags>B<);>\n"
msgstr ""

#. type: SH
#: debian-bookworm
#, no-wrap
msgid "VERSIONS"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<close_range>()  first appeared in Linux 5.9.  Library support was added in "
"glibc 2.34."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<close_range>()  is a nonstandard function that is also present on FreeBSD."
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"#define _GNU_SOURCE\n"
"#include E<lt>dirent.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>limits.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>sys/syscall.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "/* Show the contents of the symbolic links in /proc/self/fd */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"static void\n"
"show_fds(void)\n"
"{\n"
"    DIR            *dirp;\n"
"    char           path[PATH_MAX], target[PATH_MAX];\n"
"    ssize_t        len;\n"
"    struct dirent  *dp;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    dirp = opendir(\"/proc/self/fd\");\n"
"    if (dirp  == NULL) {\n"
"        perror(\"opendir\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    for (;;) {\n"
"        dp = readdir(dirp);\n"
"        if (dp == NULL)\n"
"            break;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        if (dp-E<gt>d_type == DT_LNK) {\n"
"            snprintf(path, sizeof(path), \"/proc/self/fd/%s\",\n"
"                     dp-E<gt>d_name);\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"            len = readlink(path, target, sizeof(target));\n"
"            printf(\"%s ==E<gt> %.*s\\en\", path, (int) len, target);\n"
"        }\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    closedir(dirp);\n"
"}\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int  fd;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    for (size_t j = 1; j E<lt> argc; j++) {\n"
"        fd = open(argv[j], O_RDONLY);\n"
"        if (fd == -1) {\n"
"            perror(argv[j]);\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"        printf(\"%s opened as FD %d\\en\", argv[j], fd);\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    show_fds();\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    printf(\"========= About to call close_range() =======\\en\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    if (syscall(SYS_close_range, 3, \\[ti]0U, 0) == -1) {\n"
"        perror(\"close_range\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    show_fds();\n"
"    exit(EXIT_FAILURE);\n"
"}\n"
msgstr ""

#. type: TH
#: fedora-40 mageia-cauldron
#, no-wrap
msgid "2023-10-31"
msgstr ""

#. type: TH
#: fedora-40 mageia-cauldron
#, no-wrap
msgid "Linux man-pages 6.06"
msgstr ""

#. type: Plain text
#: fedora-40 mageia-cauldron
#, no-wrap
msgid ""
"#define _GNU_SOURCE\n"
"#include E<lt>dirent.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>limits.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>sys/syscall.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
"\\&\n"
"/* Show the contents of the symbolic links in /proc/self/fd */\n"
"\\&\n"
"static void\n"
"show_fds(void)\n"
"{\n"
"    DIR            *dirp;\n"
"    char           path[PATH_MAX], target[PATH_MAX];\n"
"    ssize_t        len;\n"
"    struct dirent  *dp;\n"
"\\&\n"
"    dirp = opendir(\"/proc/self/fd\");\n"
"    if (dirp  == NULL) {\n"
"        perror(\"opendir\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    for (;;) {\n"
"        dp = readdir(dirp);\n"
"        if (dp == NULL)\n"
"            break;\n"
"\\&\n"
"        if (dp-E<gt>d_type == DT_LNK) {\n"
"            snprintf(path, sizeof(path), \"/proc/self/fd/%s\",\n"
"                     dp-E<gt>d_name);\n"
"\\&\n"
"            len = readlink(path, target, sizeof(target));\n"
"            printf(\"%s ==E<gt> %.*s\\en\", path, (int) len, target);\n"
"        }\n"
"    }\n"
"\\&\n"
"    closedir(dirp);\n"
"}\n"
"\\&\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int  fd;\n"
"\\&\n"
"    for (size_t j = 1; j E<lt> argc; j++) {\n"
"        fd = open(argv[j], O_RDONLY);\n"
"        if (fd == -1) {\n"
"            perror(argv[j]);\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"        printf(\"%s opened as FD %d\\en\", argv[j], fd);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"\\&\n"
"    printf(\"========= About to call close_range() =======\\en\");\n"
"\\&\n"
"    if (syscall(SYS_close_range, 3, \\[ti]0U, 0) == -1) {\n"
"        perror(\"close_range\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"    exit(EXIT_FAILURE);\n"
"}\n"
msgstr ""

#. type: TH
#: fedora-rawhide
#, no-wrap
msgid "2024-02-25"
msgstr ""

#. type: TH
#: fedora-rawhide
#, no-wrap
msgid "Linux man-pages 6.7"
msgstr ""

#. type: Plain text
#: fedora-rawhide
#, no-wrap
msgid ""
"#define _GNU_SOURCE\n"
"#include E<lt>dirent.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>limits.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
"\\&\n"
"/* Show the contents of the symbolic links in /proc/self/fd */\n"
"\\&\n"
"static void\n"
"show_fds(void)\n"
"{\n"
"    DIR            *dirp;\n"
"    char           path[PATH_MAX], target[PATH_MAX];\n"
"    ssize_t        len;\n"
"    struct dirent  *dp;\n"
"\\&\n"
"    dirp = opendir(\"/proc/self/fd\");\n"
"    if (dirp  == NULL) {\n"
"        perror(\"opendir\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    for (;;) {\n"
"        dp = readdir(dirp);\n"
"        if (dp == NULL)\n"
"            break;\n"
"\\&\n"
"        if (dp-E<gt>d_type == DT_LNK) {\n"
"            snprintf(path, sizeof(path), \"/proc/self/fd/%s\",\n"
"                     dp-E<gt>d_name);\n"
"\\&\n"
"            len = readlink(path, target, sizeof(target));\n"
"            printf(\"%s ==E<gt> %.*s\\en\", path, (int) len, target);\n"
"        }\n"
"    }\n"
"\\&\n"
"    closedir(dirp);\n"
"}\n"
"\\&\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int  fd;\n"
"\\&\n"
"    for (size_t j = 1; j E<lt> argc; j++) {\n"
"        fd = open(argv[j], O_RDONLY);\n"
"        if (fd == -1) {\n"
"            perror(argv[j]);\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"        printf(\"%s opened as FD %d\\en\", argv[j], fd);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"\\&\n"
"    printf(\"========= About to call close_range() =======\\en\");\n"
"\\&\n"
"    if (close_range(3, \\[ti]0U, 0) == -1) {\n"
"        perror(\"close_range\");\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    show_fds();\n"
"    exit(EXIT_FAILURE);\n"
"}\n"
msgstr ""

#. type: TH
#: opensuse-leap-15-6
#, no-wrap
msgid "2023-03-30"
msgstr ""

#. type: TH
#: opensuse-leap-15-6
#, no-wrap
msgid "Linux man-pages 6.04"
msgstr ""

#. type: TH
#: opensuse-tumbleweed
#, no-wrap
msgid "Linux man-pages (unreleased)"
msgstr ""