Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 7 | #ifndef LINUX_IO_URING_H |
| 8 | #define LINUX_IO_URING_H |
| 9 | #include <linux/fs.h> |
| 10 | #include <linux/types.h> |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 11 | #ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 12 | #include <linux/time_types.h> |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 13 | #endif |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 17 | struct io_uring_sqe { |
| 18 | __u8 opcode; |
| 19 | __u8 flags; |
| 20 | __u16 ioprio; |
| 21 | __s32 fd; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 22 | union { |
| 23 | __u64 off; |
| 24 | __u64 addr2; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 25 | struct { |
| 26 | __u32 cmd_op; |
| 27 | __u32 __pad1; |
| 28 | }; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 29 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 30 | union { |
| 31 | __u64 addr; |
| 32 | __u64 splice_off_in; |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 33 | struct { |
| 34 | __u32 level; |
| 35 | __u32 optname; |
| 36 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 37 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 38 | __u32 len; |
| 39 | union { |
| 40 | __kernel_rwf_t rw_flags; |
| 41 | __u32 fsync_flags; |
| 42 | __u16 poll_events; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 43 | __u32 poll32_events; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 44 | __u32 sync_range_flags; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 45 | __u32 msg_flags; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 46 | __u32 timeout_flags; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 47 | __u32 accept_flags; |
| 48 | __u32 cancel_flags; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 49 | __u32 open_flags; |
| 50 | __u32 statx_flags; |
| 51 | __u32 fadvise_advice; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 52 | __u32 splice_flags; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 53 | __u32 rename_flags; |
| 54 | __u32 unlink_flags; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 55 | __u32 hardlink_flags; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 56 | __u32 xattr_flags; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 57 | __u32 msg_ring_flags; |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 58 | __u32 uring_cmd_flags; |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 59 | __u32 waitid_flags; |
| 60 | __u32 futex_flags; |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 61 | __u32 install_fd_flags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 62 | }; |
| 63 | __u64 user_data; |
| 64 | union { |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 65 | __u16 buf_index; |
| 66 | __u16 buf_group; |
| 67 | } __attribute__((packed)); |
| 68 | __u16 personality; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 69 | union { |
| 70 | __s32 splice_fd_in; |
| 71 | __u32 file_index; |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 72 | __u32 optlen; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 73 | struct { |
| 74 | __u16 addr_len; |
| 75 | __u16 __pad3[1]; |
| 76 | }; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 77 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 78 | union { |
| 79 | struct { |
| 80 | __u64 addr3; |
| 81 | __u64 __pad2[1]; |
| 82 | }; |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 83 | __u64 optval; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 84 | __u8 cmd[0]; |
| 85 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 86 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 87 | #define IORING_FILE_INDEX_ALLOC (~0U) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 88 | enum { |
| 89 | IOSQE_FIXED_FILE_BIT, |
| 90 | IOSQE_IO_DRAIN_BIT, |
| 91 | IOSQE_IO_LINK_BIT, |
| 92 | IOSQE_IO_HARDLINK_BIT, |
| 93 | IOSQE_ASYNC_BIT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 94 | IOSQE_BUFFER_SELECT_BIT, |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 95 | IOSQE_CQE_SKIP_SUCCESS_BIT, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 96 | }; |
| 97 | #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) |
| 98 | #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) |
| 99 | #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) |
| 100 | #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) |
| 101 | #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 102 | #define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT) |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 103 | #define IOSQE_CQE_SKIP_SUCCESS (1U << IOSQE_CQE_SKIP_SUCCESS_BIT) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 104 | #define IORING_SETUP_IOPOLL (1U << 0) |
| 105 | #define IORING_SETUP_SQPOLL (1U << 1) |
| 106 | #define IORING_SETUP_SQ_AFF (1U << 2) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 107 | #define IORING_SETUP_CQSIZE (1U << 3) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 108 | #define IORING_SETUP_CLAMP (1U << 4) |
| 109 | #define IORING_SETUP_ATTACH_WQ (1U << 5) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 110 | #define IORING_SETUP_R_DISABLED (1U << 6) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 111 | #define IORING_SETUP_SUBMIT_ALL (1U << 7) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 112 | #define IORING_SETUP_COOP_TASKRUN (1U << 8) |
| 113 | #define IORING_SETUP_TASKRUN_FLAG (1U << 9) |
| 114 | #define IORING_SETUP_SQE128 (1U << 10) |
| 115 | #define IORING_SETUP_CQE32 (1U << 11) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 116 | #define IORING_SETUP_SINGLE_ISSUER (1U << 12) |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 117 | #define IORING_SETUP_DEFER_TASKRUN (1U << 13) |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 118 | #define IORING_SETUP_NO_MMAP (1U << 14) |
| 119 | #define IORING_SETUP_REGISTERED_FD_ONLY (1U << 15) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 120 | #define IORING_SETUP_NO_SQARRAY (1U << 16) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 121 | enum io_uring_op { |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 122 | IORING_OP_NOP, |
| 123 | IORING_OP_READV, |
| 124 | IORING_OP_WRITEV, |
| 125 | IORING_OP_FSYNC, |
| 126 | IORING_OP_READ_FIXED, |
| 127 | IORING_OP_WRITE_FIXED, |
| 128 | IORING_OP_POLL_ADD, |
| 129 | IORING_OP_POLL_REMOVE, |
| 130 | IORING_OP_SYNC_FILE_RANGE, |
| 131 | IORING_OP_SENDMSG, |
| 132 | IORING_OP_RECVMSG, |
| 133 | IORING_OP_TIMEOUT, |
| 134 | IORING_OP_TIMEOUT_REMOVE, |
| 135 | IORING_OP_ACCEPT, |
| 136 | IORING_OP_ASYNC_CANCEL, |
| 137 | IORING_OP_LINK_TIMEOUT, |
| 138 | IORING_OP_CONNECT, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 139 | IORING_OP_FALLOCATE, |
| 140 | IORING_OP_OPENAT, |
| 141 | IORING_OP_CLOSE, |
| 142 | IORING_OP_FILES_UPDATE, |
| 143 | IORING_OP_STATX, |
| 144 | IORING_OP_READ, |
| 145 | IORING_OP_WRITE, |
| 146 | IORING_OP_FADVISE, |
| 147 | IORING_OP_MADVISE, |
| 148 | IORING_OP_SEND, |
| 149 | IORING_OP_RECV, |
| 150 | IORING_OP_OPENAT2, |
| 151 | IORING_OP_EPOLL_CTL, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 152 | IORING_OP_SPLICE, |
| 153 | IORING_OP_PROVIDE_BUFFERS, |
| 154 | IORING_OP_REMOVE_BUFFERS, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 155 | IORING_OP_TEE, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 156 | IORING_OP_SHUTDOWN, |
| 157 | IORING_OP_RENAMEAT, |
| 158 | IORING_OP_UNLINKAT, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 159 | IORING_OP_MKDIRAT, |
| 160 | IORING_OP_SYMLINKAT, |
| 161 | IORING_OP_LINKAT, |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 162 | IORING_OP_MSG_RING, |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 163 | IORING_OP_FSETXATTR, |
| 164 | IORING_OP_SETXATTR, |
| 165 | IORING_OP_FGETXATTR, |
| 166 | IORING_OP_GETXATTR, |
| 167 | IORING_OP_SOCKET, |
| 168 | IORING_OP_URING_CMD, |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 169 | IORING_OP_SEND_ZC, |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 170 | IORING_OP_SENDMSG_ZC, |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 171 | IORING_OP_READ_MULTISHOT, |
| 172 | IORING_OP_WAITID, |
| 173 | IORING_OP_FUTEX_WAIT, |
| 174 | IORING_OP_FUTEX_WAKE, |
| 175 | IORING_OP_FUTEX_WAITV, |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 176 | IORING_OP_FIXED_FD_INSTALL, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 177 | IORING_OP_LAST, |
| 178 | }; |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 179 | #define IORING_URING_CMD_FIXED (1U << 0) |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 180 | #define IORING_URING_CMD_MASK IORING_URING_CMD_FIXED |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 181 | #define IORING_FSYNC_DATASYNC (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 182 | #define IORING_TIMEOUT_ABS (1U << 0) |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 183 | #define IORING_TIMEOUT_UPDATE (1U << 1) |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 184 | #define IORING_TIMEOUT_BOOTTIME (1U << 2) |
| 185 | #define IORING_TIMEOUT_REALTIME (1U << 3) |
| 186 | #define IORING_LINK_TIMEOUT_UPDATE (1U << 4) |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 187 | #define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5) |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 188 | #define IORING_TIMEOUT_MULTISHOT (1U << 6) |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 189 | #define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME) |
| 190 | #define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 191 | #define SPLICE_F_FD_IN_FIXED (1U << 31) |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 192 | #define IORING_POLL_ADD_MULTI (1U << 0) |
| 193 | #define IORING_POLL_UPDATE_EVENTS (1U << 1) |
| 194 | #define IORING_POLL_UPDATE_USER_DATA (1U << 2) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 195 | #define IORING_POLL_ADD_LEVEL (1U << 3) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 196 | #define IORING_ASYNC_CANCEL_ALL (1U << 0) |
| 197 | #define IORING_ASYNC_CANCEL_FD (1U << 1) |
| 198 | #define IORING_ASYNC_CANCEL_ANY (1U << 2) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 199 | #define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 200 | #define IORING_ASYNC_CANCEL_USERDATA (1U << 4) |
| 201 | #define IORING_ASYNC_CANCEL_OP (1U << 5) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 202 | #define IORING_RECVSEND_POLL_FIRST (1U << 0) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 203 | #define IORING_RECV_MULTISHOT (1U << 1) |
| 204 | #define IORING_RECVSEND_FIXED_BUF (1U << 2) |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 205 | #define IORING_SEND_ZC_REPORT_USAGE (1U << 3) |
| 206 | #define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 207 | #define IORING_ACCEPT_MULTISHOT (1U << 0) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 208 | enum { |
| 209 | IORING_MSG_DATA, |
| 210 | IORING_MSG_SEND_FD, |
| 211 | }; |
| 212 | #define IORING_MSG_RING_CQE_SKIP (1U << 0) |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 213 | #define IORING_MSG_RING_FLAGS_PASS (1U << 1) |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 214 | #define IORING_FIXED_FD_NO_CLOEXEC (1U << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 215 | struct io_uring_cqe { |
| 216 | __u64 user_data; |
| 217 | __s32 res; |
| 218 | __u32 flags; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 219 | __u64 big_cqe[]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 220 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 221 | #define IORING_CQE_F_BUFFER (1U << 0) |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 222 | #define IORING_CQE_F_MORE (1U << 1) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 223 | #define IORING_CQE_F_SOCK_NONEMPTY (1U << 2) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 224 | #define IORING_CQE_F_NOTIF (1U << 3) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 225 | enum { |
| 226 | IORING_CQE_BUFFER_SHIFT = 16, |
| 227 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 228 | #define IORING_OFF_SQ_RING 0ULL |
| 229 | #define IORING_OFF_CQ_RING 0x8000000ULL |
| 230 | #define IORING_OFF_SQES 0x10000000ULL |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 231 | #define IORING_OFF_PBUF_RING 0x80000000ULL |
| 232 | #define IORING_OFF_PBUF_SHIFT 16 |
| 233 | #define IORING_OFF_MMAP_MASK 0xf8000000ULL |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 234 | struct io_sqring_offsets { |
| 235 | __u32 head; |
| 236 | __u32 tail; |
| 237 | __u32 ring_mask; |
| 238 | __u32 ring_entries; |
| 239 | __u32 flags; |
| 240 | __u32 dropped; |
| 241 | __u32 array; |
| 242 | __u32 resv1; |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 243 | __u64 user_addr; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 244 | }; |
| 245 | #define IORING_SQ_NEED_WAKEUP (1U << 0) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 246 | #define IORING_SQ_CQ_OVERFLOW (1U << 1) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 247 | #define IORING_SQ_TASKRUN (1U << 2) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 248 | struct io_cqring_offsets { |
| 249 | __u32 head; |
| 250 | __u32 tail; |
| 251 | __u32 ring_mask; |
| 252 | __u32 ring_entries; |
| 253 | __u32 overflow; |
| 254 | __u32 cqes; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 255 | __u32 flags; |
| 256 | __u32 resv1; |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 257 | __u64 user_addr; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 258 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 259 | #define IORING_CQ_EVENTFD_DISABLED (1U << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 260 | #define IORING_ENTER_GETEVENTS (1U << 0) |
| 261 | #define IORING_ENTER_SQ_WAKEUP (1U << 1) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 262 | #define IORING_ENTER_SQ_WAIT (1U << 2) |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 263 | #define IORING_ENTER_EXT_ARG (1U << 3) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 264 | #define IORING_ENTER_REGISTERED_RING (1U << 4) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 265 | struct io_uring_params { |
| 266 | __u32 sq_entries; |
| 267 | __u32 cq_entries; |
| 268 | __u32 flags; |
| 269 | __u32 sq_thread_cpu; |
| 270 | __u32 sq_thread_idle; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 271 | __u32 features; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 272 | __u32 wq_fd; |
| 273 | __u32 resv[3]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 274 | struct io_sqring_offsets sq_off; |
| 275 | struct io_cqring_offsets cq_off; |
| 276 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 277 | #define IORING_FEAT_SINGLE_MMAP (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 278 | #define IORING_FEAT_NODROP (1U << 1) |
| 279 | #define IORING_FEAT_SUBMIT_STABLE (1U << 2) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 280 | #define IORING_FEAT_RW_CUR_POS (1U << 3) |
| 281 | #define IORING_FEAT_CUR_PERSONALITY (1U << 4) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 282 | #define IORING_FEAT_FAST_POLL (1U << 5) |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 283 | #define IORING_FEAT_POLL_32BITS (1U << 6) |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 284 | #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7) |
| 285 | #define IORING_FEAT_EXT_ARG (1U << 8) |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 286 | #define IORING_FEAT_NATIVE_WORKERS (1U << 9) |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 287 | #define IORING_FEAT_RSRC_TAGS (1U << 10) |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 288 | #define IORING_FEAT_CQE_SKIP (1U << 11) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 289 | #define IORING_FEAT_LINKED_FILE (1U << 12) |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 290 | #define IORING_FEAT_REG_REG_RING (1U << 13) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 291 | enum { |
| 292 | IORING_REGISTER_BUFFERS = 0, |
| 293 | IORING_UNREGISTER_BUFFERS = 1, |
| 294 | IORING_REGISTER_FILES = 2, |
| 295 | IORING_UNREGISTER_FILES = 3, |
| 296 | IORING_REGISTER_EVENTFD = 4, |
| 297 | IORING_UNREGISTER_EVENTFD = 5, |
| 298 | IORING_REGISTER_FILES_UPDATE = 6, |
| 299 | IORING_REGISTER_EVENTFD_ASYNC = 7, |
| 300 | IORING_REGISTER_PROBE = 8, |
| 301 | IORING_REGISTER_PERSONALITY = 9, |
| 302 | IORING_UNREGISTER_PERSONALITY = 10, |
| 303 | IORING_REGISTER_RESTRICTIONS = 11, |
| 304 | IORING_REGISTER_ENABLE_RINGS = 12, |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 305 | IORING_REGISTER_FILES2 = 13, |
| 306 | IORING_REGISTER_FILES_UPDATE2 = 14, |
| 307 | IORING_REGISTER_BUFFERS2 = 15, |
| 308 | IORING_REGISTER_BUFFERS_UPDATE = 16, |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 309 | IORING_REGISTER_IOWQ_AFF = 17, |
| 310 | IORING_UNREGISTER_IOWQ_AFF = 18, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 311 | IORING_REGISTER_IOWQ_MAX_WORKERS = 19, |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 312 | IORING_REGISTER_RING_FDS = 20, |
| 313 | IORING_UNREGISTER_RING_FDS = 21, |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 314 | IORING_REGISTER_PBUF_RING = 22, |
| 315 | IORING_UNREGISTER_PBUF_RING = 23, |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 316 | IORING_REGISTER_SYNC_CANCEL = 24, |
| 317 | IORING_REGISTER_FILE_ALLOC_RANGE = 25, |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 318 | IORING_REGISTER_PBUF_STATUS = 26, |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 319 | IORING_REGISTER_LAST, |
| 320 | IORING_REGISTER_USE_REGISTERED_RING = 1U << 31 |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 321 | }; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 322 | enum { |
| 323 | IO_WQ_BOUND, |
| 324 | IO_WQ_UNBOUND, |
| 325 | }; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 326 | struct io_uring_files_update { |
| 327 | __u32 offset; |
| 328 | __u32 resv; |
| 329 | __aligned_u64 fds; |
| 330 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 331 | #define IORING_RSRC_REGISTER_SPARSE (1U << 0) |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 332 | struct io_uring_rsrc_register { |
| 333 | __u32 nr; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 334 | __u32 flags; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 335 | __u64 resv2; |
| 336 | __aligned_u64 data; |
| 337 | __aligned_u64 tags; |
| 338 | }; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 339 | struct io_uring_rsrc_update { |
| 340 | __u32 offset; |
| 341 | __u32 resv; |
| 342 | __aligned_u64 data; |
| 343 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 344 | struct io_uring_rsrc_update2 { |
| 345 | __u32 offset; |
| 346 | __u32 resv; |
| 347 | __aligned_u64 data; |
| 348 | __aligned_u64 tags; |
| 349 | __u32 nr; |
| 350 | __u32 resv2; |
| 351 | }; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 352 | #define IORING_REGISTER_FILES_SKIP (- 2) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 353 | #define IO_URING_OP_SUPPORTED (1U << 0) |
| 354 | struct io_uring_probe_op { |
| 355 | __u8 op; |
| 356 | __u8 resv; |
| 357 | __u16 flags; |
| 358 | __u32 resv2; |
| 359 | }; |
| 360 | struct io_uring_probe { |
| 361 | __u8 last_op; |
| 362 | __u8 ops_len; |
| 363 | __u16 resv; |
| 364 | __u32 resv2[3]; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 365 | struct io_uring_probe_op ops[]; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 366 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 367 | struct io_uring_restriction { |
| 368 | __u16 opcode; |
| 369 | union { |
| 370 | __u8 register_op; |
| 371 | __u8 sqe_op; |
| 372 | __u8 sqe_flags; |
| 373 | }; |
| 374 | __u8 resv; |
| 375 | __u32 resv2[3]; |
| 376 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 377 | struct io_uring_buf { |
| 378 | __u64 addr; |
| 379 | __u32 len; |
| 380 | __u16 bid; |
| 381 | __u16 resv; |
| 382 | }; |
| 383 | struct io_uring_buf_ring { |
| 384 | union { |
| 385 | struct { |
| 386 | __u64 resv1; |
| 387 | __u32 resv2; |
| 388 | __u16 resv3; |
| 389 | __u16 tail; |
| 390 | }; |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 391 | __DECLARE_FLEX_ARRAY(struct io_uring_buf, bufs); |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 392 | }; |
| 393 | }; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 394 | enum { |
| 395 | IOU_PBUF_RING_MMAP = 1, |
| 396 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 397 | struct io_uring_buf_reg { |
| 398 | __u64 ring_addr; |
| 399 | __u32 ring_entries; |
| 400 | __u16 bgid; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 401 | __u16 flags; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 402 | __u64 resv[3]; |
| 403 | }; |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 404 | struct io_uring_buf_status { |
| 405 | __u32 buf_group; |
| 406 | __u32 head; |
| 407 | __u32 resv[8]; |
| 408 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 409 | enum { |
| 410 | IORING_RESTRICTION_REGISTER_OP = 0, |
| 411 | IORING_RESTRICTION_SQE_OP = 1, |
| 412 | IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2, |
| 413 | IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3, |
| 414 | IORING_RESTRICTION_LAST |
| 415 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 416 | struct io_uring_getevents_arg { |
| 417 | __u64 sigmask; |
| 418 | __u32 sigmask_sz; |
| 419 | __u32 pad; |
| 420 | __u64 ts; |
| 421 | }; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 422 | struct io_uring_sync_cancel_reg { |
| 423 | __u64 addr; |
| 424 | __s32 fd; |
| 425 | __u32 flags; |
| 426 | struct __kernel_timespec timeout; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 427 | __u8 opcode; |
| 428 | __u8 pad[7]; |
| 429 | __u64 pad2[3]; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 430 | }; |
| 431 | struct io_uring_file_index_range { |
| 432 | __u32 off; |
| 433 | __u32 len; |
| 434 | __u64 resv; |
| 435 | }; |
| 436 | struct io_uring_recvmsg_out { |
| 437 | __u32 namelen; |
| 438 | __u32 controllen; |
| 439 | __u32 payloadlen; |
| 440 | __u32 flags; |
| 441 | }; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 442 | enum { |
| 443 | SOCKET_URING_OP_SIOCINQ = 0, |
| 444 | SOCKET_URING_OP_SIOCOUTQ, |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 445 | SOCKET_URING_OP_GETSOCKOPT, |
| 446 | SOCKET_URING_OP_SETSOCKOPT, |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 447 | }; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 448 | #ifdef __cplusplus |
| 449 | } |
| 450 | #endif |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 451 | #endif |