[RFC v1] man/man2/close.2: CAVEATS: Document divergence from POSIX.1-2024
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-05-16 12:52:11
Also in:
linux-fsdevel
Subsystem:
the rest · Maintainer:
Linus Torvalds
POSIX.1-2024 now mandates a behavior different from what Linux (and many other implementations) does. It requires that we report EINPROGRESS for what now is EINTR. There are no plans to conform to POSIX.1-2024 within the Linux kernel, so document this divergence. Keep POSIX.1-2008 as the standard to which we conform in STANDARDS. Link: <https://sourceware.org/bugzilla/show_bug.cgi?id=14627> Link: <https://pubs.opengroup.org/onlinepubs/9799919799/functions/close.html> Cc: Jan Kara <jack@suse.cz> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Rich Felker <dalias@libc.org> Cc: <redacted> Cc: <redacted> Cc: <redacted> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- Hi, I've prepared this draft for discussion. While doing so, I've noticed the glibc bug ticket, which sounds possibly reasonable: returning 0 instead of reporting an error on EINTR. That would be an option that would make us conforming to POSIX.1-2024. And given that a user can (and must) do nothing after seeing EINTR, returning 0 wouldn't change things. So, I'll leave this patch open for discussion. Have a lovely day! Alex man/man2/close.2 | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/man/man2/close.2 b/man/man2/close.2
index b25ea4de9..9d5e26eed 100644
--- a/man/man2/close.2
+++ b/man/man2/close.2@@ -191,10 +191,7 @@ .SS Dealing with error returns from close() 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 ()
@@ -206,7 +203,7 @@ .SS Dealing with error returns from close() error is a somewhat special case. Regarding the .B EINTR -error, POSIX.1-2008 says: +error, POSIX.1-2008 said: .P .RS If
@@ -243,16 +240,10 @@ .SS Dealing with error returns from close() 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),
Range-diff against v0: -: --------- > 1: efaffc5a4 man/man2/close.2: CAVEATS: Document divergence from POSIX.1-2024 base-commit: 978b017d93e4e32b752b33877e44a8365644630c -- 2.49.0