FreeBSD: fix sendfile shim
[exim.git] / src / OS / os.c-FreeBSD
1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
4
5 /* Copyright (c) Jeremy Harris 1995 - 2019 */
6 /* See the file NOTICE for conditions of use and distribution. */
7
8 /* FreeBSD-specific code. This is concatenated onto the generic
9 src/os.c file. */
10
11
12 /*************
13 * Sendfile *
14 *************/
15
16 ssize_t
17 os_sendfile(int out, int in, off_t * offp, size_t cnt)
18 {
19 off_t loff = *offp, written;
20
21 if (sendfile(in, out, loff, cnt, NULL, &written, 0) < 0) return (ssize_t)-1;
22 *offp = loff + written;
23 return (ssize_t)written;
24 }
25
26 /* End of os.c-Linux */