From patchwork Sun Sep 17 15:36:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13388607 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3DDA6CD13D1 for ; Sun, 17 Sep 2023 15:36:38 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9KdOaz6eURazfdLw5/U+fqdjhUh9t9I1W2NbGPYN+UQ=; b=OhtLfI8/+ZIdz3 /t9wKglvXsv9DotPuHlsOPoaHkATQxaHMKfMMjwFZpMhw8rgoCUmno39oToYr19Q7PiArIGXUWDOk so192Sczs2VaxbnXs6WRrngOXFDyTHjvUryt7VMKfFVyIbN0LhtYZJnkfg7nPY/9Aq+qulqm/UfLK mVpJxO92XrvHhbv7SgN7TXjPmYo1B+U3fAmMEqGGf4n8XdsA0p+D04JI4oSL840Bxcty6/1vPIZfN 861UH4GhLXIsdcitxjCzKaaIKiZ3oshDFuwMgVHnWPld8d5MC6RixEPvtIwZ9eLQsH7XFzow0DhN4 WXR5vBzPPgxtjgRxaxuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhtp3-00DmVw-2Y; Sun, 17 Sep 2023 15:36:33 +0000 Received: from todd.t-8ch.de ([159.69.126.157]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhtp0-00DmUk-0y for linux-riscv@lists.infradead.org; Sun, 17 Sep 2023 15:36:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1694964988; bh=1NF2q2upNDj9/vMoCeQiX+AUEvsHPwNOqql4WRWM0Oo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PDYejELIHl1QbGAiIMk2tjDMYzW5D/26ieLRdJoDq4IaTyoVPh1QrNKnygwKUNiyQ Jyq+SfmCXjK1lWJGagf0A1MIMPRtCVraCZ4msErQL5i0VSvBxSvi3l0V196nHbXq8R /DTqZOqSbTaMg3kxexEOJoRNXkEGRbzQK9KDv0pA= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 17 Sep 2023 17:36:18 +0200 Subject: [PATCH v2 3/4] tools/nolibc: don't define new syscall number MIME-Version: 1.0 Message-Id: <20230917-nolibc-syscall-nr-v2-3-03863d509b9a@weissschuh.net> References: <20230917-nolibc-syscall-nr-v2-0-03863d509b9a@weissschuh.net> In-Reply-To: <20230917-nolibc-syscall-nr-v2-0-03863d509b9a@weissschuh.net> To: Willy Tarreau , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694964977; l=1312; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=1NF2q2upNDj9/vMoCeQiX+AUEvsHPwNOqql4WRWM0Oo=; b=HyWIKvOvEBDaT6rG3/p9D3aiZMZ5Ewl218rM+RUJeFdyJLTOV1Ab2odZNX32VYVmiMtWLk1w/ htVnUFszqpVBrAyuiLAygf5fExGiweKx2+F3qUtWHRT8SHuTrjU4bcw X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230917_083630_492143_6A880DB4 X-CRM114-Status: UNSURE ( 6.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org All symbols created by nolibc are also visible to user code. Syscall constants are expected to come from the kernel headers and should not be made up by nolibc. Refactor the logic to avoid defining syscall numbers. Also the new code is easier to understand. Acked-by: Willy Tarreau Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 8389820e1928..f05144e46b67 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -938,11 +938,10 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva t.tv_nsec = timeout->tv_usec * 1000; } return my_syscall6(__NR_pselect6, nfds, rfds, wfds, efds, timeout ? &t : NULL, NULL); -#elif defined(__NR__newselect) || defined(__NR_select) -#ifndef __NR__newselect -#define __NR__newselect __NR_select -#endif +#elif defined(__NR__newselect) return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); +#elif defined(__NR_select) + return my_syscall5(__NR_select, nfds, rfds, wfds, efds, timeout); #else return __nolibc_enosys(__func__, nfds, rfds, wfds, efds, timeout); #endif