]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/constants.h
basic/filesystems: fs_in_group() returns a boolean
[thirdparty/systemd.git] / src / basic / constants.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #if !defined(HAS_FEATURE_MEMORY_SANITIZER)
5 # if defined(__has_feature)
6 # if __has_feature(memory_sanitizer)
7 # define HAS_FEATURE_MEMORY_SANITIZER 1
8 # endif
9 # endif
10 # if !defined(HAS_FEATURE_MEMORY_SANITIZER)
11 # define HAS_FEATURE_MEMORY_SANITIZER 0
12 # endif
13 #endif
14
15 #if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
16 # ifdef __SANITIZE_ADDRESS__
17 # define HAS_FEATURE_ADDRESS_SANITIZER 1
18 # elif defined(__has_feature)
19 # if __has_feature(address_sanitizer)
20 # define HAS_FEATURE_ADDRESS_SANITIZER 1
21 # endif
22 # endif
23 # if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
24 # define HAS_FEATURE_ADDRESS_SANITIZER 0
25 # endif
26 #endif
27
28 #define DEFAULT_TIMEOUT_USEC (90*USEC_PER_SEC)
29 #define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC)
30 #define DEFAULT_CONFIRM_USEC (30*USEC_PER_SEC)
31
32 /* We use an extra-long timeout for the reload. This is because a reload or reexec means generators are rerun
33 * which are timed out after DEFAULT_TIMEOUT_USEC. Let's use twice that time here, so that the generators can
34 * have their timeout, and for everything else there's the same time budget in place. */
35 #define DAEMON_RELOAD_TIMEOUT_SEC (DEFAULT_TIMEOUT_USEC * 2)
36
37 #define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC)
38 #define DEFAULT_START_LIMIT_BURST 5
39
40 /* The default time after which exit-on-idle services exit. This
41 * should be kept lower than the watchdog timeout, because otherwise
42 * the watchdog pings will keep the loop busy. */
43 #define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
44
45 /* The default value for the net.unix.max_dgram_qlen sysctl */
46 #define DEFAULT_UNIX_MAX_DGRAM_QLEN 512UL
47
48 #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
49 #define SIGNALS_IGNORE SIGPIPE
50
51 #define NOTIFY_FD_MAX 768
52 #define NOTIFY_BUFFER_MAX PIPE_BUF
53
54 #if HAVE_SPLIT_USR
55 # define _CONF_PATHS_SPLIT_USR_NULSTR(n) "/lib/" n "\0"
56 # define _CONF_PATHS_SPLIT_USR(n) , "/lib/" n
57 #else
58 # define _CONF_PATHS_SPLIT_USR_NULSTR(n)
59 # define _CONF_PATHS_SPLIT_USR(n)
60 #endif
61
62 /* Return a nulstr for a standard cascade of configuration paths,
63 * suitable to pass to conf_files_list_nulstr() or config_parse_many_nulstr()
64 * to implement drop-in directories for extending configuration
65 * files. */
66 #define CONF_PATHS_NULSTR(n) \
67 "/etc/" n "\0" \
68 "/run/" n "\0" \
69 "/usr/local/lib/" n "\0" \
70 "/usr/lib/" n "\0" \
71 _CONF_PATHS_SPLIT_USR_NULSTR(n)
72
73 #define CONF_PATHS_USR(n) \
74 "/etc/" n, \
75 "/run/" n, \
76 "/usr/local/lib/" n, \
77 "/usr/lib/" n
78
79 #define CONF_PATHS(n) \
80 CONF_PATHS_USR(n) \
81 _CONF_PATHS_SPLIT_USR(n)
82
83 #define CONF_PATHS_USR_STRV(n) \
84 STRV_MAKE(CONF_PATHS_USR(n))
85
86 #define CONF_PATHS_STRV(n) \
87 STRV_MAKE(CONF_PATHS(n))
88
89 /* The limit for PID 1 itself (which is not inherited to children) */
90 #define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
91
92 /* Since kernel 5.16 the kernel default limit was raised to 8M. Let's adjust things on old kernels too, and
93 * in containers so that our children inherit that. */
94 #define DEFAULT_RLIMIT_MEMLOCK (1024ULL*1024ULL*8ULL)
95
96 #define PLYMOUTH_SOCKET { \
97 .un.sun_family = AF_UNIX, \
98 .un.sun_path = "\0/org/freedesktop/plymouthd", \
99 }
100
101 /* Path where PID1 listens for varlink subscriptions from systemd-oomd to notify of changes in ManagedOOM settings. */
102 #define VARLINK_ADDR_PATH_MANAGED_OOM_SYSTEM "/run/systemd/io.system.ManagedOOM"
103 /* Path where systemd-oomd listens for varlink connections from user managers to report changes in ManagedOOM settings. */
104 #define VARLINK_ADDR_PATH_MANAGED_OOM_USER "/run/systemd/oom/io.system.ManagedOOM"
105
106 #define KERNEL_BASELINE_VERSION "4.15"