unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



waitid(2)							    waitid(2)



NAME

  waitid - Wait	for child process to change state

SYNOPSIS

  #include <&lt;sys/wait.h>&gt;


  int waitid(
	  idtype_t idtype,
	  id_t id,
	  siginfo_t *infop,
	  int options );

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  waitid(): XPG4-UNIX

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

PARAMETERS

  idtype
      Identifies the type of process to	be affected.  Used with	the id param-
      eter, it suspends	execution for the specified child process.

  id  Specifies	either the process ID or process group ID of the child pro-
      cess.  Used with the idtype parameter, it	suspends execution for the
      specified	process.

  infop
      Specifies	a pointer to a siginfo_t structure.

  options
      Specifies	the conditions that must occur before a	wait operation is
      performed	by the waitid()	function.

DESCRIPTION

  The waitid() function	holds a	calling	process	until the state	of a child
  process changes.  The	current	state of the child is recorded in a structure
  pointed to by	the infop parameter. If	a child	process	changed	state prior
  to the call to the waitid() function,	the waitid() function returns immedi-
  ately.

  The idtype and id parameters determine which child process the waitid()
  function is to act upon.

    +  If the idtype parameter is P_PID, the waitid() function waits for the
       child with a process ID equal to	(pid_t)id.

    +  If the idtype parameter is P_PGID, the waitid() function	waits for any
       child with a process group ID equal to (pid_t)id.

    +  If the idtype parameter is P_ALL, the waitid function waits for any
       child and the id	parameter is ignored.

  The options parameter	specifies the conditions that must occur before	a
  wait operation is performed by the waitid() function.	 To specify a condi-
  tion,	use at least one of the	following flags	in a logical OR	operation:

  WCONTINUED
      Return the status	for any	child that was stopped and has been contin-
      ued.

  WEXITED
      Wait for processes to exit.

  WNOHANG
      Return immediately if no child processes in the requested	state are
      present.

  WNOWAIT
      Keep the child process whose status is returned in infop in a waitable
      state.  Another wait for that child may occur with the same results.

  WSTOPPED
      Wait for and return the process status of	any child that has stopped
      upon receipt of a	signal.

  WTRAPPED
      [Tru64 UNIX]  Wait for traced processes to become	trapped	or reach a
      breakpoint (see ptrace(2)).

  The infop parameter must point to a siginfo_t	structure as defined in	sig-
  info(5). This	structure contains the status explaining why a process is in
  a wait state.

  The waitid() function	returns	if a child process is found that satisfies
  the conditions defined by the	idtype and options parameters. In this case,
  the system fills in the structure pointed to by the infop parameter with
  the process status. The system always	sets the si_signo structure member to
  SIGCHLD.

RETURN VALUE

  If the waitid() function returns because the state of	a child	process
  changes, it returns a	value of zero (0).  Otherwise, a value of -1 is
  returned and errno is	set to indicate	the error.

ERRORS

  The waitid() function	sets errno to the specified values for the following
  conditions:

  [ECHILD]
      The calling process has no unwaited-for child processes.

  [EFAULT]
      [Tru64 UNIX]  The	infop parameter	points to an invalid address.

  [EINTR]
      The waitid() function was	interrupted due	to the receipt of a signal by
      the calling process.

  [EINVAL]
      An invalid value was used	with the options parameter, or the idtype and
      id parameters specify an invalid set of processes.



SEE ALSO

  Functions:  intro(2),	exec(2), exit(2), fork(2), pause(3), ptrace(2),
  sigaction(2),	signal(2), wait(2)

  Routines:  pause(3)

  Files:  siginfo(5)

  Standards:  standards(5)