From 0c64df2331827d4ec08626579e07f1a0ae132db5 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 6 Oct 2003 01:54:49 +0000 Subject: [PATCH] make BSD sendfile optional (NetBSD doesn't have it) --- io/io_sendfile.c | 3 ++- io/iob_send.c | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/io/io_sendfile.c b/io/io_sendfile.c index b92629c..399d955 100644 --- a/io/io_sendfile.c +++ b/io/io_sendfile.c @@ -1,7 +1,8 @@ #define _FILE_OFFSET_BITS 64 #include "io_internal.h" +#include "havebsdsf.h" -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(HAVE_BSDSENDFILE) #include #include #include diff --git a/io/iob_send.c b/io/iob_send.c index 291ffaa..bf059c9 100644 --- a/io/iob_send.c +++ b/io/iob_send.c @@ -1,7 +1,3 @@ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -#define BSD_SENDFILE -#endif - #include #include #include @@ -13,6 +9,7 @@ #endif #include "iob_internal.h" +#include "havebsdsf.h" int64 iob_send(int64 s,io_batch* b) { iob_entry* e,* last; @@ -20,7 +17,7 @@ int64 iob_send(int64 s,io_batch* b) { int64 total,sent; long i; long headers; -#ifdef BSD_SENDFILE +#ifdef HAVEBSDSENDFILE long trailers; #endif @@ -31,7 +28,7 @@ int64 iob_send(int64 s,io_batch* b) { for (;;) { if (!(e=array_get(&b->b,sizeof(iob_entry),b->next))) return -3; /* can't happen error */ -#ifdef BSD_SENDFILE +#ifdef HAVEBSDSENDFILE /* BSD sendfile can send headers and trailers. If we run on BSD, we * should try to exploit this. */ headers=trailers=0; @@ -42,7 +39,7 @@ int64 iob_send(int64 s,io_batch* b) { v[i].iov_len=e[i].n-e[i].offset; } headers=i; -#ifdef BSD_SENDFILE +#ifdef HAVEBSDSENDFILE if (e[i].type==FROMFILE) { off_t sbytes; struct sf_hdtr hdr;