Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!agate!saab.stanford.edu!neon!Gang-of-Four!dkeisen From: dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) Newsgroups: comp.unix.questions Subject: Re: what the kill() system call should do?? Message-ID: <1990Sep28.174450.4935@Neon.Stanford.EDU> Date: 28 Sep 90 17:44:50 GMT References: <25784.2700d355@kuhub.cc.ukans.edu> Sender: news@Neon.Stanford.EDU (USENET News System) Organization: Sequoia Peripherals Lines: 32 In article <25784.2700d355@kuhub.cc.ukans.edu> jian@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@Gang-of-Four.Stanford.EDU Office: (415) 967-5644 1447 N. Shoreline Blvd. Mountain View, CA 94043