summaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/bsdapp/eal/eal.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_eal/bsdapp/eal/eal.c')
-rw-r--r--lib/librte_eal/bsdapp/eal/eal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 508cbc46..b8152a75 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void)
int
rte_eal_iopl_init(void)
{
- static int fd;
+ static int fd = -1;
+
+ if (fd < 0)
+ fd = open("/dev/io", O_RDWR);
- fd = open("/dev/io", O_RDWR);
if (fd < 0)
return -1;
/* keep fd open for iopl */