From patchwork Thu Sep 14 16:01:19 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: 723814 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 8761CEEAA52 for ; Thu, 14 Sep 2023 16:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241405AbjINQCQ (ORCPT ); Thu, 14 Sep 2023 12:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241679AbjINQCB (ORCPT ); Thu, 14 Sep 2023 12:02:01 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39953272A; Thu, 14 Sep 2023 09:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1694707293; bh=Cu53Z9oyo5nGu95h1+MArmP5k33gYn4AQCWOgwsV/Ac=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nJXJ1xXHesT1KczhMwLWfm4v2NTSTPtV6KAFS2C4/pVvhrkdw5iJnNuZPfzcNH81X EtTjjm+ZcV9Z7OFkbIZxH8hQi/WlF1z44FUARs5NxJ4SAmGq+cjERWC0zZPVi655jx B+V7D+nxIi6ovzre3715c/cC7TfgIxPeombwOIp4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 14 Sep 2023 18:01:19 +0200 Subject: [PATCH 3/4] tools/nolibc: don't define new syscall number MIME-Version: 1.0 Message-Id: <20230914-nolibc-syscall-nr-v1-3-e50df410da11@weissschuh.net> References: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@weissschuh.net> In-Reply-To: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@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=1694707292; l=1227; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Cu53Z9oyo5nGu95h1+MArmP5k33gYn4AQCWOgwsV/Ac=; b=gJVRysrB+1Fm++kEZkA6QvwJaFYmt27QWy1msKjd+eJjR2FaQgck9iIwYB4bxpA6by3xzT2p2 PzfnrKof6pvBVVTgIWWtMX9cfqisWMmTH2n3Am9bIT64PWNQbOqeho2 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.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. 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 bc56310c6bdf..d96f2aa7d987 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -954,11 +954,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 (void)nfds; (void)rfds;