版權所有 © 2014 tutorialspoint
#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);
pid_t wait3(int *status, int options, struct rusage *rusage);
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
wait3() 和 wait4() 系統呼叫類似於 waitpid(2),但額外返回指向 *rusage* 的結構中子程序的資源使用資訊。
除了使用 *rusage* 引數外,以下 wait3() 呼叫
wait3(status, options, rusage);
等效於
waitpid(-1, status, options);
同樣,以下
wait4() 呼叫
wait4(pid, status, options, rusage);
waitpid(pid, status, options);
換句話說,wait3() 等待任何子程序,而 wait4() 可用於選擇要等待的特定子程序或子程序。有關詳細資訊,請參閱 wait(2)。
如果 *rusage* 不是 NULL,則指向它的 *struct rusage* 將填充子程序的計費資訊。有關詳細資訊,請參閱 getrusage(2)。
與 waitpid(2) 相同。
如今不需要包含 *<sys/time.h>*,但這提高了可移植性。(實際上,*<sys/resource.h>* 定義了 *rusage* 結構,其欄位的型別為 *<sys/time.h>* 中定義的 *struct timeval*。)
只有在定義 _BSD_SOURCE 時,才能使用這些函式的原型。
4.3BSD
fork (2)
getrusage (2)
sigaction (2)
signal (2)
wait (2)
廣告