1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
11 #include <rte_per_lcore.h>
12 #include <rte_errno.h>
13 #include <rte_string_fns.h>
15 RTE_DEFINE_PER_LCORE(int, _rte_errno);
18 rte_strerror(int errnum)
20 /* BSD puts a colon in the "unknown error" messages, Linux doesn't */
21 #ifdef RTE_EXEC_ENV_BSDAPP
22 static const char *sep = ":";
24 static const char *sep = "";
27 static RTE_DEFINE_PER_LCORE(char[RETVAL_SZ], retval);
28 char *ret = RTE_PER_LCORE(retval);
30 /* since some implementations of strerror_r throw an error
31 * themselves if errnum is too big, we handle that case here */
32 if (errnum >= RTE_MAX_ERRNO)
33 snprintf(ret, RETVAL_SZ, "Unknown error%s %d", sep, errnum);
37 return "Invalid call in secondary process";
39 return "Missing rte_config structure";
41 if (strerror_r(errnum, ret, RETVAL_SZ) != 0)
42 snprintf(ret, RETVAL_SZ, "Unknown error%s %d",