Back to index

glibc  2.9
wait4.c File Reference
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <hurd.h>
#include <hurd/port.h>

Go to the source code of this file.


pid_t __wait4 (pid_t pid, __WAIT_STATUS_DEFN stat_loc, int options, struct rusage *usage)

Function Documentation

pid_t __wait4 ( pid_t  pid,
__WAIT_STATUS_DEFN  stat_loc,
int  options,
struct rusage usage 

Definition at line 26 of file wait4.c.

  pid_t dead;
  error_t err;
  struct rusage ignored;
  int sigcode;
  int dummy;

  err = __USEPORT (PROC, __proc_wait (port, pid, options,
                                  stat_loc ?: &dummy, &sigcode,
                                  usage ?: &ignored, &dead));
  switch (err)
    case 0:                 /* Got a child.  */
      return dead;
    case EAGAIN:
      /* The RPC returns this error when the WNOHANG flag is set and no
        selected children are dead (but some are living).  In that
        situation, our return value is zero.  (The RPC can't return zero
        for DEAD without also returning some garbage for the other out
        parameters, so an error return is much more natural here.  Hence
        the difference between the RPC and the POSIX.1 interface.  */
      return (pid_t) 0;
      return (pid_t) __hurd_fail (err);

Here is the call graph for this function: