[LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
Martin Doucha
mdoucha@suse.cz
Thu Apr 16 18:18:19 CEST 2026
Hi,
while this patch fixes compilation on older system lacking these
constant definitions, the #ifndef macro is incorrect and always true.
The system constants are defined using an enum so they're not directly
visible to the C preprocessor. The correct way to check for these two
constants is through AC_CHECK_DECLS() in configure.ac.
On 4/16/26 14:41, Sachin Sant wrote:
> 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)
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
More information about the ltp
mailing list