Debian Codegraph @

templates/man2/close.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:20+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 "close"
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 "close - close a file descriptor"
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 close(int >I<fd>B<);>\n"
84 msgstr ""
85
86 #. type: SH
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid "DESCRIPTION"
91 msgstr ""
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 msgid ""
97 "B<close>() closes a file descriptor, so that it no longer refers to any "
98 "file and may be reused. Any record locks (see B<fcntl>(2)) held on the "
99 "file it was associated with, and owned by the process, are removed "
100 "regardless of the file descriptor that was used to obtain the lock. This "
101 "has some unfortunate consequences and one should be extra careful when using "
102 "advisory record locking. See B<fcntl>(2) for discussion of the risks and "
103 "consequences as well as for the (probably preferred) open file description "
104 "locks."
105 msgstr ""
106
107 #. type: Plain text
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 msgid ""
111 "If I<fd> is the last file descriptor referring to the underlying open file "
112 "description (see B<open>(2)), the resources associated with the open file "
113 "description are freed; if the file descriptor was the last reference to a "
114 "file which has been removed using B<unlink>(2), the file is deleted."
115 msgstr ""
116
117 #. type: SH
118 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
119 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
120 #, no-wrap
121 msgid "RETURN VALUE"
122 msgstr ""
123
124 #. type: Plain text
125 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
126 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
127 msgid ""
128 "B<close>() returns zero on success. On error, -1 is returned, and I<errno> "
129 "is set to indicate the error."
130 msgstr ""
131
132 #. type: SH
133 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
134 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
135 #, no-wrap
136 msgid "ERRORS"
137 msgstr ""
138
139 #. type: TP
140 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
141 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
142 #, no-wrap
143 msgid "B<EBADF>"
144 msgstr ""
145
146 #. type: Plain text
147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
149 msgid "I<fd> isn't a valid open file descriptor."
150 msgstr ""
151
152 #. type: TP
153 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
154 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
155 #, no-wrap
156 msgid "B<EINTR>"
157 msgstr ""
158
159 #. Though, it's in doubt whether this error can ever occur; see
160 #. https://lwn.net/Articles/576478/ "Returning EINTR from close()"
161 #. type: Plain text
162 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
163 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
164 msgid "The B<close>() call was interrupted by a signal; see B<signal>(7)."
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<EIO>"
172 msgstr ""
173
174 #. type: Plain text
175 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
176 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
177 msgid "An I/O error occurred."
178 msgstr ""
179
180 #. type: TP
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 #, no-wrap
184 msgid "B<ENOSPC>"
185 msgstr ""
186
187 #. type: TQ
188 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
189 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
190 #, no-wrap
191 msgid "B<EDQUOT>"
192 msgstr ""
193
194 #. type: Plain text
195 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
196 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
197 msgid ""
198 "On NFS, these errors are not normally reported against the first write which "
199 "exceeds the available storage space, but instead against a subsequent "
200 "B<write>(2), B<fsync>(2), or B<close>()."
201 msgstr ""
202
203 #. type: Plain text
204 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
205 #: opensuse-tumbleweed
206 msgid ""
207 "See CAVEATS for a discussion of why B<close>() should not be retried after "
208 "an error."
209 msgstr ""
210
211 #. type: SH
212 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
213 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
214 #, no-wrap
215 msgid "STANDARDS"
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 "POSIX.1-2008."
222 msgstr ""
223
224 #. type: SH
225 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
226 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
227 #, no-wrap
228 msgid "HISTORY"
229 msgstr ""
230
231 #. SVr4 documents an additional ENOLINK error condition.
232 #. type: Plain text
233 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
234 #: opensuse-tumbleweed
235 msgid "4.3BSD, SVr4, POSIX.1-1988."
236 msgstr ""
237
238 #. type: SH
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 #, no-wrap
242 msgid "NOTES"
243 msgstr ""
244
245 #. type: Plain text
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 msgid ""
249 "The close-on-exec file descriptor flag can be used to ensure that a file "
250 "descriptor is automatically closed upon a successful B<execve>(2); see "
251 "B<fcntl>(2) for details."
252 msgstr ""
253
254 #. type: SH
255 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
256 #: opensuse-tumbleweed
257 #, no-wrap
258 msgid "CAVEATS"
259 msgstr ""
260
261 #. type: Plain text
262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
264 msgid ""
265 "A successful close does not guarantee that the data has been successfully "
266 "saved to disk, as the kernel uses the buffer cache to defer writes. "
267 "Typically, filesystems do not flush buffers when a file is closed. If you "
268 "need to be sure that the data is physically stored on the underlying disk, "
269 "use B<fsync>(2). (It will depend on the disk hardware at this point.)"
270 msgstr ""
271
272 #. type: SS
273 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
274 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
275 #, no-wrap
276 msgid "Multithreaded processes and close()"
277 msgstr ""
278
279 #. #-#-#-#-# archlinux: close.2.pot (PACKAGE VERSION) #-#-#-#-#
280 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
281 #. From: Fredrik Noring <[email protected]>
282 #. One such race involves signals and ERESTARTSYS. If a file descriptor
283 #. in use by a system call is closed and then reused by, e.g., an
284 #. independent open() in some unrelated thread, before the original system
285 #. call has restarted after ERESTARTSYS, the original system call will
286 #. later restart with the reused file descriptor. This is most likely a
287 #. serious programming error.
288 #. type: Plain text
289 #. #-#-#-#-# debian-trixie: close.2.pot (PACKAGE VERSION) #-#-#-#-#
290 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
291 #. From: Fredrik Noring <[email protected]>
292 #. One such race involves signals and ERESTARTSYS. If a file descriptor
293 #. in use by a system call is closed and then reused by e.g. an
294 #. independent open() in some unrelated thread, before the original system
295 #. call has restarted after ERESTARTSYS, the original system call will
296 #. later restart with the reused file descriptor. This is most likely a
297 #. serious programming error.
298 #. type: Plain text
299 #. #-#-#-#-# debian-unstable: close.2.pot (PACKAGE VERSION) #-#-#-#-#
300 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
301 #. From: Fredrik Noring <[email protected]>
302 #. One such race involves signals and ERESTARTSYS. If a file descriptor
303 #. in use by a system call is closed and then reused by, e.g., an
304 #. independent open() in some unrelated thread, before the original system
305 #. call has restarted after ERESTARTSYS, the original system call will
306 #. later restart with the reused file descriptor. This is most likely a
307 #. serious programming error.
308 #. type: Plain text
309 #. #-#-#-#-# fedora-44: close.2.pot (PACKAGE VERSION) #-#-#-#-#
310 #. type: Plain text
311 #. #-#-#-#-# fedora-rawhide: close.2.pot (PACKAGE VERSION) #-#-#-#-#
312 #. type: Plain text
313 #. #-#-#-#-# mageia-cauldron: close.2.pot (PACKAGE VERSION) #-#-#-#-#
314 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
315 #. From: Fredrik Noring <[email protected]>
316 #. One such race involves signals and ERESTARTSYS. If a file descriptor
317 #. in use by a system call is closed and then reused by, e.g., an
318 #. independent open() in some unrelated thread, before the original system
319 #. call has restarted after ERESTARTSYS, the original system call will
320 #. later restart with the reused file descriptor. This is most likely a
321 #. serious programming error.
322 #. type: Plain text
323 #. #-#-#-#-# opensuse-leap-16-1: close.2.pot (PACKAGE VERSION) #-#-#-#-#
324 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
325 #. From: Fredrik Noring <[email protected]>
326 #. One such race involves signals and ERESTARTSYS. If a file descriptor
327 #. in use by a system call is closed and then reused by, e.g., an
328 #. independent open() in some unrelated thread, before the original system
329 #. call has restarted after ERESTARTSYS, the original system call will
330 #. later restart with the reused file descriptor. This is most likely a
331 #. serious programming error.
332 #. type: Plain text
333 #. #-#-#-#-# opensuse-tumbleweed: close.2.pot (PACKAGE VERSION) #-#-#-#-#
334 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
335 #. From: Fredrik Noring <[email protected]>
336 #. One such race involves signals and ERESTARTSYS. If a file descriptor
337 #. in use by a system call is closed and then reused by, e.g., an
338 #. independent open() in some unrelated thread, before the original system
339 #. call has restarted after ERESTARTSYS, the original system call will
340 #. later restart with the reused file descriptor. This is most likely a
341 #. serious programming error.
342 #. type: Plain text
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 msgid ""
346 "It is probably unwise to close file descriptors while they may be in use by "
347 "system calls in other threads in the same process. Since a file descriptor "
348 "may be reused, there are some obscure race conditions that may cause "
349 "unintended side effects."
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 "Furthermore, consider the following scenario where two threads are "
357 "performing operations on the same file descriptor:"
358 msgstr ""
359
360 #. type: IP
361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
363 #, no-wrap
364 msgid "(1)"
365 msgstr ""
366
367 #. type: Plain text
368 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
369 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
370 msgid ""
371 "One thread is blocked in an I/O system call on the file descriptor. For "
372 "example, it is trying to B<write>(2) to a pipe that is already full, or "
373 "trying to B<read>(2) from a stream socket which currently has no available "
374 "data."
375 msgstr ""
376
377 #. type: IP
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid "(2)"
382 msgstr ""
383
384 #. type: Plain text
385 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
386 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
387 msgid "Another thread closes the file descriptor."
388 msgstr ""
389
390 #. type: Plain text
391 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
392 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
393 msgid ""
394 "The behavior in this situation varies across systems. On some systems, when "
395 "the file descriptor is closed, the blocking system call returns immediately "
396 "with an error."
397 msgstr ""
398
399 #. 'struct file' in kernel-speak
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "On Linux (and possibly some other systems), the behavior is different: the "
405 "blocking I/O system call holds a reference to the underlying open file "
406 "description, and this reference keeps the description open until the I/O "
407 "system call completes. (See B<open>(2) for a discussion of open file "
408 "descriptions.) Thus, the blocking system call in the first thread may "
409 "successfully complete after the B<close>() in the second thread."
410 msgstr ""
411
412 #. type: SS
413 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
414 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
415 #, no-wrap
416 msgid "Dealing with error returns from close()"
417 msgstr ""
418
419 #. type: Plain text
420 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
421 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
422 msgid ""
423 "A careful programmer will check the return value of B<close>(), since it is "
424 "quite possible that errors on a previous B<write>(2) operation are reported "
425 "only on the final B<close>() that releases the open file description. "
426 "Failing to check the return value when closing a file may lead to I<silent> "
427 "loss of data. This can especially be observed with NFS and with disk quota."
428 msgstr ""
429
430 #. type: Plain text
431 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
432 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
433 msgid ""
434 "Note, however, that a failure return should be used only for diagnostic "
435 "purposes (i.e., a warning to the application that there may still be I/O "
436 "pending or there may have been failed I/O) or remedial purposes (e.g., "
437 "writing the file once more or creating a backup)."
438 msgstr ""
439
440 #
441 #. The file descriptor is released early in close();
442 #. close() ==> __close_fd():
443 #. __put_unused_fd() ==> __clear_open_fd()
444 #. return filp_close(file, files);
445 #. The errors are returned by filp_close() after the FD has been
446 #. cleared for re-use.
447 #. filp_close()
448 #. type: Plain text
449 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
450 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
451 msgid ""
452 "Retrying the B<close>() after a failure return is the wrong thing to do, "
453 "since this may cause a reused file descriptor from another thread to be "
454 "closed. This can occur because the Linux kernel I<always> releases the file "
455 "descriptor early in the close operation, freeing it for reuse; the steps "
456 "that may return an error, such as flushing data to the filesystem or device, "
457 "occur only later in the close operation."
458 msgstr ""
459
460 #. FreeBSD documents this explicitly. From the look of the source code
461 #. SVR4, ancient SunOS, later Solaris, and AIX all do this.
462 #. type: Plain text
463 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
464 #: opensuse-tumbleweed
465 msgid ""
466 "Many other implementations similarly always close the file descriptor "
467 "(except in the case of B<EBADF>, meaning that the file descriptor was "
468 "invalid) even if they subsequently report an error on return from "
469 "B<close>(). POSIX.1-2008 was silent on this point."
470 msgstr ""
471
472 #. type: Plain text
473 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
474 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
475 msgid ""
476 "A careful programmer who wants to know about I/O errors may precede "
477 "B<close>() with a call to B<fsync>(2)."
478 msgstr ""
479
480 #. type: Plain text
481 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
482 #: opensuse-tumbleweed
483 msgid ""
484 "The B<EINTR> error is a somewhat special case. Regarding the B<EINTR> "
485 "error, POSIX.1-2008 said:"
486 msgstr ""
487
488 #. type: Plain text
489 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
490 #: opensuse-tumbleweed
491 msgid ""
492 "If B<close>() is interrupted by a signal that is to be caught, it shall "
493 "return -1 with I<errno> set to B<EINTR> and the state of I<fd> is "
494 "unspecified."
495 msgstr ""
496
497 #. type: Plain text
498 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
499 #: opensuse-tumbleweed
500 msgid ""
501 "This permits the behavior that occurs on Linux and many other "
502 "implementations, where, as with other errors that may be reported by "
503 "B<close>(), the file descriptor is guaranteed to be closed. However, it "
504 "also permits another possibility: that the implementation returns an "
505 "B<EINTR> error and keeps the file descriptor open. (According to its "
506 "documentation, HP-UX's B<close>() does this.) The caller must then once "
507 "more use B<close>() to close the file descriptor, to avoid file descriptor "
508 "leaks. This divergence in implementation behaviors provides a difficult "
509 "hurdle for portable applications, since on many implementations, B<close>() "
510 "must not be called again after an B<EINTR> error, and on at least one, "
511 "B<close>() must be called again."
512 msgstr ""
513
514 #. type: Plain text
515 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
516 #: opensuse-tumbleweed
517 msgid ""
518 "POSIX.1-2024 standardized the behavior of HP-UX, making Linux and many other "
519 "implementations non-conforming. There are no plans to change the behavior "
520 "on Linux."
521 msgstr ""
522
523 #. type: SH
524 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
525 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
526 #, no-wrap
527 msgid "SEE ALSO"
528 msgstr ""
529
530 #. type: Plain text
531 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
532 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
533 msgid ""
534 "B<close_range>(2), B<fcntl>(2), B<fsync>(2), B<open>(2), B<shutdown>(2), "
535 "B<unlink>(2), B<fclose>(3)"
536 msgstr ""
537
538 #. type: TH
539 #: debian-trixie
540 #, no-wrap
541 msgid "2024-05-02"
542 msgstr ""
543
544 #. type: TH
545 #: debian-trixie
546 #, no-wrap
547 msgid "Linux man-pages 6.9.1"
548 msgstr ""
549
550 #. type: Plain text
551 #: debian-trixie
552 msgid "Standard C library (I<libc>, I<-lc>)"
553 msgstr ""
554
555 #. type: Plain text
556 #: debian-trixie fedora-44 fedora-rawhide
557 msgid ""
558 "See NOTES for a discussion of why B<close>() should not be retried after an "
559 "error."
560 msgstr ""
561
562 #. SVr4 documents an additional ENOLINK error condition.
563 #. type: Plain text
564 #: debian-trixie fedora-44 fedora-rawhide
565 msgid "POSIX.1-2001, SVr4, 4.3BSD."
566 msgstr ""
567
568 #. FreeBSD documents this explicitly. From the look of the source code
569 #. SVR4, ancient SunOS, later Solaris, and AIX all do this.
570 #. Issue 8
571 #. type: Plain text
572 #: debian-trixie fedora-44 fedora-rawhide
573 msgid ""
574 "Many other implementations similarly always close the file descriptor "
575 "(except in the case of B<EBADF>, meaning that the file descriptor was "
576 "invalid) even if they subsequently report an error on return from "
577 "B<close>(). POSIX.1 is currently silent on this point, but there are plans "
578 "to mandate this behavior in the next major release of the standard."
579 msgstr ""
580
581 #. type: Plain text
582 #: debian-trixie fedora-44 fedora-rawhide
583 msgid ""
584 "The B<EINTR> error is a somewhat special case. Regarding the B<EINTR> "
585 "error, POSIX.1-2008 says:"
586 msgstr ""
587
588 #. type: Plain text
589 #: debian-trixie fedora-44 fedora-rawhide
590 msgid ""
591 "If B<close>() is interrupted by a signal that is to be caught, it shall "
592 "return -1 with I<errno> set to B<EINTR> and the state of I<fildes> is "
593 "unspecified."
594 msgstr ""
595
596 #
597 #. FIXME . for later review when Issue 8 is one day released...
598 #. POSIX proposes further changes for EINTR
599 #. http://austingroupbugs.net/tag_view_page.php?tag_id=8
600 #. http://austingroupbugs.net/view.php?id=529
601 #. FIXME .
602 #. Review the following glibc bug later
603 #. https://sourceware.org/bugzilla/show_bug.cgi?id=14627
604 #. type: Plain text
605 #: debian-trixie fedora-44 fedora-rawhide
606 msgid ""
607 "This permits the behavior that occurs on Linux and many other "
608 "implementations, where, as with other errors that may be reported by "
609 "B<close>(), the file descriptor is guaranteed to be closed. However, it "
610 "also permits another possibility: that the implementation returns an "
611 "B<EINTR> error and keeps the file descriptor open. (According to its "
612 "documentation, HP-UX's B<close>() does this.) The caller must then once "
613 "more use B<close>() to close the file descriptor, to avoid file descriptor "
614 "leaks. This divergence in implementation behaviors provides a difficult "
615 "hurdle for portable applications, since on many implementations, B<close>() "
616 "must not be called again after an B<EINTR> error, and on at least one, "
617 "B<close>() must be called again. There are plans to address this conundrum "
618 "for the next major release of the POSIX.1 standard."
619 msgstr ""
620
621 #. type: TH
622 #: fedora-44 fedora-rawhide
623 #, no-wrap
624 msgid "2024-07-23"
625 msgstr ""
626
627 #. type: TH
628 #: fedora-44 fedora-rawhide
629 #, no-wrap
630 msgid "Linux man-pages 6.13"
631 msgstr ""
632
633 #. Date: Tue, 4 Sep 2007 13:57:35 +0200
634 #. From: Fredrik Noring <[email protected]>
635 #. One such race involves signals and ERESTARTSYS. If a file descriptor
636 #. in use by a system call is closed and then reused by e.g. an
637 #. independent open() in some unrelated thread, before the original system
638 #. call has restarted after ERESTARTSYS, the original system call will
639 #. later restart with the reused file descriptor. This is most likely a
640 #. serious programming error.
641 #. type: Plain text
642 #: fedora-44 fedora-rawhide
643 msgid ""
644 "When dealing with sockets, you have to be sure that there is no B<recv>(2) "
645 "still blocking on it on another thread, otherwise it might block forever, "
646 "since no more messages will be send via the socket. Be sure to use "
647 "B<shutdown>(2) to shut down all parts the connection before closing the "
648 "socket."
649 msgstr ""
650
651 #. type: TH
652 #: mageia-cauldron
653 #, no-wrap
654 msgid "Linux man-pages 6.17"
655 msgstr ""
656
657 #. type: TH
658 #: opensuse-leap-16-1 opensuse-tumbleweed
659 #, no-wrap
660 msgid "Linux man-pages (unreleased)"
661 msgstr ""