… | |
… | |
62 | |
62 | |
63 | AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([ |
63 | AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([ |
64 | # include <sys/types.h> |
64 | # include <sys/types.h> |
65 | #if __linux |
65 | #if __linux |
66 | # include <sys/sendfile.h> |
66 | # include <sys/sendfile.h> |
67 | #elif __freebsd |
67 | #elif __FreeBSD__ || defined __APPLE__ |
68 | # include <sys/socket.h> |
68 | # include <sys/socket.h> |
69 | # include <sys/uio.h> |
69 | # include <sys/uio.h> |
70 | #elif __hpux |
70 | #elif __hpux |
71 | # include <sys/socket.h> |
71 | # include <sys/socket.h> |
72 | #else |
72 | #else |
… | |
… | |
78 | off_t offset = 1; |
78 | off_t offset = 1; |
79 | size_t count = 2; |
79 | size_t count = 2; |
80 | ssize_t res; |
80 | ssize_t res; |
81 | #if __linux |
81 | #if __linux |
82 | res = sendfile (fd, fd, offset, count); |
82 | res = sendfile (fd, fd, offset, count); |
83 | #elif __freebsd |
83 | #elif __FreeBSD__ |
84 | res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
84 | res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
85 | #elif __hpux |
85 | #elif __hpux |
86 | res = sendfile (fd, fd, offset, count, 0, 0); |
86 | res = sendfile (fd, fd, offset, count, 0, 0); |
87 | #endif |
87 | #endif |
88 | return 0; |
88 | return 0; |