tools/nolibc: make sys_mmap() automatically use the right __NR_mmap definition
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Jul 2022 21:44:34 +0000 (23:44 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 31 Aug 2022 12:17:43 +0000 (05:17 -0700)
__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>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/sys.h

index b8c9687..ce3ee03 100644 (file)
@@ -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