tools/nolibc/string: Implement `strdup()` and `strndup()`
authorAmmar Faizi <ammarfaizi2@gnuweeb.org>
Tue, 29 Mar 2022 10:17:37 +0000 (17:17 +0700)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 21 Apr 2022 00:05:46 +0000 (17:05 -0700)
commit11dbdaeff41d9ec9376476889651fac4838bff99
tree583df0651963450bbcb3c634dc091e43180f5a47
parentb26823c19a12d9a06207ad3051e3d1059a9e1005
tools/nolibc/string: Implement `strdup()` and `strndup()`

These functions are currently only available on architectures that have
my_syscall6() macro implemented. Since these functions use malloc(),
malloc() uses mmap(), mmap() depends on my_syscall6() macro.

On architectures that don't support my_syscall6(), these function will
always return NULL with errno set to ENOSYS.

Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/string.h