Penguin

Differences between current version and predecessor to the previous major change of sendfile(2).

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 2 Last edited on Tuesday, July 15, 2003 11:00:08 pm by PerryLorier
Older page: version 1 Last edited on Tuesday, June 4, 2002 12:23:45 am by perry Revert
@@ -1,109 +1,38 @@
-SENDFILE  
-!!!SENDFILE  
-NAME  
-SYNOPSIS  
-DESCRIPTION  
-NOTES  
-RETURN VALUE  
-ERRORS  
-VERSIONS  
-SEE ALSO  
-----  
-!!NAME  
-  
-  
 sendfile - transfer data between file descriptors 
 !!SYNOPSIS 
  
  
-__#include __ 
+ __#include <sys/sendfile.h> __ 
  
+ __ssize_t sendfile(int__ ''out_fd''__, int__ ''in_fd''__, off_t *__''offset''__, size_t__ ''count''__)__  
  
-__ssize_t sendfile(int__ ''out_fd''__, int__  
-''in_fd''__, off_t *__''offset''__, size_t__  
-''count''__)__  
 !!DESCRIPTION 
+This call copies data between one file descriptor and another. Either or both of these file descriptors may refer to a socket (but see below). ''in_fd'' should be a file  
+descriptor opened for reading and ''out_fd'' should be a descriptor opened for writing. ''offset'' is a pointer to a variable holding the input file pointer position from  
+which sendfile(2) will start reading data. When sendfile(2) returns, this variable will be set to the offset of the byte following the last byte that was read. ''count'' is the number of bytes to copy between file descriptors.  
  
+Because this copying is done within the kernel, sendfile(2) does not need to spend time transferring data to and from user space.  
  
-This call copies data between one file descriptor and  
-another. Either or both of these file descriptors may refer  
-to a socket (but see below). ''in_fd'' should be a file  
-descriptor opened for reading and ''out_fd'' should be a  
-descriptor opened for writing. ''offset'' is a pointer to  
-a variable holding the input file pointer position from  
-which __sendfile__() will start reading data. When  
-__sendfile__() returns, this variable will be set to the  
-offset of the byte following the last byte that was read.  
-''count'' is the number of bytes to copy between file  
-descriptors.  
-  
-  
-Because this copying is done within the kernel,  
-__sendfile__() does not need to spend time transferring  
-data to and from user space.  
 !!NOTES 
+Sendfile does not modify the current file pointer of ''in_fd'', but does for ''out_fd''.  
  
+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, please see the __TCP_CORK__ option in tcp(7) to minimize the number of packets and to tune performance.  
  
-Sendfile does not modify the current file pointer of  
-''in_fd'' , but does for ''out_fd''
+Presently the descriptor from which data is read cannot correspond to a socket , it must correspond to a file which supports mmap(2)-like operations
  
-  
-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, please see the __TCP_CORK__ option in  
-tcp(7) to minimize the number of packets and to tune  
-performance.  
-  
-  
-Presently the descriptor from which data is read cannot  
-correspond to a socket, it must correspond to a file which  
-supports mmap()-like operations.  
 !!RETURN VALUE 
+If the transfer was successful, the number of bytes written to ''out_fd'' is returned. On error, -1 is returned, and ''errno'' is set appropriately.  
  
-  
-If the transfer was successful, the number of bytes written  
-to ''out_fd'' is returned. On error, -1 is returned, and  
-''errno'' is set appropriately.  
 !!ERRORS 
+;[EBADF]: The input file was not opened for reading or the output file was not opened for writing.  
+;[EINVAL]: Descriptor is not valid or locked.  
+;[ENOMEM]: Insufficient memory to read from ''in_fd''.  
+;[EIO]: Unspecified error while reading from ''in_fd''.  
  
-  
-__EBADF__  
-  
-  
-The input file was not opened for reading or the output file  
-was not opened for writing.  
-  
-  
-__EINVAL__  
-  
-  
-Descriptor is not valid or locked.  
-  
-  
-__ENOMEM__  
-  
-  
-Insufficient memory to read from ''in_fd''.  
-  
-  
-__EIO__  
-  
-  
-Unspecified error while reading from  
-''in_fd''.  
 !!VERSIONS 
+sendfile(2) is a new feature in Linux 2.2. The include file <sys/sendfile.h> is present since glibc 2.1.  
  
+Other Unixes often implement sendfile(2) with different semantics and prototypes. It should not be used in portable programs.  
  
-__sendfile__ is a new feature in Linux 2.2. The include  
-file  
-__  
-  
-  
-Other Unixes often implement __sendfile__ with different  
-semantics and prototypes. It should not be used in portable  
-programs.  
 !!SEE ALSO 
-  
-  
 socket(2), open(2) 
-----  
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.