Merge branch 'master' into 4.next
[exim.git] / src / OS / os.h-FreeBSD
1 /* Exim: OS-specific C header file for FreeBSD */
2 /* Copyright (c) University of Cambridge 2017 */
3 /* See the file NOTICE for conditions of use and distribution. */
4
5
6 #include <sys/types.h>
7
8 #define HAVE_BSD_GETLOADAVG
9 #define HAVE_SETCLASSRESOURCES
10 #define HAVE_MMAP
11 #define HAVE_SYS_MOUNT_H
12 #define SIOCGIFCONF_GIVES_ADDR
13 #define HAVE_SRANDOMDEV
14 #define HAVE_ARC4RANDOM
15
16 typedef struct flock flock_t;
17
18 /* iconv arg2 type: libiconv in Ports uses "const char* * inbuf" and was
19 * traditionally the only approach available. The iconv functionality
20 * in libc is "char ** restrict src".
21 *
22 * <https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html>
23 * says that libc has iconv since 2013, in 10-CURRENT. FreeBSD man-pages
24 * shows it included in 10.0-RELEASE. Writing this in 2017, 10.3 is the
25 * oldest supported release, so we should assume non-libiconv by default.
26 * (Actually, people still using old releases past EOL; we shouldn't support
27 * them but I don't want to deal with howls of complaints because we dare
28 * to not support the unsupported, so guard this on FreeBSD 10+)
29 *
30 * Thus we no longer override iconv.
31 *
32 * However, if libiconv is installed, and anything adds /usr/local/include
33 * to include-path (likely) then we'll get that. So define a variable
34 * which makes the libiconv try to not interfere with OS iconv.
35 */
36 #if __FreeBSD__ >= 10
37 # define LIBICONV_PLUG
38 #endif
39 /* for more specific version constraints, include <sys/param.h> and look at
40 * __FreeBSD_version */
41
42
43 /* When using DKIM, setting OS_SENDFILE can increase
44 performance on outgoing mail a bit. */
45
46 #define OS_SENDFILE
47 extern ssize_t os_sendfile(int, int, off_t *, size_t);
48
49
50 /*******************/
51
52 /* TCP_FASTOPEN support. There does not seems to be a
53 MSG_FASTOPEN defined yet... */
54 #define EXIM_TFO_PROBE
55
56 #include <netinet/tcp.h> /* for TCP_FASTOPEN */
57 #include <sys/socket.h> /* for MSG_FASTOPEN */
58 #if defined(TCP_FASTOPEN) && !defined(MSG_FASTOPEN)
59 # define MSG_FASTOPEN 0x20000000
60 #endif
61
62 /* for TCP state-variable values, for TFO logging */
63 #include <netinet/tcp_fsm.h>
64 #define TCP_SYN_RECV TCPS_SYN_RECEIVED
65
66 /*******************/
67
68 /* End */