diff mbox series

[3/4] tools/nolibc: don't define new syscall number

Message ID 20230914-nolibc-syscall-nr-v1-3-e50df410da11@weissschuh.net (mailing list archive)
State New
Headers show
Series tools/nolibc: cleanups for syscall fallbacks | expand

Commit Message

Thomas Weißschuh Sept. 14, 2023, 4:01 p.m. UTC
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(-)

Comments

Willy Tarreau Sept. 17, 2023, 2:59 a.m. UTC | #1
On Thu, Sep 14, 2023 at 06:01:19PM +0200, Thomas Weißschuh wrote:
> 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>

Yeah that's a good point!

Acked-by: Willy Tarreau <w@1wt.eu>
Willy
diff mbox series

Patch

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;