From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12F85A0547; Wed, 21 Apr 2021 20:12:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA38440687; Wed, 21 Apr 2021 20:12:12 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 12A1940150 for ; Wed, 21 Apr 2021 20:12:11 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 5E5F61660; Wed, 21 Apr 2021 14:12:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 21 Apr 2021 14:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=eV9UgjjssX1oEZnL6nsO/m9cwE NMHTxfQQSLyIII8oI=; b=QiJQB+/ev+IpjcfmZv28H0DJEZSN7mjH1mOMga6R7+ pzpNnPA8QcoS8oo+N/V7zeuN2pZMm8nVt/5fBwkaPk5NmXATo6bxA6wLz3jIcFTY SRuRleY9cMRC4HHBq/4QC63L4gNu4/sI6WnDrFDAXN2tT/7N8U031YjeJvBFB007 4Kr9W0gF8Veew6eWcU5KcnK/D8sdS28EWLcABsbGGz6UAXt0HCOXJ6Hatbe+4qp0 aULOUGirThM/+ZrwS9DgMKJfCo/y0oICv8Z7/DbbEL1Tl8kAAXz4TRnLR8QmdhpE HzWu6uGr1u2kOyv95ml5jkQnWIjz20VY3dZGad+/+lPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=eV9UgjjssX1oEZnL6 nsO/m9cwENMHTxfQQSLyIII8oI=; b=wqPuU07QIzcj1aGglHUdaArlJOrMhs5mk Ygogip+0vlN+uDOKNAI9YlRqoxI5D5Xnn4jpvbRCEyXZIq3aC2mSnsYhmcR51HR/ TmpuUKmG7BcPOBeN/fQ16Wcujz/KCMb5MDsbmy4cJsNr60e6aEh6GqxfEVcQVobF hI0VV31cbqToBNkQr5BsFxPZb8jLnp0FUm6YZVfqYR1qEIADF29wjQpCewAhbrmF sPGchktFqxWA2pergj3O8knrYSHQ6yd5g7ik6C/lKn5CT09VHZ5m5u6JTjt8100x O/2gYoAnYVTEckUbZRCmJqz6OJG+MZCOCOb789NsbiQAZxP/ca3MQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtkedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeejjeekgffhudetueegudejveeglefhkeeiueegvedvgfegffdutdei jefgudeikeenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepjeejrddufe egrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 9E501108005F; Wed, 21 Apr 2021 14:12:07 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Ciara Power , Bruce Richardson , "Min Hu (Connor)" , Chengwen Feng Date: Wed, 21 Apr 2021 20:11:57 +0200 Message-Id: <20210421181157.1634301-1-thomas@monjalon.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] telemetry: fix build on FreeBSD < 12.2 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The function pthread_setname_np() was originally not available on FreeBSD. It has been added in FreeBSD 12.2: https://svnweb.freebsd.org/base?view=revision&revision=362264 The EAL implementation of rte_thread_setname() is duplicated in the telemetry library, which does not depend on EAL, so the compilation is safe in all systems. Fixes: 5da7736f8c53 ("telemetry: set socket listener thread name") Signed-off-by: Thomas Monjalon --- lib/telemetry/telemetry.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 0b2993396a..386d0080bc 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -432,6 +432,18 @@ create_socket(char *path) return -1; } +static void +set_thread_name(pthread_t id __rte_unused, const char *name __rte_unused) +{ +#if defined RTE_EXEC_ENV_LINUX && defined __GLIBC__ && defined __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 12) + pthread_setname_np(id, name); +#endif +#elif defined RTE_EXEC_ENV_FREEBSD + pthread_set_name_np(id, name); +#endif +} + static int telemetry_legacy_init(void) { @@ -463,7 +475,7 @@ telemetry_legacy_init(void) return -1; } pthread_setaffinity_np(t_old, sizeof(*thread_cpuset), thread_cpuset); - pthread_setname_np(t_old, "telemetry-v1"); + set_thread_name(t_old, "telemetry-v1"); TMTY_LOG(DEBUG, "Legacy telemetry socket initialized ok\n"); return 0; } @@ -502,7 +514,7 @@ telemetry_v2_init(void) return -1; } pthread_setaffinity_np(t_new, sizeof(*thread_cpuset), thread_cpuset); - pthread_setname_np(t_new, "telemetry-v2"); + set_thread_name(t_new, "telemetry-v2"); atexit(unlink_sockets); return 0; -- 2.31.1