Skip to contentSkip to conversation

sendfile.2: Fix description of the out_fd

PATCH Superseded Akira Fujita 2 participants 3 messages Jan 27, 2011 – Feb 14, 2011 2 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 1/1 sendfile.2: Fix description of the out_fd

Hi,

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.

---
 man2/sendfile.2 |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
man2/sendfile.2 +5 -6
diff -Nrup man-pages-3.32-a/man2/sendfile.2 man-pages-3.32-b/man2/sendfile.2
@@ -87,15 +87,11 @@ 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).
 
 Applications may wish to fall back to
 .BR read (2)/ write (2)
@@ -168,6 +164,9 @@ In Linux 2.4 and earlier,
 could refer to a regular file, and
 .BR sendfile ()
 changed the current offset of that file.
+Since 2.6.33,
+.I out_fd
+can refer to any file.
 
 The original Linux
 .BR sendfile ()

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

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

Hi,

2011/1/27 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.

And I thought I was the only one discovering it recently (beside a few obvious people year ago). :)

Quoted 13 lines

diff -Nrup man-pages-3.32-a/man2/sendfile.2 man-pages-3.32-b/man2/sendfile.2

man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +0 -0
@@ -87,15 +87,11 @@ 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

man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900

Quoted 5 lines
man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +1 -4
-(i.e., it cannot be a socket);
-and
-.I out_fd
-must refer to a socket.
+(i.e., it cannot be a socket).

I don't think that completely removing out_fd socket restriction part is a proper way of fixing this page. Such information should not be lost.
I would add here sth like:

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 sendfile() changes its offset appropriately.

Quoted 5 lines

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

man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +0 -0
@@ -168,6 +164,9 @@ In Linux 2.4 and earlier,

 could refer to a regular file, and

s/could/could also/

man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900

Quoted 6 lines

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

man2/sendfile.2    2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2    2010-12-03 16:01:59.000000000 +0900 +3 -0
+Since 2.6.33,
+.I out_fd
+can refer to any file.

IMO this change shouldn't be mentioned in NOTES section.

Quoted 3 lines

 The original Linux
 .BR sendfile ()

Regards.

Signature · 6 lines
Przemysław 'Przemoc' Pawełczyk
http://przemoc.net/
--
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
#4 lore raw
In reply to a message not in the archive

Hi Przemysław,

Thank you for comment :)
Would you review this patch again?

Regards,
Akira Fujita

---

man2/sendfile.2 2011-02-14 09:02:57.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +9 -7
@@ -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.
 
Quoted 62 lines · Przemysław Pawełczyk

Hi,

2011/1/27 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.

And I thought I was the only one discovering it recently (beside a few obvious people year ago). :)

Quoted 8 lines

diff -Nrup man-pages-3.32-a/man2/sendfile.2 man-pages-3.32-b/man2/sendfile.2

man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +0 -1
@@ -87,15 +87,11 @@ 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):

man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 and the file offset will be updated by t · line 94

Quoted 10 lines
man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +2 -5
-.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).

I don't think that completely removing out_fd socket restriction part is a proper way of fixing this page. Such information should not be lost.
I would add here sth like:

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 sendfile() changes its offset appropriately.

man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 In Linux 2.4 and earlier, · line 164

Quoted 5 lines
man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +0 -0
  Applications may wish to fall back to
  .BR read (2)/ write (2)
@@ -168,6 +164,9 @@ In Linux 2.4 and earlier,
  could refer to a regular file, and

s/could/could also/

man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 In Linux 2.4 and earlier, · line 170

Quoted 6 lines
man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +3 -0
  .BR sendfile ()
  changed the current offset of that file.
 
+Since 2.6.33,
+.I out_fd
+can refer to any file.

IMO this change shouldn't be mentioned in NOTES section.

man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 In Linux 2.4 and earlier, · line 172

Quoted 3 lines
man2/sendfile.2 2011-01-27 16:03:48.000000000 +0900 renamed from man2/sendfile.2 2010-12-03 16:01:59.000000000 +0900 +0 -0
  The original Linux
  .BR sendfile ()

Regards.

Signature · 10 lines
Akira Fujita <a-fujita-cUW4a6blu5N8UrSeD/[email protected]>

The First Fundamental Software Development Group,
Software Development Division,
NEC Software Tohoku, Ltd.

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