Deleted Added
sdiff udiff text old ( 50476 ) new ( 57686 )
full compact
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 $
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
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
70pointers, if non-NULL, point to arrays of struct iovec structures. See the
71.Fn writev
72system call for information on the iovec structure. The 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
88may send fewer bytes than requested. In 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 ---