aboutsummaryrefslogtreecommitdiffstats
path: root/man/man2/close.2
diff options
context:
space:
mode:
Diffstat (limited to 'man/man2/close.2')
-rw-r--r--man/man2/close.237
1 files changed, 14 insertions, 23 deletions
diff --git a/man/man2/close.2 b/man/man2/close.2
index a19255a20d..56a3caaafd 100644
--- a/man/man2/close.2
+++ b/man/man2/close.2
@@ -75,7 +75,7 @@ subsequent
or
.BR close ().
.P
-See NOTES for a discussion of why
+See CAVEATS for a discussion of why
.BR close ()
should not be retried after an error.
.SH STANDARDS
@@ -84,6 +84,13 @@ POSIX.1-2008.
POSIX.1-2001, SVr4, 4.3BSD.
.\" SVr4 documents an additional ENOLINK error condition.
.SH NOTES
+The close-on-exec file descriptor flag can be used to ensure
+that a file descriptor is automatically closed upon a successful
+.BR execve (2);
+see
+.BR fcntl (2)
+for details.
+.SH CAVEATS
A successful close does not guarantee that the data has been successfully
saved to disk, as the kernel uses the buffer cache to defer writes.
Typically, filesystems do not flush buffers when a file is closed.
@@ -91,13 +98,6 @@ If you need to be sure that
the data is physically stored on the underlying disk, use
.BR fsync (2).
(It will depend on the disk hardware at this point.)
-.P
-The close-on-exec file descriptor flag can be used to ensure
-that a file descriptor is automatically closed upon a successful
-.BR execve (2);
-see
-.BR fcntl (2)
-for details.
.\"
.SS Multithreaded processes and close()
It is probably unwise to close file descriptors while
@@ -192,10 +192,7 @@ Many other implementations similarly always close the file descriptor
meaning that the file descriptor was invalid)
even if they subsequently report an error on return from
.BR close ().
-POSIX.1 is currently silent on this point,
-but there are plans to mandate this behavior in the next major release
-.\" Issue 8
-of the standard.
+POSIX.1-2008 was silent on this point.
.P
A careful programmer who wants to know about I/O errors may precede
.BR close ()
@@ -207,7 +204,7 @@ The
error is a somewhat special case.
Regarding the
.B EINTR
-error, POSIX.1-2008 says:
+error, POSIX.1-2008 said:
.P
.RS
If
@@ -244,16 +241,10 @@ must not be called again after an
error, and on at least one,
.BR close ()
must be called again.
-There are plans to address this conundrum for
-the next major release of the POSIX.1 standard.
-.\" FIXME . for later review when Issue 8 is one day released...
-.\" POSIX proposes further changes for EINTR
-.\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
-.\" http://austingroupbugs.net/view.php?id=529
-.\"
-.\" FIXME .
-.\" Review the following glibc bug later
-.\" https://sourceware.org/bugzilla/show_bug.cgi?id=14627
+.P
+POSIX.1-2024 standardized the behavior of HP-UX,
+making Linux and many other implementations non-conforming.
+There are no plans to change the behavior on Linux.
.SH SEE ALSO
.BR close_range (2),
.BR fcntl (2),