vfs/pipe: trigger I/O-progress handler on EOF

When the last writer closes the pipe, we must trigger the I/O progress
handler to deliver the final EOF to the client (READ_OK with out count
of 0).

Fixes #3697
This commit is contained in:
Norman Feske 2020-03-13 19:50:34 +01:00
parent e3bc77c386
commit 4fe4c9aa63
1 changed files with 6 additions and 1 deletions

View File

@ -400,8 +400,13 @@ class Vfs_pipe::File_system : public Vfs::File_system
Pipe *pipe = nullptr;
if (Pipe_handle *handle = dynamic_cast<Pipe_handle*>(vfs_handle)) {
pipe = &handle->pipe;
if (handle->writer)
if (handle->writer) {
pipe->num_writers--;
/* trigger reattempt of read to deliver EOF */
if (pipe->num_writers == 0)
pipe->submit_signal();
}
} else
if (New_pipe_handle *handle = dynamic_cast<New_pipe_handle*>(vfs_handle))
pipe = &handle->pipe;