[PATCH 0/3] tools/nolibc: add the _syscall() macro

Thomas Weißschuh posted 3 patches 2 months, 1 week ago
tools/include/nolibc/sys/syscall.h           | 11 ++++++-----
tools/testing/selftests/nolibc/nolibc-test.c |  4 ++++
2 files changed, 10 insertions(+), 5 deletions(-)
[PATCH 0/3] tools/nolibc: add the _syscall() macro
Posted by Thomas Weißschuh 2 months, 1 week ago
The standard syscall() function or macro uses the libc return value
convention. Errors returned from the kernel as negative values are
stored in errno and -1 is returned. Users which want to avoid using
errno don't have a way to call raw syscalls and check the returned
error.

Add a new macro _syscall() which works like the standard syscall()
but passes through the return value from the kernel unchanged.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
      tools/nolibc: rename the internal macros used in syscall()
      tools/nolibc: move the call to __sysret() into syscall()
      tools/nolibc: add the _syscall() macro

 tools/include/nolibc/sys/syscall.h           | 11 ++++++-----
 tools/testing/selftests/nolibc/nolibc-test.c |  4 ++++
 2 files changed, 10 insertions(+), 5 deletions(-)
---
base-commit: bda9721dd49b6a2a60feee606e22f50975063ab3
change-id: 20260405-nolibc-syscall-53e8b9b7f7cc

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/3] tools/nolibc: add the _syscall() macro
Posted by Willy Tarreau 2 months, 1 week ago
Hi Thomas,

On Sun, Apr 05, 2026 at 11:06:22AM +0200, Thomas Weißschuh wrote:
> The standard syscall() function or macro uses the libc return value
> convention. Errors returned from the kernel as negative values are
> stored in errno and -1 is returned. Users which want to avoid using
                                            ^^^^^
                                         s/which/who :-)

> errno don't have a way to call raw syscalls and check the returned
> error.
> 
> Add a new macro _syscall() which works like the standard syscall()
> but passes through the return value from the kernel unchanged.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Nice and clean! For the whole series:

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

Thanks!
Willy