Hi,

I have a server process that creates a child process. The server process receives SIGUSR1 from the child process. The child exec an executable that has either setitimer() or alarm() (I tried both) and a signal handler that sends SIGUSR1 to the server.
If the parent doesn't receive SIGUSR1, it assumes the child doesn't respond so it kills it (SIGKILL) and forks/exec a new child.
First invocation works well but for some reason, after a new child is created, it does not send signals anymore (I straced it, It seems not to enter the sigalarm handler I created) but it does work fine from the shell (had to trap USR1 first and run in background). I hope you can tell me why.
I am on Gentoo with Kernel 2.4.26-gentoo-r9
Here is the child code.
#include <errno.h>


#include <unistd.h>
#include <signal.h>
#include <stdlib.h>


void sigalrmHandler(int gotsig)
{
   kill(getppid(), SIGUSR1);
   alarm(2);
}

int main(int argc, char ** argv)
{
   alarm(2);
   signal(SIGALRM, sigalrmHandler);
   while(1)
       pause();
   exit(0);
}

--
Thanks.

David Harel,

==================================

Home office +972 4 6921986
Fax:        +972 4 6921986
Cellular:   +972 54 4534502
Snail Mail: Amuka
           D.N Merom Hagalil
           13802
           Israel
Email:      [EMAIL PROTECTED]



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to