提供了与wait,waitpid,waitid函数唯一不能提供的特性:增加了额外的参数,用于存放中止进程的所有资源的汇总和其所有的子进程
wait3, wait4 - wait for process to change state, BSD style
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
pid_t wait3(int *status, int options, struct rusage *rusage);
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
//Return: process ID if OK, -1 on error
包含了资源信息
- the amount of user CPU time
- the amount of system CPU time
- number of page faults
- number of signal received
可以man getrusage manual
查看详细的额外信息