From: "Thomas Weißschuh" <linux@weissschuh.net> To: Willy Tarreau <w@1wt.eu>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, "Thomas Weißschuh" <linux@weissschuh.net> Subject: [PATCH 3/4] tools/nolibc: don't define new syscall number Date: Thu, 14 Sep 2023 18:01:19 +0200 [thread overview] Message-ID: <20230914-nolibc-syscall-nr-v1-3-e50df410da11@weissschuh.net> (raw) In-Reply-To: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@weissschuh.net> 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 <linux@weissschuh.net> --- 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; -- 2.42.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: "Thomas Weißschuh" <linux@weissschuh.net> To: Willy Tarreau <w@1wt.eu>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, "Thomas Weißschuh" <linux@weissschuh.net> Subject: [PATCH 3/4] tools/nolibc: don't define new syscall number Date: Thu, 14 Sep 2023 18:01:19 +0200 [thread overview] Message-ID: <20230914-nolibc-syscall-nr-v1-3-e50df410da11@weissschuh.net> (raw) In-Reply-To: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@weissschuh.net> 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 <linux@weissschuh.net> --- 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; -- 2.42.0
next prev parent reply other threads:[~2023-09-14 16:01 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-14 16:01 [PATCH 0/4] tools/nolibc: cleanups for syscall fallbacks Thomas Weißschuh 2023-09-14 16:01 ` Thomas Weißschuh 2023-09-14 16:01 ` [PATCH 1/4] selftests/nolibc: allow building i386 with multiarch compiler Thomas Weißschuh 2023-09-14 16:01 ` Thomas Weißschuh 2023-09-17 2:49 ` Willy Tarreau 2023-09-17 2:49 ` Willy Tarreau 2023-09-14 16:01 ` [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks Thomas Weißschuh 2023-09-14 16:01 ` Thomas Weißschuh 2023-09-17 2:58 ` Willy Tarreau 2023-09-17 2:58 ` Willy Tarreau 2023-09-17 5:49 ` Thomas Weißschuh 2023-09-17 5:49 ` Thomas Weißschuh 2023-09-17 9:48 ` Willy Tarreau 2023-09-17 9:48 ` Willy Tarreau 2023-09-17 15:07 ` Thomas Weißschuh 2023-09-17 15:07 ` Thomas Weißschuh 2023-09-17 15:08 ` Willy Tarreau 2023-09-17 15:08 ` Willy Tarreau 2023-09-14 16:01 ` Thomas Weißschuh [this message] 2023-09-14 16:01 ` [PATCH 3/4] tools/nolibc: don't define new syscall number Thomas Weißschuh 2023-09-17 2:59 ` Willy Tarreau 2023-09-17 2:59 ` Willy Tarreau 2023-09-14 16:01 ` [PATCH 4/4] tools/nolibc: automatically detect necessity to use pselect6 Thomas Weißschuh 2023-09-14 16:01 ` Thomas Weißschuh 2023-09-17 3:07 ` Willy Tarreau 2023-09-17 3:07 ` Willy Tarreau
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230914-nolibc-syscall-nr-v1-3-e50df410da11@weissschuh.net \ --to=linux@weissschuh.net \ --cc=aou@eecs.berkeley.edu \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ --cc=shuah@kernel.org \ --cc=w@1wt.eu \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.