kernel: devfs: 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 device does not have Select().

Bug: 13965
This commit is contained in:
Xiang Fan 2018-01-21 00:14:49 +08:00 committed by Jérôme Duval
parent 8a38c1fdc2
commit f3b05a74bb
1 changed files with 7 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <util/AutoLock.h>
#include <vfs.h>
#include <vm/vm.h>
#include <wait_for_objects.h>
#include "BaseDevice.h"
#include "FileDevice.h"
@ -1552,8 +1553,12 @@ devfs_select(fs_volume* _volume, fs_vnode* _vnode, void* _cookie,
return B_NOT_ALLOWED;
// If the device has no select() hook, notify select() now.
if (!vnode->stream.u.dev.device->HasSelect())
return notify_select_event((selectsync*)sync, event);
if (!vnode->stream.u.dev.device->HasSelect()) {
if (!SELECT_TYPE_IS_OUTPUT_ONLY(event))
return notify_select_event((selectsync*)sync, event);
else
return B_OK;
}
return vnode->stream.u.dev.device->Select(cookie->device_cookie, event,
(selectsync*)sync);