]> 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)
committerBernhard Froehlich <decke@bluelife.at>
Sat, 4 May 2013 13:08:14 +0000 (15:08 +0200)
src/webui/webui.c

index bc7d5989ee630b47b7c4af26f348d0335b94628a..13c8e35c63ef06edd1774a65e3bee63696068d31 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
+
 /**
  *
  */
@@ -872,7 +879,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;