From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal: fix broken rte strerror Date: Sun, 04 Nov 2018 22:22:16 +0100 Message-ID: <7194051.gyhe4j6Bix@xps> References: <20181102081059.8096-1-jerin.jacob@caviumnetworks.com> <1877297.2k9xseoUcZ@xps> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Ferruh Yigit , "anatoly.burakov@intel.com" , "Jacob, Jerin" To: Jerin Jacob Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 180652082 for ; Sun, 4 Nov 2018 22:22:19 +0100 (CET) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 02/11/2018 18:20, Ferruh Yigit: > On 11/2/2018 9:41 AM, Thomas Monjalon wrote: > > 02/11/2018 09:11, Jerin Jacob: > >> errno_autotest testcase were failed since > >> commit 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default") > >> RTE>>errno_autotest > >> rte_strerror: 'Unknown error 11', > >> strerror: 'Resource temporarily unavailable' > >> Test Failed > >> > >> There are two different version of strerror_t() based on > >> _GNU_SOURCE definition. > >> > >> /* XSI-compliant */ > >> int strerror_r(int errnum, char *buf, size_t buflen); > >> > >> /* GNU-specific */ > >> char *strerror_r(int errnum, char *buf, size_t buflen); > >> > >> Since the GNU-specific version returns char* the exiting "if" > >> condition around the strerror_r fails. > >> > >> Switching back to XSI-compliant version to allow > >> > >> a) Portable strerror_r() usage as musl c library uses > >> non GNU speficic version > >> https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c > >> > >> b) Based on strerror_r(3) man page, it is possible that GNU-specific > >> version need not use char *buf to fill error message instead it > >> can use the immutable static string from the library and return it. > >> > >> note from strerror_r(3) man page: > >> > >> The GNU-specific strerror_r() returns a pointer to a string containing > >> the error message. This may be either a pointer to a string that the > >> function stores in buf, or a pointer to some (immutable) > >> static string (in which case buf is unused). > >> > >> Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default") > >> > >> Signed-off-by: Jerin Jacob > > > > You may be interested by this patch from Ferruh: > > https://patches.dpdk.org/patch/47622/ > > Reviewed-by: Ferruh Yigit Applied, thanks