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