[sbachman@saveware.com] libc/1534: When a program execl()'s in a signal function, the new program no longer responds to any signals set by the user.
Andreas Jaeger
aj@suse.de
Fri Jan 14 13:01:00 GMT 2000
Hi glibc developers & testers,
We've received the appended bug report. For me this looks like a bug
in the kernel. AFAIK Posix explicitly mentions execl as a function
which is allowed to be called from a signal handler (printf is not
signal safe but I don't think that this is the problem here).
What do you think? Should this be forwarded to linux-kernel?
Andreas
P.S. Here's the test program - name the executable `testd' and send it
kill -INT and kill -HUP.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* 2000 (c) Scott Bachmann sbachman@saveware.com */
/* Help from: ds111@cornell.edu */
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void foo2( int sig )
{ printf("Foo 2 you too at %d\n",sig); }
void foo( int sig )
{
printf("I got signal %d\n", sig);
execl("./testd","./testd",(char *) 0);
}
int main()
{
struct sigaction newaction;
newaction.sa_handler = foo;
newaction.sa_flags = 0;
if ( sigaction( SIGINT, &newaction, NULL ) == -1)
perror("Could not install the new signal handler");
newaction.sa_handler = foo2;
if ( sigaction( SIGHUP, &newaction, NULL ) == -1)
perror("Could not install the new signal handler");
printf("Signals set, program loaded, entering while\n");
while (1) {
printf("Hello Ball!! \n");
sleep(2);
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Libc-alpha
mailing list