diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-22 21:25:39 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-22 21:25:39 +0400 |
commit | f1a514c9bfbdb1c67d4d5acbd191f77692e2ecce (patch) | |
tree | 2d70cab4368950a74abf0b6b90e3b1b8ff7b4206 /src/buffer.c | |
parent | e9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea (diff) | |
download | rspamd-f1a514c9bfbdb1c67d4d5acbd191f77692e2ecce.tar.gz rspamd-f1a514c9bfbdb1c67d4d5acbd191f77692e2ecce.zip |
* Darwin sendfile(2) support
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index 6be6ce7d0..be6d2acc8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -43,10 +43,15 @@ sendfile_callback (rspamd_io_dispatcher_t *d) GError *err; #ifdef HAVE_SENDFILE - #if defined(FREEBSD) || defined(DARWIN) +# if defined(FREEBSD) || defined(DARWIN) + #if defined(FREEBSD) off_t off = 0; /* FreeBSD version */ - if (sendfile (d->sendfile_fd, d->fd, d->offset, 0, 0, &off, 0) != 0) { + if (sendfile (d->sendfile_fd, d->fd, d->offset, 0, NULL, &off, 0) != 0) { + #elif defined(DARWIN) + /* Darwin version */ + if (sendfile (d->sendfile_fd, d->fd, d->offset, &off, NULL, 0) != 0) { + #endif if (errno != EAGAIN) { if (d->err_callback) { err = g_error_new (G_DISPATCHER_ERROR, errno, "%s", strerror (errno)); @@ -75,7 +80,7 @@ sendfile_callback (rspamd_io_dispatcher_t *d) event_add (d->ev, d->tv); d->in_sendfile = FALSE; } - #else +# else /* Linux version */ r = sendfile (d->fd, d->sendfile_fd, &d->offset, d->file_size); if (r == -1) { @@ -113,7 +118,7 @@ sendfile_callback (rspamd_io_dispatcher_t *d) event_add (d->ev, d->tv); d->in_sendfile = FALSE; } - #endif +# endif #else r = write (d->fd, d->map, d->file_size - d->offset); if (r == -1) { |