From f2b6878955b1f77ea1fa87b502b13d5dbefc57f6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 24 Apr 2012 14:28:00 +0200 Subject: 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. --- src/core/transaction.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core/transaction.c') diff --git a/src/core/transaction.c b/src/core/transaction.c index aee155f519..09ed80737d 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -19,6 +19,9 @@ along with systemd; If not, see . ***/ +#include +#include + #include "transaction.h" #include "bus-errors.h" @@ -693,6 +696,17 @@ int transaction_activate(Transaction *tr, Manager *m, JobMode mode, DBusError *e assert(hashmap_isempty(tr->jobs)); + if (!hashmap_isempty(m->jobs)) { + /* Are there any jobs now? Then make sure we have the + * idle pipe around. We don't really care too much + * whether this works or not, as the idle pipe is a + * feature for cosmetics, not actually useful for + * anything beyond that. */ + + if (m->idle_pipe[0] < 0 && m->idle_pipe[1] < 0) + pipe2(m->idle_pipe, O_NONBLOCK|O_CLOEXEC); + } + return 0; } -- cgit v1.2.3-54-g00ecf