How does parent process get the termination status through wait from a child process which calls _exit

前端 未结 4 457
滥情空心
滥情空心 2021-01-15 16:31

I have read the following statement.

The status argument given to _exit() defines the termination status of the process, which is available to the p

4条回答
  •  不要未来只要你来
    2021-01-15 16:35

    When the child terminates, the kernel keeps some information about it. Among this information is the return code.

    Meanwhile, the parent hasn't terminated. By calling wait or waitpid it simply asks the kernel "Hey, you know that child of mine? What's his status?".

提交回复
热议问题