Commit | Line | Data |
---|---|---|
7d758a6a JH |
1 | /************************************************* |
2 | * Exim - an Internet mail transport agent * | |
3 | *************************************************/ | |
4 | ||
1e1ddfac | 5 | /* Copyright (c) Jeremy Harris 1995 - 2020 */ |
7d758a6a JH |
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 | /************* | |
73a10da9 | 13 | Sendfile shim |
7d758a6a | 14 | *************/ |
7d758a6a JH |
15 | |
16 | ssize_t | |
ab6b4fdb | 17 | os_sendfile(int out, int in, off_t * offp, size_t cnt) |
7d758a6a | 18 | { |
ab6b4fdb JH |
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; | |
7d758a6a JH |
24 | } |
25 | ||
73a10da9 JH |
26 | /************************************************* |
27 | TCP Fast Open: check that the ioctl is accepted | |
28 | *************************************************/ | |
29 | ||
30 | #ifndef COMPILE_UTILITY | |
31 | void | |
32 | tfo_probe(void) | |
33 | { | |
34 | # ifdef TCP_FASTOPEN | |
35 | int sock; | |
36 | ||
37 | if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 | |
38 | && setsockopt(sock, IPPROTO_TCP, TCP_FASTOPEN, &on, sizeof(on) >= 0) | |
39 | ) | |
40 | f.tcp_fastopen_ok = TRUE; | |
41 | close(sock); | |
42 | # endif | |
43 | } | |
44 | #endif | |
45 | ||
46 | ||
7d758a6a | 47 | /* End of os.c-Linux */ |