Reputation: 1072
As stated in pipe's Linux man page, given a pipe/FIFO that was opened properly for reading & writng, if the write end is closed, then "an attempt to read(2) from the pipe will see end-of-file (read(2) will return 0)". My question is, let's say I've written some data to the pipe (which should now be stored in a kernel buffer), and I've then closed the writing end before the reading end managed to read the data, will a following attempt to read from the file still automatically get EOF, or will the reader be able to first read the data in the kernel buffer and only afterwards get EOF?
Upvotes: 0
Views: 582
Reputation: 12322
The data still in the pipe is read first before an EOF is signaled.
Upvotes: 3