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*/
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to