1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-21 15:45:02 +00:00

Add EPOLLRDHUP support.

Tested by:	abi at abinet dot ru
This commit is contained in:
Dmitry Chagin 2015-06-20 05:40:35 +00:00
parent 3dede9f354
commit 3c91646b46
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284626
2 changed files with 5 additions and 1 deletions

View File

@ -260,6 +260,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) {
@ -309,6 +311,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;

View File

@ -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