aboutsummaryrefslogtreecommitdiff
path: root/tools/include/nolibc/sys.h
AgeCommit message (Collapse)AuthorFilesLines
2022-08-31tools/nolibc: make sys_mmap() automatically use the right __NR_mmap definitionWilly Tarreau1-1/+1
__NR_mmap2 was used for i386 but it's also needed for other archs such as RISCV32 or ARM. Let's decide to use it based on the __NR_mmap2 definition as it's not defined on other archs. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-08-31tools/nolibc: fix build warning in sys_mmap() when my_syscall6 is not definedWilly Tarreau1-1/+1
We return -ENOSYS when there's no syscall6() operation, but we must cast it to void* to avoid a warning. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/sys: Implement `mmap()` and `munmap()`Ammar Faizi1-0/+62
Implement mmap() and munmap(). Currently, they are only available for architecures that have my_syscall6 macro. For architectures that don't have, this function will return -1 with errno set to ENOSYS (Function not implemented). This has been tested on x86 and i386. Notes for i386: 1) The common mmap() syscall implementation uses __NR_mmap2 instead of __NR_mmap. 2) The offset must be shifted-right by 12-bit. Acked-by: Willy Tarreau <[email protected]> Signed-off-by: Ammar Faizi <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/sys: add syscall definition for getppid()Willy Tarreau1-0/+17
This is essentially for completeness as it's not the most often used in regtests. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/errno: extract errno.h from sys.hWilly Tarreau1-16/+1
This allows us to provide a minimal errno.h to ease porting applications that use it. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/sys: make getpgrp(), getpid(), gettid() not set errnoWilly Tarreau1-21/+3
These syscalls never fail so there is no need to extract and set errno for them. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/sys: make open() take a vararg on the 3rd argumentWilly Tarreau1-3/+15
Let's pass a vararg to open() so that it remains compatible with existing code. The arg is only dereferenced when flags contain O_CREAT. The function is generally not inlined anymore, causing an extra call (total 16 extra bytes) but it's still optimized for constant propagation, limiting the excess to no more than 16 bytes in practice when open() is called without O_CREAT, and ~40 with O_CREAT, which remains reasonable. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
2022-04-20tools/nolibc/sys: split the syscall definitions into their own fileWilly Tarreau1-0/+1189
The syscall definitions were moved to sys.h. They were arranged in a more easily maintainable order, whereby the sys_xxx() and xxx() functions were grouped together, which also enlights the occasional mappings such as wait relying on wait4(). Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>