pid这个很好理解,进程标识号,也是你ps -le显示出来的pid。如果指定了pid则会在指定pid发生变化后唤醒父进程,此外还有一下4种情况: < -1 which means to wait for any child process whose process group ID is equal to the absolute value of pid. -1 which means to wait for any child process; this is equivalent to calling wait3. 0 which means to wait for any child process whose process group ID is equal to that of the calling process. > 0 which means to wait for the child whose process ID is equal to the value of pid.
status子进程的返回状态,这是个用于描述进程返回状态的整数,有各种宏操作可以查看,如下: WIFEXITED(status) is non-zero if the child exited normally.
WEXITSTATUS(status) evaluates to the least significant eight bits of the return code of the child which terminated, which may have been set as the argument to a call to exit() or as the argument for a return statement in the main program. This macro can only be evaluated if WIFEXITED returned non-zero.
WIFSIGNALED(status) returns true if the child process exited because of a signal which was not caught.
WTERMSIG(status) returns the number of the signal that caused the child process to terminate. This macro can only be evaluated if WIFSIGNALED returned non-zero.
WIFSTOPPED(status) returns true if the child process which caused the return is currently stopped; this is only possible if the call was done using WUNTRACED.
WSTOPSIG(status) returns the number of the signal which caused the child to stop. This macro can only be evaluated if WIFSTOPPED returned non-zero.
最后rusage记录死亡进程资源使用信息,这个数据结构定义如下: struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ long ru_maxrss; /* maximum resident set size */ long ru_ixrss; /* integral shared memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages sent */ long ru_msgrcv; /* messages received */ long ru_nsignals; /* signals received */ long ru_nvcsw; /* voluntary context switches */ long ru_nivcsw; /* involuntary context switches */ };