]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add sendfile(2) support for FreeBSD.
authorBernhard Froehlich <decke@bluelife.at>
Sat, 4 May 2013 13:08:14 +0000 (15:08 +0200)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 31 May 2013 13:19:25 +0000 (14:19 +0100)
src/webui/webui.c

index 997b8829ec84a415e08be90660c03d0406f119e9..6cfd69934820b23f8a4fe67fad90cf7058a8ca39 100644 (file)
@@ -29,7 +29,6 @@
 #include <arpa/inet.h>
 
 #include <sys/stat.h>
-#include <sys/sendfile.h>
 
 #include "tvheadend.h"
 #include "access.h"
 #include "imagecache.h"
 #include "tcp.h"
 
+#if defined(PLATFORM_LINUX)
+#include <sys/sendfile.h>
+#elif defined(PLATFORM_FREEBSD)
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#endif
+
 /**
  *
  */
@@ -931,7 +938,11 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
   if(!hc->hc_no_output) {
     while(content_len > 0) {
       chunk = MIN(1024 * 1024 * 1024, content_len);
+#if defined(PLATFORM_LINUX)
       r = sendfile(hc->hc_fd, fd, NULL, chunk);
+#elif defined(PLATFORM_FREEBSD)
+      sendfile(fd, hc->hc_fd, 0, chunk, NULL, &r, 0);
+#endif
       if(r == -1) {
   close(fd);
   return -1;