Skip to contentSkip to conversation

liburing: Export `__NR_io_uring_{setup,enter,register}` to user

PATCH Applied Ammar Faizi 2 participants 2 messages Sep 4, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 liburing: Export `__NR_io_uring_{setup,enter,register}` to user

These macros are not defined in an old <sys/syscall.h> file. Allow liburing users to get io_uring syscall numbers by including <liburing.h>.

---

v2:
- Fix typo in the commit message:
s/in a old/in an old/

 src/include/liburing.h | 38 ++++++++++++++++++++++++++++++++++++++
 src/syscall.h          | 37 -------------------------------------
 2 files changed, 38 insertions(+), 37 deletions(-)
src/include/liburing.h +38 -0
index 6040a06..cceab6b 100644
@@ -33,6 +33,44 @@
 #define uring_likely(cond)	__builtin_expect(!!(cond), 1)
 #endif
 
+
+#ifdef __alpha__
+/*
+ * alpha and mips are exception, other architectures have
+ * common numbers for new system calls.
+ */
+#ifndef __NR_io_uring_setup
+#define __NR_io_uring_setup		535
+#endif
+#ifndef __NR_io_uring_enter
+#define __NR_io_uring_enter		536
+#endif
+#ifndef __NR_io_uring_register
+#define __NR_io_uring_register		537
+#endif
+#elif defined __mips__
+#ifndef __NR_io_uring_setup
+#define __NR_io_uring_setup		(__NR_Linux + 425)
+#endif
+#ifndef __NR_io_uring_enter
+#define __NR_io_uring_enter		(__NR_Linux + 426)
+#endif
+#ifndef __NR_io_uring_register
+#define __NR_io_uring_register		(__NR_Linux + 427)
+#endif
+#else /* !__alpha__ and !__mips__ */
+#ifndef __NR_io_uring_setup
+#define __NR_io_uring_setup		425
+#endif
+#ifndef __NR_io_uring_enter
+#define __NR_io_uring_enter		426
+#endif
+#ifndef __NR_io_uring_register
+#define __NR_io_uring_register		427
+#endif
+#endif
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
src/syscall.h +0 -37
index ba008ea..f750782 100644
@@ -10,45 +10,8 @@
 #include <sys/mman.h>
 #include <sys/syscall.h>
 #include <sys/resource.h>
-
 #include <liburing.h>
 
-#ifdef __alpha__
-/*
- * alpha and mips are exception, other architectures have
- * common numbers for new system calls.
- */
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup		535
-#endif
-#ifndef __NR_io_uring_enter
-#define __NR_io_uring_enter		536
-#endif
-#ifndef __NR_io_uring_register
-#define __NR_io_uring_register	537
-#endif
-#elif defined __mips__
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup		(__NR_Linux + 425)
-#endif
-#ifndef __NR_io_uring_enter
-#define __NR_io_uring_enter		(__NR_Linux + 426)
-#endif
-#ifndef __NR_io_uring_register
-#define __NR_io_uring_register	(__NR_Linux + 427)
-#endif
-#else /* !__alpha__ and !__mips__ */
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup		425
-#endif
-#ifndef __NR_io_uring_enter
-#define __NR_io_uring_enter		426
-#endif
-#ifndef __NR_io_uring_register
-#define __NR_io_uring_register		427
-#endif
-#endif
-
 /*
  * Don't put this below the #include "arch/$arch/syscall.h", that
  * file may need it.

base-commit: 42ee2bdb76022fc11d7a0ad8ec5cca6de73501e9

Signature · 1 line
Ammar Faizi
maintainer Applied
#1 lore raw
Quoted 5 lines · Ammar Faizi

These macros are not defined in an old <sys/syscall.h> file. Allow liburing users to get io_uring syscall numbers by including <liburing.h>.

Applied, thanks!

[1/1] liburing: Export __NR_io_uring_{setup,enter,register} to user

      commit: 3bd7d6b27e6b7d7950bba1491bc9c385378fe4dd

Best regards,

Signature · 1 line
Jens Axboe