Back to index

glibc  2.9
Defines | Functions
waitid.c File Reference
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <assert.h>

Go to the source code of this file.


#define __need_NULL


pid_t kwaitpid (int *stat_loc, pid_t pid, int options, struct rusage *ru_loc, siginfo_t *infop)
int __waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)

Define Documentation

#define __need_NULL

Definition at line 23 of file waitid.c.

Function Documentation

int __waitid ( idtype_t  idtype,
id_t  id,
siginfo_t *  infop,
int  options 

Definition at line 34 of file waitid.c.

  pid_t pid, child;
  int status;

  switch (idtype)
    case P_PID:
      if(id <= 0)
       goto invalid;
      pid = (pid_t) id;
    case P_PGID:
      if (id < 0 || id == 1)
       goto invalid;
      pid = (pid_t) -id;
    case P_ALL:
      pid = -1;
      __set_errno (EINVAL);
      return -1;

  /* Technically we're supposed to return EFAULT if infop is bogus,
     but that would involve mucking with signals, which is
     too much hassle.  User will have to deal with SIGSEGV/SIGBUS.
     We just check for a null pointer. */

  if (infop == NULL)
      __set_errno (EFAULT);
      return -1;

  child = kwaitpid (&status, pid, options, NULL, infop);

  if (child == -1)
    /* `waitpid' set `errno' for us.  */
    return -1;

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function:

pid_t kwaitpid ( int stat_loc,
pid_t  pid,
int  options,
struct rusage ru_loc,
siginfo_t *  infop