]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/lib/librte_eal/common/eal_common_errno.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 /* Use XSI-compliant portable version of strerror_r() */
14 #include <rte_per_lcore.h>
15 #include <rte_errno.h>
16 #include <rte_string_fns.h>
18 RTE_DEFINE_PER_LCORE(int, _rte_errno
);
21 rte_strerror(int errnum
)
23 /* BSD puts a colon in the "unknown error" messages, Linux doesn't */
24 #ifdef RTE_EXEC_ENV_FREEBSD
25 static const char *sep
= ":";
27 static const char *sep
= "";
30 static RTE_DEFINE_PER_LCORE(char[RETVAL_SZ
], retval
);
31 char *ret
= RTE_PER_LCORE(retval
);
33 /* since some implementations of strerror_r throw an error
34 * themselves if errnum is too big, we handle that case here */
35 if (errnum
>= RTE_MAX_ERRNO
)
36 snprintf(ret
, RETVAL_SZ
, "Unknown error%s %d", sep
, errnum
);
40 return "Invalid call in secondary process";
42 return "Missing rte_config structure";
44 if (strerror_r(errnum
, ret
, RETVAL_SZ
) != 0)
45 snprintf(ret
, RETVAL_SZ
, "Unknown error%s %d",