svn commit: r297296 - head/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Sat Mar 26 19:15:25 UTC 2016


Author: dchagin
Date: Sat Mar 26 19:15:23 2016
New Revision: 297296
URL: https://svnweb.freebsd.org/changeset/base/297296

Log:
  Implement O_NONBLOCK flag via fcntl(F_SETFL) for eventfd object.
  
  MFC after:	1 week

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

Modified: head/sys/compat/linux/linux_event.c
==============================================================================
--- head/sys/compat/linux/linux_event.c	Sat Mar 26 17:49:46 2016	(r297295)
+++ head/sys/compat/linux/linux_event.c	Sat Mar 26 19:15:23 2016	(r297296)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/user.h>
 #include <sys/file.h>
 #include <sys/filedesc.h>
+#include <sys/filio.h>
 #include <sys/errno.h>
 #include <sys/event.h>
 #include <sys/poll.h>
@@ -871,8 +872,24 @@ static int
 eventfd_ioctl(struct file *fp, u_long cmd, void *data,
 	struct ucred *active_cred, struct thread *td)
 {
+	struct eventfd *efd;
 
-	return (ENXIO);
+	efd = fp->f_data;
+	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
+		return (EINVAL);
+
+	switch (cmd)
+	{
+	case FIONBIO:
+		if (*(int *)data)
+			efd->efd_flags |= LINUX_O_NONBLOCK;
+		else
+			efd->efd_flags &= ~LINUX_O_NONBLOCK;
+	case FIOASYNC:
+		return (0);
+	default:
+		return (ENXIO);
+	}
 }
 
 /*ARGSUSED*/


More information about the svn-src-head mailing list