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