wait3和wait4函数

wait3和wait4函数

多数unix系统提供了两个额外的函数:wait3wait4。它的功能并不是像waitwaitidwaitpid函数一样,而是返回终止进程及其所有子进程所占用的资源的汇总。

#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

 

资源信息包含:用户CPU时间汇总统计,系统CPU时间总量,失效页面数,已收到的信号数,等等。查看getrusage系统手册有详细信息。

发表回复