*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> waitid (2)              
Title
Content
Arch
Section
 

Contents


 waitid(2)                                                         waitid(2)




 NAME    [Toc]    [Back]
      waitid - wait for child process to change state

 SYNOPSIS    [Toc]    [Back]
      #include <sys/wait.h>

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

 DESCRIPTION    [Toc]    [Back]
      The waitid() function suspends the calling process until one of its
      children changes state. It records the current state of a child in the
      structure pointed to by infop.  If a child process changed state prior
      to the call to waitid(), waitid() returns immediately.

      The idtype and id arguments are used to specify which children
      waitid() will wait for.

      If idtype is P_PID, waitid() will wait for the child with a process ID
      equal to (pid_t)pid.

      If idtypeis P_PGID, waitid() will wait for any child with a process
      group ID equal to (pid_t)pid.

      If idtypeis P_ALL, waitid() will wait for any children and id is
      ignored.

      The options argument is used to specify which state changes waitid()
      will wait for. It is formed by OR-ing together one or more of the
      following flags:

           WEXITED                  Wait for processes that have exited.

           WSTOPPED                 Status will be returned for any child
                                    that has stopped upon receipt of a
                                    signal.

           WCONTINUED               Status will be returned for any child
                                    that was stopped and has been continued.

           WNOHANG                  Return immediately if there  are  no
                                    children to wait for.

           WNOWAIT                  Keep the process whose status is
                                    returned in infop in a waitable state.
                                    This will not affect the state of the
                                    process; the process may be waited for
                                    again after this call completes.

      The infop argument must point to a siginfo_t structure. If waitid()
      returns because a child process was found that satisfied the
      conditions indicated by the arguments idtype and options, then the



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 waitid(2)                                                         waitid(2)




      structure pointed to by infop will be filled in by the system with the
      status of the process. The si_signo member will always be equal to
      SIGCHLD.

 RETURN VALUE    [Toc]    [Back]
      If waitid() returns due to the change of state of one of its children,
      0 is returned. Otherwise, -1 is returned and errno is set to indicate
      the error.

 ERRORS    [Toc]    [Back]
      The waitid() function will fail if:

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

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

           [EINVAL]       An invalid value was specified for options, or
                          idtype and id specify an invalid set of processes.

 APPLICATION USAGE    [Toc]    [Back]
    Threads Considerations
      In a multi-threaded application, only the calling thread is suspended
      by waitid().

      waitid() will not return until all threads in the process have reached
      the desired state.  For example, if the WEXITED, WSTOPPED or
      WCONTINUED options are specified, waitid() will not return until all
      threads in the process have terminated, stopped or continued
      respectively.

 SEE ALSO    [Toc]    [Back]
      exec(2), exit(2), wait(2), <sys/wait.h>.

 CHANGE HISTORY    [Toc]    [Back]
      First released in Issue 4, Version 2.


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
wait HP-UX wait for child process to stop or terminate
waitpid Tru64 Wait for a child process to stop or terminate
wait Tru64 Wait for a child process to stop or terminate
wait4 Tru64 Wait for a child process to stop or terminate
wait3 Tru64 Wait for a child process to stop or terminate
waitpid HP-UX wait for child process to stop or terminate
wait IRIX wait for child processes to stop or terminate
wait IRIX wait for child processes to stop or terminate
pthread_atfork Tru64 Declares fork handler routines to be called when the calling thread's process forks a child process
pxfwait IRIX Obtains information about a calling process' child process
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service