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~46^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f24ea24b26bc702a052eb24765f7adbbd55815ee;p=thirdparty%2Ftvheadend.git Add sendfile(2) support for FreeBSD. --- diff --git a/src/webui/webui.c b/src/webui/webui.c index 997b8829e..6cfd69934 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -29,7 +29,6 @@ #include #include -#include #include "tvheadend.h" #include "access.h" @@ -48,6 +47,14 @@ #include "imagecache.h" #include "tcp.h" +#if defined(PLATFORM_LINUX) +#include +#elif defined(PLATFORM_FREEBSD) +#include +#include +#include +#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;