From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FF4EC433F5 for ; Thu, 2 Dec 2021 00:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235522AbhLBAho (ORCPT ); Wed, 1 Dec 2021 19:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354514AbhLBAhO (ORCPT ); Wed, 1 Dec 2021 19:37:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A73C061574; Wed, 1 Dec 2021 16:33:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6051CB8219A; Thu, 2 Dec 2021 00:33:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B44D3C58321; Thu, 2 Dec 2021 00:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638405228; bh=da3NOKaiBWDJd3n47XoGyoEsJWmey0xhdX+Vk5dGrEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgOGPzWtT082Qpftmxm0kBChcUErG6AfsWTEsyDVI8kc1fXjhBes4hnRnlRcdrPmY tebdi4O/5EaIM6AxJ44CLNY60cnBryuuj9KbG7YCosnvXD7UrvDiiemezJZ2zt7Amk D3dDrM55ziAcXEPA1IHfK/o3o946M/je/0OWaHIFrgmByTF6KTYM0Fq9h9J9dmnI23 DnCJ8gnOxY+XDleYm3De4/CML7M5RrxA6/FD73ka/HgS8qDswCUg+Se+u6yx+hs+O6 UCyQRWmofVweVen7chNhJG4SelHLeN2+By/SLrlYN35idtEACCW9c5yrcWTeJsTPAe 13J5W9NxMKH4g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 44CF35C1180; Wed, 1 Dec 2021 16:33:48 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, Mark Brown , Willy Tarreau , "Paul E . McKenney" Subject: [PATCH rcu 6/6] tools/nolibc: Implement gettid() Date: Wed, 1 Dec 2021 16:33:46 -0800 Message-Id: <20211202003346.3129110-6-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20211202003322.GA3128775@paulmck-ThinkPad-P17-Gen-1> References: <20211202003322.GA3128775@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown Allow test programs to determine their thread ID. Signed-off-by: Mark Brown Cc: Willy Tarreau Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/include/nolibc/nolibc.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h index 4988866af0b58..c1c285fe494aa 100644 --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -1571,6 +1571,12 @@ pid_t sys_getpid(void) return my_syscall0(__NR_getpid); } +static __attribute__((unused)) +pid_t sys_gettid(void) +{ + return my_syscall0(__NR_gettid); +} + static __attribute__((unused)) int sys_gettimeofday(struct timeval *tv, struct timezone *tz) { @@ -2029,6 +2035,18 @@ pid_t getpid(void) return ret; } +static __attribute__((unused)) +pid_t gettid(void) +{ + pid_t ret = sys_gettid(); + + if (ret < 0) { + SET_ERRNO(-ret); + ret = -1; + } + return ret; +} + static __attribute__((unused)) int gettimeofday(struct timeval *tv, struct timezone *tz) { -- 2.31.1.189.g2e36527f23