static void scope_init(Unit *u) { Scope *s = SCOPE(u); assert(u); assert(u->load_state == UNIT_STUB); s->timeout_stop_usec = u->manager->default_timeout_stop_usec; cgroup_context_init(&s->cgroup_context); kill_context_init(&s->kill_context); UNIT(s)->ignore_on_isolate = true; UNIT(s)->ignore_on_snapshot = true; }
static void busname_enter_signal(BusName *n, BusNameState state, BusNameResult f) { KillContext kill_context = {}; int r; assert(n); if (f != BUSNAME_SUCCESS) n->result = f; kill_context_init(&kill_context); r = unit_kill_context(UNIT(n), &kill_context, state != BUSNAME_SIGTERM ? KILL_KILL : KILL_TERMINATE, -1, n->control_pid, false); if (r < 0) { log_unit_warning_errno(UNIT(n)->id, r, "%s failed to kill control process: %m", UNIT(n)->id); goto fail; } if (r > 0) { r = busname_arm_timer(n); if (r < 0) { log_unit_warning_errno(UNIT(n)->id, r, "%s failed to arm timer: %m", UNIT(n)->id); goto fail; } busname_set_state(n, state); } else if (state == BUSNAME_SIGTERM) busname_enter_signal(n, BUSNAME_SIGKILL, BUSNAME_SUCCESS); else busname_enter_dead(n, BUSNAME_SUCCESS); return; fail: busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES); }