When reading about works in advanced programming on UNIX, I noticed that after the fork, the parent can close() read the end of the pipe, and it does not close the end of the read for the child. When the fork process, its file descriptors are saved?
What I mean is that before the fork, the channel file descriptor has a storage counter of 1 and after fork 2. When the parent closed his read side, fd went to 1 and remains open for the child. This, in fact, , what's happening? Does this also happen for regular file descriptors?
c unix pipe fork
Stephen melvin
source share