Remove more circular header dependencies (#37185)
Continuation of https://github.com/systemd/systemd/pull/37112
This commit is contained in:
@@ -61,7 +61,6 @@ static int parse_condition(Unit *u, const char *line) {
|
||||
_printf_(7, 8)
|
||||
static int log_helper(void *userdata, int level, int error, const char *file, int line, const char *func, const char *format, ...) {
|
||||
Unit *u = ASSERT_PTR(userdata);
|
||||
Manager *m = ASSERT_PTR(u->manager);
|
||||
va_list ap;
|
||||
int r;
|
||||
|
||||
@@ -70,7 +69,7 @@ static int log_helper(void *userdata, int level, int error, const char *file, in
|
||||
|
||||
va_start(ap, format);
|
||||
r = log_object_internalv(level, error, file, line, func,
|
||||
/* object_field = */ m->unit_log_field,
|
||||
/* object_field = */ unit_log_field(u),
|
||||
/* object = */ u->id,
|
||||
/* extra_field = */ NULL,
|
||||
/* extra = */ NULL,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "analyze-image-policy.h"
|
||||
#include "analyze.h"
|
||||
#include "format-table.h"
|
||||
#include "image-policy.h"
|
||||
#include "terminal-util.h"
|
||||
|
||||
static int table_add_designator_line(Table *table, PartitionDesignator d, PartitionPolicyFlags f) {
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "format-table.h"
|
||||
#include "glob-util.h"
|
||||
#include "hashmap.h"
|
||||
#include "image-policy.h"
|
||||
#include "locale-util.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
struct iovec_wrapper {
|
||||
struct iovec *iovec;
|
||||
|
||||
@@ -7,20 +7,25 @@
|
||||
# include <libaudit.h>
|
||||
#endif
|
||||
|
||||
/* We use _Static_assert() directly here instead of assert_cc()
|
||||
* because if we include macro.h in this header, the invocation
|
||||
* of generate-audit_type-list.sh becomes more complex.
|
||||
*/
|
||||
|
||||
#ifndef AUDIT_SERVICE_START
|
||||
# define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
|
||||
#else
|
||||
assert_cc(AUDIT_SERVICE_START == 1130);
|
||||
_Static_assert(AUDIT_SERVICE_START == 1130, "");
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_SERVICE_STOP
|
||||
# define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
|
||||
#else
|
||||
assert_cc(AUDIT_SERVICE_STOP == 1131);
|
||||
_Static_assert(AUDIT_SERVICE_STOP == 1131, "");
|
||||
#endif
|
||||
|
||||
#ifndef MAX_AUDIT_MESSAGE_LENGTH
|
||||
# define MAX_AUDIT_MESSAGE_LENGTH 8970
|
||||
#else
|
||||
assert_cc(MAX_AUDIT_MESSAGE_LENGTH == 8970);
|
||||
_Static_assert(MAX_AUDIT_MESSAGE_LENGTH == 8970, "");
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* This is currently not exported in the public kernel headers, but the libxfs library code part of xfsprogs
|
||||
* defines it as public header */
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* For details about the file format see RFC:
|
||||
* https://www.ietf.org/id/draft-tuexen-opsawg-pcapng-03.html
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "assert-util.h"
|
||||
|
||||
static inline pthread_mutex_t* pthread_mutex_lock_assert(pthread_mutex_t *mutex) {
|
||||
assert_se(pthread_mutex_lock(mutex) == 0);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* glibc defines the reboot() API call, which is a wrapper around the system call of the same name, but without the
|
||||
* extra "arg" parameter. Since we need that parameter for some calls, let's add a "raw" wrapper that is defined the
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
struct strbuf {
|
||||
char *buf;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "macro.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
/* The container base should have the last 16 bit set to zero */
|
||||
assert_cc((CONTAINER_UID_BASE_MIN & 0xFFFFU) == 0);
|
||||
assert_cc((CONTAINER_UID_BASE_MAX & 0xFFFFU) == 0);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
typedef struct UIDRangeEntry {
|
||||
uid_t start, nr;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "efi.h"
|
||||
|
||||
char16_t *disk_get_url(EFI_HANDLE *handle);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "automount.h"
|
||||
#include "device.h"
|
||||
#include "mount.h"
|
||||
#include "path.h"
|
||||
#include "scope.h"
|
||||
#include "service.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "io-util.h"
|
||||
#include "label-util.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "manager.h"
|
||||
#include "mount-util.h"
|
||||
#include "mount.h"
|
||||
#include "mountpoint-util.h"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Automount Automount;
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
typedef enum AutomountResult {
|
||||
@@ -15,7 +13,7 @@ typedef enum AutomountResult {
|
||||
_AUTOMOUNT_RESULT_INVALID = -EINVAL,
|
||||
} AutomountResult;
|
||||
|
||||
struct Automount {
|
||||
typedef struct Automount {
|
||||
Unit meta;
|
||||
|
||||
AutomountState state, deserialized_state;
|
||||
@@ -35,7 +33,7 @@ struct Automount {
|
||||
sd_event_source *expire_event_source;
|
||||
|
||||
AutomountResult result;
|
||||
};
|
||||
} Automount;
|
||||
|
||||
extern const UnitVTable automount_vtable;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "bpf-program.h"
|
||||
#include "fd-util.h"
|
||||
#include "in-addr-prefix-util.h"
|
||||
#include "manager.h"
|
||||
#include "memory-util.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "unit.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "bpf-restrict-ifaces.h"
|
||||
#include "netlink-util.h"
|
||||
#include "unit.h"
|
||||
|
||||
#if BPF_FRAMEWORK
|
||||
/* libbpf, clang and llc compile time dependencies are satisfied */
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fdset.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Unit Unit;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "fd-util.h"
|
||||
#include "bpf-socket-bind.h"
|
||||
#include "unit.h"
|
||||
|
||||
#if BPF_FRAMEWORK
|
||||
/* libbpf, clang, llvm and bpftool compile time dependencies are satisfied */
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "fdset.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Unit Unit;
|
||||
|
||||
int bpf_socket_bind_supported(void);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "io-util.h"
|
||||
#include "ip-protocol-list.h"
|
||||
#include "limits-util.h"
|
||||
#include "manager.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "core-varlink.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "json-util.h"
|
||||
#include "manager.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "strv.h"
|
||||
#include "unit.h"
|
||||
#include "user-util.h"
|
||||
#include "varlink-internal.h"
|
||||
#include "varlink-io.systemd.UserDatabase.h"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "manager.h"
|
||||
typedef struct Manager Manager;
|
||||
typedef struct Unit Unit;
|
||||
|
||||
int manager_setup_varlink_server(Manager *m);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#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"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#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"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "sd-bus-vtable.h"
|
||||
|
||||
#include "execute.h"
|
||||
#include "unit.h"
|
||||
|
||||
#define BUS_EXEC_STATUS_VTABLE(prefix, offset, flags) \
|
||||
BUS_PROPERTY_DUAL_TIMESTAMP(prefix "StartTimestamp", (offset) + offsetof(ExecStatus, start_timestamp), flags), \
|
||||
|
||||
+2
-1
@@ -3,9 +3,10 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "unit.h"
|
||||
#include "bus-object.h"
|
||||
|
||||
typedef struct Job Job;
|
||||
|
||||
extern const sd_bus_vtable bus_job_vtable[];
|
||||
extern const BusObjectImplementation job_object;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "dbus-unit.h"
|
||||
#include "dbus-util.h"
|
||||
#include "dbus.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "env-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "sd-bus-vtable.h"
|
||||
|
||||
#include "manager.h"
|
||||
#include "time-util.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
extern const sd_bus_vtable bus_manager_vtable[];
|
||||
extern const sd_bus_vtable bus_manager_log_control_vtable[];
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
#include "sd-bus.h"
|
||||
#include "sd-bus-vtable.h"
|
||||
|
||||
#include "scope.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Scope Scope;
|
||||
|
||||
extern const sd_bus_vtable bus_scope_vtable[];
|
||||
|
||||
int bus_scope_set_property(Unit *u, const char *name, sd_bus_message *i, UnitWriteFlags flags, sd_bus_error *error);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "bus-util.h"
|
||||
#include "dbus-util.h"
|
||||
#include "escape.h"
|
||||
#include "manager.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "reboot-util.h"
|
||||
|
||||
+3
-1
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "manager.h"
|
||||
#include "fdset.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
void bus_send_pending_reload_message(Manager *m);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "device-util.h"
|
||||
#include "device.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "ratelimit.h"
|
||||
|
||||
+2
-4
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Device Device;
|
||||
|
||||
/* A mask specifying where we have seen the device currently. This is a bitmask because the device might show up
|
||||
* asynchronously from each other at various places. For example, in very common case a device might already be mounted
|
||||
* before udev finished probing it (think: a script setting up a loopback block device, formatting it and mounting it
|
||||
@@ -17,7 +15,7 @@ typedef enum DeviceFound {
|
||||
_DEVICE_FOUND_MASK = DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP,
|
||||
} DeviceFound;
|
||||
|
||||
struct Device {
|
||||
typedef struct Device {
|
||||
Unit meta;
|
||||
|
||||
char *sysfs, *deserialized_sysfs;
|
||||
@@ -36,7 +34,7 @@ struct Device {
|
||||
|
||||
/* The SYSTEMD_WANTS udev property for this device the last time we saw it */
|
||||
char **wants_property;
|
||||
};
|
||||
} Device;
|
||||
|
||||
extern const UnitVTable device_vtable;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "fs-util.h"
|
||||
#include "iovec-util.h"
|
||||
#include "lock-util.h"
|
||||
#include "manager.h"
|
||||
#include "parse-util.h"
|
||||
#include "random-util.h"
|
||||
#include "serialize.h"
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
/* 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 DynamicUser DynamicUser;
|
||||
typedef struct Manager Manager;
|
||||
|
||||
typedef struct DynamicCreds {
|
||||
/* A combination of a dynamic user and group */
|
||||
@@ -9,8 +17,6 @@ typedef struct DynamicCreds {
|
||||
DynamicUser *group;
|
||||
} DynamicCreds;
|
||||
|
||||
#include "manager.h"
|
||||
|
||||
/* Note that this object always allocates a pair of user and group under the same name, even if one of them isn't
|
||||
* used. This means, if you want to allocate a group and user pair, and they might have two different names, then you
|
||||
* need to allocated two of these objects. DynamicCreds below makes that easy. */
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#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"
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "runtime-scope.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
typedef enum EmergencyAction {
|
||||
EMERGENCY_ACTION_NONE,
|
||||
EMERGENCY_ACTION_EXIT,
|
||||
@@ -34,9 +37,6 @@ typedef enum EmergencyActionFlags {
|
||||
_EMERGENCY_ACTION_FLAGS_MAX = (1 << 3) - 1,
|
||||
} EmergencyActionFlags;
|
||||
|
||||
#include "macro.h"
|
||||
#include "manager.h"
|
||||
|
||||
void emergency_action(
|
||||
Manager *m,
|
||||
EmergencyAction action,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "io-util.h"
|
||||
#include "iovec-util.h"
|
||||
#include "label-util.h"
|
||||
#include "log.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "mount-util.h"
|
||||
#include "mountpoint-util.h"
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
#include "bpf-restrict-fs.h"
|
||||
#include "btrfs-util.h"
|
||||
#include "capability-util.h"
|
||||
#include "cgroup.h"
|
||||
#include "cgroup-setup.h"
|
||||
#include "chase.h"
|
||||
#include "chattr-util.h"
|
||||
#include "chown-recursive.h"
|
||||
#include "copy.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "exec-credential.h"
|
||||
@@ -38,14 +40,17 @@
|
||||
#include "fd-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 "memfd-util.h"
|
||||
#include "missing_sched.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "mount-util.h"
|
||||
#include "osc-context.h"
|
||||
#include "proc-cmdline.h"
|
||||
#include "process-util.h"
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include "af-list.h"
|
||||
#include "capability-util.h"
|
||||
#include "cgroup.h"
|
||||
#include "cgroup-setup.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "escape.h"
|
||||
#include "exec-credential.h"
|
||||
#include "execute-serialize.h"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "cgroup-setup.h"
|
||||
#include "constants.h"
|
||||
#include "cpu-set-util.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "env-file.h"
|
||||
#include "env-util.h"
|
||||
#include "errno-list.h"
|
||||
|
||||
+13
-12
@@ -1,19 +1,11 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct ExecStatus ExecStatus;
|
||||
typedef struct ExecCommand ExecCommand;
|
||||
typedef struct ExecContext ExecContext;
|
||||
typedef struct ExecSharedRuntime ExecSharedRuntime;
|
||||
typedef struct DynamicCreds DynamicCreds;
|
||||
typedef struct ExecRuntime ExecRuntime;
|
||||
typedef struct ExecParameters ExecParameters;
|
||||
typedef struct Manager Manager;
|
||||
|
||||
#include <sched.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/capability.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "bus-unit-util.h"
|
||||
#include "cgroup-util.h"
|
||||
@@ -22,6 +14,7 @@ typedef struct Manager Manager;
|
||||
#include "exec-util.h"
|
||||
#include "fdset.h"
|
||||
#include "list.h"
|
||||
#include "log-context.h"
|
||||
#include "namespace.h"
|
||||
#include "nsflags.h"
|
||||
#include "numa-util.h"
|
||||
@@ -34,6 +27,17 @@ typedef struct Manager Manager;
|
||||
#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 {
|
||||
@@ -494,9 +498,6 @@ struct ExecParameters {
|
||||
.pidref_transport_fd = -EBADF, \
|
||||
}
|
||||
|
||||
#include "unit.h"
|
||||
#include "dynamic-user.h"
|
||||
|
||||
int exec_spawn(
|
||||
Unit *unit,
|
||||
ExecCommand *command,
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "argv-util.h"
|
||||
#include "build.h"
|
||||
#include "capability-util.h"
|
||||
#include "cgroup.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "exec-invoke.h"
|
||||
#include "execute-serialize.h"
|
||||
#include "execute.h"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "execute-serialize.h"
|
||||
#include "fd-util.h"
|
||||
#include "fuzz.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "fuzz.h"
|
||||
#include "install.h"
|
||||
#include "load-fragment.h"
|
||||
#include "manager.h"
|
||||
#include "manager-dump.h"
|
||||
#include "memstream-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "job.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "manager.h"
|
||||
#include "parse-util.h"
|
||||
#include "serialize.h"
|
||||
#include "set.h"
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "sd-event.h"
|
||||
|
||||
#include "list.h"
|
||||
#include "memory-util.h"
|
||||
#include "time-util.h"
|
||||
#include "unit-dependency-atom.h"
|
||||
|
||||
typedef struct ActivationDetails ActivationDetails;
|
||||
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct KillContext KillContext;
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -18,7 +16,7 @@ typedef enum KillMode {
|
||||
_KILL_MODE_INVALID = -EINVAL,
|
||||
} KillMode;
|
||||
|
||||
struct KillContext {
|
||||
typedef struct KillContext {
|
||||
KillMode kill_mode;
|
||||
int kill_signal;
|
||||
int restart_kill_signal;
|
||||
@@ -26,7 +24,7 @@ struct KillContext {
|
||||
int watchdog_signal;
|
||||
bool send_sigkill;
|
||||
bool send_sighup;
|
||||
};
|
||||
} KillContext;
|
||||
|
||||
typedef enum KillWhom {
|
||||
/* Kill whom is a property of an operation */
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "dropin.h"
|
||||
#include "fs-util.h"
|
||||
#include "load-dropin.h"
|
||||
#include "load-fragment.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "unit-name.h"
|
||||
#include "unit.h"
|
||||
|
||||
int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths) {
|
||||
assert(u);
|
||||
|
||||
return unit_file_find_dropin_paths(NULL,
|
||||
u->manager->lookup_paths.search_path,
|
||||
use_unit_path_cache ? u->manager->unit_path_cache : NULL,
|
||||
".d", ".conf",
|
||||
u->id, u->aliases,
|
||||
paths);
|
||||
}
|
||||
|
||||
static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suffix) {
|
||||
_cleanup_strv_free_ char **paths = NULL;
|
||||
int r;
|
||||
|
||||
+4
-12
@@ -1,20 +1,12 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "dropin.h"
|
||||
#include "unit.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct Unit Unit;
|
||||
|
||||
/* Read service data supplementary drop-in directories */
|
||||
|
||||
static inline int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths) {
|
||||
assert(u);
|
||||
|
||||
return unit_file_find_dropin_paths(NULL,
|
||||
u->manager->lookup_paths.search_path,
|
||||
use_unit_path_cache ? u->manager->unit_path_cache : NULL,
|
||||
".d", ".conf",
|
||||
u->id, u->aliases,
|
||||
paths);
|
||||
}
|
||||
int unit_find_dropin_paths(Unit *u, bool use_unit_path_cache, char ***paths);
|
||||
|
||||
int unit_load_dropin(Unit *u);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Unit Unit;
|
||||
|
||||
/* These functions are declared in the header to make them accessible to unit tests. */
|
||||
bool contains_instance_specifier_superset(const char *s);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "crash-handler.h"
|
||||
|
||||
extern bool arg_dump_core;
|
||||
extern int arg_crash_chvt;
|
||||
extern bool arg_crash_shell;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "hashmap.h"
|
||||
#include "manager.h"
|
||||
#include "manager-dump.h"
|
||||
#include "memstream-util.h"
|
||||
#include "unit-serialize.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "manager.h"
|
||||
typedef struct Manager Manager;
|
||||
|
||||
void manager_dump_jobs(Manager *s, FILE *f, char **patterns, const char *prefix);
|
||||
int manager_get_dump_jobs_string(Manager *m, char **patterns, const char *prefix, char **ret);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "clean-ipc.h"
|
||||
#include "core-varlink.h"
|
||||
#include "dbus.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "format-util.h"
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "manager.h"
|
||||
#include "fdset.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
#define DESTROY_IPC_FLAG (UINT32_C(1) << 31)
|
||||
|
||||
int manager_open_serialization(Manager *m, FILE **ret_f);
|
||||
|
||||
+1
-17
@@ -42,6 +42,7 @@
|
||||
#include "dbus-unit.h"
|
||||
#include "dbus.h"
|
||||
#include "dirent-util.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "event-util.h"
|
||||
@@ -928,15 +929,6 @@ int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags,
|
||||
m->timestamps + MANAGER_TIMESTAMP_LOADER);
|
||||
#endif
|
||||
|
||||
/* Prepare log fields we can use for structured logging */
|
||||
if (MANAGER_IS_SYSTEM(m)) {
|
||||
m->unit_log_field = "UNIT=";
|
||||
m->invocation_log_field = "INVOCATION_ID=";
|
||||
} else {
|
||||
m->unit_log_field = "USER_UNIT=";
|
||||
m->invocation_log_field = "USER_INVOCATION_ID=";
|
||||
}
|
||||
|
||||
/* Reboot immediately if the user hits C-A-D more often than 7x per 2s */
|
||||
m->ctrl_alt_del_ratelimit = (const RateLimit) { .interval = 2 * USEC_PER_SEC, .burst = 7 };
|
||||
|
||||
@@ -5191,11 +5183,3 @@ static const char* const manager_timestamp_table[_MANAGER_TIMESTAMP_MAX] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(manager_timestamp, ManagerTimestamp);
|
||||
|
||||
static const char* const oom_policy_table[_OOM_POLICY_MAX] = {
|
||||
[OOM_CONTINUE] = "continue",
|
||||
[OOM_STOP] = "stop",
|
||||
[OOM_KILL] = "kill",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(oom_policy, OOMPolicy);
|
||||
|
||||
+9
-30
@@ -9,14 +9,22 @@
|
||||
#include "sd-event.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
#include "common-signal.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "cgroup.h"
|
||||
#include "common-signal.h"
|
||||
#include "emergency-action.h"
|
||||
#include "execute.h"
|
||||
#include "fdset.h"
|
||||
#include "hashmap.h"
|
||||
#include "job.h"
|
||||
#include "list.h"
|
||||
#include "path-lookup.h"
|
||||
#include "prioq.h"
|
||||
#include "ratelimit.h"
|
||||
#include "show-status.h"
|
||||
#include "transaction.h"
|
||||
#include "unit-name.h"
|
||||
#include "unit.h"
|
||||
|
||||
struct libmnt_monitor;
|
||||
typedef struct Unit Unit;
|
||||
@@ -62,21 +70,6 @@ typedef enum ManagerObjective {
|
||||
_MANAGER_OBJECTIVE_INVALID = -EINVAL,
|
||||
} ManagerObjective;
|
||||
|
||||
typedef enum StatusType {
|
||||
STATUS_TYPE_EPHEMERAL,
|
||||
STATUS_TYPE_NORMAL,
|
||||
STATUS_TYPE_NOTICE,
|
||||
STATUS_TYPE_EMERGENCY,
|
||||
} StatusType;
|
||||
|
||||
typedef enum OOMPolicy {
|
||||
OOM_CONTINUE, /* The kernel or systemd-oomd kills the process it wants to kill, and that's it */
|
||||
OOM_STOP, /* The kernel or systemd-oomd kills the process it wants to kill, and we stop the unit */
|
||||
OOM_KILL, /* The kernel or systemd-oomd kills the process it wants to kill, and all others in the unit, and we stop the unit */
|
||||
_OOM_POLICY_MAX,
|
||||
_OOM_POLICY_INVALID = -EINVAL,
|
||||
} OOMPolicy;
|
||||
|
||||
/* Notes:
|
||||
* 1. TIMESTAMP_FIRMWARE, TIMESTAMP_LOADER, TIMESTAMP_KERNEL, TIMESTAMP_INITRD,
|
||||
* TIMESTAMP_SECURITY_START, and TIMESTAMP_SECURITY_FINISH are set only when
|
||||
@@ -135,14 +128,6 @@ typedef enum WatchdogType {
|
||||
_WATCHDOG_TYPE_MAX,
|
||||
} WatchdogType;
|
||||
|
||||
#include "execute.h"
|
||||
#include "job.h"
|
||||
#include "path-lookup.h"
|
||||
#include "show-status.h"
|
||||
#include "transaction.h"
|
||||
#include "unit-name.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef enum ManagerTestRunFlags {
|
||||
MANAGER_TEST_NORMAL = 0, /* run normally */
|
||||
MANAGER_TEST_RUN_MINIMAL = 1 << 0, /* create basic data structures */
|
||||
@@ -472,9 +457,6 @@ struct Manager {
|
||||
RateLimit ctrl_alt_del_ratelimit;
|
||||
EmergencyAction cad_burst_action;
|
||||
|
||||
const char *unit_log_field;
|
||||
const char *invocation_log_field;
|
||||
|
||||
int first_boot; /* tri-state */
|
||||
|
||||
/* Prefixes of e.g. RuntimeDirectory= */
|
||||
@@ -673,9 +655,6 @@ LogTarget manager_get_executor_log_target(Manager *m);
|
||||
|
||||
int manager_allocate_idle_pipe(Manager *m);
|
||||
|
||||
const char* oom_policy_to_string(OOMPolicy i) _const_;
|
||||
OOMPolicy oom_policy_from_string(const char *s) _pure_;
|
||||
|
||||
void unit_defaults_init(UnitDefaults *defaults, RuntimeScope scope);
|
||||
void unit_defaults_done(UnitDefaults *defaults);
|
||||
|
||||
|
||||
+2
-5
@@ -1,9 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Mount Mount;
|
||||
|
||||
#include "dynamic-user.h"
|
||||
#include "kill.h"
|
||||
#include "pidref.h"
|
||||
#include "unit.h"
|
||||
@@ -42,7 +39,7 @@ typedef enum MountProcFlags {
|
||||
MOUNT_PROC_JUST_CHANGED = 1 << 2,
|
||||
} MountProcFlags;
|
||||
|
||||
struct Mount {
|
||||
typedef struct Mount {
|
||||
Unit meta;
|
||||
|
||||
char *where;
|
||||
@@ -88,7 +85,7 @@ struct Mount {
|
||||
sd_event_source *timer_event_source;
|
||||
|
||||
unsigned n_retry_umount;
|
||||
};
|
||||
} Mount;
|
||||
|
||||
extern const UnitVTable mount_vtable;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "label-util.h"
|
||||
#include "list.h"
|
||||
#include "lock-util.h"
|
||||
#include "log.h"
|
||||
#include "loop-util.h"
|
||||
#include "loopback-setup.h"
|
||||
#include "missing_syscall.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "glob-util.h"
|
||||
#include "inotify-util.h"
|
||||
#include "macro.h"
|
||||
#include "manager.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "path.h"
|
||||
#include "path-util.h"
|
||||
|
||||
+4
-8
@@ -1,10 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Path Path;
|
||||
typedef struct PathSpec PathSpec;
|
||||
typedef struct ActivationDetailsPath ActivationDetailsPath;
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
typedef enum PathType {
|
||||
@@ -52,7 +48,7 @@ typedef enum PathResult {
|
||||
_PATH_RESULT_INVALID = -EINVAL,
|
||||
} PathResult;
|
||||
|
||||
struct Path {
|
||||
typedef struct Path {
|
||||
Unit meta;
|
||||
|
||||
LIST_HEAD(PathSpec, specs);
|
||||
@@ -67,12 +63,12 @@ struct Path {
|
||||
RateLimit trigger_limit;
|
||||
|
||||
sd_event_source *trigger_notify_event_source;
|
||||
};
|
||||
} Path;
|
||||
|
||||
struct ActivationDetailsPath {
|
||||
typedef struct ActivationDetailsPath {
|
||||
ActivationDetails meta;
|
||||
char *trigger_path_filename;
|
||||
};
|
||||
} ActivationDetailsPath;
|
||||
|
||||
void path_free_specs(Path *p);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "exit-status.h"
|
||||
#include "load-dropin.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "process-util.h"
|
||||
#include "random-util.h"
|
||||
#include "scope.h"
|
||||
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Scope Scope;
|
||||
|
||||
#include "cgroup.h"
|
||||
#include "kill.h"
|
||||
#include "unit.h"
|
||||
@@ -16,7 +14,7 @@ typedef enum ScopeResult {
|
||||
_SCOPE_RESULT_INVALID = -EINVAL,
|
||||
} ScopeResult;
|
||||
|
||||
struct Scope {
|
||||
typedef struct Scope {
|
||||
Unit meta;
|
||||
|
||||
CGroupContext cgroup_context;
|
||||
@@ -41,7 +39,7 @@ struct Scope {
|
||||
char *group;
|
||||
|
||||
OOMPolicy oom_policy;
|
||||
};
|
||||
} Scope;
|
||||
|
||||
extern const UnitVTable scope_vtable;
|
||||
|
||||
|
||||
+8
-9
@@ -1,12 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Service Service;
|
||||
typedef struct ServiceFDStore ServiceFDStore;
|
||||
typedef struct ServiceExtraFD ServiceExtraFD;
|
||||
|
||||
#include "exit-status.h"
|
||||
#include "kill.h"
|
||||
#include "manager.h"
|
||||
#include "open-file.h"
|
||||
#include "path.h"
|
||||
#include "pidref.h"
|
||||
@@ -14,6 +11,8 @@ typedef struct ServiceExtraFD ServiceExtraFD;
|
||||
#include "socket.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Service Service;
|
||||
|
||||
typedef enum ServiceRestart {
|
||||
SERVICE_RESTART_NO,
|
||||
SERVICE_RESTART_ON_SUCCESS,
|
||||
@@ -101,7 +100,7 @@ typedef enum ServiceRestartMode {
|
||||
_SERVICE_RESTART_MODE_INVALID = -EINVAL,
|
||||
} ServiceRestartMode;
|
||||
|
||||
struct ServiceFDStore {
|
||||
typedef struct ServiceFDStore {
|
||||
Service *service;
|
||||
|
||||
int fd;
|
||||
@@ -109,13 +108,13 @@ struct ServiceFDStore {
|
||||
sd_event_source *event_source;
|
||||
bool do_poll;
|
||||
|
||||
LIST_FIELDS(ServiceFDStore, fd_store);
|
||||
};
|
||||
LIST_FIELDS(struct ServiceFDStore, fd_store);
|
||||
} ServiceFDStore;
|
||||
|
||||
struct ServiceExtraFD {
|
||||
typedef struct ServiceExtraFD {
|
||||
int fd;
|
||||
char *fdname;
|
||||
};
|
||||
} ServiceExtraFD;
|
||||
|
||||
struct Service {
|
||||
Unit meta;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "dbus-unit.h"
|
||||
#include "fd-util.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "serialize.h"
|
||||
#include "slice.h"
|
||||
#include "special.h"
|
||||
|
||||
+2
-4
@@ -3,9 +3,7 @@
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Slice Slice;
|
||||
|
||||
struct Slice {
|
||||
typedef struct Slice {
|
||||
Unit meta;
|
||||
|
||||
SliceState state, deserialized_state;
|
||||
@@ -16,7 +14,7 @@ struct Slice {
|
||||
CGroupContext cgroup_context;
|
||||
|
||||
CGroupRuntime *cgroup_runtime;
|
||||
};
|
||||
} Slice;
|
||||
|
||||
extern const UnitVTable slice_vtable;
|
||||
|
||||
|
||||
@@ -7,4 +7,6 @@
|
||||
Nathaniel Chen <nathaniel.chen@intel.com>
|
||||
***/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
int mac_smack_setup(bool *loaded_policy);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ip-protocol-list.h"
|
||||
#include "label-util.h"
|
||||
#include "log.h"
|
||||
#include "manager.h"
|
||||
#include "mkdir-label.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Socket Socket;
|
||||
typedef struct SocketPeer SocketPeer;
|
||||
|
||||
#include "mount.h"
|
||||
#include "pidref.h"
|
||||
#include "socket-util.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Socket Socket;
|
||||
typedef struct SocketPeer SocketPeer;
|
||||
|
||||
typedef enum SocketExecCommand {
|
||||
SOCKET_EXEC_START_PRE,
|
||||
SOCKET_EXEC_START_CHOWN,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
#include "fstab-util.h"
|
||||
#include "manager.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
|
||||
+2
-4
@@ -10,8 +10,6 @@
|
||||
#include "pidref.h"
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Swap Swap;
|
||||
|
||||
typedef enum SwapExecCommand {
|
||||
SWAP_EXEC_ACTIVATE,
|
||||
SWAP_EXEC_DEACTIVATE,
|
||||
@@ -38,7 +36,7 @@ typedef struct SwapParameters {
|
||||
bool priority_set;
|
||||
} SwapParameters;
|
||||
|
||||
struct Swap {
|
||||
typedef struct Swap {
|
||||
Unit meta;
|
||||
|
||||
char *what;
|
||||
@@ -85,7 +83,7 @@ struct Swap {
|
||||
devices for the same swap. We chain them up here. */
|
||||
|
||||
LIST_FIELDS(struct Swap, same_devnode);
|
||||
};
|
||||
} Swap;
|
||||
|
||||
extern const UnitVTable swap_vtable;
|
||||
|
||||
|
||||
+2
-4
@@ -3,13 +3,11 @@
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
typedef struct Target Target;
|
||||
|
||||
struct Target {
|
||||
typedef struct Target {
|
||||
Unit meta;
|
||||
|
||||
TargetState state, deserialized_state;
|
||||
};
|
||||
} Target;
|
||||
|
||||
extern const UnitVTable target_vtable;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#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"
|
||||
|
||||
+4
-7
@@ -1,9 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Timer Timer;
|
||||
typedef struct ActivationDetailsTimer ActivationDetailsTimer;
|
||||
|
||||
#include "calendarspec.h"
|
||||
#include "unit.h"
|
||||
|
||||
@@ -37,7 +34,7 @@ typedef enum TimerResult {
|
||||
_TIMER_RESULT_INVALID = -EINVAL,
|
||||
} TimerResult;
|
||||
|
||||
struct Timer {
|
||||
typedef struct Timer {
|
||||
Unit meta;
|
||||
|
||||
usec_t accuracy_usec;
|
||||
@@ -64,12 +61,12 @@ struct Timer {
|
||||
bool defer_reactivation;
|
||||
|
||||
char *stamp_path;
|
||||
};
|
||||
} Timer;
|
||||
|
||||
struct ActivationDetailsTimer {
|
||||
typedef struct ActivationDetailsTimer {
|
||||
ActivationDetails meta;
|
||||
dual_timestamp last_trigger;
|
||||
};
|
||||
} ActivationDetailsTimer;
|
||||
|
||||
#define TIMER_MONOTONIC_CLOCK(t) ((t)->wake_system ? CLOCK_BOOTTIME_ALARM : CLOCK_MONOTONIC)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-error.h"
|
||||
#include "dbus-unit.h"
|
||||
#include "manager.h"
|
||||
#include "slice.h"
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
@@ -393,7 +394,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
||||
break;
|
||||
}
|
||||
|
||||
unit_ids = merge_unit_ids(j->manager->unit_log_field, array); /* ignore error */
|
||||
unit_ids = merge_unit_ids(unit_log_field(j->unit), array); /* ignore error */
|
||||
|
||||
STRV_FOREACH_PAIR(unit_id, job_type, array)
|
||||
/* logging for j not k here to provide a consistent narrative */
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Transaction Transaction;
|
||||
typedef enum TransactionAddFlags TransactionAddFlags;
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "job.h"
|
||||
#include "manager.h"
|
||||
#include "unit.h"
|
||||
|
||||
struct Transaction {
|
||||
typedef struct Transaction {
|
||||
/* Jobs to be added */
|
||||
Hashmap *jobs; /* Unit object => Job object list 1:1 */
|
||||
Job *anchor_job; /* The job the user asked for */
|
||||
bool irreversible;
|
||||
};
|
||||
} Transaction;
|
||||
|
||||
Transaction* transaction_new(bool irreversible);
|
||||
Transaction* transaction_free(Transaction *tr);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "cgroup-util.h"
|
||||
#include "format-util.h"
|
||||
#include "macro.h"
|
||||
#include "manager.h"
|
||||
#include "sd-path.h"
|
||||
#include "specifier.h"
|
||||
#include "string-util.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "parse-util.h"
|
||||
#include "serialize.h"
|
||||
#include "string-table.h"
|
||||
#include "unit.h"
|
||||
#include "unit-serialize.h"
|
||||
#include "user-util.h"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "unit.h"
|
||||
#include "fdset.h"
|
||||
|
||||
typedef struct Unit Unit;
|
||||
|
||||
/* These functions serialize state for our own usage, i.e.: across a reload/reexec, rather than for being
|
||||
* passed to a child process. */
|
||||
|
||||
|
||||
+21
-4
@@ -24,6 +24,7 @@
|
||||
#include "dbus-unit.h"
|
||||
#include "dbus.h"
|
||||
#include "dropin.h"
|
||||
#include "dynamic-user.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "exec-credential.h"
|
||||
@@ -1727,9 +1728,9 @@ static int log_unit_internal(void *userdata, int level, int error, const char *f
|
||||
va_start(ap, format);
|
||||
if (u)
|
||||
r = log_object_internalv(level, error, file, line, func,
|
||||
u->manager->unit_log_field,
|
||||
unit_log_field(u),
|
||||
u->id,
|
||||
u->manager->invocation_log_field,
|
||||
unit_invocation_log_field(u),
|
||||
u->invocation_id_string,
|
||||
format, ap);
|
||||
else
|
||||
@@ -2491,10 +2492,10 @@ static int unit_log_resources(Unit *u) {
|
||||
if (!set_iovec_string_field(iovec, &n_iovec, "MESSAGE_ID=", SD_MESSAGE_UNIT_RESOURCES_STR))
|
||||
return log_oom();
|
||||
|
||||
if (!set_iovec_string_field(iovec, &n_iovec, u->manager->unit_log_field, u->id))
|
||||
if (!set_iovec_string_field(iovec, &n_iovec, unit_log_field(u), u->id))
|
||||
return log_oom();
|
||||
|
||||
if (!set_iovec_string_field(iovec, &n_iovec, u->manager->invocation_log_field, u->invocation_id_string))
|
||||
if (!set_iovec_string_field(iovec, &n_iovec, unit_invocation_log_field(u), u->invocation_id_string))
|
||||
return log_oom();
|
||||
|
||||
log_unit_struct_iovec(u, log_level, iovec, n_iovec);
|
||||
@@ -6642,6 +6643,14 @@ int unit_compare_priority(Unit *a, Unit *b) {
|
||||
return strcmp(a->id, b->id);
|
||||
}
|
||||
|
||||
const char* unit_log_field(const Unit *u) {
|
||||
return MANAGER_IS_SYSTEM(ASSERT_PTR(u)->manager) ? "UNIT=" : "USER_UNIT=";
|
||||
}
|
||||
|
||||
const char* unit_invocation_log_field(const Unit *u) {
|
||||
return MANAGER_IS_SYSTEM(ASSERT_PTR(u)->manager) ? "INVOCATION_ID=" : "USER_INVOCATION_ID=";
|
||||
}
|
||||
|
||||
const ActivationDetailsVTable * const activation_details_vtable[_UNIT_TYPE_MAX] = {
|
||||
[UNIT_PATH] = &activation_details_path_vtable,
|
||||
[UNIT_TIMER] = &activation_details_timer_vtable,
|
||||
@@ -6802,6 +6811,14 @@ static const char* const unit_mount_dependency_type_table[_UNIT_MOUNT_DEPENDENCY
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(unit_mount_dependency_type, UnitMountDependencyType);
|
||||
|
||||
static const char* const oom_policy_table[_OOM_POLICY_MAX] = {
|
||||
[OOM_CONTINUE] = "continue",
|
||||
[OOM_STOP] = "stop",
|
||||
[OOM_KILL] = "kill",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(oom_policy, OOMPolicy);
|
||||
|
||||
UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependencyType t) {
|
||||
switch (t) {
|
||||
|
||||
|
||||
+41
-20
@@ -9,7 +9,21 @@
|
||||
|
||||
#include "sd-id128.h"
|
||||
|
||||
/* Circular dependency with manager.h, needs to be defined before local includes */
|
||||
#include "cgroup.h"
|
||||
#include "condition.h"
|
||||
#include "emergency-action.h"
|
||||
#include "execute.h"
|
||||
#include "install.h"
|
||||
#include "job.h"
|
||||
#include "list.h"
|
||||
#include "log-context.h"
|
||||
#include "mount-util.h"
|
||||
#include "pidref.h"
|
||||
#include "ratelimit.h"
|
||||
#include "unit-file.h"
|
||||
|
||||
typedef struct UnitRef UnitRef;
|
||||
|
||||
typedef enum UnitMountDependencyType {
|
||||
UNIT_MOUNT_WANTS,
|
||||
UNIT_MOUNT_REQUIRES,
|
||||
@@ -17,18 +31,6 @@ typedef enum UnitMountDependencyType {
|
||||
_UNIT_MOUNT_DEPENDENCY_TYPE_INVALID = -EINVAL,
|
||||
} UnitMountDependencyType;
|
||||
|
||||
#include "cgroup.h"
|
||||
#include "condition.h"
|
||||
#include "emergency-action.h"
|
||||
#include "install.h"
|
||||
#include "list.h"
|
||||
#include "log-context.h"
|
||||
#include "mount-util.h"
|
||||
#include "pidref.h"
|
||||
#include "unit-file.h"
|
||||
|
||||
typedef struct UnitRef UnitRef;
|
||||
|
||||
typedef enum KillOperation {
|
||||
KILL_TERMINATE,
|
||||
KILL_TERMINATE_AND_LOG,
|
||||
@@ -46,6 +48,21 @@ typedef enum CollectMode {
|
||||
_COLLECT_MODE_INVALID = -EINVAL,
|
||||
} CollectMode;
|
||||
|
||||
typedef enum OOMPolicy {
|
||||
OOM_CONTINUE, /* The kernel or systemd-oomd kills the process it wants to kill, and that's it */
|
||||
OOM_STOP, /* The kernel or systemd-oomd kills the process it wants to kill, and we stop the unit */
|
||||
OOM_KILL, /* The kernel or systemd-oomd kills the process it wants to kill, and all others in the unit, and we stop the unit */
|
||||
_OOM_POLICY_MAX,
|
||||
_OOM_POLICY_INVALID = -EINVAL,
|
||||
} OOMPolicy;
|
||||
|
||||
typedef enum StatusType {
|
||||
STATUS_TYPE_EPHEMERAL,
|
||||
STATUS_TYPE_NORMAL,
|
||||
STATUS_TYPE_NOTICE,
|
||||
STATUS_TYPE_EMERGENCY,
|
||||
} StatusType;
|
||||
|
||||
static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
|
||||
return IN_SET(t, UNIT_ACTIVE, UNIT_RELOADING, UNIT_REFRESHING);
|
||||
}
|
||||
@@ -200,8 +217,6 @@ static inline void* UNIT_DEPENDENCY_TO_PTR(UnitDependency d) {
|
||||
return INT_TO_PTR(d);
|
||||
}
|
||||
|
||||
#include "job.h"
|
||||
|
||||
struct UnitRef {
|
||||
/* Keeps tracks of references to a unit. This is useful so
|
||||
* that we can merge two units if necessary and correct all
|
||||
@@ -1054,10 +1069,16 @@ bool unit_passes_filter(Unit *u, char * const *states, char * const *patterns);
|
||||
|
||||
int unit_compare_priority(Unit *a, Unit *b);
|
||||
|
||||
const char* unit_log_field(const Unit *u);
|
||||
const char* unit_invocation_log_field(const Unit *u);
|
||||
|
||||
UnitMountDependencyType unit_mount_dependency_type_from_string(const char *s) _const_;
|
||||
const char* unit_mount_dependency_type_to_string(UnitMountDependencyType t) _const_;
|
||||
UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependencyType t) _pure_;
|
||||
|
||||
const char* oom_policy_to_string(OOMPolicy i) _const_;
|
||||
OOMPolicy oom_policy_from_string(const char *s) _pure_;
|
||||
|
||||
/* Macros which append UNIT= or USER_UNIT= to the message */
|
||||
|
||||
#define log_unit_full_errno_zerook(unit, level, error, ...) \
|
||||
@@ -1071,7 +1092,7 @@ UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependency
|
||||
LOG_CONTEXT_PUSH_IOV(_c ? _c->log_extra_fields : NULL, \
|
||||
_c ? _c->n_log_extra_fields : 0); \
|
||||
!_do_log ? -ERRNO_VALUE(error) : \
|
||||
_u ? log_object_internal(_l, error, PROJECT_FILE, __LINE__, __func__, _u->manager->unit_log_field, _u->id, _u->manager->invocation_log_field, _u->invocation_id_string, ##__VA_ARGS__) : \
|
||||
_u ? log_object_internal(_l, error, PROJECT_FILE, __LINE__, __func__, unit_log_field(_u), _u->id, unit_invocation_log_field(_u), _u->invocation_id_string, ##__VA_ARGS__) : \
|
||||
log_internal(_l, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
@@ -1138,8 +1159,8 @@ UnitDependency unit_mount_dependency_type_to_dependency_type(UnitMountDependency
|
||||
|
||||
/* Like LOG_MESSAGE(), but with the unit name prefixed. */
|
||||
#define LOG_UNIT_MESSAGE(unit, fmt, ...) LOG_MESSAGE("%s: " fmt, (unit)->id, ##__VA_ARGS__)
|
||||
#define LOG_UNIT_ID(unit) LOG_ITEM("%s%s", (unit)->manager->unit_log_field, (unit)->id)
|
||||
#define LOG_UNIT_INVOCATION_ID(unit) LOG_ITEM("%s%s", (unit)->manager->invocation_log_field, (unit)->invocation_id_string)
|
||||
#define LOG_UNIT_ID(unit) LOG_ITEM("%s%s", unit_log_field((unit)), (unit)->id)
|
||||
#define LOG_UNIT_INVOCATION_ID(unit) LOG_ITEM("%s%s", unit_invocation_log_field((unit)), (unit)->invocation_id_string)
|
||||
|
||||
const char* collect_mode_to_string(CollectMode m) _const_;
|
||||
CollectMode collect_mode_from_string(const char *s) _pure_;
|
||||
@@ -1198,8 +1219,8 @@ typedef struct UnitForEachDependencyData {
|
||||
#define _LOG_CONTEXT_PUSH_UNIT(unit, u, c) \
|
||||
const Unit *u = (unit); \
|
||||
const ExecContext *c = unit_get_exec_context(u); \
|
||||
LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->unit_log_field, u->id); \
|
||||
LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->invocation_log_field, u->invocation_id_string); \
|
||||
LOG_CONTEXT_PUSH_KEY_VALUE(unit_log_field(u), u->id); \
|
||||
LOG_CONTEXT_PUSH_KEY_VALUE(unit_invocation_log_field(u), u->invocation_id_string); \
|
||||
LOG_CONTEXT_PUSH_IOV(c ? c->log_extra_fields : NULL, c ? c->n_log_extra_fields : 0); \
|
||||
LOG_CONTEXT_SET_LOG_LEVEL(c->log_level_max >= 0 ? c->log_level_max : log_get_max_level())
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "format-table.h"
|
||||
#include "fs-util.h"
|
||||
#include "glob-util.h"
|
||||
#include "image-policy.h"
|
||||
#include "journal-internal.h"
|
||||
#include "journal-util.h"
|
||||
#include "json-util.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "ask-password-api.h"
|
||||
#include "cryptsetup-util.h"
|
||||
#include "log.h"
|
||||
#include "time-util.h"
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct crypt_device;
|
||||
|
||||
/* for more information see libcryptsetup.h crypt-tokens section */
|
||||
|
||||
const char* cryptsetup_token_version(void);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct crypt_device;
|
||||
|
||||
int acquire_luks2_key(
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "fs-util.h"
|
||||
#include "glyph-util.h"
|
||||
#include "hostname-util.h"
|
||||
#include "image-policy.h"
|
||||
#include "kbd-util.h"
|
||||
#include "libcrypt-util.h"
|
||||
#include "locale-util.h"
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#if !SD_BOOT
|
||||
#include <stdlib.h>
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#include "assert-fundamental.h"
|
||||
#include "macro-fundamental.h"
|
||||
|
||||
#if SD_BOOT
|
||||
/* struct iovec is a POSIX userspace construct. Let's introduce it also in EFI mode, it's just so useful */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "homed-bus.h"
|
||||
#include "homed-home-bus.h"
|
||||
#include "homed-home.h"
|
||||
#include "homed-manager.h"
|
||||
#include "log.h"
|
||||
#include "strv.h"
|
||||
#include "user-record-util.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "home-util.h"
|
||||
#include "homed-home.h"
|
||||
#include "homed-home-bus.h"
|
||||
#include "homed-manager.h"
|
||||
#include "json-util.h"
|
||||
#include "log.h"
|
||||
#include "memfd-util.h"
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
typedef struct Home Home;
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "homed-manager.h"
|
||||
#include "homed-operation.h"
|
||||
#include "list.h"
|
||||
#include "ordered-set.h"
|
||||
@@ -12,6 +9,8 @@ typedef struct Home Home;
|
||||
#include "stat-util.h"
|
||||
#include "user-record.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
typedef enum HomeState {
|
||||
HOME_UNFIXATED, /* home exists, but local record does not */
|
||||
HOME_ABSENT, /* local record exists, but home does not */
|
||||
@@ -108,7 +107,7 @@ static inline bool HOME_STATE_MAY_RETRY_DEACTIVATE(HomeState state) {
|
||||
HOME_AUTHENTICATING_FOR_ACQUIRE);
|
||||
}
|
||||
|
||||
struct Home {
|
||||
typedef struct Home {
|
||||
Manager *manager;
|
||||
|
||||
/* The fields this record can be looked up by. This is kinda redundant, as the same information is
|
||||
@@ -180,7 +179,7 @@ struct Home {
|
||||
|
||||
/* Whether a rebalance operation is pending */
|
||||
bool rebalance_pending;
|
||||
};
|
||||
} Home;
|
||||
|
||||
int home_new(Manager *m, UserRecord *hr, const char *sysfs, Home **ret);
|
||||
Home *home_free(Home *h);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "bus-util.h"
|
||||
#include "bus-object.h"
|
||||
|
||||
extern const BusObjectImplementation manager_object;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "sd-event.h"
|
||||
#include "sd-varlink.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "homed-home.h"
|
||||
|
||||
@@ -25,7 +23,7 @@ typedef enum RebalanceState {
|
||||
_REBALANCE_STATE_INVALID = -1,
|
||||
} RebalanceState;
|
||||
|
||||
struct Manager {
|
||||
typedef struct Manager {
|
||||
sd_event *event;
|
||||
sd_bus *bus;
|
||||
|
||||
@@ -68,7 +66,7 @@ struct Manager {
|
||||
* running a rebalancing operation for. 'rebalance_queued_method_calls' are the method calls that
|
||||
* have been queued since then and that we'll operate on once we complete the current run. */
|
||||
Set *rebalance_pending_method_calls, *rebalance_queued_method_calls;
|
||||
};
|
||||
} Manager;
|
||||
|
||||
int manager_new(Manager **ret);
|
||||
Manager* manager_free(Manager *m);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "fs-util.h"
|
||||
#include "homework-cifs.h"
|
||||
#include "homework-mount.h"
|
||||
#include "log.h"
|
||||
#include "memfd-util.h"
|
||||
#include "mkdir.h"
|
||||
#include "mount-util.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "homework-directory.h"
|
||||
#include "homework-mount.h"
|
||||
#include "homework-quota.h"
|
||||
#include "log.h"
|
||||
#include "mkdir.h"
|
||||
#include "mount-util.h"
|
||||
#include "path-util.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "homework-mount.h"
|
||||
#include "homework-quota.h"
|
||||
#include "keyring-util.h"
|
||||
#include "log.h"
|
||||
#include "memory-util.h"
|
||||
#include "missing_fs.h"
|
||||
#include "missing_keyctl.h"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user