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 4AAD042588; Wed, 13 Sep 2023 13:45:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CD6A40689; Wed, 13 Sep 2023 13:45:11 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id 9985940293 for ; Wed, 13 Sep 2023 13:45:09 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E5DC73200957; Wed, 13 Sep 2023 07:45:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 13 Sep 2023 07:45:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694605507; x=1694691907; bh=Qu2x7Ja/yh9Qi3mISmOdF72ldQCkUZbKAQQ /xmlwgv0=; b=J9BEpIqhgcGOpkm5ILS8VIFz5kk+F6Q97VtGnIhJhwVgFSPkaNT N5fkQE/eQ2pRhaPgGqMvFOubCt98gLIxSbB4pjiYNGV9kjIcU5hRxpkFRsr22znA odrvqbaIl6CTpn0r99oYtB7a+QjXccB6N/43hHg/INLkwt36cqeSCdTSzQCQVBRP YfksEQ9tNqHIoAp6L/IWo+JHTwD6H3yhEI+2fd6CV6X4WInDLmBmVHTqy/4q1T9P FNh43o8v17NDmVpP/buNX4cbpCJbA7C9Y5IeWE4QTApl4iQAixdu5N2qkMgDu6mV 6C8qDGlrh9r/vj5PU2o7W1kLyH/2avFTTlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1694605507; x=1694691907; bh=Qu2x7Ja/yh9Qi3mISmOdF72ldQCkUZbKAQQ /xmlwgv0=; b=pjogxeoVht/B8PTCtaxms5aDDBpNhW9Lge7FU2OQDvUhQVTGmAp cIQZCxI57FwJZh9aAbg6OmzZtAes5KULlz2Jz0yZ9k7fDfKYs6PqWaBkqK4HN0PP +SqniSZTVDEsZjYvv8o+iNJohfcephpEufD/1QXK7VbKJWCJi8tLJ7kk39lRuBgf 8yuz+S2QXEitoQWdCvhZ6pLeMTl9XrW4mh7jRff0/pPxa76e58CFYpbmHq+qfFrM juJ22fSzlLzt777h7W5ksMCxTWa14th5FXEYqj7V0rdZL28UAIfbacooxnAvhu6q CJljOeEPRx5M/zeg0cFceQ4D3ez5+j9phgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 07:45:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Tyler Retzlaff , David Marchand , Ferruh Yigit , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Subject: [PATCH v3 02/11] eal: rename thread name length definition Date: Wed, 13 Sep 2023 13:28:15 +0200 Message-ID: <20230913114351.1940459-3-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913114351.1940459-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913114351.1940459-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 RTE_MAX_THREAD_NAME_LEN is including the NUL character, so it should be named "size" instead of "length". A new constant RTE_THREAD_NAME_SIZE is introduced for naming accuracy. For API compatibility, the old name is kept. At the same time, the original definition is moved from rte_eal.h to rte_thread.h. Signed-off-by: Thomas Monjalon Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/eal/freebsd/eal.c | 2 +- lib/eal/freebsd/eal_thread.c | 2 +- lib/eal/include/rte_eal.h | 3 --- lib/eal/include/rte_thread.h | 9 +++++++-- lib/eal/linux/eal.c | 2 +- lib/eal/linux/eal_thread.c | 2 +- lib/eal/windows/eal.c | 2 +- lib/eal/windows/rte_thread.c | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 9e1e267955..39a2868523 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -583,7 +583,7 @@ rte_eal_init(int argc, char **argv) static uint32_t run_once; uint32_t has_run = 0; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - char thread_name[RTE_MAX_THREAD_NAME_LEN]; + char thread_name[RTE_THREAD_NAME_SIZE]; const struct rte_config *config = rte_eal_get_configuration(); struct internal_config *internal_conf = eal_get_internal_configuration(); diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c index 3227d9b8a2..ba9b25c2c0 100644 --- a/lib/eal/freebsd/eal_thread.c +++ b/lib/eal/freebsd/eal_thread.c @@ -34,7 +34,7 @@ int rte_sys_gettid(void) void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) { - char truncated[RTE_MAX_THREAD_NAME_LEN]; + char truncated[RTE_THREAD_NAME_SIZE]; const size_t truncatedsz = sizeof(truncated); if (strlcpy(truncated, thread_name, truncatedsz) >= truncatedsz) diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index 53c4a5519e..cd318ee141 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -27,9 +27,6 @@ extern "C" { #define RTE_MAGIC 19820526 /**< Magic number written by the main partition when ready. */ -/* Maximum thread_name length. */ -#define RTE_MAX_THREAD_NAME_LEN 16 - /** * The type of process in a linux, multi-process setup */ diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h index 369e2375f6..6233142322 100644 --- a/lib/eal/include/rte_thread.h +++ b/lib/eal/include/rte_thread.h @@ -23,6 +23,11 @@ extern "C" { #endif +/** Maximum thread name length (including '\0'). */ +#define RTE_THREAD_NAME_SIZE 16 +/* Old definition, aliased for compatibility. */ +#define RTE_MAX_THREAD_NAME_LEN RTE_THREAD_NAME_SIZE + /** * Thread id descriptor. */ @@ -110,7 +115,7 @@ int rte_thread_create(rte_thread_t *thread_id, * Filled with the thread id of the new created thread. * @param name * The name of the control thread - * (max RTE_MAX_THREAD_NAME_LEN characters including '\0'). + * (max RTE_THREAD_NAME_SIZE characters including '\0'). * @param thread_attr * Attributes for the new thread. * @param thread_func @@ -188,7 +193,7 @@ rte_thread_t rte_thread_self(void); * The id of the thread to set name. * * @param thread_name - * The name to set. Truncated to RTE_MAX_THREAD_NAME_LEN, + * The name to set. Truncated to RTE_THREAD_NAME_SIZE, * including terminating NUL if necessary. */ __rte_experimental diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index a26822f667..5f4b2fb005 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -970,7 +970,7 @@ rte_eal_init(int argc, char **argv) static uint32_t run_once; uint32_t has_run = 0; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - char thread_name[RTE_MAX_THREAD_NAME_LEN]; + char thread_name[RTE_THREAD_NAME_SIZE]; bool phys_addrs; const struct rte_config *config = rte_eal_get_configuration(); struct internal_config *internal_conf = diff --git a/lib/eal/linux/eal_thread.c b/lib/eal/linux/eal_thread.c index c07ad9d8a4..b9a126f3a8 100644 --- a/lib/eal/linux/eal_thread.c +++ b/lib/eal/linux/eal_thread.c @@ -24,7 +24,7 @@ void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) int ret = ENOSYS; #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 12) - char truncated[RTE_MAX_THREAD_NAME_LEN]; + char truncated[RTE_THREAD_NAME_SIZE]; const size_t truncatedsz = sizeof(truncated); if (strlcpy(truncated, thread_name, truncatedsz) >= truncatedsz) diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index 16c1ba1596..7ec2152211 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -283,7 +283,7 @@ rte_eal_init(int argc, char **argv) enum rte_iova_mode iova_mode; int ret; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - char thread_name[RTE_MAX_THREAD_NAME_LEN]; + char thread_name[RTE_THREAD_NAME_SIZE]; eal_log_init(NULL, 0); diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c index e528ac9991..acf648456c 100644 --- a/lib/eal/windows/rte_thread.c +++ b/lib/eal/windows/rte_thread.c @@ -324,7 +324,7 @@ void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) { int ret = 0; - wchar_t wname[RTE_MAX_THREAD_NAME_LEN]; + wchar_t wname[RTE_THREAD_NAME_SIZE]; mbstate_t state = {0}; size_t rv; HANDLE thread_handle; -- 2.42.0