mmap() improvements from Martin Pool

This commit is contained in:
Michael Kerrisk 2005-03-31 14:42:09 +00:00
parent 042d7c1b37
commit 9fe9d301af
1 changed files with 16 additions and 3 deletions

View File

@ -10,13 +10,16 @@
.\" updated description of in_fd and out_fd for 2.6
.\" Various wording and formatting changes
.\"
.\" 2005-03-31 Martin Pool <mbp@sourcefrog.net> mmap() improvements
.\"
.TH SENDFILE 2 2004-12-17 "Linux Man Page" "Linux Programmer's Manual"
.SH NAME
sendfile \- transfer data between file descriptors
.SH SYNOPSIS
.B #include <sys/sendfile.h>
.sp
.BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" offset ", size_t" " count" );
.BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
offset ", size_t" " count" );
.\" The below is too ugly. Comments about glibc versions belong
.\" in the notes, not in the header.
.\"
@ -32,7 +35,8 @@ sendfile \- transfer data between file descriptors
.\" .br
.\" .B /* No system prototype before glibc 2.1. */
.\" .br
.\" .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" offset ", size_t" " count" )
.\" .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
.\" offset ", size_t" " count" )
.\" .br
.\" .B #endif
.\"
@ -76,6 +80,12 @@ must correspond to a file which supports mmap()-like operations
and
.I out_fd
must refer to a socket.
Applications may wish to fall back to
.BR read (2)/ write (2)
in the case where
.BR sendfile ()
fails with EINVAL or ENOSYS.
.SH NOTES
If you plan to use sendfile for sending files to a TCP socket, but need
to send some header data in front of the file contents, you will find
@ -111,7 +121,9 @@ was not opened for writing.
Bad address.
.TP
.B EINVAL
Descriptor is not valid or locked.
Descriptor is not valid or locked, or an mmap()-like
operation is not available for
.IR in_fd .
.TP
.B EIO
Unspecified error while reading from
@ -131,4 +143,5 @@ with different semantics and prototypes. It should
not be used in portable programs.
.SH "SEE ALSO"
.BR open (2),
.BR mmap (2),
.BR socket (2)