From 931bef1d7eddad2ac39cface8c8628f0ab01e530 Mon Sep 17 00:00:00 2001
From: Xiang Fan <sfanxiang@gmail.com>
Date: Sun, 21 Jan 2018 00:15:39 +0800
Subject: [PATCH 4/4] kernel: vfs: 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 vnode does not have select().
---
src/system/kernel/fs/vfs.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp
index 8f9ebe3e97..a519af4555 100644
a
|
b
|
|
52 | 52 | #include <vfs.h> |
53 | 53 | #include <vm/vm.h> |
54 | 54 | #include <vm/VMCache.h> |
| 55 | #include <wait_for_objects.h> |
55 | 56 | |
56 | 57 | #include "EntryCache.h" |
57 | 58 | #include "fifo.h" |
… |
… |
file_select(struct file_descriptor* descriptor, uint8 event,
|
5773 | 5774 | struct vnode* vnode = descriptor->u.vnode; |
5774 | 5775 | |
5775 | 5776 | // If the FS has no select() hook, notify select() now. |
5776 | | if (!HAS_FS_CALL(vnode, select)) |
5777 | | return notify_select_event(sync, event); |
| 5777 | if (!HAS_FS_CALL(vnode, select)) { |
| 5778 | if (!SELECT_TYPE_IS_OUTPUT_ONLY(event)) |
| 5779 | return notify_select_event(sync, event); |
| 5780 | else |
| 5781 | return B_OK; |
| 5782 | } |
5778 | 5783 | |
5779 | 5784 | return FS_CALL(vnode, select, descriptor->cookie, event, sync); |
5780 | 5785 | } |