diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-11 00:50:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-11 00:50:04 +0200 |
commit | 96490500cffcd5771ee29c939151d87b0673507e (patch) | |
tree | 9ecad208b287a4de1aeec1fcb0ea579837f9612e /src/shared | |
parent | 6f45f8ca76651a9658494eef1d99bae98819a9a0 (diff) | |
parent | 185a08745957cbd32e8293daf8c51ab9c995a71e (diff) |
Merge pull request #6 from xnox/drop-name
shared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/cgroup-util.c | 24 | ||||
-rw-r--r-- | src/shared/cgroup-util.h | 2 | ||||
-rw-r--r-- | src/shared/def.h | 2 |
3 files changed, 12 insertions, 16 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index 9988e5c574..d83cdf7e5f 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -441,9 +441,7 @@ static const char *normalize_controller(const char *controller) { assert(controller); - if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) - return "systemd"; - else if (startswith(controller, "name=")) + if (startswith(controller, "name=")) return controller + 5; else return controller; @@ -483,7 +481,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch assert(fs); - if (controller && !cg_controller_is_valid(controller, true)) + if (controller && !cg_controller_is_valid(controller)) return -EINVAL; if (_unlikely_(!good)) { @@ -526,7 +524,7 @@ int cg_get_path_and_check(const char *controller, const char *path, const char * assert(fs); - if (!cg_controller_is_valid(controller, true)) + if (!cg_controller_is_valid(controller)) return -EINVAL; /* Normalize the controller syntax */ @@ -742,7 +740,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) { assert(pid >= 0); if (controller) { - if (!cg_controller_is_valid(controller, true)) + if (!cg_controller_is_valid(controller)) return -EINVAL; controller = normalize_controller(controller); @@ -971,7 +969,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) { e = strchr(spec, ':'); if (!e) { - if (!cg_controller_is_valid(spec, true)) + if (!cg_controller_is_valid(spec)) return -EINVAL; if (controller) { @@ -994,7 +992,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) { t = strdup(normalize_controller(v)); if (!t) return -ENOMEM; - if (!cg_controller_is_valid(t, true)) { + if (!cg_controller_is_valid(t)) { free(t); return -EINVAL; } @@ -1610,17 +1608,15 @@ char *cg_unescape(const char *p) { DIGITS LETTERS \ "_" -bool cg_controller_is_valid(const char *p, bool allow_named) { +bool cg_controller_is_valid(const char *p) { const char *t, *s; if (!p) return false; - if (allow_named) { - s = startswith(p, "name="); - if (s) - p = s; - } + s = startswith(p, "name="); + if (s) + p = s; if (*p == 0 || *p == '_') return false; diff --git a/src/shared/cgroup-util.h b/src/shared/cgroup-util.h index cbf7201370..fd72e9e5c5 100644 --- a/src/shared/cgroup-util.h +++ b/src/shared/cgroup-util.h @@ -122,7 +122,7 @@ int cg_path_decode_unit(const char *cgroup, char **unit); char *cg_escape(const char *p); char *cg_unescape(const char *p) _pure_; -bool cg_controller_is_valid(const char *p, bool allow_named); +bool cg_controller_is_valid(const char *p); int cg_slice_to_path(const char *unit, char **ret); diff --git a/src/shared/def.h b/src/shared/def.h index a3d9fcf388..011c7c667e 100644 --- a/src/shared/def.h +++ b/src/shared/def.h @@ -35,7 +35,7 @@ * the watchdog pings will keep the loop busy. */ #define DEFAULT_EXIT_USEC (30*USEC_PER_SEC) -#define SYSTEMD_CGROUP_CONTROLLER "name=systemd" +#define SYSTEMD_CGROUP_CONTROLLER "systemd" #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT #define SIGNALS_IGNORE SIGPIPE |