Add sendfile(2) support for FreeBSD.
This commit is contained in:
parent
0fdc4fc193
commit
f24ea24b26
1 changed files with 12 additions and 1 deletions
|
@ -29,7 +29,6 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sendfile.h>
|
||||
|
||||
#include "tvheadend.h"
|
||||
#include "access.h"
|
||||
|
@ -48,6 +47,14 @@
|
|||
#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
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue