]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/constants.h
conf: replace config_parse_many_nulstr() with config_parse_config_file()
[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_RESTART_USEC (100*USEC_PER_MSEC)
29
30 /* Many different things, but also system unit start/stop */
31 #define DEFAULT_TIMEOUT_USEC (DEFAULT_TIMEOUT_SEC*USEC_PER_SEC)
32 /* User unit start/stop */
33 #define DEFAULT_USER_TIMEOUT_USEC (DEFAULT_USER_TIMEOUT_SEC*USEC_PER_SEC)
34 /* Timeout for user confirmation on the console */
35 #define DEFAULT_CONFIRM_USEC (30*USEC_PER_SEC)
36
37 /* We use an extra-long timeout for the reload. This is because a reload or reexec means generators are rerun
38 * which are timed out after DEFAULT_TIMEOUT_USEC. Let's use twice that time here, so that the generators can
39 * have their timeout, and for everything else there's the same time budget in place. */
40 #define DAEMON_RELOAD_TIMEOUT_SEC (DEFAULT_TIMEOUT_USEC * 2)
41
42 #define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC)
43 #define DEFAULT_START_LIMIT_BURST 5
44
45 /* Wait for 1.5 seconds at maximum for freeze operation */
46 #define FREEZE_TIMEOUT (1500 * USEC_PER_MSEC)
47
48 /* The default time after which exit-on-idle services exit. This
49 * should be kept lower than the watchdog timeout, because otherwise
50 * the watchdog pings will keep the loop busy. */
51 #define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
52
53 /* The default value for the net.unix.max_dgram_qlen sysctl */
54 #define DEFAULT_UNIX_MAX_DGRAM_QLEN 512
55
56 #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
57 #define SIGNALS_IGNORE SIGPIPE
58
59 #define NOTIFY_FD_MAX 768
60 #define NOTIFY_BUFFER_MAX PIPE_BUF
61
62 #if HAVE_SPLIT_USR
63 # define _CONF_PATHS_SPLIT_USR_NULSTR(n) "/lib/" n "\0"
64 # define _CONF_PATHS_SPLIT_USR(n) , "/lib/" n
65 #else
66 # define _CONF_PATHS_SPLIT_USR_NULSTR(n)
67 # define _CONF_PATHS_SPLIT_USR(n)
68 #endif
69
70 /* Return a nulstr for a standard cascade of configuration paths, suitable to pass to
71 * conf_files_list_nulstr() to implement drop-in directories for extending configuration files. */
72 #define CONF_PATHS_NULSTR(n) \
73 "/etc/" n "\0" \
74 "/run/" n "\0" \
75 "/usr/local/lib/" n "\0" \
76 "/usr/lib/" n "\0" \
77 _CONF_PATHS_SPLIT_USR_NULSTR(n)
78
79 #define CONF_PATHS_USR(n) \
80 "/etc/" n, \
81 "/run/" n, \
82 "/usr/local/lib/" n, \
83 "/usr/lib/" n
84
85 #define CONF_PATHS(n) \
86 CONF_PATHS_USR(n) \
87 _CONF_PATHS_SPLIT_USR(n)
88
89 #define CONF_PATHS_USR_STRV(n) \
90 STRV_MAKE(CONF_PATHS_USR(n))
91
92 #define CONF_PATHS_STRV(n) \
93 STRV_MAKE(CONF_PATHS(n))
94
95 /* The limit for PID 1 itself (which is not inherited to children) */
96 #define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
97
98 /* Since kernel 5.16 the kernel default limit was raised to 8M. Let's adjust things on old kernels too, and
99 * in containers so that our children inherit that. */
100 #define DEFAULT_RLIMIT_MEMLOCK (1024ULL*1024ULL*8ULL)
101
102 #define PLYMOUTH_SOCKET { \
103 .un.sun_family = AF_UNIX, \
104 .un.sun_path = "\0/org/freedesktop/plymouthd", \
105 }
106
107 /* Path where PID1 listens for varlink subscriptions from systemd-oomd to notify of changes in ManagedOOM settings. */
108 #define VARLINK_ADDR_PATH_MANAGED_OOM_SYSTEM "/run/systemd/io.system.ManagedOOM"
109 /* Path where systemd-oomd listens for varlink connections from user managers to report changes in ManagedOOM settings. */
110 #define VARLINK_ADDR_PATH_MANAGED_OOM_USER "/run/systemd/oom/io.system.ManagedOOM"
111
112 #define KERNEL_BASELINE_VERSION "4.15"