Message ID | 20181102081059.8096-1-jerin.jacob@caviumnetworks.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 155975F1B; Fri, 2 Nov 2018 09:11:27 +0100 (CET) Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710081.outbound.protection.outlook.com [40.107.71.81]) by dpdk.org (Postfix) with ESMTP id 790A55A6A for <dev@dpdk.org>; Fri, 2 Nov 2018 09:11:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gwwcp1rvdvR0kKq1CjiVqSTChG/X4R6kEhIQwjKHcJk=; b=RjXiaY44iVusgxSd3Gkm0I8eqzEd6LOCe60x98NvEMhUz5eeCrkohm0IUhq4o6Z5h3tBPEk1hxDeQx313BPei0kBMKeZryxs5+dU2irrt2nbiv3oH0uoJqiUsjqwe5SwwQh82k0fScTbNMFtZWTw6W3FOXDEyKTNJIA2k4xj2e4= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB4902.namprd07.prod.outlook.com (52.135.205.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 2 Nov 2018 08:11:23 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc%2]) with mapi id 15.20.1273.030; Fri, 2 Nov 2018 08:11:23 +0000 From: Jerin Jacob <jerin.jacob@caviumnetworks.com> To: "dev@dpdk.org" <dev@dpdk.org> CC: "thomas@monjalon.net" <thomas@monjalon.net>, "anatoly.burakov@intel.com" <anatoly.burakov@intel.com>, "Jacob, Jerin" <Jerin.JacobKollanukkaran@cavium.com> Thread-Topic: [dpdk-dev] [PATCH] eal: fix broken rte strerror Thread-Index: AQHUcoOkxEcb0Gq4RUeBIuI4T7utCw== Date: Fri, 2 Nov 2018 08:11:23 +0000 Message-ID: <20181102081059.8096-1-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [115.113.156.3] x-clientproxiedby: PN1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::22) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4902; 6:SZ0EWdU6uf31WwzmuOJ9TI75OX+pCq2f8PTqgCxFqPv5IN8tVMRvuq4BZLduhGmFyuNYMM41i1y++Lb2CRmIgVJpld+91VSHlGwI5qv81PhMseGddlzGC+ufBfP0zOZ30Jy2GxScpQuhtwr2y2gG11P72dqQxuCSmf7iJEXUDgMd2yGIisL6OA54fSyeqZFKB0ImK8dEUK4yy7fus57o9nPcYeCLK43p5ldXmDGXBAJSfZO7u907V2jSmqzFCIADJliLSrM9YN2AR1HIyNHANORECSE1tcNPXGIB5lCjUO8xk7K/z6wWK+gSE4EyeVglvCyV7eyyqUmjiRPj3VG5AXlFdgzxnFa6CKa843jfxMa14C1hafizdxe/Pmv8n2vX9/uouXn5stHs4rKAbfB61CZHe68SRnFbIvC+7s6ihki/ap/hEPGn7dLG/fxCgkcTeA5h85Zcbq+0DQPwFg7GUQ==; 5:WPc5o8Q1yBIegxVWWrE587z4n8jM0xq9fuDJ8DdmId+u8ys/gUU9tA3w/eDo6RKR9UnXbafrf0Aej1sDJKp4L1CPebI6qzOnu42gsRGenvvRsHay24Gtk4YR2Ois0sDrGY0Xp2hQP3/7h4MY7AgRFl8mBulEqjKdaT6Q12vpSl0=; 7:T1Phnuvwgx4kYOvpE91noyaB/v3zxRv5sG8jXCLGMv+wC35Yqg2EzcbF96JVdAet/cDd8iZHb1OsY6xJ8LUPt5QVWORHOB7cG0jZoREhgkV9Ff1D5cwn9ngGhrOqrt0BkjgvJ7ohKdTnZ4ki6t9acQ== x-ms-office365-filtering-correlation-id: 90fde050-15b6-4437-91fe-08d6409ac70e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; x-ms-traffictypediagnostic: BYAPR07MB4902: x-microsoft-antispam-prvs: <BYAPR07MB4902CDDA8EE1D73AD7A00744E3CF0@BYAPR07MB4902.namprd07.prod.outlook.com> x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231382)(944501410)(52105095)(10201501046)(3002001)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; x-forefront-prvs: 08444C7C87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(396003)(346002)(136003)(39860400002)(189003)(199004)(4326008)(97736004)(25786009)(14454004)(966005)(305945005)(7736002)(2616005)(476003)(68736007)(66066001)(54906003)(8936002)(256004)(36756003)(8676002)(42882007)(316002)(1857600001)(14444005)(186003)(81166006)(1730700003)(81156014)(2501003)(72206003)(2906002)(1076002)(106356001)(2900100001)(107886003)(478600001)(6512007)(5660300001)(53936002)(26005)(3846002)(6116002)(99286004)(6306002)(6916009)(5640700003)(486006)(6436002)(52116002)(2351001)(105586002)(55236004)(6486002)(102836004)(71200400001)(71190400001)(386003)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Cm+aqZTCHu0T2jRLtwV1hKfz3u+xZdNrDKRWtZTSpsWErUNxvCfIjK60d9nj1hphXXjPjIUw5P3xsnoRerBzxpDES4We9Rf+0lJ3oHEaNE+IONPoH4HJU7PXPp8yYlMkdpB39KwjiAusUNNx5QRD6gAklVrFSbX9n6vlpXkOhVbHNqYlhGC8MhxZYhjIwcAkiwpcwIp0TKryTI/rhh7a52Af0pA33R7/1Y8Wa8ZcSksDgB6LhLDV+3NAjt/l+eBfwONFSH110g+Siv1iEqBFrDxeEC49L0i3ZbYGpsQrVR3dslo+JDGZ2Y1Ilr69cvC5NV/88IFtP62qXgwZ7w9PRlCqZjb6DTHR/B0TThJY2LU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90fde050-15b6-4437-91fe-08d6409ac70e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 08:11:23.5765 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH] eal: fix broken rte strerror X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
eal: fix broken rte strerror
|
|
Checks
Context | Check | Description |
---|---|---|
ci/Intel-compilation | success | Compilation OK |
Commit Message
Jerin Jacob
Nov. 2, 2018, 8:11 a.m. UTC
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(+)
Comments
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/
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>
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
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>