Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jun 2015 05:40:36 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284626 - head/sys/compat/linux
Message-ID:  <201506200540.t5K5ea6d013226@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Jun 20 05:40:35 2015
New Revision: 284626
URL: https://svnweb.freebsd.org/changeset/base/284626

Log:
  Add EPOLLRDHUP support.
  
  Tested by:	abi at abinet dot ru

Modified:
  head/sys/compat/linux/linux_event.c
  head/sys/compat/linux/linux_event.h

Modified: head/sys/compat/linux/linux_event.c
==============================================================================
--- head/sys/compat/linux/linux_event.c	Sat Jun 20 04:48:53 2015	(r284625)
+++ head/sys/compat/linux/linux_event.c	Sat Jun 20 05:40:35 2015	(r284626)
@@ -260,6 +260,8 @@ epoll_to_kevent(struct thread *td, struc
 		*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, s
 	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;

Modified: head/sys/compat/linux/linux_event.h
==============================================================================
--- head/sys/compat/linux/linux_event.h	Sat Jun 20 04:48:53 2015	(r284625)
+++ head/sys/compat/linux/linux_event.h	Sat Jun 20 05:40:35 2015	(r284626)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506200540.t5K5ea6d013226>