eal: set errno when exiting for already initialized
authorAaron Conole <aconole@redhat.com>
Wed, 22 Mar 2017 20:19:32 +0000 (16:19 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 27 Mar 2017 13:53:46 +0000 (15:53 +0200)
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/bsdapp/eal/eal.c
lib/librte_eal/linuxapp/eal/eal.c

index a71566c..a7a3a25 100644 (file)
@@ -511,8 +511,11 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (!rte_atomic32_test_and_set(&run_once))
+       if (!rte_atomic32_test_and_set(&run_once)) {
+               rte_eal_init_alert("already called initialization.");
+               rte_errno = EALREADY;
                return -1;
+       }
 
        thread_id = pthread_self();
 
index 5a92b28..564cac3 100644 (file)
@@ -765,8 +765,11 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (!rte_atomic32_test_and_set(&run_once))
+       if (!rte_atomic32_test_and_set(&run_once)) {
+               rte_eal_init_alert("already called initialization.");
+               rte_errno = EALREADY;
                return -1;
+       }
 
        logid = strrchr(argv[0], '/');
        logid = strdup(logid ? logid + 1: argv[0]);