I tried your script and used every combination I found mentioned in perlipc (i.e. without posix) and couldn't get it to work either. It seems definitely broken.
A trace shows this difference between a successful handling and an unsuccessful:
#ok: write(1, "got signal.\n", 12got signal. ) = 12 wait4(-1, 0x7fff97d3635c, WNOHANG, NULL) = -1 ECHILD (No child process +es) rt_sigprocmask(SIG_BLOCK, [USR1], [USR1], 8) = 0 rt_sigaction(SIGUSR1, {0x4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, {0x +4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 #not ok: write(1, "got signal.\n", 12got signal. ) = 12 wait4(-1, 0x7fff97d3635c, WNOHANG, NULL) = -1 ECHILD (No child process +es) rt_sigprocmask(SIG_BLOCK, [USR1], [USR1], 8) = 0 rt_sigaction(SIGUSR1, {0x4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, {0x +4ba320, [], SA_RESTORER, 0x7ff73ec382e0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [USR1], NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [USR1], NULL, 8) = 0 rt_sigaction(SIG_0, NULL, {0x8ab3b8, [], SA_NOCLDSTOP}, 8) = -1 EINVAL + (Invalid argument)
The difference is the call to rt_sigaction instead of a third rt_sigprocmask, seemingly unprovoked by any return values from the operating system. So my guess is the problem is in the perl code. It seems a case for a debugger now
In reply to Re: How to prevent Perl from exit when SIGUSR1 recieved?
by jethro
in thread How to prevent Perl from exit when SIGUSR1 recieved?
by cmyker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |