summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_event.c
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2019-11-24 20:41:47 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2019-11-24 20:41:47 +0000
commit896a4c279dbcca744aebd7b40bb62f2de4650b0b (patch)
tree741e4a8c9cba9036f4ec05cf57ab285a2b589ba6 /sys/compat/linux/linux_event.c
parent323624493636f90fc02e09196000d8d6b80947ab (diff)
Notes
Diffstat (limited to 'sys/compat/linux/linux_event.c')
-rw-r--r--sys/compat/linux/linux_event.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index f10cccec30a4..7d26ee3e5051 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -306,7 +306,7 @@ epoll_to_kevent(struct thread *td, struct file *epfp,
/* flags related to how event is registered */
if ((levents & LINUX_EPOLLONESHOT) != 0)
- *kev_flags |= EV_ONESHOT;
+ *kev_flags |= EV_DISPATCH;
if ((levents & LINUX_EPOLLET) != 0)
*kev_flags |= EV_CLEAR;
if ((levents & LINUX_EPOLLERR) != 0)
@@ -501,16 +501,17 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ctl_args *args)
case LINUX_EPOLL_CTL_ADD:
/*
* kqueue_register() return ENOENT if event does not exists
- * and the EV_ADD flag is not set.
+ * and the EV_ADD flag is not set. Reset EV_ENABLE flag to
+ * avoid accidental activation of fired oneshot events.
*/
- kev[0].flags &= ~EV_ADD;
+ kev[0].flags &= ~(EV_ADD | EV_ENABLE);
error = kqfd_register(args->epfd, &kev[0], td, M_WAITOK);
if (error != ENOENT) {
error = EEXIST;
goto leave0;
}
error = 0;
- kev[0].flags |= EV_ADD;
+ kev[0].flags |= (EV_ADD | EV_ENABLE);
break;
case LINUX_EPOLL_CTL_DEL: