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