summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2016-01-09 18:23:34 +0000
committerdchagin <dchagin@FreeBSD.org>2016-01-09 18:23:34 +0000
commit0fba4d31404955c6babb54c71c7642cce9ead7d3 (patch)
treef91755ca11baa988388f6a46b4f44573a8b9ec91 /sys/compat
parent3fca4fe8523b16d9f47fd7eeb14581f9ce96d00e (diff)
downloadFreeBSD-src-0fba4d31404955c6babb54c71c7642cce9ead7d3.zip
FreeBSD-src-0fba4d31404955c6babb54c71c7642cce9ead7d3.tar.gz
MFC r284626:
Add EPOLLRDHUP support.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_event.c4
-rw-r--r--sys/compat/linux/linux_event.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index 8780373..1fe3445 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -257,6 +257,8 @@ epoll_to_kevent(struct thread *td, struct file *epfp,
*kev_flags |= EV_CLEAR;
if ((levents & LINUX_EPOLLERR) != 0)
*kev_flags |= EV_ERROR;
+ if ((levents & LINUX_EPOLLRDHUP) != 0)
+ *kev_flags |= EV_EOF;
/* flags related to what event is registered */
if ((levents & LINUX_EPOLL_EVRD) != 0) {
@@ -306,6 +308,8 @@ kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event)
switch (kevent->filter) {
case EVFILT_READ:
l_event->events = LINUX_EPOLLIN|LINUX_EPOLLRDNORM|LINUX_EPOLLPRI;
+ if ((kevent->flags & EV_EOF) != 0)
+ l_event->events |= LINUX_EPOLLRDHUP;
break;
case EVFILT_WRITE:
l_event->events = LINUX_EPOLLOUT|LINUX_EPOLLWRNORM;
diff --git a/sys/compat/linux/linux_event.h b/sys/compat/linux/linux_event.h
index 0c030ad..9b7d37b 100644
--- a/sys/compat/linux/linux_event.h
+++ b/sys/compat/linux/linux_event.h
@@ -49,7 +49,7 @@
|LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI)
#define LINUX_EPOLL_EVWR (LINUX_EPOLLOUT|LINUX_EPOLLWRNORM)
#define LINUX_EPOLL_EVSUP (LINUX_EPOLLET|LINUX_EPOLLONESHOT \
- |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR)
+ |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP)
#define LINUX_EPOLL_CTL_ADD 1
#define LINUX_EPOLL_CTL_DEL 2
OpenPOWER on IntegriCloud