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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17350C433F5 for ; Tue, 19 Oct 2021 17:24:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0FAB6135F for ; Tue, 19 Oct 2021 17:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbhJSR03 (ORCPT ); Tue, 19 Oct 2021 13:26:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234631AbhJSR01 (ORCPT ); Tue, 19 Oct 2021 13:26:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73D29610FC; Tue, 19 Oct 2021 17:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634664255; bh=KfpPJVWRO66fQ+lHM4RrxvOpwpsFMCzrx77xLw3EyNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROzp8HzX7wop+hyph7Rokd7QJXTwlfdnnFh/cpOQ3Lg/tuE1Kit3weu2/rfUYPm0N ATSV3jH+UBxo3fBk24XgnCdAPRpAEYClMfS/yBmdZFZjL6wc5jPIoOZ8fnVjlAGaOR gnNjRcvjwFYQ5P/zX6QJCrws43PvVWwcHYKdwpu135Gni+chP+xI4s3FqS3vXit6wF 8X8va1m2d6754PqZehTDQec/6CmtMo1bem0qljBil+vTccTW3xaYJwhOWRyQ+YnnLp OimXXxaHxgOPwaXLBqe60INoQMHF29uwBl4bERDXwd0LkueZMmQ7r3A1TGEK7LAkCg ns5UaFjomt5Zg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown , Willy Tarreau Subject: [PATCH v3 14/42] tools/nolibc: Implement gettid() Date: Tue, 19 Oct 2021 18:22:19 +0100 Message-Id: <20211019172247.3045838-15-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211019172247.3045838-1-broonie@kernel.org> References: <20211019172247.3045838-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1061; h=from:subject; bh=KfpPJVWRO66fQ+lHM4RrxvOpwpsFMCzrx77xLw3EyNE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhbv7Oztk/96WoNH8DozWFJeEEmhlhgkZPyKxVcLYr laul/l+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYW7+zgAKCRAk1otyXVSH0EKFB/ 96uMU5+WZcSmhrZcorl2ncsrAPUn1z3tvA55P6lhy/TUwKOEDkZFP+LatBuPSkuQfZEfgLWOUjaoll wvcuOXRAVfAPzyBl9vwJagMs66SyD6w/dRqf48vs/vQJtSajNVHTHS6Foi73AKFQvRIx/40GyC22MB ahtkaPCj5oe0ZzTGZ+BfV/Whxx1hP6LnFotcUP5XUzgODagpeOYDcfM6weBZ1lB4Nj9WlEx7y7Fx30 BxJgWSv5H+Zx3Th4oohDqC+JAbb0Xy8mnQTZ/qAeeBWlurp22bzZA2npvHQf4eV4QG4YRKz7nXsPHG 0gJSJjYQW3k9nPBZ7ttVVSdseIsP56 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Allow test programs to determine their thread ID. Signed-off-by: Mark Brown Cc: Willy Tarreau --- 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 3430667b0d24..fea8aace0119 100644 --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -1555,6 +1555,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) { @@ -2013,6 +2019,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.30.2 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6709EC433F5 for ; Tue, 19 Oct 2021 17:32:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C0A861354 for ; Tue, 19 Oct 2021 17:32:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2C0A861354 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aEAH/DzsUYLjXjzVij7HM9hBjA7HonlUFgvJ1qRHVZ4=; b=4drpPCfxpsTH2R LZWj4eb/gfI/ZVI0hS/UvMPUTQFy56gStvzfeouh8OmDA7npI0H5Wn5BHWqL/OjXFH/AZXEmhIrNc suIjwzjZ633opokOt5Gpjr3NeopDK8jeXG1jWKuoBW4T8MW00mvTdrNhd6J/y5hkTxciN5AdyHzrz m1cfUMYtuOnQoLkkOuVAaSldrXSvoUqZ+9CIYJpM7P1FEFwxUkIH8GDYo3fa8K+kjbfaJPBbMhrRz sWm2AAw4qT9JQrwANzeP+2YOkg4XRcjSYujp5SLZUyVL2I4oq9aG65NY7gPwrz8Rf6/hjGyKJSzbC bVKRpvtJIWTZBo0dLZRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcsws-00280B-Dk; Tue, 19 Oct 2021 17:30:52 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcsqV-00258g-AD for linux-arm-kernel@lists.infradead.org; Tue, 19 Oct 2021 17:24:16 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73D29610FC; Tue, 19 Oct 2021 17:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634664255; bh=KfpPJVWRO66fQ+lHM4RrxvOpwpsFMCzrx77xLw3EyNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROzp8HzX7wop+hyph7Rokd7QJXTwlfdnnFh/cpOQ3Lg/tuE1Kit3weu2/rfUYPm0N ATSV3jH+UBxo3fBk24XgnCdAPRpAEYClMfS/yBmdZFZjL6wc5jPIoOZ8fnVjlAGaOR gnNjRcvjwFYQ5P/zX6QJCrws43PvVWwcHYKdwpu135Gni+chP+xI4s3FqS3vXit6wF 8X8va1m2d6754PqZehTDQec/6CmtMo1bem0qljBil+vTccTW3xaYJwhOWRyQ+YnnLp OimXXxaHxgOPwaXLBqe60INoQMHF29uwBl4bERDXwd0LkueZMmQ7r3A1TGEK7LAkCg ns5UaFjomt5Zg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown , Willy Tarreau Subject: [PATCH v3 14/42] tools/nolibc: Implement gettid() Date: Tue, 19 Oct 2021 18:22:19 +0100 Message-Id: <20211019172247.3045838-15-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211019172247.3045838-1-broonie@kernel.org> References: <20211019172247.3045838-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1061; h=from:subject; bh=KfpPJVWRO66fQ+lHM4RrxvOpwpsFMCzrx77xLw3EyNE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhbv7Oztk/96WoNH8DozWFJeEEmhlhgkZPyKxVcLYr laul/l+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYW7+zgAKCRAk1otyXVSH0EKFB/ 96uMU5+WZcSmhrZcorl2ncsrAPUn1z3tvA55P6lhy/TUwKOEDkZFP+LatBuPSkuQfZEfgLWOUjaoll wvcuOXRAVfAPzyBl9vwJagMs66SyD6w/dRqf48vs/vQJtSajNVHTHS6Foi73AKFQvRIx/40GyC22MB ahtkaPCj5oe0ZzTGZ+BfV/Whxx1hP6LnFotcUP5XUzgODagpeOYDcfM6weBZ1lB4Nj9WlEx7y7Fx30 BxJgWSv5H+Zx3Th4oohDqC+JAbb0Xy8mnQTZ/qAeeBWlurp22bzZA2npvHQf4eV4QG4YRKz7nXsPHG 0gJSJjYQW3k9nPBZ7ttVVSdseIsP56 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_102415_411344_C37ECB51 X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow test programs to determine their thread ID. Signed-off-by: Mark Brown Cc: Willy Tarreau --- 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 3430667b0d24..fea8aace0119 100644 --- a/tools/include/nolibc/nolibc.h +++ b/tools/include/nolibc/nolibc.h @@ -1555,6 +1555,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) { @@ -2013,6 +2019,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.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel