sendfile.2 (50476) | sendfile.2 (57686) |
---|---|
1.\" Copyright (c) 1998, David Greenman 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice unmodified, this list of conditions, and the following --- 9 unchanged lines hidden (view full) --- 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" | 1.\" Copyright (c) 1998, David Greenman 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice unmodified, this list of conditions, and the following --- 9 unchanged lines hidden (view full) --- 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/lib/libc/sys/sendfile.2 50476 1999-08-28 00:22:10Z peter $ | 26.\" $FreeBSD: head/lib/libc/sys/sendfile.2 57686 2000-03-02 09:14:21Z sheldonh $ |
27.\" 28.Dd November 5, 1998 29.Dt SENDFILE 2 30.Os 31.Sh NAME 32.Nm sendfile 33.Nd send a file to a socket 34.Sh SYNOPSIS --- 6 unchanged lines hidden (view full) --- 41.Fn Sendfile 42sends a regular file specified by descriptor 43.Fa fd 44out a stream socket specified by descriptor 45.Fa s . 46.Pp 47The 48.Fa offset | 27.\" 28.Dd November 5, 1998 29.Dt SENDFILE 2 30.Os 31.Sh NAME 32.Nm sendfile 33.Nd send a file to a socket 34.Sh SYNOPSIS --- 6 unchanged lines hidden (view full) --- 41.Fn Sendfile 42sends a regular file specified by descriptor 43.Fa fd 44out a stream socket specified by descriptor 45.Fa s . 46.Pp 47The 48.Fa offset |
49argument specifies where to begin in the file. The | 49argument specifies where to begin in the file. 50The |
50.Fa nbytes 51argument specifies how many bytes of the file should be sent, with 0 having the special 52meaning of send until the end of file has been reached. 53.Pp 54An optional header and/or trailer can be sent before and after the file data by specifying 55a pointer to a struct sf_hdtr, which has the following structure: 56.Pp 57.Bd -literal -offset indent -compact --- 4 unchanged lines hidden (view full) --- 62 int trl_cnt; /* number of trailer iovecs */ 63}; 64.Ed 65.Pp 66The 67.Fa headers 68and 69.Fa tailers | 51.Fa nbytes 52argument specifies how many bytes of the file should be sent, with 0 having the special 53meaning of send until the end of file has been reached. 54.Pp 55An optional header and/or trailer can be sent before and after the file data by specifying 56a pointer to a struct sf_hdtr, which has the following structure: 57.Pp 58.Bd -literal -offset indent -compact --- 4 unchanged lines hidden (view full) --- 63 int trl_cnt; /* number of trailer iovecs */ 64}; 65.Ed 66.Pp 67The 68.Fa headers 69and 70.Fa tailers |
70pointers, if non-NULL, point to arrays of struct iovec structures. See the | 71pointers, if non-NULL, point to arrays of struct iovec structures. 72See the |
71.Fn writev | 73.Fn writev |
72system call for information on the iovec structure. The number of iovecs in these | 74system call for information on the iovec structure. 75The number of iovecs in these |
73arrays is specified by 74.Fa hdr_cnt 75and 76.Fa trl_cnt . 77.Pp 78If non-NULL, the system will write the total number of bytes sent on the socket to the 79variable pointed to by 80.Fa sbytes . 81.Pp 82The 83.Fa flags 84argument is currently undefined and should be specified as 0. 85.Pp 86When using a socket marked for non-blocking I/O, 87.Fn sendfile | 76arrays is specified by 77.Fa hdr_cnt 78and 79.Fa trl_cnt . 80.Pp 81If non-NULL, the system will write the total number of bytes sent on the socket to the 82variable pointed to by 83.Fa sbytes . 84.Pp 85The 86.Fa flags 87argument is currently undefined and should be specified as 0. 88.Pp 89When using a socket marked for non-blocking I/O, 90.Fn sendfile |
88may send fewer bytes than requested. In this case, the number of bytes successfully | 91may send fewer bytes than requested. 92In this case, the number of bytes successfully |
89written is returned in 90.Fa *sbytes 91(if specified), 92and the error 93.Er EAGAIN 94is returned. 95.Sh IMPLEMENTATION NOTES 96.Pp --- 59 unchanged lines hidden --- | 93written is returned in 94.Fa *sbytes 95(if specified), 96and the error 97.Er EAGAIN 98is returned. 99.Sh IMPLEMENTATION NOTES 100.Pp --- 59 unchanged lines hidden --- |