#include "automount.h"
#include "device.h"
+#include "mount.h"
#include "path.h"
#include "scope.h"
#include "service.h"
#include "io-util.h"
#include "label-util.h"
#include "mkdir-label.h"
+#include "manager.h"
#include "mount-util.h"
#include "mount.h"
#include "mountpoint-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Automount Automount;
-
#include "unit.h"
typedef enum AutomountResult {
_AUTOMOUNT_RESULT_INVALID = -EINVAL,
} AutomountResult;
-struct Automount {
+typedef struct Automount {
Unit meta;
AutomountState state, deserialized_state;
sd_event_source *expire_event_source;
AutomountResult result;
-};
+} Automount;
extern const UnitVTable automount_vtable;
#include "bpf-program.h"
#include "fd-util.h"
#include "in-addr-prefix-util.h"
+#include "manager.h"
#include "memory-util.h"
#include "missing_syscall.h"
#include "unit.h"
#include "fd-util.h"
#include "bpf-restrict-ifaces.h"
#include "netlink-util.h"
+#include "unit.h"
#if BPF_FRAMEWORK
/* libbpf, clang and llc compile time dependencies are satisfied */
#pragma once
#include "fdset.h"
-#include "unit.h"
typedef struct Unit Unit;
#include "fd-util.h"
#include "bpf-socket-bind.h"
+#include "unit.h"
#if BPF_FRAMEWORK
/* libbpf, clang, llvm and bpftool compile time dependencies are satisfied */
#pragma once
#include "fdset.h"
-#include "unit.h"
+
+typedef struct Unit Unit;
int bpf_socket_bind_supported(void);
#include "io-util.h"
#include "ip-protocol-list.h"
#include "limits-util.h"
+#include "manager.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "sd-varlink.h"
#include "core-varlink.h"
+#include "dynamic-user.h"
#include "json-util.h"
+#include "manager.h"
#include "mkdir-label.h"
#include "strv.h"
+#include "unit.h"
#include "user-util.h"
#include "varlink-internal.h"
#include "varlink-io.systemd.UserDatabase.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "manager.h"
+typedef struct Manager Manager;
+typedef struct Unit Unit;
int manager_setup_varlink_server(Manager *m);
#include "in-addr-prefix-util.h"
#include "ip-protocol-list.h"
#include "limits-util.h"
+#include "manager.h"
#include "memstream-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "sd-bus-vtable.h"
#include "execute.h"
+#include "unit.h"
#define BUS_EXEC_STATUS_VTABLE(prefix, offset, flags) \
BUS_PROPERTY_DUAL_TIMESTAMP(prefix "StartTimestamp", (offset) + offsetof(ExecStatus, start_timestamp), flags), \
#include "sd-bus.h"
-#include "unit.h"
#include "bus-object.h"
+typedef struct Job Job;
+
extern const sd_bus_vtable bus_job_vtable[];
extern const BusObjectImplementation job_object;
#include "dbus-unit.h"
#include "dbus-util.h"
#include "dbus.h"
+#include "dynamic-user.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "sd-bus-vtable.h"
-#include "manager.h"
+#include "time-util.h"
+
+typedef struct Manager Manager;
extern const sd_bus_vtable bus_manager_vtable[];
extern const sd_bus_vtable bus_manager_log_control_vtable[];
#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "scope.h"
#include "unit.h"
+typedef struct Scope Scope;
+
extern const sd_bus_vtable bus_scope_vtable[];
int bus_scope_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error);
#include "bus-util.h"
#include "dbus-util.h"
#include "escape.h"
+#include "manager.h"
#include "parse-util.h"
#include "path-util.h"
#include "reboot-util.h"
#include "sd-bus.h"
-#include "manager.h"
+#include "fdset.h"
+
+typedef struct Manager Manager;
void bus_send_pending_reload_message(Manager *m);
#include "device-util.h"
#include "device.h"
#include "log.h"
+#include "manager.h"
#include "parse-util.h"
#include "path-util.h"
#include "ratelimit.h"
#include "unit.h"
-typedef struct Device Device;
-
/* A mask specifying where we have seen the device currently. This is a bitmask because the device might show up
* asynchronously from each other at various places. For example, in very common case a device might already be mounted
* before udev finished probing it (think: a script setting up a loopback block device, formatting it and mounting it
_DEVICE_FOUND_MASK = DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP,
} DeviceFound;
-struct Device {
+typedef struct Device {
Unit meta;
char *sysfs, *deserialized_sysfs;
/* The SYSTEMD_WANTS udev property for this device the last time we saw it */
char **wants_property;
-};
+} Device;
extern const UnitVTable device_vtable;
#include "fs-util.h"
#include "iovec-util.h"
#include "lock-util.h"
+#include "manager.h"
#include "parse-util.h"
#include "random-util.h"
#include "serialize.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+#include "fdset.h"
+#include "memory-util.h"
+
typedef struct DynamicUser DynamicUser;
+typedef struct Manager Manager;
typedef struct DynamicCreds {
/* A combination of a dynamic user and group */
DynamicUser *group;
} DynamicCreds;
-#include "manager.h"
-
/* Note that this object always allocates a pair of user and group under the same name, even if one of them isn't
* used. This means, if you want to allocate a group and user pair, and they might have two different names, then you
* need to allocated two of these objects. DynamicCreds below makes that easy. */
#include "bus-error.h"
#include "bus-util.h"
#include "emergency-action.h"
+#include "manager.h"
#include "raw-reboot.h"
#include "reboot-util.h"
#include "special.h"
#include <errno.h>
+#include "macro.h"
#include "runtime-scope.h"
+typedef struct Manager Manager;
+
typedef enum EmergencyAction {
EMERGENCY_ACTION_NONE,
EMERGENCY_ACTION_EXIT,
_EMERGENCY_ACTION_FLAGS_MAX = (1 << 3) - 1,
} EmergencyActionFlags;
-#include "macro.h"
-#include "manager.h"
-
void emergency_action(
Manager *m,
EmergencyAction action,
#include "bpf-restrict-fs.h"
#include "btrfs-util.h"
#include "capability-util.h"
+#include "cgroup.h"
#include "cgroup-setup.h"
#include "chase.h"
#include "chattr-util.h"
#include "chown-recursive.h"
#include "copy.h"
+#include "dynamic-user.h"
#include "env-util.h"
#include "escape.h"
#include "exec-credential.h"
#include "ioprio-util.h"
#include "iovec-util.h"
#include "journal-send.h"
+#include "manager.h"
#include "memfd-util.h"
#include "missing_sched.h"
#include "missing_syscall.h"
#include "mkdir-label.h"
+#include "mount-util.h"
#include "osc-context.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "af-list.h"
#include "capability-util.h"
+#include "cgroup.h"
#include "cgroup-setup.h"
+#include "dynamic-user.h"
#include "escape.h"
#include "exec-credential.h"
#include "execute-serialize.h"
#include "cgroup-setup.h"
#include "constants.h"
#include "cpu-set-util.h"
+#include "dynamic-user.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-list.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct ExecStatus ExecStatus;
-typedef struct ExecCommand ExecCommand;
-typedef struct ExecContext ExecContext;
-typedef struct ExecSharedRuntime ExecSharedRuntime;
-typedef struct DynamicCreds DynamicCreds;
-typedef struct ExecRuntime ExecRuntime;
-typedef struct ExecParameters ExecParameters;
-typedef struct Manager Manager;
-
#include <sched.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/capability.h>
+#include <sys/socket.h>
#include "bus-unit-util.h"
#include "cgroup-util.h"
#include "exec-util.h"
#include "fdset.h"
#include "list.h"
+#include "log-context.h"
#include "namespace.h"
#include "nsflags.h"
#include "numa-util.h"
#include "set.h"
#include "time-util.h"
+typedef struct CGroupContext CGroupContext;
+typedef struct ExecStatus ExecStatus;
+typedef struct ExecCommand ExecCommand;
+typedef struct ExecContext ExecContext;
+typedef struct ExecSharedRuntime ExecSharedRuntime;
+typedef struct DynamicCreds DynamicCreds;
+typedef struct ExecRuntime ExecRuntime;
+typedef struct ExecParameters ExecParameters;
+typedef struct Manager Manager;
+typedef struct Unit Unit;
+
#define EXEC_STDIN_DATA_MAX (64U*1024U*1024U)
typedef enum ExecUtmpMode {
.pidref_transport_fd = -EBADF, \
}
-#include "unit.h"
-#include "dynamic-user.h"
-
int exec_spawn(
Unit *unit,
ExecCommand *command,
#include "argv-util.h"
#include "build.h"
#include "capability-util.h"
+#include "cgroup.h"
+#include "dynamic-user.h"
#include "exec-invoke.h"
#include "execute-serialize.h"
#include "execute.h"
#include <stdio.h>
#include "alloc-util.h"
+#include "dynamic-user.h"
#include "execute-serialize.h"
#include "fd-util.h"
#include "fuzz.h"
#include "fuzz.h"
#include "install.h"
#include "load-fragment.h"
+#include "manager.h"
#include "manager-dump.h"
#include "memstream-util.h"
#include "string-util.h"
#include "job.h"
#include "log.h"
#include "macro.h"
+#include "manager.h"
#include "parse-util.h"
#include "serialize.h"
#include "set.h"
#include "sd-event.h"
#include "list.h"
+#include "memory-util.h"
+#include "time-util.h"
#include "unit-dependency-atom.h"
typedef struct ActivationDetails ActivationDetails;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct KillContext KillContext;
-
#include <stdbool.h>
#include <stdio.h>
_KILL_MODE_INVALID = -EINVAL,
} KillMode;
-struct KillContext {
+typedef struct KillContext {
KillMode kill_mode;
int kill_signal;
int restart_kill_signal;
int watchdog_signal;
bool send_sigkill;
bool send_sighup;
-};
+} KillContext;
typedef enum KillWhom {
/* Kill whom is a property of an operation */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "conf-parser.h"
+#include "dropin.h"
#include "fs-util.h"
#include "load-dropin.h"
#include "load-fragment.h"
#include "log.h"
+#include "manager.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "unit.h"
+int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths) {
+ assert(u);
+
+ return unit_file_find_dropin_paths(NULL,
+ u->manager->lookup_paths.search_path,
+ use_unit_path_cache ? u->manager->unit_path_cache : NULL,
+ ".d", ".conf",
+ u->id, u->aliases,
+ paths);
+}
+
static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suffix) {
_cleanup_strv_free_ char **paths = NULL;
int r;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "dropin.h"
-#include "unit.h"
+#include <stdbool.h>
-/* Read service data supplementary drop-in directories */
+typedef struct Unit Unit;
-static inline int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths) {
- assert(u);
+/* Read service data supplementary drop-in directories */
- return unit_file_find_dropin_paths(NULL,
- u->manager->lookup_paths.search_path,
- use_unit_path_cache ? u->manager->unit_path_cache : NULL,
- ".d", ".conf",
- u->id, u->aliases,
- paths);
-}
+int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths);
int unit_load_dropin(Unit *u);
#pragma once
#include "conf-parser.h"
-#include "unit.h"
+
+typedef struct Unit Unit;
/* These functions are declared in the header to make them accessible to unit tests. */
bool contains_instance_specifier_superset(const char *s);
#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
+#include "manager.h"
#include "manager-dump.h"
#include "memstream-util.h"
#include "unit-serialize.h"
#include <stdio.h>
-#include "manager.h"
+typedef struct Manager Manager;
void manager_dump_jobs(Manager *s, FILE *f, char **patterns, const char *prefix);
int manager_get_dump_jobs_string(Manager *m, char **patterns, const char *prefix, char **ret);
#include "clean-ipc.h"
#include "core-varlink.h"
#include "dbus.h"
+#include "dynamic-user.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#pragma once
#include <stdbool.h>
+#include <stdio.h>
-#include "manager.h"
#include "fdset.h"
+typedef struct Manager Manager;
+
#define DESTROY_IPC_FLAG (UINT32_C(1) << 31)
int manager_open_serialization(Manager *m, FILE **ret_f);
#include "dbus-unit.h"
#include "dbus.h"
#include "dirent-util.h"
+#include "dynamic-user.h"
#include "env-util.h"
#include "escape.h"
#include "event-util.h"
};
DEFINE_STRING_TABLE_LOOKUP(manager_timestamp, ManagerTimestamp);
-
-static const char* const oom_policy_table[_OOM_POLICY_MAX] = {
- [OOM_CONTINUE] = "continue",
- [OOM_STOP] = "stop",
- [OOM_KILL] = "kill",
-};
-
-DEFINE_STRING_TABLE_LOOKUP(oom_policy, OOMPolicy);
#include "sd-event.h"
#include "sd-varlink.h"
-#include "common-signal.h"
#include "cgroup-util.h"
#include "cgroup.h"
+#include "common-signal.h"
+#include "emergency-action.h"
+#include "execute.h"
#include "fdset.h"
#include "hashmap.h"
+#include "job.h"
#include "list.h"
+#include "path-lookup.h"
#include "prioq.h"
#include "ratelimit.h"
+#include "show-status.h"
+#include "transaction.h"
+#include "unit-name.h"
+#include "unit.h"
struct libmnt_monitor;
typedef struct Unit Unit;
_MANAGER_OBJECTIVE_INVALID = -EINVAL,
} ManagerObjective;
-typedef enum StatusType {
- STATUS_TYPE_EPHEMERAL,
- STATUS_TYPE_NORMAL,
- STATUS_TYPE_NOTICE,
- STATUS_TYPE_EMERGENCY,
-} StatusType;
-
-typedef enum OOMPolicy {
- OOM_CONTINUE, /* The kernel or systemd-oomd kills the process it wants to kill, and that's it */
- OOM_STOP, /* The kernel or systemd-oomd kills the process it wants to kill, and we stop the unit */
- OOM_KILL, /* The kernel or systemd-oomd kills the process it wants to kill, and all others in the unit, and we stop the unit */
- _OOM_POLICY_MAX,
- _OOM_POLICY_INVALID = -EINVAL,
-} OOMPolicy;
-
/* Notes:
* 1. TIMESTAMP_FIRMWARE, TIMESTAMP_LOADER, TIMESTAMP_KERNEL, TIMESTAMP_INITRD,
* TIMESTAMP_SECURITY_START, and TIMESTAMP_SECURITY_FINISH are set only when
_WATCHDOG_TYPE_MAX,
} WatchdogType;
-#include "execute.h"
-#include "job.h"
-#include "path-lookup.h"
-#include "show-status.h"
-#include "transaction.h"
-#include "unit-name.h"
-#include "unit.h"
-
typedef enum ManagerTestRunFlags {
MANAGER_TEST_NORMAL = 0, /* run normally */
MANAGER_TEST_RUN_MINIMAL = 1 << 0, /* create basic data structures */
int manager_allocate_idle_pipe(Manager *m);
-const char* oom_policy_to_string(OOMPolicy i) _const_;
-OOMPolicy oom_policy_from_string(const char *s) _pure_;
-
void unit_defaults_init(UnitDefaults *defaults, RuntimeScope scope);
void unit_defaults_done(UnitDefaults *defaults);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Mount Mount;
-
-#include "dynamic-user.h"
#include "kill.h"
#include "pidref.h"
#include "unit.h"
MOUNT_PROC_JUST_CHANGED = 1 << 2,
} MountProcFlags;
-struct Mount {
+typedef struct Mount {
Unit meta;
char *where;
sd_event_source *timer_event_source;
unsigned n_retry_umount;
-};
+} Mount;
extern const UnitVTable mount_vtable;
#include "glob-util.h"
#include "inotify-util.h"
#include "macro.h"
+#include "manager.h"
#include "mkdir-label.h"
#include "path.h"
#include "path-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Path Path;
-typedef struct PathSpec PathSpec;
-typedef struct ActivationDetailsPath ActivationDetailsPath;
-
#include "unit.h"
typedef enum PathType {
_PATH_RESULT_INVALID = -EINVAL,
} PathResult;
-struct Path {
+typedef struct Path {
Unit meta;
LIST_HEAD(PathSpec, specs);
RateLimit trigger_limit;
sd_event_source *trigger_notify_event_source;
-};
+} Path;
-struct ActivationDetailsPath {
+typedef struct ActivationDetailsPath {
ActivationDetails meta;
char *trigger_path_filename;
-};
+} ActivationDetailsPath;
void path_free_specs(Path *p);
#include "exit-status.h"
#include "load-dropin.h"
#include "log.h"
+#include "manager.h"
#include "process-util.h"
#include "random-util.h"
#include "scope.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Scope Scope;
-
#include "cgroup.h"
#include "kill.h"
#include "unit.h"
_SCOPE_RESULT_INVALID = -EINVAL,
} ScopeResult;
-struct Scope {
+typedef struct Scope {
Unit meta;
CGroupContext cgroup_context;
char *group;
OOMPolicy oom_policy;
-};
+} Scope;
extern const UnitVTable scope_vtable;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Service Service;
-typedef struct ServiceFDStore ServiceFDStore;
-typedef struct ServiceExtraFD ServiceExtraFD;
-
#include "exit-status.h"
#include "kill.h"
+#include "manager.h"
#include "open-file.h"
#include "path.h"
#include "pidref.h"
#include "socket.h"
#include "unit.h"
+typedef struct Service Service;
+
typedef enum ServiceRestart {
SERVICE_RESTART_NO,
SERVICE_RESTART_ON_SUCCESS,
_SERVICE_RESTART_MODE_INVALID = -EINVAL,
} ServiceRestartMode;
-struct ServiceFDStore {
+typedef struct ServiceFDStore {
Service *service;
int fd;
sd_event_source *event_source;
bool do_poll;
- LIST_FIELDS(ServiceFDStore, fd_store);
-};
+ LIST_FIELDS(struct ServiceFDStore, fd_store);
+} ServiceFDStore;
-struct ServiceExtraFD {
+typedef struct ServiceExtraFD {
int fd;
char *fdname;
-};
+} ServiceExtraFD;
struct Service {
Unit meta;
#include "dbus-unit.h"
#include "fd-util.h"
#include "log.h"
+#include "manager.h"
#include "serialize.h"
#include "slice.h"
#include "special.h"
#include "unit.h"
-typedef struct Slice Slice;
-
-struct Slice {
+typedef struct Slice {
Unit meta;
SliceState state, deserialized_state;
CGroupContext cgroup_context;
CGroupRuntime *cgroup_runtime;
-};
+} Slice;
extern const UnitVTable slice_vtable;
#include "ip-protocol-list.h"
#include "label-util.h"
#include "log.h"
+#include "manager.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Socket Socket;
-typedef struct SocketPeer SocketPeer;
-
-#include "mount.h"
#include "pidref.h"
#include "socket-util.h"
#include "unit.h"
+typedef struct Socket Socket;
+typedef struct SocketPeer SocketPeer;
+
typedef enum SocketExecCommand {
SOCKET_EXEC_START_PRE,
SOCKET_EXEC_START_CHOWN,
#include "fd-util.h"
#include "format-util.h"
#include "fstab-util.h"
+#include "manager.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "pidref.h"
#include "unit.h"
-typedef struct Swap Swap;
-
typedef enum SwapExecCommand {
SWAP_EXEC_ACTIVATE,
SWAP_EXEC_DEACTIVATE,
bool priority_set;
} SwapParameters;
-struct Swap {
+typedef struct Swap {
Unit meta;
char *what;
devices for the same swap. We chain them up here. */
LIST_FIELDS(struct Swap, same_devnode);
-};
+} Swap;
extern const UnitVTable swap_vtable;
#include "unit.h"
-typedef struct Target Target;
-
-struct Target {
+typedef struct Target {
Unit meta;
TargetState state, deserialized_state;
-};
+} Target;
extern const UnitVTable target_vtable;
#include "dbus-timer.h"
#include "dbus-unit.h"
#include "fs-util.h"
+#include "manager.h"
#include "parse-util.h"
#include "random-util.h"
#include "serialize.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Timer Timer;
-typedef struct ActivationDetailsTimer ActivationDetailsTimer;
-
#include "calendarspec.h"
#include "unit.h"
_TIMER_RESULT_INVALID = -EINVAL,
} TimerResult;
-struct Timer {
+typedef struct Timer {
Unit meta;
usec_t accuracy_usec;
bool defer_reactivation;
char *stamp_path;
-};
+} Timer;
-struct ActivationDetailsTimer {
+typedef struct ActivationDetailsTimer {
ActivationDetails meta;
dual_timestamp last_trigger;
-};
+} ActivationDetailsTimer;
#define TIMER_MONOTONIC_CLOCK(t) ((t)->wake_system ? CLOCK_BOOTTIME_ALARM : CLOCK_MONOTONIC)
#include "bus-common-errors.h"
#include "bus-error.h"
#include "dbus-unit.h"
+#include "manager.h"
#include "slice.h"
#include "strv.h"
#include "terminal-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Transaction Transaction;
-typedef enum TransactionAddFlags TransactionAddFlags;
-
#include "hashmap.h"
#include "job.h"
-#include "manager.h"
-#include "unit.h"
-struct Transaction {
+typedef struct Transaction {
/* Jobs to be added */
Hashmap *jobs; /* Unit object => Job object list 1:1 */
Job *anchor_job; /* The job the user asked for */
bool irreversible;
-};
+} Transaction;
Transaction* transaction_new(bool irreversible);
Transaction* transaction_free(Transaction *tr);
#include "cgroup-util.h"
#include "format-util.h"
#include "macro.h"
+#include "manager.h"
#include "sd-path.h"
#include "specifier.h"
#include "string-util.h"
#include "parse-util.h"
#include "serialize.h"
#include "string-table.h"
+#include "unit.h"
#include "unit-serialize.h"
#include "user-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <stdbool.h>
#include <stdio.h>
-#include "unit.h"
#include "fdset.h"
+typedef struct Unit Unit;
+
/* These functions serialize state for our own usage, i.e.: across a reload/reexec, rather than for being
* passed to a child process. */
#include "dbus-unit.h"
#include "dbus.h"
#include "dropin.h"
+#include "dynamic-user.h"
#include "env-util.h"
#include "escape.h"
#include "exec-credential.h"
DEFINE_STRING_TABLE_LOOKUP(unit_mount_dependency_type, UnitMountDependencyType);
+static const char* const oom_policy_table[_OOM_POLICY_MAX] = {
+ [OOM_CONTINUE] = "continue",
+ [OOM_STOP] = "stop",
+ [OOM_KILL] = "kill",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(oom_policy, OOMPolicy);
+
UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependencyType t) {
switch (t) {
#include "sd-id128.h"
-/* Circular dependency with manager.h, needs to be defined before local includes */
-typedef enum UnitMountDependencyType {
- UNIT_MOUNT_WANTS,
- UNIT_MOUNT_REQUIRES,
- _UNIT_MOUNT_DEPENDENCY_TYPE_MAX,
- _UNIT_MOUNT_DEPENDENCY_TYPE_INVALID = -EINVAL,
-} UnitMountDependencyType;
-
#include "cgroup.h"
#include "condition.h"
#include "emergency-action.h"
+#include "execute.h"
#include "install.h"
+#include "job.h"
#include "list.h"
#include "log-context.h"
#include "mount-util.h"
#include "pidref.h"
+#include "ratelimit.h"
#include "unit-file.h"
typedef struct UnitRef UnitRef;
+typedef enum UnitMountDependencyType {
+ UNIT_MOUNT_WANTS,
+ UNIT_MOUNT_REQUIRES,
+ _UNIT_MOUNT_DEPENDENCY_TYPE_MAX,
+ _UNIT_MOUNT_DEPENDENCY_TYPE_INVALID = -EINVAL,
+} UnitMountDependencyType;
+
typedef enum KillOperation {
KILL_TERMINATE,
KILL_TERMINATE_AND_LOG,
_COLLECT_MODE_INVALID = -EINVAL,
} CollectMode;
+typedef enum OOMPolicy {
+ OOM_CONTINUE, /* The kernel or systemd-oomd kills the process it wants to kill, and that's it */
+ OOM_STOP, /* The kernel or systemd-oomd kills the process it wants to kill, and we stop the unit */
+ OOM_KILL, /* The kernel or systemd-oomd kills the process it wants to kill, and all others in the unit, and we stop the unit */
+ _OOM_POLICY_MAX,
+ _OOM_POLICY_INVALID = -EINVAL,
+} OOMPolicy;
+
+typedef enum StatusType {
+ STATUS_TYPE_EPHEMERAL,
+ STATUS_TYPE_NORMAL,
+ STATUS_TYPE_NOTICE,
+ STATUS_TYPE_EMERGENCY,
+} StatusType;
+
static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
return IN_SET(t, UNIT_ACTIVE, UNIT_RELOADING, UNIT_REFRESHING);
}
return INT_TO_PTR(d);
}
-#include "job.h"
-
struct UnitRef {
/* Keeps tracks of references to a unit. This is useful so
* that we can merge two units if necessary and correct all
const char* unit_mount_dependency_type_to_string(UnitMountDependencyType t) _const_;
UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependencyType t) _pure_;
+const char* oom_policy_to_string(OOMPolicy i) _const_;
+OOMPolicy oom_policy_from_string(const char *s) _pure_;
+
/* Macros which append UNIT= or USER_UNIT= to the message */
#define log_unit_full_errno_zerook(unit, level, error, ...) \