os: add -sigstop option for Upstart (or equivalent) startup

This is very similar to the RunFromSmartParent (implicit) option, except
we do not send the signal to our parent process, but our own process
instead, and that signal is SIGSTOP, not SIGUSR1.

Upstart or a similar equivalent program will detect this, realize that
we are ready to accept clients now, send us SIGCONT and move our job
status from SPAWNED to RUNNING.

Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Vignatti Tiago (Nokia-MS/Helsinki) 2010-08-30 21:24:30 +03:00 • committed by Keith Packard
commit 5b680f2c23
3 changed files with 10 additions and 0 deletions

View file

@ -146,6 +146,8 @@ Bool NewOutputPending; /* not yet attempted to write some new output */
Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
equivalent) will send SIGCONT back. */
Bool PartialNetwork; /* continue even if unable to bind all addrs */
static Pid_t ParentProcess;
@ -357,6 +359,8 @@ NotifyParentProcess(void)
kill (ParentProcess, SIGUSR1);
}
}
if (RunFromSigStopParent)
raise (SIGSTOP);
#endif
}