Section 8.8. wait3 and wait4 Functions

team bbl


8.8. wait3 and wait4 Functions

Most UNIX system implementations provide two additional functions: wait3 and wait4. Historically, these two variants descend from the BSD branch of the UNIX System. The only feature provided by these two functions that isn't provided by the wait, waitid, and waitpid functions is an additional argument that allows the kernel to return a summary of the resources used by the terminated process and all its child processes.

[View full width]

 #include <sys/types.h> #include <sys/wait.h> #include <sys/time.h> #include <sys/resource.h> pid_t wait3(int *statloc, int options, struct  rusage *rusage); pid_t wait4(pid_t pid, int *statloc, int options,  struct rusage *rusage); 

Both return: process ID if OK, 0, or 1 on error


The resource information includes such statistics as the amount of user CPU time, the amount of system CPU time, number of page faults, number of signals received, and the like. Refer to the geTRusage(2) manual page for additional details. (This resource information differs from the resource limits we described in Section 7.11.) Figure 8.11 details the various arguments supported by the wait functions.

Figure 8.11. Arguments supported by wait functions on various systems

Function

pid

options

rusage

POSIX.1

Free BSD 5.2.1

Linux 2.4.22

Mac OSX 10.3

Solaris 9

wait

   

waitid

 

XSI

   

waitpid

 

wait3

 

 

wait4

 


The wait3 function was included in earlier versions of the Single UNIX Specification. In Version 2, wait3 was moved to the legacy category; wait3 was removed from the specification in Version 3.

    team bbl



    Advanced Programming in the UNIX Environment
    Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
    ISBN: 0321525949
    EAN: 2147483647
    Year: 2005
    Pages: 370

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net