Skip to content

Commit

Permalink
fixed sendfile on smartos/omnios
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Aug 26, 2014
1 parent 13df278 commit 8cd13f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/sendfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ ssize_t uwsgi_sendfile_do(int sockfd, int filefd, size_t pos, size_t len) {
int sf_ret = sendfile(filefd, sockfd, pos, &sf_len, NULL, 0);
if (sf_ret == 0 || (sf_ret == -1 && errno == EAGAIN)) return sf_len;
return -1;
#elif defined(__linux__) || defined(__sun__) || defined(__GNU_kFreeBSD__)
#elif defined(__linux__) || defined(__GNU_kFreeBSD__)
off_t off = pos;
return sendfile(sockfd, filefd, &off, len);
#elif defined(__sun__)
off_t off = pos;
ssize_t wlen = sendfile(sockfd, filefd, &off, len);
if (wlen < 0 && uwsgi_is_again()) {
if (off - pos > 0) {
return off-pos;
}
}
return wlen;
#endif

no_sendfile:
Expand Down

0 comments on commit 8cd13f2

Please sign in to comment.