Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Nov 2019 20:47:40 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355067 - head/sys/compat/linux
Message-ID:  <201911242047.xAOKleKU045912@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf
Date: Sun Nov 24 20:47:40 2019
New Revision: 355067
URL: https://svnweb.freebsd.org/changeset/base/355067

Log:
  Linux epoll: Register events with zero event mask
  
  Such an events are legal and should be interpreted as EPOLLERR | EPOLLHUP.
  Register a disabled kqueue event in that case as we do not support EPOLLHUP yet.
  
  Required by Linux Steam client.
  
  PR:		240590
  Reported by:	Alex S <iwtcex@gmail.com>
  Reviewed by:	emaste
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D22516

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	Sun Nov 24 20:44:14 2019	(r355066)
+++ head/sys/compat/linux/linux_event.c	Sun Nov 24 20:47:40 2019	(r355067)
@@ -325,6 +325,11 @@ epoll_to_kevent(struct thread *td, int fd, struct epol
 		EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0);
 		++(*nkevents);
 	}
+	/* zero event mask is legal */
+	if ((levents & (LINUX_EPOLL_EVRD | LINUX_EPOLL_EVWR)) == 0) {
+		EV_SET(kevent++, fd, EVFILT_READ, EV_ADD|EV_DISABLE, 0, 0, 0);
+		++(*nkevents);
+	}
 
 	if ((levents & ~(LINUX_EPOLL_EVSUP)) != 0) {
 		p = td->td_proc;

Modified: head/sys/compat/linux/linux_event.h
==============================================================================
--- head/sys/compat/linux/linux_event.h	Sun Nov 24 20:44:14 2019	(r355066)
+++ head/sys/compat/linux/linux_event.h	Sun Nov 24 20:47:40 2019	(r355067)
@@ -45,10 +45,10 @@
 #define	LINUX_EPOLLONESHOT	1u<<30
 #define	LINUX_EPOLLET		1u<<31
 
-#define	LINUX_EPOLL_EVRD	(LINUX_EPOLLIN|LINUX_EPOLLRDNORM	\
-		|LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI)
+#define	LINUX_EPOLL_EVRD	(LINUX_EPOLLIN|LINUX_EPOLLRDNORM)
 #define	LINUX_EPOLL_EVWR	(LINUX_EPOLLOUT|LINUX_EPOLLWRNORM)
 #define	LINUX_EPOLL_EVSUP	(LINUX_EPOLLET|LINUX_EPOLLONESHOT	\
+		|LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI		\
 		|LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP)
 
 #define	LINUX_EPOLL_CTL_ADD	1



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