[LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE)

Sachin Sant sachinp@linux.ibm.com
Thu Apr 16 14:41:44 CEST 2026


Add fallback definitions for IORING_OP_READ and IORING_OP_WRITE
opcodes to support building on older distributions with kernel
headers between v5.1 and v5.5.

These opcodes were introduced in kernel v5.6, but some distros
may have io_uring support from v5.1+ without these newer
operation codes.

Fixes: fcc4887e73ca (io_uring: Test IORING READ and WRITE operations)
Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Sachin Sant <sachinp@linux.ibm.com>
---
 include/lapi/io_uring.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index c05517595..d95a4cd59 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -267,6 +267,16 @@ struct io_uring_probe {
 #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
 #endif /* IOSQE_ASYNC */
 
+#ifndef IORING_OP_READ
+/* Added in kernel v5.6 */
+#define IORING_OP_READ		22
+#endif /* IORING_OP_READ */
+
+#ifndef IORING_OP_WRITE
+/* Added in kernel v5.6 */
+#define IORING_OP_WRITE		23
+#endif /* IORING_OP_WRITE */
+
 #ifndef HAVE_IO_URING_REGISTER
 static inline int io_uring_register(int fd, unsigned int opcode, void *arg,
 	unsigned int nr_args)
-- 
2.39.1



More information about the ltp mailing list