Skip to contentSkip to conversation

sendfile.2: Fix description of the out_fd

PATCH RESEND In review Akira Fujita 3 participants 5 messages Mar 9, 2011 – Sep 17, 2011 3 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 sendfile.2: Fix description of the out_fd

commit cc56f7de7f00d188c7c4da1e9861581853b9e92f made sendfile(2) can work with any output file.
Therefore the out_fd of sendfile(2) can refer to any file, but current manual (man-pages-3.32) has not been changed so far.

---
 sendfile.2 |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
man2/sendfile.2 +9 -8
@@ -87,15 +87,17 @@ and the file offset will be updated by t
 .I count
 is the number of bytes to copy between the file descriptors.
 
-Presently (Linux 2.6.9):
-.IR in_fd ,
+.IR in_fd
 must correspond to a file which supports
 .BR mmap (2)-like
 operations
-(i.e., it cannot be a socket);
-and
-.I out_fd
-must refer to a socket.
+(i.e., it cannot be a socket).
+
+.IR out_fd
+was required to be a socket, but since Linux 2.6.33 it can be
+any file. If it is a regular file, then
+.BR sendfile()
+changes its offset appropriately.
 
 Applications may wish to fall back to
 .BR read (2)/ write (2)
@@ -165,7 +167,7 @@ to minimize the number of packets and to
 
 In Linux 2.4 and earlier,
 .I out_fd
-could refer to a regular file, and
+could also refer to a regular file, and
 .BR sendfile ()
 changed the current offset of that file.
--

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): 4D771705.1020408-cUW4a6blu5N8UrSeD/[email protected]

#2 lore raw

Hello Akira,

2011/3/9 Akira Fujita <a-fujita-cUW4a6blu5N8UrSeD/[email protected]>:

Quoted 4 lines

commit cc56f7de7f00d188c7c4da1e9861581853b9e92f made sendfile(2) can work with any output file.
Therefore the out_fd of sendfile(2) can refer to any file, but current manual (man-pages-3.32) has not been changed so far.

Thank you for this report! Some notes below.

Quoted 10 lines

---
 sendfile.2 |   16 +++++++++-------

 1 file changed, 9 insertions(+), 7 deletions(-)
man2/sendfile.2    2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +0 -0
@@ -87,15 +87,17 @@ and the file offset will be updated by t

 .I count
 is the number of bytes to copy between the file descriptors.

Quoted 7 lines

-Presently (Linux 2.6.9):
-.IR in_fd ,
+.IR in_fd
 must correspond to a file which supports
 .BR mmap (2)-like
 operations
-(i.e., it cannot be a socket);

You removed that piece, but I believe nothing changed for 'in_fd', so I kept that piece.

Quoted 19 lines
man2/sendfile.2    2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +7 -3
-and
-.I out_fd
-must refer to a socket.
+(i.e., it cannot be a socket).
+
+.IR out_fd
+was required to be a socket, but since Linux 2.6.33 it can be
+any file. If it is a regular file, then
+.BR sendfile()
+changes its offset appropriately.

 Applications may wish to fall back to
 .BR read (2)/ write (2)

man2/sendfile.2    2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +0 -0
@@ -165,7 +167,7 @@ to minimize the number of packets and to
 
  In Linux 2.4 and earlier,

 .I out_fd

man2/sendfile.2    2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +1 -1
-could refer to a regular file, and
+could also refer to a regular file, and
Quoted 2 lines

 .BR sendfile ()
 changed the current offset of that file.

For 3.33 I applied a slightly modified version of you patch; see below.

Cheers,

Michael

man2/sendfile.2 +7 -3
@@ -92,10 +92,14 @@ The
 argument must correspond to a file which supports
 .BR mmap (2)-like
 operations
-(i.e., it cannot be a socket);
-and
+(i.e., it cannot be a socket).
+In Linux kernels before 2.6.33,
 .I out_fd
 must refer to a socket.
+Since Linux 2.6.33 it can be any file.
+If it is a regular file, then
+.BR sendfile()
+changes the file offset offset appropriately.
 
 Applications may wish to fall back to
 .BR read (2)/ write (2)
@@ -165,7 +169,7 @@ to minimize the number of packets and to tune performance.
 
 In Linux 2.4 and earlier,
 .I out_fd
-could refer to a regular file, and
+could also refer to a regular file, and
 .BR sendfile ()
 changed the current offset of that file.
 
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
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): CAKgNAkiSkgjEKDwk6R6RPhGDfJayXZGnxrfRVFcQ9t7K_S3eZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Hello Michael,

Thank you for your work!

Regards,
Akira Fujita

Quoted 80 lines · Michael Kerrisk

Hello Akira,

2011/3/9 Akira Fujita<a-fujita-cUW4a6blu5N8UrSeD/[email protected]>:

Quoted 4 lines

commit cc56f7de7f00d188c7c4da1e9861581853b9e92f made sendfile(2) can work with any output file.
Therefore the out_fd of sendfile(2) can refer to any file, but current manual (man-pages-3.32) has not been changed so far.

Thank you for this report! Some notes below.

Quoted 7 lines
---
  sendfile.2 |   16 +++++++++-------
  1 file changed, 9 insertions(+), 7 deletions(-)

man2/sendfile.2 2011-03-09 10:34:53.000000000 +0900 and the file offset will be updated by t · line 95

Quoted 10 lines
man2/sendfile.2 2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +1 -3
@@ -87,15 +87,17 @@ and the file offset will be updated by t
  .I count
  is the number of bytes to copy between the file descriptors.
 
-Presently (Linux 2.6.9):
-.IR in_fd ,
+.IR in_fd
  must correspond to a file which supports
  .BR mmap (2)-like
  operations
-(i.e., it cannot be a socket);

You removed that piece, but I believe nothing changed for 'in_fd', so I kept that piece.

Quoted 14 lines
man2/sendfile.2 2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +7 -3
-and
-.I out_fd
-must refer to a socket.
+(i.e., it cannot be a socket).
+
+.IR out_fd
+was required to be a socket, but since Linux 2.6.33 it can be
+any file. If it is a regular file, then
+.BR sendfile()
+changes its offset appropriately.
 
  Applications may wish to fall back to
  .BR read (2)/ write (2)

man2/sendfile.2 2011-03-09 10:34:53.000000000 +0900 to minimize the number of packets and to · line 172

Quoted 7 lines
man2/sendfile.2 2011-03-09 10:34:53.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +1 -1
@@ -165,7 +167,7 @@ to minimize the number of packets and to
 
  In Linux 2.4 and earlier,
  .I out_fd
-could refer to a regular file, and
+could also refer to a regular file, and
  .BR sendfile ()
  changed the current offset of that file.

For 3.33 I applied a slightly modified version of you patch; see below.

Cheers,

Michael

man2/sendfile.2 +6 -2
@@ -92,10 +92,14 @@ The
  argument must correspond to a file which supports
  .BR mmap (2)-like
  operations
-(i.e., it cannot be a socket);
-and
+(i.e., it cannot be a socket).
+In Linux kernels before 2.6.33,
  .I out_fd
  must refer to a socket.
+Since Linux 2.6.33 it can be any file.
+If it is a regular file, then
+.BR sendfile()
+changes the file offset offset appropriately.
 
  Applications may wish to fall back to
  .BR read (2)/ write (2)

man2/sendfile.2 to minimize the number of packets and to tune performance. · line 175

Quoted 8 lines
man2/sendfile.2 +1 -1
@@ -165,7 +169,7 @@ to minimize the number of packets and to tune performance.
 
  In Linux 2.4 and earlier,
  .I out_fd
-could refer to a regular file, and
+could also refer to a regular file, and
  .BR sendfile ()
  changed the current offset of that file.
 

--
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

#5 lore raw
In reply to a message not in the archive

HI,

On Sun, Sep 11, 2011 at 7:00 PM, Michael Kerrisk <[email protected]> wrote:
[...]

Quoted 19 lines

For 3.33 I applied a slightly modified version of you patch; see below.

Cheers,

Michael

man2/sendfile.2 +0 -0
@@ -92,10 +92,14 @@ The

 argument must correspond to a file which supports .BR mmap (2)-like
 operations

man2/sendfile.2 +2 -2
-(i.e., it cannot be a socket);
-and
+(i.e., it cannot be a socket).
+In Linux kernels before 2.6.33,

 .I out_fd
 must refer to a socket.

man2/sendfile.2 The · line 102

Quoted 4 lines
man2/sendfile.2 +4 -0
+Since Linux 2.6.33 it can be any file.
+If it is a regular file, then
+.BR sendfile()
+changes the file offset offset appropriately.

You wrote 'offset' twice here, I guess it's a typo, unless I'm missing something...

Thanks,
Stefan.
--
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): CACKs7VDNboqj7XFSkwfzBMazzhSbGGTjt6+M642CgLk5UofXVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw
Quoted 22 lines · Stefan Puiu

HI,

On Sun, Sep 11, 2011 at 7:00 PM, Michael Kerrisk <[email protected]> wrote:
[...]

Quoted 18 lines

For 3.33 I applied a slightly modified version of you patch; see below.

Cheers,

Michael

man2/sendfile.2 +0 -0
@@ -92,10 +92,14 @@ The

 argument must correspond to a file which supports .BR mmap (2)-like
 operations

man2/sendfile.2 +2 -2
-(i.e., it cannot be a socket);
-and
+(i.e., it cannot be a socket).
+In Linux kernels before 2.6.33,

 .I out_fd

Quoted 8 lines

man2/sendfile.2 The · line 102

Quoted 5 lines

 must refer to a socket.

man2/sendfile.2 +4 -0
+Since Linux 2.6.33 it can be any file.
+If it is a regular file, then
+.BR sendfile()
+changes the file offset offset appropriately.

You wrote 'offset' twice here, I guess it's a typo, unless I'm missing something...

Thanks Stefan. Fixed now.

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
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