From: Bernhard Froehlich Date: Sat, 4 May 2013 13:08:14 +0000 (+0200) Subject: Add sendfile(2) support for FreeBSD. X-Git-Tag: v3.9~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0ec040cf264493379f1f71d187ddfca75f2a6bb;p=thirdparty%2Ftvheadend.git Add sendfile(2) support for FreeBSD. --- diff --git a/src/webui/webui.c b/src/webui/webui.c index bc7d5989e..13c8e35c6 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -29,7 +29,6 @@ #include #include -#include #include "tvheadend.h" #include "access.h" @@ -47,6 +46,14 @@ #include "imagecache.h" #include "tcp.h" +#if defined(PLATFORM_LINUX) +#include +#elif defined(PLATFORM_FREEBSD) +#include +#include +#include +#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;