[PATCH] signal handlers setup

Bron Gondwana brong at fastmail.fm
Tue Oct 11 01:57:36 EDT 2011


On Tue, Oct 11, 2011 at 02:51:25AM +0200, Thomas Cataldo wrote:
> While testing some java code that executes cyrus init script, I came into a
> problem : the Java VM blocks SIGQUIT, event when using -Xrs parameter.

Why Java?

> As SIGQUIT is safe shutdown, I need the signal delivered correctly. I came
> up with the attached patch that resets the signal mask for cyrmaster before
> setting the signal handlers.
> 
> diff --git a/master/master.c b/master/master.c
> index 823be06..f2ca72e 100644
> --- a/master/master.c
> +++ b/master/master.c
> @@ -1064,7 +1064,11 @@ void sigalrm_handler(int sig __attribute__((unused)))
>  void sighandler_setup(void)
>  {
>      struct sigaction action;
> -
> +    sigset_t all_signals;
> +
> +    sigfillset(&all_signals);
> +    sigprocmask(SIG_UNBLOCK, &all_signals, NULL);
> +
>      sigemptyset(&action.sa_mask);
>      action.sa_flags = 0;

Greg - you know signal handling better than me.  What do you think?

Bron.


More information about the Cyrus-devel mailing list