diff mbox series

[liburing] arch/syscall: Use __NR_mmap2 existence for preprocessor condition

Message ID 20220726111851.3608291-1-alviro.iskandar@gnuweeb.org (mailing list archive)
State New
Headers show
Series [liburing] arch/syscall: Use __NR_mmap2 existence for preprocessor condition | expand

Commit Message

Alviro Iskandar Setiawan July 26, 2022, 11:18 a.m. UTC
Now __NR_mmap2 is only used for i386. But it is also needed for other
archs like ARM and RISCV32. Decide to use it based on the __NR_mmap2
definition as it's not defined on other archs. Currently, this has no
effect because other archs use the generic mmap definition from libc.

Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---
 src/arch/syscall-defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ammar Faizi July 26, 2022, 11:29 a.m. UTC | #1
On 7/26/22 6:18 PM, Alviro Iskandar Setiawan wrote:
> Now __NR_mmap2 is only used for i386. But it is also needed for other
> archs like ARM and RISCV32. Decide to use it based on the __NR_mmap2
> definition as it's not defined on other archs. Currently, this has no
> effect because other archs use the generic mmap definition from libc.
> 
> Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>

Acked-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Jens Axboe July 26, 2022, 12:58 p.m. UTC | #2
On Tue, 26 Jul 2022 11:18:51 +0000, Alviro Iskandar Setiawan wrote:
> Now __NR_mmap2 is only used for i386. But it is also needed for other
> archs like ARM and RISCV32. Decide to use it based on the __NR_mmap2
> definition as it's not defined on other archs. Currently, this has no
> effect because other archs use the generic mmap definition from libc.
> 
> 

Applied, thanks!

[1/1] arch/syscall: Use __NR_mmap2 existence for preprocessor condition
      commit: 00c8a105ba688a3826304430f8e57835a302609d

Best regards,
diff mbox series

Patch

diff --git a/src/arch/syscall-defs.h b/src/arch/syscall-defs.h
index 9ddac45..374aa0d 100644
--- a/src/arch/syscall-defs.h
+++ b/src/arch/syscall-defs.h
@@ -27,7 +27,7 @@  static inline void *__sys_mmap(void *addr, size_t length, int prot, int flags,
 {
 	int nr;
 
-#if defined(__i386__)
+#if defined(__NR_mmap2)
 	nr = __NR_mmap2;
 	offset >>= 12;
 #else