[PATCH v11 6/9] app/test: differentiate a strerror on different OS
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Sat Dec 4 02:33:37 CET 2021
2021-12-02 16:06 (UTC-0800), Jie Zhou:
> On Windows, strerror returns just "Unknown error" for errnum greater
> than MAX_ERRNO, while linux and freebsd returns "Unknown error <num>",
> which is the current expectation for errno_autotest. Differentiate
> the error string on Windows to remove a "duplicate error code" failure.
>
> Signed-off-by: Jie Zhou <jizh at linux.microsoft.com>
>
> ---
> app/test/test_errno.c | 12 +++++++++++-
> lib/eal/common/eal_common_errno.c | 4 ++++
> 2 files changed, 15 insertions(+), 1 deletion(-)
[...]
> diff --git a/lib/eal/common/eal_common_errno.c b/lib/eal/common/eal_common_errno.c
> index f86802705a..4c4abb802e 100644
> --- a/lib/eal/common/eal_common_errno.c
> +++ b/lib/eal/common/eal_common_errno.c
> @@ -37,7 +37,11 @@ rte_strerror(int errnum)
> /* since some implementations of strerror_r throw an error
> * themselves if errnum is too big, we handle that case here */
> if (errnum >= RTE_MAX_ERRNO)
> +#ifdef RTE_EXEC_ENV_WINDOWS
> + snprintf(ret, RETVAL_SZ, "Unknown error%s", sep);
"sep" is not needed here, is it?
> +#else
> snprintf(ret, RETVAL_SZ, "Unknown error%s %d", sep, errnum);
> +#endif
> else
> switch (errnum){
> case E_RTE_SECONDARY:
More information about the dev
mailing list