From fac657c58ae86c747674391e477d9af043b29e2e Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Tue, 7 Feb 2017 06:50:04 +0100 Subject: [PATCH] Remove src/basic/special.h, as all defines in there are systemd-only. --- src/basic/cgroup-util.c | 7 ++- src/basic/special.h | 120 ---------------------------------------- src/core/cgroup.c | 11 +++- src/login/logind-dbus.c | 2 +- src/login/logind-user.c | 8 +-- src/login/logind-utmp.c | 2 +- 6 files changed, 21 insertions(+), 129 deletions(-) delete mode 100644 src/basic/special.h diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 95f6faf81..f8386f01c 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -37,7 +37,7 @@ #include "path-util.h" #include "unit-name.h" #include "fileio.h" -#include "special.h" +// #include "special.h" #include "mkdir.h" #include "login-util.h" #include "cgroup-util.h" @@ -1155,7 +1155,7 @@ int cg_mangle_path(const char *path, char **result) { } int cg_get_root_path(char **path) { - char *p, *e; + char *p; //, *e; int r; assert(path); @@ -1164,6 +1164,8 @@ int cg_get_root_path(char **path) { if (r < 0) return r; +/// elogind does not support systemd scopes and slices +#if 0 e = endswith(p, "/" SPECIAL_INIT_SCOPE); if (!e) e = endswith(p, "/" SPECIAL_SYSTEM_SLICE); /* legacy */ @@ -1171,6 +1173,7 @@ int cg_get_root_path(char **path) { e = endswith(p, "/system"); /* even more legacy */ if (e) *e = 0; +#endif // 0 *path = p; return 0; diff --git a/src/basic/special.h b/src/basic/special.h deleted file mode 100644 index fe377fbce..000000000 --- a/src/basic/special.h +++ /dev/null @@ -1,120 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#pragma once - -/*** - This file is part of systemd. - - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -#define SPECIAL_DEFAULT_TARGET "default.target" - -/* Shutdown targets */ -#define SPECIAL_UMOUNT_TARGET "umount.target" -/* This is not really intended to be started by directly. This is - * mostly so that other targets (reboot/halt/poweroff) can depend on - * it to bring all services down that want to be brought down on - * system shutdown. */ -#define SPECIAL_SHUTDOWN_TARGET "shutdown.target" -// #define SPECIAL_HALT_TARGET "halt.target" -// #define SPECIAL_POWEROFF_TARGET "poweroff.target" -// #define SPECIAL_REBOOT_TARGET "reboot.target" -// #define SPECIAL_KEXEC_TARGET "kexec.target" -#define SPECIAL_EXIT_TARGET "exit.target" -// #define SPECIAL_SUSPEND_TARGET "suspend.target" -// #define SPECIAL_HIBERNATE_TARGET "hibernate.target" -// #define SPECIAL_HYBRID_SLEEP_TARGET "hybrid-sleep.target" - -/* Special boot targets */ -#define SPECIAL_RESCUE_TARGET "rescue.target" -#define SPECIAL_EMERGENCY_TARGET "emergency.target" -#define SPECIAL_MULTI_USER_TARGET "multi-user.target" -#define SPECIAL_GRAPHICAL_TARGET "graphical.target" - -/* Early boot targets */ -#define SPECIAL_SYSINIT_TARGET "sysinit.target" -#define SPECIAL_SOCKETS_TARGET "sockets.target" -#define SPECIAL_BUSNAMES_TARGET "busnames.target" -#define SPECIAL_TIMERS_TARGET "timers.target" -#define SPECIAL_PATHS_TARGET "paths.target" -#define SPECIAL_LOCAL_FS_TARGET "local-fs.target" -#define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target" -#define SPECIAL_INITRD_FS_TARGET "initrd-fs.target" -#define SPECIAL_INITRD_ROOT_FS_TARGET "initrd-root-fs.target" -#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */ -#define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target" -#define SPECIAL_SWAP_TARGET "swap.target" -#define SPECIAL_NETWORK_ONLINE_TARGET "network-online.target" -#define SPECIAL_TIME_SYNC_TARGET "time-sync.target" /* LSB's $time */ -#define SPECIAL_BASIC_TARGET "basic.target" - -/* LSB compatibility */ -#define SPECIAL_NETWORK_TARGET "network.target" /* LSB's $network */ -#define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target" /* LSB's $named */ -#define SPECIAL_RPCBIND_TARGET "rpcbind.target" /* LSB's $portmap */ - -/* - * Rules regarding adding further high level targets like the above: - * - * - Be conservative, only add more of these when we really need - * them. We need strong usecases for further additions. - * - * - When there can be multiple implementations running side-by-side, - * it needs to be a .target unit which can pull in all - * implementations. - * - * - If something can be implemented with socket activation, and - * without, it needs to be a .target unit, so that it can pull in - * the appropriate unit. - * - * - Otherwise, it should be a .service unit. - * - * - In some cases it is OK to have both a .service and a .target - * unit, i.e. if there can be multiple parallel implementations, but - * only one is the "system" one. Example: syslog. - * - * Or to put this in other words: .service symlinks can be used to - * arbitrate between multiple implementations if there can be only one - * of a kind. .target units can be used to support multiple - * implementations that can run side-by-side. - */ - -/* Magic early boot services */ -#define SPECIAL_FSCK_SERVICE "systemd-fsck@.service" -#define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service" -#define SPECIAL_QUOTAON_SERVICE "quotaon.service" -#define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service" - -/* Services systemd relies on */ -#define SPECIAL_DBUS_SERVICE "dbus.service" -#define SPECIAL_DBUS_SOCKET "dbus.socket" -#define SPECIAL_JOURNALD_SOCKET "systemd-journald.socket" -#define SPECIAL_JOURNALD_SERVICE "systemd-journald.service" - -/* Magic init signals */ -#define SPECIAL_KBREQUEST_TARGET "kbrequest.target" -#define SPECIAL_SIGPWR_TARGET "sigpwr.target" -#define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target" - -/* Where we add all our system units, users and machines by default */ -#define SPECIAL_SYSTEM_SLICE "system.slice" -#define SPECIAL_USER_SLICE "user.slice" -#define SPECIAL_MACHINE_SLICE "machine.slice" -#define SPECIAL_ROOT_SLICE "-.slice" - -/* The scope unit systemd itself lives in. */ -#define SPECIAL_INIT_SCOPE "init.scope" diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 9b0339aae..b517415ce 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -24,7 +24,7 @@ #include "process-util.h" #include "path-util.h" -#include "special.h" +// #include "special.h" #include "cgroup-util.h" #include "cgroup.h" @@ -1233,6 +1233,8 @@ int manager_setup_cgroup(Manager *m) { if (r < 0) return log_error_errno(r, "Cannot determine cgroup we are running in: %m"); +/// elogind does not support systemd scopes and slices +#if 0 /* Chop off the init scope, if we are already located in it */ e = endswith(m->cgroup_root, "/" SPECIAL_INIT_SCOPE); @@ -1247,6 +1249,7 @@ int manager_setup_cgroup(Manager *m) { } if (e) *e = 0; +#endif // 0 /* And make sure to store away the root value without trailing * slash, even for the root dir, so that we can easily prepend @@ -1313,9 +1316,15 @@ int manager_setup_cgroup(Manager *m) { log_debug("Release agent already installed."); } +/// elogind is not meant to run in systemd init scope +#if 0 /* 4. Make sure we are in the special "init.scope" unit in the root slice. */ scope_path = strjoina(m->cgroup_root, "/" SPECIAL_INIT_SCOPE); r = cg_create_and_attach(ELOGIND_CGROUP_CONTROLLER, scope_path, 0); +#else + scope_path = strjoina(m->cgroup_root, "/elogind"); + r = cg_create_and_attach(ELOGIND_CGROUP_CONTROLLER, scope_path, 0); +#endif // 0 if (r < 0) return log_error_errno(r, "Failed to create %s control group: %m", scope_path); diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index b0c15e253..ef0c13bc0 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -28,7 +28,7 @@ #include "strv.h" #include "mkdir.h" #include "path-util.h" -#include "special.h" +// #include "special.h" #include "sleep-config.h" #include "fileio-label.h" #include "unit-name.h" diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 2733117c6..54c210835 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -30,7 +30,7 @@ #include "hashmap.h" #include "fileio.h" #include "path-util.h" -#include "special.h" +// #include "special.h" #include "unit-name.h" #include "bus-util.h" #include "bus-error.h" @@ -409,26 +409,26 @@ static int user_start_slice(User *u) { char lu[DECIMAL_STR_MAX(uid_t) + 1], *slice; sprintf(lu, UID_FMT, u->uid); - r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &slice); + r = slice_build_subslice("user", lu, &slice); if (r < 0) return r; /// elogind : Do not try to use dbus to ask systemd #if 0 r = manager_start_unit(u->manager, slice, &error, &job); -#endif // 0 if (r < 0) { log_error("Failed to start user slice: %s", bus_error_message(&error, r)); free(slice); } else { +#endif // 0 u->slice = slice; /// elogind does not support slice jobs #if 0 free(u->slice_job); u->slice_job = job; -#endif // 0 } +#endif // 0 } if (u->slice) diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c index 1e13ff01d..faa4fc733 100644 --- a/src/login/logind-utmp.c +++ b/src/login/logind-utmp.c @@ -26,7 +26,7 @@ #include "sd-messages.h" #include "strv.h" -#include "special.h" +// #include "special.h" #include "unit-name.h" #include "audit.h" #include "bus-util.h" -- 2.30.2