Split out of #37344.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "automount.h"
-#include "device.h"
-#include "mount.h"
-#include "path.h"
-#include "scope.h"
-#include "service.h"
-#include "slice.h"
-#include "socket.h"
-#include "swap.h"
-#include "target.h"
-#include "timer.h"
-#include "unit.h"
+#include "automount.h" /* IWYU pragma: export */
+#include "device.h" /* IWYU pragma: export */
+#include "mount.h" /* IWYU pragma: export */
+#include "path.h" /* IWYU pragma: export */
+#include "scope.h" /* IWYU pragma: export */
+#include "service.h" /* IWYU pragma: export */
+#include "slice.h" /* IWYU pragma: export */
+#include "socket.h" /* IWYU pragma: export */
+#include "swap.h" /* IWYU pragma: export */
+#include "target.h" /* IWYU pragma: export */
+#include "timer.h" /* IWYU pragma: export */
+#include "unit.h" /* IWYU pragma: export */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
-#include "macro.h"
#include "string-util.h"
#include "strv.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-
#include "audit-fd.h"
#include "capability-util.h"
#include "libaudit-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "forward.h"
+
int get_core_audit_fd(void);
void close_core_audit_fd(void);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fcntl.h>
-#include <limits.h>
#include <linux/auto_dev-ioctl.h>
-#include <sys/epoll.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "sd-bus.h"
+
#include "alloc-util.h"
-#include "async.h"
#include "automount.h"
#include "bus-error.h"
-#include "bus-util.h"
#include "dbus-automount.h"
#include "dbus-unit.h"
+#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fstab-util.h"
#include "path-util.h"
#include "process-util.h"
#include "serialize.h"
+#include "set.h"
#include "special.h"
#include "stdio-util.h"
#include "string-table.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "core-forward.h"
#include "unit.h"
typedef enum AutomountResult {
#include <fnmatch.h>
#include <linux/bpf_insn.h>
+#include <sys/stat.h>
#include "alloc-util.h"
#include "bpf-devices.h"
#include "bpf-program.h"
+#include "cgroup.h"
#include "devnum-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "log.h"
#include "missing_bpf.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "path-util.h"
-#include "stdio-util.h"
#include "string-util.h"
#define PASS_JUMP_OFF 4096
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <inttypes.h>
-
-#include "cgroup.h"
-
-typedef struct BPFProgram BPFProgram;
+#include "core-forward.h"
int bpf_devices_cgroup_init(BPFProgram **ret, CGroupDevicePolicy policy, bool allow_list);
int bpf_devices_apply_policy(
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
#include <linux/bpf_insn.h>
-#include <net/ethernet.h>
+#include <linux/if_ether.h>
#include <net/if.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
-#include <stddef.h>
#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include "alloc-util.h"
#include "bpf-firewall.h"
#include "bpf-program.h"
+#include "errno-util.h"
#include "fd-util.h"
#include "in-addr-prefix-util.h"
#include "manager.h"
#include "memory-util.h"
-#include "missing_syscall.h"
+#include "set.h"
+#include "string-util.h"
#include "strv.h"
#include "unit.h"
#include "virt.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <inttypes.h>
-
-#include "cgroup.h"
-#include "unit.h"
+#include "core-forward.h"
int bpf_firewall_compile(Unit *u);
int bpf_firewall_install(Unit *u);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "alloc-util.h"
#include "bpf-foreign.h"
#include "bpf-program.h"
#include "cgroup.h"
-#include "memory-util.h"
+#include "hash-funcs.h"
+#include "hashmap.h"
#include "missing_magic.h"
-#include "mountpoint-util.h"
-#include "set.h"
+#include "siphash24.h"
#include "stat-util.h"
+#include "unit.h"
-typedef struct BPFForeignKey BPFForeignKey;
-struct BPFForeignKey {
+typedef struct BPFForeignKey {
uint32_t prog_id;
uint32_t attach_type;
-};
+} BPFForeignKey;
static int bpf_foreign_key_new(uint32_t prog_id,
enum bpf_attach_type attach_type,
#pragma once
-#include "unit.h"
+#include "core-forward.h"
/*
* Attach cgroup-bpf programs foreign to systemd, i.e. loaded to the kernel by an entity
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/types.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "alloc-util.h"
+#include <stdlib.h>
+
#include "bpf-restrict-fs.h"
-#include "cgroup-util.h"
#include "fd-util.h"
-#include "fileio.h"
#include "filesystems.h"
#include "log.h"
#include "lsm-util.h"
#include "manager.h"
-#include "mkdir.h"
#include "nulstr-util.h"
+#include "set.h"
#include "stat-util.h"
-#include "strv.h"
+#include "unit.h"
#if BPF_FRAMEWORK
/* libbpf, clang and llc compile time dependencies are satisfied */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "hashmap.h"
+#include "core-forward.h"
typedef enum FilesystemParseFlags {
FILESYSTEM_PARSE_INVERT = 1 << 0,
FILESYSTEM_PARSE_LOG = 1 << 2,
} FilesystemParseFlags;
-typedef struct Unit Unit;
-typedef struct Manager Manager;
-
-typedef struct restrict_fs_bpf restrict_fs_bpf;
-
bool bpf_restrict_fs_supported(bool initialize);
int bpf_restrict_fs_setup(Manager *m);
int bpf_restrict_fs_update(const Set *filesystems, uint64_t cgroup_id, int outer_map_fd, bool allow_list);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "sd-netlink.h"
+
+#include "alloc-util.h"
#include "bpf-restrict-ifaces.h"
+#include "cgroup.h"
#include "fd-util.h"
+#include "fdset.h"
#include "netlink-util.h"
+#include "set.h"
#include "unit.h"
#if BPF_FRAMEWORK
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "fdset.h"
-
-typedef struct Unit Unit;
+#include "core-forward.h"
int bpf_restrict_ifaces_supported(void);
int bpf_restrict_ifaces_install(Unit *u);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#if BPF_FRAMEWORK
-#include <bpf/bpf.h>
-#endif
-
+#include "alloc-util.h"
#include "bpf-socket-bind.h"
+#include "cgroup.h"
#include "fd-util.h"
+#include "fdset.h"
#include "unit.h"
#if BPF_FRAMEWORK
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "fdset.h"
-
-typedef struct Unit Unit;
+#include "core-forward.h"
int bpf_socket_bind_supported(void);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
+#include <sys/stat.h>
+#include "sd-bus.h"
#include "sd-messages.h"
#include "af-list.h"
#include "bpf-devices.h"
#include "bpf-firewall.h"
#include "bpf-foreign.h"
+#include "bpf-program.h"
#include "bpf-restrict-ifaces.h"
#include "bpf-socket-bind.h"
#include "btrfs-util.h"
#include "cgroup-setup.h"
#include "cgroup-util.h"
#include "devnum-util.h"
+#include "errno-util.h"
+#include "extract-word.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fileio.h"
#include "firewall-util.h"
#include "in-addr-prefix-util.h"
#include "inotify-util.h"
-#include "io-util.h"
#include "ip-protocol-list.h"
#include "limits-util.h"
#include "manager.h"
#include "parse-util.h"
#include "path-util.h"
#include "percent-util.h"
+#include "pidref.h"
#include "process-util.h"
#include "procfs-util.h"
#include "serialize.h"
+#include "set.h"
#include "special.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "virt.h"
#if BPF_FRAMEWORK
#include "bpf-dlopen.h"
#include "bpf-link.h"
+#include "bpf-restrict-fs.h"
#include "bpf/restrict_fs/restrict-fs-skel.h"
#endif
/* Returns the log level to use when cgroup attribute writes fail. When an attribute is missing or we have access
* problems we downgrade to LOG_DEBUG. This is supposed to be nice to container managers and kernels which want to mask
* out specific attributes from us. */
-#define LOG_LEVEL_CGROUP_WRITE(r) (IN_SET(abs(r), ENOENT, EROFS, EACCES, EPERM) ? LOG_DEBUG : LOG_WARNING)
+#define LOG_LEVEL_CGROUP_WRITE(r) (IN_SET(ABS(r), ENOENT, EROFS, EACCES, EPERM) ? LOG_DEBUG : LOG_WARNING)
static void unit_remove_from_cgroup_empty_queue(Unit *u);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-
-#include "sd-event.h"
-
-#include "bpf-program.h"
-#include "bpf-restrict-fs.h"
#include "cgroup-util.h"
+#include "core-forward.h"
#include "cpu-set-util.h"
#include "firewall-util.h"
#include "list.h"
-#include "pidref.h"
-#include "time-util.h"
typedef struct CGroupTasksMax {
/* If scale == 0, just use value; otherwise, value / scale.
uint64_t cgroup_tasks_max_resolve(const CGroupTasksMax *tasks_max);
-typedef struct CGroupContext CGroupContext;
-typedef struct CGroupDeviceAllow CGroupDeviceAllow;
-typedef struct CGroupIODeviceWeight CGroupIODeviceWeight;
-typedef struct CGroupIODeviceLimit CGroupIODeviceLimit;
-typedef struct CGroupIODeviceLatency CGroupIODeviceLatency;
-typedef struct CGroupBPFForeignProgram CGroupBPFForeignProgram;
-typedef struct CGroupSocketBindItem CGroupSocketBindItem;
-typedef struct CGroupRuntime CGroupRuntime;
-
typedef enum CGroupDevicePolicy {
/* When devices listed, will allow those, plus built-in ones, if none are listed will allow
* everything. */
_CGROUP_DEVICE_PERMISSIONS_INVALID = -EINVAL,
} CGroupDevicePermissions;
-struct CGroupDeviceAllow {
+typedef struct CGroupDeviceAllow {
LIST_FIELDS(CGroupDeviceAllow, device_allow);
char *path;
CGroupDevicePermissions permissions;
-};
+} CGroupDeviceAllow;
-struct CGroupIODeviceWeight {
+typedef struct CGroupIODeviceWeight {
LIST_FIELDS(CGroupIODeviceWeight, device_weights);
char *path;
uint64_t weight;
-};
+} CGroupIODeviceWeight;
-struct CGroupIODeviceLimit {
+typedef struct CGroupIODeviceLimit {
LIST_FIELDS(CGroupIODeviceLimit, device_limits);
char *path;
uint64_t limits[_CGROUP_IO_LIMIT_TYPE_MAX];
-};
+} CGroupIODeviceLimit;
-struct CGroupIODeviceLatency {
+typedef struct CGroupIODeviceLatency {
LIST_FIELDS(CGroupIODeviceLatency, device_latencies);
char *path;
usec_t target_usec;
-};
+} CGroupIODeviceLatency;
-struct CGroupBPFForeignProgram {
+typedef struct CGroupBPFForeignProgram {
LIST_FIELDS(CGroupBPFForeignProgram, programs);
uint32_t attach_type;
char *bpffs_path;
-};
+} CGroupBPFForeignProgram;
-struct CGroupSocketBindItem {
+typedef struct CGroupSocketBindItem {
LIST_FIELDS(CGroupSocketBindItem, socket_bind_items);
int address_family;
int ip_protocol;
uint16_t nr_ports;
uint16_t port_min;
-};
+} CGroupSocketBindItem;
typedef enum CGroupPressureWatch {
CGROUP_PRESSURE_WATCH_NO, /* → tells the service payload explicitly not to watch for memory pressure */
/* The user-supplied cgroup-related configuration options. This remains mostly immutable while the service
* manager is running (except for an occasional SetProperty() configuration change), outside of reload
* cycles. */
-struct CGroupContext {
+typedef struct CGroupContext {
bool io_accounting;
bool memory_accounting;
bool tasks_accounting;
/* Forward coredumps for processes that crash within this cgroup.
* Requires 'delegate' to also be true. */
bool coredump_receive;
-};
+} CGroupContext;
/* Used when querying IP accounting data */
typedef enum CGroupIPAccountingMetric {
bool warned_clamping_cpu_quota_period:1;
} CGroupRuntime;
-typedef struct Unit Unit;
-typedef struct Manager Manager;
-typedef enum ManagerState ManagerState;
-
uint64_t cgroup_context_cpu_weight(CGroupContext *c, ManagerState state);
usec_t cgroup_cpu_adjust_period(usec_t period, usec_t quota, usec_t resolution, usec_t max_period);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
+#include "forward.h"
int clock_reset_timewarp(void);
void clock_apply_epoch(bool allow_backwards);
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "conf-parser-forward.h" /* IWYU pragma: export */
+#include "forward.h" /* IWYU pragma: export */
+#include "unit-def.h" /* IWYU pragma: export */
+
+typedef enum CGroupDevicePermissions CGroupDevicePermissions;
+typedef enum CGroupDevicePolicy CGroupDevicePolicy;
+typedef enum CGroupMask CGroupMask;
+typedef enum ExecCleanMask ExecCleanMask;
+typedef enum ExecPreserveMode ExecPreserveMode;
+typedef enum FreezerAction FreezerAction;
+typedef enum JobResult JobResult;
+typedef enum JobState JobState;
+typedef enum JobType JobType;
+typedef enum ManagerState ManagerState;
+typedef enum TransactionAddFlags TransactionAddFlags;
+typedef enum UnitDependencyAtom UnitDependencyAtom;
+typedef enum UnitWriteFlags UnitWriteFlags;
+
+typedef struct ActivationDetails ActivationDetails;
+typedef struct BindMount BindMount;
+typedef struct CGroupBPFForeignProgram CGroupBPFForeignProgram;
+typedef struct CGroupContext CGroupContext;
+typedef struct CGroupDeviceAllow CGroupDeviceAllow;
+typedef struct CGroupIODeviceLatency CGroupIODeviceLatency;
+typedef struct CGroupIODeviceLimit CGroupIODeviceLimit;
+typedef struct CGroupIODeviceWeight CGroupIODeviceWeight;
+typedef struct CGroupRuntime CGroupRuntime;
+typedef struct CGroupSocketBindItem CGroupSocketBindItem;
+typedef struct DynamicCreds DynamicCreds;
+typedef struct DynamicUser DynamicUser;
+typedef struct ExecCommand ExecCommand;
+typedef struct ExecContext ExecContext;
+typedef struct ExecParameters ExecParameters;
+typedef struct ExecRuntime ExecRuntime;
+typedef struct ExecSharedRuntime ExecSharedRuntime;
+typedef struct Job Job;
+typedef struct JobDependency JobDependency;
+typedef struct KillContext KillContext;
+typedef struct Manager Manager;
+typedef struct MountImage MountImage;
+typedef struct PathSpec PathSpec;
+typedef struct Scope Scope;
+typedef struct Service Service;
+typedef struct Socket Socket;
+typedef struct SocketPeer SocketPeer;
+typedef struct TemporaryFileSystem TemporaryFileSystem;
+typedef struct Unit Unit;
+typedef struct UnitRef UnitRef;
+
+struct restrict_fs_bpf;
#include "sd-messages.h"
+#include "constants.h"
#include "crash-handler.h"
#include "exit-status.h"
-#include "macro.h"
+#include "format-util.h"
+#include "log.h"
#include "main.h"
-#include "missing_syscall.h"
#include "process-util.h"
#include "raw-clone.h"
#include "rlimit-util.h"
#include "signal-util.h"
#include "string-table.h"
+#include "string-util.h"
#include "terminal-util.h"
#include "virt.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-
-#include "macro.h"
+#include "forward.h"
typedef enum CrashAction {
CRASH_FREEZE,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_automount_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <arpa/inet.h>
-
#include "af-list.h"
#include "alloc-util.h"
-#include "bpf-firewall.h"
-#include "bpf-foreign.h"
+#include "bpf-program.h"
#include "bus-get-properties.h"
#include "bus-message-util.h"
-#include "bus-util.h"
#include "cgroup.h"
#include "cgroup-util.h"
#include "dbus-cgroup.h"
-#include "dbus-util.h"
-#include "errno-util.h"
#include "escape.h"
-#include "fd-util.h"
-#include "fileio.h"
#include "firewall-util.h"
#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 "percent-util.h"
+#include "set.h"
#include "socket-util.h"
+#include "string-util.h"
+#include "strv.h"
#include "varlink.h"
BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", CGroupTasksMax, cgroup_tasks_max_resolve);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "cgroup.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_cgroup_vtable[];
#include "dbus-device.h"
#include "device.h"
-#include "unit.h"
const sd_bus_vtable bus_device_vtable[] = {
SD_BUS_VTABLE_START(0),
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <syslog.h>
#include <sys/mount.h>
-#include <sys/prctl.h>
#include "af-list.h"
#include "alloc-util.h"
+#include "bpf-restrict-fs.h"
#include "bus-get-properties.h"
#include "bus-unit-util.h"
-#include "bus-util.h"
#include "cap-list.h"
-#include "capability-util.h"
#include "cpu-set-util.h"
#include "creds-util.h"
#include "dbus-execute.h"
#include "dbus-util.h"
+#include "dissect-image.h"
#include "env-util.h"
-#include "errno-list.h"
#include "escape.h"
#include "exec-credential.h"
#include "execute.h"
#include "fd-util.h"
-#include "fileio.h"
#include "hexdecoct.h"
#include "hostname-util.h"
#include "image-policy.h"
#include "ioprio-util.h"
#include "iovec-util.h"
#include "journal-file.h"
-#include "load-fragment.h"
#include "memstream-util.h"
#include "mountpoint-util.h"
#include "namespace.h"
-#include "parse-util.h"
+#include "nsflags.h"
+#include "ordered-set.h"
#include "path-util.h"
#include "pcre2-util.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "seccomp-util.h"
#include "securebits-util.h"
+#include "set.h"
#include "specifier.h"
-#include "stat-util.h"
#include "strv.h"
#include "syslog-util.h"
-#include "unit-printf.h"
+#include "unit.h"
#include "user-util.h"
#include "utf8.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "execute.h"
-#include "unit.h"
+#include "bus-get-properties.h"
+#include "core-forward.h"
#define BUS_EXEC_STATUS_VTABLE(prefix, offset, flags) \
BUS_PROPERTY_DUAL_TIMESTAMP(prefix "StartTimestamp", (offset) + offsetof(ExecStatus, start_timestamp), flags), \
#include "alloc-util.h"
#include "bus-get-properties.h"
+#include "bus-object.h"
#include "bus-util.h"
#include "dbus.h"
#include "dbus-job.h"
#include "dbus-unit.h"
#include "dbus-util.h"
+#include "hashmap.h"
#include "job.h"
#include "log.h"
+#include "manager.h"
#include "selinux-access.h"
-#include "string-util.h"
#include "strv.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, job_type, JobType);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
+#include "sd-bus-vtable.h"
-#include "bus-object.h"
-
-typedef struct Job Job;
+#include "core-forward.h"
extern const sd_bus_vtable bus_job_vtable[];
extern const BusObjectImplementation job_object;
#include "dbus-util.h"
#include "kill.h"
#include "signal-util.h"
+#include "string-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_kill_mode, kill_mode, KillMode);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "kill.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_kill_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
+#include <linux/capability.h>
#include <sys/prctl.h>
-#include <sys/statvfs.h>
#include <unistd.h>
#include "alloc-util.h"
#include "bus-util.h"
#include "chase.h"
#include "confidential-virt.h"
-#include "dbus.h"
#include "dbus-cgroup.h"
#include "dbus-execute.h"
+#include "dbus.h"
#include "dbus-job.h"
#include "dbus-manager.h"
#include "dbus-scope.h"
#include "dbus-util.h"
#include "dynamic-user.h"
#include "env-util.h"
+#include "errno-util.h"
#include "fd-util.h"
-#include "fileio.h"
#include "format-util.h"
+#include "glyph-util.h"
+#include "hashmap.h"
#include "initrd-util.h"
#include "install.h"
#include "locale-util.h"
#include "log.h"
#include "manager-dump.h"
+#include "manager.h"
#include "memfd-util.h"
#include "os-util.h"
-#include "parse-util.h"
#include "path-util.h"
+#include "pidref.h"
#include "process-util.h"
#include "selinux-access.h"
-#include "stat-util.h"
+#include "set.h"
#include "string-util.h"
#include "strv.h"
#include "syslog-util.h"
#include "taint.h"
+#include "unit-name.h"
#include "user-util.h"
#include "version.h"
#include "virt.h"
#include "sd-bus-vtable.h"
-#include "time-util.h"
-
-typedef struct Manager Manager;
+#include "core-forward.h"
extern const sd_bus_vtable bus_manager_vtable[];
extern const sd_bus_vtable bus_manager_log_control_vtable[];
#include "mount.h"
#include "string-util.h"
#include "unit.h"
-#include "utf8.h"
static int property_get_what(
sd_bus *bus,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_mount_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_path_vtable[];
#include "bus-common-errors.h"
#include "bus-get-properties.h"
#include "bus-util.h"
-#include "dbus.h"
#include "dbus-cgroup.h"
#include "dbus-kill.h"
#include "dbus-manager.h"
#include "dbus-scope.h"
-#include "dbus-unit.h"
#include "dbus-util.h"
+#include "manager.h"
+#include "pidref.h"
#include "scope.h"
#include "selinux-access.h"
+#include "string-util.h"
#include "unit.h"
int bus_scope_method_abandon(sd_bus_message *message, void *userdata, sd_bus_error *error) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
-
-typedef struct Scope Scope;
+#include "core-forward.h"
extern const sd_bus_vtable bus_scope_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include "alloc-util.h"
#include "async.h"
#include "bus-common-errors.h"
#include "bus-get-properties.h"
+#include "constants.h"
#include "dbus-cgroup.h"
#include "dbus-execute.h"
#include "dbus-kill.h"
#include "dbus-manager.h"
#include "dbus-service.h"
#include "dbus-util.h"
-#include "exec-credential.h"
+#include "dissect-image.h"
#include "execute.h"
#include "exit-status.h"
#include "fd-util.h"
-#include "fileio.h"
+#include "glyph-util.h"
#include "locale-util.h"
+#include "manager.h"
#include "missing_fcntl.h"
+#include "mount-util.h"
#include "open-file.h"
-#include "parse-util.h"
#include "path-util.h"
#include "selinux-access.h"
#include "service.h"
#include "signal-util.h"
#include "string-util.h"
-#include "strv.h"
#include "unit.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, service_type, ServiceType);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_service_vtable[];
#include "dbus-slice.h"
#include "dbus-util.h"
#include "slice.h"
+#include "string-util.h"
#include "unit.h"
static int property_get_currently_active(
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_slice_vtable[];
#include "dbus-util.h"
#include "fd-util.h"
#include "ip-protocol-list.h"
-#include "parse-util.h"
#include "path-util.h"
#include "socket.h"
#include "socket-netlink.h"
#include "socket-util.h"
#include "string-util.h"
+#include "strv.h"
#include "unit.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, socket_result, SocketResult);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_socket_vtable[];
#include "dbus-cgroup.h"
#include "dbus-execute.h"
#include "dbus-swap.h"
-#include "string-util.h"
#include "swap.h"
#include "unit.h"
Copyright © 2010 Maarten Lankhorst
***/
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_swap_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dbus-target.h"
-#include "unit.h"
const sd_bus_vtable bus_target_vtable[] = {
SD_BUS_VTABLE_START(0),
#include "alloc-util.h"
#include "bus-get-properties.h"
+#include "calendarspec.h"
#include "dbus-timer.h"
#include "dbus-util.h"
+#include "string-util.h"
#include "strv.h"
#include "timer.h"
#include "unit.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_timer_vtable[];
#include "alloc-util.h"
#include "bitfield.h"
-#include "bpf-firewall.h"
#include "bus-common-errors.h"
#include "bus-get-properties.h"
-#include "bus-polkit.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "condition.h"
#include "dbus-unit.h"
#include "dbus-util.h"
#include "fd-util.h"
+#include "format-util.h"
#include "install.h"
#include "locale-util.h"
#include "log.h"
+#include "manager.h"
+#include "namespace-util.h"
#include "path-util.h"
#include "process-util.h"
#include "selinux-access.h"
#include "service.h"
+#include "set.h"
#include "signal-util.h"
#include "special.h"
-#include "string-table.h"
#include "string-util.h"
#include "strv.h"
-#include "user-util.h"
+#include "transaction.h"
+#include "unit-name.h"
#include "web-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_collect_mode, collect_mode, CollectMode);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
+#include "sd-bus-vtable.h"
-#include "unit.h"
+#include "core-forward.h"
extern const sd_bus_vtable bus_unit_vtable[];
extern const sd_bus_vtable bus_unit_cgroup_vtable[];
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-polkit.h"
-#include "bus-util.h"
#include "dbus-util.h"
+#include "dissect-image.h"
#include "escape.h"
#include "manager.h"
-#include "parse-util.h"
#include "path-util.h"
#include "reboot-util.h"
+#include "strv.h"
#include "unit.h"
-#include "unit-printf.h"
#include "user-util.h"
int bus_property_get_triggered_unit(
return 1;
}
-int bus_set_transient_usec_internal(
+static int bus_set_transient_usec_internal(
Unit *u,
const char *name,
usec_t *p,
return 1;
}
+int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) {
+ return bus_set_transient_usec_internal(u, name, p, false, message, flags, error);
+}
+
+int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) {
+ return bus_set_transient_usec_internal(u, name, p, true, message, flags, error);
+}
+
int bus_verify_manage_units_async_impl(
Manager *manager,
const char *id,
error);
}
+int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error) {
+ assert(u);
+ return bus_verify_manage_units_async_impl(u->manager, u->id, verb, polkit_message, call, error);
+}
+
+int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *error) {
+ return bus_verify_manage_units_async_impl(manager, NULL, NULL, NULL, call, error);
+}
+
int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error) {
assert(m);
assert(call);
#include "sd-bus.h"
-#include "dissect-image.h"
+#include "core-forward.h"
+#include "string-util.h"
#include "unit.h"
int bus_property_get_triggered_unit(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
int bus_set_transient_string(Unit *u, const char *name, char **p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
int bus_set_transient_bool(Unit *u, const char *name, bool *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
int bus_set_transient_tristate(Unit *u, const char *name, int *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
-int bus_set_transient_usec_internal(Unit *u, const char *name, usec_t *p, bool fix_0, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
-static inline int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) {
- return bus_set_transient_usec_internal(u, name, p, false, message, flags, error);
-}
-static inline int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) {
- return bus_set_transient_usec_internal(u, name, p, true, message, flags, error);
-}
-
+int bus_set_transient_usec(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
+int bus_set_transient_usec_fix_0(Unit *u, const char *name, usec_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error);
int bus_verify_manage_units_async_impl(Manager *manager, const char *id, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error);
-static inline int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error) {
- assert(u);
- return bus_verify_manage_units_async_impl(u->manager, u->id, verb, polkit_message, call, error);
-}
-static inline int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *error) {
- return bus_verify_manage_units_async_impl(manager, NULL, NULL, NULL, call, error);
-}
+int bus_verify_manage_units_async_full(Unit *u, const char *verb, const char *polkit_message, sd_bus_message *call, sd_bus_error *error);
+int bus_verify_manage_units_async(Manager *manager, sd_bus_message *call, sd_bus_error *error);
int bus_verify_manage_unit_files_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
int bus_verify_reload_daemon_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
int bus_verify_set_environment_async(Manager *m, sd_bus_message *call, sd_bus_error *error);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <sys/epoll.h>
#include <unistd.h>
#include "sd-bus.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-internal.h"
-#include "bus-polkit.h"
+#include "bus-object.h"
#include "bus-util.h"
#include "dbus.h"
#include "dbus-automount.h"
#include "dbus-target.h"
#include "dbus-timer.h"
#include "dbus-unit.h"
+#include "errno-util.h"
#include "fd-util.h"
+#include "fdset.h"
+#include "format-util.h"
#include "fs-util.h"
#include "log.h"
+#include "manager.h"
+#include "path-util.h"
+#include "pidref.h"
#include "process-util.h"
#include "selinux-access.h"
#include "serialize.h"
-#include "service.h"
+#include "set.h"
#include "special.h"
#include "string-util.h"
#include "strv.h"
-#include "strxcpyx.h"
#include "umask-util.h"
-#include "user-util.h"
#define CONNECTIONS_MAX 4096
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
-
-#include "fdset.h"
-
-typedef struct Manager Manager;
+#include "core-forward.h"
void bus_send_pending_reload_message(Manager *m);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <sys/epoll.h>
-
+#include "sd-bus.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
-#include "dbus-device.h"
#include "dbus-unit.h"
#include "device.h"
#include "device-private.h"
#include "device-util.h"
+#include "extract-word.h"
+#include "hashmap.h"
#include "log.h"
#include "manager.h"
-#include "parse-util.h"
#include "path-util.h"
-#include "ratelimit.h"
#include "serialize.h"
-#include "stat-util.h"
+#include "set.h"
#include "string-util.h"
+#include "strv.h"
#include "swap.h"
#include "udev-util.h"
#include "unit.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "core-forward.h"
#include "unit.h"
/* A mask specifying where we have seen the device currently. This is a bitmask because the device might show up
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <grp.h>
#include <sys/file.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include "clean-ipc.h"
#include "dynamic-user.h"
+#include "errno-list.h"
+#include "extract-word.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fileio.h"
#include "format-util.h"
-#include "fs-util.h"
+#include "hashmap.h"
#include "iovec-util.h"
#include "lock-util.h"
#include "manager.h"
-#include "parse-util.h"
#include "random-util.h"
#include "serialize.h"
+#include "siphash24.h"
#include "socket-util.h"
#include "stdio-util.h"
#include "string-util.h"
-#include "strv.h"
#include "uid-classification.h"
#include "user-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "fdset.h"
-#include "memory-util.h"
-
-typedef struct Manager Manager;
+#include "core-forward.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
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
-#include <unistd.h>
+#include <sys/stat.h>
-#include "alloc-util.h"
#include "chattr-util.h"
#include "efi-random.h"
#include "efivars.h"
#include "fd-util.h"
-#include "fs-util.h"
#include "log.h"
-#include "random-util.h"
-#include "strv.h"
void lock_down_efi_variables(void) {
_cleanup_close_ int fd = -EBADF;
#include <sys/reboot.h>
#include "ansi-color.h"
-#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 "string-table.h"
-#include "terminal-util.h"
+#include "string-util.h"
#include "virt.h"
static const char* const emergency_action_table[_EMERGENCY_ACTION_MAX] = {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-
-#include "macro.h"
-#include "runtime-scope.h"
-
-typedef struct Manager Manager;
+#include "core-forward.h"
typedef enum EmergencyAction {
EMERGENCY_ACTION_NONE,
#include "acl-util.h"
#include "creds-util.h"
+#include "errno-util.h"
#include "exec-credential.h"
#include "execute.h"
#include "fileio.h"
+#include "fs-util.h"
#include "glob-util.h"
#include "io-util.h"
#include "iovec-util.h"
#include "mkdir-label.h"
#include "mount-util.h"
#include "mountpoint-util.h"
+#include "ordered-set.h"
+#include "path-lookup.h"
+#include "path-util.h"
#include "process-util.h"
#include "random-util.h"
#include "recurse-dir.h"
#include "rm-rf.h"
+#include "siphash24.h"
+#include "stat-util.h"
+#include "strv.h"
#include "tmpfile-util.h"
#include "user-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#include "hash-funcs.h"
-
-typedef struct ExecContext ExecContext;
-typedef struct ExecParameters ExecParameters;
+#include "core-forward.h"
/* A credential configured with LoadCredential= */
typedef struct ExecLoadCredential {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <grp.h>
+#include <linux/ioprio.h>
#include <linux/prctl.h>
#include <linux/sched.h>
#include <linux/securebits.h>
+#include <poll.h>
#include <sys/eventfd.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#if HAVE_PAM
#include <security/pam_appl.h>
-#include <security/pam_misc.h>
#endif
#include "sd-messages.h"
#include "bpf-restrict-fs.h"
#include "btrfs-util.h"
#include "capability-util.h"
-#include "cgroup.h"
#include "cgroup-setup.h"
+#include "cgroup.h"
#include "chase.h"
-#include "chattr-util.h"
#include "chown-recursive.h"
+#include "constants.h"
#include "copy.h"
+#include "coredump-util.h"
+#include "dissect-image.h"
#include "dynamic-user.h"
#include "env-util.h"
#include "escape.h"
#include "execute.h"
#include "exit-status.h"
#include "fd-util.h"
+#include "fs-util.h"
#include "hexdecoct.h"
#include "hostname-setup.h"
#include "image-policy.h"
#include "io-util.h"
-#include "ioprio-util.h"
#include "iovec-util.h"
#include "journal-send.h"
#include "manager.h"
#include "missing_syscall.h"
#include "mkdir-label.h"
#include "mount-util.h"
+#include "namespace-util.h"
+#include "nsflags.h"
+#include "open-file.h"
#include "osc-context.h"
+#include "path-util.h"
+#include "pidref.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "psi-util.h"
#include "rlimit-util.h"
#include "seccomp-util.h"
#include "selinux-util.h"
+#include "set.h"
#include "signal-util.h"
#include "smack-util.h"
#include "socket-util.h"
+#include "stat-util.h"
#include "string-table.h"
#include "strv.h"
#include "terminal-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct ExecCommand ExecCommand;
-typedef struct ExecContext ExecContext;
-typedef struct ExecParameters ExecParameters;
-typedef struct ExecRuntime ExecRuntime;
-typedef struct CGroupContext CGroupContext;
+#include "core-forward.h"
int exec_invoke(
const ExecCommand *command,
#include "af-list.h"
#include "capability-util.h"
#include "cgroup.h"
-#include "cgroup-setup.h"
+#include "dissect-image.h"
#include "dynamic-user.h"
#include "escape.h"
#include "exec-credential.h"
+#include "execute.h"
#include "execute-serialize.h"
+#include "extract-word.h"
#include "fd-util.h"
-#include "fileio.h"
#include "hexdecoct.h"
+#include "image-policy.h"
#include "in-addr-prefix-util.h"
+#include "log.h"
+#include "nsflags.h"
+#include "open-file.h"
+#include "ordered-set.h"
#include "parse-helpers.h"
#include "parse-util.h"
-#include "percent-util.h"
+#include "path-util.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "serialize.h"
+#include "set.h"
#include "string-util.h"
#include "strv.h"
+#include "time-util.h"
static int exec_cgroup_context_serialize(const CGroupContext *c, FILE *f) {
_cleanup_free_ char *disable_controllers_str = NULL, *delegate_controllers_str = NULL,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "execute.h"
+#include "core-forward.h"
/* These functions serialize/deserialize for invocation purposes (i.e.: serialized object is passed to a
* child process) rather than to save state across reload/reexec. */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fcntl.h>
#include <linux/prctl.h>
#include <poll.h>
-#include <sys/file.h>
#include <sys/mman.h>
-#include <sys/personality.h>
+#include <sys/mount.h>
#include <sys/prctl.h>
-#include <sys/shm.h>
-#include <sys/types.h>
-#include <sys/un.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
#include <unistd.h>
-#include <utmpx.h>
-
-#include "sd-messages.h"
#include "af-list.h"
#include "alloc-util.h"
#include "cap-list.h"
#include "capability-util.h"
#include "cgroup-setup.h"
-#include "constants.h"
+#include "coredump-util.h"
#include "cpu-set-util.h"
+#include "dissect-image.h"
#include "dynamic-user.h"
#include "env-file.h"
#include "env-util.h"
-#include "errno-list.h"
#include "escape.h"
-#include "exec-credential.h"
#include "execute.h"
#include "execute-serialize.h"
-#include "exit-status.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fileio.h"
#include "format-util.h"
+#include "fs-util.h"
#include "glob-util.h"
#include "hexdecoct.h"
+#include "image-policy.h"
#include "io-util.h"
#include "ioprio-util.h"
-#include "lock-util.h"
#include "log.h"
-#include "macro.h"
#include "manager.h"
-#include "manager-dump.h"
-#include "memory-util.h"
-#include "missing_fs.h"
-#include "mkdir-label.h"
+#include "mkdir.h"
+#include "namespace-util.h"
#include "namespace.h"
+#include "nsflags.h"
+#include "open-file.h"
+#include "ordered-set.h"
#include "osc-context.h"
#include "parse-util.h"
#include "path-util.h"
+#include "pidref.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "rm-rf.h"
#include "seccomp-util.h"
#include "securebits-util.h"
-#include "selinux-util.h"
#include "serialize.h"
+#include "set.h"
#include "sort-util.h"
-#include "special.h"
-#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "syslog-util.h"
#include "terminal-util.h"
#include "tmpfile-util.h"
-#include "umask-util.h"
-#include "unit-serialize.h"
-#include "user-util.h"
#include "utmp-wtmp.h"
#include "vpick.h"
return "/run/host/notify";
}
+int exec_log_level_max(const ExecContext *context, const ExecParameters *params) {
+ assert(context);
+ assert(params);
+
+ if (params->debug_invocation)
+ return LOG_DEBUG;
+
+ return context->log_level_max < 0 ? log_get_max_level() : context->log_level_max;
+}
+
bool exec_directory_is_private(const ExecContext *context, ExecDirectoryType type) {
assert(context);
#endif
}
+bool exec_context_restrict_namespaces_set(const ExecContext *c) {
+ assert(c);
+
+ return (c->restrict_namespaces & NAMESPACE_FLAGS_ALL) != NAMESPACE_FLAGS_ALL;
+}
+
+bool exec_context_restrict_filesystems_set(const ExecContext *c) {
+ assert(c);
+
+ return c->restrict_filesystems_allow_list ||
+ !set_isempty(c->restrict_filesystems);
+}
+
+bool exec_context_with_rootfs(const ExecContext *c) {
+ assert(c);
+
+ /* Checks if RootDirectory= or RootImage= are used */
+
+ return !empty_or_root(c->root_directory) || c->root_image;
+}
+
int exec_context_has_vpicked_extensions(const ExecContext *context) {
int r;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <sched.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <sys/capability.h>
-#include <sys/socket.h>
+#include "sd-id128.h"
#include "bus-unit-util.h"
#include "cgroup-util.h"
-#include "coredump-util.h"
+#include "core-forward.h"
#include "cpu-set-util.h"
#include "exec-util.h"
-#include "fdset.h"
#include "list.h"
-#include "log.h"
#include "log-context.h"
#include "namespace.h"
-#include "nsflags.h"
#include "numa-util.h"
-#include "open-file.h"
-#include "ordered-set.h"
-#include "path-util.h"
#include "ratelimit.h"
#include "rlimit-util.h"
-#include "runtime-scope.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 {
} ExecKeyringMode;
/* Contains start and exit information about an executed command. */
-struct ExecStatus {
+typedef struct ExecStatus {
dual_timestamp start_timestamp;
dual_timestamp exit_timestamp;
dual_timestamp handoff_timestamp;
pid_t pid;
int code; /* as in siginfo_t::si_code */
int status; /* as in siginfo_t::si_status */
-};
+} ExecStatus;
/* Stores information about commands we execute. Covers both configuration settings as well as runtime data. */
-struct ExecCommand {
+typedef struct ExecCommand {
char *path;
char **argv;
ExecStatus exec_status; /* Note that this is not serialized to sd-executor */
ExecCommandFlags flags;
LIST_FIELDS(ExecCommand, command); /* useful for chaining commands */
-};
+} ExecCommand;
/* Encapsulates certain aspects of the runtime environment that is to be shared between multiple otherwise separate
* invocations of commands. Specifically, this allows sharing of /tmp and /var/tmp data as well as network namespaces
* between invocations of commands. This is a reference counted object, with one reference taken by each currently
* active command invocation that wants to share this runtime. */
-struct ExecSharedRuntime {
+typedef struct ExecSharedRuntime {
unsigned n_ref;
Manager *manager;
/* Like netns_storage_socket, but the file descriptor is referring to the IPC namespace. */
int ipcns_storage_socket[2];
-};
+} ExecSharedRuntime;
-struct ExecRuntime {
+typedef struct ExecRuntime {
ExecSharedRuntime *shared;
DynamicCreds *dynamic_creds;
* the root directory or root image. The lock prevents tmpfiles from removing the ephemeral snapshot
* until we're done using it. */
int ephemeral_storage_socket[2];
-};
+} ExecRuntime;
typedef enum ExecDirectoryType {
EXEC_DIRECTORY_RUNTIME,
/* Encodes configuration parameters applied to invoked commands. Does not carry runtime data, but only configuration
* changes sourced from unit files and suchlike. ExecContext objects are usually embedded into Unit objects, and do not
* change after being loaded. */
-struct ExecContext {
+typedef struct ExecContext {
char **environment;
char **environment_files;
char **pass_environment;
OrderedSet *import_credentials; /* ExecImportCredential */
ImagePolicy *root_image_policy, *mount_image_policy, *extension_image_policy;
-};
-
-static inline bool exec_context_restrict_namespaces_set(const ExecContext *c) {
- assert(c);
-
- return (c->restrict_namespaces & NAMESPACE_FLAGS_ALL) != NAMESPACE_FLAGS_ALL;
-}
-
-static inline bool exec_context_restrict_filesystems_set(const ExecContext *c) {
- assert(c);
-
- return c->restrict_filesystems_allow_list ||
- !set_isempty(c->restrict_filesystems);
-}
-
-static inline bool exec_context_with_rootfs(const ExecContext *c) {
- assert(c);
-
- /* Checks if RootDirectory= or RootImage= are used */
-
- return !empty_or_root(c->root_directory) || c->root_image;
-}
+} ExecContext;
typedef enum ExecFlags {
EXEC_APPLY_SANDBOXING = 1 << 0,
/* Parameters for a specific invocation of a command. This structure is put together right before a command is
* executed. */
-struct ExecParameters {
+typedef struct ExecParameters {
RuntimeScope runtime_scope;
char **environment;
char invocation_id_string[SD_ID128_STRING_MAX];
bool debug_invocation;
-};
+} ExecParameters;
#define EXEC_PARAMETERS_INIT(_flags) \
(ExecParameters) { \
char** exec_context_get_syscall_log(const ExecContext *c);
char** exec_context_get_address_families(const ExecContext *c);
char** exec_context_get_restrict_filesystems(const ExecContext *c);
+bool exec_context_restrict_namespaces_set(const ExecContext *c);
+bool exec_context_restrict_filesystems_set(const ExecContext *c);
+bool exec_context_with_rootfs(const ExecContext *c);
int exec_context_has_vpicked_extensions(const ExecContext *context);
const char* exec_get_private_notify_socket_path(const ExecContext *context, const ExecParameters *params, bool needs_sandboxing);
-static inline int exec_log_level_max(const ExecContext *context, const ExecParameters *params) {
- assert(context);
- assert(params);
-
- if (params->debug_invocation)
- return LOG_DEBUG;
-
- return context->log_level_max < 0 ? log_get_max_level() : context->log_level_max;
-}
+int exec_log_level_max(const ExecContext *context, const ExecParameters *params);
/* These logging macros do the same logging as those in unit.h, but using ExecContext and ExecParameters
* instead of the unit object, so that it can be used in the sd-executor context (where the unit object is
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
-#include <unistd.h>
+#include <stdlib.h>
#include "sd-messages.h"
#include "fileio.h"
#include "getopt-defs.h"
#include "label-util.h"
+#include "log.h"
#include "parse-util.h"
#include "pretty-print.h"
#include "selinux-util.h"
*/
#include <stdio.h>
+#include <stdlib.h>
-#include "alloc-util.h"
+#include "cgroup.h"
#include "dynamic-user.h"
#include "execute-serialize.h"
+#include "execute.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fuzz.h"
-#include "service.h"
static void exec_fuzz_one(FILE *f, FDSet *fdset) {
_cleanup_(exec_params_deep_clear) ExecParameters params = EXEC_PARAMETERS_INIT(/* flags= */ 0);
#include <stdio.h>
-#include "alloc-util.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fuzz.h"
#include "manager.h"
#include "manager-serialize.h"
-#include "service.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_(manager_freep) Manager *m = NULL;
#include "conf-parser.h"
#include "fd-util.h"
#include "fuzz.h"
-#include "install.h"
#include "load-fragment.h"
#include "manager.h"
#include "manager-dump.h"
#include "errno-util.h"
#include "generator-setup.h"
-#include "macro.h"
#include "mkdir-label.h"
+#include "path-lookup.h"
#include "rm-rf.h"
int lookup_paths_mkdir_generator(LookupPaths *p) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "path-lookup.h"
+#include "forward.h"
int lookup_paths_mkdir_generator(LookupPaths *p);
void lookup_paths_trim_generator(LookupPaths *p);
TORSEC group — http://security.polito.it
***/
-#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <stdlib.h>
#include <sys/mount.h>
#include "confidential-virt.h"
#include "copy.h"
#include "creds-util.h"
+#include "errno-util.h"
#include "escape.h"
#include "fileio.h"
#include "format-util.h"
#include "import-creds.h"
#include "initrd-util.h"
#include "io-util.h"
+#include "log.h"
#include "mkdir-label.h"
#include "mount-util.h"
#include "mountpoint-util.h"
#include "proc-cmdline.h"
#include "recurse-dir.h"
#include "smbios11.h"
+#include "stat-util.h"
+#include "string-util.h"
#include "strv.h"
#include "virt.h"
#include "fileio.h"
#include "ipe-setup.h"
#include "log.h"
-#include "nulstr-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-
-#include "sd-id128.h"
+#include "sd-bus.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "async.h"
#include "cgroup.h"
+#include "condition.h"
#include "dbus.h"
#include "dbus-job.h"
#include "escape.h"
-#include "fileio.h"
#include "job.h"
#include "log.h"
-#include "macro.h"
#include "manager.h"
#include "parse-util.h"
+#include "prioq.h"
#include "serialize.h"
#include "set.h"
#include "sort-util.h"
#include "special.h"
-#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
-#include "terminal-util.h"
#include "unit.h"
#include "virt.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-
-#include "sd-bus.h"
-#include "sd-event.h"
-
+#include "core-forward.h"
#include "list.h"
-#include "memory-util.h"
-#include "time-util.h"
-#include "unit-dependency-atom.h"
-
-typedef struct ActivationDetails ActivationDetails;
-typedef struct Job Job;
-typedef struct JobDependency JobDependency;
-typedef enum JobType JobType;
-typedef enum JobState JobState;
-typedef enum JobResult JobResult;
-typedef struct Manager Manager;
-typedef struct Unit Unit;
/* Be careful when changing the job types! Adjust job_merging_table[] accordingly! */
enum JobType {
_JOB_TYPE_INVALID = -EINVAL,
};
-enum JobState {
+typedef enum JobState {
JOB_WAITING,
JOB_RUNNING,
_JOB_STATE_MAX,
_JOB_STATE_INVALID = -EINVAL,
-};
+} JobState;
-enum JobResult {
+typedef enum JobResult {
JOB_DONE, /* Job completed successfully (or skipped due to an unmet ConditionXYZ=) */
JOB_CANCELED, /* Job canceled by a conflicting job installation or by explicit cancel request */
JOB_TIMEOUT, /* Job timeout elapsed */
JOB_CONCURRENCY, /* Slice the unit is in has its hard concurrency limit reached */
_JOB_RESULT_MAX,
_JOB_RESULT_INVALID = -EINVAL,
-};
+} JobResult;
-struct JobDependency {
+typedef struct JobDependency {
/* Encodes that the 'subject' job needs the 'object' job in
* some way. This structure is used only while building a transaction. */
Job *subject;
bool matters:1;
bool conflicts:1;
-};
+} JobDependency;
-struct Job {
+typedef struct Job {
Manager *manager;
Unit *unit;
bool ref_by_private_bus:1;
bool in_gc_queue:1;
-};
+} Job;
Job* job_new(Unit *unit, JobType type);
Job* job_new_raw(Unit *unit);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <stdio.h>
+
#include "kill.h"
#include "signal-util.h"
#include "string-table.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "macro.h"
+#include "forward.h"
typedef enum KillMode {
/* The kill mode is a property of a unit. */
#include <unistd.h>
#include "alloc-util.h"
-#include "bus-util.h"
#include "capability-util.h"
#include "efi-api.h"
#include "fileio.h"
#include "kmod-setup.h"
#include "log.h"
-#include "macro.h"
#include "module-util.h"
#include "recurse-dir.h"
#include "string-util.h"
#include "log.h"
#include "manager.h"
#include "stat-util.h"
-#include "string-util.h"
#include "strv.h"
#include "unit.h"
#include "unit-name.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-
-typedef struct Unit Unit;
+#include "core-forward.h"
/* Read service data supplementary drop-in directories */
#endif
#include <stddef.h>
#include "all-units.h"
+#include "condition.h"
#include "conf-parser.h"
#include "image-policy.h"
#include "in-addr-prefix-util.h"
Copyright © 2012 Holger Hans Peter Freyther
***/
-#include <errno.h>
#include <fcntl.h>
-#include <linux/oom.h>
#include <sched.h>
-#include <sys/resource.h>
+#include "sd-bus.h"
#include "sd-messages.h"
#include "af-list.h"
#include "all-units.h"
#include "alloc-util.h"
-#include "bpf-firewall.h"
#include "bpf-program.h"
#include "bpf-restrict-fs.h"
-#include "bpf-socket-bind.h"
#include "bus-error.h"
-#include "bus-internal.h"
-#include "bus-util.h"
+#include "calendarspec.h"
#include "cap-list.h"
#include "capability-util.h"
#include "cgroup-setup.h"
+#include "condition.h"
#include "conf-parser.h"
+#include "coredump-util.h"
#include "cpu-set-util.h"
#include "creds-util.h"
+#include "dissect-image.h"
#include "env-util.h"
-#include "errno-list.h"
#include "escape.h"
#include "exec-credential.h"
#include "execute.h"
+#include "extract-word.h"
#include "fd-util.h"
-#include "fileio.h"
#include "firewall-util.h"
-#include "fs-util.h"
#include "fstab-util.h"
+#include "hashmap.h"
#include "hexdecoct.h"
#include "hostname-util.h"
#include "ioprio-util.h"
#include "limits-util.h"
#include "load-fragment.h"
#include "log.h"
-#include "missing_fs.h"
+#include "manager.h"
#include "mountpoint-util.h"
+#include "nsflags.h"
#include "nulstr-util.h"
#include "open-file.h"
+#include "ordered-set.h"
#include "parse-helpers.h"
#include "parse-util.h"
#include "path-util.h"
#include "seccomp-util.h"
#include "securebits-util.h"
#include "selinux-util.h"
+#include "set.h"
+#include "show-status.h"
#include "signal-util.h"
#include "socket-netlink.h"
#include "specifier.h"
#include "unit-name.h"
#include "unit-printf.h"
#include "user-util.h"
-#include "utf8.h"
-#include "varlink.h"
#include "web-util.h"
static int parse_socket_protocol(const char *s) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "conf-parser.h"
-
-typedef struct Unit Unit;
+#include "core-forward.h"
/* These functions are declared in the header to make them accessible to unit tests. */
bool contains_instance_specifier_superset(const char *s);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/oom.h>
+#include <stdlib.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/utsname.h>
#include <unistd.h>
+
#if HAVE_VALGRIND_VALGRIND_H
# include <valgrind/valgrind.h>
#endif
#include "argv-util.h"
#include "build.h"
#include "bus-error.h"
-#include "bus-util.h"
#include "capability-util.h"
#include "cgroup-setup.h"
-#include "cgroup-util.h"
#include "chase.h"
#include "clock-util.h"
#include "clock-warp.h"
#include "confidential-virt.h"
#include "constants.h"
#include "copy.h"
+#include "coredump-util.h"
#include "cpu-set-util.h"
#include "crash-handler.h"
#include "dbus.h"
#include "dbus-manager.h"
#include "dev-setup.h"
#include "efi-random.h"
-#include "efivars.h"
#include "emergency-action.h"
#include "env-util.h"
#include "escape.h"
-#include "exit-status.h"
#include "fd-util.h"
#include "fdset.h"
#include "fileio.h"
#include "format-util.h"
-#include "fs-util.h"
#include "getopt-defs.h"
#include "hexdecoct.h"
#include "hostname-setup.h"
+#include "id128-util.h"
#include "ima-setup.h"
#include "import-creds.h"
#include "initrd-util.h"
#include "pretty-print.h"
#include "proc-cmdline.h"
#include "process-util.h"
-#include "psi-util.h"
#include "random-util.h"
#include "rlimit-util.h"
#include "rm-rf.h"
#include "selinux-setup.h"
#include "selinux-util.h"
#include "serialize.h"
+#include "set.h"
#include "signal-util.h"
#include "smack-setup.h"
#include "special.h"
#include "terminal-util.h"
#include "time-util.h"
#include "umask-util.h"
+#include "unit-name.h"
#include "user-util.h"
#include "version.h"
#include "virt.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-
+#include "forward.h"
#include "crash-handler.h"
extern bool arg_dump_core;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fnmatch.h>
+#include <stdio.h>
+
+#include "sd-bus.h"
#include "build.h"
-#include "fd-util.h"
-#include "fileio.h"
#include "hashmap.h"
#include "manager.h"
#include "manager-dump.h"
#include "memstream-util.h"
+#include "string-util.h"
+#include "strv.h"
#include "unit-serialize.h"
#include "version.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdio.h>
-
-typedef struct Manager Manager;
+#include "core-forward.h"
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);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-varlink.h"
-
-#include "clean-ipc.h"
+#include "alloc-util.h"
#include "dbus.h"
#include "dynamic-user.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fileio.h"
#include "format-util.h"
+#include "glyph-util.h"
+#include "hashmap.h"
#include "initrd-util.h"
-#include "macro.h"
#include "manager.h"
#include "manager-serialize.h"
#include "parse-util.h"
#include "serialize.h"
+#include "string-util.h"
+#include "strv.h"
#include "syslog-util.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 "fdset.h"
-
-typedef struct Manager Manager;
+#include "core-forward.h"
#define DESTROY_IPC_FLAG (UINT32_C(1) << 31)
#include <sys/prctl.h>
+#include "sd-varlink.h"
+
+#include "alloc-util.h"
+#include "architecture.h"
#include "build.h"
#include "confidential-virt.h"
#include "json-util.h"
#include "manager-varlink.h"
#include "manager.h"
+#include "set.h"
+#include "strv.h"
#include "syslog-util.h"
#include "taint.h"
#include "version.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-json.h"
-#include "sd-varlink.h"
+#include "forward.h"
int vl_method_describe_manager(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fcntl.h>
#include <linux/kd.h>
-#include <sys/epoll.h>
#include <sys/inotify.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/reboot.h>
-#include <sys/timerfd.h>
#include <sys/wait.h>
#include <unistd.h>
#include "all-units.h"
#include "alloc-util.h"
+#include "architecture.h"
#include "audit-fd.h"
#include "boot-timestamps.h"
+#include "bpf-restrict-fs.h"
#include "build-path.h"
#include "bus-common-errors.h"
#include "bus-error.h"
-#include "bus-kernel.h"
-#include "bus-util.h"
#include "clean-ipc.h"
-#include "clock-util.h"
#include "common-signal.h"
#include "confidential-virt.h"
#include "constants.h"
#include "creds-util.h"
#include "daemon-util.h"
-#include "dbus.h"
#include "dbus-job.h"
#include "dbus-manager.h"
#include "dbus-unit.h"
+#include "dbus.h"
#include "dirent-util.h"
#include "dynamic-user.h"
#include "env-util.h"
#include "execute.h"
#include "exit-status.h"
#include "fd-util.h"
-#include "fileio.h"
+#include "fdset.h"
+#include "format-util.h"
+#include "fs-util.h"
#include "generator-setup.h"
#include "hashmap.h"
#include "initrd-util.h"
#include "load-fragment.h"
#include "locale-setup.h"
#include "log.h"
-#include "macro.h"
-#include "manager.h"
#include "manager-dump.h"
#include "manager-serialize.h"
-#include "memory-util.h"
+#include "manager.h"
#include "mkdir-label.h"
#include "mount-util.h"
#include "notify-recv.h"
-#include "os-util.h"
#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "plymouth-util.h"
#include "pretty-print.h"
+#include "prioq.h"
#include "process-util.h"
#include "psi-util.h"
#include "ratelimit.h"
#include "rm-rf.h"
#include "selinux-util.h"
#include "serialize.h"
+#include "set.h"
#include "signal-util.h"
#include "socket-util.h"
#include "special.h"
#include "terminal-util.h"
#include "time-util.h"
#include "transaction.h"
-#include "uid-range.h"
#include "umask-util.h"
#include "unit-name.h"
#include "user-util.h"
return unit_compare_priority(x->unit, y->unit);
}
+usec_t manager_default_timeout(RuntimeScope scope) {
+ return scope == RUNTIME_SCOPE_SYSTEM ? DEFAULT_TIMEOUT_USEC : DEFAULT_USER_TIMEOUT_USEC;
+}
+
int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags, Manager **ret) {
_cleanup_(manager_freep) Manager *m = NULL;
int r;
return 0;
}
+int manager_add_job(
+ Manager *m,
+ JobType type,
+ Unit *unit,
+ JobMode mode,
+ sd_bus_error *error,
+ Job **ret) {
+
+ return manager_add_job_full(m, type, unit, mode, 0, NULL, error, ret);
+}
+
int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, sd_bus_error *e, Job **ret) {
Unit *unit = NULL; /* just to appease gcc, initialization is not really necessary */
int r;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "sd-bus.h"
-#include "sd-device.h"
#include "sd-event.h"
-#include "sd-varlink.h"
#include "cgroup.h"
-#include "cgroup-util.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 "forward.h"
+#include "log.h"
#include "show-status.h"
-#include "transaction.h"
#include "unit.h"
-#include "unit-name.h"
struct libmnt_monitor;
assert_cc((int) _MANAGER_SIGNAL_COMMAND_MAX <= (int) _COMMON_SIGNAL_COMMAND_PRIVATE_END);
-typedef struct Manager Manager;
-
/* An externally visible state. We don't actually maintain this as state variable, but derive it from various fields
* when requested */
typedef enum ManagerState {
struct rlimit *rlimit[_RLIMIT_MAX];
} UnitDefaults;
-struct Manager {
+typedef struct Manager {
/* Note that the set of units we know of is allowed to be
* inconsistent. However the subset of it that is loaded may
* not, and the list of jobs may neither. */
/* Original ambient capabilities when we were initialized */
uint64_t saved_ambient_set;
-};
+} Manager;
static inline usec_t manager_default_timeout_abort_usec(Manager *m) {
assert(m);
#define MANAGER_IS_TEST_RUN(m) ((m)->test_run_flags != 0)
-static inline usec_t manager_default_timeout(RuntimeScope scope) {
- return scope == RUNTIME_SCOPE_SYSTEM ? DEFAULT_TIMEOUT_USEC : DEFAULT_USER_TIMEOUT_USEC;
-}
+usec_t manager_default_timeout(RuntimeScope scope);
int manager_new(RuntimeScope scope, ManagerTestRunFlags test_run_flags, Manager **m);
Manager* manager_free(Manager *m);
Set *affected_jobs,
sd_bus_error *error,
Job **ret);
-static inline int manager_add_job(
+int manager_add_job(
Manager *m,
JobType type,
Unit *unit,
JobMode mode,
sd_bus_error *error,
- Job **ret) {
- return manager_add_job_full(m, type, unit, mode, 0, NULL, error, ret);
-}
+ Job **ret);
+
int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, sd_bus_error *e, Job **ret);
int manager_add_job_by_name_and_warn(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, Job **ret);
int manager_propagate_reload(Manager *m, Unit *unit, JobMode mode, sd_bus_error *e);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <signal.h>
#include <stdio.h>
-#include <sys/epoll.h>
+#include <stdlib.h>
+#include <sys/socket.h>
#include "sd-messages.h"
#include "dbus-mount.h"
#include "dbus-unit.h"
#include "device.h"
+#include "errno-util.h"
#include "exec-credential.h"
#include "exit-status.h"
#include "fd-util.h"
#include "format-util.h"
-#include "fs-util.h"
#include "fstab-util.h"
+#include "glyph-util.h"
#include "initrd-util.h"
#include "libmount-util.h"
#include "log.h"
#include "manager.h"
#include "mkdir-label.h"
+#include "mount-util.h"
#include "mount.h"
#include "mount-setup.h"
#include "mountpoint-util.h"
#include "path-util.h"
#include "process-util.h"
#include "serialize.h"
+#include "set.h"
#include "special.h"
#include "stat-util.h"
#include "string-table.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "cgroup.h"
+#include "core-forward.h"
+#include "execute.h"
#include "kill.h"
#include "pidref.h"
#include "unit.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <linux/loop.h>
#include <sched.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <unistd.h>
#include "chase.h"
#include "dev-setup.h"
#include "devnum-util.h"
-#include "env-util.h"
+#include "dissect-image.h"
+#include "errno-util.h"
#include "escape.h"
#include "extension-util.h"
#include "fd-util.h"
#include "format-util.h"
+#include "fs-util.h"
#include "glyph-util.h"
#include "label-util.h"
#include "list.h"
#include "loop-util.h"
#include "loopback-setup.h"
#include "missing_magic.h"
-#include "missing_syscall.h"
#include "mkdir-label.h"
#include "mount-util.h"
#include "mountpoint-util.h"
return 0;
}
+char* namespace_cleanup_tmpdir(char *p) {
+ PROTECT_ERRNO;
+ if (!streq_ptr(p, RUN_SYSTEMD_EMPTY))
+ (void) rmdir(p);
+ return mfree(p);
+}
+
int setup_tmp_dirs(const char *id, char **tmp_dir, char **var_tmp_dir) {
_cleanup_(namespace_cleanup_tmpdirp) char *a = NULL;
_cleanup_(rmdir_and_freep) char *a_tmp = NULL;
Copyright © 2016 Djalal Harouni
***/
-typedef struct NamespaceParameters NamespaceParameters;
-typedef struct BindMount BindMount;
-typedef struct TemporaryFileSystem TemporaryFileSystem;
-typedef struct MountImage MountImage;
-
-#include <stdbool.h>
-
-#include "dissect-image.h"
-#include "fs-util.h"
-#include "macro.h"
-#include "namespace-util.h"
-#include "pidref.h"
+#include "forward.h"
+#include "list.h"
#include "runtime-scope.h"
-#include "string-util.h"
typedef enum ProtectHome {
PROTECT_HOME_NO,
_PRIVATE_PIDS_INVALID = -EINVAL,
} PrivatePIDs;
-struct BindMount {
+typedef struct BindMount {
char *source;
char *destination;
bool read_only;
bool idmapped;
uid_t uid;
gid_t gid;
-};
+} BindMount;
-struct TemporaryFileSystem {
+typedef struct TemporaryFileSystem {
char *path;
char *options;
-};
+} TemporaryFileSystem;
typedef enum MountImageType {
MOUNT_IMAGE_DISCRETE,
_MOUNT_IMAGE_TYPE_INVALID = -EINVAL,
} MountImageType;
-struct MountImage {
+typedef struct MountImage {
char *source;
char *destination; /* Unused if MountImageType == MOUNT_IMAGE_EXTENSION */
LIST_HEAD(MountOptions, mount_options);
bool ignore_enoent;
MountImageType type;
-};
+} MountImage;
-struct NamespaceParameters {
+typedef struct NamespaceParameters {
RuntimeScope runtime_scope;
const char *root_directory;
PrivateTmp private_tmp;
PrivateTmp private_var_tmp;
PrivatePIDs private_pids;
-};
+} NamespaceParameters;
int setup_namespace(const NamespaceParameters *p, char **reterr_path);
#define RUN_SYSTEMD_EMPTY "/run/systemd/empty"
-static inline char* namespace_cleanup_tmpdir(char *p) {
- PROTECT_ERRNO;
- if (!streq_ptr(p, RUN_SYSTEMD_EMPTY))
- (void) rmdir(p);
- return mfree(p);
-}
+char* namespace_cleanup_tmpdir(char *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, namespace_cleanup_tmpdir);
int setup_tmp_dirs(
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <sys/epoll.h>
#include <sys/inotify.h>
#include <unistd.h>
+#include "sd-bus.h"
+
#include "async.h"
#include "bus-error.h"
-#include "bus-util.h"
#include "dbus-path.h"
#include "dbus-unit.h"
+#include "errno-util.h"
#include "escape.h"
#include "event-util.h"
-#include "fd-util.h"
#include "glob-util.h"
#include "inotify-util.h"
-#include "macro.h"
#include "manager.h"
#include "mkdir-label.h"
#include "path.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "unit.h"
-#include "unit-name.h"
static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = {
[PATH_DEAD] = UNIT_INACTIVE,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "core-forward.h"
#include "unit.h"
typedef enum PathType {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <unistd.h>
-#include "alloc-util.h"
+#include "sd-bus.h"
+
#include "cgroup-setup.h"
#include "dbus-scope.h"
#include "dbus-unit.h"
#include "exit-status.h"
-#include "load-dropin.h"
#include "log.h"
#include "manager.h"
#include "parse-util.h"
-#include "process-util.h"
+#include "pidref.h"
#include "random-util.h"
#include "scope.h"
#include "serialize.h"
+#include "set.h"
#include "special.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit.h"
-#include "unit-name.h"
#include "user-util.h"
static const UnitActiveState state_translation_table[_SCOPE_STATE_MAX] = {
#pragma once
#include "cgroup.h"
+#include "core-forward.h"
#include "kill.h"
#include "unit.h"
#if HAVE_SELINUX
-#include <errno.h>
#include <selinux/avc.h>
#include <selinux/selinux.h>
#include "alloc-util.h"
#include "audit-fd.h"
-#include "bus-util.h"
#include "errno-util.h"
#include "format-util.h"
#include "libaudit-util.h"
#include "log.h"
-#include "path-util.h"
#include "selinux-util.h"
#include "stdio-util.h"
+#include "string-util.h"
#include "strv.h"
+#include "unit.h"
static bool initialized = false;
*/
int mac_selinux_access_check_internal(
sd_bus_message *message,
- const char *unit_path,
- const char *unit_context,
+ const Unit *unit,
const char *permission,
const char *function,
sd_bus_error *error) {
if (r < 0)
return r;
- if (unit_context) {
+ if (unit && unit->access_selinux_context) {
/* Nice! The unit comes with a SELinux context read from the unit file */
- acon = unit_context;
+ acon = unit->access_selinux_context;
tclass = "service";
} else {
/* If no unit context is known, use our own */
struct audit_info audit_info = {
.creds = creds,
- .path = unit_path,
+ .path = unit ? unit->fragment_path : NULL,
.cmdline = cl,
.function = function,
};
log_full_errno_zerook(LOG_DEBUG, r,
"SELinux access check scon=%s tcon=%s tclass=%s perm=%s state=%s function=%s path=%s cmdline=%s: %m",
- scon, acon, tclass, permission, enforce ? "enforcing" : "permissive", function, strna(unit_path), empty_to_na(cl));
+ scon, acon, tclass, permission, enforce ? "enforcing" : "permissive", function, strna(unit ? unit->fragment_path : NULL), empty_to_na(cl));
return enforce ? r : 0;
}
int mac_selinux_access_check_internal(
sd_bus_message *message,
- const char *unit_path,
- const char *unit_label,
+ const Unit *unit,
const char *permission,
const char *function,
sd_bus_error *error) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-bus.h"
+#include "core-forward.h"
-#include "manager.h"
-
-int mac_selinux_access_check_internal(sd_bus_message *message, const char *unit_path, const char *unit_label, const char *permission, const char *function, sd_bus_error *error);
+int mac_selinux_access_check_internal(sd_bus_message *message, const Unit *unit, const char *permission, const char *function, sd_bus_error *error);
#define mac_selinux_access_check(message, permission, error) \
- mac_selinux_access_check_internal((message), NULL, NULL, (permission), __func__, (error))
+ mac_selinux_access_check_internal((message), NULL, (permission), __func__, (error))
#define mac_selinux_unit_access_check(unit, message, permission, error) \
- mac_selinux_access_check_internal((message), (unit)->fragment_path, (unit)->access_selinux_context, (permission), __func__, (error))
+ mac_selinux_access_check_internal((message), (unit), (permission), __func__, (error))
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <stdio.h>
#include <unistd.h>
#if HAVE_SELINUX
#include "errno-util.h"
#include "initrd-util.h"
#include "log.h"
-#include "macro.h"
#include "selinux-setup.h"
#include "selinux-util.h"
#include "string-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
+#include "forward.h"
int mac_selinux_setup(bool *loaded_policy);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <math.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
+#include "sd-bus.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "async.h"
#include "bus-common-errors.h"
#include "bus-error.h"
-#include "bus-kernel.h"
#include "bus-util.h"
#include "chase.h"
-#include "constants.h"
#include "dbus-service.h"
#include "dbus-unit.h"
#include "devnum-util.h"
#include "env-util.h"
+#include "errno-util.h"
#include "escape.h"
#include "execute.h"
#include "exec-credential.h"
#include "exit-status.h"
+#include "extract-word.h"
#include "fd-util.h"
+#include "fdset.h"
#include "fileio.h"
#include "format-util.h"
-#include "io-util.h"
-#include "load-dropin.h"
-#include "load-fragment.h"
+#include "glyph-util.h"
+#include "image-policy.h"
#include "log.h"
#include "manager.h"
#include "missing_audit.h"
#include "open-file.h"
#include "parse-util.h"
#include "path-util.h"
+#include "path.h"
#include "pidfd-util.h"
#include "process-util.h"
#include "random-util.h"
-#include "runtime-scope.h"
#include "selinux-util.h"
#include "serialize.h"
#include "service.h"
#include "signal-util.h"
+#include "socket.h"
#include "special.h"
-#include "stdio-util.h"
+#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "cgroup.h"
+#include "core-forward.h"
#include "exit-status.h"
#include "kill.h"
-#include "manager.h"
-#include "open-file.h"
-#include "path.h"
#include "pidref.h"
-#include "ratelimit.h"
-#include "socket.h"
#include "unit.h"
-typedef struct Service Service;
-
typedef enum ServiceRestart {
SERVICE_RESTART_NO,
SERVICE_RESTART_ON_SUCCESS,
char *fdname;
} ServiceExtraFD;
-struct Service {
+typedef struct Service {
Unit meta;
ServiceType type;
/* The D-Bus request, we will reply once the operation is finished, so that callers can block */
sd_bus_message *mount_request;
-};
+} Service;
static inline usec_t service_timeout_abort_usec(Service *s) {
assert(s);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include "alloc-util.h"
#include "fd-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-#include <stdarg.h>
-#include <stdbool.h>
-
-#include "macro.h"
+#include "forward.h"
/* Manager status */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
+#include <stdio.h>
#include "alloc-util.h"
#include "dbus-slice.h"
#include "dbus-unit.h"
-#include "fd-util.h"
#include "log.h"
#include "manager.h"
#include "serialize.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "cgroup.h"
+#include "core-forward.h"
#include "unit.h"
typedef struct Slice {
Nathaniel Chen <nathaniel.chen@intel.com>
***/
-#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include "sd-messages.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
-#include "macro.h"
#include "smack-setup.h"
#include "string-util.h"
Nathaniel Chen <nathaniel.chen@intel.com>
***/
-#include <stdbool.h>
+#include "forward.h"
int mac_smack_setup(bool *loaded_policy);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <arpa/inet.h>
-#include <errno.h>
#include <fcntl.h>
#include <linux/sctp.h>
#include <mqueue.h>
#include <netinet/tcp.h>
-#include <sys/epoll.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "sd-bus.h"
+
#include "alloc-util.h"
-#include "bpf-firewall.h"
+#include "bpf-program.h"
#include "bus-error.h"
-#include "bus-util.h"
-#include "chase.h"
-#include "constants.h"
#include "copy.h"
#include "dbus-socket.h"
#include "dbus-unit.h"
#include "errno-list.h"
+#include "errno-util.h"
#include "exit-status.h"
+#include "extract-word.h"
#include "fd-util.h"
+#include "fdset.h"
#include "format-util.h"
+#include "fs-util.h"
+#include "glyph-util.h"
#include "in-addr-util.h"
#include "io-util.h"
#include "ip-protocol-list.h"
-#include "label-util.h"
#include "log.h"
#include "manager.h"
#include "mkdir-label.h"
+#include "namespace-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "pidfd-util.h"
#include "selinux-util.h"
#include "serialize.h"
#include "service.h"
-#include "signal-util.h"
+#include "set.h"
+#include "siphash24.h"
#include "smack-util.h"
#include "socket.h"
#include "socket-netlink.h"
#include "unit-name.h"
#include "user-util.h"
-struct SocketPeer {
+typedef struct SocketPeer {
unsigned n_ref;
Socket *socket;
union sockaddr_union peer;
socklen_t peer_salen;
struct ucred peer_cred;
-};
+} SocketPeer;
static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = {
[SOCKET_DEAD] = UNIT_INACTIVE,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "cgroup.h"
+#include "core-forward.h"
+#include "execute.h"
+#include "list.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,
_SOCKET_TIMESTAMPING_INVALID = -EINVAL,
} SocketTimestamping;
-struct Socket {
+typedef struct Socket {
Unit meta;
LIST_HEAD(SocketPort, ports);
RateLimit trigger_limit;
RateLimit poll_limit;
-};
+} Socket;
SocketPeer *socket_peer_ref(SocketPeer *p);
SocketPeer *socket_peer_unref(SocketPeer *p);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <sys/epoll.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include "dbus-unit.h"
#include "device.h"
#include "device-util.h"
+#include "errno-util.h"
#include "escape.h"
#include "exit-status.h"
#include "fd-util.h"
#include "format-util.h"
#include "fstab-util.h"
+#include "glyph-util.h"
#include "manager.h"
-#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "serialize.h"
+#include "set.h"
#include "special.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "swap.h"
#include "unit.h"
#include "unit-name.h"
Copyright © 2010 Maarten Lankhorst
***/
-#include "sd-device.h"
-
+#include "cgroup.h"
+#include "core-forward.h"
+#include "execute.h"
#include "pidref.h"
#include "unit.h"
#include <sys/utsname.h>
#include "alloc-util.h"
-#include "cgroup-util.h"
#include "clock-util.h"
+#include "constants.h"
#include "errno-util.h"
#include "fileio.h"
#include "fs-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "dbus-target.h"
+#include <stdio.h>
+
#include "dbus-unit.h"
-#include "log.h"
#include "serialize.h"
#include "special.h"
#include "string-util.h"
#include "target.h"
#include "unit.h"
-#include "unit-name.h"
static const UnitActiveState state_translation_table[_TARGET_STATE_MAX] = {
[TARGET_DEAD] = UNIT_INACTIVE,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "core-forward.h"
#include "unit.h"
typedef struct Target {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
+#include <stdlib.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
+#include "sd-bus.h"
+
#include "alloc-util.h"
#include "bus-error.h"
-#include "bus-util.h"
+#include "calendarspec.h"
#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"
+#include "siphash24.h"
#include "special.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "timer.h"
#include "unit.h"
-#include "unit-name.h"
#include "user-util.h"
#include "virt.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "calendarspec.h"
+#include "core-forward.h"
#include "unit.h"
typedef enum TimerBase {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <fcntl.h>
-#include <unistd.h>
+#include "sd-bus.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "bus-error.h"
#include "dbus-unit.h"
#include "manager.h"
+#include "set.h"
#include "slice.h"
+#include "string-util.h"
#include "strv.h"
-#include "terminal-util.h"
#include "transaction.h"
static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "hashmap.h"
-#include "job.h"
+#include "core-forward.h"
typedef struct Transaction {
/* Jobs to be added */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "assert-util.h"
+#include "unit-def.h"
#include "unit-dependency-atom.h"
static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-
-#include "unit-def.h"
+#include "forward.h"
/* Flags that identify the various "atomic" behaviours a specific dependency type implies. Each dependency is
* a combination of one or more of these flags that define what they actually entail. */
#include "sd-path.h"
#include "alloc-util.h"
-#include "cgroup-util.h"
-#include "format-util.h"
-#include "macro.h"
+#include "creds-util.h"
+#include "env-util.h"
+#include "fd-util.h"
+#include "fileio.h"
#include "manager.h"
#include "specifier.h"
#include "string-util.h"
-#include "strv.h"
#include "unit.h"
#include "unit-name.h"
#include "unit-printf.h"
-#include "user-util.h"
static int specifier_prefix_and_instance(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
const Unit *u = ASSERT_PTR(userdata);
return specifier_printf(format, max_length, table, NULL, u, ret);
}
+
+int unit_full_printf(const Unit *u, const char *text, char **ret) {
+ return unit_full_printf_full(u, text, LONG_LINE_MAX, ret);
+}
+
+int unit_path_printf(const Unit *u, const char *text, char **ret) {
+ return unit_full_printf_full(u, text, PATH_MAX-1, ret);
+}
+
+int unit_fd_printf(const Unit *u, const char *text, char **ret) {
+ return unit_full_printf_full(u, text, FDNAME_MAX, ret);
+}
+
+int unit_cred_printf(const Unit *u, const char *text, char **ret) {
+ return unit_full_printf_full(u, text, CREDENTIAL_NAME_MAX, ret);
+}
+
+int unit_env_printf(const Unit *u, const char *text, char **ret) {
+ return unit_full_printf_full(u, text, sc_arg_max(), ret);
+}
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "creds-util.h"
-#include "env-util.h"
-#include "fd-util.h"
-#include "fileio.h"
-#include "unit.h"
+#include "core-forward.h"
int unit_name_printf(const Unit *u, const char* text, char **ret);
int unit_full_printf_full(const Unit *u, const char *text, size_t max_length, char **ret);
-static inline int unit_full_printf(const Unit *u, const char *text, char **ret) {
- return unit_full_printf_full(u, text, LONG_LINE_MAX, ret);
-}
-static inline int unit_path_printf(const Unit *u, const char *text, char **ret) {
- return unit_full_printf_full(u, text, PATH_MAX-1, ret);
-}
-static inline int unit_fd_printf(const Unit *u, const char *text, char **ret) {
- return unit_full_printf_full(u, text, FDNAME_MAX, ret);
-}
-static inline int unit_cred_printf(const Unit *u, const char *text, char **ret) {
- return unit_full_printf_full(u, text, CREDENTIAL_NAME_MAX, ret);
-}
-static inline int unit_env_printf(const Unit *u, const char *text, char **ret) {
- return unit_full_printf_full(u, text, sc_arg_max(), ret);
-}
+int unit_full_printf(const Unit *u, const char *text, char **ret);
+int unit_path_printf(const Unit *u, const char *text, char **ret);
+int unit_fd_printf(const Unit *u, const char *text, char **ret);
+int unit_cred_printf(const Unit *u, const char *text, char **ret);
+int unit_env_printf(const Unit *u, const char *text, char **ret);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "sd-bus.h"
+
+#include "alloc-util.h"
#include "bitfield.h"
-#include "bpf-restrict-ifaces.h"
-#include "bpf-socket-bind.h"
-#include "bus-util.h"
+#include "cgroup.h"
+#include "condition.h"
#include "dbus.h"
+#include "extract-word.h"
#include "fileio.h"
#include "format-util.h"
+#include "glyph-util.h"
#include "parse-util.h"
#include "serialize.h"
-#include "string-table.h"
+#include "set.h"
+#include "string-util.h"
+#include "strv.h"
#include "unit.h"
#include "unit-serialize.h"
#include "user-util.h"
"%s\tMerged into: %s\n",
prefix, u->merged_into->id);
else if (u->load_state == UNIT_ERROR) {
- errno = abs(u->load_error);
+ errno = ABS(u->load_error);
fprintf(f, "%s\tLoad Error Code: %m\n", prefix);
}
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "fdset.h"
-
-typedef struct Unit Unit;
+#include "core-forward.h"
/* These functions serialize state for our own usage, i.e.: across a reload/reexec, rather than for being
* passed to a child process. */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fnmatch.h>
-#include <stdlib.h>
-#include <sys/prctl.h>
+#include <linux/capability.h>
#include <unistd.h>
+#include "sd-bus.h"
#include "sd-id128.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "bpf-firewall.h"
-#include "bpf-foreign.h"
-#include "bpf-socket-bind.h"
+#include "bpf-restrict-fs.h"
#include "bus-common-errors.h"
#include "bus-internal.h"
#include "bus-util.h"
#include "cgroup-setup.h"
#include "cgroup-util.h"
#include "chase.h"
-#include "dbus.h"
+#include "condition.h"
#include "dbus-unit.h"
#include "dropin.h"
#include "dynamic-user.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "fs-util.h"
#include "id128-util.h"
#include "install.h"
#include "iovec-util.h"
#include "load-fragment.h"
#include "log.h"
#include "logarithm.h"
-#include "macro.h"
#include "mkdir-label.h"
+#include "manager.h"
+#include "mount-util.h"
#include "mountpoint-util.h"
#include "path-util.h"
#include "process-util.h"
#include "serialize.h"
#include "set.h"
#include "signal-util.h"
+#include "siphash24.h"
#include "sparse-endian.h"
#include "special.h"
#include "specifier.h"
#include "stat-util.h"
-#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
-#include "terminal-util.h"
#include "tmpfile-util.h"
#include "umask-util.h"
#include "unit.h"
#include "unit-name.h"
#include "user-util.h"
#include "varlink.h"
-#include "virt.h"
-#if BPF_FRAMEWORK
-#include "bpf-link.h"
-#endif
/* Thresholds for logging at INFO level about resource consumption */
#define MENTIONWORTHY_CPU_NSEC (1 * NSEC_PER_SEC)
return 0;
}
+int unit_get_log_level_max(const Unit *u) {
+ if (u) {
+ if (u->debug_invocation)
+ return LOG_DEBUG;
+
+ ExecContext *ec = unit_get_exec_context(u);
+ if (ec && ec->log_level_max >= 0)
+ return ec->log_level_max;
+ }
+
+ return log_get_max_level();
+}
+
+bool unit_log_level_test(const Unit *u, int level) {
+ assert(u);
+ return LOG_PRI(level) <= unit_get_log_level_max(u);
+}
+
void unit_log_success(Unit *u) {
assert(u);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
#include "sd-id128.h"
-#include "cgroup.h"
-#include "condition.h"
+#include "core-forward.h"
#include "emergency-action.h"
#include "execute.h"
+#include "hashmap.h"
#include "install.h"
+#include "iterator.h"
#include "job.h"
#include "list.h"
+#include "log.h"
#include "log-context.h"
-#include "mount-util.h"
-#include "pidref.h"
#include "ratelimit.h"
+#include "time-util.h"
+#include "unit-def.h"
+#include "unit-dependency-atom.h"
#include "unit-file.h"
-typedef struct UnitRef UnitRef;
-
typedef enum UnitMountDependencyType {
UNIT_MOUNT_WANTS,
UNIT_MOUNT_REQUIRES,
return INT_TO_PTR(d);
}
-struct UnitRef {
+typedef struct UnitRef {
/* Keeps tracks of references to a unit. This is useful so
* that we can merge two units if necessary and correct all
* references to them */
Unit *source, *target;
LIST_FIELDS(UnitRef, refs_by_target);
-};
+} UnitRef;
/* The generic, dynamic definition of the unit */
typedef struct Unit {
return u && u->job && u->job->type == type;
}
-static inline int unit_get_log_level_max(const Unit *u) {
- if (u) {
- if (u->debug_invocation)
- return LOG_DEBUG;
-
- ExecContext *ec = unit_get_exec_context(u);
- if (ec && ec->log_level_max >= 0)
- return ec->log_level_max;
- }
+int unit_get_log_level_max(const Unit *u);
- return log_get_max_level();
-}
-
-static inline bool unit_log_level_test(const Unit *u, int level) {
- assert(u);
- return LOG_PRI(level) <= unit_get_log_level_max(u);
-}
+bool unit_log_level_test(const Unit *u, int level);
/* unit_log_skip is for cases like ExecCondition= where a unit is considered "done"
* after some execution, rather than succeeded or failed. */
#pragma once
#include "sd-json.h"
-#include "sd-varlink.h"
int rlimit_build_json(sd_json_variant **ret, const char *name, void *userdata);
int rlimit_table_build_json(sd_json_variant **ret, const char *name, void *userdata);
#include "sd-varlink.h"
+#include "constants.h"
#include "dynamic-user.h"
-#include "format-util.h"
+#include "errno-util.h"
#include "json-util.h"
#include "manager.h"
#include "manager-varlink.h"
-#include "mkdir-label.h"
+#include "path-util.h"
+#include "pidref.h"
+#include "string-util.h"
#include "strv.h"
#include "unit.h"
#include "user-util.h"
#include "varlink.h"
-#include "varlink-internal.h"
#include "varlink-io.systemd.Manager.h"
#include "varlink-io.systemd.ManagedOOM.h"
#include "varlink-io.systemd.UserDatabase.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-typedef struct Manager Manager;
-typedef struct Unit Unit;
+#include "core-forward.h"
int manager_setup_varlink_server(Manager *m);