For child processes, the wait() and waitpid() functions can be used to suspends execution of the current process until a child has exited. But t
So far I've found three ways to do this on Linux:
kill or by testing for the existence of /proc/$pid, as in most of the other answersptrace system call to attach to the process like a debugger so you get notified when it exits, as in a3nm's answernetlink interface to listen for PROC_EVENT_EXIT messages - this way the kernel tells your program every time a process exits and you just wait for the right process ID. I've only seen this described in one place on the internet.Shameless plug: I'm working on a program (open source of course; GPLv2) that does any of the three.