189857Sobrien/* 289857Sobrien 389857Sobrien@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) 489857Sobrien 589857SobrienThis is a wrapper around the @code{wait} function. Any ``special'' 689857Sobrienvalues of @var{pid} depend on your implementation of @code{wait}, as 789857Sobriendoes the return value. The third argument is unused in @libib{}. 889857Sobrien 989857Sobrien@end deftypefn 1089857Sobrien 1189857Sobrien*/ 1289857Sobrien 1377298Sobrien#ifdef HAVE_CONFIG_H 1477298Sobrien#include "config.h" 1577298Sobrien#endif 16218822Sdim#include "ansidecl.h" 17104834Sobrien 18104834Sobrien/* On some systems (such as WindISS), you must include <sys/types.h> 19104834Sobrien to get the definition of "pid_t" before you include <sys/wait.h>. */ 20104834Sobrien#include <sys/types.h> 21104834Sobrien 2277298Sobrien#ifdef HAVE_SYS_WAIT_H 2377298Sobrien#include <sys/wait.h> 2477298Sobrien#endif 2577298Sobrien 26104834Sobrienpid_t 27218822Sdimwaitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED) 2833965Sjdp{ 2933965Sjdp for (;;) 3033965Sjdp { 3133965Sjdp int wpid = wait(stat_loc); 3233965Sjdp if (wpid == pid || wpid == -1) 3333965Sjdp return wpid; 3433965Sjdp } 3533965Sjdp} 36