… | |
… | |
113 | # include <sys/uio.h> |
113 | # include <sys/uio.h> |
114 | # elif __hpux |
114 | # elif __hpux |
115 | # include <sys/socket.h> |
115 | # include <sys/socket.h> |
116 | # elif __solaris |
116 | # elif __solaris |
117 | # include <sys/sendfile.h> |
117 | # include <sys/sendfile.h> |
118 | # elif defined _WIN32 |
|
|
119 | # else |
118 | # else |
120 | # error sendfile support requested but not available |
119 | # error sendfile support requested but not available |
121 | # endif |
120 | # endif |
122 | #endif |
121 | #endif |
123 | |
122 | |
… | |
… | |
924 | if (res < 0 && sbytes) |
923 | if (res < 0 && sbytes) |
925 | /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ |
924 | /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ |
926 | res = sbytes; |
925 | res = sbytes; |
927 | } |
926 | } |
928 | |
927 | |
929 | # elif defined __APPLE__ |
928 | # elif defined (__APPLE__) |
930 | |
929 | |
931 | { |
930 | { |
932 | off_t bytes = count; |
931 | off_t sbytes = count; |
933 | res = sendfile (ifd, ofd, offset, &bytes, 0, 0); |
932 | res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); |
934 | |
933 | |
935 | if (res < 0 && errno == EAGAIN && bytes) |
934 | if (res < 0 && errno == EAGAIN && sbytes) |
936 | res = sbytes; |
935 | res = sbytes; |
937 | } |
936 | } |
938 | |
937 | |
939 | # elif __hpux |
938 | # elif __hpux |
940 | res = sendfile (ofd, ifd, offset, count, 0, 0); |
939 | res = sendfile (ofd, ifd, offset, count, 0, 0); |
… | |
… | |
954 | if (res < 0 && sbytes) |
953 | if (res < 0 && sbytes) |
955 | res = sbytes; |
954 | res = sbytes; |
956 | } |
955 | } |
957 | |
956 | |
958 | # endif |
957 | # endif |
|
|
958 | |
959 | #elif defined _WIN32 |
959 | #elif defined (_WIN32) |
960 | |
960 | |
961 | /* does not work, just for documentation of what would need to be done */ |
961 | /* does not work, just for documentation of what would need to be done */ |
962 | { |
962 | { |
963 | HANDLE h = TO_SOCKET (ifd); |
963 | HANDLE h = TO_SOCKET (ifd); |
964 | SetFilePointer (h, offset, 0, FILE_BEGIN); |
964 | SetFilePointer (h, offset, 0, FILE_BEGIN); |