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