From f24ea24b26bc702a052eb24765f7adbbd55815ee Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 4 May 2013 15:08:14 +0200 Subject: [PATCH] Add sendfile(2) support for FreeBSD. --- src/webui/webui.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 997b8829..6cfd6993 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;