We have seen several APIs that perform the work of having the parent process wait until the child changes state (dies, or stops, or resumes after stop):
- wait
- waitpid
- waitid
- wait3
- wait4
Interestingly, and similar to the situation with the exec family APIs, the Linux implementation is such that most of the preceding APIs are library (glibc) wrappers: The fact is that, on the Linux OS, of all the preceding APIs, wait4(2) is the actual system call API.
Performing an strace(1) on a program that uses one of the wait APIs proves the point (we strace our simpsh_v1 program, which calls wait):
$ strace -e trace=process -o strc.txt ./simpsh_v1 >> ps PID TTY TIME CMD14874 pts/6 00:00:00 bash27248 pts/6 00:00:00 strace27250 pts/6 ...