#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
+
/**
*
*/
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;