chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core/mount: remove "fail" again
[elogind.git]
/
src
/
core
/
scope.c
diff --git
a/src/core/scope.c
b/src/core/scope.c
index e8f9e8dd738ab56faaf5cfa3b678684f21af9c38..e0da6e4db7965739cd99ad5444b5816ebcc1599b 100644
(file)
--- a/
src/core/scope.c
+++ b/
src/core/scope.c
@@
-133,7
+133,7
@@
static int scope_verify(Scope *s) {
return 0;
if (set_isempty(UNIT(s)->pids) && UNIT(s)->manager->n_reloading <= 0) {
return 0;
if (set_isempty(UNIT(s)->pids) && UNIT(s)->manager->n_reloading <= 0) {
- log_
error_unit
(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id);
+ log_
unit_error
(UNIT(s)->id, "Scope %s has no PIDs. Refusing.", UNIT(s)->id);
return -EINVAL;
}
return -EINVAL;
}
@@
-243,7
+243,7
@@
static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
r = unit_kill_context(
UNIT(s),
&s->kill_context,
r = unit_kill_context(
UNIT(s),
&s->kill_context,
- state != SCOPE_STOP_SIGTERM,
+ state != SCOPE_STOP_SIGTERM
? KILL_KILL : KILL_TERMINATE
,
-1, -1, false);
if (r < 0)
goto fail;
-1, -1, false);
if (r < 0)
goto fail;
@@
-264,7
+264,7
@@
static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
return;
fail:
return;
fail:
- log_
warning_unit
(UNIT(s)->id,
+ log_
unit_warning
(UNIT(s)->id,
"%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
scope_enter_dead(s, SCOPE_FAILURE_RESOURCES);
"%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
scope_enter_dead(s, SCOPE_FAILURE_RESOURCES);
@@
-288,13
+288,7
@@
static int scope_start(Unit *u) {
if (!u->transient && UNIT(s)->manager->n_reloading <= 0)
return -ENOENT;
if (!u->transient && UNIT(s)->manager->n_reloading <= 0)
return -ENOENT;
- r = unit_realize_cgroup(u);
- if (r < 0) {
- log_error("Failed to realize cgroup: %s", strerror(-r));
- return r;
- }
-
- r = cg_attach_many_everywhere(u->manager->cgroup_supported, u->cgroup_path, UNIT(s)->pids);
+ r = unit_attach_pids_to_cgroup(u);
if (r < 0)
return r;
if (r < 0)
return r;
@@
-384,15
+378,14
@@
static int scope_deserialize_item(Unit *u, const char *key, const char *value, F
}
static bool scope_check_gc(Unit *u) {
}
static bool scope_check_gc(Unit *u) {
- Scope *s = SCOPE(u);
- int r;
-
- assert(s);
+ assert(u);
/* Never clean up scopes that still have a process around,
* even if the scope is formally dead. */
if (u->cgroup_path) {
/* Never clean up scopes that still have a process around,
* even if the scope is formally dead. */
if (u->cgroup_path) {
+ int r;
+
r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, true);
if (r <= 0)
return true;
r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, true);
if (r <= 0)
return true;
@@
-405,7
+398,7
@@
static void scope_notify_cgroup_empty_event(Unit *u) {
Scope *s = SCOPE(u);
assert(u);
Scope *s = SCOPE(u);
assert(u);
- log_
debug_unit
(u->id, "%s: cgroup is empty", u->id);
+ log_
unit_debug
(u->id, "%s: cgroup is empty", u->id);
if (IN_SET(s->state, SCOPE_RUNNING, SCOPE_ABANDONED, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL))
scope_enter_dead(s, SCOPE_SUCCESS);
if (IN_SET(s->state, SCOPE_RUNNING, SCOPE_ABANDONED, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL))
scope_enter_dead(s, SCOPE_SUCCESS);
@@
-437,17
+430,17
@@
static int scope_dispatch_timer(sd_event_source *source, usec_t usec, void *user
case SCOPE_STOP_SIGTERM:
if (s->kill_context.send_sigkill) {
case SCOPE_STOP_SIGTERM:
if (s->kill_context.send_sigkill) {
- log_
warning_unit
(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
+ log_
unit_warning
(UNIT(s)->id, "%s stopping timed out. Killing.", UNIT(s)->id);
scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_TIMEOUT);
} else {
scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_FAILURE_TIMEOUT);
} else {
- log_
warning_unit
(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id);
+ log_
unit_warning
(UNIT(s)->id, "%s stopping timed out. Skipping SIGKILL.", UNIT(s)->id);
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
}
break;
case SCOPE_STOP_SIGKILL:
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
}
break;
case SCOPE_STOP_SIGKILL:
- log_
warning_unit
(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
+ log_
unit_warning
(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
break;
scope_enter_dead(s, SCOPE_FAILURE_TIMEOUT);
break;