* [dpdk-dev] [PATCH] eal: fix broken rte strerror
@ 2018-11-02 8:11 Jerin Jacob
2018-11-02 9:41 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Jerin Jacob @ 2018-11-02 8:11 UTC (permalink / raw)
To: dev; +Cc: thomas, anatoly.burakov, Jacob, Jerin
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 <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/eal_common_errno.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal/common/eal_common_errno.c
index 56b492f5f..c63a943b3 100644
--- a/lib/librte_eal/common/eal_common_errno.c
+++ b/lib/librte_eal/common/eal_common_errno.c
@@ -2,6 +2,9 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+/* Use XSI-compliant portable version of strerror_r() */
+#undef _GNU_SOURCE
+
#include <stdint.h>
#include <stdio.h>
#include <string.h>
--
2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix broken rte strerror
2018-11-02 8:11 [dpdk-dev] [PATCH] eal: fix broken rte strerror Jerin Jacob
@ 2018-11-02 9:41 ` Thomas Monjalon
2018-11-02 17:20 ` Ferruh Yigit
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2018-11-02 9:41 UTC (permalink / raw)
To: Jerin Jacob; +Cc: dev, anatoly.burakov, Jacob, Jerin, ferruh.yigit
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 <jerin.jacob@caviumnetworks.com>
You may be interested by this patch from Ferruh:
https://patches.dpdk.org/patch/47622/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix broken rte strerror
2018-11-02 9:41 ` Thomas Monjalon
@ 2018-11-02 17:20 ` Ferruh Yigit
2018-11-04 21:22 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2018-11-02 17:20 UTC (permalink / raw)
To: Thomas Monjalon, Jerin Jacob; +Cc: dev, anatoly.burakov, Jacob, Jerin
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 <jerin.jacob@caviumnetworks.com>
>
> You may be interested by this patch from Ferruh:
> https://patches.dpdk.org/patch/47622/
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eal: fix broken rte strerror
2018-11-02 17:20 ` Ferruh Yigit
@ 2018-11-04 21:22 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-11-04 21:22 UTC (permalink / raw)
To: Jerin Jacob; +Cc: dev, Ferruh Yigit, anatoly.burakov, Jacob, Jerin
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 <jerin.jacob@caviumnetworks.com>
> >
> > You may be interested by this patch from Ferruh:
> > https://patches.dpdk.org/patch/47622/
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-04 21:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 8:11 [dpdk-dev] [PATCH] eal: fix broken rte strerror Jerin Jacob
2018-11-02 9:41 ` Thomas Monjalon
2018-11-02 17:20 ` Ferruh Yigit
2018-11-04 21:22 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).