Re: [PATCH 25/32] pipe.7: also mention writev(2) in atomicity sexion
From: Michael Kerrisk (man-pages) <hidden>
Date: 2021-08-08 09:30:14
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hello наб and Alex, On 7/28/21 10:20 PM, Alejandro Colomar wrote:
quoted hunk ↗ jump to hunk
From: наб <redacted> writev(2) notes that buffers don't interleave with other process' (a reasonable question to ask), but points to pipe(7) for an exception. pipe(7) did /not/ mention "writev", "iov", "scat", or "gath", which are, in order, reasonable search terms: this was confusing at best and alarming at worst By mentioning writev(2) in the heading, we clearly note that this sort of interleaving behaviour matches write(2)'s and isn't a concern Signed-off-by: Ahelenia Ziemiańska <redacted> Signed-off-by: Alejandro Colomar <redacted> --- man7/pipe.7 | 2 ++ 1 file changed, 2 insertions(+)diff --git a/man7/pipe.7 b/man7/pipe.7 index c3210320c..29f6cf6cb 100644 --- a/man7/pipe.7 +++ b/man7/pipe.7@@ -246,6 +246,8 @@ limits; see BUGS. .SS PIPE_BUF POSIX.1 says that .BR write (2)s +and +.BR writev (2)s of less than .B PIPE_BUF bytes must be atomic: the output data is written to the pipe as a
I think a different fix is required. On reflection, I don't think the
reference to pipe(7) is needed in writev(2) (mea culpa; I added that
text), and I think the text in pipe(7) could be written to be closer
to the POSIX spec, which doesn't talk about "write() calls", but
simply about "writes". See below.
Cheers,
Michael
commit 0602a20452d7abde429bc46215b203160ab70ec0 (HEAD -> master)
Author: Michael Kerrisk [off-list ref]
Date: Sun Aug 8 11:24:16 2021 +0200
readv.2, pipe.7: Make text on pipe writes more general to avoid a confusion in writev(2)
After a patch proposal from наб triggered by concerns that, when
talking about PIPE_BUF, pipe(7) explicitly mentions write(2) but
not writev(2), I've concluded that the reference in writev(2) to
pipe(7) is not needed (mea culpa; I added that text), and I think
the text in pipe(7) could be written to be closer to the POSIX
spec, which doesn't talk about "write() calls", but simply about
"writes".
Reported-by: наб [off-list ref]
Signed-off-by: Michael Kerrisk [off-list ref]
diff --git a/man2/readv.2 b/man2/readv.2
index bd0a6cd2f..c066c73a5 100644
--- a/man2/readv.2
+++ b/man2/readv.2@@ -141,9 +141,7 @@ are atomic: the data written by .\" Regarding atomicity, see https://bugzilla.kernel.org/show_bug.cgi?id=10596 .BR writev () is written as a single block that is not intermingled with output -from writes in other processes (but see -.BR pipe (7) -for an exception); +from writes in other processes; analogously, .BR readv () is guaranteed to read a contiguous block of data from the file,
diff --git a/man7/pipe.7 b/man7/pipe.7
index c3210320c..d79768fb6 100644
--- a/man7/pipe.7
+++ b/man7/pipe.7@@ -244,9 +244,7 @@ and limits; see BUGS. .\" .SS PIPE_BUF -POSIX.1 says that -.BR write (2)s -of less than +POSIX.1 says that writes of less than .B PIPE_BUF bytes must be atomic: the output data is written to the pipe as a contiguous sequence.
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/