]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Clean up includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 21 May 2025 14:37:12 +0000 (16:37 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 07:37:20 +0000 (09:37 +0200)
Split out of #37344.

144 files changed:
src/core/all-units.h
src/core/apparmor-setup.c
src/core/audit-fd.c
src/core/audit-fd.h
src/core/automount.c
src/core/automount.h
src/core/bpf-devices.c
src/core/bpf-devices.h
src/core/bpf-firewall.c
src/core/bpf-firewall.h
src/core/bpf-foreign.c
src/core/bpf-foreign.h
src/core/bpf-restrict-fs.c
src/core/bpf-restrict-fs.h
src/core/bpf-restrict-ifaces.c
src/core/bpf-restrict-ifaces.h
src/core/bpf-socket-bind.c
src/core/bpf-socket-bind.h
src/core/cgroup.c
src/core/cgroup.h
src/core/clock-warp.h
src/core/core-forward.h [new file with mode: 0644]
src/core/crash-handler.c
src/core/crash-handler.h
src/core/dbus-automount.h
src/core/dbus-cgroup.c
src/core/dbus-cgroup.h
src/core/dbus-device.c
src/core/dbus-execute.c
src/core/dbus-execute.h
src/core/dbus-job.c
src/core/dbus-job.h
src/core/dbus-kill.c
src/core/dbus-kill.h
src/core/dbus-manager.c
src/core/dbus-manager.h
src/core/dbus-mount.c
src/core/dbus-mount.h
src/core/dbus-path.h
src/core/dbus-scope.c
src/core/dbus-scope.h
src/core/dbus-service.c
src/core/dbus-service.h
src/core/dbus-slice.c
src/core/dbus-slice.h
src/core/dbus-socket.c
src/core/dbus-socket.h
src/core/dbus-swap.c
src/core/dbus-swap.h
src/core/dbus-target.c
src/core/dbus-timer.c
src/core/dbus-timer.h
src/core/dbus-unit.c
src/core/dbus-unit.h
src/core/dbus-util.c
src/core/dbus-util.h
src/core/dbus.c
src/core/dbus.h
src/core/device.c
src/core/device.h
src/core/dynamic-user.c
src/core/dynamic-user.h
src/core/efi-random.c
src/core/emergency-action.c
src/core/emergency-action.h
src/core/exec-credential.c
src/core/exec-credential.h
src/core/exec-invoke.c
src/core/exec-invoke.h
src/core/execute-serialize.c
src/core/execute-serialize.h
src/core/execute.c
src/core/execute.h
src/core/executor.c
src/core/fuzz-execute-serialize.c
src/core/fuzz-manager-serialize.c
src/core/fuzz-unit-file.c
src/core/generator-setup.c
src/core/generator-setup.h
src/core/ima-setup.c
src/core/import-creds.c
src/core/ipe-setup.c
src/core/job.c
src/core/job.h
src/core/kill.c
src/core/kill.h
src/core/kmod-setup.c
src/core/load-dropin.c
src/core/load-dropin.h
src/core/load-fragment-gperf.gperf.in
src/core/load-fragment.c
src/core/load-fragment.h
src/core/main.c
src/core/main.h
src/core/manager-dump.c
src/core/manager-dump.h
src/core/manager-serialize.c
src/core/manager-serialize.h
src/core/manager-varlink.c
src/core/manager-varlink.h
src/core/manager.c
src/core/manager.h
src/core/mount.c
src/core/mount.h
src/core/namespace.c
src/core/namespace.h
src/core/path.c
src/core/path.h
src/core/scope.c
src/core/scope.h
src/core/selinux-access.c
src/core/selinux-access.h
src/core/selinux-setup.c
src/core/selinux-setup.h
src/core/service.c
src/core/service.h
src/core/show-status.c
src/core/show-status.h
src/core/slice.c
src/core/slice.h
src/core/smack-setup.c
src/core/smack-setup.h
src/core/socket.c
src/core/socket.h
src/core/swap.c
src/core/swap.h
src/core/taint.c
src/core/target.c
src/core/target.h
src/core/timer.c
src/core/timer.h
src/core/transaction.c
src/core/transaction.h
src/core/unit-dependency-atom.c
src/core/unit-dependency-atom.h
src/core/unit-printf.c
src/core/unit-printf.h
src/core/unit-serialize.c
src/core/unit-serialize.h
src/core/unit.c
src/core/unit.h
src/core/varlink-common.h
src/core/varlink.c
src/core/varlink.h

index 9e8649d1e17cf9a2f4821c2f33c249e59380ee65..dd152d78022fda53dff28cdf88f0fbd6280d8b69 100644 (file)
@@ -1,15 +1,15 @@
 /* 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 */
index 2dbb63e603af69c12c84f1a9a247ce865c99a101..104335a75e103df389ec8fc8ede64ae65c047b92 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
@@ -10,7 +9,6 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "log.h"
-#include "macro.h"
 #include "string-util.h"
 #include "strv.h"
 
index 6150e7e43e563ae14da7dcf9f7e2bc3e6ecefc2c..928d67169af7582a06100f049f92bfe88669a471 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "audit-fd.h"
 #include "capability-util.h"
 #include "libaudit-util.h"
index 2fceb433a71a7fc5602591b37c6590eab5752dbf..55bd357c81f0f94285b7b297afebfbb34d4ae751 100644 (file)
@@ -1,5 +1,7 @@
 /* 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);
index c3f4b6b72c67f968f33ad129eeaa047afce89f38..e6b3dd09dba990faf0c9e0415d52baf70bb568d4 100644 (file)
@@ -1,21 +1,19 @@
 /* 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"
@@ -30,6 +28,7 @@
 #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"
index 6f2ca7657bc77cd394783ef628fe980400b79ce8..8dd70ad8b5e4652c8746489cc8202b15c9315a5c 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "core-forward.h"
 #include "unit.h"
 
 typedef enum AutomountResult {
index 4417ab58e94675e12c98d18c72a17654782b6edd..7e6a1d15a4e86a8cb0c1085839acef1eb8346eb9 100644 (file)
@@ -2,18 +2,20 @@
 
 #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
index a1d261548d89856ecd9be537795b762fa4d58f3c..aac7dfd8db0144bf49ace9decbce89853be1712b 100644 (file)
@@ -1,11 +1,7 @@
 /* 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(
index 428c0c97813760397f892e88d2b9048bedbe0367..cf9d826332e4cc439568f46e657217a02aa6f136 100644 (file)
@@ -1,27 +1,23 @@
 /* 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"
index 27cbdf857bc60c7aed10d7a5c143a33703d5c58f..4a47e70558b3bbfbd2e4234440e4d7ab03c51716 100644 (file)
@@ -1,10 +1,7 @@
 /* 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);
index 851cc424a2db3f63538831e17e00fbd7990cd2b5..b58cff8a0b4c568eff1afd3a0b7ccfd93d6d1ab8 100644 (file)
@@ -1,19 +1,20 @@
 /* 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,
index c97be7c72f44016327af632c220d147c6e994e54..831648cc653519a6db02a92a99a60c1ca792538a 100644 (file)
@@ -2,7 +2,7 @@
 
 #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
index 4e163717399d4ed2cb54b5ff8aeb17e81c67e78e..33e525c911aaa79752e566fd95c6ac59251ae36e 100644 (file)
@@ -1,27 +1,17 @@
 /* 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 */
index 8da12de7463b52f4dceb686417649b60fc7dac2e..dbc017e251782622d37c7c3c037659f11029f26f 100644 (file)
@@ -1,7 +1,7 @@
 /* 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,
@@ -9,11 +9,6 @@ typedef enum FilesystemParseFlags {
         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);
index e97682a19cd7b8e0c713210eb9f2d0e0047ef4a7..971772badef63884d5339f472fe9af993d2695e8 100644 (file)
@@ -1,8 +1,14 @@
 /* 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
index 80af1f3e5b8203ffa78576e6cc2f0ed77ebeb065..51d9de3a33f8b3cf93e64225aa9897422288e9b4 100644 (file)
@@ -1,9 +1,7 @@
 /* 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);
index ef5ff4f65a31892ec3fe3f51cd79048e568f8369..6838476d048335f7f8e29b47ab8eb134aa7b6c7a 100644 (file)
@@ -1,11 +1,10 @@
 /* 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
index 13a0fc15215365f107432ff2c72859a79d3ddbeb..511772b713c0b253438e791a83664c515063f320 100644 (file)
@@ -1,9 +1,7 @@
 /* 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);
 
index 504a64d231fb39959517e9db04bd865975d8e488..61a034641b324b2f3302f16d542ad767ed646dda 100644 (file)
@@ -1,7 +1,9 @@
 /* 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"
@@ -10,6 +12,7 @@
 #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
 
@@ -52,7 +61,7 @@
 /* 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);
 
index bdd4a2236bb12fbb8b29b75c5e70fa298a1617f7..501caa971c333a5f1c8d1c596c90f8514c78ccd3 100644 (file)
@@ -1,18 +1,11 @@
 /* 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.
@@ -29,15 +22,6 @@ static inline bool cgroup_tasks_max_isset(const CGroupTasksMax *tasks_max) {
 
 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. */
@@ -72,43 +56,43 @@ typedef enum CGroupDevicePermissions {
         _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 */
@@ -122,7 +106,7 @@ typedef enum CGroupPressureWatch {
 /* 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;
@@ -222,7 +206,7 @@ struct CGroupContext {
         /* 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 {
@@ -349,10 +333,6 @@ typedef struct CGroupRuntime {
         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);
index 402c7eee042c5242dacbf02a0daf70b1cbd968bd..84ffdc230ad32f502cd0784ca3cd2e78363f9f7f 100644 (file)
@@ -1,7 +1,7 @@
 /* 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);
diff --git a/src/core/core-forward.h b/src/core/core-forward.h
new file mode 100644 (file)
index 0000000..59be62c
--- /dev/null
@@ -0,0 +1,53 @@
+/* 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;
index 385a6cf641fcc429491d6ab94c720559ba3a1c8d..41826a1f3e06fc9331cf1ce3f6d472c9b0cd3d0f 100644 (file)
@@ -4,16 +4,18 @@
 
 #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"
 
index f156d23aa00b7d8c2a661b96f1ba9a9611279265..4fd185fa45ed4ca675dbc29b35fcf1b685948153 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum CrashAction {
         CRASH_FREEZE,
index cfceaecc043da16c16caf22b3655eb5628735d22..6e46d9b2779a311504783b0255171b59abd8cc5e 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index 326c440cf9f6b38a2c3393dd4c149105387c8c36..b8ca90bb21fee6d6dc5467d61c57537acfba7e58 100644 (file)
@@ -1,32 +1,26 @@
 /* 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);
index 21f33984857ac9a7bd493208e0be46bfdd977557..cd62979002b51a46e2d3b574a2fd76606cc6e1d8 100644 (file)
@@ -1,11 +1,9 @@
 /* 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[];
 
index b5e18d80a47632b9b143c7ca46df3a9b1aa3db95..c39dc87a575d4a543dba2ce3ccc6a445c4991ec1 100644 (file)
@@ -2,7 +2,6 @@
 
 #include "dbus-device.h"
 #include "device.h"
-#include "unit.h"
 
 const sd_bus_vtable bus_device_vtable[] = {
         SD_BUS_VTABLE_START(0),
index d0281cc236d29efba3d36863170745caa85819af..c0915f501a1d26acd6e7d381856b04d55f259d8d 100644 (file)
@@ -1,48 +1,46 @@
 /* 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"
 
index 4ad7dd27a9d0db0bbd121936d60769a53a6849d0..c3566bda56121ff5aa7423b7d0c3ad8f8d68d290 100644 (file)
@@ -1,11 +1,10 @@
 /* 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), \
index 7ebaec976b400afb153dc8e26bd6d08efa63f994..854d329c014e0541167c4a352220543d9ee94d2d 100644 (file)
@@ -4,15 +4,17 @@
 
 #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);
index 50957303de6aa0bbfca9256a12977a13ae449445..13ce4dca7588385a604d523065b213a1eac45574 100644 (file)
@@ -1,11 +1,9 @@
 /* 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;
index 19e439f79ee2f8d673002db6702ff9a3321dde35..12dea8fb3b07b68380066aafef0d4007867e782d 100644 (file)
@@ -5,6 +5,7 @@
 #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);
 
index 5a9028795ccede101d3159c90b562461cdc6e966..6afe40e58b2784adcf913c65d041f9c68f26e71d 100644 (file)
@@ -1,11 +1,9 @@
 /* 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[];
 
index 6cb3777097e44cf03ba0ae9b66a8c06a04ad962d..c79118f98a8f3b2e86d07572d12b48f227ff3f54 100644 (file)
@@ -1,8 +1,7 @@
 /* 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"
@@ -16,9 +15,9 @@
 #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"
index fcabca57c9c9683f1b4018b3ff8732054d58eb48..4dd6492255e0bfb28bb3fb054220ad4e185121ff 100644 (file)
@@ -3,9 +3,7 @@
 
 #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[];
index 6b30b90f7fb74c48f998a2aae91f45795b65be94..6c10e476b9c336d6c2ad18aebe90d1f5d6606145 100644 (file)
@@ -10,7 +10,6 @@
 #include "mount.h"
 #include "string-util.h"
 #include "unit.h"
-#include "utf8.h"
 
 static int property_get_what(
                 sd_bus *bus,
index 5a848d3104e12171791a9d52fa287f4c4107fe9a..2ea4c74f6240e5c332e4058e3ac077c2c5bf4784 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index b5018b0116dd0770937b88b871a9f042ac85699c..c30466dc72a941fc04f8513de9c25d13b5af6862 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index cf282462702a0f9d87955f5d3e5acdc21c439085..2d2f65a9665d7d5724612de43a7fe09b2fa25d1b 100644 (file)
@@ -4,15 +4,16 @@
 #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) {
index fb7467a0f5514b997d5ac81680f17a8852ccd9e7..017390ac5b60b4c948e086557538d58abe3507b9 100644 (file)
@@ -1,12 +1,9 @@
 /* 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[];
 
index 20ed478068d74f389e5a4b3718f6b92bfd022846..6c1866859d9248a6568ae7d11607443a76915cef 100644 (file)
@@ -1,32 +1,35 @@
 /* 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);
index aea6cf77f30a2bd2fe46c42493a3c79705709a81..3977a3af494b846ea68dc78c7cf64621ec1b1d05 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index d6b2b5f3b775c075b3139413d14ffc8c92d58bd3..e504665cce7b3c06a7e32aa5ce830cd454495941 100644 (file)
@@ -5,6 +5,7 @@
 #include "dbus-slice.h"
 #include "dbus-util.h"
 #include "slice.h"
+#include "string-util.h"
 #include "unit.h"
 
 static int property_get_currently_active(
index eb71916abdaf9f78c89e47cd0fb8a19eea8ea1d9..7a11379a2c269758feca0d1b8ed0f022b49a4964 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index 545bef5af51602ffe598f7f1860c13c2e36f1205..5781fb59f32d81cdd7dfd846f0fa05ee3b398e01 100644 (file)
@@ -9,12 +9,12 @@
 #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);
index f9f36a244851fa73e36b27f4f1494ee0eaa7699c..e638c39cf7d2b133e7caeb05ca54c44783a42f76 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index dbcc5a3621c56dc204dc06131db4c372d35afe4a..e733675f0f0c61d3380543368986a5c97c25b281 100644 (file)
@@ -7,7 +7,6 @@
 #include "dbus-cgroup.h"
 #include "dbus-execute.h"
 #include "dbus-swap.h"
-#include "string-util.h"
 #include "swap.h"
 #include "unit.h"
 
index 9d651b565420b5686243612cfb02bbc96fd9488c..485bf33e65040491e6d0ffea1c7189bebe12fc0a 100644 (file)
@@ -5,10 +5,9 @@
   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[];
 
index e979fb7267ef19033d63575f8e45bc0f98deebc1..26e7a5376ecf9db14a8a2b768f1c8b49f48a04a3 100644 (file)
@@ -1,7 +1,6 @@
 /* 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),
index b9d0c16acd87580b40043492a795323c73062b98..4c7d8cd80a21f60710877311ec4f1f25165febcd 100644 (file)
@@ -2,8 +2,10 @@
 
 #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"
index ac436f15aa848d1a24ef4446c4a994d39479d64e..52f2153cbc38224c260ec977e46f028bdee223a3 100644 (file)
@@ -1,10 +1,9 @@
 /* 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[];
 
index 4f45b7c34edfc65551036810384e8362f91057dc..8d8169df55e599ca28b08c3946ebffe1ca815019 100644 (file)
@@ -4,10 +4,8 @@
 
 #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);
index 9cf2cbf878d49662044fee2eff95dcd6bfe57943..9b879b11bebb71482630895510b412d619a0076b 100644 (file)
@@ -1,9 +1,9 @@
 /* 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[];
index b75783071348ebb568749143d04872360495bbf5..7db4434582a2e9d1288c329beb317dd8e5824fc2 100644 (file)
@@ -1,15 +1,14 @@
 /* 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(
@@ -120,7 +119,7 @@ int bus_set_transient_tristate(
         return 1;
 }
 
-int bus_set_transient_usec_internal(
+static int bus_set_transient_usec_internal(
                 Unit *u,
                 const char *name,
                 usec_t *p,
@@ -151,6 +150,14 @@ int bus_set_transient_usec_internal(
         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,
@@ -193,6 +200,15 @@ int bus_verify_manage_units_async_impl(
                         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);
index 471c64acb6552c42b6ab777c1110db07c3d110f5..f28a1ca7256649bbba786a4128535bd8eb743644 100644 (file)
@@ -3,7 +3,8 @@
 
 #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);
@@ -243,22 +244,11 @@ int bus_set_transient_reboot_parameter(Unit *u, const char *name, char **p, sd_b
 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);
index 0c3c124ce9689f8ded431b054236581c00f5a53c..cb167fa2c18fc3b2d7c745df58427ecfe69a7f5c 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <sys/epoll.h>
 #include <unistd.h>
 
 #include "sd-bus.h"
@@ -11,7 +9,7 @@
 #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
 
index a362a652af0caa7ccc832490f8c3d67921b2b0e0..03d94af36cd452af187fa871c4d9eda7bae1b98d 100644 (file)
@@ -1,11 +1,7 @@
 /* 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);
 
index 97124645711b7f58df85da1a2efe4180766284bc..8afca1236e89fd8e3873a1a76115cd8400de7fa4 100644 (file)
@@ -1,25 +1,23 @@
 /* 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"
index 6f42cfa93ab2304310fe14a5bf2a4633c26e0da9..9bcbece4296afce0782e94fa11829bc8827562ec 100644 (file)
@@ -1,6 +1,7 @@
 /* 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
index d21c709de738c35b5ed7c6ec0c6f75ae0bfe91fa..e69f6557a5ac064efe5d0c5838e97d20cf653fdb 100644 (file)
@@ -1,25 +1,27 @@
 /* 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"
 
index fe190cb864ecfa67c3bc4dc83c2bae54d427dd3a..0f923edfe91b3b0537111fa8964190c1eafc8194 100644 (file)
@@ -1,14 +1,7 @@
 /* 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
index 775f678e1c4d7e66480e1052f4f94100a3f04649..c10071782e2ac1378999de1efa80123d0f6c34a1 100644 (file)
@@ -1,17 +1,13 @@
 /* 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;
index 6752926bd9660b6c00ea8ad03bda0db11b33833e..cb460d0f03d265faa7c6e27ac7656d730ae11e33 100644 (file)
@@ -3,15 +3,13 @@
 #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] = {
index d0f1898a60d70a557f8553cc0d87f4afc2c815f6..f993a5f06e5d0113b1e326e0effde01034520aac 100644 (file)
@@ -1,12 +1,7 @@
 /* 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,
index 1608e4c9b07777775e902313a61389fd3dead2c0..9bc7540e5ea77fafb82ece53cee0e0c6b8d760f3 100644 (file)
@@ -4,9 +4,11 @@
 
 #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"
 
index 65c9a83b359ac9893ff299fabce791fa352169e5..c082d6d6f7e33023054c97db118a7c5f87488cdc 100644 (file)
@@ -1,14 +1,7 @@
 /* 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 {
index 8de8660b3252784dc3298bdcdefe2b81d6110c3c..b27358d8dc96c69dec18a33360caeb6cc9738970 100644 (file)
@@ -1,8 +1,11 @@
 /* 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>
@@ -10,7 +13,6 @@
 
 #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"
index a8a3ac6e56ea5bda8afc776e333378bf4a2c1bec..d8a2320ef407ed6c65790a9c65760751d01c0702 100644 (file)
@@ -1,11 +1,7 @@
 /* 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,
index 2a91a6fadb19cf6e7a7337b5397deb292dd20caa..4c10a81a04dee52a19c870b6ada585c29bf4a095 100644 (file)
@@ -3,23 +3,31 @@
 #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,
index 89c8e09edbd6b2a37818d7d45f00cdfea5780c0c..17b0159d1efeef71afb2cdb7896e75d3377d170b 100644 (file)
@@ -1,7 +1,7 @@
 /* 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. */
index d6fbde04e4c4e20a97bb6d874a6502eed8bf65f7..8d96109473038cff093e12a5cc617c76824a98d7 100644 (file)
@@ -1,20 +1,14 @@
 /* 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"
 
@@ -386,6 +376,16 @@ const char* exec_get_private_notify_socket_path(const ExecContext *context, cons
         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);
 
@@ -1995,6 +1995,27 @@ char** exec_context_get_restrict_filesystems(const ExecContext *c) {
 #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;
 
index 1bbaac3840c389a0d6718f9795e9229d50cc7d3a..5700e7febe5630fd00077a1c89850acdfa363850 100644 (file)
@@ -1,44 +1,21 @@
 /* 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 {
@@ -96,29 +73,29 @@ typedef enum ExecKeyringMode {
 } 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;
@@ -134,9 +111,9 @@ struct ExecSharedRuntime {
 
         /* 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;
 
@@ -147,7 +124,7 @@ struct ExecRuntime {
          * 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,
@@ -195,7 +172,7 @@ typedef enum ExecCleanMask {
 /* 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;
@@ -386,28 +363,7 @@ struct ExecContext {
         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,
@@ -431,7 +387,7 @@ typedef enum ExecFlags {
 
 /* 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;
@@ -486,7 +442,7 @@ struct ExecParameters {
         char invocation_id_string[SD_ID128_STRING_MAX];
 
         bool debug_invocation;
-};
+} ExecParameters;
 
 #define EXEC_PARAMETERS_INIT(_flags)              \
         (ExecParameters) {                        \
@@ -566,6 +522,9 @@ char** exec_context_get_syscall_archs(const ExecContext *c);
 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);
 
@@ -645,15 +604,7 @@ bool exec_is_cgroup_mount_read_only(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
index 3f1cf3fe43d3a0c2349a1f14a22d0ef53ec4b83a..68695986a31c47cdba866e0c501fcb8a30fe40bd 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <getopt.h>
-#include <unistd.h>
+#include <stdlib.h>
 
 #include "sd-messages.h"
 
@@ -20,6 +20,7 @@
 #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"
index 48ddea10d7d56acb009d79494d69061b64104164..a0875dc35ab84b6ae4a61bdf6741216ee95a8618 100644 (file)
  */
 
 #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);
index ca155fd15a40fc531a27c82bdbca8afff35023cd..dc3d3588b561b15f5f3c8c930b497e3696530a2e 100644 (file)
@@ -2,12 +2,11 @@
 
 #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;
index d8987c9648d2654e57e2b99c38d85f4c21086627..3e7941f8b495dfd3988b964f4e832c22a7cd9774 100644 (file)
@@ -3,7 +3,6 @@
 #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"
index 7510fc3c610ab2e84fd344afad371f198aea1cf9..d63a393d985d1b3e5cd35148a1bccb4650bd0688 100644 (file)
@@ -4,8 +4,8 @@
 
 #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) {
index 1cc816b3f539b791416a79336b1f4b49626caf6f..57468231535aa809a1b53424a39c27c17020ba88 100644 (file)
@@ -1,7 +1,7 @@
 /* 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);
index 37916bb474a396d1d200b107c9e2975ed2d70dda..bdd37a650ca7eaf70467f8a941e29db98a536133 100644 (file)
@@ -4,10 +4,7 @@
                                    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"
index 2603eab1d97ab8ac07290f7c01182d45c739d569..e146faab91eb3a15bf6602ae2bc396463c13a12e 100644 (file)
@@ -1,10 +1,12 @@
 /* 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"
@@ -13,6 +15,7 @@
 #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"
@@ -21,6 +24,8 @@
 #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"
 
index 7bf4f52d04781179d69d8da26640d8bbaa9c7b74..b266a9274ebb52f48163c053e02dd1a2270aff28 100644 (file)
@@ -10,7 +10,6 @@
 #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"
index c335bb1cf78fa6698b5029c9e6a7990cb920b8d1..a60025cffc35c0b83903d05827078d67bbcafe9e 100644 (file)
@@ -1,32 +1,28 @@
 /* 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"
 
index 3c1e861bbc1694b9fe383fab8ff522872167fa29..d8be0b652eb1bfbe0b6a93cad9d61e3cef3f2d85 100644 (file)
@@ -1,24 +1,8 @@
 /* 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 {
@@ -65,14 +49,14 @@ 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 */
@@ -88,9 +72,9 @@ enum JobResult {
         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;
@@ -101,9 +85,9 @@ struct JobDependency {
 
         bool matters:1;
         bool conflicts:1;
-};
+} JobDependency;
 
-struct Job {
+typedef struct Job {
         Manager *manager;
         Unit *unit;
 
@@ -158,7 +142,7 @@ struct Job {
         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);
index 74b1b13a8d86d791218baed9b2ac5f2c482b0a92..07f6ecc97e91a7d5c2b88817a482e52465cf7a19 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdio.h>
+
 #include "kill.h"
 #include "signal-util.h"
 #include "string-table.h"
index ffa2280e609cd85a6d39eff0756df9bf5dd8e8e4..fff6e2c2ebeb95cea7e089664c8fb6f9c0f4a093 100644 (file)
@@ -1,11 +1,7 @@
 /* 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. */
index a9a969337d8feba7fceec455e99aefbc1a097fd9..12ce5a86e4a84bed51fe84601e6460b1c7858f8b 100644 (file)
@@ -3,13 +3,11 @@
 #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"
index a84ecb9910b4a5a19294e921227d58d5f85cc15e..a295d7f343ba72581824eb2f0cf5ace86e17f26a 100644 (file)
@@ -8,7 +8,6 @@
 #include "log.h"
 #include "manager.h"
 #include "stat-util.h"
-#include "string-util.h"
 #include "strv.h"
 #include "unit.h"
 #include "unit-name.h"
index 864ea4f0837a4763cd1772868ea3f911bc4f148c..308683b472f28f18b96d82b27257b94df8cc6fee 100644 (file)
@@ -1,9 +1,7 @@
 /* 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 */
 
index aeccf07d55b12451a6ab5c15493fd2e6475663d6..1bd7c950fcae6c23328c9258bb58965e54f5accb 100644 (file)
@@ -275,6 +275,7 @@ _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
 #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"
index 79eb1757d0eab10cf3a62850cc22044a6aa0beb8..aae9cb1d2ab8f735e9a2d48eccb3a358ad625511 100644 (file)
@@ -3,40 +3,37 @@
   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"
@@ -60,6 +59,8 @@
 #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"
@@ -71,8 +72,6 @@
 #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) {
index 6aa8f479f5dcbf5c6c30a8171b859476b9bcde33..1d595a043bcf87f9cc367ef05ca4a769f4192642 100644 (file)
@@ -1,9 +1,7 @@
 /* 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);
index cb846367c2f91faccd620c34a11c2b96e9af5a93..640e26925ea02d3f961dbe2af47618a73b16e032 100644 (file)
@@ -1,13 +1,14 @@
 /* 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"
@@ -80,7 +78,6 @@
 #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"
@@ -88,6 +85,7 @@
 #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"
@@ -99,6 +97,7 @@
 #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"
index f637cbad7aa37a86a916a0dd1286ac2f0ba60992..a871d573fd2ed2575cfd805da53bd3dcecded356 100644 (file)
@@ -1,8 +1,7 @@
 /* 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;
index e781d1912980fe898049c3e8db692badaf5d8606..02275bb7ec51c214bed97d069f15dc2c8ee9fd19 100644 (file)
@@ -1,14 +1,17 @@
 /* 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"
 
index a02c29ad686d1bfd37a28b95d99817725ec64a86..a6dca29711fed6e902c0a501de97d3ac2da678b9 100644 (file)
@@ -1,9 +1,7 @@
 /* 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);
index e0199a3727d23d9f47d1ceaaef2c54041b77306d..057ca9ad49efcfa70d50b1c3eb122af0eba8a26b 100644 (file)
@@ -1,19 +1,21 @@
 /* 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"
index 7d4e8effb28a601e47a3d1ccc51eff65d37c734d..e335c6ec331e913426d66039cc95f0444badeed8 100644 (file)
@@ -1,12 +1,7 @@
 /* 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)
 
index c38c4b1947d316b53a7d67efbe3734d2fe03619c..8986ef8dbe274fb42a40178bf803577242c52faf 100644 (file)
@@ -2,11 +2,17 @@
 
 #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"
index 52be44502b470cd3b47d2369adcb7885365bce29..f7396e12644aa1f85c701fcfc6fa21614eb8c2af 100644 (file)
@@ -1,7 +1,6 @@
 /* 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);
index 5b3d41596bbbc94cd77776937c0b628d7e710d71..893ef7677beec8acde6a66bcc91671080715337b 100644 (file)
@@ -1,14 +1,11 @@
 /* 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"
@@ -45,7 +41,9 @@
 #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"
@@ -79,6 +75,7 @@
 #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"
@@ -93,7 +90,6 @@
 #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"
@@ -866,6 +862,10 @@ static int compare_job_priority(const void *a, const void *b) {
         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;
@@ -2154,6 +2154,17 @@ int manager_add_job_full(
         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;
index 31b4b59c0bc5e434aebf666f3baf1d94b3172648..ebb50af5a12ab47e02a38fce6a010bae927e908b 100644 (file)
@@ -1,30 +1,15 @@
 /* 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;
 
@@ -39,8 +24,6 @@ enum {
 
 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 {
@@ -169,7 +152,7 @@ typedef struct UnitDefaults {
         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. */
@@ -495,7 +478,7 @@ struct Manager {
 
         /* 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);
@@ -516,9 +499,7 @@ static inline usec_t manager_default_timeout_abort_usec(Manager *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);
@@ -546,15 +527,14 @@ int manager_add_job_full(
                 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);
index d7211de024962e12d429608b4a05fcb3c88f490a..8797dcce180b6a6e7f06af9b047e77a21f8152fe 100644 (file)
@@ -1,9 +1,9 @@
 /* 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"
@@ -30,6 +32,7 @@
 #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"
index c754ae7933a6f70bbd923bf6499e0aa40fdb5ff2..9aaef8dd39101ede5a43131c49c3d84e981f7d2b 100644 (file)
@@ -1,6 +1,9 @@
 /* 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"
index b21a8d25e1303131102d323b0732fa5cc46f264d..8ced4ead2e8325e9b8748c6dec5edddf0656f039 100644 (file)
@@ -1,9 +1,9 @@
 /* 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"
@@ -26,7 +28,6 @@
 #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"
@@ -3180,6 +3181,13 @@ static int setup_one_tmp_dir(const char *id, const char *prefix, char **path, ch
         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;
index ced0a87e14554a13b937ac3f3ccef7a2e6190799..eadd991ed2a135c6f1af9e70f1dda672a9f04b64 100644 (file)
@@ -5,20 +5,9 @@
   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,
@@ -95,7 +84,7 @@ typedef enum PrivatePIDs {
         _PRIVATE_PIDS_INVALID = -EINVAL,
 } PrivatePIDs;
 
-struct BindMount {
+typedef struct BindMount {
         char *source;
         char *destination;
         bool read_only;
@@ -107,12 +96,12 @@ struct BindMount {
         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,
@@ -121,15 +110,15 @@ typedef enum MountImageType {
         _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;
@@ -202,18 +191,13 @@ struct NamespaceParameters {
         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(
index d62a83cc94906b80972e5dffe3eb4e93176d779d..315e395ee6f935fbceec04c00f40d68a30de81a9 100644 (file)
@@ -1,21 +1,19 @@
 /* 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"
@@ -25,8 +23,8 @@
 #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,
index 8a3b8b35924d28cdb9e30f50aaf8be229cc8d41f..b99e1826a546fab5ac2eebdfc7b3b699ecc3c344 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "core-forward.h"
 #include "unit.h"
 
 typedef enum PathType {
index 174a95c6496cd3b2a1d27ddc7faae404a2873292..cf70de573c76285a6c98131151d17b1f25ea7fcf 100644 (file)
@@ -1,27 +1,26 @@
 /* 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] = {
index 27f2c83b232991f48c739b8cc82ad002950f4359..0654197094998796cda34672c681c923509d9ba7 100644 (file)
@@ -2,6 +2,7 @@
 #pragma once
 
 #include "cgroup.h"
+#include "core-forward.h"
 #include "kill.h"
 #include "unit.h"
 
index 189bded2800296d3c109bee967baa1d6579686f2..9798569cf093734557cbcb04e56d8ad5f18de5a2 100644 (file)
@@ -4,7 +4,6 @@
 
 #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;
 
@@ -172,8 +171,7 @@ static int access_init(sd_bus_error *error) {
 */
 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) {
@@ -217,9 +215,9 @@ int mac_selinux_access_check_internal(
         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 */
@@ -248,7 +246,7 @@ int mac_selinux_access_check_internal(
 
         struct audit_info audit_info = {
                 .creds = creds,
-                .path = unit_path,
+                .path = unit ? unit->fragment_path : NULL,
                 .cmdline = cl,
                 .function = function,
         };
@@ -263,7 +261,7 @@ int mac_selinux_access_check_internal(
 
         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;
 }
 
@@ -271,8 +269,7 @@ int mac_selinux_access_check_internal(
 
 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) {
index dc8da9e97bde56af842f40820d8f84d1cd22e620..9c319f20ac65ed96cbfe46717748e28b89827ba6 100644 (file)
@@ -1,14 +1,12 @@
 /* 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))
index 6a08782ae8cb40a751c52d4ef901339bb103ff0f..a24af6d1c28440a15cae5967b426ee88261b6741 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdio.h>
 #include <unistd.h>
 
 #if HAVE_SELINUX
@@ -13,7 +11,6 @@
 #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"
index cdff51d747bbdb1346d552f12c75e038c5b19d4c..99c05650d06474e6db1df16b4fd2959b43d42596 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 int mac_selinux_setup(bool *loaded_policy);
index cab27384abe3f0a091c39a0d81b3775e0b111982..d5874ce39383c2f8705e850c3d9e71c94e46075a 100644 (file)
@@ -1,35 +1,34 @@
 /* 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"
index a542c0fb111da8b5aa3703e6ffb6b75da6d5c202..c81b5b7637f81c05450823628b84e83482c76a5d 100644 (file)
@@ -1,18 +1,13 @@
 /* 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,
@@ -116,7 +111,7 @@ typedef struct ServiceExtraFD {
         char *fdname;
 } ServiceExtraFD;
 
-struct Service {
+typedef struct Service {
         Unit meta;
 
         ServiceType type;
@@ -245,7 +240,7 @@ struct Service {
 
         /* 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);
index 9519fb1b84e4c5aa11b0caf8ff9e7263420fbb30..8ba1ae11d3fe9a825ac5a35441cfb47880730b8f 100644 (file)
@@ -1,8 +1,6 @@
 /* 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"
index 1986985c210775df03bba118f5481e1923719f63..38c23e6a24d647befb7cd57ff8e2d4baf20229b7 100644 (file)
@@ -1,11 +1,7 @@
 /* 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 */
 
index 361ef84a38be89227061850a04c513562440e0de..0ace5577b684fa3fd65957284d65b07f70fcdc70 100644 (file)
@@ -1,11 +1,10 @@
 /* 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"
index 46faecc0307acf6dc46679f1cf703d35b2826cfa..2f83973b8855c5620d3387b862c2e9885b31fe4d 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "cgroup.h"
+#include "core-forward.h"
 #include "unit.h"
 
 typedef struct Slice {
index 6d8acc0984fc3e7de77d80318cae021f1c281763..72927eb941cc50ea4b5a5d53dd0b1b55056c38c5 100644 (file)
@@ -5,10 +5,8 @@
         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"
@@ -18,7 +16,6 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "log.h"
-#include "macro.h"
 #include "smack-setup.h"
 #include "string-util.h"
 
index 6758f07cef9b829cfb278212698b864a827a5245..4b7da569ca6ab06ffa6fe8571643aa733d70fcc5 100644 (file)
@@ -7,6 +7,6 @@
         Nathaniel Chen <nathaniel.chen@intel.com>
 ***/
 
-#include <stdbool.h>
+#include "forward.h"
 
 int mac_smack_setup(bool *loaded_policy);
index 1ce6bc1ba60e608440407037c38537c6aeeb78df..f848e46d84a9e5840180025d31beaca3d5e532c8 100644 (file)
@@ -1,35 +1,37 @@
 /* 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"
@@ -38,7 +40,8 @@
 #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,
index 240a9ac9658e5450a4f67594f37c93ff1d4b7339..696e0490c13ca9eb0e7780368ea8ce543e1773b9 100644 (file)
@@ -1,13 +1,14 @@
 /* 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,
@@ -65,7 +66,7 @@ typedef enum SocketTimestamping {
         _SOCKET_TIMESTAMPING_INVALID = -EINVAL,
 } SocketTimestamping;
 
-struct Socket {
+typedef struct Socket {
         Unit meta;
 
         LIST_HEAD(SocketPort, ports);
@@ -161,7 +162,7 @@ struct Socket {
 
         RateLimit trigger_limit;
         RateLimit poll_limit;
-};
+} Socket;
 
 SocketPeer *socket_peer_ref(SocketPeer *p);
 SocketPeer *socket_peer_unref(SocketPeer *p);
index 668e1bcf6cb8b31d29231d66cfa904a738bc3193..27ac10e36d48d2298d45a149b87e1c307561c4e5 100644 (file)
@@ -1,7 +1,6 @@
 /* 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"
index fce7ea5e56affec5c3bbb2833e80758da9ca976d..946a2ac55fb575df486fd2e7990fbfacaaa138e7 100644 (file)
@@ -5,8 +5,9 @@
   Copyright Â© 2010 Maarten Lankhorst
 ***/
 
-#include "sd-device.h"
-
+#include "cgroup.h"
+#include "core-forward.h"
+#include "execute.h"
 #include "pidref.h"
 #include "unit.h"
 
index a6b220455c6992c5716df4841024317ab6c1eeda..8872a224b256d82e0a64f109d4a3b33e246ea10e 100644 (file)
@@ -3,8 +3,8 @@
 #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"
index f095aa199247466ae5463ec0f1dc761ed8ac4f7e..880f858481923d421ae21c3191f7ffbc3be2d151 100644 (file)
@@ -1,14 +1,13 @@
 /* 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,
index 9e7c77c027eab78130dc0a6452ce6dedf8a87f99..a6ed994faf4a018449c3f551c383ed75ee68b433 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "core-forward.h"
 #include "unit.h"
 
 typedef struct Target {
index e4d831fd9bea6f6d2cfdc5017fa242f8b7e1678f..5410cd761577efcc1afb5550626481ba4c29a90d 100644 (file)
@@ -1,26 +1,27 @@
 /* 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"
 
index 90f19a7cf4e1319d3c87ba3f4ef4003cbe253f37..759e924f3a786d171b139be494d1352a9b9cc1c7 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "calendarspec.h"
+#include "core-forward.h"
 #include "unit.h"
 
 typedef enum TimerBase {
index 6d0d7e73beff0bb959df65edf293c73d861a661d..b451c906da3b63e1c0cbd014e05eec0955625d9a 100644 (file)
@@ -1,7 +1,6 @@
 /* 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"
@@ -9,9 +8,10 @@
 #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);
index 1f58fcebccf8570ad9ede2dc8ae3fb621e90e400..4f5430d6d4a7c8dd49aede7edd21c135bd025800 100644 (file)
@@ -1,8 +1,7 @@
 /* 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 */
index 06def183b97e400ea86c9d63b8b70d3ba4a70036..a421fbc1de5bca211b2a77fd7340bbd5f496f8d0 100644 (file)
@@ -1,6 +1,6 @@
 /* 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] = {
index 89a3eae1bf0ca5ff9281fe6997e4e7b95bc0b7bf..36ea729f5c61b96dbcfd266947898a93b0e654f9 100644 (file)
@@ -1,9 +1,7 @@
 /* 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. */
index 5bce46b625740e07cf385b01bb2d8df2b6cf5f23..2b35a1b2a9263cba2798e948299523d8ec240e99 100644 (file)
@@ -3,17 +3,16 @@
 #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);
@@ -254,3 +253,23 @@ int unit_full_printf_full(const Unit *u, const char *format, size_t max_length,
 
         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);
+}
index 2df07db26d3acc7f6736647ee306fc260ef2b835..aa9ba004945e23e3aeaefc154a7784b3627d2b55 100644 (file)
@@ -1,26 +1,12 @@
 /* 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);
index a38b38590a84dc507845fdf24c67ff5a9f2c5d77..76363e3023946861e364b9ffe543500e920a9578 100644 (file)
@@ -1,15 +1,21 @@
 /* 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"
@@ -677,7 +683,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                         "%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);
         }
 
index a7ac03cf823580dbdc5924150a704358bc0bd313..8f12c8c991b918821a707492c7bc69fb048d630b 100644 (file)
@@ -1,12 +1,7 @@
 /* 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. */
index 3845d7c39facafa1b9fa9e134e5ad0a5c4a67e2e..bb30d704cf26288d8680073816dab2805ba00dd3 100644 (file)
@@ -1,11 +1,10 @@
 /* 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"
@@ -32,6 +30,7 @@
 #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"
@@ -40,8 +39,9 @@
 #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)
@@ -6068,6 +6063,24 @@ int unit_pid_attachable(Unit *u, PidRef *pid, sd_bus_error *error) {
         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);
 
index cb6f6e070c1b1df7d5f05075f78262a80e5f034b..f3a44fd1a11b66b95efcb7bc944f245222bdfb5c 100644 (file)
@@ -1,29 +1,24 @@
 /* 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,
@@ -217,14 +212,14 @@ static inline void* UNIT_DEPENDENCY_TO_PTR(UnitDependency d) {
         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 {
@@ -1018,23 +1013,9 @@ static inline bool unit_has_job_type(Unit *u, JobType type) {
         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. */
index 94a8682a218d65c5be4526edab2ebd148d44afcc..5456bfced6bd78fbbf314345829fc2bb06e8aabf 100644 (file)
@@ -2,7 +2,6 @@
 #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);
index 40b988aec51acaa6d4ef58f47abe6854b9a7cba3..2e9be69c5e99247e3fe839f03bea4c2acdfaab18 100644 (file)
@@ -2,17 +2,19 @@
 
 #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"
index e4996f01ada3cc2942a81309078cfcebae493d49..72e6a2b130d5fe502f42041145668f52d6281b81 100644 (file)
@@ -1,8 +1,7 @@
 /* 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);