diff mbox series

[03/17] tools/nolibc: make sys_mmap() automatically use the right __NR_mmap definition

Message ID 20220719214449.2520-4-w@1wt.eu
State Accepted
Commit 364702f7551451f2fab341f1b31adf911c888375
Headers show
Series nolibc: add preliminary self tests | expand

Commit Message

Willy Tarreau July 19, 2022, 9:44 p.m. UTC
__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 <w@1wt.eu>
---
 tools/include/nolibc/sys.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index b8c96878c9ce..ce3ee03aa679 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -697,7 +697,7 @@  void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
 
 	int n;
 
-#if defined(__i386__)
+#if defined(__NR_mmap2)
 	n = __NR_mmap2;
 	offset >>= 12;
 #else