Thread (1 message) 1 message, 1 author, 2015-03-18

Re: [PATCH 2/6] eal: Close file descriptor of uio configuration

From: David Marchand <hidden>
Date: 2015-03-18 15:19:18

On Tue, Mar 17, 2015 at 10:30 AM, Tetsuya Mukawa [off-list ref] wrote:
quoted hunk
When pci_uio_unmap_resource() is called, a file descriptor that is used
for uio configuration should be closed.

Signed-off-by: Tetsuya Mukawa <mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index 9cdf24f..b971ec9 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -459,8 +459,14 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)

        /* close fd if in primary process */
        close(dev->intr_handle.fd);
-
        dev->intr_handle.fd = -1;
+
+       /* close cfg_fd if in primary process */
+       if (dev->intr_handle.uio_cfg_fd >= 0) {
+               close(dev->intr_handle.uio_cfg_fd);
+               dev->intr_handle.uio_cfg_fd = -1;
+       }
+
        dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
 }
 #endif /* RTE_LIBRTE_EAL_HOTPLUG */
Hum, why check for < 0 value ?
There is no such check for intr_handle.fd and I can see no reason why we
should behave differently.


-- 
David Marchand
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help