waitpid.c revision 89857
116239Sjkh/* 24Srgrimes 3509Srgrimes@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) 437581Sbde 54SrgrimesThis is a wrapper around the @code{wait} function. Any ``special'' 6509Srgrimesvalues of @var{pid} depend on your implementation of @code{wait}, as 7509Srgrimesdoes the return value. The third argument is unused in @libib{}. 84Srgrimes 94Srgrimes@end deftypefn 104Srgrimes 114Srgrimes*/ 124Srgrimes 134Srgrimes#ifdef HAVE_CONFIG_H 144Srgrimes#include "config.h" 154Srgrimes#endif 164Srgrimes#ifdef HAVE_SYS_WAIT_H 174Srgrimes#include <sys/wait.h> 184Srgrimes#endif 1930640Speter 2037580Sbdeint 2130640Speterwaitpid (pid, stat_loc, options) 2225083Sjdp int pid, *stat_loc, options; 2325537Sdfr{ 2425083Sjdp for (;;) 2525083Sjdp { 2627674Sphk int wpid = wait(stat_loc); 2727674Sphk if (wpid == pid || wpid == -1) 282056Swollman return wpid; 292056Swollman } 302056Swollman} 314Srgrimes