diff -r f5102a892ed4 -r 4a10bc0ee80d src/server/util/io.c --- a/src/server/util/io.c Mon May 27 12:28:56 2013 +0200 +++ b/src/server/util/io.c Thu Jun 20 13:27:07 2013 +0200 @@ -33,7 +33,10 @@ #include #include #include +#include +#ifndef BSD #include +#endif #include /* asprintf */ #include "../daemon/vfs.h" @@ -134,7 +137,23 @@ ssize_t ret = 0; off_t fileoffset = sfd->offset; if(sfd->fd->fd != -1) { +#ifdef OSX + struct iovec hdvec; + hdvec.iov_base = (void*)sfd->header; + hdvec.iov_len = sfd->hlen; + struct iovec trvec; + trvec.iov_base = (void*)sfd->trailer; + trvec.iov_len = sfd->tlen; + struct sf_hdtr hdtr; + hdtr.headers = &hdvec; + hdtr.hdr_cnt = 1; + hdtr.trailers = &trvec; + hdtr.trl_cnt = 1; + + ret = sendfile(sfd->fd->fd, st->fd, sfd->offset, (off_t*)&sfd->len, &hdtr, 0); +#else ret = sendfile(st->fd, sfd->fd->fd, &fileoffset, sfd->len); +#endif } else { // TODO: regular copy fprintf(stderr, "sendfile not implemented for SYS_FILE\n");