what the kill() system call should do??

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Sat Sep 29 03:44:50 AEST 1990


In article <25784.2700d355 at kuhub.cc.ukans.edu> jian at kuhub.cc.ukans.edu writes:
>
>I tried to send a signal (SIGUSR1) from a child process to its parent process
>by using kill() system call in C. The result was funny. Whenever the parent
>process received the signal, it died immediately. I don't know what goes wrong
>in my program. Any help appreciated.
>
>void parent_process()
>{
>  int ppid;
>  ....
>
>  switch( pid = fork()) {

  ......
>    
>     default:   
>       signal(SIGUSR1, catch_usr1);
>  }
>

The child can post the signal to the parent before the parent returns from
the fork, if this happens the default action (termination) will occur.
Set up the signal handler before the fork.



--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
1447 N. Shoreline Blvd.
Mountain View, CA 94043



More information about the Comp.unix.questions mailing list