Propagating parent PID to ./run

From: Earl Chew <earl_chew_at_yahoo.com>
Date: Tue, 4 Jan 2022 08:26:43 -0800

Is there any appetite for providing a way for ./run to know the PID of
its parent s6-supervise instance?

This information allows the supervised child to know that it has been
orphaned, and to tie its fate to its parent (eg PDEATHSIG
https://stackoverflow.com/a/36945270).

Using getppid(2) alone is not reliable because the child might have been
orphaned between the fork(2) and getppid(2) calls.

Mechanisms that might be used include a) setting an environment variable
(eg S6_PPID) before executing ./run, or b) passing the PID as an
argument when executing ./run.

The environment variable approach can be used when s6-supervise is
deployed in standalone settings (eg exec env S6_PPID=$$ s6-supervise
servicedir), but this approach not presently a good fit in s6-svscan
scenarios.

Earl
Received on Tue Jan 04 2022 - 17:26:43 CET

This archive was generated by hypermail 2.4.0 : Tue Jan 04 2022 - 17:27:26 CET