The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: sta...@dpdk.org

Signed-off-by: Dengdui Huang <huangdeng...@huawei.com>
Acked-by: Chengwen Feng <fengcheng...@huawei.com>
Acked-by: Morten Brørup <m...@smartsharesystems.com>
---
 lib/eal/common/eal_common_fbarray.c     |  2 +-
 lib/eal/common/eal_common_options.c     |  7 ++--
 lib/eal/common/eal_common_proc.c        | 12 +++----
 lib/eal/common/eal_common_trace_utils.c |  6 ++--
 lib/eal/freebsd/eal.c                   |  4 +--
 lib/eal/freebsd/eal_interrupts.c        |  8 ++---
 lib/eal/freebsd/eal_memory.c            |  2 +-
 lib/eal/freebsd/eal_timer.c             |  7 ++--
 lib/eal/linux/eal.c                     | 10 +++---
 lib/eal/linux/eal_dev.c                 |  2 +-
 lib/eal/linux/eal_hugepage_info.c       |  5 +--
 lib/eal/linux/eal_interrupts.c          | 18 +++++-----
 lib/eal/linux/eal_memalloc.c            | 47 +++++++++++++------------
 lib/eal/linux/eal_memory.c              | 42 +++++++++++-----------
 lib/eal/linux/eal_timer.c               |  2 +-
 lib/eal/linux/eal_vfio.c                | 42 +++++++++++-----------
 lib/eal/unix/eal_filesystem.c           |  5 +--
 lib/eal/unix/eal_unix_memory.c          |  6 ++--
 lib/eal/unix/rte_thread.c               |  6 ++--
 19 files changed, 119 insertions(+), 114 deletions(-)

diff --git a/lib/eal/common/eal_common_fbarray.c 
b/lib/eal/common/eal_common_fbarray.c
index 22b43073c6..8b3ab3cb19 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1041,7 +1041,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
                eal_get_fbarray_path(path, sizeof(path), arr->name);
                if (unlink(path)) {
                        EAL_LOG(DEBUG, "Cannot unlink fbarray: %s",
-                               strerror(errno));
+                               rte_strerror(errno));
                        rte_errno = errno;
                        /*
                         * we're still holding an exclusive lock, so drop it to
diff --git a/lib/eal/common/eal_common_options.c 
b/lib/eal/common/eal_common_options.c
index f1a5e329a5..2aee5a7dad 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -44,6 +44,7 @@
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
+#include <rte_errno.h>
 
 #define BITS_PER_HEX 4
 #define LCORE_OPT_LST 1
@@ -411,7 +412,7 @@ eal_plugindir_init(const char *path)
        d = opendir(path);
        if (d == NULL) {
                EAL_LOG(ERR, "failed to open directory %s: %s",
-                       path, strerror(errno));
+                       path, rte_strerror(errno));
                return -1;
        }
 
@@ -463,7 +464,7 @@ verify_perms(const char *dirpath)
        /* call stat to check for permissions and ensure not world writable */
        if (stat(dirpath, &st) != 0) {
                EAL_LOG(ERR, "Error with stat on %s, %s",
-                               dirpath, strerror(errno));
+                               dirpath, rte_strerror(errno));
                return -1;
        }
        if (st.st_mode & S_IWOTH) {
@@ -491,7 +492,7 @@ eal_dlopen(const char *pathname)
        }
        if (realp == NULL) {
                EAL_LOG(ERR, "Error with realpath for %s, %s",
-                               pathname, strerror(errno));
+                               pathname, rte_strerror(errno));
                goto out;
        }
        if (strnlen(realp, PATH_MAX) == PATH_MAX) {
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index d24093937c..07ccf68118 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct 
sockaddr_un *s)
                if (errno == EINTR)
                        goto retry;
 
-               EAL_LOG(ERR, "recvmsg failed, %s", strerror(errno));
+               EAL_LOG(ERR, "recvmsg failed, %s", rte_strerror(errno));
                return -1;
        }
 
@@ -583,7 +583,7 @@ open_socket_fd(void)
 
        if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
                EAL_LOG(ERR, "failed to bind %s: %s",
-                       un.sun_path, strerror(errno));
+                       un.sun_path, rte_strerror(errno));
                close(mp_fd);
                return -1;
        }
@@ -631,13 +631,13 @@ rte_mp_channel_init(void)
        dir_fd = open(mp_dir_path, O_RDONLY);
        if (dir_fd < 0) {
                EAL_LOG(ERR, "failed to open %s: %s",
-                       mp_dir_path, strerror(errno));
+                       mp_dir_path, rte_strerror(errno));
                return -1;
        }
 
        if (flock(dir_fd, LOCK_EX)) {
                EAL_LOG(ERR, "failed to lock %s: %s",
-                       mp_dir_path, strerror(errno));
+                       mp_dir_path, rte_strerror(errno));
                close(dir_fd);
                return -1;
        }
@@ -650,7 +650,7 @@ rte_mp_channel_init(void)
        if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
                        mp_handle, NULL) < 0) {
                EAL_LOG(ERR, "failed to create mp thread: %s",
-                       strerror(errno));
+                       rte_strerror(errno));
                close(dir_fd);
                close(rte_atomic_exchange_explicit(&mp_fd, -1, 
rte_memory_order_relaxed));
                return -1;
@@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int 
type)
                        return 0;
                }
                EAL_LOG(ERR, "failed to send to (%s) due to %s",
-                       dst_path, strerror(errno));
+                       dst_path, rte_strerror(errno));
                return -1;
        }
 
diff --git a/lib/eal/common/eal_common_trace_utils.c 
b/lib/eal/common/eal_common_trace_utils.c
index 7282715b11..ee5fe6f7b3 100644
--- a/lib/eal/common/eal_common_trace_utils.c
+++ b/lib/eal/common/eal_common_trace_utils.c
@@ -245,7 +245,7 @@ eal_trace_dir_args_save(char const *val)
        int rc;
 
        if (asprintf(&dir_path, "%s/", val) == -1) {
-               trace_err("failed to copy directory: %s", strerror(errno));
+               trace_err("failed to copy directory: %s", rte_strerror(errno));
                return -ENOMEM;
        }
 
@@ -329,7 +329,7 @@ trace_mkdir(void)
        /* Create the path if it t exist, no "mkdir -p" available here */
        rc = mkdir(trace->dir, 0700);
        if (rc < 0 && errno != EEXIST) {
-               trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+               trace_err("mkdir %s failed [%s]", trace->dir, 
rte_strerror(errno));
                rte_errno = errno;
                return -rte_errno;
        }
@@ -344,7 +344,7 @@ trace_mkdir(void)
 
        rc = mkdir(trace->dir, 0700);
        if (rc < 0) {
-               trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+               trace_err("mkdir %s failed [%s]", trace->dir, 
rte_strerror(errno));
                rte_errno = errno;
                return -rte_errno;
        }
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 1229230063..083867babd 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -203,7 +203,7 @@ rte_eal_config_attach(void)
                close(mem_cfg_fd);
                mem_cfg_fd = -1;
                EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
@@ -250,7 +250,7 @@ rte_eal_config_reattach(void)
                        return -1;
                }
                EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 23747babc2..1fbcdc2f2d 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle 
*intr_handle,
                        else
                                EAL_LOG(ERR, "Error adding fd %d kevent, %s",
                                        rte_intr_fd_get(src->intr_handle),
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        ret = -errno;
                        goto fail;
                }
@@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle 
*intr_handle,
                if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
                        EAL_LOG(ERR, "Error removing fd %d kevent, %s",
                                rte_intr_fd_get(src->intr_handle),
-                               strerror(errno));
+                               rte_strerror(errno));
                        /* removing non-existent even is an expected condition
                         * in some circumstances (e.g. oneshot events).
                         */
@@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
                                EAL_LOG(ERR, "Error reading from file "
                                        "descriptor %d: %s",
                                        event_fd,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        } else if (bytes_read == 0)
                                EAL_LOG(ERR, "Read nothing from file "
                                        "descriptor %d", event_fd);
@@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
                                if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
                                        EAL_LOG(ERR, "Error removing fd %d 
kevent, %s",
                                                
rte_intr_fd_get(src->intr_handle),
-                                               strerror(errno));
+                                               rte_strerror(errno));
                                        /* removing non-existent even is an 
expected
                                         * condition in some circumstances
                                         * (e.g. oneshot events).
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index a6f3ba226e..029c84f7b2 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -85,7 +85,7 @@ rte_eal_hugepage_init(void)
                                MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                if (addr == MAP_FAILED) {
                        EAL_LOG(ERR, "%s: mmap() failed: %s", __func__,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        return -1;
                }
 
diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c
index 4eba66eadb..ccd07072c6 100644
--- a/lib/eal/freebsd/eal_timer.c
+++ b/lib/eal/freebsd/eal_timer.c
@@ -15,6 +15,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_debug.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -36,20 +37,20 @@ get_tsc_freq(uint64_t arch_hz)
        tmp = 0;
 
        if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0))
-               EAL_LOG(WARNING, "%s", strerror(errno));
+               EAL_LOG(WARNING, "%s", rte_strerror(errno));
        else if (tmp != 1)
                EAL_LOG(WARNING, "TSC is not safe to use in SMP mode");
 
        tmp = 0;
 
        if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0))
-               EAL_LOG(WARNING, "%s", strerror(errno));
+               EAL_LOG(WARNING, "%s", rte_strerror(errno));
        else if (tmp != 1)
                EAL_LOG(WARNING, "TSC is not invariant");
 
        sz = sizeof(tsc_hz);
        if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
-               EAL_LOG(WARNING, "%s", strerror(errno));
+               EAL_LOG(WARNING, "%s", rte_strerror(errno));
                return arch_hz;
        }
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 54577b7718..ded2222d49 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -160,7 +160,7 @@ eal_clean_runtime_dir(void)
                closedir(dir);
 
        EAL_LOG(ERR, "Error while clearing runtime dir: %s",
-               strerror(errno));
+               rte_strerror(errno));
 
        return -1;
 }
@@ -288,7 +288,7 @@ rte_eal_config_attach(void)
                close(mem_cfg_fd);
                mem_cfg_fd = -1;
                EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
@@ -335,7 +335,7 @@ rte_eal_config_reattach(void)
                        return -1;
                }
                EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
@@ -1412,7 +1412,7 @@ rte_eal_check_module(const char *module_name)
        /* Check if there is sysfs mounted */
        if (stat("/sys/module", &st) != 0) {
                EAL_LOG(DEBUG, "sysfs is not mounted! error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
@@ -1425,7 +1425,7 @@ rte_eal_check_module(const char *module_name)
 
        if (stat(sysfs_mod_name, &st) != 0) {
                EAL_LOG(DEBUG, "Module %s not found! error %i (%s)",
-                       sysfs_mod_name, errno, strerror(errno));
+                       sysfs_mod_name, errno, rte_strerror(errno));
                return 0;
        }
 
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index e63f24d108..95b1d02c9f 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info,
        if (ret == -1) {
                rte_exit(EXIT_FAILURE,
                         "Failed to handle SIGBUS for hot-unplug, "
-                        "(rte_errno: %s)!", strerror(rte_errno));
+                        "(rte_errno: %s)!", rte_strerror(rte_errno));
        } else if (ret == 1) {
                if (sigbus_action_old.sa_flags == SA_SIGINFO
                    && sigbus_action_old.sa_sigaction) {
diff --git a/lib/eal/linux/eal_hugepage_info.c 
b/lib/eal/linux/eal_hugepage_info.c
index d47a19c56a..8d4e28fb58 100644
--- a/lib/eal/linux/eal_hugepage_info.c
+++ b/lib/eal/linux/eal_hugepage_info.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_common.h>
 #include "rte_string_fns.h"
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void 
*user_data)
                closedir(dir);
 
        EAL_LOG(ERR, "Error while walking hugepage dir: %s",
-               strerror(errno));
+               rte_strerror(errno));
 
        return -1;
 }
@@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 
        if (fstat(whd->file_fd, &st) < 0)
                EAL_LOG(DEBUG, "%s(): stat(\"%s\") failed: %s",
-                               __func__, whd->file_name, strerror(errno));
+                               __func__, whd->file_name, rte_strerror(errno));
        else
                (*total_size) += st.st_size;
 }
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index 6436f796eb..629d012436 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle)
        if (rte_intr_fd_get(intr_handle) < 0 ||
            write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
                EAL_LOG(ERR, "Error disabling interrupts for fd %d (%s)",
-                       rte_intr_fd_get(intr_handle), strerror(errno));
+                       rte_intr_fd_get(intr_handle), rte_strerror(errno));
                return -1;
        }
        return 0;
@@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle)
        if (rte_intr_fd_get(intr_handle) < 0 ||
            write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
                EAL_LOG(ERR, "Error enabling interrupts for fd %d (%s)",
-                       rte_intr_fd_get(intr_handle), strerror(errno));
+                       rte_intr_fd_get(intr_handle), rte_strerror(errno));
                return -1;
        }
        return 0;
@@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int 
nfds)
                                EAL_LOG(ERR, "Error reading from file "
                                        "descriptor %d: %s",
                                        events[n].data.fd,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                                /*
                                 * The device is unplugged or buggy, remove
                                 * it as an interrupt source and return to
@@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg)
                if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
                                                &pipe_event) < 0) {
                        rte_panic("Error adding fd to %d epoll_ctl, %s\n",
-                                       intr_pipe.readfd, strerror(errno));
+                                       intr_pipe.readfd, rte_strerror(errno));
                }
                numfds++;
 
@@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg)
                                        rte_intr_fd_get(src->intr_handle), &ev) 
< 0) {
                                rte_panic("Error adding fd %d epoll_ctl, %s\n",
                                        rte_intr_fd_get(src->intr_handle),
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        }
                        else
                                numfds++;
@@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct 
rte_intr_handle *intr_handle)
                                continue;
                        EAL_LOG(ERR,
                                "Error reading from fd %d: %s",
-                               fd, strerror(errno));
+                               fd, rte_strerror(errno));
                } else if (nbytes == 0)
                        EAL_LOG(ERR, "Read nothing from fd %d", fd);
                return;
@@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events,
                        }
                        /* epoll_wait fail */
                        EAL_LOG(ERR, "epoll_wait returns with fail %s",
-                               strerror(errno));
+                               rte_strerror(errno));
                        rc = -1;
                        break;
                } else {
@@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd,
        ev.events = event->epdata.event;
        if (epoll_ctl(epfd, op, fd, &ev) < 0) {
                EAL_LOG(ERR, "Error op %d fd %d epoll_ctl, %s",
-                       op, fd, strerror(errno));
+                       op, fd, rte_strerror(errno));
                if (op == EPOLL_CTL_ADD)
                        /* rollback status when CTL_ADD fail */
                        rte_atomic_store_explicit(&event->status, 
RTE_EPOLL_INVALID,
@@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, 
uint32_t nb_efd)
                        if (fd < 0) {
                                EAL_LOG(ERR,
                                        "can't setup eventfd, error %i (%s)",
-                                       errno, strerror(errno));
+                                       errno, rte_strerror(errno));
                                return -errno;
                        }
 
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index e354efc95d..08cb502a5a 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -31,6 +31,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int 
socket_id)
                          oldmask->size + 1, 0, 0) < 0) {
                EAL_LOG(ERR,
                        "Failed to get current mempolicy: %s. "
-                       "Assuming MPOL_DEFAULT.", strerror(errno));
+                       "Assuming MPOL_DEFAULT.", rte_strerror(errno));
                *oldpolicy = MPOL_DEFAULT;
        }
        EAL_LOG(DEBUG,
@@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask)
        } else if (set_mempolicy(*oldpolicy, oldmask->maskp,
                                 oldmask->size + 1) < 0) {
                EAL_LOG(ERR, "Failed to restore mempolicy: %s",
-                       strerror(errno));
+                       rte_strerror(errno));
                numa_set_localalloc();
        }
        numa_free_cpumask(oldmask);
@@ -224,7 +225,7 @@ static int lock(int fd, int type)
                return 0;
        } else if (ret) {
                EAL_LOG(ERR, "%s(): error calling flock(): %s",
-                       __func__, strerror(errno));
+                       __func__, rte_strerror(errno));
                return -1;
        }
        /* lock was successful */
@@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
                        fd = memfd_create(segname, flags);
                        if (fd < 0) {
                                EAL_LOG(DEBUG, "%s(): memfd create failed: %s",
-                                       __func__, strerror(errno));
+                                       __func__, rte_strerror(errno));
                                return -1;
                        }
                        fd_list[list_idx].memseg_list_fd = fd;
@@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
                        fd = memfd_create(segname, flags);
                        if (fd < 0) {
                                EAL_LOG(DEBUG, "%s(): memfd create failed: %s",
-                                       __func__, strerror(errno));
+                                       __func__, rte_strerror(errno));
                                return -1;
                        }
                        fd_list[list_idx].fds[seg_idx] = fd;
@@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
        ret = stat(path, &st);
        if (ret < 0 && errno != ENOENT) {
                EAL_LOG(DEBUG, "%s(): stat() for '%s' failed: %s",
-                       __func__, path, strerror(errno));
+                       __func__, path, rte_strerror(errno));
                return -1;
        }
        if (!internal_conf->hugepage_file.unlink_existing && ret == 0 &&
@@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
                /* coverity[toctou] */
                if (unlink(path) < 0) {
                        EAL_LOG(DEBUG, "%s(): could not remove '%s': %s",
-                               __func__, path, strerror(errno));
+                               __func__, path, rte_strerror(errno));
                        return -1;
                }
        }
@@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info 
*hi,
        fd = open(path, O_CREAT | O_RDWR, 0600);
        if (fd < 0) {
                EAL_LOG(ERR, "%s(): open '%s' failed: %s",
-                       __func__, path, strerror(errno));
+                       __func__, path, rte_strerror(errno));
                return -1;
        }
        /* take out a read lock */
        if (lock(fd, LOCK_SH) < 0) {
                EAL_LOG(ERR, "%s(): lock '%s' failed: %s",
-                       __func__, path, strerror(errno));
+                       __func__, path, rte_strerror(errno));
                close(fd);
                return -1;
        }
@@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset,
        if (ret < 0) {
                EAL_LOG(DEBUG, "%s(): fallocate() failed: %s",
                                __func__,
-                               strerror(errno));
+                               rte_strerror(errno));
                return -1;
        }
        return 0;
@@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, 
uint64_t page_sz,
                        if (new_size > cur_size &&
                                        ftruncate(fd, new_size) < 0) {
                                EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s",
-                                       __func__, strerror(errno));
+                                       __func__, rte_strerror(errno));
                                return -1;
                        }
                } else {
@@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, 
uint64_t page_sz,
                                } else {
                                        EAL_LOG(DEBUG, "%s(): fallocate() 
failed: %s",
                                                __func__,
-                                               strerror(errno));
+                                               rte_strerror(errno));
                                        return -1;
                                }
                        } else {
@@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx)
                        rte_eal_process_type() == RTE_PROC_PRIMARY &&
                        unlink(path))
                EAL_LOG(ERR, "%s(): unlinking '%s' failed: %s",
-                       __func__, path, strerror(errno));
+                       __func__, path, rte_strerror(errno));
 
        close(fd);
        fd_list[list_idx].memseg_list_fd = -1;
@@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int 
socket_id,
                        map_offset = 0;
                        if (ftruncate(fd, alloc_sz) < 0) {
                                EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s",
-                                       __func__, strerror(errno));
+                                       __func__, rte_strerror(errno));
                                goto resized;
                        }
                        if (internal_conf->hugepage_file.unlink_before_mapping 
&&
                                        !internal_conf->in_memory) {
                                if (unlink(path)) {
                                        EAL_LOG(DEBUG, "%s(): unlink() failed: 
%s",
-                                               __func__, strerror(errno));
+                                               __func__, rte_strerror(errno));
                                        goto resized;
                                }
                        }
@@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 
        if (va == MAP_FAILED) {
                EAL_LOG(DEBUG, "%s(): mmap() failed: %s", __func__,
-                       strerror(errno));
+                       rte_strerror(errno));
                /* mmap failed, but the previous region might have been
                 * unmapped anyway. try to remap it
                 */
@@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
                                        MPOL_F_NODE | MPOL_F_ADDR);
                if (ret < 0) {
                        EAL_LOG(DEBUG, "%s(): get_mempolicy: %s",
-                               __func__, strerror(errno));
+                               __func__, rte_strerror(errno));
                        goto mapped;
                } else if (cur_socket_id != socket_id) {
                        EAL_LOG(DEBUG,
@@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void 
*arg)
                dir_fd = open(wa->hi->hugedir, O_RDONLY);
                if (dir_fd < 0) {
                        EAL_LOG(ERR, "%s(): Cannot open '%s': %s",
-                               __func__, wa->hi->hugedir, strerror(errno));
+                               __func__, wa->hi->hugedir, rte_strerror(errno));
                        return -1;
                }
                /* blocking writelock */
                if (flock(dir_fd, LOCK_EX)) {
                        EAL_LOG(ERR, "%s(): Cannot lock '%s': %s",
-                               __func__, wa->hi->hugedir, strerror(errno));
+                               __func__, wa->hi->hugedir, rte_strerror(errno));
                        close(dir_fd);
                        return -1;
                }
@@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void 
*arg)
                dir_fd = open(wa->hi->hugedir, O_RDONLY);
                if (dir_fd < 0) {
                        EAL_LOG(ERR, "%s(): Cannot open '%s': %s",
-                               __func__, wa->hi->hugedir, strerror(errno));
+                               __func__, wa->hi->hugedir, rte_strerror(errno));
                        return -1;
                }
                /* blocking writelock */
                if (flock(dir_fd, LOCK_EX)) {
                        EAL_LOG(ERR, "%s(): Cannot lock '%s': %s",
-                               __func__, wa->hi->hugedir, strerror(errno));
+                               __func__, wa->hi->hugedir, rte_strerror(errno));
                        close(dir_fd);
                        return -1;
                }
@@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl,
        dir_fd = open(hi->hugedir, O_RDONLY);
        if (dir_fd < 0) {
                EAL_LOG(ERR, "%s(): Cannot open '%s': %s", __func__,
-                       hi->hugedir, strerror(errno));
+                       hi->hugedir, rte_strerror(errno));
                return -1;
        }
        /* blocking writelock */
        if (flock(dir_fd, LOCK_EX)) {
                EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", __func__,
-                       hi->hugedir, strerror(errno));
+                       hi->hugedir, rte_strerror(errno));
                close(dir_fd);
                return -1;
        }
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 45879ca743..30568335f8 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr)
        fd = open("/proc/self/pagemap", O_RDONLY);
        if (fd < 0) {
                EAL_LOG(INFO, "%s(): cannot open /proc/self/pagemap: %s",
-                       __func__, strerror(errno));
+                       __func__, rte_strerror(errno));
                return RTE_BAD_IOVA;
        }
 
@@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr)
        offset = sizeof(uint64_t) * virt_pfn;
        if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
                EAL_LOG(INFO, "%s(): seek error in /proc/self/pagemap: %s",
-                               __func__, strerror(errno));
+                               __func__, rte_strerror(errno));
                close(fd);
                return RTE_BAD_IOVA;
        }
@@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr)
        close(fd);
        if (retval < 0) {
                EAL_LOG(INFO, "%s(): cannot read /proc/self/pagemap: %s",
-                               __func__, strerror(errno));
+                               __func__, rte_strerror(errno));
                return RTE_BAD_IOVA;
        } else if (retval != PFN_MASK_SIZE) {
                EAL_LOG(INFO, "%s(): read %d bytes from /proc/self/pagemap "
@@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void)
 /* Callback for numa library. */
 void numa_error(char *where)
 {
-       EAL_LOG(ERR, "%s failed: %s", where, strerror(errno));
+       EAL_LOG(ERR, "%s failed: %s", where, rte_strerror(errno));
 }
 #endif
 
@@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct 
hugepage_info *hpi,
                                  oldmask->size + 1, 0, 0) < 0) {
                        EAL_LOG(ERR,
                                "Failed to get current mempolicy: %s. "
-                               "Assuming MPOL_DEFAULT.", strerror(errno));
+                               "Assuming MPOL_DEFAULT.", rte_strerror(errno));
                        oldpolicy = MPOL_DEFAULT;
                }
                for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
@@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct 
hugepage_info *hpi,
                fd = open(hf->filepath, O_CREAT | O_RDWR, 0600);
                if (fd < 0) {
                        EAL_LOG(DEBUG, "%s(): open failed: %s", __func__,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        goto out;
                }
 
@@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct 
hugepage_info *hpi,
                                MAP_SHARED | MAP_POPULATE, fd, 0);
                if (virtaddr == MAP_FAILED) {
                        EAL_LOG(DEBUG, "%s(): mmap failed: %s", __func__,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        close(fd);
                        goto out;
                }
@@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct 
hugepage_info *hpi,
                /* set shared lock on the file. */
                if (flock(fd, LOCK_SH) < 0) {
                        EAL_LOG(DEBUG, "%s(): Locking file failed:%s ",
-                               __func__, strerror(errno));
+                               __func__, rte_strerror(errno));
                        close(fd);
                        goto out;
                }
@@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct 
hugepage_info *hpi,
                } else if (set_mempolicy(oldpolicy, oldmask->maskp,
                                         oldmask->size + 1) < 0) {
                        EAL_LOG(ERR, "Failed to restore mempolicy: %s",
-                               strerror(errno));
+                               rte_strerror(errno));
                        numa_set_localalloc();
                }
        }
@@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 
                if (hp->orig_va != NULL && unlink(hp->filepath)) {
                        EAL_LOG(WARNING, "%s(): Removing %s failed: %s",
-                               __func__, hp->filepath, strerror(errno));
+                               __func__, hp->filepath, rte_strerror(errno));
                }
        }
        return 0;
@@ -640,7 +640,7 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl,
                                                hp->orig_va = NULL;
                                                if (unlink(hp->filepath) == -1) 
{
                                                        EAL_LOG(ERR, "%s(): 
Removing %s failed: %s",
-                                                                       
__func__, hp->filepath, strerror(errno));
+                                                                       
__func__, hp->filepath, rte_strerror(errno));
                                                        return -1;
                                                }
                                        } else {
@@ -736,13 +736,13 @@ remap_segment(struct hugepage_file *hugepages, int 
seg_start, int seg_end)
                fd = open(hfile->filepath, O_RDWR);
                if (fd < 0) {
                        EAL_LOG(ERR, "Could not open '%s': %s",
-                                       hfile->filepath, strerror(errno));
+                                       hfile->filepath, rte_strerror(errno));
                        return -1;
                }
                /* set shared lock on the file. */
                if (flock(fd, LOCK_SH) < 0) {
                        EAL_LOG(DEBUG, "Could not lock '%s': %s",
-                                       hfile->filepath, strerror(errno));
+                                       hfile->filepath, rte_strerror(errno));
                        close(fd);
                        return -1;
                }
@@ -756,7 +756,7 @@ remap_segment(struct hugepage_file *hugepages, int 
seg_start, int seg_end)
                                MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0);
                if (addr == MAP_FAILED) {
                        EAL_LOG(ERR, "Couldn't remap '%s': %s",
-                                       hfile->filepath, strerror(errno));
+                                       hfile->filepath, rte_strerror(errno));
                        close(fd);
                        return -1;
                }
@@ -1178,13 +1178,13 @@ eal_legacy_hugepage_init(void)
                memfd = memfd_create("nohuge", 0);
                if (memfd < 0) {
                        EAL_LOG(DEBUG, "Cannot create memfd: %s",
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        EAL_LOG(DEBUG, "Falling back to anonymous map");
                } else {
                        /* we got an fd - now resize it */
                        if (ftruncate(memfd, internal_conf->memory) < 0) {
                                EAL_LOG(ERR, "Cannot resize memfd: %s",
-                                               strerror(errno));
+                                               rte_strerror(errno));
                                EAL_LOG(ERR, "Falling back to anonymous map");
                                close(memfd);
                        } else {
@@ -1212,7 +1212,7 @@ eal_legacy_hugepage_init(void)
                                flags | MAP_FIXED, fd, 0);
                if (addr == MAP_FAILED || addr != prealloc_addr) {
                        EAL_LOG(ERR, "%s: mmap() failed: %s", __func__,
-                                       strerror(errno));
+                                       rte_strerror(errno));
                        munmap(prealloc_addr, mem_sz);
                        return -1;
                }
@@ -1571,7 +1571,7 @@ eal_legacy_hugepage_attach(void)
                fd = open(hf->filepath, O_RDWR);
                if (fd < 0) {
                        EAL_LOG(ERR, "Could not open %s: %s",
-                               hf->filepath, strerror(errno));
+                               hf->filepath, rte_strerror(errno));
                        goto error;
                }
 
@@ -1579,14 +1579,14 @@ eal_legacy_hugepage_attach(void)
                                MAP_SHARED | MAP_FIXED, fd, 0);
                if (map_addr == MAP_FAILED) {
                        EAL_LOG(ERR, "Could not map %s: %s",
-                               hf->filepath, strerror(errno));
+                               hf->filepath, rte_strerror(errno));
                        goto fd_error;
                }
 
                /* set shared lock on the file. */
                if (flock(fd, LOCK_SH) < 0) {
                        EAL_LOG(DEBUG, "%s(): Locking file failed: %s",
-                               __func__, strerror(errno));
+                               __func__, rte_strerror(errno));
                        goto mmap_error;
                }
 
@@ -1931,7 +1931,7 @@ rte_eal_memseg_init(void)
 
                if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
                        EAL_LOG(DEBUG, "Setting maximum number of open files 
failed: %s",
-                                       strerror(errno));
+                                       rte_strerror(errno));
                } else {
                        EAL_LOG(DEBUG, "Setting maximum number of open files to 
%"
                                        PRIu64,
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 489732c116..3aecff7f47 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default)
        fd = open(DEV_HPET, O_RDONLY);
        if (fd < 0) {
                EAL_LOG(ERR, "ERROR: Cannot open "DEV_HPET": %s!",
-                       strerror(errno));
+                       rte_strerror(errno));
                internal_conf->no_hpet = 1;
                return -1;
        }
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 7132e24cba..f04fbca2df 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num)
                        /* if file not found, it's not an error */
                        if (errno != ENOENT) {
                                EAL_LOG(ERR, "Cannot open %s: %s",
-                                               filename, strerror(errno));
+                                               filename, rte_strerror(errno));
                                return -1;
                        }
 
@@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num)
                                if (errno != ENOENT) {
                                        EAL_LOG(ERR,
                                                "Cannot open %s: %s",
-                                               filename, strerror(errno));
+                                               filename, rte_strerror(errno));
                                        return -1;
                                }
                                return -ENOENT;
@@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char 
*dev_addr,
        ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
        if (ret) {
                EAL_LOG(ERR, "%s cannot get VFIO group status, "
-                       "error %i (%s)", dev_addr, errno, strerror(errno));
+                       "error %i (%s)", dev_addr, errno, rte_strerror(errno));
                close(vfio_group_fd);
                rte_vfio_clear_group(vfio_group_fd);
                return -1;
@@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char 
*dev_addr,
                if (ret) {
                        EAL_LOG(ERR,
                                "%s cannot add VFIO group to container, error "
-                               "%i (%s)", dev_addr, errno, strerror(errno));
+                               "%i (%s)", dev_addr, errno, 
rte_strerror(errno));
                        close(vfio_group_fd);
                        rte_vfio_clear_group(vfio_group_fd);
                        return -1;
@@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char 
*dev_addr,
                                EAL_LOG(ERR,
                                        "%s DMA remapping failed, error "
                                        "%i (%s)",
-                                       dev_addr, errno, strerror(errno));
+                                       dev_addr, errno, rte_strerror(errno));
                                close(vfio_group_fd);
                                rte_vfio_clear_group(vfio_group_fd);
                                rte_mcfg_mem_read_unlock();
@@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char 
*dev_addr,
        if (ret) {
                EAL_LOG(ERR, "%s cannot get device info, "
                                "error %i (%s)", dev_addr, errno,
-                               strerror(errno));
+                               rte_strerror(errno));
                close(*vfio_dev_fd);
                close(vfio_group_fd);
                rte_vfio_clear_group(vfio_group_fd);
@@ -1219,7 +1219,7 @@ vfio_set_iommu_type(int vfio_container_fd)
                /* not an error, there may be more supported IOMMU types */
                EAL_LOG(DEBUG, "Set IOMMU type %d (%s) failed, error "
                                "%i (%s)", t->type_id, t->name, errno,
-                               strerror(errno));
+                               rte_strerror(errno));
        }
        /* if we didn't find a suitable IOMMU type, fail */
        return NULL;
@@ -1243,7 +1243,7 @@ rte_vfio_get_device_info(const char *sysfs_base, const 
char *dev_addr,
                ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
                if (ret) {
                        EAL_LOG(ERR, "%s cannot get device info, error %i (%s)",
-                                       dev_addr, errno, strerror(errno));
+                                       dev_addr, errno, rte_strerror(errno));
                        return -1;
                }
        }
@@ -1263,7 +1263,7 @@ vfio_has_supported_extensions(int vfio_container_fd)
                                t->type_id);
                if (ret < 0) {
                        EAL_LOG(ERR, "Could not get IOMMU type, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        close(vfio_container_fd);
                        return -1;
                } else if (ret == 1) {
@@ -1303,7 +1303,7 @@ rte_vfio_get_container_fd(void)
                        EAL_LOG(ERR,
                                        "Cannot open VFIO container %s, error "
                                        "%i (%s)", VFIO_CONTAINER_PATH,
-                                       errno, strerror(errno));
+                                       errno, rte_strerror(errno));
                        return -1;
                }
 
@@ -1313,7 +1313,7 @@ rte_vfio_get_container_fd(void)
                        if (ret < 0)
                                EAL_LOG(ERR,
                                        "Could not get VFIO API version, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        else
                                EAL_LOG(ERR, "Unsupported VFIO API version!");
                        close(vfio_container_fd);
@@ -1445,7 +1445,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                        } else {
                                EAL_LOG(ERR,
                                        "Cannot set up DMA remapping, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                                return -1;
                        }
                }
@@ -1459,7 +1459,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                                &dma_unmap);
                if (ret) {
                        EAL_LOG(ERR, "Cannot clear DMA remapping, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                } else if (dma_unmap.size != len) {
                        EAL_LOG(ERR, "Unexpected size %"PRIu64
@@ -1508,7 +1508,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                if (ret) {
                        EAL_LOG(ERR,
                                "Cannot register vaddr for IOMMU, error "
-                               "%i (%s)", errno, strerror(errno));
+                               "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                }
 
@@ -1523,7 +1523,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
                if (ret) {
                        EAL_LOG(ERR, "Cannot map vaddr for IOMMU, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                }
 
@@ -1539,7 +1539,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                                &dma_unmap);
                if (ret) {
                        EAL_LOG(ERR, "Cannot unmap vaddr for IOMMU, error "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                }
 
@@ -1548,7 +1548,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t 
vaddr, uint64_t iova,
                if (ret) {
                        EAL_LOG(ERR,
                                "Cannot unregister vaddr for IOMMU, error "
-                               "%i (%s)", errno, strerror(errno));
+                               "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                }
        }
@@ -1733,7 +1733,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
        ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
        if (ret) {
                EAL_LOG(ERR, "Cannot get IOMMU info, error %i (%s)",
-                       errno, strerror(errno));
+                       errno, rte_strerror(errno));
                return -1;
        }
 
@@ -1774,7 +1774,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */
        if (ret) {
                EAL_LOG(ERR, "Cannot create new DMA window, error "
-                               "%i (%s)", errno, strerror(errno));
+                               "%i (%s)", errno, rte_strerror(errno));
                EAL_LOG(ERR,
                        "Consider using a larger hugepage size if supported by 
the system");
                return -1;
@@ -2035,7 +2035,7 @@ rte_vfio_noiommu_is_enabled(void)
        if (fd < 0) {
                if (errno != ENOENT) {
                        EAL_LOG(ERR, "Cannot open VFIO noiommu file "
-                                       "%i (%s)", errno, strerror(errno));
+                                       "%i (%s)", errno, rte_strerror(errno));
                        return -1;
                }
                /*
@@ -2049,7 +2049,7 @@ rte_vfio_noiommu_is_enabled(void)
        close(fd);
        if (cnt != 1) {
                EAL_LOG(ERR, "Unable to read from VFIO noiommu file "
-                               "%i (%s)", errno, strerror(errno));
+                               "%i (%s)", errno, rte_strerror(errno));
                return -1;
        }
 
diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c
index 6cd5f1492c..0d08b996f8 100644
--- a/lib/eal/unix/eal_filesystem.c
+++ b/lib/eal/unix/eal_filesystem.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_filesystem.h"
@@ -59,14 +60,14 @@ int eal_create_runtime_dir(void)
        ret = mkdir(tmp, 0700);
        if (ret < 0 && errno != EEXIST) {
                EAL_LOG(ERR, "Error creating '%s': %s",
-                       tmp, strerror(errno));
+                       tmp, rte_strerror(errno));
                return -1;
        }
 
        ret = mkdir(run_dir, 0700);
        if (ret < 0 && errno != EEXIST) {
                EAL_LOG(ERR, "Error creating '%s': %s",
-                       run_dir, strerror(errno));
+                       run_dir, rte_strerror(errno));
                return -1;
        }
 
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index 97969a401b..a1cdbd1537 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int 
flags,
                EAL_LOG(DEBUG,
                    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s",
                    requested_addr, size, prot, flags, fd, offset,
-                   strerror(errno));
+                   rte_strerror(errno));
                rte_errno = errno;
                return NULL;
        }
@@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size)
        int ret = munmap(virt, size);
        if (ret < 0) {
                EAL_LOG(DEBUG, "Cannot munmap(%p, 0x%zx): %s",
-                       virt, size, strerror(errno));
+                       virt, size, rte_strerror(errno));
                rte_errno = errno;
        }
        return ret;
@@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
        int ret = madvise(virt, size, flags);
        if (ret) {
                EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s",
-                               virt, size, flags, strerror(rte_errno));
+                               virt, size, flags, rte_strerror(rte_errno));
                rte_errno = errno;
        }
        return ret;
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 1b4c73f58e..f0dae50549 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -304,7 +304,7 @@ rte_thread_key_create(rte_thread_key *key, void 
(*destructor)(void *))
        err = pthread_key_create(&((*key)->thread_index), destructor);
        if (err) {
                EAL_LOG(DEBUG, "pthread_key_create failed: %s",
-                       strerror(err));
+                       rte_strerror(err));
                free(*key);
                rte_errno = ENOEXEC;
                return -1;
@@ -325,7 +325,7 @@ rte_thread_key_delete(rte_thread_key key)
        err = pthread_key_delete(key->thread_index);
        if (err) {
                EAL_LOG(DEBUG, "pthread_key_delete failed: %s",
-                       strerror(err));
+                       rte_strerror(err));
                free(key);
                rte_errno = ENOEXEC;
                return -1;
@@ -347,7 +347,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)
        err = pthread_setspecific(key->thread_index, value);
        if (err) {
                EAL_LOG(DEBUG, "pthread_setspecific failed: %s",
-                       strerror(err));
+                       rte_strerror(err));
                rte_errno = ENOEXEC;
                return -1;
        }
-- 
2.33.0


Reply via email to