uringmachine 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/TODO.md +0 -1
- data/examples/bm_fileno.rb +33 -0
- data/examples/bm_mutex.rb +85 -0
- data/examples/bm_mutex_single.rb +33 -0
- data/examples/bm_queue.rb +27 -28
- data/examples/bm_send.rb +2 -5
- data/examples/bm_snooze.rb +20 -42
- data/examples/fiber_scheduler_demo.rb +15 -51
- data/examples/fiber_scheduler_fork.rb +24 -0
- data/examples/nc_ssl.rb +71 -0
- data/ext/um/extconf.rb +5 -15
- data/ext/um/um.c +57 -41
- data/ext/um/um.h +21 -11
- data/ext/um/um_async_op_class.c +2 -2
- data/ext/um/um_buffer.c +1 -1
- data/ext/um/um_class.c +94 -23
- data/ext/um/um_const.c +51 -3
- data/ext/um/um_mutex_class.c +1 -1
- data/ext/um/um_queue_class.c +1 -1
- data/ext/um/um_stream.c +5 -5
- data/ext/um/um_stream_class.c +3 -0
- data/ext/um/um_sync.c +22 -27
- data/ext/um/um_utils.c +59 -19
- data/grant-2025/journal.md +229 -0
- data/grant-2025/tasks.md +66 -0
- data/lib/uringmachine/fiber_scheduler.rb +180 -48
- data/lib/uringmachine/version.rb +1 -1
- data/lib/uringmachine.rb +6 -0
- data/test/test_fiber_scheduler.rb +138 -0
- data/test/test_stream.rb +2 -2
- data/test/test_um.rb +427 -34
- data/vendor/liburing/.github/workflows/ci.yml +94 -1
- data/vendor/liburing/.github/workflows/test_build.c +9 -0
- data/vendor/liburing/configure +27 -0
- data/vendor/liburing/examples/Makefile +6 -0
- data/vendor/liburing/examples/helpers.c +8 -0
- data/vendor/liburing/examples/helpers.h +5 -0
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/src/Makefile +9 -3
- data/vendor/liburing/src/include/liburing/barrier.h +11 -5
- data/vendor/liburing/src/include/liburing/io_uring/query.h +41 -0
- data/vendor/liburing/src/include/liburing/io_uring.h +50 -0
- data/vendor/liburing/src/include/liburing/sanitize.h +16 -4
- data/vendor/liburing/src/include/liburing.h +445 -121
- data/vendor/liburing/src/liburing-ffi.map +15 -0
- data/vendor/liburing/src/liburing.map +8 -0
- data/vendor/liburing/src/sanitize.c +4 -1
- data/vendor/liburing/src/setup.c +7 -4
- data/vendor/liburing/test/232c93d07b74.c +4 -16
- data/vendor/liburing/test/Makefile +15 -1
- data/vendor/liburing/test/accept.c +2 -13
- data/vendor/liburing/test/conn-unreach.c +132 -0
- data/vendor/liburing/test/fd-pass.c +32 -7
- data/vendor/liburing/test/fdinfo.c +39 -12
- data/vendor/liburing/test/fifo-futex-poll.c +114 -0
- data/vendor/liburing/test/fifo-nonblock-read.c +1 -12
- data/vendor/liburing/test/futex.c +1 -1
- data/vendor/liburing/test/helpers.c +99 -2
- data/vendor/liburing/test/helpers.h +9 -0
- data/vendor/liburing/test/io_uring_passthrough.c +6 -12
- data/vendor/liburing/test/mock_file.c +379 -0
- data/vendor/liburing/test/mock_file.h +47 -0
- data/vendor/liburing/test/nop.c +2 -2
- data/vendor/liburing/test/nop32-overflow.c +150 -0
- data/vendor/liburing/test/nop32.c +126 -0
- data/vendor/liburing/test/pipe.c +166 -0
- data/vendor/liburing/test/poll-race-mshot.c +13 -1
- data/vendor/liburing/test/recv-mshot-fair.c +81 -34
- data/vendor/liburing/test/recvsend_bundle.c +1 -1
- data/vendor/liburing/test/resize-rings.c +2 -0
- data/vendor/liburing/test/ring-query.c +322 -0
- data/vendor/liburing/test/ringbuf-loop.c +87 -0
- data/vendor/liburing/test/runtests.sh +2 -2
- data/vendor/liburing/test/send-zerocopy.c +43 -5
- data/vendor/liburing/test/send_recv.c +102 -32
- data/vendor/liburing/test/shutdown.c +2 -12
- data/vendor/liburing/test/socket-nb.c +3 -14
- data/vendor/liburing/test/socket-rw-eagain.c +2 -12
- data/vendor/liburing/test/socket-rw-offset.c +2 -12
- data/vendor/liburing/test/socket-rw.c +2 -12
- data/vendor/liburing/test/sqe-mixed-bad-wrap.c +87 -0
- data/vendor/liburing/test/sqe-mixed-nop.c +82 -0
- data/vendor/liburing/test/sqe-mixed-uring_cmd.c +153 -0
- data/vendor/liburing/test/timestamp.c +56 -19
- data/vendor/liburing/test/vec-regbuf.c +2 -4
- data/vendor/liburing/test/wq-aff.c +7 -0
- metadata +24 -2
|
@@ -46,6 +46,7 @@ jobs:
|
|
|
46
46
|
cc: x86_64-linux-gnu-gcc
|
|
47
47
|
cxx: x86_64-linux-gnu-g++
|
|
48
48
|
sanitize: 0
|
|
49
|
+
tsan: 0
|
|
49
50
|
|
|
50
51
|
# x86-64 gcc asan
|
|
51
52
|
- arch: x86_64
|
|
@@ -54,6 +55,7 @@ jobs:
|
|
|
54
55
|
cc: x86_64-linux-gnu-gcc
|
|
55
56
|
cxx: x86_64-linux-gnu-g++
|
|
56
57
|
sanitize: 1
|
|
58
|
+
tsan: 0
|
|
57
59
|
|
|
58
60
|
# x86-64 clang asan
|
|
59
61
|
- arch: x86_64
|
|
@@ -62,6 +64,16 @@ jobs:
|
|
|
62
64
|
cc: clang
|
|
63
65
|
cxx: clang++
|
|
64
66
|
sanitize: 1
|
|
67
|
+
tsan: 0
|
|
68
|
+
|
|
69
|
+
# x86-64 clang tsan
|
|
70
|
+
- arch: x86_64
|
|
71
|
+
cc_pkg: clang
|
|
72
|
+
cxx_pkg: clang
|
|
73
|
+
cc: clang
|
|
74
|
+
cxx: clang++
|
|
75
|
+
sanitize: 0
|
|
76
|
+
tsan: 1
|
|
65
77
|
|
|
66
78
|
# x86-64 clang
|
|
67
79
|
- arch: x86_64
|
|
@@ -72,6 +84,7 @@ jobs:
|
|
|
72
84
|
liburing_extra_flags: -Wshorten-64-to-32
|
|
73
85
|
extra_flags: -Wmissing-prototypes -Wstrict-prototypes -Wunreachable-code-loop-increment -Wunreachable-code -Wmissing-variable-declarations -Wextra-semi-stmt
|
|
74
86
|
sanitize: 0
|
|
87
|
+
tsan: 0
|
|
75
88
|
|
|
76
89
|
# x86 (32-bit) gcc
|
|
77
90
|
- arch: i686
|
|
@@ -80,6 +93,7 @@ jobs:
|
|
|
80
93
|
cc: i686-linux-gnu-gcc
|
|
81
94
|
cxx: i686-linux-gnu-g++
|
|
82
95
|
sanitize: 0
|
|
96
|
+
tsan: 0
|
|
83
97
|
|
|
84
98
|
# aarch64 gcc
|
|
85
99
|
- arch: aarch64
|
|
@@ -88,6 +102,7 @@ jobs:
|
|
|
88
102
|
cc: aarch64-linux-gnu-gcc
|
|
89
103
|
cxx: aarch64-linux-gnu-g++
|
|
90
104
|
sanitize: 0
|
|
105
|
+
tsan: 0
|
|
91
106
|
|
|
92
107
|
# arm (32-bit) gcc
|
|
93
108
|
- arch: arm
|
|
@@ -96,6 +111,7 @@ jobs:
|
|
|
96
111
|
cc: arm-linux-gnueabi-gcc
|
|
97
112
|
cxx: arm-linux-gnueabi-g++
|
|
98
113
|
sanitize: 0
|
|
114
|
+
tsan: 0
|
|
99
115
|
|
|
100
116
|
# riscv64
|
|
101
117
|
- arch: riscv64
|
|
@@ -104,6 +120,7 @@ jobs:
|
|
|
104
120
|
cc: riscv64-linux-gnu-gcc
|
|
105
121
|
cxx: riscv64-linux-gnu-g++
|
|
106
122
|
sanitize: 0
|
|
123
|
+
tsan: 0
|
|
107
124
|
|
|
108
125
|
# powerpc64
|
|
109
126
|
- arch: powerpc64
|
|
@@ -112,6 +129,7 @@ jobs:
|
|
|
112
129
|
cc: powerpc64-linux-gnu-gcc
|
|
113
130
|
cxx: powerpc64-linux-gnu-g++
|
|
114
131
|
sanitize: 0
|
|
132
|
+
tsan: 0
|
|
115
133
|
|
|
116
134
|
# powerpc
|
|
117
135
|
- arch: powerpc
|
|
@@ -120,6 +138,7 @@ jobs:
|
|
|
120
138
|
cc: powerpc-linux-gnu-gcc
|
|
121
139
|
cxx: powerpc-linux-gnu-g++
|
|
122
140
|
sanitize: 0
|
|
141
|
+
tsan: 0
|
|
123
142
|
|
|
124
143
|
# alpha
|
|
125
144
|
- arch: alpha
|
|
@@ -128,6 +147,7 @@ jobs:
|
|
|
128
147
|
cc: alpha-linux-gnu-gcc
|
|
129
148
|
cxx: alpha-linux-gnu-g++
|
|
130
149
|
sanitize: 0
|
|
150
|
+
tsan: 0
|
|
131
151
|
|
|
132
152
|
# mips64
|
|
133
153
|
- arch: mips64
|
|
@@ -136,6 +156,7 @@ jobs:
|
|
|
136
156
|
cc: mips64-linux-gnuabi64-gcc
|
|
137
157
|
cxx: mips64-linux-gnuabi64-g++
|
|
138
158
|
sanitize: 0
|
|
159
|
+
tsan: 0
|
|
139
160
|
|
|
140
161
|
# mips
|
|
141
162
|
- arch: mips
|
|
@@ -144,6 +165,7 @@ jobs:
|
|
|
144
165
|
cc: mips-linux-gnu-gcc
|
|
145
166
|
cxx: mips-linux-gnu-g++
|
|
146
167
|
sanitize: 0
|
|
168
|
+
tsan: 0
|
|
147
169
|
|
|
148
170
|
# hppa
|
|
149
171
|
- arch: hppa
|
|
@@ -152,10 +174,12 @@ jobs:
|
|
|
152
174
|
cc: hppa-linux-gnu-gcc
|
|
153
175
|
cxx: hppa-linux-gnu-g++
|
|
154
176
|
sanitize: 0
|
|
177
|
+
tsan: 0
|
|
155
178
|
|
|
156
179
|
env:
|
|
157
180
|
FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.build_args.extra_flags}}
|
|
158
181
|
SANITIZE: ${{matrix.build_args.sanitize}}
|
|
182
|
+
THREAD_SANITIZE: ${{matrix.build_args.tsan}}
|
|
159
183
|
|
|
160
184
|
# Flags for building sources in src/ dir only.
|
|
161
185
|
LIBURING_CFLAGS: ${{matrix.build_args.liburing_extra_flags}}
|
|
@@ -181,7 +205,7 @@ jobs:
|
|
|
181
205
|
${{matrix.build_args.cxx}} --version;
|
|
182
206
|
|
|
183
207
|
- name: Build
|
|
184
|
-
if: ${{matrix.build_args.sanitize == '0'}}
|
|
208
|
+
if: ${{matrix.build_args.sanitize == '0' && matrix.build_args.tsan == '0'}}
|
|
185
209
|
run: |
|
|
186
210
|
./configure --cc=${{matrix.build_args.cc}} --cxx=${{matrix.build_args.cxx}};
|
|
187
211
|
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
|
|
@@ -192,10 +216,79 @@ jobs:
|
|
|
192
216
|
./configure --cc=${{matrix.build_args.cc}} --cxx=${{matrix.build_args.cxx}} --enable-sanitizer;
|
|
193
217
|
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
|
|
194
218
|
|
|
219
|
+
- name: Build
|
|
220
|
+
if: ${{matrix.build_args.tsan == '1'}}
|
|
221
|
+
run: |
|
|
222
|
+
./configure --cc=${{matrix.build_args.cc}} --cxx=${{matrix.build_args.cxx}} --enable-tsan;
|
|
223
|
+
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
|
|
224
|
+
|
|
195
225
|
- name: Test install command
|
|
196
226
|
run: |
|
|
197
227
|
sudo make install;
|
|
198
228
|
|
|
229
|
+
- name: Test build against the installed liburing
|
|
230
|
+
run: |
|
|
231
|
+
export TEST_FILE=".github/workflows/test_build.c";
|
|
232
|
+
if [ "$SANITIZE" -eq "1" ]; then
|
|
233
|
+
export SANITIZE_FLAGS="-fsanitize=address,undefined";
|
|
234
|
+
elif [ "$THREAD_SANITIZE" -eq "1" ]; then
|
|
235
|
+
export SANITIZE_FLAGS="-fsanitize=thread";
|
|
236
|
+
else
|
|
237
|
+
export SANITIZE_FLAGS="";
|
|
238
|
+
fi;
|
|
239
|
+
${{matrix.build_args.cc}} -x c -o a.out $TEST_FILE -luring $SANITIZE_FLAGS;
|
|
240
|
+
${{matrix.build_args.cxx}} -x c++ -o a.out $TEST_FILE -luring $SANITIZE_FLAGS;
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
alpine-musl-build:
|
|
244
|
+
needs: get_commit_list
|
|
245
|
+
runs-on: ubuntu-24.04
|
|
246
|
+
strategy:
|
|
247
|
+
matrix:
|
|
248
|
+
commit: ${{ fromJson(needs.get_commit_list.outputs.commit_list) }}
|
|
249
|
+
|
|
250
|
+
steps:
|
|
251
|
+
- name: Checkout source
|
|
252
|
+
uses: actions/checkout@v4
|
|
253
|
+
with:
|
|
254
|
+
fetch-depth: 0
|
|
255
|
+
|
|
256
|
+
- name: Checkout commit
|
|
257
|
+
run: |
|
|
258
|
+
git checkout ${{ matrix.commit }};
|
|
259
|
+
|
|
260
|
+
- name: Setup Alpine Environment
|
|
261
|
+
uses: jirutka/setup-alpine@v1
|
|
262
|
+
with:
|
|
263
|
+
branch: v3.15
|
|
264
|
+
|
|
265
|
+
- name: Display Alpine version
|
|
266
|
+
shell: alpine.sh {0}
|
|
267
|
+
run: cat /etc/alpine-release;
|
|
268
|
+
|
|
269
|
+
- name: Install build dependencies
|
|
270
|
+
shell: alpine.sh --root {0}
|
|
271
|
+
run: |
|
|
272
|
+
apk add --no-cache build-base musl-dev linux-headers;
|
|
273
|
+
|
|
274
|
+
- name: Build
|
|
275
|
+
shell: alpine.sh {0}
|
|
276
|
+
run: |
|
|
277
|
+
./configure --cc=gcc --cxx=g++;
|
|
278
|
+
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
|
|
279
|
+
|
|
280
|
+
- name: Test install command
|
|
281
|
+
shell: alpine.sh --root {0}
|
|
282
|
+
run: |
|
|
283
|
+
make install;
|
|
284
|
+
|
|
285
|
+
- name: Test build against the installed liburing
|
|
286
|
+
shell: alpine.sh {0}
|
|
287
|
+
run: |
|
|
288
|
+
export TEST_FILE=".github/workflows/test_build.c";
|
|
289
|
+
gcc -x c -o a.out $TEST_FILE -luring;
|
|
290
|
+
g++ -x c++ -o a.out $TEST_FILE -luring;
|
|
291
|
+
|
|
199
292
|
|
|
200
293
|
codespell:
|
|
201
294
|
needs: get_commit_list
|
data/vendor/liburing/configure
CHANGED
|
@@ -30,6 +30,8 @@ for opt do
|
|
|
30
30
|
;;
|
|
31
31
|
--enable-sanitizer) use_sanitizer=yes
|
|
32
32
|
;;
|
|
33
|
+
--enable-tsan) use_tsan=yes
|
|
34
|
+
;;
|
|
33
35
|
*)
|
|
34
36
|
echo "ERROR: unknown option $opt"
|
|
35
37
|
echo "Try '$0 --help' for more information"
|
|
@@ -379,6 +381,22 @@ if compile_prog "" "" "has_ucontext"; then
|
|
|
379
381
|
fi
|
|
380
382
|
print_config "has_ucontext" "$has_ucontext"
|
|
381
383
|
|
|
384
|
+
##########################################
|
|
385
|
+
# check for memfd_create(2)
|
|
386
|
+
has_memfd_create="no"
|
|
387
|
+
cat > $TMPC << EOF
|
|
388
|
+
#include <sys/mman.h>
|
|
389
|
+
int main(int argc, char **argv)
|
|
390
|
+
{
|
|
391
|
+
int memfd = memfd_create("test", 0);
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
EOF
|
|
395
|
+
if compile_prog "-Werror=implicit-function-declaration" "" "has_memfd_create"; then
|
|
396
|
+
has_memfd_create="yes"
|
|
397
|
+
fi
|
|
398
|
+
print_config "has_memfd_create" "$has_memfd_create"
|
|
399
|
+
|
|
382
400
|
##########################################
|
|
383
401
|
# Check NVME_URING_CMD support
|
|
384
402
|
nvme_uring_cmd="no"
|
|
@@ -539,6 +557,9 @@ fi
|
|
|
539
557
|
if test "$array_bounds" = "yes"; then
|
|
540
558
|
output_sym "CONFIG_HAVE_ARRAY_BOUNDS"
|
|
541
559
|
fi
|
|
560
|
+
if test "$has_memfd_create" = "yes"; then
|
|
561
|
+
output_sym "CONFIG_HAVE_MEMFD_CREATE"
|
|
562
|
+
fi
|
|
542
563
|
if test "$nvme_uring_cmd" = "yes"; then
|
|
543
564
|
output_sym "CONFIG_HAVE_NVME_URING"
|
|
544
565
|
fi
|
|
@@ -557,6 +578,12 @@ if test "$use_sanitizer" = "yes"; then
|
|
|
557
578
|
else
|
|
558
579
|
print_config "use sanitizer" "no"
|
|
559
580
|
fi
|
|
581
|
+
if test "$use_tsan" = "yes"; then
|
|
582
|
+
output_sym "CONFIG_USE_TSAN"
|
|
583
|
+
print_config "use tsan" "yes"
|
|
584
|
+
else
|
|
585
|
+
print_config "use tsan" "no"
|
|
586
|
+
fi
|
|
560
587
|
|
|
561
588
|
echo "CC=$cc" >> $config_host_mak
|
|
562
589
|
print_config "CC" "$cc"
|
|
@@ -19,6 +19,12 @@ ifeq ($(CONFIG_USE_SANITIZER),y)
|
|
|
19
19
|
override LDFLAGS += -fsanitize=address,undefined
|
|
20
20
|
endif
|
|
21
21
|
|
|
22
|
+
ifeq ($(CONFIG_USE_TSAN),y)
|
|
23
|
+
override CFLAGS += -fsanitize=thread -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
24
|
+
override CPPFLAGS += -fsanitize=thread -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
25
|
+
override LDFLAGS += -fsanitize=thread -ltsan
|
|
26
|
+
endif
|
|
27
|
+
|
|
22
28
|
example_srcs := \
|
|
23
29
|
io_uring-close-test.c \
|
|
24
30
|
io_uring-cp.c \
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
|
|
14
14
|
#include "helpers.h"
|
|
15
15
|
|
|
16
|
+
#ifndef CONFIG_HAVE_MEMFD_CREATE
|
|
17
|
+
#include <sys/syscall.h>
|
|
18
|
+
int memfd_create(const char *name, unsigned int flags)
|
|
19
|
+
{
|
|
20
|
+
return (int)syscall(SYS_memfd_create, name, flags);
|
|
21
|
+
}
|
|
22
|
+
#endif
|
|
23
|
+
|
|
16
24
|
int setup_listening_socket(int port, int ipv6)
|
|
17
25
|
{
|
|
18
26
|
struct sockaddr_in srv_addr = { };
|
|
@@ -17,4 +17,9 @@ void *t_aligned_alloc(size_t alignment, size_t size);
|
|
|
17
17
|
|
|
18
18
|
void t_error(int status, int errnum, const char *format, ...);
|
|
19
19
|
|
|
20
|
+
#ifndef CONFIG_HAVE_MEMFD_CREATE
|
|
21
|
+
#include <linux/memfd.h>
|
|
22
|
+
#endif
|
|
23
|
+
int memfd_create(const char *name, unsigned int flags);
|
|
24
|
+
|
|
20
25
|
#endif
|
|
@@ -62,6 +62,12 @@ ifeq ($(CONFIG_USE_SANITIZER),y)
|
|
|
62
62
|
liburing_srcs += sanitize.c
|
|
63
63
|
endif
|
|
64
64
|
|
|
65
|
+
ifeq ($(CONFIG_USE_TSAN),y)
|
|
66
|
+
override CFLAGS += -fsanitize=thread -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
67
|
+
override CPPFLAGS += -fsanitize=thread -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
68
|
+
override LINK_FLAGS += -fsanitize=thread -ltsan
|
|
69
|
+
endif
|
|
70
|
+
|
|
65
71
|
override CPPFLAGS += -MT "$@" -MMD -MP -MF "$@.d"
|
|
66
72
|
liburing_objs := $(patsubst %.c,%.ol,$(liburing_srcs))
|
|
67
73
|
liburing_sobjs := $(patsubst %.c,%.os,$(liburing_srcs))
|
|
@@ -74,9 +80,7 @@ liburing_ffi_sobjs := ffi.os
|
|
|
74
80
|
%.ol: %.c
|
|
75
81
|
$(QUIET_CC)$(CC) $(CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
-include $(liburing_objs:%=%.d)
|
|
79
|
-
-include $(liburing_sobjs:%=%.d)
|
|
83
|
+
-include $(liburing_objs:%=%.d) $(liburing_sobjs:%=%.d) $(liburing_ffi_objs:%=%.d) $(liburing_ffi_sobjs:%=%.d)
|
|
80
84
|
|
|
81
85
|
AR ?= ar
|
|
82
86
|
RANLIB ?= ranlib
|
|
@@ -102,6 +106,7 @@ install: $(all_targets)
|
|
|
102
106
|
install -D -m 644 include/liburing/compat.h $(includedir)/liburing/compat.h
|
|
103
107
|
install -D -m 644 include/liburing/barrier.h $(includedir)/liburing/barrier.h
|
|
104
108
|
install -D -m 644 include/liburing/io_uring_version.h $(includedir)/liburing/io_uring_version.h
|
|
109
|
+
install -D -m 644 include/liburing/io_uring/query.h $(includedir)/liburing/io_uring/query.h
|
|
105
110
|
install -D -m 644 liburing.a $(libdevdir)/liburing.a
|
|
106
111
|
install -D -m 644 liburing-ffi.a $(libdevdir)/liburing-ffi.a
|
|
107
112
|
ifeq ($(ENABLE_SHARED),1)
|
|
@@ -120,6 +125,7 @@ uninstall:
|
|
|
120
125
|
@rm -f $(includedir)/liburing/barrier.h
|
|
121
126
|
@rm -f $(includedir)/liburing/sanitize.h
|
|
122
127
|
@rm -f $(includedir)/liburing/io_uring_version.h
|
|
128
|
+
@rm -f $(includedir)/liburing/io_uring/query.h
|
|
123
129
|
@rm -f $(libdevdir)/liburing.a
|
|
124
130
|
@rm -f $(libdevdir)/liburing-ffi.a
|
|
125
131
|
ifeq ($(ENABLE_SHARED),1)
|
|
@@ -23,15 +23,18 @@ after the acquire operation executes. This is implemented using
|
|
|
23
23
|
|
|
24
24
|
#ifdef __cplusplus
|
|
25
25
|
#include <atomic>
|
|
26
|
+
#define LIBURING_NOEXCEPT noexcept
|
|
26
27
|
|
|
27
28
|
template <typename T>
|
|
28
|
-
|
|
29
|
+
_LOCAL_INLINE void IO_URING_WRITE_ONCE(T &var, T val)
|
|
30
|
+
LIBURING_NOEXCEPT
|
|
29
31
|
{
|
|
30
32
|
std::atomic_store_explicit(reinterpret_cast<std::atomic<T> *>(&var),
|
|
31
33
|
val, std::memory_order_relaxed);
|
|
32
34
|
}
|
|
33
35
|
template <typename T>
|
|
34
|
-
|
|
36
|
+
_LOCAL_INLINE T IO_URING_READ_ONCE(const T &var)
|
|
37
|
+
LIBURING_NOEXCEPT
|
|
35
38
|
{
|
|
36
39
|
return std::atomic_load_explicit(
|
|
37
40
|
reinterpret_cast<const std::atomic<T> *>(&var),
|
|
@@ -39,21 +42,24 @@ static inline T IO_URING_READ_ONCE(const T &var)
|
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
template <typename T>
|
|
42
|
-
|
|
45
|
+
_LOCAL_INLINE void io_uring_smp_store_release(T *p, T v)
|
|
46
|
+
LIBURING_NOEXCEPT
|
|
43
47
|
{
|
|
44
48
|
std::atomic_store_explicit(reinterpret_cast<std::atomic<T> *>(p), v,
|
|
45
49
|
std::memory_order_release);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
template <typename T>
|
|
49
|
-
|
|
53
|
+
_LOCAL_INLINE T io_uring_smp_load_acquire(const T *p)
|
|
54
|
+
LIBURING_NOEXCEPT
|
|
50
55
|
{
|
|
51
56
|
return std::atomic_load_explicit(
|
|
52
57
|
reinterpret_cast<const std::atomic<T> *>(p),
|
|
53
58
|
std::memory_order_acquire);
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
_LOCAL_INLINE void io_uring_smp_mb()
|
|
62
|
+
LIBURING_NOEXCEPT
|
|
57
63
|
{
|
|
58
64
|
std::atomic_thread_fence(std::memory_order_seq_cst);
|
|
59
65
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
|
|
2
|
+
/*
|
|
3
|
+
* Header file for the io_uring query interface.
|
|
4
|
+
*/
|
|
5
|
+
#ifndef LINUX_IO_URING_QUERY_H
|
|
6
|
+
#define LINUX_IO_URING_QUERY_H
|
|
7
|
+
|
|
8
|
+
#include <linux/types.h>
|
|
9
|
+
|
|
10
|
+
struct io_uring_query_hdr {
|
|
11
|
+
__u64 next_entry;
|
|
12
|
+
__u64 query_data;
|
|
13
|
+
__u32 query_op;
|
|
14
|
+
__u32 size;
|
|
15
|
+
__s32 result;
|
|
16
|
+
__u32 __resv[3];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
enum {
|
|
20
|
+
IO_URING_QUERY_OPCODES = 0,
|
|
21
|
+
|
|
22
|
+
__IO_URING_QUERY_MAX,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/* Doesn't require a ring */
|
|
26
|
+
struct io_uring_query_opcode {
|
|
27
|
+
/* The number of supported IORING_OP_* opcodes */
|
|
28
|
+
__u32 nr_request_opcodes;
|
|
29
|
+
/* The number of supported IORING_[UN]REGISTER_* opcodes */
|
|
30
|
+
__u32 nr_register_opcodes;
|
|
31
|
+
/* Bitmask of all supported IORING_FEAT_* flags */
|
|
32
|
+
__u64 feature_flags;
|
|
33
|
+
/* Bitmask of all supported IORING_SETUP_* flags */
|
|
34
|
+
__u64 ring_setup_flags;
|
|
35
|
+
/* Bitmask of all supported IORING_ENTER_** flags */
|
|
36
|
+
__u64 enter_flags;
|
|
37
|
+
/* Bitmask of all supported IOSQE_* flags */
|
|
38
|
+
__u64 sqe_flags;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
#endif
|
|
@@ -73,6 +73,7 @@ struct io_uring_sqe {
|
|
|
73
73
|
__u32 futex_flags;
|
|
74
74
|
__u32 install_fd_flags;
|
|
75
75
|
__u32 nop_flags;
|
|
76
|
+
__u32 pipe_flags;
|
|
76
77
|
};
|
|
77
78
|
__u64 user_data; /* data to be passed back at completion time */
|
|
78
79
|
/* pack this to avoid bogus arm OABI complaints */
|
|
@@ -99,6 +100,10 @@ struct io_uring_sqe {
|
|
|
99
100
|
__u64 addr3;
|
|
100
101
|
__u64 __pad2[1];
|
|
101
102
|
};
|
|
103
|
+
struct {
|
|
104
|
+
__u64 attr_ptr; /* pointer to attribute information */
|
|
105
|
+
__u64 attr_type_mask; /* bit mask of attributes */
|
|
106
|
+
};
|
|
102
107
|
__u64 optval;
|
|
103
108
|
/*
|
|
104
109
|
* If the ring is initialized with IORING_SETUP_SQE128, then
|
|
@@ -108,6 +113,18 @@ struct io_uring_sqe {
|
|
|
108
113
|
};
|
|
109
114
|
};
|
|
110
115
|
|
|
116
|
+
/* sqe->attr_type_mask flags */
|
|
117
|
+
#define IORING_RW_ATTR_FLAG_PI (1U << 0)
|
|
118
|
+
/* PI attribute information */
|
|
119
|
+
struct io_uring_attr_pi {
|
|
120
|
+
__u16 flags;
|
|
121
|
+
__u16 app_tag;
|
|
122
|
+
__u32 len;
|
|
123
|
+
__u64 addr;
|
|
124
|
+
__u64 seed;
|
|
125
|
+
__u64 rsvd;
|
|
126
|
+
};
|
|
127
|
+
|
|
111
128
|
/*
|
|
112
129
|
* If sqe->file_index is set to this for opcodes that instantiate a new
|
|
113
130
|
* direct descriptor (like openat/openat2/accept), then io_uring will allocate
|
|
@@ -204,6 +221,18 @@ enum io_uring_sqe_flags_bit {
|
|
|
204
221
|
/* Use hybrid poll in iopoll process */
|
|
205
222
|
#define IORING_SETUP_HYBRID_IOPOLL (1U << 17)
|
|
206
223
|
|
|
224
|
+
/*
|
|
225
|
+
* Allow both 16b and 32b CQEs. If a 32b CQE is posted, it will have
|
|
226
|
+
* IORING_CQE_F_32 set in cqe->flags.
|
|
227
|
+
*/
|
|
228
|
+
#define IORING_SETUP_CQE_MIXED (1U << 18)
|
|
229
|
+
|
|
230
|
+
/*
|
|
231
|
+
* Allow both 64b and 128b SQEs. If a 128b SQE is posted, it will use a 128b
|
|
232
|
+
* opcode.
|
|
233
|
+
*/
|
|
234
|
+
#define IORING_SETUP_SQE_MIXED (1U << 19)
|
|
235
|
+
|
|
207
236
|
enum io_uring_op {
|
|
208
237
|
IORING_OP_NOP,
|
|
209
238
|
IORING_OP_READV,
|
|
@@ -267,6 +296,9 @@ enum io_uring_op {
|
|
|
267
296
|
IORING_OP_EPOLL_WAIT,
|
|
268
297
|
IORING_OP_READV_FIXED,
|
|
269
298
|
IORING_OP_WRITEV_FIXED,
|
|
299
|
+
IORING_OP_PIPE,
|
|
300
|
+
IORING_OP_NOP128,
|
|
301
|
+
IORING_OP_URING_CMD128,
|
|
270
302
|
|
|
271
303
|
/* this goes last, obviously */
|
|
272
304
|
IORING_OP_LAST,
|
|
@@ -370,12 +402,16 @@ enum io_uring_op {
|
|
|
370
402
|
* the starting buffer ID in cqe->flags as per
|
|
371
403
|
* usual for provided buffer usage. The buffers
|
|
372
404
|
* will be contiguous from the starting buffer ID.
|
|
405
|
+
*
|
|
406
|
+
* IORING_SEND_VECTORIZED If set, SEND[_ZC] will take a pointer to a io_vec
|
|
407
|
+
* to allow vectorized send operations.
|
|
373
408
|
*/
|
|
374
409
|
#define IORING_RECVSEND_POLL_FIRST (1U << 0)
|
|
375
410
|
#define IORING_RECV_MULTISHOT (1U << 1)
|
|
376
411
|
#define IORING_RECVSEND_FIXED_BUF (1U << 2)
|
|
377
412
|
#define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
|
|
378
413
|
#define IORING_RECVSEND_BUNDLE (1U << 4)
|
|
414
|
+
#define IORING_SEND_VECTORIZED (1U << 5)
|
|
379
415
|
|
|
380
416
|
/*
|
|
381
417
|
* cqe.res for IORING_CQE_F_NOTIF if
|
|
@@ -424,6 +460,7 @@ enum io_uring_msg_ring_flags {
|
|
|
424
460
|
* IORING_NOP_INJECT_RESULT Inject result from sqe->result
|
|
425
461
|
*/
|
|
426
462
|
#define IORING_NOP_INJECT_RESULT (1U << 0)
|
|
463
|
+
#define IORING_NOP_CQE32 (1U << 5)
|
|
427
464
|
|
|
428
465
|
/*
|
|
429
466
|
* IO completion data structure (Completion Queue Entry)
|
|
@@ -457,12 +494,22 @@ struct io_uring_cqe {
|
|
|
457
494
|
* other provided buffer type, all completions with a
|
|
458
495
|
* buffer passed back is automatically returned to the
|
|
459
496
|
* application.
|
|
497
|
+
* IORING_CQE_F_SKIP If set, then the application/liburing must ignore this
|
|
498
|
+
* CQE. It's only purpose is to fill a gap in the ring,
|
|
499
|
+
* if a large CQE is attempted posted when the ring has
|
|
500
|
+
* just a single small CQE worth of space left before
|
|
501
|
+
* wrapping.
|
|
502
|
+
* IORING_CQE_F_32 If set, this is a 32b/big-cqe posting. Use with rings
|
|
503
|
+
* setup in a mixed CQE mode, where both 16b and 32b
|
|
504
|
+
* CQEs may be posted to the CQ ring.
|
|
460
505
|
*/
|
|
461
506
|
#define IORING_CQE_F_BUFFER (1U << 0)
|
|
462
507
|
#define IORING_CQE_F_MORE (1U << 1)
|
|
463
508
|
#define IORING_CQE_F_SOCK_NONEMPTY (1U << 2)
|
|
464
509
|
#define IORING_CQE_F_NOTIF (1U << 3)
|
|
465
510
|
#define IORING_CQE_F_BUF_MORE (1U << 4)
|
|
511
|
+
#define IORING_CQE_F_SKIP (1U << 5)
|
|
512
|
+
#define IORING_CQE_F_32 (1U << 15)
|
|
466
513
|
|
|
467
514
|
#define IORING_CQE_BUFFER_SHIFT 16
|
|
468
515
|
|
|
@@ -635,6 +682,9 @@ enum io_uring_register_op {
|
|
|
635
682
|
|
|
636
683
|
IORING_REGISTER_MEM_REGION = 34,
|
|
637
684
|
|
|
685
|
+
/* query various aspects of io_uring, see linux/io_uring/query.h */
|
|
686
|
+
IORING_REGISTER_QUERY = 35,
|
|
687
|
+
|
|
638
688
|
/* this goes last */
|
|
639
689
|
IORING_REGISTER_LAST,
|
|
640
690
|
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
#ifndef LIBURING_SANITIZE_H
|
|
3
3
|
#define LIBURING_SANITIZE_H
|
|
4
4
|
|
|
5
|
+
#ifdef __cplusplus
|
|
6
|
+
#define LIBURING_NOEXCEPT noexcept
|
|
7
|
+
#else
|
|
8
|
+
#define LIBURING_NOEXCEPT
|
|
9
|
+
#endif
|
|
10
|
+
|
|
5
11
|
#ifdef __cplusplus
|
|
6
12
|
extern "C" {
|
|
7
13
|
#endif
|
|
@@ -10,24 +16,30 @@ struct io_uring;
|
|
|
10
16
|
struct iovec;
|
|
11
17
|
|
|
12
18
|
#if defined(CONFIG_USE_SANITIZER)
|
|
13
|
-
void liburing_sanitize_ring(struct io_uring *ring);
|
|
14
|
-
void liburing_sanitize_address(const void *addr);
|
|
15
|
-
void liburing_sanitize_region(const void *addr, unsigned int len)
|
|
16
|
-
|
|
19
|
+
void liburing_sanitize_ring(struct io_uring *ring) LIBURING_NOEXCEPT;
|
|
20
|
+
void liburing_sanitize_address(const void *addr) LIBURING_NOEXCEPT;
|
|
21
|
+
void liburing_sanitize_region(const void *addr, unsigned int len)
|
|
22
|
+
LIBURING_NOEXCEPT;
|
|
23
|
+
void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr)
|
|
24
|
+
LIBURING_NOEXCEPT;
|
|
17
25
|
#else
|
|
18
26
|
#define __maybe_unused __attribute__((__unused__))
|
|
19
27
|
static inline void liburing_sanitize_ring(struct io_uring __maybe_unused *ring)
|
|
28
|
+
LIBURING_NOEXCEPT
|
|
20
29
|
{
|
|
21
30
|
}
|
|
22
31
|
static inline void liburing_sanitize_address(const void __maybe_unused *addr)
|
|
32
|
+
LIBURING_NOEXCEPT
|
|
23
33
|
{
|
|
24
34
|
}
|
|
25
35
|
static inline void liburing_sanitize_region(const void __maybe_unused *addr,
|
|
26
36
|
unsigned int __maybe_unused len)
|
|
37
|
+
LIBURING_NOEXCEPT
|
|
27
38
|
{
|
|
28
39
|
}
|
|
29
40
|
static inline void liburing_sanitize_iovecs(const struct iovec __maybe_unused *iovecs,
|
|
30
41
|
unsigned __maybe_unused nr)
|
|
42
|
+
LIBURING_NOEXCEPT
|
|
31
43
|
{
|
|
32
44
|
}
|
|
33
45
|
#endif
|