about summary refs log tree commit homepage
path: root/http_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'http_get.c')
-rw-r--r--http_get.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/http_get.c b/http_get.c
index eb6c5a8..7e43b31 100644
--- a/http_get.c
+++ b/http_get.c
@@ -5,11 +5,18 @@
 
 #include "cmogstored.h"
 #include "http.h"
-#if defined(HAVE_SENDFILE)
-#  ifdef HAVE_SYS_SENDFILE_H /* Linux */
-#    include <sys/sendfile.h>
-#  endif
-#  ifndef __linux__
+
+#if defined(HAVE_SYS_SENDFILE_H) && !defined(HAVE_BSD_SENDFILE)
+#  include <sys/sendfile.h>
+#endif
+
+#if defined(__linux__)
+/* all good */
+#elif defined(HAVE_SENDFILE) || defined(HAVE_BSD_SENDFILE)
+#  if defined(HAVE_BSD_SENDFILE) && !defined(HAVE_SENDFILE)/* Debian kFBSD */
+#    define sendfile(fd,s,offset,nbytes,hdtr,sbytes,flags) \
+            bsd_sendfile((fd),(s),(offset),(nbytes),(hdtr),(sbytes),(flags))
+#  endif /* HAVE_BSD_SENDFILE */
 /*
  * make BSD sendfile look like Linux for now...
  * we can support SF_NODISKIO later
@@ -28,9 +35,12 @@ static ssize_t linux_sendfile(int sockfd, int filefd, off_t *off, size_t count)
 
         return (ssize_t)rc;
 }
+
+#  if defined(HAVE_BSD_SENDFILE) /* Debian GNU/kFreeBSD */
+#    undef sendfile
+#  endif /* HAVE_BSD_SENDFILE */
 #  define sendfile(out_fd, in_fd, offset, count) \
           linux_sendfile((out_fd),(in_fd),(offset),(count))
-#  endif
 #else
 #  include "compat_sendfile.h"
 #endif