aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 21:25:39 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-22 21:25:39 +0400
commitf1a514c9bfbdb1c67d4d5acbd191f77692e2ecce (patch)
tree2d70cab4368950a74abf0b6b90e3b1b8ff7b4206
parente9d2ad6a1b942cb5bbba9a268cc7e0108a0145ea (diff)
downloadrspamd-f1a514c9bfbdb1c67d4d5acbd191f77692e2ecce.tar.gz
rspamd-f1a514c9bfbdb1c67d4d5acbd191f77692e2ecce.zip
* Darwin sendfile(2) support
-rw-r--r--src/buffer.c13
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) {