waitpid man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

waitpid(3)							    waitpid(3)

NAME
       waitpid	- allows the calling process to obtain status information per‐
       taining to one of its child processes.

SYNOPSIS
       #include <sys/wait.h>

       pid_t waitpid(
	       pid_t process_id,
	       int ∗status_location,
	       int options);

LIBRARY
       SVR4 Library (libsvr4)

PARAMETERS
       Points to a location that contains the termination status of the	 child
       process	as  defined  in	 the  <sys/wait.h> header file.	 Specifies the
       child process or set of child processes.	 Modifies the behavior of  the
       function.  The  flags  for  the	options	 parameter  are defined in the
       DESCRIPTION section.

DESCRIPTION
       The waitpid() function allows the  calling  process  to	obtain	status
       information  pertaining	to one of its child processes. Various options
       permit status information to be obtained for child processes that  have
       terminated  or  stopped.	 If status information is available for two or
       more child processes, the order in which their status  is  reported  is
       unspecified.

       The waitpid() function behaves identically to wait(), if the process_id
       parameter has a value of (pid_t)-1 and the options parameter  specifies
       a value of zero (0).  Should these parameters contain other values, the
       waitpid() function is changed as specified by those values.

       In a multithreaded environment, the waitpid() function blocks only  the
       calling thread.

       The  process_id	parameter  allows the calling process to gather status
       from a specific set of child processes.	The waitpid() function returns
       the  status  only of child processes from this set. The following rules
       define the set: If the process_id parameter is equal to (pid_t)-1, sta‐
       tus is requested for any child process.	In this respect, the waitpid()
       function is equivalent to  the  wait()  function.   If  the  process_id
       parameter  is  greater  than zero (0), it specifies the process ID of a
       single child process for which status is requested.  If the  process_id
       parameter  is  equal  to	 zero  (0),  status is requested for any child
       process whose process group ID is equal to that of the calling process.
       If the process_id parameter is less than (pid_t)-1, status is requested
       for any child process whose process group ID is equal to	 the  absolute
       value of the process_id parameter.

       The  options  parameter to the waitpid() function modifies the behavior
       of the function. The flags for the options parameter can be combined by
       specifying  them	 in a bitwise-inclusive OR operation. The flags are as
       follows: Prevents the calling process from being suspended.   If	 there
       are child processes that have been stopped or terminated, one is chosen
       and waitpid() returns its pid, just as when the	WNOHANG	 flag  is  not
       specified.   If there are no such processes (that is, if conditions are
       such that waitpid() without the WNOHANG flag would have	suspended  the
       calling process), zero (0) is returned.	Because you can never wait for
       process 0, there is no confusion arising from this  return.   Specifies
       that  the  call return additional information when the child process is
       stopped because it received a SIGTTIN, SIGTTOU,	SIGSTOP,  or  SIGTSTOP
       signal.

       If  the waitpid() function returns the process ID of the child process,
       in this instance, information is stored in the location pointed	to  by
       the  status_location  parameter	if the value of the status_location is
       not null.  The value stored in the location  pointed  to	 by  the  sta‐
       tus_location  parameter	is  zero  (0)  if,  and only if, the status is
       returned from a terminated child process that did one of the following:
       Returned zero (0) from the main() routine.  Passed zero (0) as the sta‐
       tus parameter to the _exit or exit function.

       Regardless of its value, this information  can  be  defined  using  the
       macros  defined	in the <sys/wait.h> header file that evaluate to inte‐
       gral expressions.

RETURN VALUES
       If the waitpid() function returns because the status of a child process
       is  available,  the  process ID of the child is returned to the calling
       process. If they return because a signal	 was  caught  by  the  calling
       process, -1 is returned and errno is set to [EINTR].

       If the waitpid() function is invoked with the WNOHANG option specified,
       it has at least one child process specified by pid for which status  is
       not available, and status is not available for any process specified by
       pid, a  value  of  0  (zero)  is	 returned.   Otherwise,	 (pid_t-1)  is
       returned, and errno is set to indicate the error.

ERRORS
       The  waitpid() function fails if one or both of the following are true:
       The process or process group ID specified by the	 process_id  parameter
       does  not  exist or is not a child process of the calling process.  The
       value of the options parameter is not valid.

RELATED INFORMATION
       Functions: exec(2), exit(2), fork(2), ptrace(2),	 getrusage(2),	sigac‐
       tion(2), pause(3)

       delim off

								    waitpid(3)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net