From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH] eal: fix API to get error string Date: Fri, 2 Nov 2018 09:51:01 +0000 Message-ID: <20181102095046.GA32112@jerin> References: <20181031171928.61110-1-ferruh.yigit@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: Bruce Richardson , "dev@dpdk.org" , "stable@dpdk.org" To: Ferruh Yigit Return-path: In-Reply-To: <20181031171928.61110-1-ferruh.yigit@intel.com> Content-Language: en-US Content-ID: <93B80E7D299DEC48936185EDBA06E950@namprd07.prod.outlook.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Wed, 31 Oct 2018 17:19:28 +0000 > From: Ferruh Yigit > To: Bruce Richardson > CC: dev@dpdk.org, Ferruh Yigit , stable@dpdk.org > Subject: [dpdk-dev] [PATCH] eal: fix API to get error string > X-Mailer: git-send-email 2.17.2 >=20 > External Email >=20 > rte_strerror uses strerror_r(), and strerror_r() has two version of it. > - XSI-compliant version, (_POSIX_C_SOURCE >=3D 200112L) && ! _GNU_SOURCE > - GNU-specific version >=20 > Those two has different return types, so the exiting return type check > is not correct for GNU-specific version. >=20 > And this is causing failure in errno_autotest unit test. >=20 > Adding different implementation for FreeBSD and Linux. >=20 > Fixes: 016c32bd3e3d ("eal: cleanup strerror function") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ferruh Yigit > --- > lib/librte_eal/common/eal_common_errno.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > diff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal/co= mmon/eal_common_errno.c > index 56b492f5f..fbbc71b0b 100644 > --- a/lib/librte_eal/common/eal_common_errno.c > +++ b/lib/librte_eal/common/eal_common_errno.c > @@ -38,9 +38,17 @@ rte_strerror(int errnum) > case E_RTE_NO_CONFIG: > return "Missing rte_config structure"; > default: > +#ifdef RTE_EXEC_ENV_BSDAPP > if (strerror_r(errnum, ret, RETVAL_SZ) !=3D 0) > snprintf(ret, RETVAL_SZ, "Unknown error%s= %d", > sep, errnum); > +#else > + /* > + * _GNU_SOURCE version, error string is not alway= s > + * strored in "ret" buffer, need to use return va= lue > + */ > + ret =3D strerror_r(errnum, ret, RETVAL_SZ); Probably this will fail in musl c version. https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c Another alternative of this patch. http://patches.dpdk.org/patch/47706/ > +#endif > } >=20 > return ret; > -- > 2.17.2 >=20