forked from enlightenment/efl
evas/cserve2: catch more signals and exit nicely
Also, ignore USR1 and USR2.
This commit is contained in:
parent
07ef0fdd93
commit
338218109b
|
@ -90,16 +90,19 @@ _signal_handle_child(struct signalfd_siginfo *sinfo EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_signal_handle_int(struct signalfd_siginfo *sinfo EINA_UNUSED)
|
_signal_handle_exit(struct signalfd_siginfo *sinfo)
|
||||||
{
|
{
|
||||||
DBG("Received SIGINT. Honoring request.");
|
const char *name;
|
||||||
terminate = EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
switch (sinfo->ssi_signo)
|
||||||
_signal_handle_term(struct signalfd_siginfo *sinfo EINA_UNUSED)
|
{
|
||||||
{
|
case SIGINT: name = "SIGINT"; break;
|
||||||
DBG("Received SIGTERM. Honoring request.");
|
case SIGTERM: name = "SIGTERM"; break;
|
||||||
|
case SIGQUIT: name = "SIGQUIT"; break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG("Received %s. Honoring request.", name);
|
||||||
terminate = EINA_TRUE;
|
terminate = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,10 +129,13 @@ _signalfd_handler(int fd, Fd_Flags flags EINA_UNUSED, void *data EINA_UNUSED)
|
||||||
_signal_handle_child(&sinfo);
|
_signal_handle_child(&sinfo);
|
||||||
break;
|
break;
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
_signal_handle_int(&sinfo);
|
|
||||||
break;
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
_signal_handle_term(&sinfo);
|
case SIGQUIT:
|
||||||
|
_signal_handle_exit(&sinfo);
|
||||||
|
break;
|
||||||
|
case SIGUSR1:
|
||||||
|
case SIGUSR2:
|
||||||
|
DBG("Ignored signal %d", sinfo.ssi_signo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERR("Caught unexpected signal '%d'.", sinfo.ssi_signo);
|
ERR("Caught unexpected signal '%d'.", sinfo.ssi_signo);
|
||||||
|
@ -146,6 +152,9 @@ _signalfd_setup(void)
|
||||||
sigaddset(&mask, SIGCHLD);
|
sigaddset(&mask, SIGCHLD);
|
||||||
sigaddset(&mask, SIGINT);
|
sigaddset(&mask, SIGINT);
|
||||||
sigaddset(&mask, SIGTERM);
|
sigaddset(&mask, SIGTERM);
|
||||||
|
sigaddset(&mask, SIGQUIT);
|
||||||
|
sigaddset(&mask, SIGUSR1);
|
||||||
|
sigaddset(&mask, SIGUSR2);
|
||||||
|
|
||||||
if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
|
if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue