static void scope_set_state(Scope *s, ScopeState state) { ScopeState old_state; assert(s); old_state = s->state; s->state = state; if (state != SCOPE_STOP_SIGTERM && state != SCOPE_STOP_SIGKILL) s->timer_event_source = sd_event_source_unref(s->timer_event_source); if (state != old_state) log_debug("%s changed %s -> %s", UNIT(s)->id, scope_state_to_string(old_state), scope_state_to_string(state)); unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true); }
static int scope_serialize(Unit *u, FILE *f, FDSet *fds) { Scope *s = SCOPE(u); assert(s); assert(f); assert(fds); unit_serialize_item(u, f, "state", scope_state_to_string(s->state)); return 0; }
static void scope_dump(Unit *u, FILE *f, const char *prefix) { Scope *s = SCOPE(u); assert(s); assert(f); fprintf(f, "%sScope State: %s\n" "%sResult: %s\n", prefix, scope_state_to_string(s->state), prefix, scope_result_to_string(s->result)); cgroup_context_dump(&s->cgroup_context, f, prefix); kill_context_dump(&s->kill_context, f, prefix); }
static int scope_serialize(Unit *u, FILE *f, FDSet *fds) { Scope *s = SCOPE(u); assert(s); assert(f); assert(fds); unit_serialize_item(u, f, "state", scope_state_to_string(s->state)); unit_serialize_item(u, f, "was-abandoned", yes_no(s->was_abandoned)); if (s->controller) unit_serialize_item(u, f, "controller", s->controller); return 0; }
static void scope_set_state(Scope *s, ScopeState state) { ScopeState old_state; assert(s); old_state = s->state; s->state = state; if (!IN_SET(state, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL)) s->timer_event_source = sd_event_source_unref(s->timer_event_source); if (IN_SET(state, SCOPE_DEAD, SCOPE_FAILED)) { unit_unwatch_all_pids(UNIT(s)); unit_dequeue_rewatch_pids(UNIT(s)); } if (state != old_state) log_debug("%s changed %s -> %s", UNIT(s)->id, scope_state_to_string(old_state), scope_state_to_string(state)); unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], 0); }
_pure_ static const char *scope_sub_state_to_string(Unit *u) { assert(u); return scope_state_to_string(SCOPE(u)->state); }