[−][src]Function nix::sys::sendfile::sendfile
pub fn sendfile(
in_fd: RawFd,
out_sock: RawFd,
offset: off_t,
count: Option<off_t>,
headers: Option<&[&[u8]]>,
trailers: Option<&[&[u8]]>
) -> (Result<()>, off_t)
Read bytes from in_fd
starting at offset
and write up to count
bytes to
out_sock
.
Returns a Result
and a count of bytes written. Bytes written may be non-zero even if
an error occurs.
in_fd
must describe a regular file. out_sock
must describe a stream socket.
If offset
falls past the end of the file, the function returns success and zero bytes
written.
If count
is None
or 0, bytes will be read from in_fd
until reaching the end of
file (EOF).
hdtr
specifies an optional list of headers and trailers to be sent before and after
the data read from in_fd
, respectively. The length of headers and trailers sent is
included in the returned count of bytes written. If any headers are specified and
count
is non-zero, the length of the headers will be counted in the limit of total
bytes sent. Trailers do not count toward the limit of bytes sent and will always be sent
regardless. The value of offset
does not affect headers or trailers.
For more information, see the sendfile(2) man page.