Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2014 20:13:25 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r265387 - user/dchagin/lemul/sys/compat/linux
Message-ID:  <201405052013.s45KDPg0055954@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Mon May  5 20:13:25 2014
New Revision: 265387
URL: http://svnweb.freebsd.org/changeset/base/265387

Log:
  hecking epoll fd against fd is useless as different fds could
  resolve to the same file.
  Instead of checking of file descriptors compare file pointers.
  
  Suggested by: mjg

Modified:
  user/dchagin/lemul/sys/compat/linux/linux_event.c

Modified: user/dchagin/lemul/sys/compat/linux/linux_event.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_event.c	Mon May  5 19:53:03 2014	(r265386)
+++ user/dchagin/lemul/sys/compat/linux/linux_event.c	Mon May  5 20:13:25 2014	(r265387)
@@ -339,9 +339,6 @@ linux_epoll_ctl(struct thread *td, struc
 	int nchanges = 0;
 	int error;
 
-	if (args->epfd == args->fd)
-		return (EINVAL);
-
 	if (args->op != LINUX_EPOLL_CTL_DEL) {
 		error = copyin(args->event, &le, sizeof(le));
 		if (error != 0)
@@ -359,6 +356,12 @@ linux_epoll_ctl(struct thread *td, struc
 	if (error != 0)
 		goto leave1;
 
+	/* Linux disallows spying on himself */
+	if (epfp == fp) {
+		error = EINVAL;
+		goto leave0;
+	}
+
 	ciargs.changelist = kev;
 
 	switch (args->op) {



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