Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!luth!sunic!lth.se!E89HSE@rigel.efd.lth.se From: e89hse@rigel.efd.lth.se Newsgroups: comp.unix.questions Subject: Re: Is there a system call to check the status of any processes? Message-ID: <009374EC.B9A700E0@rigel.efd.lth.se> Date: 27 May 90 19:16:05 GMT References: <23329@adm.BRL.MIL>,<9005220904.AA01656@samsa.pcs.com> Sender: newsuser@lth.se (LTH network news server) Reply-To: e89hse@rigel.efd.lth.se Organization: Lund Institute of Technology,Lund, Sweden Lines: 17 In article <9005220904.AA01656@samsa.pcs.com>, wolfgang@samsa.pcs.com (wolfgang) writes: >In comp.unix.questions you write: > >->I knew the "ps" command will show the status of any processes, but is there >->a system call that can check the status of a process, probably based on >->the process id? If there is no such a call, how can I check the status > >Of course there is one. It is kill(2)! Extract from man: [...] >[ Program ended...] > while (kill(pid, 0) == 0) > sleep(10); > printf("\007Process %s has ended.\n", *argv); > exit(0); Isn't there any more graceful way to do this? I looked the HP-UX manual and it turned out they had something called waitpid(pid,stat_loc,opt) that can be used to wait for one (out of many) child process.