-
Nadav Har'El authored
We used to return the POLLRDHUP event when polling a write-side of a pipe whose reader is closed, but Linux returns POLLERR|POLLOUT, so let's do the same. Linux's behavior can be explained in that when the reader is closed, a write will return immediately (and hence POLLOUT) but moreover, will return with an error (EPIPE). And since a read will also cause an error (EBADF when reading on the write side of the pipe), a POLLERR makes sense and says that any operation on this fd will now result in an error. This patch also adds a test for this case. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
Nadav Har'El authoredWe used to return the POLLRDHUP event when polling a write-side of a pipe whose reader is closed, but Linux returns POLLERR|POLLOUT, so let's do the same. Linux's behavior can be explained in that when the reader is closed, a write will return immediately (and hence POLLOUT) but moreover, will return with an error (EPIPE). And since a read will also cause an error (EBADF when reading on the write side of the pipe), a POLLERR makes sense and says that any operation on this fd will now result in an error. This patch also adds a test for this case. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>