Skip to contentSkip to conversation

Refactoring the description of nonblocking splice behaviour

PATCH In review Mark Hills 2 participants 3 messages May 26, 2015 – Sep 11, 2015 2 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Mark Hills

author
#0 lore raw

PATCH 1/1 Refactoring the description of nonblocking splice behaviour

Rather than the detail of SPLICE_F_NONBLOCK getting long, move this to its own section where it can grow to include the information with greater clarity.

Added a description of the behaviour against a blocking file descriptor, including an important gotcha.

I have aimed to keep to the section headings specified in man-pages(7).

The description that "splice() may nevertheless block because the file descriptors that are spliced to/from may block" remains although I did not observe or investigate this behaviour myself.

---
 man2/splice.2 |   47 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 7 deletions(-)
man2/splice.2 +40 -7
index 035aac4..cf1e2f6 100644
@@ -105,13 +105,11 @@ call);
 in the future, a correct implementation may be restored.
 .TP
 .B SPLICE_F_NONBLOCK
-Do not block on I/O.
-This makes the splice pipe operations nonblocking, but
-.BR splice ()
-may nevertheless block because the file descriptors that
-are spliced to/from may block (unless they have the
-.B O_NONBLOCK
-flag set).
+Make the splice operation itself nonblocking. See the
+.B NOTES
+on
+.B Nonblocking behaviours
+below.
 .TP
 .B SPLICE_F_MORE
 More data will be coming in a subsequent splice.
@@ -184,6 +182,41 @@ library support was added to glibc in version 2.5.
 .SH CONFORMING TO
 This system call is Linux-specific.
 .SH NOTES
+.SS Nonblocking behaviours
+Whether 
+.BR splice ()
+may block is influenced by the
+.B O_NONBLOCK
+flag on 
+.I fd_in
+and
+.IR fd_out ,
+and the 
+.B SPLICE_F_NONBLOCK
+flag.
+
+Without
+.B SPLICE_F_NONBLOCK
+the behaviour of the underlying
+file descriptors defines when the
+.BR splice()
+operation will block.
+
+If
+.B SPLICE_F_NONBLOCK
+is set then the movement of data within
+.BR splice()
+is unblocking.
+However,
+.BR splice()
+may nevertheless block because the file descriptors that
+are spliced to/from may block.
+Care should be taken with this flag as
+.BR splice()
+will not block if data from a blocking file descriptor is not resident
+in memory; there can be a difference in behaviour where file
+content is or is not already cached to RAM.
+.SS Related calls
 The three system calls
 .BR splice (),
 .BR vmsplice (2),
Signature · 7 lines
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1505261556150.21456-dXq1Mi7BeBhiN/[email protected]

#2 lore raw

Hello Mark,

Sorry for the delay in following up. Thanks for the proposal. Could you take a look at the comments below and revise your patch?

Quoted 4 lines · Mark Hills

Rather than the detail of SPLICE_F_NONBLOCK getting long, move this to its own section where it can grow to include the information with greater clarity.

Quoted 8 lines

Added a description of the behaviour against a blocking file descriptor, including an important gotcha.

I have aimed to keep to the section headings specified in man-pages(7).

The description that "splice() may nevertheless block because the file descriptors that are spliced to/from may block" remains although I did not observe or investigate this behaviour myself.

I think the changelog entry could be clearer. It seems to me that the second paragraph is the key point, and it should come at the top. Also, that paragraph could note what the gotcha actually is (see also my comment below). And, then, surely this patch is more than a refactoring, so I'd title the patch differently... not sure what's best here though; do you have a suggestion?

Quoted 10 lines
---
 man2/splice.2 |   47 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 7 deletions(-)
man2/splice.2 +0 -0
index 035aac4..cf1e2f6 100644
@@ -105,13 +105,11 @@ call);
 in the future, a correct implementation may be restored.

man2/splice.2 call); · line 108

Quoted 10 lines
man2/splice.2 +1 -7
 .TP
 .B SPLICE_F_NONBLOCK
-Do not block on I/O.
-This makes the splice pipe operations nonblocking, but
-.BR splice ()
-may nevertheless block because the file descriptors that
-are spliced to/from may block (unless they have the
-.B O_NONBLOCK
-flag set).
+Make the splice operation itself nonblocking. See the

New sentences should start on new lines please.

man2/splice.2 call); · line 111

Quoted 3 lines
man2/splice.2 +3 -0
+.B NOTES
+on
+.B Nonblocking behaviours

man-pages uses American spelling consistently. s/iours/iors/ (and below also)

Quoted 23 lines
man2/splice.2 +16 -0
+below.
 .TP
 .B SPLICE_F_MORE
 More data will be coming in a subsequent splice.
@@ -184,6 +182,41 @@ library support was added to glibc in version 2.5.
 .SH CONFORMING TO
 This system call is Linux-specific.
 .SH NOTES
+.SS Nonblocking behaviours
+Whether 
+.BR splice ()
+may block is influenced by the
+.B O_NONBLOCK
+flag on 
+.I fd_in
+and
+.IR fd_out ,
+and the 
+.B SPLICE_F_NONBLOCK
+flag.
+
+Without
+.B SPLICE_F_NONBLOCK

man2/splice.2 library support was added to glibc in version 2.5. · line 209

Quoted 10 lines
man2/splice.2 +10 -0
+the behaviour of the underlying
+file descriptors defines when the
+.BR splice()
+operation will block.
+
+If
+.B SPLICE_F_NONBLOCK
+is set then the movement of data within
+.BR splice()
+is unblocking.

s/unblocking/nonblocking/

man2/splice.2 library support was added to glibc in version 2.5. · line 218

Quoted 9 lines
man2/splice.2 +9 -0
+However,
+.BR splice()
+may nevertheless block because the file descriptors that
+are spliced to/from may block.
+Care should be taken with this flag as
+.BR splice()
+will not block if data from a blocking file descriptor is not resident
+in memory; there can be a difference in behaviour where file
+content is or is not already cached to RAM.

I'm not disputing your assertion here, but how did you verify this last point? It would be good to include that information in the commit message.

man2/splice.2 library support was added to glibc in version 2.5. · line 222

Quoted 4 lines
man2/splice.2 +1 -0
+.SS Related calls
 The three system calls
 .BR splice (),
 .BR vmsplice (2),

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Mark,

Might you have a chance to look at this?

Thanks,

Michael

Quoted 122 lines · Michael Kerrisk (man-pages)

Hello Mark,

Sorry for the delay in following up. Thanks for the proposal. Could you take a look at the comments below and revise your patch?

Quoted 4 lines · Mark Hills

Rather than the detail of SPLICE_F_NONBLOCK getting long, move this to its own section where it can grow to include the information with greater clarity.

Quoted 8 lines

Added a description of the behaviour against a blocking file descriptor, including an important gotcha.

I have aimed to keep to the section headings specified in man-pages(7).

The description that "splice() may nevertheless block because the file descriptors that are spliced to/from may block" remains although I did not observe or investigate this behaviour myself.

I think the changelog entry could be clearer. It seems to me that the second paragraph is the key point, and it should come at the top. Also, that paragraph could note what the gotcha actually is (see also my comment below). And, then, surely this patch is more than a refactoring, so I'd title the patch differently... not sure what's best here though; do you have a suggestion?

Quoted 10 lines
---
 man2/splice.2 |   47 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 7 deletions(-)
man2/splice.2 +0 -0
index 035aac4..cf1e2f6 100644
@@ -105,13 +105,11 @@ call);
 in the future, a correct implementation may be restored.

man2/splice.2 call); · line 108

Quoted 10 lines
man2/splice.2 +1 -7
 .TP
 .B SPLICE_F_NONBLOCK
-Do not block on I/O.
-This makes the splice pipe operations nonblocking, but
-.BR splice ()
-may nevertheless block because the file descriptors that
-are spliced to/from may block (unless they have the
-.B O_NONBLOCK
-flag set).
+Make the splice operation itself nonblocking. See the

New sentences should start on new lines please.

man2/splice.2 call); · line 111

Quoted 3 lines
man2/splice.2 +3 -0
+.B NOTES
+on
+.B Nonblocking behaviours

man-pages uses American spelling consistently. s/iours/iors/ (and below also)

Quoted 23 lines
man2/splice.2 +16 -0
+below.
 .TP
 .B SPLICE_F_MORE
 More data will be coming in a subsequent splice.
@@ -184,6 +182,41 @@ library support was added to glibc in version 2.5.
 .SH CONFORMING TO
 This system call is Linux-specific.
 .SH NOTES
+.SS Nonblocking behaviours
+Whether
+.BR splice ()
+may block is influenced by the
+.B O_NONBLOCK
+flag on
+.I fd_in
+and
+.IR fd_out ,
+and the
+.B SPLICE_F_NONBLOCK
+flag.
+
+Without
+.B SPLICE_F_NONBLOCK

man2/splice.2 library support was added to glibc in version 2.5. · line 209

Quoted 10 lines
man2/splice.2 +10 -0
+the behaviour of the underlying
+file descriptors defines when the
+.BR splice()
+operation will block.
+
+If
+.B SPLICE_F_NONBLOCK
+is set then the movement of data within
+.BR splice()
+is unblocking.

s/unblocking/nonblocking/

man2/splice.2 library support was added to glibc in version 2.5. · line 218

Quoted 9 lines
man2/splice.2 +9 -0
+However,
+.BR splice()
+may nevertheless block because the file descriptors that
+are spliced to/from may block.
+Care should be taken with this flag as
+.BR splice()
+will not block if data from a blocking file descriptor is not resident
+in memory; there can be a difference in behaviour where file
+content is or is not already cached to RAM.

I'm not disputing your assertion here, but how did you verify this last point? It would be good to include that information in the commit message.

man2/splice.2 library support was added to glibc in version 2.5. · line 222

Quoted 4 lines
man2/splice.2 +1 -0
+.SS Related calls
 The three system calls
 .BR splice (),
 .BR vmsplice (2),

Cheers,

Michael

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html