summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-04-24 14:28:00 +0200
committerLennart Poettering <lennart@poettering.net>2012-04-24 14:42:24 +0200
commitf2b6878955b1f77ea1fa87b502b13d5dbefc57f6 (patch)
tree3fdf72d167a9e64ac16aaac52eaffa57c3cb9d13 /src/core/manager.c
parent8d8e945624a0080073d94941f3032b8fa3b3aa15 (diff)
service: introduce Type=idle and use it for gettys
Type=idle is much like Type=simple, however between the fork() and the exec() in the child we wait until PID 1 informs us that no jobs are left. This is mostly a cosmetic fix to make gettys appear only after all boot output is finished and complete. Note that this does not impact the normal job logic as we do not delay the completion of any jobs. We just delay the invocation of the actual binary, and only for services that otherwise would be of Type=simple.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index f7ccba6235..a6013668b8 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -259,6 +259,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
m->name_data_slot = m->conn_data_slot = m->subscribed_data_slot = -1;
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->pin_cgroupfs_fd = -1;
+ m->idle_pipe[0] = m->idle_pipe[1] = -1;
#ifdef HAVE_AUDIT
m->audit_fd = -1;
@@ -518,6 +519,8 @@ void manager_free(Manager *m) {
hashmap_free(m->cgroup_bondings);
set_free_free(m->unit_path_cache);
+ close_pipe(m->idle_pipe);
+
free(m);
}
@@ -1962,10 +1965,13 @@ void manager_check_finished(Manager *m) {
assert(m);
- if (dual_timestamp_is_set(&m->finish_timestamp))
+ if (hashmap_size(m->jobs) > 0)
return;
- if (hashmap_size(m->jobs) > 0)
+ /* Notify Type=idle units that we are done now */
+ close_pipe(m->idle_pipe);
+
+ if (dual_timestamp_is_set(&m->finish_timestamp))
return;
dual_timestamp_get(&m->finish_timestamp);