mitch@hq.af.mil (Mitch Wright) (08/10/90)
Greetings! I was recently flipping through the source of ksh(1), humbly admiring the work of David Korn, when I came across a function called waitpid(). I quickly grep'ed through the code to see if I could find where this function was defined, since I was not aware of a system call by this name. Well, I found no definition for this call in the code or in the few SYSV programming manuals that I have. Does anyone have an idea exactly what this call does? Since it is in the middle of the job control routines, I'd assume it was similar to wait3() in the Bezerkely world, but the parameters seem to be out of whack, and all three of them are integers instead of 1 int, 1 union wait *, and a struct rusage *. A man-page would be fine, but I'd prefer not only a man page, but a *real* description of what this puppy does. Thanks! -- ..mitch mitch@hq.af.mil (Mitch Wright) | The Pentagon, 1B1046 | (202) 695-0262 The two most common things in the universe are hydrogen and stupidity, but not necessarily in that order.
chris@mimsy.umd.edu (Chris Torek) (08/13/90)
In article <MITCH.90Aug10002007@hq.af.mil> mitch@hq.af.mil (Mitch Wright) writes: >Does anyone have an idea exactly what [waitpid()] does? waitpid() is a POSIX function: int waitpid(int pid, int *status, int options) where the `pid' argument is the process ID of the process to wait for, or WAIT_ANY to wait for any child; `status' is the place to store the exit status (or signal); and `options' are options from the same set allowed by 4.[123]BSD wait3(): WNOHANG: return 0 if there are no exited children at the moment; and WUNTRACED: return information on stopped children even when they are not being traced via ptrace(). waitpid() allows routines like pclose() to operate reliably (i.e., without consuming any `wrong' child status). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris (New campus phone system, active sometime soon: +1 301 405 2750)
decot@hpisod2.HP.COM (Dave Decot) (08/15/90)
> >Does anyone have an idea exactly what [waitpid()] does? > > waitpid() is a POSIX function: > > int waitpid(int pid, int *status, int options) > > where the `pid' argument is the process ID of the process to wait > for, or WAIT_ANY to wait for any child; WAIT_ANY does not exist in POSIX. The correct value to wait for any child is -1. Dave Decot