1 /* Exim: OS-specific C header file for Linux */
2 /* Copyright (c) University of Cambridge 1995 - 2020 */
3 /* Copyright (c) The Exim Maintainers 2021 */
4 /* See the file NOTICE for conditions of use and distribution. */
7 /* Some old systems we've received bug-reports for have a <limits.h> which
8 does not pull in <features.h>. Best to just pull it in now and have done
12 #include <sys/types.h>
16 #define GLIBC_IP_OPTIONS
18 #define HAVE_BSD_GETLOADAVG
19 #define HAVE_SYS_STATVFS_H
20 #define HAVE_GETIFADDRS
24 /* When using DKIM, setting OS_SENDFILE can increase
25 performance on outgoing mail a bit. Note: With older glibc versions
26 this setting will conflict with the _FILE_OFFSET_BITS=64 setting
27 defined as part of the Linux CFLAGS. As of 2017 those are declared
28 to be too old to build by default. */
31 extern ssize_t os_sendfile(int, int, off_t *, size_t);
33 #define F_FREESP O_TRUNC
34 typedef struct flock flock_t;
36 #define os_strsignal strsignal
39 #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__)
40 # define SIOCGIFCONF_GIVES_ADDR
41 # define HAVE_SYS_MOUNT_H
44 #if defined(__linux__)
46 /* Some versions of Linux need explicit sync-ing of directories as well as
47 files. This setting requests that. If the directory is on NFS, it may not
48 be possible to sync it - in that case, Exim now should ignore the error. But
49 if you have problems in that area, try undefining this. But be aware that you
50 may be in a situation where files are not being properly "committed to stable
51 storage" as quickly as Exim thinks they are. */
53 #define NEED_SYNC_DIRECTORY
55 #define os_find_running_interfaces os_find_running_interfaces_linux
57 /* Need a prototype for the Linux-specific function. The structure hasn't
58 been defined yet, so we need to pre-declare it. */
60 struct ip_address_item;
61 extern struct ip_address_item *os_find_running_interfaces_linux(void);
63 #endif /* __linux__ */
65 /* Some folks running "unusual" setups with very old libc environments have
66 found that _GNU_SOURCE=1 before <features.h> is not sufficient to define some
67 constants needed for 64-bit arithmetic. If you encounter build errors based
68 on LLONG_MIN being undefined and various other escape hatches have not helped,
69 then change the 0 to 1 in the next block. */
72 # define LLONG_MIN LONG_LONG_MIN
73 # define LLONG_MAX LONG_LONG_MAX
76 #if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOURCE
77 # define EXIM_HAVE_OPENAT
78 # define EXIM_HAVE_FUTIMENS
81 /* TCP Fast Open support */
83 #include <netinet/tcp.h> /* for TCP_FASTOPEN */
84 #include <sys/socket.h> /* for MSG_FASTOPEN */
85 #if defined(TCP_FASTOPEN) && !defined(MSG_FASTOPEN)
86 # define MSG_FASTOPEN 0x20000000
88 #define EXIM_HAVE_TCPI_UNACKED
89 #ifndef TCPI_OPT_SYN_DATA
90 # define TCPI_OPT_SYN_DATA 32
93 /* "Abstract" Unix-socket names */
94 #define EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
96 /* inotify(7) etc syscalls */
97 #define EXIM_HAVE_INOTIFY
99 /* Needed for uClibc */
101 # define NS_MAXMSG 65535