out_fd
a file descriptor, open for writing, for the data to be written
in_fd
a file descriptor, open for reading, for the data to be read
offset
the offset in the input file to start transfer (e.g. a value of 0 indicates the beginning of the file). This is passed into the function and updated when the function returns.
count
the number of bytes to be transferredhtml
正常状况下函数会返回被写入的字节数,若是出错就返回-1linux
咱们都知道在linux系统里文件描述符fd,能够是一个真实的文件或者是一个设备,例如一个网络socket,(固然linux世界里一切皆文件,这里只是具体区别一下。)senfile须要输入的文件描述符是一个支持mmap的真实文件或者设备,那么socket就不能做为输入的fd,而输出的fd是能够的。nginx