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.

Bug: 13965
This commit is contained in:
Xiang Fan 2018-01-20 23:47:51 +08:00 committed by Jérôme Duval
parent 46b328f136
commit 8a38c1fdc2
1 changed files with 6 additions and 2 deletions

View File

@ -566,10 +566,14 @@ select_fd(int32 fd, struct select_info* info, bool kernel)
uint16 eventsToSelect = info->selected_events & ~B_EVENT_INVALID;
if (descriptor->ops->fd_select == NULL && eventsToSelect != 0) {
if (descriptor->ops->fd_select == NULL) {
// if the I/O subsystem doesn't support select(), we will
// immediately notify the select call
return notify_select_events(info, eventsToSelect);
eventsToSelect &= ~SELECT_OUTPUT_ONLY_FLAGS;
if (eventsToSelect != 0)
return notify_select_events(info, eventsToSelect);
else
return B_OK;
}
// We need the FD to stay open while we're doing this, so no select()/