18269e767SBrooks Davis.\" Copyright (c) 2003, David G. Lawrence 28269e767SBrooks Davis.\" All rights reserved. 38269e767SBrooks Davis.\" 48269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 58269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 68269e767SBrooks Davis.\" are met: 78269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 88269e767SBrooks Davis.\" notice unmodified, this list of conditions, and the following 98269e767SBrooks Davis.\" disclaimer. 108269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 118269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 128269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 138269e767SBrooks Davis.\" 148269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 158269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 168269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 178269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 188269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 198269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 208269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 218269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 228269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 238269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 248269e767SBrooks Davis.\" SUCH DAMAGE. 258269e767SBrooks Davis.\" 268269e767SBrooks Davis.Dd March 30, 2020 278269e767SBrooks Davis.Dt SENDFILE 2 288269e767SBrooks Davis.Os 298269e767SBrooks Davis.Sh NAME 308269e767SBrooks Davis.Nm sendfile 318269e767SBrooks Davis.Nd send a file to a socket 328269e767SBrooks Davis.Sh LIBRARY 338269e767SBrooks Davis.Lb libc 348269e767SBrooks Davis.Sh SYNOPSIS 358269e767SBrooks Davis.In sys/types.h 368269e767SBrooks Davis.In sys/socket.h 378269e767SBrooks Davis.In sys/uio.h 388269e767SBrooks Davis.Ft int 398269e767SBrooks Davis.Fo sendfile 408269e767SBrooks Davis.Fa "int fd" "int s" "off_t offset" "size_t nbytes" 418269e767SBrooks Davis.Fa "struct sf_hdtr *hdtr" "off_t *sbytes" "int flags" 428269e767SBrooks Davis.Fc 438269e767SBrooks Davis.Sh DESCRIPTION 448269e767SBrooks DavisThe 458269e767SBrooks Davis.Fn sendfile 468269e767SBrooks Davissystem call 478269e767SBrooks Davissends a regular file or shared memory object specified by descriptor 488269e767SBrooks Davis.Fa fd 498269e767SBrooks Davisout a stream socket specified by descriptor 508269e767SBrooks Davis.Fa s . 518269e767SBrooks Davis.Pp 528269e767SBrooks DavisThe 538269e767SBrooks Davis.Fa offset 548269e767SBrooks Davisargument specifies where to begin in the file. 558269e767SBrooks DavisShould 568269e767SBrooks Davis.Fa offset 578269e767SBrooks Davisfall beyond the end of file, the system will return 588269e767SBrooks Davissuccess and report 0 bytes sent as described below. 598269e767SBrooks DavisThe 608269e767SBrooks Davis.Fa nbytes 618269e767SBrooks Davisargument specifies how many bytes of the file should be sent, with 0 having the special 628269e767SBrooks Davismeaning of send until the end of file has been reached. 638269e767SBrooks Davis.Pp 648269e767SBrooks DavisAn optional header and/or trailer can be sent before and after the file data by specifying 658269e767SBrooks Davisa pointer to a 668269e767SBrooks Davis.Vt "struct sf_hdtr" , 678269e767SBrooks Daviswhich has the following structure: 688269e767SBrooks Davis.Pp 698269e767SBrooks Davis.Bd -literal -offset indent -compact 708269e767SBrooks Davisstruct sf_hdtr { 718269e767SBrooks Davis struct iovec *headers; /* pointer to header iovecs */ 728269e767SBrooks Davis int hdr_cnt; /* number of header iovecs */ 738269e767SBrooks Davis struct iovec *trailers; /* pointer to trailer iovecs */ 748269e767SBrooks Davis int trl_cnt; /* number of trailer iovecs */ 758269e767SBrooks Davis}; 768269e767SBrooks Davis.Ed 778269e767SBrooks Davis.Pp 788269e767SBrooks DavisThe 798269e767SBrooks Davis.Fa headers 808269e767SBrooks Davisand 818269e767SBrooks Davis.Fa trailers 828269e767SBrooks Davispointers, if 838269e767SBrooks Davis.Pf non- Dv NULL , 848269e767SBrooks Davispoint to arrays of 858269e767SBrooks Davis.Vt "struct iovec" 868269e767SBrooks Davisstructures. 878269e767SBrooks DavisSee the 888269e767SBrooks Davis.Fn writev 898269e767SBrooks Davissystem call for information on the iovec structure. 908269e767SBrooks DavisThe number of iovecs in these 918269e767SBrooks Davisarrays is specified by 928269e767SBrooks Davis.Fa hdr_cnt 938269e767SBrooks Davisand 948269e767SBrooks Davis.Fa trl_cnt . 958269e767SBrooks Davis.Pp 968269e767SBrooks DavisIf 978269e767SBrooks Davis.Pf non- Dv NULL , 988269e767SBrooks Davisthe system will write the total number of bytes sent on the socket to the 998269e767SBrooks Davisvariable pointed to by 1008269e767SBrooks Davis.Fa sbytes . 1018269e767SBrooks Davis.Pp 1028269e767SBrooks DavisThe least significant 16 bits of 1038269e767SBrooks Davis.Fa flags 1048269e767SBrooks Davisargument is a bitmap of these values: 1058269e767SBrooks Davis.Bl -tag -offset indent -width "SF_USER_READAHEAD" 1068269e767SBrooks Davis.It Dv SF_NODISKIO 1078269e767SBrooks DavisThis flag causes 1088269e767SBrooks Davis.Nm 1098269e767SBrooks Davisto return 1108269e767SBrooks Davis.Er EBUSY 1118269e767SBrooks Davisinstead of blocking when a busy page is encountered. 1128269e767SBrooks DavisThis rare situation can happen if some other process is now working 1138269e767SBrooks Daviswith the same region of the file. 1148269e767SBrooks DavisIt is advised to retry the operation after a short period. 1158269e767SBrooks Davis.Pp 1168269e767SBrooks DavisNote that in older 1178269e767SBrooks Davis.Fx 1188269e767SBrooks Davisversions the 1198269e767SBrooks Davis.Dv SF_NODISKIO 1208269e767SBrooks Davishad slightly different notion. 1218269e767SBrooks DavisThe flag prevented 1228269e767SBrooks Davis.Nm 1238269e767SBrooks Davisto run I/O operations in case if an invalid (not cached) page is encountered, 1248269e767SBrooks Davisthus avoiding blocking on I/O. 1258269e767SBrooks DavisStarting with 1268269e767SBrooks Davis.Fx 11 1278269e767SBrooks Davis.Nm 1288269e767SBrooks Davissending files off the 129*1a720cbeSAlexander Ziaee.Xr ffs 4 1308269e767SBrooks Davisfilesystem does not block on I/O 1318269e767SBrooks Davis(see 1328269e767SBrooks Davis.Sx IMPLEMENTATION NOTES 1338269e767SBrooks Davis), so the condition no longer applies. 1348269e767SBrooks DavisHowever, it is safe if an application utilizes 1358269e767SBrooks Davis.Dv SF_NODISKIO 1368269e767SBrooks Davisand on 1378269e767SBrooks Davis.Er EBUSY 1388269e767SBrooks Davisperforms the same action as it did in 1398269e767SBrooks Davisolder 1408269e767SBrooks Davis.Fx 1418269e767SBrooks Davisversions, e.g., 1428269e767SBrooks Davis.Xr aio_read 2 , 1438269e767SBrooks Davis.Xr read 2 1448269e767SBrooks Davisor 1458269e767SBrooks Davis.Nm 1468269e767SBrooks Davisin a different context. 1478269e767SBrooks Davis.It Dv SF_NOCACHE 1488269e767SBrooks DavisThe data sent to socket will not be cached by the virtual memory system, 1498269e767SBrooks Davisand will be freed directly to the pool of free pages. 1508269e767SBrooks Davis.It Dv SF_SYNC 1518269e767SBrooks Davis.Nm 1528269e767SBrooks Davissleeps until the network stack no longer references the VM pages 1538269e767SBrooks Davisof the file, making subsequent modifications to it safe. 1548269e767SBrooks DavisPlease note that this is not a guarantee that the data has actually 1558269e767SBrooks Davisbeen sent. 1568269e767SBrooks Davis.It Dv SF_USER_READAHEAD 1578269e767SBrooks Davis.Nm 1588269e767SBrooks Davishas some internal heuristics to do readahead when sending data. 1598269e767SBrooks DavisThis flag forces 1608269e767SBrooks Davis.Nm 1618269e767SBrooks Davisto override any heuristically calculated readahead and use exactly the 1628269e767SBrooks Davisapplication specified readahead. 1638269e767SBrooks DavisSee 1648269e767SBrooks Davis.Sx SETTING READAHEAD 1658269e767SBrooks Davisfor more details on readahead. 1668269e767SBrooks Davis.El 1678269e767SBrooks Davis.Pp 1688269e767SBrooks DavisWhen using a socket marked for non-blocking I/O, 1698269e767SBrooks Davis.Fn sendfile 1708269e767SBrooks Davismay send fewer bytes than requested. 1718269e767SBrooks DavisIn this case, the number of bytes successfully 1728269e767SBrooks Daviswritten is returned in 1738269e767SBrooks Davis.Fa *sbytes 1748269e767SBrooks Davis(if specified), 1758269e767SBrooks Davisand the error 1768269e767SBrooks Davis.Er EAGAIN 1778269e767SBrooks Davisis returned. 1788269e767SBrooks Davis.Sh SETTING READAHEAD 1798269e767SBrooks Davis.Nm 1808269e767SBrooks Davisuses internal heuristics based on request size and file system layout 1818269e767SBrooks Davisto do readahead. 1828269e767SBrooks DavisAdditionally application may request extra readahead. 1838269e767SBrooks DavisThe most significant 16 bits of 1848269e767SBrooks Davis.Fa flags 1858269e767SBrooks Davisspecify amount of pages that 1868269e767SBrooks Davis.Nm 1878269e767SBrooks Davismay read ahead when reading the file. 1888269e767SBrooks DavisA macro 1898269e767SBrooks Davis.Fn SF_FLAGS 1908269e767SBrooks Davisis provided to combine readahead amount and flags. 1918269e767SBrooks DavisAn example showing specifying readahead of 16 pages and 1928269e767SBrooks Davis.Dv SF_NOCACHE 1938269e767SBrooks Davisflag: 1948269e767SBrooks Davis.Pp 1958269e767SBrooks Davis.Bd -literal -offset indent -compact 1968269e767SBrooks Davis SF_FLAGS(16, SF_NOCACHE) 1978269e767SBrooks Davis.Ed 1988269e767SBrooks Davis.Pp 1998269e767SBrooks Davis.Nm 2008269e767SBrooks Daviswill use either application specified readahead or internally calculated, 2018269e767SBrooks Daviswhichever is bigger. 2028269e767SBrooks DavisSetting flag 2038269e767SBrooks Davis.Dv SF_USER_READAHEAD 2048269e767SBrooks Daviswould turn off any heuristics and set maximum possible readahead length to 2058269e767SBrooks Davisthe number of pages specified via flags. 2068269e767SBrooks Davis.Sh IMPLEMENTATION NOTES 2078269e767SBrooks DavisThe 2088269e767SBrooks Davis.Fx 2098269e767SBrooks Davisimplementation of 2108269e767SBrooks Davis.Fn sendfile 2118269e767SBrooks Davisdoes not block on disk I/O when it sends a file off the 212*1a720cbeSAlexander Ziaee.Xr ffs 4 2138269e767SBrooks Davisfilesystem. 2148269e767SBrooks DavisThe syscall returns success before the actual I/O completes, and data 2158269e767SBrooks Davisis put into the socket later unattended. 2168269e767SBrooks DavisHowever, the order of data in the socket is preserved, so it is safe 2178269e767SBrooks Davisto do further writes to the socket. 2188269e767SBrooks Davis.Pp 2198269e767SBrooks DavisThe 2208269e767SBrooks Davis.Fx 2218269e767SBrooks Davisimplementation of 2228269e767SBrooks Davis.Fn sendfile 2238269e767SBrooks Davisis "zero-copy", meaning that it has been optimized so that copying of the file data is avoided. 2248269e767SBrooks Davis.Sh TUNING 2258269e767SBrooks Davis.Ss physical paging buffers 2268269e767SBrooks Davis.Fn sendfile 2278269e767SBrooks Davisuses vnode pager to read file pages into memory. 2288269e767SBrooks DavisThe pager uses a pool of physical buffers to run its I/O operations. 2298269e767SBrooks DavisWhen system runs out of pbufs, sendfile will block and report state 2308269e767SBrooks Davis.Dq Li zonelimit . 2318269e767SBrooks DavisSize of the pool can be tuned with 2328269e767SBrooks Davis.Va vm.vnode_pbufs 2338269e767SBrooks Davis.Xr loader.conf 5 2348269e767SBrooks Davistunable and can be checked with 2358269e767SBrooks Davis.Xr sysctl 8 2368269e767SBrooks DavisOID of the same name at runtime. 2378269e767SBrooks Davis.Ss sendfile(2) buffers 2388269e767SBrooks DavisOn some architectures, this system call internally uses a special 2398269e767SBrooks Davis.Fn sendfile 2408269e767SBrooks Davisbuffer 2418269e767SBrooks Davis.Pq Vt "struct sf_buf" 2428269e767SBrooks Davisto handle sending file data to the client. 2438269e767SBrooks DavisIf the sending socket is 2448269e767SBrooks Davisblocking, and there are not enough 2458269e767SBrooks Davis.Fn sendfile 2468269e767SBrooks Davisbuffers available, 2478269e767SBrooks Davis.Fn sendfile 2488269e767SBrooks Daviswill block and report a state of 2498269e767SBrooks Davis.Dq Li sfbufa . 2508269e767SBrooks DavisIf the sending socket is non-blocking and there are not enough 2518269e767SBrooks Davis.Fn sendfile 2528269e767SBrooks Davisbuffers available, the call will block and wait for the 2538269e767SBrooks Davisnecessary buffers to become available before finishing the call. 2548269e767SBrooks Davis.Pp 2558269e767SBrooks DavisThe number of 2568269e767SBrooks Davis.Vt sf_buf Ns 's 2578269e767SBrooks Davisallocated should be proportional to the number of nmbclusters used to 2588269e767SBrooks Davissend data to a client via 2598269e767SBrooks Davis.Fn sendfile . 2608269e767SBrooks DavisTune accordingly to avoid blocking! 2618269e767SBrooks DavisBusy installations that make extensive use of 2628269e767SBrooks Davis.Fn sendfile 2638269e767SBrooks Davismay want to increase these values to be inline with their 2648269e767SBrooks Davis.Va kern.ipc.nmbclusters 2658269e767SBrooks Davis(see 2668269e767SBrooks Davis.Xr tuning 7 2678269e767SBrooks Davisfor details). 2688269e767SBrooks Davis.Pp 2698269e767SBrooks DavisThe number of 2708269e767SBrooks Davis.Fn sendfile 2718269e767SBrooks Davisbuffers available is determined at boot time by either the 2728269e767SBrooks Davis.Va kern.ipc.nsfbufs 2738269e767SBrooks Davis.Xr loader.conf 5 2748269e767SBrooks Davisvariable or the 2758269e767SBrooks Davis.Dv NSFBUFS 2768269e767SBrooks Daviskernel configuration tunable. 2778269e767SBrooks DavisThe number of 2788269e767SBrooks Davis.Fn sendfile 2798269e767SBrooks Davisbuffers scales with 2808269e767SBrooks Davis.Va kern.maxusers . 2818269e767SBrooks DavisThe 2828269e767SBrooks Davis.Va kern.ipc.nsfbufsused 2838269e767SBrooks Davisand 2848269e767SBrooks Davis.Va kern.ipc.nsfbufspeak 2858269e767SBrooks Davisread-only 2868269e767SBrooks Davis.Xr sysctl 8 2878269e767SBrooks Davisvariables show current and peak 2888269e767SBrooks Davis.Fn sendfile 2898269e767SBrooks Davisbuffers usage respectively. 2908269e767SBrooks DavisThese values may also be viewed through 2918269e767SBrooks Davis.Nm netstat Fl m . 2928269e767SBrooks Davis.Pp 2938269e767SBrooks DavisIf 2948269e767SBrooks Davis.Xr sysctl 8 2958269e767SBrooks DavisOID 2968269e767SBrooks Davis.Va kern.ipc.nsfbufs 2978269e767SBrooks Davisdoesn't exist, your architecture does not need to use 2988269e767SBrooks Davis.Fn sendfile 2998269e767SBrooks Davisbuffers because their task can be efficiently performed 3008269e767SBrooks Davisby the generic virtual memory structures. 3018269e767SBrooks Davis.Sh RETURN VALUES 3028269e767SBrooks Davis.Rv -std sendfile 3038269e767SBrooks Davis.Sh ERRORS 3048269e767SBrooks Davis.Bl -tag -width Er 3058269e767SBrooks Davis.It Bq Er EAGAIN 3068269e767SBrooks DavisThe socket is marked for non-blocking I/O and not all data was sent due to 3078269e767SBrooks Davisthe socket buffer being filled. 3088269e767SBrooks DavisIf specified, the number of bytes successfully sent will be returned in 3098269e767SBrooks Davis.Fa *sbytes . 3108269e767SBrooks Davis.It Bq Er EBADF 3118269e767SBrooks DavisThe 3128269e767SBrooks Davis.Fa fd 3138269e767SBrooks Davisargument 3148269e767SBrooks Davisis not a valid file descriptor. 3158269e767SBrooks Davis.It Bq Er EBADF 3168269e767SBrooks DavisThe 3178269e767SBrooks Davis.Fa s 3188269e767SBrooks Davisargument 3198269e767SBrooks Davisis not a valid socket descriptor. 3208269e767SBrooks Davis.It Bq Er EBUSY 3218269e767SBrooks DavisA busy page was encountered and 3228269e767SBrooks Davis.Dv SF_NODISKIO 3238269e767SBrooks Davishad been specified. 3248269e767SBrooks DavisPartial data may have been sent. 3258269e767SBrooks Davis.It Bq Er EFAULT 3268269e767SBrooks DavisAn invalid address was specified for an argument. 3278269e767SBrooks Davis.It Bq Er EINTR 3288269e767SBrooks DavisA signal interrupted 3298269e767SBrooks Davis.Fn sendfile 3308269e767SBrooks Davisbefore it could be completed. 3318269e767SBrooks DavisIf specified, the number 3328269e767SBrooks Davisof bytes successfully sent will be returned in 3338269e767SBrooks Davis.Fa *sbytes . 3348269e767SBrooks Davis.It Bq Er EINVAL 3358269e767SBrooks DavisThe 3368269e767SBrooks Davis.Fa fd 3378269e767SBrooks Davisargument 3388269e767SBrooks Davisis not a regular file. 3398269e767SBrooks Davis.It Bq Er EINVAL 3408269e767SBrooks DavisThe 3418269e767SBrooks Davis.Fa s 3428269e767SBrooks Davisargument 3438269e767SBrooks Davisis not a SOCK_STREAM type socket. 3448269e767SBrooks Davis.It Bq Er EINVAL 3458269e767SBrooks DavisThe 3468269e767SBrooks Davis.Fa offset 3478269e767SBrooks Davisargument 3488269e767SBrooks Davisis negative. 3498269e767SBrooks Davis.It Bq Er EIO 3508269e767SBrooks DavisAn error occurred while reading from 3518269e767SBrooks Davis.Fa fd . 3528269e767SBrooks Davis.It Bq Er EINTEGRITY 3538269e767SBrooks DavisCorrupted data was detected while reading from 3548269e767SBrooks Davis.Fa fd . 3558269e767SBrooks Davis.It Bq Er ENOTCAPABLE 3568269e767SBrooks DavisThe 3578269e767SBrooks Davis.Fa fd 3588269e767SBrooks Davisor the 3598269e767SBrooks Davis.Fa s 3608269e767SBrooks Davisargument has insufficient rights. 3618269e767SBrooks Davis.It Bq Er ENOBUFS 3628269e767SBrooks DavisThe system was unable to allocate an internal buffer. 3638269e767SBrooks Davis.It Bq Er ENOTCONN 3648269e767SBrooks DavisThe 3658269e767SBrooks Davis.Fa s 3668269e767SBrooks Davisargument 3678269e767SBrooks Davispoints to an unconnected socket. 3688269e767SBrooks Davis.It Bq Er ENOTSOCK 3698269e767SBrooks DavisThe 3708269e767SBrooks Davis.Fa s 3718269e767SBrooks Davisargument 3728269e767SBrooks Davisis not a socket. 3738269e767SBrooks Davis.It Bq Er EOPNOTSUPP 3748269e767SBrooks DavisThe file system for descriptor 3758269e767SBrooks Davis.Fa fd 3768269e767SBrooks Davisdoes not support 3778269e767SBrooks Davis.Fn sendfile . 3788269e767SBrooks Davis.It Bq Er EPIPE 3798269e767SBrooks DavisThe socket peer has closed the connection. 3808269e767SBrooks Davis.El 3818269e767SBrooks Davis.Sh SEE ALSO 3828269e767SBrooks Davis.Xr netstat 1 , 3838269e767SBrooks Davis.Xr open 2 , 3848269e767SBrooks Davis.Xr send 2 , 3858269e767SBrooks Davis.Xr socket 2 , 3868269e767SBrooks Davis.Xr writev 2 , 3878269e767SBrooks Davis.Xr loader.conf 5 , 3888269e767SBrooks Davis.Xr tuning 7 , 3898269e767SBrooks Davis.Xr sysctl 8 3908269e767SBrooks Davis.Rs 3918269e767SBrooks Davis.%A K. Elmeleegy 3928269e767SBrooks Davis.%A A. Chanda 3938269e767SBrooks Davis.%A A. L. Cox 3948269e767SBrooks Davis.%A W. Zwaenepoel 3958269e767SBrooks Davis.%T A Portable Kernel Abstraction for Low-Overhead Ephemeral Mapping Management 3968269e767SBrooks Davis.%J The Proceedings of the 2005 USENIX Annual Technical Conference 3978269e767SBrooks Davis.%P pp 223-236 3988269e767SBrooks Davis.%D 2005 3998269e767SBrooks Davis.Re 4008269e767SBrooks Davis.Sh HISTORY 4018269e767SBrooks DavisThe 4028269e767SBrooks Davis.Fn sendfile 4038269e767SBrooks Davissystem call 4048269e767SBrooks Davisfirst appeared in 4058269e767SBrooks Davis.Fx 3.0 . 4068269e767SBrooks DavisThis manual page first appeared in 4078269e767SBrooks Davis.Fx 3.1 . 4088269e767SBrooks DavisIn 4098269e767SBrooks Davis.Fx 10 4108269e767SBrooks Davissupport for sending shared memory descriptors had been introduced. 4118269e767SBrooks DavisIn 4128269e767SBrooks Davis.Fx 11 4138269e767SBrooks Davisa non-blocking implementation had been introduced. 4148269e767SBrooks Davis.Sh AUTHORS 4158269e767SBrooks DavisThe initial implementation of 4168269e767SBrooks Davis.Fn sendfile 4178269e767SBrooks Davissystem call 4188269e767SBrooks Davisand this manual page were written by 4198269e767SBrooks Davis.An David G. Lawrence Aq Mt dg@dglawrence.com . 4208269e767SBrooks DavisThe 4218269e767SBrooks Davis.Fx 11 4228269e767SBrooks Davisimplementation was written by 4238269e767SBrooks Davis.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . 4248269e767SBrooks Davis.Sh BUGS 4258269e767SBrooks DavisThe 4268269e767SBrooks Davis.Fn sendfile 4278269e767SBrooks Davissystem call will not fail, i.e., return 4288269e767SBrooks Davis.Dv -1 4298269e767SBrooks Davisand set 4308269e767SBrooks Davis.Va errno 4318269e767SBrooks Davisto 4328269e767SBrooks Davis.Er EFAULT , 4338269e767SBrooks Davisif provided an invalid address for 4348269e767SBrooks Davis.Fa sbytes . 4358269e767SBrooks DavisThe 4368269e767SBrooks Davis.Fn sendfile 4378269e767SBrooks Davissystem call does not support SCTP sockets, 4388269e767SBrooks Davisit will return 4398269e767SBrooks Davis.Dv -1 4408269e767SBrooks Davisand set 4418269e767SBrooks Davis.Va errno 4428269e767SBrooks Davisto 4438269e767SBrooks Davis.Er EINVAL . 444