Is there a system call to check the status of any processes?

e89hse at rigel.efd.lth.se e89hse at rigel.efd.lth.se
Mon May 28 05:16:05 AEST 1990


In article <9005220904.AA01656 at samsa.pcs.com>, wolfgang at 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.



More information about the Comp.unix.questions mailing list