wait3に引数pidが増えただけです。
#include < sys/types.h > #include < sys/time.h > #include < sys/resource.h > #include < sys/wait.h > #include < unistd.h > #include < stdio.h > int main() { int status; pid_t pid; struct rusage usage; if ((pid = fork()) < 0){ perror("fork"); return 1; } else if (pid == 0){ write(1, "chlid process\n", 14); _exit(12); } write(1, "parent process\n", 15); if ((pid = wait4(pid, status, 0, &usage)) < 0){ perror("wait4"); return 1; } if(WIFEXITED(status)){ printf( "pid = %d exited with status = %d\n", (int)pid, WEXITSTATUS(status)); } printf( "user time = %ld.%06ld\n" "system time = %ld.%06ld\n", usage.ru_utime.tv_sec, usage.ru_utime.tv_usec, usage.ru_stime.tv_sec, usage.ru_stime.tv_usec); return 0; }