Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: what the kill() system call should do?? Message-ID: <1990Sep27.111849.3088@virtech.uucp> Date: 27 Sep 90 11:18:49 GMT References: <25784.2700d355@kuhub.cc.ukans.edu> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 26 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()) { > case -1: perror("for()"); exit(1); > case 0: ppid = getpid(); child_process(ppid); > default: signal(SIGUSR1, catch_usr1); > } I assume the getpid() is a typo and you really had getppid() in the code. Most likely the child process is executing the kill() before the parent process has a chance to execute the signal(). Try running the signal before the fork (and if necessary, reset it in the child). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170