tools/nolibc: __sysret: support syscalls who return a pointer
authorZhangjin Wu <falcon@tinylab.org>
Fri, 7 Jul 2023 14:56:59 +0000 (22:56 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Aug 2023 02:38:02 +0000 (04:38 +0200)
commit6591be4a73feb955a107c70c7e5b621a97a2eb4b
tree7c90f1c723fca70f7009cd15b2783e38ed332efb
parent6d1970e1efc8696bc8c4b8d36c9680882cb2c849
tools/nolibc: __sysret: support syscalls who return a pointer

No official reference states the errno range, here aligns with musl and
glibc and uses [-MAX_ERRNO, -1] instead of all negative ones.

- musl: src/internal/syscall_ret.c
- glibc: sysdeps/unix/sysv/linux/sysdep.h

The MAX_ERRNO used by musl and glibc is 4095, just like the one nolibc
defined in tools/include/nolibc/errno.h.

Suggested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/lkml/ZKKdD%2Fp4UkEavru6@1wt.eu/
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Link: https://lore.kernel.org/linux-riscv/94dd5170929f454fbc0a10a2eb3b108d@AcuMS.aculab.com/
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
tools/include/nolibc/sys.h