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