]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/constants.h
Merge pull request #30480 from keszybz/kernel-install-more-paths
[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 /* The default time after which exit-on-idle services exit. This
46 * should be kept lower than the watchdog timeout, because otherwise
47 * the watchdog pings will keep the loop busy. */
48 #define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
49
50 /* The default value for the net.unix.max_dgram_qlen sysctl */
51 #define DEFAULT_UNIX_MAX_DGRAM_QLEN 512
52
53 #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
54 #define SIGNALS_IGNORE SIGPIPE
55
56 #define NOTIFY_FD_MAX 768
57 #define NOTIFY_BUFFER_MAX PIPE_BUF
58
59 /* Return a nulstr for a standard cascade of configuration paths, suitable to pass to
60 * conf_files_list_nulstr() to implement drop-in directories for extending configuration files. */
61 #define CONF_PATHS_NULSTR(n) \
62 "/etc/" n "\0" \
63 "/run/" n "\0" \
64 "/usr/local/lib/" n "\0" \
65 "/usr/lib/" n "\0"
66
67 #define CONF_PATHS(n) \
68 "/etc/" n, \
69 "/run/" n, \
70 "/usr/local/lib/" n, \
71 "/usr/lib/" n
72
73 #define CONF_PATHS_STRV(n) \
74 STRV_MAKE(CONF_PATHS(n))
75
76 /* The limit for PID 1 itself (which is not inherited to children) */
77 #define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
78
79 /* Since kernel 5.16 the kernel default limit was raised to 8M. Let's adjust things on old kernels too, and
80 * in containers so that our children inherit that. */
81 #define DEFAULT_RLIMIT_MEMLOCK (1024ULL*1024ULL*8ULL)
82
83 /* Path where PID1 listens for varlink subscriptions from systemd-oomd to notify of changes in ManagedOOM settings. */
84 #define VARLINK_ADDR_PATH_MANAGED_OOM_SYSTEM "/run/systemd/io.systemd.ManagedOOM"
85 /* Path where systemd-oomd listens for varlink connections from user managers to report changes in ManagedOOM settings. */
86 #define VARLINK_ADDR_PATH_MANAGED_OOM_USER "/run/systemd/oom/io.systemd.ManagedOOM"
87
88 #define KERNEL_BASELINE_VERSION "4.15"