ExecUtil.pm: support a same-pid reexec option
commit471a64ae65b5b944395dceb550542186bf6b507d
authorKyle J. McKay <mackyle@gmail.com>
Mon, 28 Nov 2016 00:12:20 +0000 (27 16:12 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 28 Nov 2016 00:12:20 +0000 (27 16:12 -0800)
tree7a218adcda175b806922d0a10d689e2ea9f8a483
parent0a671162264e26860f5168ddc970900d7cb73186
ExecUtil.pm: support a same-pid reexec option

Ideally when re-execing oneself, one wants to end up with a new
pid to reflect the fact that really a new copy is running and also
to avoid any odd failures caused by the same pid trying to run some
initialization code twice from the same pid without an intervening
pid termination that perhaps the operating system does not tolerate
very well.

However, there are some circumstances where it's very inconvenient
for the original pid to exit, so allow keeping the same pid with
an option and leave it up to the caller in that case to deal with
any operating system idiosyncrasies regarding double initialization.

The old and new pid values are also now passed to the optional
success code ref (which is run in a doubly-forked process when
keeping the same pid to avoid a spurious SIGCHLD in the parent).

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Girocco/ExecUtil.pm