在linux中,sendfile()函数在<sys/sendfile.h>库中
在mac中,sendfile()函数在
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
库中,mac中可参考该博客
Mac OS X Manual Page For sendfile(2)
在mac中参数是六个:
int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags);
linux中是四个
ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
有关零拷贝的概念以及零拷贝和write,mmap的区别,可参考这个博客