core: rename SystemdRunningAs to ManagerRunningAs
authorLennart Poettering <lennart@poettering.net>
Mon, 11 May 2015 20:51:49 +0000 (22:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 May 2015 20:51:49 +0000 (22:51 +0200)
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.

34 files changed:
src/analyze/analyze-verify.c
src/analyze/analyze-verify.h
src/analyze/analyze.c
src/core/automount.c
src/core/busname.c
src/core/cgroup.c
src/core/dbus-manager.c
src/core/dbus.c
src/core/device.c
src/core/failure-action.c
src/core/job.c
src/core/load-fragment.c
src/core/main.c
src/core/manager.c
src/core/manager.h
src/core/mount.c
src/core/path.c
src/core/service.c
src/core/socket.c
src/core/swap.c
src/core/timer.c
src/core/unit-printf.c
src/core/unit.c
src/shared/path-lookup.c
src/shared/path-lookup.h
src/systemctl/systemctl.c
src/sysv-generator/sysv-generator.c
src/test/test-cgroup-mask.c
src/test/test-engine.c
src/test/test-execute.c
src/test/test-path-lookup.c
src/test/test-path.c
src/test/test-sched-prio.c
src/test/test-unit-name.c

index e7df55f..f4255f9 100644 (file)
@@ -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;
index f10c34c..d2d4a7f 100644 (file)
@@ -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);
index 17fc5c8..9583458 100644 (file)
@@ -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;
index b747c6f..13f80c2 100644 (file)
@@ -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);
index 2010ec0..eb95c8e 100644 (file)
@@ -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");
index e337c0f..6474e08 100644 (file)
@@ -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");
index 18a379f..d8b39bd 100644 (file)
@@ -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)
index 1679242..86886e6 100644 (file)
@@ -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 */
index a0eb0f4..8eca4c2 100644 (file)
@@ -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;
index 7c6abb3..b06a7d2 100644 (file)
@@ -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 */
 
index 49fcac9..9ad1f73 100644 (file)
@@ -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))
index 970120a..33d9e27 100644 (file)
@@ -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;
index ac2f117..08e84d8 100644 (file)
@@ -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;
index 285abe1..28b9427 100644 (file)
@@ -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");
 }
index 524cdf9..4ef869d 100644 (file)
@@ -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);
index 6501be9..e143f6b 100644 (file)
@@ -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
index fc27e33..6d26d89 100644 (file)
@@ -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)
index d11bcb1..0842ef1 100644 (file)
@@ -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;
index 3368207..a655ec9 100644 (file)
@@ -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;
index 1cf3f2a..12ebf84 100644 (file)
@@ -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)
index eb73b64..d427956 100644 (file)
@@ -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)
index 8050e2f..0889769 100644 (file)
@@ -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 */
index 0a1278c..1c1d9cf 100644 (file)
@@ -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);
index fb2c2c2..f6a1271 100644 (file)
@@ -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);
index f1925ee..31b2df3 100644 (file)
@@ -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,
index e4b301a..d48160e 100644 (file)
@@ -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;
 
index aecae80..9ae518a 100644 (file)
@@ -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;
index d14a07e..289dddb 100644 (file)
@@ -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;
index d543d23..a7ab21a 100644 (file)
@@ -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;
index a84a925..0f4172e 100644 (file)
@@ -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;
index 66b0b99..aa4bac6 100644 (file)
@@ -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;
 }
index 0504ae7..5d19037 100644 (file)
@@ -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;
index 6b3128d..f915539 100644 (file)
@@ -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;
index de8f7dd..5053d69 100644 (file)
@@ -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;