From f9c275b6144d9c37fc8c692e6a4347b0ad18d00e Mon Sep 17 00:00:00 2001
From: Xiang Fan <sfanxiang@gmail.com>
Date: Sat, 20 Jan 2018 23:47:51 +0800
Subject: [PATCH 2/4] kernel: fd: don't notify output-only select events by
default
Output-only events (B_EVENT_ERROR, B_EVENT_DISCONNECTED and
B_EVENT_INVALID, with B_EVENT_INVALID masked out before passing down
events) are used to indicate error, so they should not be notified if
the filesystem does not explicitly provide an fd_select() override.
---
src/system/kernel/fs/fd.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/system/kernel/fs/fd.cpp b/src/system/kernel/fs/fd.cpp
index 4e50e906ef..25b85d9ea3 100644
a
|
b
|
select_fd(int32 fd, struct select_info* info, bool kernel)
|
566 | 566 | |
567 | 567 | uint16 eventsToSelect = info->selected_events & ~B_EVENT_INVALID; |
568 | 568 | |
569 | | if (descriptor->ops->fd_select == NULL && eventsToSelect != 0) { |
| 569 | if (descriptor->ops->fd_select == NULL) { |
570 | 570 | // if the I/O subsystem doesn't support select(), we will |
571 | 571 | // immediately notify the select call |
572 | | return notify_select_events(info, eventsToSelect); |
| 572 | eventsToSelect &= ~SELECT_OUTPUT_ONLY_FLAGS; |
| 573 | if (eventsToSelect != 0) |
| 574 | return notify_select_events(info, eventsToSelect); |
| 575 | else |
| 576 | return B_OK; |
573 | 577 | } |
574 | 578 | |
575 | 579 | // We need the FD to stay open while we're doing this, so no select()/ |