polyphony 0.85 → 0.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/ext/polyphony/io_extensions.c +2 -3
  5. data/lib/polyphony/version.rb +1 -1
  6. data/polyphony.gemspec +1 -1
  7. data/test/test_backend.rb +1 -1
  8. data/test/test_signal.rb +3 -3
  9. data/vendor/liburing/.github/pull_request_template.md +86 -0
  10. data/vendor/liburing/.github/workflows/build.yml +85 -0
  11. data/vendor/liburing/.github/workflows/shellcheck.yml +20 -0
  12. data/vendor/liburing/.gitignore +149 -0
  13. data/vendor/liburing/COPYING +502 -0
  14. data/vendor/liburing/COPYING.GPL +339 -0
  15. data/vendor/liburing/LICENSE +7 -0
  16. data/vendor/liburing/Makefile +82 -0
  17. data/vendor/liburing/Makefile.common +5 -0
  18. data/vendor/liburing/Makefile.quiet +11 -0
  19. data/vendor/liburing/README +46 -0
  20. data/vendor/liburing/configure +486 -0
  21. data/vendor/liburing/debian/README.Debian +7 -0
  22. data/vendor/liburing/debian/changelog +27 -0
  23. data/vendor/liburing/debian/compat +1 -0
  24. data/vendor/liburing/debian/control +48 -0
  25. data/vendor/liburing/debian/copyright +49 -0
  26. data/vendor/liburing/debian/liburing-dev.install +4 -0
  27. data/vendor/liburing/debian/liburing-dev.manpages +6 -0
  28. data/vendor/liburing/debian/liburing1-udeb.install +1 -0
  29. data/vendor/liburing/debian/liburing1.install +1 -0
  30. data/vendor/liburing/debian/liburing1.symbols +32 -0
  31. data/vendor/liburing/debian/patches/series +1 -0
  32. data/vendor/liburing/debian/rules +81 -0
  33. data/vendor/liburing/debian/source/format +1 -0
  34. data/vendor/liburing/debian/source/local-options +2 -0
  35. data/vendor/liburing/debian/source/options +1 -0
  36. data/vendor/liburing/debian/watch +3 -0
  37. data/vendor/liburing/examples/Makefile +38 -0
  38. data/vendor/liburing/examples/io_uring-cp.c +282 -0
  39. data/vendor/liburing/examples/io_uring-test.c +112 -0
  40. data/vendor/liburing/examples/link-cp.c +193 -0
  41. data/vendor/liburing/examples/ucontext-cp.c +273 -0
  42. data/vendor/liburing/liburing.pc.in +12 -0
  43. data/vendor/liburing/liburing.spec +66 -0
  44. data/vendor/liburing/make-debs.sh +53 -0
  45. data/vendor/liburing/man/io_uring.7 +754 -0
  46. data/vendor/liburing/man/io_uring_cq_advance.3 +35 -0
  47. data/vendor/liburing/man/io_uring_cq_ready.3 +25 -0
  48. data/vendor/liburing/man/io_uring_cqe_get_data.3 +34 -0
  49. data/vendor/liburing/man/io_uring_cqe_seen.3 +32 -0
  50. data/vendor/liburing/man/io_uring_enter.2 +1483 -0
  51. data/vendor/liburing/man/io_uring_free_probe.3 +24 -0
  52. data/vendor/liburing/man/io_uring_get_probe.3 +29 -0
  53. data/vendor/liburing/man/io_uring_get_sqe.3 +38 -0
  54. data/vendor/liburing/man/io_uring_opcode_supported.3 +29 -0
  55. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +58 -0
  56. data/vendor/liburing/man/io_uring_prep_read.3 +50 -0
  57. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +54 -0
  58. data/vendor/liburing/man/io_uring_prep_readv.3 +51 -0
  59. data/vendor/liburing/man/io_uring_prep_readv2.3 +79 -0
  60. data/vendor/liburing/man/io_uring_prep_write.3 +50 -0
  61. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +54 -0
  62. data/vendor/liburing/man/io_uring_prep_writev.3 +51 -0
  63. data/vendor/liburing/man/io_uring_prep_writev2.3 +78 -0
  64. data/vendor/liburing/man/io_uring_queue_exit.3 +27 -0
  65. data/vendor/liburing/man/io_uring_queue_init.3 +44 -0
  66. data/vendor/liburing/man/io_uring_register.2 +688 -0
  67. data/vendor/liburing/man/io_uring_register_buffers.3 +41 -0
  68. data/vendor/liburing/man/io_uring_register_files.3 +35 -0
  69. data/vendor/liburing/man/io_uring_setup.2 +534 -0
  70. data/vendor/liburing/man/io_uring_sq_ready.3 +25 -0
  71. data/vendor/liburing/man/io_uring_sq_space_left.3 +25 -0
  72. data/vendor/liburing/man/io_uring_sqe_set_data.3 +30 -0
  73. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +60 -0
  74. data/vendor/liburing/man/io_uring_sqring_wait.3 +30 -0
  75. data/vendor/liburing/man/io_uring_submit.3 +29 -0
  76. data/vendor/liburing/man/io_uring_submit_and_wait.3 +34 -0
  77. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +49 -0
  78. data/vendor/liburing/man/io_uring_unregister_buffers.3 +26 -0
  79. data/vendor/liburing/man/io_uring_unregister_files.3 +26 -0
  80. data/vendor/liburing/man/io_uring_wait_cqe.3 +33 -0
  81. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +36 -0
  82. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +39 -0
  83. data/vendor/liburing/man/io_uring_wait_cqes.3 +46 -0
  84. data/vendor/liburing/src/Makefile +89 -0
  85. data/vendor/liburing/src/arch/aarch64/syscall.h +95 -0
  86. data/vendor/liburing/src/arch/generic/lib.h +21 -0
  87. data/vendor/liburing/src/arch/generic/syscall.h +87 -0
  88. data/vendor/liburing/src/arch/syscall-defs.h +67 -0
  89. data/vendor/liburing/src/arch/x86/lib.h +32 -0
  90. data/vendor/liburing/src/arch/x86/syscall.h +160 -0
  91. data/vendor/liburing/src/include/liburing/barrier.h +81 -0
  92. data/vendor/liburing/src/include/liburing/io_uring.h +442 -0
  93. data/vendor/liburing/src/include/liburing.h +921 -0
  94. data/vendor/liburing/src/int_flags.h +8 -0
  95. data/vendor/liburing/src/lib.h +57 -0
  96. data/vendor/liburing/src/liburing.map +53 -0
  97. data/vendor/liburing/src/nolibc.c +48 -0
  98. data/vendor/liburing/src/queue.c +403 -0
  99. data/vendor/liburing/src/register.c +293 -0
  100. data/vendor/liburing/src/setup.c +332 -0
  101. data/vendor/liburing/src/syscall.c +47 -0
  102. data/vendor/liburing/src/syscall.h +103 -0
  103. data/vendor/liburing/test/232c93d07b74-test.c +306 -0
  104. data/vendor/liburing/test/35fa71a030ca-test.c +329 -0
  105. data/vendor/liburing/test/500f9fbadef8-test.c +89 -0
  106. data/vendor/liburing/test/7ad0e4b2f83c-test.c +93 -0
  107. data/vendor/liburing/test/8a9973408177-test.c +106 -0
  108. data/vendor/liburing/test/917257daa0fe-test.c +53 -0
  109. data/vendor/liburing/test/Makefile +244 -0
  110. data/vendor/liburing/test/a0908ae19763-test.c +58 -0
  111. data/vendor/liburing/test/a4c0b3decb33-test.c +180 -0
  112. data/vendor/liburing/test/accept-link.c +254 -0
  113. data/vendor/liburing/test/accept-reuse.c +164 -0
  114. data/vendor/liburing/test/accept-test.c +79 -0
  115. data/vendor/liburing/test/accept.c +477 -0
  116. data/vendor/liburing/test/across-fork.c +283 -0
  117. data/vendor/liburing/test/b19062a56726-test.c +53 -0
  118. data/vendor/liburing/test/b5837bd5311d-test.c +77 -0
  119. data/vendor/liburing/test/ce593a6c480a-test.c +136 -0
  120. data/vendor/liburing/test/close-opath.c +122 -0
  121. data/vendor/liburing/test/config +10 -0
  122. data/vendor/liburing/test/connect.c +398 -0
  123. data/vendor/liburing/test/cq-full.c +96 -0
  124. data/vendor/liburing/test/cq-overflow.c +294 -0
  125. data/vendor/liburing/test/cq-peek-batch.c +102 -0
  126. data/vendor/liburing/test/cq-ready.c +94 -0
  127. data/vendor/liburing/test/cq-size.c +64 -0
  128. data/vendor/liburing/test/d4ae271dfaae-test.c +96 -0
  129. data/vendor/liburing/test/d77a67ed5f27-test.c +65 -0
  130. data/vendor/liburing/test/defer.c +307 -0
  131. data/vendor/liburing/test/double-poll-crash.c +185 -0
  132. data/vendor/liburing/test/drop-submit.c +92 -0
  133. data/vendor/liburing/test/eeed8b54e0df-test.c +114 -0
  134. data/vendor/liburing/test/empty-eownerdead.c +45 -0
  135. data/vendor/liburing/test/eventfd-disable.c +151 -0
  136. data/vendor/liburing/test/eventfd-reg.c +76 -0
  137. data/vendor/liburing/test/eventfd-ring.c +97 -0
  138. data/vendor/liburing/test/eventfd.c +112 -0
  139. data/vendor/liburing/test/exec-target.c +6 -0
  140. data/vendor/liburing/test/exit-no-cleanup.c +117 -0
  141. data/vendor/liburing/test/fadvise.c +202 -0
  142. data/vendor/liburing/test/fallocate.c +249 -0
  143. data/vendor/liburing/test/fc2a85cb02ef-test.c +131 -0
  144. data/vendor/liburing/test/file-register.c +858 -0
  145. data/vendor/liburing/test/file-update.c +173 -0
  146. data/vendor/liburing/test/file-verify.c +629 -0
  147. data/vendor/liburing/test/files-exit-hang-poll.c +128 -0
  148. data/vendor/liburing/test/files-exit-hang-timeout.c +134 -0
  149. data/vendor/liburing/test/fixed-link.c +90 -0
  150. data/vendor/liburing/test/fpos.c +252 -0
  151. data/vendor/liburing/test/fsync.c +224 -0
  152. data/vendor/liburing/test/hardlink.c +136 -0
  153. data/vendor/liburing/test/helpers.c +135 -0
  154. data/vendor/liburing/test/helpers.h +67 -0
  155. data/vendor/liburing/test/io-cancel.c +550 -0
  156. data/vendor/liburing/test/io_uring_enter.c +296 -0
  157. data/vendor/liburing/test/io_uring_register.c +676 -0
  158. data/vendor/liburing/test/io_uring_setup.c +192 -0
  159. data/vendor/liburing/test/iopoll.c +372 -0
  160. data/vendor/liburing/test/lfs-openat-write.c +119 -0
  161. data/vendor/liburing/test/lfs-openat.c +275 -0
  162. data/vendor/liburing/test/link-timeout.c +1107 -0
  163. data/vendor/liburing/test/link.c +496 -0
  164. data/vendor/liburing/test/link_drain.c +229 -0
  165. data/vendor/liburing/test/madvise.c +195 -0
  166. data/vendor/liburing/test/mkdir.c +108 -0
  167. data/vendor/liburing/test/msg-ring.c +234 -0
  168. data/vendor/liburing/test/multicqes_drain.c +387 -0
  169. data/vendor/liburing/test/nop-all-sizes.c +99 -0
  170. data/vendor/liburing/test/nop.c +115 -0
  171. data/vendor/liburing/test/open-close.c +261 -0
  172. data/vendor/liburing/test/openat2.c +308 -0
  173. data/vendor/liburing/test/personality.c +204 -0
  174. data/vendor/liburing/test/pipe-eof.c +83 -0
  175. data/vendor/liburing/test/pipe-reuse.c +105 -0
  176. data/vendor/liburing/test/poll-cancel-ton.c +135 -0
  177. data/vendor/liburing/test/poll-cancel.c +228 -0
  178. data/vendor/liburing/test/poll-link.c +230 -0
  179. data/vendor/liburing/test/poll-many.c +208 -0
  180. data/vendor/liburing/test/poll-mshot-update.c +273 -0
  181. data/vendor/liburing/test/poll-ring.c +48 -0
  182. data/vendor/liburing/test/poll-v-poll.c +353 -0
  183. data/vendor/liburing/test/poll.c +109 -0
  184. data/vendor/liburing/test/pollfree.c +426 -0
  185. data/vendor/liburing/test/probe.c +135 -0
  186. data/vendor/liburing/test/read-write.c +876 -0
  187. data/vendor/liburing/test/register-restrictions.c +633 -0
  188. data/vendor/liburing/test/rename.c +135 -0
  189. data/vendor/liburing/test/ring-leak.c +173 -0
  190. data/vendor/liburing/test/ring-leak2.c +249 -0
  191. data/vendor/liburing/test/rsrc_tags.c +449 -0
  192. data/vendor/liburing/test/runtests-loop.sh +16 -0
  193. data/vendor/liburing/test/runtests.sh +170 -0
  194. data/vendor/liburing/test/rw_merge_test.c +97 -0
  195. data/vendor/liburing/test/self.c +91 -0
  196. data/vendor/liburing/test/send_recv.c +286 -0
  197. data/vendor/liburing/test/send_recvmsg.c +345 -0
  198. data/vendor/liburing/test/sendmsg_fs_cve.c +200 -0
  199. data/vendor/liburing/test/shared-wq.c +84 -0
  200. data/vendor/liburing/test/short-read.c +75 -0
  201. data/vendor/liburing/test/shutdown.c +165 -0
  202. data/vendor/liburing/test/sigfd-deadlock.c +74 -0
  203. data/vendor/liburing/test/skip-cqe.c +429 -0
  204. data/vendor/liburing/test/socket-rw-eagain.c +158 -0
  205. data/vendor/liburing/test/socket-rw-offset.c +157 -0
  206. data/vendor/liburing/test/socket-rw.c +145 -0
  207. data/vendor/liburing/test/splice.c +512 -0
  208. data/vendor/liburing/test/sq-full-cpp.cc +45 -0
  209. data/vendor/liburing/test/sq-full.c +45 -0
  210. data/vendor/liburing/test/sq-poll-dup.c +204 -0
  211. data/vendor/liburing/test/sq-poll-kthread.c +169 -0
  212. data/vendor/liburing/test/sq-poll-share.c +137 -0
  213. data/vendor/liburing/test/sq-space_left.c +159 -0
  214. data/vendor/liburing/test/sqpoll-cancel-hang.c +157 -0
  215. data/vendor/liburing/test/sqpoll-disable-exit.c +196 -0
  216. data/vendor/liburing/test/sqpoll-exit-hang.c +78 -0
  217. data/vendor/liburing/test/sqpoll-sleep.c +69 -0
  218. data/vendor/liburing/test/statx.c +172 -0
  219. data/vendor/liburing/test/stdout.c +232 -0
  220. data/vendor/liburing/test/submit-link-fail.c +154 -0
  221. data/vendor/liburing/test/submit-reuse.c +239 -0
  222. data/vendor/liburing/test/symlink.c +116 -0
  223. data/vendor/liburing/test/teardowns.c +58 -0
  224. data/vendor/liburing/test/thread-exit.c +143 -0
  225. data/vendor/liburing/test/timeout-new.c +252 -0
  226. data/vendor/liburing/test/timeout-overflow.c +204 -0
  227. data/vendor/liburing/test/timeout.c +1523 -0
  228. data/vendor/liburing/test/unlink.c +112 -0
  229. data/vendor/liburing/test/wakeup-hang.c +162 -0
  230. metadata +223 -2
@@ -0,0 +1,442 @@
1
+ /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
2
+ /*
3
+ * Header file for the io_uring interface.
4
+ *
5
+ * Copyright (C) 2019 Jens Axboe
6
+ * Copyright (C) 2019 Christoph Hellwig
7
+ */
8
+ #ifndef LINUX_IO_URING_H
9
+ #define LINUX_IO_URING_H
10
+
11
+ #include <linux/fs.h>
12
+ #include <linux/types.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ /*
19
+ * IO submission data structure (Submission Queue Entry)
20
+ */
21
+ struct io_uring_sqe {
22
+ __u8 opcode; /* type of operation for this sqe */
23
+ __u8 flags; /* IOSQE_ flags */
24
+ __u16 ioprio; /* ioprio for the request */
25
+ __s32 fd; /* file descriptor to do IO on */
26
+ union {
27
+ __u64 off; /* offset into file */
28
+ __u64 addr2;
29
+ };
30
+ union {
31
+ __u64 addr; /* pointer to buffer or iovecs */
32
+ __u64 splice_off_in;
33
+ };
34
+ __u32 len; /* buffer size or number of iovecs */
35
+ union {
36
+ __kernel_rwf_t rw_flags;
37
+ __u32 fsync_flags;
38
+ __u16 poll_events; /* compatibility */
39
+ __u32 poll32_events; /* word-reversed for BE */
40
+ __u32 sync_range_flags;
41
+ __u32 msg_flags;
42
+ __u32 timeout_flags;
43
+ __u32 accept_flags;
44
+ __u32 cancel_flags;
45
+ __u32 open_flags;
46
+ __u32 statx_flags;
47
+ __u32 fadvise_advice;
48
+ __u32 splice_flags;
49
+ __u32 rename_flags;
50
+ __u32 unlink_flags;
51
+ __u32 hardlink_flags;
52
+ };
53
+ __u64 user_data; /* data to be passed back at completion time */
54
+ /* pack this to avoid bogus arm OABI complaints */
55
+ union {
56
+ /* index into fixed buffers, if used */
57
+ __u16 buf_index;
58
+ /* for grouped buffer selection */
59
+ __u16 buf_group;
60
+ } __attribute__((packed));
61
+ /* personality to use, if used */
62
+ __u16 personality;
63
+ union {
64
+ __s32 splice_fd_in;
65
+ __u32 file_index;
66
+ };
67
+ __u64 __pad2[2];
68
+ };
69
+
70
+ enum {
71
+ IOSQE_FIXED_FILE_BIT,
72
+ IOSQE_IO_DRAIN_BIT,
73
+ IOSQE_IO_LINK_BIT,
74
+ IOSQE_IO_HARDLINK_BIT,
75
+ IOSQE_ASYNC_BIT,
76
+ IOSQE_BUFFER_SELECT_BIT,
77
+ IOSQE_CQE_SKIP_SUCCESS_BIT,
78
+ };
79
+
80
+ /*
81
+ * sqe->flags
82
+ */
83
+ /* use fixed fileset */
84
+ #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
85
+ /* issue after inflight IO */
86
+ #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
87
+ /* links next sqe */
88
+ #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
89
+ /* like LINK, but stronger */
90
+ #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
91
+ /* always go async */
92
+ #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
93
+ /* select buffer from sqe->buf_group */
94
+ #define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
95
+ /* don't post CQE if request succeeded */
96
+ #define IOSQE_CQE_SKIP_SUCCESS (1U << IOSQE_CQE_SKIP_SUCCESS_BIT)
97
+
98
+ /*
99
+ * io_uring_setup() flags
100
+ */
101
+ #define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */
102
+ #define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */
103
+ #define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */
104
+ #define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */
105
+ #define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */
106
+ #define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */
107
+ #define IORING_SETUP_R_DISABLED (1U << 6) /* start with ring disabled */
108
+ #define IORING_SETUP_SUBMIT_ALL (1U << 7) /* continue submit on error */
109
+
110
+ enum {
111
+ IORING_OP_NOP,
112
+ IORING_OP_READV,
113
+ IORING_OP_WRITEV,
114
+ IORING_OP_FSYNC,
115
+ IORING_OP_READ_FIXED,
116
+ IORING_OP_WRITE_FIXED,
117
+ IORING_OP_POLL_ADD,
118
+ IORING_OP_POLL_REMOVE,
119
+ IORING_OP_SYNC_FILE_RANGE,
120
+ IORING_OP_SENDMSG,
121
+ IORING_OP_RECVMSG,
122
+ IORING_OP_TIMEOUT,
123
+ IORING_OP_TIMEOUT_REMOVE,
124
+ IORING_OP_ACCEPT,
125
+ IORING_OP_ASYNC_CANCEL,
126
+ IORING_OP_LINK_TIMEOUT,
127
+ IORING_OP_CONNECT,
128
+ IORING_OP_FALLOCATE,
129
+ IORING_OP_OPENAT,
130
+ IORING_OP_CLOSE,
131
+ IORING_OP_FILES_UPDATE,
132
+ IORING_OP_STATX,
133
+ IORING_OP_READ,
134
+ IORING_OP_WRITE,
135
+ IORING_OP_FADVISE,
136
+ IORING_OP_MADVISE,
137
+ IORING_OP_SEND,
138
+ IORING_OP_RECV,
139
+ IORING_OP_OPENAT2,
140
+ IORING_OP_EPOLL_CTL,
141
+ IORING_OP_SPLICE,
142
+ IORING_OP_PROVIDE_BUFFERS,
143
+ IORING_OP_REMOVE_BUFFERS,
144
+ IORING_OP_TEE,
145
+ IORING_OP_SHUTDOWN,
146
+ IORING_OP_RENAMEAT,
147
+ IORING_OP_UNLINKAT,
148
+ IORING_OP_MKDIRAT,
149
+ IORING_OP_SYMLINKAT,
150
+ IORING_OP_LINKAT,
151
+ IORING_OP_MSG_RING,
152
+
153
+ /* this goes last, obviously */
154
+ IORING_OP_LAST,
155
+ };
156
+
157
+ /*
158
+ * sqe->fsync_flags
159
+ */
160
+ #define IORING_FSYNC_DATASYNC (1U << 0)
161
+
162
+ /*
163
+ * sqe->timeout_flags
164
+ */
165
+ #define IORING_TIMEOUT_ABS (1U << 0)
166
+ #define IORING_TIMEOUT_UPDATE (1U << 1)
167
+ #define IORING_TIMEOUT_BOOTTIME (1U << 2)
168
+ #define IORING_TIMEOUT_REALTIME (1U << 3)
169
+ #define IORING_LINK_TIMEOUT_UPDATE (1U << 4)
170
+ #define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5)
171
+ #define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
172
+ #define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
173
+ /*
174
+ * sqe->splice_flags
175
+ * extends splice(2) flags
176
+ */
177
+ #define SPLICE_F_FD_IN_FIXED (1U << 31) /* the last bit of __u32 */
178
+
179
+ /*
180
+ * POLL_ADD flags. Note that since sqe->poll_events is the flag space, the
181
+ * command flags for POLL_ADD are stored in sqe->len.
182
+ *
183
+ * IORING_POLL_ADD_MULTI Multishot poll. Sets IORING_CQE_F_MORE if
184
+ * the poll handler will continue to report
185
+ * CQEs on behalf of the same SQE.
186
+ *
187
+ * IORING_POLL_UPDATE Update existing poll request, matching
188
+ * sqe->addr as the old user_data field.
189
+ */
190
+ #define IORING_POLL_ADD_MULTI (1U << 0)
191
+ #define IORING_POLL_UPDATE_EVENTS (1U << 1)
192
+ #define IORING_POLL_UPDATE_USER_DATA (1U << 2)
193
+
194
+ /*
195
+ * IO completion data structure (Completion Queue Entry)
196
+ */
197
+ struct io_uring_cqe {
198
+ __u64 user_data; /* sqe->data submission passed back */
199
+ __s32 res; /* result code for this event */
200
+ __u32 flags;
201
+ };
202
+
203
+ /*
204
+ * cqe->flags
205
+ *
206
+ * IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID
207
+ * IORING_CQE_F_MORE If set, parent SQE will generate more CQE entries
208
+ * IORING_CQE_F_MSG If set, CQE was generated with IORING_OP_MSG_RING
209
+ */
210
+ #define IORING_CQE_F_BUFFER (1U << 0)
211
+ #define IORING_CQE_F_MORE (1U << 1)
212
+ #define IORING_CQE_F_MSG (1U << 2)
213
+
214
+ enum {
215
+ IORING_CQE_BUFFER_SHIFT = 16,
216
+ };
217
+
218
+ /*
219
+ * Magic offsets for the application to mmap the data it needs
220
+ */
221
+ #define IORING_OFF_SQ_RING 0ULL
222
+ #define IORING_OFF_CQ_RING 0x8000000ULL
223
+ #define IORING_OFF_SQES 0x10000000ULL
224
+
225
+ /*
226
+ * Filled with the offset for mmap(2)
227
+ */
228
+ struct io_sqring_offsets {
229
+ __u32 head;
230
+ __u32 tail;
231
+ __u32 ring_mask;
232
+ __u32 ring_entries;
233
+ __u32 flags;
234
+ __u32 dropped;
235
+ __u32 array;
236
+ __u32 resv1;
237
+ __u64 resv2;
238
+ };
239
+
240
+ /*
241
+ * sq_ring->flags
242
+ */
243
+ #define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */
244
+ #define IORING_SQ_CQ_OVERFLOW (1U << 1) /* CQ ring is overflown */
245
+
246
+ struct io_cqring_offsets {
247
+ __u32 head;
248
+ __u32 tail;
249
+ __u32 ring_mask;
250
+ __u32 ring_entries;
251
+ __u32 overflow;
252
+ __u32 cqes;
253
+ __u32 flags;
254
+ __u32 resv1;
255
+ __u64 resv2;
256
+ };
257
+
258
+ /*
259
+ * cq_ring->flags
260
+ */
261
+
262
+ /* disable eventfd notifications */
263
+ #define IORING_CQ_EVENTFD_DISABLED (1U << 0)
264
+
265
+ /*
266
+ * io_uring_enter(2) flags
267
+ */
268
+ #define IORING_ENTER_GETEVENTS (1U << 0)
269
+ #define IORING_ENTER_SQ_WAKEUP (1U << 1)
270
+ #define IORING_ENTER_SQ_WAIT (1U << 2)
271
+ #define IORING_ENTER_EXT_ARG (1U << 3)
272
+ #define IORING_ENTER_REGISTERED_RING (1U << 4)
273
+
274
+ /*
275
+ * Passed in for io_uring_setup(2). Copied back with updated info on success
276
+ */
277
+ struct io_uring_params {
278
+ __u32 sq_entries;
279
+ __u32 cq_entries;
280
+ __u32 flags;
281
+ __u32 sq_thread_cpu;
282
+ __u32 sq_thread_idle;
283
+ __u32 features;
284
+ __u32 wq_fd;
285
+ __u32 resv[3];
286
+ struct io_sqring_offsets sq_off;
287
+ struct io_cqring_offsets cq_off;
288
+ };
289
+
290
+ /*
291
+ * io_uring_params->features flags
292
+ */
293
+ #define IORING_FEAT_SINGLE_MMAP (1U << 0)
294
+ #define IORING_FEAT_NODROP (1U << 1)
295
+ #define IORING_FEAT_SUBMIT_STABLE (1U << 2)
296
+ #define IORING_FEAT_RW_CUR_POS (1U << 3)
297
+ #define IORING_FEAT_CUR_PERSONALITY (1U << 4)
298
+ #define IORING_FEAT_FAST_POLL (1U << 5)
299
+ #define IORING_FEAT_POLL_32BITS (1U << 6)
300
+ #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
301
+ #define IORING_FEAT_EXT_ARG (1U << 8)
302
+ #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
303
+ #define IORING_FEAT_RSRC_TAGS (1U << 10)
304
+ #define IORING_FEAT_CQE_SKIP (1U << 11)
305
+
306
+ /*
307
+ * io_uring_register(2) opcodes and arguments
308
+ */
309
+ enum {
310
+ IORING_REGISTER_BUFFERS = 0,
311
+ IORING_UNREGISTER_BUFFERS = 1,
312
+ IORING_REGISTER_FILES = 2,
313
+ IORING_UNREGISTER_FILES = 3,
314
+ IORING_REGISTER_EVENTFD = 4,
315
+ IORING_UNREGISTER_EVENTFD = 5,
316
+ IORING_REGISTER_FILES_UPDATE = 6,
317
+ IORING_REGISTER_EVENTFD_ASYNC = 7,
318
+ IORING_REGISTER_PROBE = 8,
319
+ IORING_REGISTER_PERSONALITY = 9,
320
+ IORING_UNREGISTER_PERSONALITY = 10,
321
+ IORING_REGISTER_RESTRICTIONS = 11,
322
+ IORING_REGISTER_ENABLE_RINGS = 12,
323
+
324
+ /* extended with tagging */
325
+ IORING_REGISTER_FILES2 = 13,
326
+ IORING_REGISTER_FILES_UPDATE2 = 14,
327
+ IORING_REGISTER_BUFFERS2 = 15,
328
+ IORING_REGISTER_BUFFERS_UPDATE = 16,
329
+
330
+ /* set/clear io-wq thread affinities */
331
+ IORING_REGISTER_IOWQ_AFF = 17,
332
+ IORING_UNREGISTER_IOWQ_AFF = 18,
333
+
334
+ /* set/get max number of io-wq workers */
335
+ IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
336
+
337
+ /* register/unregister io_uring fd with the ring */
338
+ IORING_REGISTER_RING_FDS = 20,
339
+ IORING_UNREGISTER_RING_FDS = 21,
340
+
341
+ /* this goes last */
342
+ IORING_REGISTER_LAST
343
+ };
344
+
345
+ /* io-wq worker categories */
346
+ enum {
347
+ IO_WQ_BOUND,
348
+ IO_WQ_UNBOUND,
349
+ };
350
+
351
+ /* deprecated, see struct io_uring_rsrc_update */
352
+ struct io_uring_files_update {
353
+ __u32 offset;
354
+ __u32 resv;
355
+ __aligned_u64 /* __s32 * */ fds;
356
+ };
357
+
358
+ struct io_uring_rsrc_register {
359
+ __u32 nr;
360
+ __u32 resv;
361
+ __u64 resv2;
362
+ __aligned_u64 data;
363
+ __aligned_u64 tags;
364
+ };
365
+
366
+ struct io_uring_rsrc_update {
367
+ __u32 offset;
368
+ __u32 resv;
369
+ __aligned_u64 data;
370
+ };
371
+
372
+ struct io_uring_rsrc_update2 {
373
+ __u32 offset;
374
+ __u32 resv;
375
+ __aligned_u64 data;
376
+ __aligned_u64 tags;
377
+ __u32 nr;
378
+ __u32 resv2;
379
+ };
380
+
381
+ /* Skip updating fd indexes set to this value in the fd table */
382
+ #define IORING_REGISTER_FILES_SKIP (-2)
383
+
384
+ #define IO_URING_OP_SUPPORTED (1U << 0)
385
+
386
+ struct io_uring_probe_op {
387
+ __u8 op;
388
+ __u8 resv;
389
+ __u16 flags; /* IO_URING_OP_* flags */
390
+ __u32 resv2;
391
+ };
392
+
393
+ struct io_uring_probe {
394
+ __u8 last_op; /* last opcode supported */
395
+ __u8 ops_len; /* length of ops[] array below */
396
+ __u16 resv;
397
+ __u32 resv2[3];
398
+ struct io_uring_probe_op ops[];
399
+ };
400
+
401
+ struct io_uring_restriction {
402
+ __u16 opcode;
403
+ union {
404
+ __u8 register_op; /* IORING_RESTRICTION_REGISTER_OP */
405
+ __u8 sqe_op; /* IORING_RESTRICTION_SQE_OP */
406
+ __u8 sqe_flags; /* IORING_RESTRICTION_SQE_FLAGS_* */
407
+ };
408
+ __u8 resv;
409
+ __u32 resv2[3];
410
+ };
411
+
412
+ /*
413
+ * io_uring_restriction->opcode values
414
+ */
415
+ enum {
416
+ /* Allow an io_uring_register(2) opcode */
417
+ IORING_RESTRICTION_REGISTER_OP = 0,
418
+
419
+ /* Allow an sqe opcode */
420
+ IORING_RESTRICTION_SQE_OP = 1,
421
+
422
+ /* Allow sqe flags */
423
+ IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2,
424
+
425
+ /* Require sqe flags (these flags must be set on each submission) */
426
+ IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3,
427
+
428
+ IORING_RESTRICTION_LAST
429
+ };
430
+
431
+ struct io_uring_getevents_arg {
432
+ __u64 sigmask;
433
+ __u32 sigmask_sz;
434
+ __u32 pad;
435
+ __u64 ts;
436
+ };
437
+
438
+ #ifdef __cplusplus
439
+ }
440
+ #endif
441
+
442
+ #endif