[PATCH] signal handlers setup

Thomas Cataldo tcataldo at gmail.com
Mon Oct 10 20:51:25 EDT 2011


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.

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);
     action.sa_flags = 0;

Any comment ? without it I can't restart Cyrus safely from java.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20111011/f519ae1b/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unblock_signals.diff
Type: application/octet-stream
Size: 441 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20111011/f519ae1b/attachment.obj 

More information about the Cyrus-devel mailing list