From 8c27050808de2ffb67e8d84e3dca98c53dffafb0 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Fri, 16 May 2025 14:18:48 +0200 Subject: [PATCH] man/man2/close.2: Move part of NOTES into a new CAVEATS section Signed-off-by: Alejandro Colomar --- man/man2/close.2 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/man/man2/close.2 b/man/man2/close.2 index f7a26054f..b75d2ef3f 100644 --- a/man/man2/close.2 +++ b/man/man2/close.2 @@ -74,7 +74,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 @@ -83,6 +83,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. @@ -90,13 +97,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 -- 2.47.2