X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=c0ee1140a8aeddfdfd8b685c0ac4f5376010894a;hb=9cd861842ccb07372fbd665f2e6c054daaedacb4;hp=d11de79a50de2f4024ce22eaf307c32ca66c1a08;hpb=1f19a534ea84458670ec011f6d1ba96f76e3f783;p=elogind.git diff --git a/src/core/service.c b/src/core/service.c index d11de79a5..c0ee1140a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -143,7 +143,9 @@ static void service_init(Unit *u) { kill_context_init(&s->kill_context); cgroup_context_init(&s->cgroup_context); - RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5); + RATELIMIT_INIT(s->start_limit, + u->manager->default_start_limit_interval, + u->manager->default_start_limit_burst); s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID; } @@ -1517,6 +1519,22 @@ static void service_set_state(Service *s, ServiceState state) { if (state == SERVICE_EXITED && UNIT(s)->manager->n_reloading <= 0) unit_destroy_cgroup(UNIT(s)); + /* For remain_after_exit services, let's see if we can "release" the + * hold on the console, since unit_notify() only does that in case of + * change of state */ + if (state == SERVICE_EXITED && s->remain_after_exit && + UNIT(s)->manager->n_on_console > 0) { + ExecContext *ec = unit_get_exec_context(UNIT(s)); + if (ec && exec_context_may_touch_console(ec)) { + Manager *m = UNIT(s)->manager; + + m->n_on_console --; + if (m->n_on_console == 0) + /* unset no_console_output flag, since the console is free */ + m->no_console_output = false; + } + } + if (old_state != state) log_debug_unit(UNIT(s)->id, "%s changed %s -> %s", UNIT(s)->id,