summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-05-11 22:51:49 +0200
committerLennart Poettering <lennart@poettering.net>2015-05-11 22:51:49 +0200
commitb2c23da8cea1987a1a329f5a964d3299b7ca7890 (patch)
tree66f369f148c30ef8d63b32cc33686b0370c6cbf8
parent8b4305c7354f572fa0390b7580ba30af741aa0a5 (diff)
core: rename SystemdRunningAs to ManagerRunningAs
It's primarily just a property of the Manager object after all, and we try to refer to PID 1 as "manager" instead of "systemd", hence let's to stick to this here too.
-rw-r--r--src/analyze/analyze-verify.c2
-rw-r--r--src/analyze/analyze-verify.h2
-rw-r--r--src/analyze/analyze.c2
-rw-r--r--src/core/automount.c2
-rw-r--r--src/core/busname.c4
-rw-r--r--src/core/cgroup.c4
-rw-r--r--src/core/dbus-manager.c30
-rw-r--r--src/core/dbus.c16
-rw-r--r--src/core/device.c2
-rw-r--r--src/core/failure-action.c2
-rw-r--r--src/core/job.c2
-rw-r--r--src/core/load-fragment.c2
-rw-r--r--src/core/main.c40
-rw-r--r--src/core/manager.c70
-rw-r--r--src/core/manager.h4
-rw-r--r--src/core/mount.c16
-rw-r--r--src/core/path.c2
-rw-r--r--src/core/service.c4
-rw-r--r--src/core/socket.c2
-rw-r--r--src/core/swap.c4
-rw-r--r--src/core/timer.c4
-rw-r--r--src/core/unit-printf.c8
-rw-r--r--src/core/unit.c20
-rw-r--r--src/shared/path-lookup.c12
-rw-r--r--src/shared/path-lookup.h16
-rw-r--r--src/systemctl/systemctl.c2
-rw-r--r--src/sysv-generator/sysv-generator.c2
-rw-r--r--src/test/test-cgroup-mask.c2
-rw-r--r--src/test/test-engine.c2
-rw-r--r--src/test/test-execute.c2
-rw-r--r--src/test/test-path-lookup.c18
-rw-r--r--src/test/test-path.c2
-rw-r--r--src/test/test-sched-prio.c2
-rw-r--r--src/test/test-unit-name.c2
34 files changed, 153 insertions, 153 deletions
diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
index e7df55f5a5..f4255f979e 100644
--- a/src/analyze/analyze-verify.c
+++ b/src/analyze/analyze-verify.c
@@ -192,7 +192,7 @@ static int verify_unit(Unit *u, bool check_man) {
return r;
}
-int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man) {
+int verify_units(char **filenames, ManagerRunningAs running_as, bool check_man) {
_cleanup_bus_error_free_ sd_bus_error err = SD_BUS_ERROR_NULL;
Manager *m = NULL;
FILE *serial = NULL;
diff --git a/src/analyze/analyze-verify.h b/src/analyze/analyze-verify.h
index f10c34c4ae..d2d4a7f190 100644
--- a/src/analyze/analyze-verify.h
+++ b/src/analyze/analyze-verify.h
@@ -25,4 +25,4 @@
#include "path-lookup.h"
-int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man);
+int verify_units(char **filenames, ManagerRunningAs running_as, bool check_man);
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 17fc5c861b..9583458f72 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1328,7 +1328,7 @@ int main(int argc, char *argv[]) {
if (streq_ptr(argv[optind], "verify"))
r = verify_units(argv+optind+1,
- arg_user ? SYSTEMD_USER : SYSTEMD_SYSTEM,
+ arg_user ? MANAGER_USER : MANAGER_SYSTEM,
arg_man);
else {
_cleanup_bus_close_unref_ sd_bus *bus = NULL;
diff --git a/src/core/automount.c b/src/core/automount.c
index b747c6f38f..13f80c2abd 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -156,7 +156,7 @@ static int automount_add_default_dependencies(Automount *a) {
assert(a);
- if (UNIT(a)->manager->running_as != SYSTEMD_SYSTEM)
+ if (UNIT(a)->manager->running_as != MANAGER_SYSTEM)
return 0;
r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
diff --git a/src/core/busname.c b/src/core/busname.c
index 2010ec0985..eb95c8e81e 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -147,7 +147,7 @@ static int busname_add_default_default_dependencies(BusName *n) {
if (r < 0)
return r;
- if (UNIT(n)->manager->running_as == SYSTEMD_SYSTEM) {
+ if (UNIT(n)->manager->running_as == MANAGER_SYSTEM) {
r = unit_add_two_dependencies_by_name(UNIT(n), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
if (r < 0)
return r;
@@ -312,7 +312,7 @@ static int busname_open_fd(BusName *n) {
if (n->starter_fd >= 0)
return 0;
- mode = UNIT(n)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user";
+ mode = UNIT(n)->manager->running_as == MANAGER_SYSTEM ? "system" : "user";
n->starter_fd = bus_kernel_open_bus_fd(mode, &path);
if (n->starter_fd < 0)
return log_unit_warning_errno(UNIT(n), n->starter_fd, "Failed to open %s: %m", path ?: "kdbus");
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index e337c0fd13..6474e08bd2 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -908,7 +908,7 @@ int manager_setup_cgroup(Manager *m) {
/* LEGACY: Already in /system.slice? If so, let's cut this
* off. This is to support live upgrades from older systemd
* versions where PID 1 was moved there. */
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
char *e;
e = endswith(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE);
@@ -933,7 +933,7 @@ int manager_setup_cgroup(Manager *m) {
if (!m->test_run) {
/* 3. Install agent */
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
r = cg_install_release_agent(SYSTEMD_CGROUP_CONTROLLER, SYSTEMD_CGROUP_AGENT_PATH);
if (r < 0)
log_warning_errno(r, "Failed to install release agent, ignoring: %m");
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 18a379f8c4..d8b39bdf5f 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1206,7 +1206,7 @@ static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *er
if (r < 0)
return r;
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Exit is only supported for user service managers.");
m->exit_code = MANAGER_EXIT;
@@ -1225,7 +1225,7 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *
if (r < 0)
return r;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Reboot is only supported for system managers.");
m->exit_code = MANAGER_REBOOT;
@@ -1244,7 +1244,7 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error
if (r < 0)
return r;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Powering off is only supported for system managers.");
m->exit_code = MANAGER_POWEROFF;
@@ -1263,7 +1263,7 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er
if (r < 0)
return r;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Halt is only supported for system managers.");
m->exit_code = MANAGER_HALT;
@@ -1282,7 +1282,7 @@ static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *e
if (r < 0)
return r;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "KExec is only supported for system managers.");
m->exit_code = MANAGER_KEXEC;
@@ -1303,7 +1303,7 @@ static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_er
if (r < 0)
return r;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Root switching is only supported by system manager.");
r = sd_bus_message_read(message, "ss", &root, &init);
@@ -1480,7 +1480,7 @@ static int method_list_unit_files(sd_bus_message *message, void *userdata, sd_bu
if (!h)
return -ENOMEM;
- r = unit_file_get_list(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
+ r = unit_file_get_list(m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
if (r < 0)
goto fail;
@@ -1528,7 +1528,7 @@ static int method_get_unit_file_state(sd_bus_message *message, void *userdata, s
if (r < 0)
return r;
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
state = unit_file_get_state(scope, NULL, name);
if (state < 0)
@@ -1552,7 +1552,7 @@ static int method_get_default_target(sd_bus_message *message, void *userdata, sd
if (r < 0)
return r;
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = unit_file_get_default(scope, NULL, &default_target);
if (r < 0)
@@ -1661,7 +1661,7 @@ static int method_enable_unit_files_generic(
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = call(scope, runtime, NULL, l, force, &changes, &n_changes);
if (r < 0)
@@ -1734,7 +1734,7 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = unit_file_preset(scope, runtime, NULL, l, mm, force, &changes, &n_changes);
if (r < 0)
@@ -1771,7 +1771,7 @@ static int method_disable_unit_files_generic(
if (r < 0)
return r;
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
@@ -1819,7 +1819,7 @@ static int method_set_default_target(sd_bus_message *message, void *userdata, sd
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = unit_file_set_default(scope, NULL, name, force, &changes, &n_changes);
if (r < 0)
@@ -1862,7 +1862,7 @@ static int method_preset_all_unit_files(sd_bus_message *message, void *userdata,
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = unit_file_preset_all(scope, runtime, NULL, mm, force, &changes, &n_changes);
if (r < 0)
@@ -1907,7 +1907,7 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd
if (r < 0)
return r;
- scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
+ scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
r = unit_file_add_dependency(scope, runtime, NULL, l, target, dep, force, &changes, &n_changes);
if (r < 0)
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 1679242be8..86886e6d2c 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -85,7 +85,7 @@ static int signal_agent_released(sd_bus_message *message, void *userdata, sd_bus
manager_notify_cgroup_empty(m, cgroup);
/* only forward to system bus if running as system instance */
- if (m->running_as != SYSTEMD_SYSTEM || !m->system_bus)
+ if (m->running_as != MANAGER_SYSTEM || !m->system_bus)
return 0;
r = sd_bus_message_rewind(message, 1);
@@ -685,7 +685,7 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void
return 0;
}
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
/* When we run as system instance we get the Released
* signal via a direct connection */
@@ -813,10 +813,10 @@ static int bus_init_api(Manager *m) {
return 0;
/* The API and system bus is the same if we are running in system mode */
- if (m->running_as == SYSTEMD_SYSTEM && m->system_bus)
+ if (m->running_as == MANAGER_SYSTEM && m->system_bus)
bus = sd_bus_ref(m->system_bus);
else {
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
r = sd_bus_open_system(&bus);
else
r = sd_bus_open_user(&bus);
@@ -856,7 +856,7 @@ static int bus_setup_system(Manager *m, sd_bus *bus) {
assert(bus);
/* On kdbus or if we are a user instance we get the Released message via the system bus */
- if (m->running_as == SYSTEMD_USER || m->kdbus_fd >= 0) {
+ if (m->running_as == MANAGER_USER || m->kdbus_fd >= 0) {
r = sd_bus_add_match(
bus,
NULL,
@@ -881,7 +881,7 @@ static int bus_init_system(Manager *m) {
return 0;
/* The API and system bus is the same if we are running in system mode */
- if (m->running_as == SYSTEMD_SYSTEM && m->api_bus) {
+ if (m->running_as == MANAGER_SYSTEM && m->api_bus) {
m->system_bus = sd_bus_ref(m->api_bus);
return 0;
}
@@ -932,7 +932,7 @@ static int bus_init_private(Manager *m) {
if (m->kdbus_fd >= 0)
return 0;
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
/* We want the private bus only when running as init */
if (getpid() != 1)
@@ -1031,7 +1031,7 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
/* Possibly flush unwritten data, but only if we are
* unprivileged, since we don't want to sync here */
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
sd_bus_flush(*bus);
/* And destroy the object */
diff --git a/src/core/device.c b/src/core/device.c
index a0eb0f449c..8eca4c2fa0 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -264,7 +264,7 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
assert(u);
assert(dev);
- property = u->manager->running_as == SYSTEMD_USER ? "SYSTEMD_USER_WANTS" : "SYSTEMD_WANTS";
+ property = u->manager->running_as == MANAGER_USER ? "MANAGER_USER_WANTS" : "SYSTEMD_WANTS";
wants = udev_device_get_property_value(dev, property);
if (!wants)
return 0;
diff --git a/src/core/failure-action.c b/src/core/failure-action.c
index 7c6abb3a82..b06a7d2ae5 100644
--- a/src/core/failure-action.c
+++ b/src/core/failure-action.c
@@ -50,7 +50,7 @@ int failure_action(
if (action == FAILURE_ACTION_NONE)
return -ECANCELED;
- if (m->running_as == SYSTEMD_USER) {
+ if (m->running_as == MANAGER_USER) {
/* Downgrade all options to simply exiting if we run
* in user mode */
diff --git a/src/core/job.c b/src/core/job.c
index 49fcac97dc..9ad1f735f0 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -1152,7 +1152,7 @@ void job_shutdown_magic(Job *j) {
if (j->type != JOB_START)
return;
- if (j->unit->manager->running_as != SYSTEMD_SYSTEM)
+ if (j->unit->manager->running_as != MANAGER_SYSTEM)
return;
if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 970120ab70..33d9e2714a 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2408,7 +2408,7 @@ int config_parse_syscall_filter(
/* Turn on NNP, but only if it wasn't configured explicitly
* before, and only if we are in user mode. */
- if (!c->no_new_privileges_set && u->manager->running_as == SYSTEMD_USER)
+ if (!c->no_new_privileges_set && u->manager->running_as == MANAGER_USER)
c->no_new_privileges = true;
return 0;
diff --git a/src/core/main.c b/src/core/main.c
index ac2f1172e8..08e84d8304 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -85,7 +85,7 @@ static enum {
ACTION_DONE
} arg_action = ACTION_RUN;
static char *arg_default_unit = NULL;
-static SystemdRunningAs arg_running_as = _SYSTEMD_RUNNING_AS_INVALID;
+static ManagerRunningAs arg_running_as = _MANAGER_RUNNING_AS_INVALID;
static bool arg_dump_core = true;
static bool arg_crash_shell = false;
static int arg_crash_chvt = -1;
@@ -676,8 +676,8 @@ static int parse_config_file(void) {
const char *fn, *conf_dirs_nulstr;
- fn = arg_running_as == SYSTEMD_SYSTEM ? PKGSYSCONFDIR "/system.conf" : PKGSYSCONFDIR "/user.conf";
- conf_dirs_nulstr = arg_running_as == SYSTEMD_SYSTEM ? CONF_DIRS_NULSTR("systemd/system.conf") : CONF_DIRS_NULSTR("systemd/user.conf");
+ fn = arg_running_as == MANAGER_SYSTEM ? PKGSYSCONFDIR "/system.conf" : PKGSYSCONFDIR "/user.conf";
+ conf_dirs_nulstr = arg_running_as == MANAGER_SYSTEM ? CONF_DIRS_NULSTR("systemd/system.conf") : CONF_DIRS_NULSTR("systemd/user.conf");
config_parse_many(fn, conf_dirs_nulstr, "Manager\0",
config_item_table_lookup, items, false, NULL);
@@ -814,11 +814,11 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_SYSTEM:
- arg_running_as = SYSTEMD_SYSTEM;
+ arg_running_as = MANAGER_SYSTEM;
break;
case ARG_USER:
- arg_running_as = SYSTEMD_USER;
+ arg_running_as = MANAGER_USER;
break;
case ARG_TEST:
@@ -1275,7 +1275,7 @@ int main(int argc, char *argv[]) {
if (getpid() == 1 && detect_container(NULL) <= 0) {
/* Running outside of a container as PID 1 */
- arg_running_as = SYSTEMD_SYSTEM;
+ arg_running_as = MANAGER_SYSTEM;
make_null_stdio();
log_set_target(LOG_TARGET_KMSG);
log_open();
@@ -1349,7 +1349,7 @@ int main(int argc, char *argv[]) {
} else if (getpid() == 1) {
/* Running inside a container, as PID 1 */
- arg_running_as = SYSTEMD_SYSTEM;
+ arg_running_as = MANAGER_SYSTEM;
log_set_target(LOG_TARGET_CONSOLE);
log_close_console(); /* force reopen of /dev/console */
log_open();
@@ -1364,7 +1364,7 @@ int main(int argc, char *argv[]) {
} else {
/* Running as user instance */
- arg_running_as = SYSTEMD_USER;
+ arg_running_as = MANAGER_USER;
log_set_target(LOG_TARGET_AUTO);
log_open();
@@ -1413,7 +1413,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (arg_running_as == SYSTEMD_SYSTEM) {
+ if (arg_running_as == MANAGER_SYSTEM) {
r = parse_proc_cmdline(parse_proc_cmdline_item);
if (r < 0)
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
@@ -1434,14 +1434,14 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (arg_running_as == SYSTEMD_USER &&
+ if (arg_running_as == MANAGER_USER &&
arg_action == ACTION_RUN &&
sd_booted() <= 0) {
log_error("Trying to run as user instance, but the system has not been booted with systemd.");
goto finish;
}
- if (arg_running_as == SYSTEMD_SYSTEM &&
+ if (arg_running_as == MANAGER_SYSTEM &&
arg_action == ACTION_RUN &&
running_in_chroot() > 0) {
log_error("Cannot be run in a chroot() environment.");
@@ -1468,7 +1468,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (arg_running_as == SYSTEMD_USER &&
+ if (arg_running_as == MANAGER_USER &&
!getenv("XDG_RUNTIME_DIR")) {
log_error("Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.");
goto finish;
@@ -1491,7 +1491,7 @@ int main(int argc, char *argv[]) {
if (arg_serialization)
assert_se(fdset_remove(fds, fileno(arg_serialization)) >= 0);
- if (arg_running_as == SYSTEMD_SYSTEM)
+ if (arg_running_as == MANAGER_SYSTEM)
/* Become a session leader if we aren't one yet. */
setsid();
@@ -1500,7 +1500,7 @@ int main(int argc, char *argv[]) {
/* Reset the console, but only if this is really init and we
* are freshly booted */
- if (arg_running_as == SYSTEMD_SYSTEM && arg_action == ACTION_RUN) {
+ if (arg_running_as == MANAGER_SYSTEM && arg_action == ACTION_RUN) {
/* If we are init, we connect stdin/stdout/stderr to
* /dev/null and make sure we don't have a controlling
@@ -1527,7 +1527,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (arg_running_as == SYSTEMD_SYSTEM) {
+ if (arg_running_as == MANAGER_SYSTEM) {
const char *virtualization = NULL;
log_info(PACKAGE_STRING " running in %ssystem mode. (" SYSTEMD_FEATURES ")",
@@ -1563,7 +1563,7 @@ int main(int argc, char *argv[]) {
arg_action == ACTION_TEST ? " test" : "", getuid(), t);
}
- if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {
+ if (arg_running_as == MANAGER_SYSTEM && !skip_setup) {
if (arg_show_status > 0)
status_welcome();
@@ -1575,7 +1575,7 @@ int main(int argc, char *argv[]) {
test_usr();
}
- if (arg_running_as == SYSTEMD_SYSTEM && arg_runtime_watchdog > 0)
+ if (arg_running_as == MANAGER_SYSTEM && arg_runtime_watchdog > 0)
watchdog_set_timeout(&arg_runtime_watchdog);
if (arg_timer_slack_nsec != NSEC_INFINITY)
@@ -1605,7 +1605,7 @@ int main(int argc, char *argv[]) {
}
}
- if (arg_running_as == SYSTEMD_USER) {
+ if (arg_running_as == MANAGER_USER) {
/* Become reaper of our children */
if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) {
log_warning_errno(errno, "Failed to make us a subreaper: %m");
@@ -1614,7 +1614,7 @@ int main(int argc, char *argv[]) {
}
}
- if (arg_running_as == SYSTEMD_SYSTEM) {
+ if (arg_running_as == MANAGER_SYSTEM) {
bump_rlimit_nofile(&saved_rlimit_nofile);
if (empty_etc) {
@@ -1895,7 +1895,7 @@ finish:
args[i++] = SYSTEMD_BINARY_PATH;
if (switch_root_dir)
args[i++] = "--switched-root";
- args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user";
+ args[i++] = arg_running_as == MANAGER_SYSTEM ? "--system" : "--user";
args[i++] = "--deserialize";
args[i++] = sfd;
args[i++] = NULL;
diff --git a/src/core/manager.c b/src/core/manager.c
index 285abe16d3..28b9427b9d 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -474,7 +474,7 @@ static int manager_setup_signals(Manager *m) {
if (r < 0)
return r;
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
return enable_special_signals(m);
return 0;
@@ -500,7 +500,7 @@ static void manager_clean_environment(Manager *m) {
static int manager_default_environment(Manager *m) {
assert(m);
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
/* The system manager always starts with a clean
* environment for its children. It does not import
* the kernel or the parents exported variables.
@@ -529,16 +529,16 @@ static int manager_default_environment(Manager *m) {
}
-int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
+int manager_new(ManagerRunningAs running_as, bool test_run, Manager **_m) {
- static const char * const unit_log_fields[_SYSTEMD_RUNNING_AS_MAX] = {
- [SYSTEMD_SYSTEM] = "UNIT=",
- [SYSTEMD_USER] = "USER_UNIT=",
+ static const char * const unit_log_fields[_MANAGER_RUNNING_AS_MAX] = {
+ [MANAGER_SYSTEM] = "UNIT=",
+ [MANAGER_USER] = "USER_UNIT=",
};
- static const char * const unit_log_format_strings[_SYSTEMD_RUNNING_AS_MAX] = {
- [SYSTEMD_SYSTEM] = "UNIT=%s",
- [SYSTEMD_USER] = "USER_UNIT=%s",
+ static const char * const unit_log_format_strings[_MANAGER_RUNNING_AS_MAX] = {
+ [MANAGER_SYSTEM] = "UNIT=%s",
+ [MANAGER_USER] = "USER_UNIT=%s",
};
Manager *m;
@@ -546,14 +546,14 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
assert(_m);
assert(running_as >= 0);
- assert(running_as < _SYSTEMD_RUNNING_AS_MAX);
+ assert(running_as < _MANAGER_RUNNING_AS_MAX);
m = new0(Manager, 1);
if (!m)
return -ENOMEM;
#ifdef ENABLE_EFI
- if (running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0)
+ if (running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0)
boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp);
#endif
@@ -678,7 +678,7 @@ static int manager_setup_notify(Manager *m) {
if (fd < 0)
return log_error_errno(errno, "Failed to allocate notification socket: %m");
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
m->notify_socket = strdup("/run/systemd/notify");
else {
const char *e;
@@ -740,12 +740,12 @@ static int manager_setup_kdbus(Manager *m) {
if (!is_kdbus_available())
return -ESOCKTNOSUPPORT;
- if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0)
+ if (m->running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0)
bus_kernel_fix_attach_mask();
m->kdbus_fd = bus_kernel_create_bus(
- m->running_as == SYSTEMD_SYSTEM ? "system" : "user",
- m->running_as == SYSTEMD_SYSTEM, &p);
+ m->running_as == MANAGER_SYSTEM ? "system" : "user",
+ m->running_as == MANAGER_SYSTEM, &p);
if (m->kdbus_fd < 0)
return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
@@ -767,7 +767,7 @@ static int manager_connect_bus(Manager *m, bool reexecuting) {
try_bus_connect =
m->kdbus_fd >= 0 ||
reexecuting ||
- (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS"));
+ (m->running_as == MANAGER_USER && getenv("DBUS_SESSION_BUS_ADDRESS"));
/* Try to connect to the buses, if possible. */
return bus_init(m, try_bus_connect);
@@ -1728,7 +1728,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
}
log_received_signal(sfsi.ssi_signo == SIGCHLD ||
- (sfsi.ssi_signo == SIGTERM && m->running_as == SYSTEMD_USER)
+ (sfsi.ssi_signo == SIGTERM && m->running_as == MANAGER_USER)
? LOG_DEBUG : LOG_INFO,
&sfsi);
@@ -1739,7 +1739,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
break;
case SIGTERM:
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
/* This is for compatibility with the
* original sysvinit */
m->exit_code = MANAGER_REEXECUTE;
@@ -1749,7 +1749,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
/* Fall through */
case SIGINT:
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
/* If the user presses C-A-D more than
* 7 times within 2s, we reboot
@@ -1775,14 +1775,14 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
break;
case SIGWINCH:
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
manager_start_target(m, SPECIAL_KBREQUEST_TARGET, JOB_REPLACE);
/* This is a nop on non-init */
break;
case SIGPWR:
- if (m->running_as == SYSTEMD_SYSTEM)
+ if (m->running_as == MANAGER_SYSTEM)
manager_start_target(m, SPECIAL_SIGPWR_TARGET, JOB_REPLACE);
/* This is a nop on non-init */
@@ -1896,7 +1896,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
break;
case 24:
- if (m->running_as == SYSTEMD_USER) {
+ if (m->running_as == MANAGER_USER) {
m->exit_code = MANAGER_EXIT;
return 0;
}
@@ -2014,7 +2014,7 @@ int manager_loop(Manager *m) {
while (m->exit_code == MANAGER_OK) {
usec_t wait_usec;
- if (m->runtime_watchdog > 0 && m->running_as == SYSTEMD_SYSTEM)
+ if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM)
watchdog_ping();
if (!ratelimit_test(&rl)) {
@@ -2040,7 +2040,7 @@ int manager_loop(Manager *m) {
continue;
/* Sleep for half the watchdog time */
- if (m->runtime_watchdog > 0 && m->running_as == SYSTEMD_SYSTEM) {
+ if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM) {
wait_usec = m->runtime_watchdog / 2;
if (wait_usec <= 0)
wait_usec = 1;
@@ -2120,7 +2120,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
if (m->n_reloading > 0)
return;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return;
if (u->type != UNIT_SERVICE)
@@ -2157,7 +2157,7 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) {
if (m->n_reloading > 0)
return;
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return;
if (detect_container(NULL) > 0)
@@ -2219,7 +2219,7 @@ int manager_open_serialization(Manager *m, FILE **_f) {
assert(_f);
- path = m->running_as == SYSTEMD_SYSTEM ? "/run/systemd" : "/tmp";
+ path = m->running_as == MANAGER_SYSTEM ? "/run/systemd" : "/tmp";
fd = open_tmpfile(path, O_RDWR|O_CLOEXEC);
if (fd < 0)
return -errno;
@@ -2635,7 +2635,7 @@ static void manager_notify_finished(Manager *m) {
if (m->test_run)
return;
- if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) {
+ if (m->running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0) {
/* Note that m->kernel_usec.monotonic is always at 0,
* and m->firmware_usec.monotonic and
@@ -2751,7 +2751,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name)
if (*generator)
return 0;
- if (m->running_as == SYSTEMD_SYSTEM && getpid() == 1) {
+ if (m->running_as == MANAGER_SYSTEM && getpid() == 1) {
/* systemd --system, not running --test */
p = strappend("/run/systemd/", name);
@@ -2764,7 +2764,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name)
free(p);
return r;
}
- } else if (m->running_as == SYSTEMD_USER) {
+ } else if (m->running_as == MANAGER_USER) {
const char *s = NULL;
s = getenv("XDG_RUNTIME_DIR");
@@ -2951,7 +2951,7 @@ void manager_recheck_journal(Manager *m) {
assert(m);
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return;
u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET);
@@ -2975,7 +2975,7 @@ void manager_set_show_status(Manager *m, ShowStatus mode) {
assert(m);
assert(IN_SET(mode, SHOW_STATUS_AUTO, SHOW_STATUS_NO, SHOW_STATUS_YES, SHOW_STATUS_TEMPORARY));
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return;
m->show_status = mode;
@@ -2989,7 +2989,7 @@ void manager_set_show_status(Manager *m, ShowStatus mode) {
static bool manager_get_show_status(Manager *m, StatusType type) {
assert(m);
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return false;
if (m->no_console_output)
@@ -3011,7 +3011,7 @@ static bool manager_get_show_status(Manager *m, StatusType type) {
void manager_set_first_boot(Manager *m, bool b) {
assert(m);
- if (m->running_as != SYSTEMD_SYSTEM)
+ if (m->running_as != MANAGER_SYSTEM)
return;
m->first_boot = b;
@@ -3079,7 +3079,7 @@ Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path) {
const char *manager_get_runtime_prefix(Manager *m) {
assert(m);
- return m->running_as == SYSTEMD_SYSTEM ?
+ return m->running_as == MANAGER_SYSTEM ?
"/run" :
getenv("XDG_RUNTIME_DIR");
}
diff --git a/src/core/manager.h b/src/core/manager.h
index 524cdf97b9..4ef869d14a 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -226,7 +226,7 @@ struct Manager {
int pin_cgroupfs_fd;
/* Flags */
- SystemdRunningAs running_as;
+ ManagerRunningAs running_as;
ManagerExitCode exit_code:5;
bool dispatching_load_queue:1;
@@ -297,7 +297,7 @@ struct Manager {
const char *unit_log_format_string;
};
-int manager_new(SystemdRunningAs running_as, bool test_run, Manager **m);
+int manager_new(ManagerRunningAs running_as, bool test_run, Manager **m);
Manager* manager_free(Manager *m);
int manager_enumerate(Manager *m);
diff --git a/src/core/mount.c b/src/core/mount.c
index 6501be96db..e143f6b6d8 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -320,7 +320,7 @@ static int mount_add_device_links(Mount *m) {
if (path_equal(m->where, "/"))
return 0;
- if (mount_is_auto(p) && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
+ if (mount_is_auto(p) && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
device_wants_mount = true;
r = unit_add_node_link(UNIT(m), p->what, device_wants_mount);
@@ -336,7 +336,7 @@ static int mount_add_quota_links(Mount *m) {
assert(m);
- if (UNIT(m)->manager->running_as != SYSTEMD_SYSTEM)
+ if (UNIT(m)->manager->running_as != MANAGER_SYSTEM)
return 0;
p = get_mount_parameters_fragment(m);
@@ -379,7 +379,7 @@ static int mount_add_default_dependencies(Mount *m) {
assert(m);
- if (UNIT(m)->manager->running_as != SYSTEMD_SYSTEM)
+ if (UNIT(m)->manager->running_as != MANAGER_SYSTEM)
return 0;
/* We do not add any default dependencies to / and /usr, since
@@ -828,7 +828,7 @@ static void mount_enter_unmounting(Mount *m) {
m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
r = exec_command_set(m->control_command, "/bin/umount", m->where, NULL);
- if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
+ if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
r = exec_command_append(m->control_command, "-n", NULL);
if (r < 0)
goto fail;
@@ -880,7 +880,7 @@ static void mount_enter_mounting(Mount *m) {
r = exec_command_set(m->control_command, "/bin/mount",
m->parameters_fragment.what, m->where, NULL);
- if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
+ if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
r = exec_command_append(m->control_command, "-n", NULL);
if (r >= 0 && m->sloppy_options)
r = exec_command_append(m->control_command, "-s", NULL);
@@ -928,7 +928,7 @@ static void mount_enter_remounting(Mount *m) {
r = exec_command_set(m->control_command, "/bin/mount",
m->parameters_fragment.what, m->where,
"-o", o, NULL);
- if (r >= 0 && UNIT(m)->manager->running_as == SYSTEMD_SYSTEM)
+ if (r >= 0 && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
r = exec_command_append(m->control_command, "-n", NULL);
if (r >= 0 && m->sloppy_options)
r = exec_command_append(m->control_command, "-s", NULL);
@@ -1376,7 +1376,7 @@ static int mount_setup_unit(
goto fail;
}
- if (m->running_as == SYSTEMD_SYSTEM) {
+ if (m->running_as == MANAGER_SYSTEM) {
const char* target;
target = mount_needs_network(options, fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
@@ -1404,7 +1404,7 @@ static int mount_setup_unit(
}
}
- if (m->running_as == SYSTEMD_SYSTEM &&
+ if (m->running_as == MANAGER_SYSTEM &&
mount_needs_network(options, fstype)) {
/* _netdev option may have shown up late, or on a
* remount. Add remote-fs dependencies, even though
diff --git a/src/core/path.c b/src/core/path.c
index fc27e33511..6d26d89e82 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -314,7 +314,7 @@ static int path_add_default_dependencies(Path *p) {
if (r < 0)
return r;
- if (UNIT(p)->manager->running_as == SYSTEMD_SYSTEM) {
+ if (UNIT(p)->manager->running_as == MANAGER_SYSTEM) {
r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, UNIT_REQUIRES,
SPECIAL_SYSINIT_TARGET, NULL, true);
if (r < 0)
diff --git a/src/core/service.c b/src/core/service.c
index d11bcb1028..0842ef1b94 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1121,7 +1121,7 @@ static int service_spawn(
goto fail;
}
- if (UNIT(s)->manager->running_as != SYSTEMD_SYSTEM)
+ if (UNIT(s)->manager->running_as != MANAGER_SYSTEM)
if (asprintf(our_env + n_env++, "MANAGERPID="PID_FMT, getpid()) < 0) {
r = -ENOMEM;
goto fail;
@@ -1181,7 +1181,7 @@ static int service_spawn(
#ifdef ENABLE_KDBUS
if (s->exec_context.bus_endpoint) {
- r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == SYSTEMD_SYSTEM ? "system" : "user",
+ r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == MANAGER_SYSTEM ? "system" : "user",
UNIT(s)->id, &bus_endpoint_path);
if (r < 0)
goto fail;
diff --git a/src/core/socket.c b/src/core/socket.c
index 33682073c9..a655ec9d58 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -284,7 +284,7 @@ static int socket_add_default_dependencies(Socket *s) {
if (r < 0)
return r;
- if (UNIT(s)->manager->running_as == SYSTEMD_SYSTEM) {
+ if (UNIT(s)->manager->running_as == MANAGER_SYSTEM) {
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
if (r < 0)
return r;
diff --git a/src/core/swap.c b/src/core/swap.c
index 1cf3f2a864..12ebf84f62 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -201,7 +201,7 @@ static int swap_add_device_links(Swap *s) {
return 0;
if (is_device_path(s->what))
- return unit_add_node_link(UNIT(s), s->what, UNIT(s)->manager->running_as == SYSTEMD_SYSTEM);
+ return unit_add_node_link(UNIT(s), s->what, UNIT(s)->manager->running_as == MANAGER_SYSTEM);
else
/* File based swap devices need to be ordered after
* systemd-remount-fs.service, since they might need a
@@ -212,7 +212,7 @@ static int swap_add_device_links(Swap *s) {
static int swap_add_default_dependencies(Swap *s) {
assert(s);
- if (UNIT(s)->manager->running_as != SYSTEMD_SYSTEM)
+ if (UNIT(s)->manager->running_as != MANAGER_SYSTEM)
return 0;
if (detect_container(NULL) > 0)
diff --git a/src/core/timer.c b/src/core/timer.c
index eb73b64a48..d427956e0c 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -102,7 +102,7 @@ static int timer_add_default_dependencies(Timer *t) {
if (r < 0)
return r;
- if (UNIT(t)->manager->running_as == SYSTEMD_SYSTEM) {
+ if (UNIT(t)->manager->running_as == MANAGER_SYSTEM) {
r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
if (r < 0)
return r;
@@ -128,7 +128,7 @@ static int timer_setup_persistent(Timer *t) {
if (!t->persistent)
return 0;
- if (UNIT(t)->manager->running_as == SYSTEMD_SYSTEM) {
+ if (UNIT(t)->manager->running_as == MANAGER_SYSTEM) {
r = unit_require_mounts_for(UNIT(t), "/var/lib/systemd/timers");
if (r < 0)
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index 8050e2fd66..0889769d03 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -140,7 +140,7 @@ static int specifier_runtime(char specifier, void *data, void *userdata, char **
assert(u);
- if (u->manager->running_as == SYSTEMD_SYSTEM)
+ if (u->manager->running_as == MANAGER_SYSTEM)
e = "/run";
else {
e = getenv("XDG_RUNTIME_DIR");
@@ -168,7 +168,7 @@ static int specifier_user_name(char specifier, void *data, void *userdata, char
if (!c)
return -EINVAL;
- if (u->manager->running_as == SYSTEMD_SYSTEM) {
+ if (u->manager->running_as == MANAGER_SYSTEM) {
/* We cannot use NSS from PID 1, hence try to make the
* best of it in that case, and fail if we can't help
@@ -231,7 +231,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char
if (!c)
return -EOPNOTSUPP;
- if (u->manager->running_as == SYSTEMD_SYSTEM) {
+ if (u->manager->running_as == MANAGER_SYSTEM) {
/* We cannot use NSS from PID 1, hence try to make the
* best of it if we can, but fail if we can't */
@@ -279,7 +279,7 @@ static int specifier_user_shell(char specifier, void *data, void *userdata, char
if (!c)
return -EOPNOTSUPP;
- if (u->manager->running_as == SYSTEMD_SYSTEM) {
+ if (u->manager->running_as == MANAGER_SYSTEM) {
/* We cannot use NSS from PID 1, hence try to make the
* best of it if we can, but fail if we can't */
diff --git a/src/core/unit.c b/src/core/unit.c
index 0a1278c2a1..1c1d9cf896 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -804,7 +804,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
return r;
}
- if (u->manager->running_as != SYSTEMD_SYSTEM)
+ if (u->manager->running_as != MANAGER_SYSTEM)
return 0;
if (c->private_tmp) {
@@ -2456,7 +2456,7 @@ int unit_add_default_slice(Unit *u, CGroupContext *c) {
if (!escaped)
return -ENOMEM;
- if (u->manager->running_as == SYSTEMD_SYSTEM)
+ if (u->manager->running_as == MANAGER_SYSTEM)
b = strjoin("system-", escaped, ".slice", NULL);
else
b = strappend(escaped, ".slice");
@@ -2466,7 +2466,7 @@ int unit_add_default_slice(Unit *u, CGroupContext *c) {
slice_name = b;
} else
slice_name =
- u->manager->running_as == SYSTEMD_SYSTEM
+ u->manager->running_as == MANAGER_SYSTEM
? SPECIAL_SYSTEM_SLICE
: SPECIAL_ROOT_SLICE;
@@ -2836,7 +2836,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
if (r < 0)
return r;
- r = unit_add_two_dependencies(u, UNIT_AFTER, u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_BINDS_TO : UNIT_WANTS, device, true);
+ r = unit_add_two_dependencies(u, UNIT_AFTER, u->manager->running_as == MANAGER_SYSTEM ? UNIT_BINDS_TO : UNIT_WANTS, device, true);
if (r < 0)
return r;
@@ -3111,7 +3111,7 @@ UnitFileState unit_get_unit_file_state(Unit *u) {
if (u->unit_file_state < 0 && u->fragment_path)
u->unit_file_state = unit_file_get_state(
- u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
+ u->manager->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
NULL, basename(u->fragment_path));
return u->unit_file_state;
@@ -3122,7 +3122,7 @@ int unit_get_unit_file_preset(Unit *u) {
if (u->unit_file_preset < 0 && u->fragment_path)
u->unit_file_preset = unit_file_query_preset(
- u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
+ u->manager->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
NULL, basename(u->fragment_path));
return u->unit_file_preset;
@@ -3172,7 +3172,7 @@ int unit_patch_contexts(Unit *u) {
return -ENOMEM;
}
- if (u->manager->running_as == SYSTEMD_USER &&
+ if (u->manager->running_as == MANAGER_USER &&
!ec->working_directory) {
r = get_home_dir(&ec->working_directory);
@@ -3184,7 +3184,7 @@ int unit_patch_contexts(Unit *u) {
ec->working_directory_missing_ok = true;
}
- if (u->manager->running_as == SYSTEMD_USER &&
+ if (u->manager->running_as == MANAGER_USER &&
(ec->syscall_whitelist ||
!set_isempty(ec->syscall_filter) ||
!set_isempty(ec->syscall_archs) ||
@@ -3263,7 +3263,7 @@ ExecRuntime *unit_get_exec_runtime(Unit *u) {
}
static int unit_drop_in_dir(Unit *u, UnitSetPropertiesMode mode, bool transient, char **dir) {
- if (u->manager->running_as == SYSTEMD_USER) {
+ if (u->manager->running_as == MANAGER_USER) {
int r;
if (mode == UNIT_PERSISTENT && !transient)
@@ -3432,7 +3432,7 @@ int unit_make_transient(Unit *u) {
free(u->fragment_path);
u->fragment_path = NULL;
- if (u->manager->running_as == SYSTEMD_USER) {
+ if (u->manager->running_as == MANAGER_USER) {
_cleanup_free_ char *c = NULL;
r = user_runtime_dir(&c);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index fb2c2c233a..f6a127174c 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -218,8 +218,8 @@ static char** user_dirs(
return tmp;
}
-char **generator_paths(SystemdRunningAs running_as) {
- if (running_as == SYSTEMD_USER)
+char **generator_paths(ManagerRunningAs running_as) {
+ if (running_as == MANAGER_USER)
return strv_new("/run/systemd/user-generators",
"/etc/systemd/user-generators",
"/usr/local/lib/systemd/user-generators",
@@ -235,7 +235,7 @@ char **generator_paths(SystemdRunningAs running_as) {
int lookup_paths_init(
LookupPaths *p,
- SystemdRunningAs running_as,
+ ManagerRunningAs running_as,
bool personal,
const char *root_dir,
const char *generator,
@@ -277,7 +277,7 @@ int lookup_paths_init(
* we include /lib in the search path for the system
* stuff but avoid it for user stuff. */
- if (running_as == SYSTEMD_USER) {
+ if (running_as == MANAGER_USER) {
if (personal)
unit_path = user_dirs(generator, generator_early, generator_late);
else
@@ -337,7 +337,7 @@ int lookup_paths_init(
p->unit_path = NULL;
}
- if (running_as == SYSTEMD_SYSTEM) {
+ if (running_as == MANAGER_SYSTEM) {
#ifdef HAVE_SYSV_COMPAT
/* /etc/init.d/ compatibility does not matter to users */
@@ -437,7 +437,7 @@ int lookup_paths_init_from_scope(LookupPaths *paths,
zero(*paths);
return lookup_paths_init(paths,
- scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
+ scope == UNIT_FILE_SYSTEM ? MANAGER_SYSTEM : MANAGER_USER,
scope == UNIT_FILE_USER,
root_dir,
NULL, NULL, NULL);
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index f1925eef69..31b2df3c14 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -33,20 +33,20 @@ typedef struct LookupPaths {
#endif
} LookupPaths;
-typedef enum SystemdRunningAs {
- SYSTEMD_SYSTEM,
- SYSTEMD_USER,
- _SYSTEMD_RUNNING_AS_MAX,
- _SYSTEMD_RUNNING_AS_INVALID = -1
-} SystemdRunningAs;
+typedef enum ManagerRunningAs {
+ MANAGER_SYSTEM,
+ MANAGER_USER,
+ _MANAGER_RUNNING_AS_MAX,
+ _MANAGER_RUNNING_AS_INVALID = -1
+} ManagerRunningAs;
int user_config_home(char **config_home);
int user_runtime_dir(char **runtime_dir);
-char **generator_paths(SystemdRunningAs running_as);
+char **generator_paths(ManagerRunningAs running_as);
int lookup_paths_init(LookupPaths *p,
- SystemdRunningAs running_as,
+ ManagerRunningAs running_as,
bool personal,
const char *root_dir,
const char *generator,
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e4b301af73..d48160e008 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5111,7 +5111,7 @@ static int enable_sysv_units(const char *verb, char **args) {
/* Processes all SysV units, and reshuffles the array so that
* afterwards only the native units remain */
- r = lookup_paths_init(&paths, SYSTEMD_SYSTEM, false, arg_root, NULL, NULL, NULL);
+ r = lookup_paths_init(&paths, MANAGER_SYSTEM, false, arg_root, NULL, NULL, NULL);
if (r < 0)
return r;
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index aecae801b7..9ae518ac4a 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -931,7 +931,7 @@ int main(int argc, char *argv[]) {
umask(0022);
- r = lookup_paths_init(&lp, SYSTEMD_SYSTEM, true, NULL, NULL, NULL, NULL);
+ r = lookup_paths_init(&lp, MANAGER_SYSTEM, true, NULL, NULL, NULL, NULL);
if (r < 0) {
log_error("Failed to find lookup paths.");
return EXIT_FAILURE;
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c
index d14a07e1f4..289dddbaac 100644
--- a/src/test/test-cgroup-mask.c
+++ b/src/test/test-cgroup-mask.c
@@ -35,7 +35,7 @@ static int test_cgroup_mask(void) {
/* Prepare the manager. */
assert_se(set_unit_path(TEST_DIR) >= 0);
- r = manager_new(SYSTEMD_USER, true, &m);
+ r = manager_new(MANAGER_USER, true, &m);
if (r == -EPERM || r == -EACCES) {
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;
diff --git a/src/test/test-engine.c b/src/test/test-engine.c
index d543d23b7a..a7ab21a415 100644
--- a/src/test/test-engine.c
+++ b/src/test/test-engine.c
@@ -37,7 +37,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */
assert_se(set_unit_path(TEST_DIR) >= 0);
- r = manager_new(SYSTEMD_USER, true, &m);
+ r = manager_new(MANAGER_USER, true, &m);
if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return EXIT_TEST_SKIP;
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index a84a9254f9..0f4172e722 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) {
assert_se(set_unit_path(TEST_DIR) >= 0);
- r = manager_new(SYSTEMD_USER, true, &m);
+ r = manager_new(MANAGER_USER, true, &m);
if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return EXIT_TEST_SKIP;
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index 66b0b99741..aa4bac6cdd 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -26,7 +26,7 @@
#include "strv.h"
#include "rm-rf.h"
-static void test_paths(SystemdRunningAs running_as, bool personal) {
+static void test_paths(ManagerRunningAs running_as, bool personal) {
char template[] = "/tmp/test-path-lookup.XXXXXXX";
_cleanup_lookup_paths_free_ LookupPaths lp = {};
@@ -46,11 +46,11 @@ static void test_paths(SystemdRunningAs running_as, bool personal) {
assert_se(rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0);
}
-static void print_generator_paths(SystemdRunningAs running_as) {
+static void print_generator_paths(ManagerRunningAs running_as) {
_cleanup_strv_free_ char **paths;
char **dir;
- log_info("Generators dirs (%s):", running_as == SYSTEMD_SYSTEM ? "system" : "user");
+ log_info("Generators dirs (%s):", running_as == MANAGER_SYSTEM ? "system" : "user");
paths = generator_paths(running_as);
STRV_FOREACH(dir, paths)
@@ -62,13 +62,13 @@ int main(int argc, char **argv) {
log_parse_environment();
log_open();
- test_paths(SYSTEMD_SYSTEM, false);
- test_paths(SYSTEMD_SYSTEM, true);
- test_paths(SYSTEMD_USER, false);
- test_paths(SYSTEMD_USER, true);
+ test_paths(MANAGER_SYSTEM, false);
+ test_paths(MANAGER_SYSTEM, true);
+ test_paths(MANAGER_USER, false);
+ test_paths(MANAGER_USER, true);
- print_generator_paths(SYSTEMD_SYSTEM);
- print_generator_paths(SYSTEMD_USER);
+ print_generator_paths(MANAGER_SYSTEM);
+ print_generator_paths(MANAGER_USER);
return EXIT_SUCCESS;
}
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 0504ae76bb..5d190378f1 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -39,7 +39,7 @@ static int setup_test(Manager **m) {
assert_se(m);
- r = manager_new(SYSTEMD_USER, true, &tmp);
+ r = manager_new(MANAGER_USER, true, &tmp);
if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return -EXIT_TEST_SKIP;
diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c
index 6b3128d3b7..f915539e00 100644
--- a/src/test/test-sched-prio.c
+++ b/src/test/test-sched-prio.c
@@ -34,7 +34,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */
assert_se(set_unit_path(TEST_DIR) >= 0);
- r = manager_new(SYSTEMD_USER, true, &m);
+ r = manager_new(MANAGER_USER, true, &m);
if (IN_SET(r, -EPERM, -EACCES, -EADDRINUSE, -EHOSTDOWN, -ENOENT)) {
printf("Skipping test: manager_new: %s", strerror(-r));
return EXIT_TEST_SKIP;
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index de8f7ddfa8..5053d69d1d 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -200,7 +200,7 @@ static int test_unit_printf(void) {
assert_se((root = getpwnam("root")));
assert_se(asprintf(&root_uid, "%d", (int) root->pw_uid) > 0);
- r = manager_new(SYSTEMD_USER, true, &m);
+ r = manager_new(MANAGER_USER, true, &m);
if (r == -EPERM || r == -EACCES || r == -EADDRINUSE) {
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;