[ale] SIGHUP ignored after exec
Joe Steele
joe at madewell.com
Mon Mar 25 21:40:46 EST 2002
Two issues are at play:
1) When a signal handler is invoked, the signal which it catches is
blocked until the handler returns or until the signal is explicitly
unblocked.
2) When you exec() a new program, the new program inherits the
signal mask of the previous program.
In your case, when the SIGHUP arrives, the signal mask is changed to
block the signal and the signal handler is called. The signal
handler never returns, but instead calls exec(), so the new program
inherits the signal mask which has SIGHUP blocked.
You need to change your main program so that after it calls signal(),
it unblocks SIGHUP, roughly like this:
sigset_t myset;
...
sigemptyset (&myset);
sigaddset (&myset, SIGHUP);
signal (SIGHUP, sigCatcher);
sigprocmask (SIG_UNBLOCK, &myset, NULL);
--Joe
-----Original Message-----
From: Chris Fowler [SMTP:cfowler at outpostsentinel.com]
Sent: Monday, March 25, 2002 2:38 PM
To: ale at ale.org
Subject: [ale] SIGHUP ignored after exec
Hello,
I have an issue where I use SIGHUP to reintialize a program. The way I do this is just have the program exec itself. The exec works but it appears that
all attempts to send SIGHUP to the new program fail. It is ignoring those signals. Below is strace output and I also have attached test
code. I may be using my syscalls incorreclty. Having a program reexec itself is easier than re-reading configuration.
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list