Many modern process supervision systems (runsv, daemontools, sysvinit)
expect to be able to terminate a process gracefully by sending it a
SIGTERM; although SIGQUIT is nominally used for this purpose it seems
to have fallen into disuse as a matter of practice. Therefore, to
integrate as smoothly as possible with the outside world, bosserver
should catch SIGTERM and interpret it as a request to shut down
gracefully.
When used with process supervision (runsv or daemontools), the
previous behavior would cause bosserver to die but leave its children
running, and then bosserver would get restarted by the supervisor.
The result is a situation where there would be two copies of every
bnode process. Mayhem ensues.
Change-Id: I8690fba0af6c2b9f9613527254af915be9e76dfc
Reviewed-on: http://gerrit.openafs.org/1310
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
void
bnode_Int(int asignal)
{
- if (asignal == SIGQUIT) {
+ if (asignal == SIGQUIT || asignal == SIGTERM) {
IOMGR_SoftSig(bozo_ShutdownAndExit, (void *)(intptr_t)asignal);
} else {
IOMGR_SoftSig(bnode_SoftInt, (void *)(intptr_t)asignal);
code = sigaction(SIGQUIT, &newaction, NULL);
if (code)
return errno;
+ code = sigaction(SIGTERM, &newaction, NULL);
+ if (code)
+ return errno;
return code;
}