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

From: Thomas Weißschuh

Date: Sun Apr 05 2026 - 05:07:11 EST


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@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxx>