vfio: set eventfd non-blocking and not inherited
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 29 Apr 2015 15:15:45 +0000 (08:15 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 11 May 2015 15:07:57 +0000 (17:07 +0200)
Set internal event file descriptor to be non-block and not
inherited across exec.  This prevents accidental hangs and
passing in another thread.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c

index aea1fb1..426953a 100644 (file)
@@ -294,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
                }
 
                /* set up an eventfd for interrupts */
-               fd = eventfd(0, 0);
+               fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
                if (fd < 0) {
                        RTE_LOG(ERR, EAL, "  cannot set up eventfd, "
                                        "error %i (%s)\n", errno, strerror(errno));