Condy v1.5.0
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
condy_uring.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <liburing.h> // IWYU pragma: export
8
9// liburing <= 2.3 has no version macros, define them here
10
11#ifndef IO_URING_VERSION_MAJOR
12#define IO_URING_VERSION_MAJOR 2
13#endif
14
15#ifndef IO_URING_VERSION_MINOR
16#define IO_URING_VERSION_MINOR 3
17#endif
18
19#ifndef IO_URING_CHECK_VERSION
20#define IO_URING_CHECK_VERSION(major, minor) \
21 (major > IO_URING_VERSION_MAJOR || \
22 (major == IO_URING_VERSION_MAJOR && minor > IO_URING_VERSION_MINOR))
23#endif
24
25// Polyfill for io_uring_prep_uring_cmd (added in liburing 2.13)
26// Opcode exists since 2.3, only the helper function is missing
27#if IO_URING_CHECK_VERSION(2, 13) // < 2.13
28inline void io_uring_prep_uring_cmd(struct io_uring_sqe *sqe, int cmd_op,
29 int fd) noexcept {
30 sqe->opcode = (__u8)IORING_OP_URING_CMD;
31 sqe->fd = fd;
32 sqe->cmd_op = cmd_op;
33 sqe->__pad1 = 0;
34 sqe->addr = 0ul;
35 sqe->len = 0;
36}
37#endif