Enable use of sendfile on FreeBSD
[exim.git] / src / OS / os.h-Linux
CommitLineData
61ec970d
PH
1/* Exim: OS-specific C header file for Linux */
2
b87a6e0e
PP
3/* Some old systems we've received bug-reports for have a <limits.h> which
4does not pull in <features.h>. Best to just pull it in now and have done
5with the issue. */
9d26b8c0
PP
6
7#include <features.h>
7d758a6a 8#include <sys/types.h>
9d26b8c0
PP
9
10
61ec970d
PH
11#define CRYPT_H
12#define GLIBC_IP_OPTIONS
13#define HAVE_MMAP
6e2b4ccc 14#define HAVE_BSD_GETLOADAVG
26034054 15#define HAVE_SYS_STATVFS_H
61ec970d 16#define NO_IP_VAR_H
61ec970d
PH
17#define SIG_IGN_WORKS
18
7d758a6a 19/* When using DKIM, setting OS_SENDFILE can increase
80a47a2c
TK
20performance on outgoing mail a bit. Note: With older glibc versions
21this setting will conflict with the _FILE_OFFSET_BITS=64 setting
eeb35890
JH
22defined as part of the Linux CFLAGS. As of 2017 those are declared
23to be too old to build by default. */
2f43ad4a 24
7d758a6a
JH
25#define OS_SENDFILE
26extern ssize_t os_sendfile(int, int, off_t *, size_t);
2f43ad4a 27
6e2b4ccc
PH
28#define F_FREESP O_TRUNC
29typedef struct flock flock_t;
30
31#define os_strsignal strsignal
32#define OS_STRSIGNAL
33
34#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__)
7d758a6a
JH
35# define SIOCGIFCONF_GIVES_ADDR
36# define HAVE_SYS_MOUNT_H
6e2b4ccc
PH
37#endif
38
39#if defined(__linux__)
40
61ec970d
PH
41/* Some versions of Linux need explicit sync-ing of directories as well as
42files. This setting requests that. If the directory is on NFS, it may not
43be possible to sync it - in that case, Exim now should ignore the error. But
44if you have problems in that area, try undefining this. But be aware that you
45may be in a situation where files are not being properly "committed to stable
46storage" as quickly as Exim thinks they are. */
47
48#define NEED_SYNC_DIRECTORY
49
61ec970d
PH
50#define os_find_running_interfaces os_find_running_interfaces_linux
51
52/* Need a prototype for the Linux-specific function. The structure hasn't
53been defined yet, so we need to pre-declare it. */
54
55struct ip_address_item;
56extern struct ip_address_item *os_find_running_interfaces_linux(void);
57
6e2b4ccc
PH
58#endif /* __linux__ */
59
05ec18de
PP
60/* Some folks running "unusual" setups with very old libc environments have
61found that _GNU_SOURCE=1 before <features.h> is not sufficient to define some
62constants needed for 64-bit arithmetic. If you encounter build errors based
63on LLONG_MIN being undefined and various other escape hatches have not helped,
64then change the 0 to 1 in the next block. */
65
66#if 0
67# define LLONG_MIN LONG_LONG_MIN
68# define LLONG_MAX LONG_LONG_MAX
69#endif
70
10c50704
JH
71#if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOUCE
72# define EXIM_HAVE_OPENAT
73#endif
74
4c089965
JH
75#include <netinet/tcp.h> /* for TCP_FASTOPEN */
76#include <sys/socket.h> /* for MSG_FASTOPEN */
18f1b2f3
JH
77#if defined(TCP_FASTOPEN) && !defined(MSG_FASTOPEN)
78# define MSG_FASTOPEN 0x20000000
79#endif
80
05ec18de 81
61ec970d 82/* End */