Command: waitPID

NEST HelpDesk Command Index NEST Quick Reference

Name:
 waitPID - wait or check for a child process to terminate

Synopsis:
 PIDin NoHangFlag waitPID -> Status NormalExitFlag PIDout
                                   -> 0

Description:
 The waitPID function suspends execution of the calling process
              until status information for the given child is available,
              or until delivery of a signal whose action is either to
              execute a signal-catching function or to terminate the
              process. If status information is available prior to the call
              to waitPID, it returns immediately.
				 
              The waitPID function returns the process ID of the child for
              which status is being reported.
              Zero is returned immediately, if the NoHangFlag is set
              and no status is available.

	      Alternatives: Function waitPID_i_b (undocumented) 
	      -> behaviour and synopsis are the same.

Parameters:
 In : PIDin(integer):      -1: Wait for any child process.
                                positive: Wait for the specific child whose
                                          process ID is equal to PIDin.
                           (           0: -not supported-) 
                           (less than -1: -not supported-) 
                              
                 NoHangFlag(boolean):
                  If true, causes waitPID function not to suspend execution
                  of the calling process if status is not immediately
                  available for any of the child processes specified by
                  PIDin. In this case, zero is returned as only result.
               
            Out: PIDout(integer):
                   The process ID of the child for which status is being
                   reported.

                 NormalExitFlag(boolean):
                   True, if status is returned for a child that terminated
                   normally, i.e. by a call to exit() or by returning from
                   main(). In that case, the exit code is reported in the Status
                   argument (see below). 
                   False, if status is returned for a child that terminated due
                   to a signal that was not caught. In that case, the number of
                   that signal is reported in the Status argument (see below).
	    
                 Status(integer):
                   If NormalExitFlag is true, this reports the child's exit code, 
                   i.e. the low-order eight bits of the status argument that the
                   child passed to exit(), or the value the child process
                   returned from main().
                   If NormalExitFlag is false, this reports the number of the
                   signal that caused the termination of the child process. Look
                   up this number in signaldict, to know what it means.
                
Examples:
1. {(sleep 3) sysexec} spoon false waitPID
         2. {(ls) sysexec} spoon false waitPID
            Note the parent process' SLI-Prompt appearing AFTER execution of the
            command finished.
            This is different to the call "{(ls) sysexec} spoon" only.
         3. 23 false waitPID

Bugs:
 -

Author:
 R Kupper

FirstVersion:
 Apr 13 1999

Remarks:
 The features normally used only by the UNIX-shell-program
          (such as the WUNTRACED-option) are currently not supported,
          although values <=0 can be passed through PIDin.
         See any documentation of POSIX-function waitpid().
         Discription text is mainly taken from
          Donald A. Lewine, "POSIX programmer's guide", O'Reilly&Associates,Inc.

SeeAlso:wait spoon signaldict getPGRP
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/sli/processes.h

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative