From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6807972FB; Fri, 8 Jun 2018 11:02:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 02:02:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,490,1520924400"; d="scan'208";a="55123555" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 08 Jun 2018 02:02:13 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 8 Jun 2018 02:02:13 -0700 Received: from lcsmsx155.ger.corp.intel.com (10.186.165.233) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 8 Jun 2018 02:02:13 -0700 Received: from hasmsx105.ger.corp.intel.com ([169.254.1.132]) by LCSMSX155.ger.corp.intel.com ([169.254.12.62]) with mapi id 14.03.0319.002; Fri, 8 Jun 2018 12:02:11 +0300 From: "Stojaczyk, DariuszX" To: "dev@dpdk.org" CC: "stable@dpdk.org" , Thomas Monjalon Thread-Topic: [PATCH 1/2] eal/thread: fix return codes for rte_thread_setname() Thread-Index: AQHT/waWFWJFDjAbsUCMUdWEvRarc6RWD/tw Date: Fri, 8 Jun 2018 09:02:10 +0000 Message-ID: References: <1528461427-164113-1-git-send-email-dariuszx.stojaczyk@intel.com> In-Reply-To: <1528461427-164113-1-git-send-email-dariuszx.stojaczyk@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjk4ZmVkZDktMGY5MS00YzFmLWFlZDUtYTJhMjExMTEyYjNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiIzaW83SGg3UlA0aFVhN0V2b2JVMkJ0a3ZuQmVhXC83emF2ZTVRRzlJdVBqbHRoUnlKcFwvSm9iS1pCQ3pVbDZpQU0ifQ== x-originating-ip: [10.103.102.242] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] eal/thread: fix return codes for rte_thread_setname() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2018 09:02:17 -0000 +CC thomas@monjalon.net=20 The previous @6wind email appears to be unavailable now. > -----Original Message----- > From: Stojaczyk, DariuszX > Sent: Friday, June 8, 2018 2:37 PM > To: dev@dpdk.org > Cc: Stojaczyk, DariuszX ; > thomas.monjalon@6wind.com; stable@dpdk.org > Subject: [PATCH 1/2] eal/thread: fix return codes for rte_thread_setname(= ) >=20 > The doc says this function returns negative errno on error, but it curren= tly > returns either -1 or positive errno. >=20 > It was incorrectly assumed that pthread_setname_np() returns negative > error numbers. It always returns positive ones, so this patch negates its > return value before returning. >=20 > While here, also ignore rte_thread_setname() failure in > rte_ctrl_thread_create() and print a debug message instead. >=20 > Fixes: 3901ed99c2f8 ("eal: fix thread naming on FreeBSD") > Cc: thomas.monjalon@6wind.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Dariusz Stojaczyk > --- > lib/librte_eal/common/eal_common_thread.c | 3 ++- > lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++-- > 2 files changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_thread.c > b/lib/librte_eal/common/eal_common_thread.c > index 4239863..8110ac2 100644 > --- a/lib/librte_eal/common/eal_common_thread.c > +++ b/lib/librte_eal/common/eal_common_thread.c > @@ -191,7 +191,8 @@ rte_ctrl_thread_create(pthread_t *thread, const > char *name, > if (name !=3D NULL) { > ret =3D rte_thread_setname(*thread, name); > if (ret < 0) > - goto fail; > + RTE_LOG(DEBUG, EAL, > + "Cannot set name for ctrl thread\n"); > } >=20 > cpu_found =3D 0; > diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c > b/lib/librte_eal/linuxapp/eal/eal_thread.c > index f652ff9..b496fc7 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_thread.c > +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c > @@ -176,7 +176,7 @@ int rte_sys_gettid(void) >=20 > int rte_thread_setname(pthread_t id, const char *name) { > - int ret =3D -1; > + int ret =3D ENOSYS; > #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if > __GLIBC_PREREQ(2, 12) > ret =3D pthread_setname_np(id, name); > @@ -184,5 +184,5 @@ int rte_thread_setname(pthread_t id, const char > *name) #endif > RTE_SET_USED(id); > RTE_SET_USED(name); > - return ret; > + return -ret; > } > -- > 2.7.4