Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Apr 2016 06:15:14 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297502 - stable/10/sys/compat/linux
Message-ID:  <201604020615.u326FEGt065477@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Apr  2 06:15:14 2016
New Revision: 297502
URL: https://svnweb.freebsd.org/changeset/base/297502

Log:
  MFC r297296:
  
  Implement O_NONBLOCK flag via fcntl(F_SETFL) for eventfd object.

Modified:
  stable/10/sys/compat/linux/linux_event.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_event.c
==============================================================================
--- stable/10/sys/compat/linux/linux_event.c	Sat Apr  2 01:59:53 2016	(r297501)
+++ stable/10/sys/compat/linux/linux_event.c	Sat Apr  2 06:15:14 2016	(r297502)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.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>
@@ -868,8 +869,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*/



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