If I'm not mistaken, waitpid blocks until it returns - why can't we just call waitpid and then check the value of status after it returns instead of having it in a while loop?  (I might be missing something about the semantics of waitpid, so this is a genuine question.)