2003-12-01 22:12:50 +00:00
|
|
|
.\" Copyright (c) 2003, David G. Lawrence
|
1998-11-05 14:43:29 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice unmodified, this list of conditions, and the following
|
|
|
|
.\" disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-11-05 14:43:29 +00:00
|
|
|
.\"
|
2019-02-15 23:36:22 +00:00
|
|
|
.Dd February 15, 2019
|
1998-11-05 14:43:29 +00:00
|
|
|
.Dt SENDFILE 2
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm sendfile
|
|
|
|
.Nd send a file to a socket
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In sys/socket.h
|
|
|
|
.In sys/uio.h
|
1998-11-05 14:43:29 +00:00
|
|
|
.Ft int
|
2005-01-11 20:50:51 +00:00
|
|
|
.Fo sendfile
|
|
|
|
.Fa "int fd" "int s" "off_t offset" "size_t nbytes"
|
|
|
|
.Fa "struct sf_hdtr *hdtr" "off_t *sbytes" "int flags"
|
|
|
|
.Fc
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-12-18 09:22:32 +00:00
|
|
|
The
|
|
|
|
.Fn sendfile
|
|
|
|
system call
|
2016-01-08 20:34:57 +00:00
|
|
|
sends a regular file or shared memory object specified by descriptor
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa fd
|
|
|
|
out a stream socket specified by descriptor
|
|
|
|
.Fa s .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fa offset
|
2000-03-02 09:14:21 +00:00
|
|
|
argument specifies where to begin in the file.
|
2004-10-16 09:39:25 +00:00
|
|
|
Should
|
|
|
|
.Fa offset
|
|
|
|
fall beyond the end of file, the system will return
|
|
|
|
success and report 0 bytes sent as described below.
|
2000-03-02 09:14:21 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa nbytes
|
|
|
|
argument specifies how many bytes of the file should be sent, with 0 having the special
|
|
|
|
meaning of send until the end of file has been reached.
|
|
|
|
.Pp
|
|
|
|
An optional header and/or trailer can be sent before and after the file data by specifying
|
2004-10-16 09:46:38 +00:00
|
|
|
a pointer to a
|
|
|
|
.Vt "struct sf_hdtr" ,
|
|
|
|
which has the following structure:
|
1998-11-05 14:43:29 +00:00
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent -compact
|
|
|
|
struct sf_hdtr {
|
|
|
|
struct iovec *headers; /* pointer to header iovecs */
|
|
|
|
int hdr_cnt; /* number of header iovecs */
|
|
|
|
struct iovec *trailers; /* pointer to trailer iovecs */
|
|
|
|
int trl_cnt; /* number of trailer iovecs */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fa headers
|
|
|
|
and
|
2001-02-04 02:05:16 +00:00
|
|
|
.Fa trailers
|
2004-10-16 09:46:38 +00:00
|
|
|
pointers, if
|
|
|
|
.Pf non- Dv NULL ,
|
2005-01-11 20:50:51 +00:00
|
|
|
point to arrays of
|
|
|
|
.Vt "struct iovec"
|
|
|
|
structures.
|
2000-03-02 09:14:21 +00:00
|
|
|
See the
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fn writev
|
2000-03-02 09:14:21 +00:00
|
|
|
system call for information on the iovec structure.
|
|
|
|
The number of iovecs in these
|
1998-11-05 14:43:29 +00:00
|
|
|
arrays is specified by
|
|
|
|
.Fa hdr_cnt
|
|
|
|
and
|
|
|
|
.Fa trl_cnt .
|
|
|
|
.Pp
|
2004-10-16 09:46:38 +00:00
|
|
|
If
|
|
|
|
.Pf non- Dv NULL ,
|
|
|
|
the system will write the total number of bytes sent on the socket to the
|
1998-11-05 14:43:29 +00:00
|
|
|
variable pointed to by
|
|
|
|
.Fa sbytes .
|
|
|
|
.Pp
|
2016-01-08 20:34:57 +00:00
|
|
|
The least significant 16 bits of
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa flags
|
2008-02-03 15:54:41 +00:00
|
|
|
argument is a bitmap of these values:
|
2019-01-25 19:56:02 +00:00
|
|
|
.Bl -tag -offset indent -width "SF_USER_READAHEAD"
|
2016-01-08 20:34:57 +00:00
|
|
|
.It Dv SF_NODISKIO
|
|
|
|
This flag causes
|
|
|
|
.Nm
|
|
|
|
to return
|
|
|
|
.Er EBUSY
|
|
|
|
instead of blocking when a busy page is encountered.
|
|
|
|
This rare situation can happen if some other process is now working
|
|
|
|
with the same region of the file.
|
|
|
|
It is advised to retry the operation after a short period.
|
|
|
|
.Pp
|
|
|
|
Note that in older
|
|
|
|
.Fx
|
|
|
|
versions the
|
|
|
|
.Dv SF_NODISKIO
|
|
|
|
had slightly different notion.
|
|
|
|
The flag prevented
|
|
|
|
.Nm
|
|
|
|
to run I/O operations in case if an invalid (not cached) page is encountered,
|
|
|
|
thus avoiding blocking on I/O.
|
|
|
|
Starting with
|
|
|
|
.Fx 11
|
|
|
|
.Nm
|
|
|
|
sending files off the
|
|
|
|
.Xr ffs 7
|
2018-03-15 19:03:54 +00:00
|
|
|
filesystem does not block on I/O
|
|
|
|
(see
|
2016-01-08 20:34:57 +00:00
|
|
|
.Sx IMPLEMENTATION NOTES
|
|
|
|
), so the condition no longer applies.
|
|
|
|
However, it is safe if an application utilizes
|
|
|
|
.Dv SF_NODISKIO
|
|
|
|
and on
|
|
|
|
.Er EBUSY
|
|
|
|
performs the same action as it did in
|
|
|
|
older
|
|
|
|
.Fx
|
2018-03-15 19:03:54 +00:00
|
|
|
versions, e.g.,
|
|
|
|
.Xr aio_read 2 ,
|
2016-01-08 20:34:57 +00:00
|
|
|
.Xr read 2
|
|
|
|
or
|
|
|
|
.Nm
|
|
|
|
in a different context.
|
|
|
|
.It Dv SF_NOCACHE
|
|
|
|
The data sent to socket will not be cached by the virtual memory system,
|
|
|
|
and will be freed directly to the pool of free pages.
|
|
|
|
.It Dv SF_SYNC
|
2008-02-03 15:54:41 +00:00
|
|
|
.Nm
|
|
|
|
sleeps until the network stack no longer references the VM pages
|
|
|
|
of the file, making subsequent modifications to it safe.
|
|
|
|
Please note that this is not a guarantee that the data has actually
|
|
|
|
been sent.
|
2016-11-17 21:36:18 +00:00
|
|
|
.It Dv SF_USER_READAHEAD
|
|
|
|
.Nm
|
|
|
|
has some internal heuristics to do readahead when sending data.
|
|
|
|
This flag forces
|
|
|
|
.Nm
|
|
|
|
to override any heuristically calculated readahead and use exactly the
|
|
|
|
application specified readahead.
|
|
|
|
See
|
|
|
|
.Sx SETTING READAHEAD
|
|
|
|
for more details on readahead.
|
2008-02-03 15:54:41 +00:00
|
|
|
.El
|
1998-11-06 19:35:58 +00:00
|
|
|
.Pp
|
2016-11-17 21:36:18 +00:00
|
|
|
When using a socket marked for non-blocking I/O,
|
|
|
|
.Fn sendfile
|
|
|
|
may send fewer bytes than requested.
|
|
|
|
In this case, the number of bytes successfully
|
|
|
|
written is returned in
|
|
|
|
.Fa *sbytes
|
|
|
|
(if specified),
|
|
|
|
and the error
|
|
|
|
.Er EAGAIN
|
|
|
|
is returned.
|
|
|
|
.Sh SETTING READAHEAD
|
|
|
|
.Nm
|
|
|
|
uses internal heuristics based on request size and file system layout
|
|
|
|
to do readahead.
|
|
|
|
Additionally application may request extra readahead.
|
2016-01-08 20:34:57 +00:00
|
|
|
The most significant 16 bits of
|
|
|
|
.Fa flags
|
|
|
|
specify amount of pages that
|
|
|
|
.Nm
|
|
|
|
may read ahead when reading the file.
|
|
|
|
A macro
|
|
|
|
.Fn SF_FLAGS
|
|
|
|
is provided to combine readahead amount and flags.
|
2017-12-28 01:31:28 +00:00
|
|
|
An example showing specifying readahead of 16 pages and
|
2016-01-08 20:34:57 +00:00
|
|
|
.Dv SF_NOCACHE
|
|
|
|
flag:
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent -compact
|
|
|
|
SF_FLAGS(16, SF_NOCACHE)
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2016-11-17 21:36:18 +00:00
|
|
|
.Nm
|
|
|
|
will use either application specified readahead or internally calculated,
|
|
|
|
whichever is bigger.
|
|
|
|
Setting flag
|
|
|
|
.Dv SF_USER_READAHEAD
|
|
|
|
would turn off any heuristics and set maximum possible readahead length to
|
|
|
|
the number of pages specified via flags.
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh IMPLEMENTATION NOTES
|
2000-11-14 11:20:58 +00:00
|
|
|
The
|
|
|
|
.Fx
|
|
|
|
implementation of
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fn sendfile
|
2018-03-15 19:03:54 +00:00
|
|
|
does not block on disk I/O when it sends a file off the
|
2016-01-08 20:34:57 +00:00
|
|
|
.Xr ffs 7
|
|
|
|
filesystem.
|
|
|
|
The syscall returns success before the actual I/O completes, and data
|
|
|
|
is put into the socket later unattended.
|
|
|
|
However, the order of data in the socket is preserved, so it is safe
|
|
|
|
to do further writes to the socket.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fx
|
|
|
|
implementation of
|
|
|
|
.Fn sendfile
|
1998-11-05 14:43:29 +00:00
|
|
|
is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
|
2003-03-12 09:28:44 +00:00
|
|
|
.Sh TUNING
|
2019-02-15 23:36:22 +00:00
|
|
|
.Ss physical paging buffers
|
|
|
|
.Fn sendfile
|
|
|
|
uses vnode pager to read file pages into memory.
|
|
|
|
The pager uses a pool of physical buffers to run its I/O operations.
|
|
|
|
When system runs out of pbufs, sendfile will block and report state
|
|
|
|
.Dq Li zonelimit .
|
|
|
|
Size of the pool can be tuned with
|
|
|
|
.Va vm.vnode_pbufs
|
|
|
|
.Xr loader.conf 5
|
|
|
|
tunable and can be checked with
|
|
|
|
.Xr sysctl 8
|
|
|
|
OID of the same name at runtime.
|
|
|
|
.Ss sendfile(2) buffers
|
2006-11-24 11:44:19 +00:00
|
|
|
On some architectures, this system call internally uses a special
|
2004-06-30 20:09:10 +00:00
|
|
|
.Fn sendfile
|
2003-03-12 09:28:44 +00:00
|
|
|
buffer
|
2003-05-22 13:02:28 +00:00
|
|
|
.Pq Vt "struct sf_buf"
|
2003-03-12 09:28:44 +00:00
|
|
|
to handle sending file data to the client.
|
|
|
|
If the sending socket is
|
2004-06-30 20:09:10 +00:00
|
|
|
blocking, and there are not enough
|
|
|
|
.Fn sendfile
|
|
|
|
buffers available,
|
|
|
|
.Fn sendfile
|
2003-03-12 09:28:44 +00:00
|
|
|
will block and report a state of
|
2003-05-22 13:02:28 +00:00
|
|
|
.Dq Li sfbufa .
|
2003-03-12 09:28:44 +00:00
|
|
|
If the sending socket is non-blocking and there are not enough
|
2004-06-30 20:09:10 +00:00
|
|
|
.Fn sendfile
|
|
|
|
buffers available, the call will block and wait for the
|
2003-03-12 09:28:44 +00:00
|
|
|
necessary buffers to become available before finishing the call.
|
|
|
|
.Pp
|
|
|
|
The number of
|
2003-05-22 13:02:28 +00:00
|
|
|
.Vt sf_buf Ns 's
|
2003-03-12 09:28:44 +00:00
|
|
|
allocated should be proportional to the number of nmbclusters used to
|
|
|
|
send data to a client via
|
2004-06-30 20:09:10 +00:00
|
|
|
.Fn sendfile .
|
2003-03-12 09:28:44 +00:00
|
|
|
Tune accordingly to avoid blocking!
|
|
|
|
Busy installations that make extensive use of
|
2004-06-30 20:09:10 +00:00
|
|
|
.Fn sendfile
|
2003-03-12 09:28:44 +00:00
|
|
|
may want to increase these values to be inline with their
|
2003-05-22 13:02:28 +00:00
|
|
|
.Va kern.ipc.nmbclusters
|
|
|
|
(see
|
|
|
|
.Xr tuning 7
|
|
|
|
for details).
|
2003-03-12 09:28:44 +00:00
|
|
|
.Pp
|
|
|
|
The number of
|
2004-06-30 20:09:10 +00:00
|
|
|
.Fn sendfile
|
2004-02-08 07:38:35 +00:00
|
|
|
buffers available is determined at boot time by either the
|
2003-05-22 13:02:28 +00:00
|
|
|
.Va kern.ipc.nsfbufs
|
2003-03-12 09:28:44 +00:00
|
|
|
.Xr loader.conf 5
|
|
|
|
variable or the
|
2003-05-22 13:02:28 +00:00
|
|
|
.Dv NSFBUFS
|
2003-03-12 09:28:44 +00:00
|
|
|
kernel configuration tunable.
|
2004-06-30 20:09:10 +00:00
|
|
|
The number of
|
|
|
|
.Fn sendfile
|
|
|
|
buffers scales with
|
2003-05-22 13:02:28 +00:00
|
|
|
.Va kern.maxusers .
|
2004-06-30 20:09:10 +00:00
|
|
|
The
|
2003-12-29 12:29:37 +00:00
|
|
|
.Va kern.ipc.nsfbufsused
|
|
|
|
and
|
|
|
|
.Va kern.ipc.nsfbufspeak
|
2004-06-30 20:09:10 +00:00
|
|
|
read-only
|
|
|
|
.Xr sysctl 8
|
|
|
|
variables show current and peak
|
|
|
|
.Fn sendfile
|
2003-12-29 12:29:37 +00:00
|
|
|
buffers usage respectively.
|
|
|
|
These values may also be viewed through
|
|
|
|
.Nm netstat Fl m .
|
2006-11-24 11:44:19 +00:00
|
|
|
.Pp
|
2019-02-15 23:36:22 +00:00
|
|
|
If
|
|
|
|
.Xr sysctl 8
|
|
|
|
OID
|
|
|
|
.Va kern.ipc.nsfbufs
|
|
|
|
doesn't exist, your architecture does not need to use
|
2006-11-24 11:44:19 +00:00
|
|
|
.Fn sendfile
|
|
|
|
buffers because their task can be efficiently performed
|
|
|
|
by the generic virtual memory structures.
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh RETURN VALUES
|
2001-08-09 13:32:13 +00:00
|
|
|
.Rv -std sendfile
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh ERRORS
|
|
|
|
.Bl -tag -width Er
|
2005-10-31 04:00:20 +00:00
|
|
|
.It Bq Er EAGAIN
|
|
|
|
The socket is marked for non-blocking I/O and not all data was sent due to
|
|
|
|
the socket buffer being filled.
|
|
|
|
If specified, the number of bytes successfully sent will be returned in
|
|
|
|
.Fa *sbytes .
|
1998-11-05 14:43:29 +00:00
|
|
|
.It Bq Er EBADF
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa fd
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-11-05 14:43:29 +00:00
|
|
|
is not a valid file descriptor.
|
|
|
|
.It Bq Er EBADF
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa s
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-11-05 14:43:29 +00:00
|
|
|
is not a valid socket descriptor.
|
2004-02-08 07:38:35 +00:00
|
|
|
.It Bq Er EBUSY
|
2016-01-08 20:34:57 +00:00
|
|
|
A busy page was encountered and
|
2004-06-30 20:09:10 +00:00
|
|
|
.Dv SF_NODISKIO
|
2016-01-08 20:34:57 +00:00
|
|
|
had been specified.
|
|
|
|
Partial data may have been sent.
|
2005-10-31 04:00:20 +00:00
|
|
|
.It Bq Er EFAULT
|
|
|
|
An invalid address was specified for an argument.
|
|
|
|
.It Bq Er EINTR
|
|
|
|
A signal interrupted
|
|
|
|
.Fn sendfile
|
|
|
|
before it could be completed.
|
|
|
|
If specified, the number
|
|
|
|
of bytes successfully sent will be returned in
|
|
|
|
.Fa *sbytes .
|
1998-11-05 14:43:29 +00:00
|
|
|
.It Bq Er EINVAL
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa fd
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-11-05 14:43:29 +00:00
|
|
|
is not a regular file.
|
|
|
|
.It Bq Er EINVAL
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa s
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-11-05 14:43:29 +00:00
|
|
|
is not a SOCK_STREAM type socket.
|
|
|
|
.It Bq Er EINVAL
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa offset
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
2004-10-18 10:02:04 +00:00
|
|
|
is negative.
|
2005-10-31 04:00:20 +00:00
|
|
|
.It Bq Er EIO
|
|
|
|
An error occurred while reading from
|
|
|
|
.Fa fd .
|
2018-10-13 02:20:16 +00:00
|
|
|
.It Bq Er ENOTCAPABLE
|
|
|
|
The
|
|
|
|
.Fa fd
|
|
|
|
or the
|
|
|
|
.Fa s
|
|
|
|
argument has insufficient rights.
|
2012-11-14 01:45:10 +00:00
|
|
|
.It Bq Er ENOBUFS
|
|
|
|
The system was unable to allocate an internal buffer.
|
1998-11-05 14:43:29 +00:00
|
|
|
.It Bq Er ENOTCONN
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fa s
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-11-05 14:43:29 +00:00
|
|
|
points to an unconnected socket.
|
2005-10-31 04:00:20 +00:00
|
|
|
.It Bq Er ENOTSOCK
|
|
|
|
The
|
|
|
|
.Fa s
|
|
|
|
argument
|
|
|
|
is not a socket.
|
2005-10-31 04:08:28 +00:00
|
|
|
.It Bq Er EOPNOTSUPP
|
|
|
|
The file system for descriptor
|
|
|
|
.Fa fd
|
|
|
|
does not support
|
|
|
|
.Fn sendfile .
|
1998-11-05 14:43:29 +00:00
|
|
|
.It Bq Er EPIPE
|
|
|
|
The socket peer has closed the connection.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2019-02-15 23:36:22 +00:00
|
|
|
.Xr loader.conf 5 ,
|
2003-12-29 12:29:37 +00:00
|
|
|
.Xr netstat 1 ,
|
1998-11-05 14:43:29 +00:00
|
|
|
.Xr open 2 ,
|
|
|
|
.Xr send 2 ,
|
1999-08-15 09:51:25 +00:00
|
|
|
.Xr socket 2 ,
|
2003-05-22 13:02:28 +00:00
|
|
|
.Xr writev 2 ,
|
2019-02-15 23:36:22 +00:00
|
|
|
.Xr sysctl 8 ,
|
2003-05-22 13:02:28 +00:00
|
|
|
.Xr tuning 7
|
2006-11-24 11:44:19 +00:00
|
|
|
.Rs
|
|
|
|
.%A K. Elmeleegy
|
|
|
|
.%A A. Chanda
|
|
|
|
.%A A. L. Cox
|
|
|
|
.%A W. Zwaenepoel
|
|
|
|
.%T A Portable Kernel Abstraction for Low-Overhead Ephemeral Mapping Management
|
|
|
|
.%J The Proceedings of the 2005 USENIX Annual Technical Conference
|
|
|
|
.%P pp 223-236
|
|
|
|
.%D 2005
|
|
|
|
.Re
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh HISTORY
|
2002-12-18 09:22:32 +00:00
|
|
|
The
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fn sendfile
|
2002-12-18 09:22:32 +00:00
|
|
|
system call
|
1999-08-15 09:51:25 +00:00
|
|
|
first appeared in
|
|
|
|
.Fx 3.0 .
|
|
|
|
This manual page first appeared in
|
|
|
|
.Fx 3.1 .
|
2016-01-08 20:34:57 +00:00
|
|
|
In
|
|
|
|
.Fx 10
|
|
|
|
support for sending shared memory descriptors had been introduced.
|
|
|
|
In
|
|
|
|
.Fx 11
|
|
|
|
a non-blocking implementation had been introduced.
|
1998-11-05 14:43:29 +00:00
|
|
|
.Sh AUTHORS
|
2016-01-08 20:34:57 +00:00
|
|
|
The initial implementation of
|
1998-11-05 14:43:29 +00:00
|
|
|
.Fn sendfile
|
2002-12-18 09:22:32 +00:00
|
|
|
system call
|
1999-08-15 09:51:25 +00:00
|
|
|
and this manual page were written by
|
2014-06-23 08:25:03 +00:00
|
|
|
.An David G. Lawrence Aq Mt dg@dglawrence.com .
|
2016-01-08 20:34:57 +00:00
|
|
|
The
|
|
|
|
.Fx 11
|
|
|
|
implementation was written by
|
|
|
|
.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org .
|
2019-01-25 19:56:02 +00:00
|
|
|
.Sh BUGS
|
|
|
|
The
|
|
|
|
.Fn sendfile
|
|
|
|
system call will not fail, i.e., return
|
|
|
|
.Dv -1
|
|
|
|
and set
|
|
|
|
.Va errno
|
|
|
|
to
|
|
|
|
.Er EFAULT ,
|
|
|
|
if provided an invalid address for
|
|
|
|
.Fa sbytes .
|