In Linux,
#include <stdlib.h> void exit(int status);
What does exit()
send status
to, the parent process or the OS kernel?
APUE says that
exit()
performs certain cleanup processing and then returns to the kernel.
But when I run a program in shell, the program returns its exit status to the shell which is its parent process.
Advertisement
Answer
As you’re probably aware, Linux (like most Operating Systems) keeps processes separate. That’s why the result of exit
is passed via the kernel to the parent process.