hrev51343 adds 1 changeset to branch 'master'
old head: 57b87ea9c386cf46e71e4cb83527fadf2fd64ee2
new head: 65abebfaa73cc5833b38358e5d281a8f05914018
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=65abebfaa73c+%5E57b87ea9c386
----------------------------------------------------------------------------
65abebfaa73c: fifo: wakeup readers not checking POLLHUP/B_SELECT_DISCONNECTED
For readers waiting in select() or simply in read(),
B_SELECT_DISCONNECTED notification didn't wake them anymore.
Now, cascade notifications to be sure to wake them, either
on POLLHUP, POOLERR/B_SELECT_ERROR or, at worst, from read().
See #7859 for details.
[ Philippe Houdoin <philippe.houdoin@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev51343
Commit: 65abebfaa73cc5833b38358e5d281a8f05914018
URL: http://cgit.haiku-os.org/haiku/commit/?id=65abebfaa73c
Author: Philippe Houdoin <philippe.houdoin@xxxxxxxxx>
Date: Thu Aug 3 11:48:02 2017 UTC
Ticket: https://dev.haiku-os.org/ticket/7859
----------------------------------------------------------------------------
1 file changed, 12 insertions(+), 3 deletions(-)
src/system/kernel/fs/fifo.cpp | 15 ++++++++++++---
----------------------------------------------------------------------------
diff --git a/src/system/kernel/fs/fifo.cpp b/src/system/kernel/fs/fifo.cpp
index 65c1b02..6b212b4 100644
--- a/src/system/kernel/fs/fifo.cpp
+++ b/src/system/kernel/fs/fifo.cpp
@@ -616,14 +616,17 @@ Inode::NotifyEndClosed(bool writer)
if (fReadSelectSyncPool)
notify_select_event_pool(fReadSelectSyncPool,
B_SELECT_DISCONNECTED);
+ notify_select_event_pool(fReadSelectSyncPool,
B_SELECT_ERROR);
+ notify_select_event_pool(fReadSelectSyncPool,
B_SELECT_READ);
}
} else {
// Last reader is gone. Wake up all writers.
fWriteCondition.NotifyAll();
if (fWriteSelectSyncPool) {
- notify_select_event_pool(fWriteSelectSyncPool,
B_SELECT_WRITE);
notify_select_event_pool(fWriteSelectSyncPool,
B_SELECT_DISCONNECTED);
+ notify_select_event_pool(fWriteSelectSyncPool,
B_SELECT_ERROR);
+ notify_select_event_pool(fWriteSelectSyncPool,
B_SELECT_WRITE);
}
}
}
@@ -712,13 +715,19 @@ Inode::Select(uint8 event, selectsync* sync, int openMode)
if (writer) {
if (event == B_SELECT_WRITE && fBuffer.Writable() > 0)
return notify_select_event(sync, event);
- if (fReaderCount == 0)
+ if (fReaderCount == 0) {
+ if (event == B_SELECT_ERROR)
+ return notify_select_event(sync, event);
return notify_select_event(sync, B_SELECT_DISCONNECTED);
+ }
} else {
if (event == B_SELECT_READ && fBuffer.Readable() > 0)
return notify_select_event(sync, event);
- if (fWriterCount == 0)
+ if (fWriterCount == 0) {
+ if (event == B_SELECT_ERROR)
+ return notify_select_event(sync, event);
return notify_select_event(sync, B_SELECT_DISCONNECTED);
+ }
}
return B_OK;