1 /* MiniDLNA media server
2 * Copyright (C) 2013 NETGEAR
4 * This file is part of MiniDLNA.
6 * MiniDLNA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * MiniDLNA is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
18 #if defined(HAVE_LINUX_SENDFILE_API)
20 #include <sys/sendfile.h>
22 int sys_sendfile(int sock
, int sendfd
, off_t
*offset
, off_t len
)
24 return sendfile(sock
, sendfd
, offset
, len
);
27 #elif defined(HAVE_DARWIN_SENDFILE_API)
29 #include <sys/types.h>
30 #include <sys/socket.h>
33 int sys_sendfile(int sock
, int sendfd
, off_t
*offset
, off_t len
)
37 ret
= sendfile(sendfd
, sock
, *offset
, &len
, NULL
, 0);
43 #elif defined(HAVE_FREEBSD_SENDFILE_API)
45 #include <sys/types.h>
46 #include <sys/socket.h>
49 int sys_sendfile(int sock
, int sendfd
, off_t
*offset
, off_t len
)
54 ret
= sendfile(sendfd
, sock
, *offset
, nbytes
, NULL
, &len
, 0);
64 int sys_sendfile(int sock
, int sendfd
, off_t
*offset
, off_t len
)