uringmachine 0.3 → 0.5
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/.github/workflows/test.yml +2 -1
- data/CHANGELOG.md +23 -0
- data/README.md +128 -0
- data/TODO.md +14 -0
- data/examples/bm_snooze.rb +89 -0
- data/examples/bm_write.rb +56 -0
- data/examples/dns_client.rb +12 -0
- data/examples/echo_server.rb +18 -40
- data/examples/http_server.rb +42 -43
- data/examples/inout.rb +19 -0
- data/examples/nc.rb +36 -0
- data/examples/server_client.rb +64 -0
- data/examples/snooze.rb +44 -0
- data/examples/write_dev_null.rb +16 -0
- data/ext/um/extconf.rb +24 -23
- data/ext/um/um.c +524 -278
- data/ext/um/um.h +146 -44
- data/ext/um/um_buffer.c +49 -0
- data/ext/um/um_class.c +217 -106
- data/ext/um/um_const.c +213 -0
- data/ext/um/um_ext.c +4 -0
- data/ext/um/um_mutex_class.c +47 -0
- data/ext/um/um_op.c +86 -114
- data/ext/um/um_queue_class.c +58 -0
- data/ext/um/um_sync.c +273 -0
- data/ext/um/um_utils.c +49 -4
- data/lib/uringmachine/dns_resolver.rb +84 -0
- data/lib/uringmachine/version.rb +1 -1
- data/lib/uringmachine.rb +28 -0
- data/supressions/ruby.supp +71 -0
- data/test/helper.rb +8 -0
- data/test/test_um.rb +685 -46
- data/vendor/liburing/.github/workflows/build.yml +29 -1
- data/vendor/liburing/.gitignore +6 -0
- data/vendor/liburing/CHANGELOG +16 -0
- data/vendor/liburing/CONTRIBUTING.md +165 -0
- data/vendor/liburing/configure +64 -0
- data/vendor/liburing/examples/Makefile +9 -1
- data/vendor/liburing/examples/kdigest.c +405 -0
- data/vendor/liburing/examples/proxy.c +75 -8
- data/vendor/liburing/examples/reg-wait.c +159 -0
- data/vendor/liburing/liburing.pc.in +1 -1
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/src/Makefile +16 -2
- data/vendor/liburing/src/include/liburing/io_uring.h +77 -0
- data/vendor/liburing/src/include/liburing/sanitize.h +39 -0
- data/vendor/liburing/src/include/liburing.h +59 -6
- data/vendor/liburing/src/int_flags.h +10 -3
- data/vendor/liburing/src/liburing-ffi.map +16 -0
- data/vendor/liburing/src/liburing.map +10 -0
- data/vendor/liburing/src/queue.c +28 -16
- data/vendor/liburing/src/register.c +106 -1
- data/vendor/liburing/src/sanitize.c +176 -0
- data/vendor/liburing/src/setup.c +47 -19
- data/vendor/liburing/src/setup.h +6 -0
- data/vendor/liburing/test/35fa71a030ca.c +7 -0
- data/vendor/liburing/test/500f9fbadef8.c +2 -0
- data/vendor/liburing/test/7ad0e4b2f83c.c +0 -25
- data/vendor/liburing/test/917257daa0fe.c +7 -0
- data/vendor/liburing/test/Makefile +38 -4
- data/vendor/liburing/test/a0908ae19763.c +7 -0
- data/vendor/liburing/test/a4c0b3decb33.c +7 -0
- data/vendor/liburing/test/accept.c +14 -4
- data/vendor/liburing/test/b19062a56726.c +7 -0
- data/vendor/liburing/test/bind-listen.c +2 -2
- data/vendor/liburing/test/buf-ring-nommap.c +10 -3
- data/vendor/liburing/test/buf-ring.c +2 -0
- data/vendor/liburing/test/cmd-discard.c +427 -0
- data/vendor/liburing/test/coredump.c +7 -0
- data/vendor/liburing/test/cq-overflow.c +13 -1
- data/vendor/liburing/test/d4ae271dfaae.c +11 -3
- data/vendor/liburing/test/defer-taskrun.c +2 -2
- data/vendor/liburing/test/defer-tw-timeout.c +4 -1
- data/vendor/liburing/test/defer.c +2 -2
- data/vendor/liburing/test/double-poll-crash.c +1 -1
- data/vendor/liburing/test/eeed8b54e0df.c +2 -0
- data/vendor/liburing/test/eventfd.c +0 -1
- data/vendor/liburing/test/exit-no-cleanup.c +11 -0
- data/vendor/liburing/test/fadvise.c +9 -26
- data/vendor/liburing/test/fdinfo.c +9 -1
- data/vendor/liburing/test/fifo-nonblock-read.c +69 -0
- data/vendor/liburing/test/file-exit-unreg.c +48 -0
- data/vendor/liburing/test/file-register.c +14 -2
- data/vendor/liburing/test/file-update.c +1 -1
- data/vendor/liburing/test/file-verify.c +27 -16
- data/vendor/liburing/test/files-exit-hang-timeout.c +1 -2
- data/vendor/liburing/test/fixed-buf-iter.c +3 -1
- data/vendor/liburing/test/fixed-hugepage.c +12 -1
- data/vendor/liburing/test/fsnotify.c +1 -0
- data/vendor/liburing/test/futex.c +16 -4
- data/vendor/liburing/test/helpers.c +47 -0
- data/vendor/liburing/test/helpers.h +6 -0
- data/vendor/liburing/test/init-mem.c +5 -3
- data/vendor/liburing/test/io-cancel.c +0 -24
- data/vendor/liburing/test/io_uring_passthrough.c +4 -0
- data/vendor/liburing/test/io_uring_register.c +38 -8
- data/vendor/liburing/test/iopoll-leak.c +4 -0
- data/vendor/liburing/test/iopoll-overflow.c +1 -1
- data/vendor/liburing/test/iopoll.c +3 -3
- data/vendor/liburing/test/kallsyms.c +203 -0
- data/vendor/liburing/test/link-timeout.c +159 -0
- data/vendor/liburing/test/linked-defer-close.c +224 -0
- data/vendor/liburing/test/madvise.c +12 -25
- data/vendor/liburing/test/min-timeout-wait.c +0 -25
- data/vendor/liburing/test/min-timeout.c +0 -25
- data/vendor/liburing/test/mkdir.c +6 -0
- data/vendor/liburing/test/msg-ring.c +8 -2
- data/vendor/liburing/test/napi-test.c +16 -3
- data/vendor/liburing/test/no-mmap-inval.c +3 -1
- data/vendor/liburing/test/nop.c +44 -0
- data/vendor/liburing/test/ooo-file-unreg.c +1 -1
- data/vendor/liburing/test/open-close.c +40 -0
- data/vendor/liburing/test/openat2.c +37 -14
- data/vendor/liburing/test/poll-many.c +13 -7
- data/vendor/liburing/test/poll-mshot-update.c +17 -10
- data/vendor/liburing/test/poll-v-poll.c +6 -3
- data/vendor/liburing/test/pollfree.c +148 -0
- data/vendor/liburing/test/read-mshot-empty.c +158 -153
- data/vendor/liburing/test/read-mshot-stdin.c +121 -0
- data/vendor/liburing/test/read-mshot.c +282 -27
- data/vendor/liburing/test/read-write.c +78 -13
- data/vendor/liburing/test/recv-msgall-stream.c +3 -0
- data/vendor/liburing/test/recv-msgall.c +5 -0
- data/vendor/liburing/test/recvsend_bundle-inc.c +680 -0
- data/vendor/liburing/test/recvsend_bundle.c +94 -31
- data/vendor/liburing/test/reg-fd-only.c +15 -5
- data/vendor/liburing/test/reg-wait.c +251 -0
- data/vendor/liburing/test/regbuf-clone.c +645 -0
- data/vendor/liburing/test/regbuf-merge.c +7 -0
- data/vendor/liburing/test/register-restrictions.c +86 -85
- data/vendor/liburing/test/rename.c +59 -1
- data/vendor/liburing/test/resize-rings.c +643 -0
- data/vendor/liburing/test/ringbuf-read.c +5 -0
- data/vendor/liburing/test/ringbuf-status.c +5 -1
- data/vendor/liburing/test/rsrc_tags.c +1 -1
- data/vendor/liburing/test/runtests.sh +16 -1
- data/vendor/liburing/test/send-zerocopy.c +59 -0
- data/vendor/liburing/test/short-read.c +1 -0
- data/vendor/liburing/test/socket.c +43 -0
- data/vendor/liburing/test/splice.c +3 -1
- data/vendor/liburing/test/sq-poll-dup.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +2 -0
- data/vendor/liburing/test/sqpoll-disable-exit.c +8 -0
- data/vendor/liburing/test/sqpoll-exit-hang.c +1 -25
- data/vendor/liburing/test/sqpoll-sleep.c +40 -33
- data/vendor/liburing/test/sqwait.c +136 -0
- data/vendor/liburing/test/statx.c +89 -0
- data/vendor/liburing/test/stdout.c +2 -0
- data/vendor/liburing/test/submit-and-wait.c +1 -25
- data/vendor/liburing/test/submit-reuse.c +4 -26
- data/vendor/liburing/test/symlink.c +12 -1
- data/vendor/liburing/test/sync-cancel.c +56 -22
- data/vendor/liburing/test/thread-exit.c +5 -0
- data/vendor/liburing/test/timeout-new.c +1 -26
- data/vendor/liburing/test/timeout.c +25 -34
- data/vendor/liburing/test/unlink.c +94 -1
- data/vendor/liburing/test/uring_cmd_ublk.c +1252 -0
- data/vendor/liburing/test/waitid.c +62 -8
- data/vendor/liburing/test/wq-aff.c +35 -0
- data/vendor/liburing/test/xfail_prep_link_timeout_out_of_scope.c +46 -0
- data/vendor/liburing/test/xfail_register_buffers_out_of_scope.c +51 -0
- metadata +37 -6
- data/examples/event_loop.rb +0 -69
- data/examples/fibers.rb +0 -105
- data/examples/http_server_multishot.rb +0 -57
- data/examples/http_server_simpler.rb +0 -34
@@ -27,6 +27,10 @@ ifdef CONFIG_HAVE_ARRAY_BOUNDS
|
|
27
27
|
XCFLAGS += -Warray-bounds=0
|
28
28
|
endif
|
29
29
|
|
30
|
+
ifeq ($(CONFIG_USE_SANITIZER),y)
|
31
|
+
XCFLAGS += -fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
32
|
+
endif
|
33
|
+
|
30
34
|
CXXFLAGS ?= $(CFLAGS)
|
31
35
|
override CFLAGS += $(XCFLAGS) -DLIBURING_BUILD_TEST
|
32
36
|
override CXXFLAGS += $(XCFLAGS) -std=c++11 -DLIBURING_BUILD_TEST
|
@@ -61,6 +65,7 @@ test_srcs := \
|
|
61
65
|
connect.c \
|
62
66
|
connect-rep.c \
|
63
67
|
coredump.c \
|
68
|
+
cmd-discard.c \
|
64
69
|
cq-full.c \
|
65
70
|
cq-overflow.c \
|
66
71
|
cq-peek-batch.c \
|
@@ -89,6 +94,8 @@ test_srcs := \
|
|
89
94
|
fd-install.c \
|
90
95
|
fd-pass.c \
|
91
96
|
fdinfo.c \
|
97
|
+
fifo-nonblock-read.c \
|
98
|
+
file-exit-unreg.c \
|
92
99
|
file-register.c \
|
93
100
|
files-exit-hang-poll.c \
|
94
101
|
files-exit-hang-timeout.c \
|
@@ -114,11 +121,13 @@ test_srcs := \
|
|
114
121
|
io_uring_passthrough.c \
|
115
122
|
io_uring_register.c \
|
116
123
|
io_uring_setup.c \
|
124
|
+
kallsyms.c \
|
117
125
|
lfs-openat.c \
|
118
126
|
lfs-openat-write.c \
|
119
127
|
link.c \
|
120
128
|
link_drain.c \
|
121
129
|
link-timeout.c \
|
130
|
+
linked-defer-close.c \
|
122
131
|
madvise.c \
|
123
132
|
min-timeout.c \
|
124
133
|
min-timeout-wait.c \
|
@@ -130,7 +139,6 @@ test_srcs := \
|
|
130
139
|
multicqes_drain.c \
|
131
140
|
napi-test.c \
|
132
141
|
no-mmap-inval.c \
|
133
|
-
nolibc.c \
|
134
142
|
nop-all-sizes.c \
|
135
143
|
nop.c \
|
136
144
|
ooo-file-unreg.c \
|
@@ -154,10 +162,12 @@ test_srcs := \
|
|
154
162
|
poll-race-mshot.c \
|
155
163
|
poll-ring.c \
|
156
164
|
poll-v-poll.c \
|
165
|
+
pollfree.c \
|
157
166
|
probe.c \
|
158
167
|
read-before-exit.c \
|
159
168
|
read-mshot.c \
|
160
169
|
read-mshot-empty.c \
|
170
|
+
read-mshot-stdin.c \
|
161
171
|
read-write.c \
|
162
172
|
recv-msgall.c \
|
163
173
|
recv-msgall-stream.c \
|
@@ -165,9 +175,12 @@ test_srcs := \
|
|
165
175
|
reg-fd-only.c \
|
166
176
|
reg-hint.c \
|
167
177
|
reg-reg-ring.c \
|
178
|
+
reg-wait.c \
|
179
|
+
regbuf-clone.c \
|
168
180
|
regbuf-merge.c \
|
169
181
|
register-restrictions.c \
|
170
182
|
rename.c \
|
183
|
+
resize-rings.c \
|
171
184
|
ringbuf-read.c \
|
172
185
|
ringbuf-status.c \
|
173
186
|
ring-leak2.c \
|
@@ -176,6 +189,7 @@ test_srcs := \
|
|
176
189
|
rw_merge_test.c \
|
177
190
|
self.c \
|
178
191
|
recvsend_bundle.c \
|
192
|
+
recvsend_bundle-inc.c \
|
179
193
|
send_recv.c \
|
180
194
|
send_recvmsg.c \
|
181
195
|
send-zerocopy.c \
|
@@ -202,6 +216,7 @@ test_srcs := \
|
|
202
216
|
sq-poll-share.c \
|
203
217
|
sqpoll-sleep.c \
|
204
218
|
sq-space_left.c \
|
219
|
+
sqwait.c \
|
205
220
|
stdout.c \
|
206
221
|
submit-and-wait.c \
|
207
222
|
submit-link-fail.c \
|
@@ -215,6 +230,7 @@ test_srcs := \
|
|
215
230
|
truncate.c \
|
216
231
|
tty-write-dpoll.c \
|
217
232
|
unlink.c \
|
233
|
+
uring_cmd_ublk.c \
|
218
234
|
version.c \
|
219
235
|
waitid.c \
|
220
236
|
wait-timeout.c \
|
@@ -223,9 +239,19 @@ test_srcs := \
|
|
223
239
|
xattr.c \
|
224
240
|
# EOL
|
225
241
|
|
242
|
+
# Please keep this list sorted alphabetically.
|
243
|
+
asan_test_srcs := \
|
244
|
+
xfail_prep_link_timeout_out_of_scope.c \
|
245
|
+
xfail_register_buffers_out_of_scope.c \
|
246
|
+
# EOL
|
247
|
+
|
226
248
|
all_targets :=
|
227
249
|
include ../Makefile.quiet
|
228
250
|
|
251
|
+
ifeq ($(CONFIG_NOLIBC),y)
|
252
|
+
test_srcs += nolibc.c
|
253
|
+
endif
|
254
|
+
|
229
255
|
ifdef CONFIG_HAVE_STATX
|
230
256
|
test_srcs += statx.c
|
231
257
|
else ifdef CONFIG_HAVE_GLIBC_STATX
|
@@ -246,7 +272,15 @@ test_targets := $(patsubst %,%.t,$(test_targets))
|
|
246
272
|
all_targets += $(test_targets)
|
247
273
|
helpers = helpers.o
|
248
274
|
|
249
|
-
|
275
|
+
ifeq ($(CONFIG_USE_SANITIZER),y)
|
276
|
+
asan_test_targets := $(patsubst %.c,%,$(asan_test_srcs))
|
277
|
+
asan_test_targets := $(patsubst %.cc,%,$(asan_test_targets))
|
278
|
+
asan_run_test_targets := $(patsubst %,%.run_test,$(asan_test_targets))
|
279
|
+
asan_test_targets := $(patsubst %,%.t,$(asan_test_targets))
|
280
|
+
all_targets += $(asan_test_targets)
|
281
|
+
endif
|
282
|
+
|
283
|
+
all: $(test_targets) $(asan_test_targets)
|
250
284
|
|
251
285
|
helpers.o: helpers.c
|
252
286
|
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
@@ -283,10 +317,10 @@ clean:
|
|
283
317
|
@rm -rf output/
|
284
318
|
|
285
319
|
runtests: all
|
286
|
-
@./runtests.sh $(test_targets)
|
320
|
+
@./runtests.sh $(test_targets) $(asan_test_targets)
|
287
321
|
|
288
322
|
runtests-loop: all
|
289
|
-
@./runtests-loop.sh $(test_targets)
|
323
|
+
@./runtests-loop.sh $(test_targets) $(asan_test_targets)
|
290
324
|
|
291
325
|
%.run_test: %.t
|
292
326
|
@./runtests-quiet.sh $<
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#include "helpers.h"
|
15
15
|
#include "../src/syscall.h"
|
16
16
|
|
17
|
+
#ifndef CONFIG_USE_SANITIZER
|
17
18
|
static uint64_t r[1] = {0xffffffffffffffff};
|
18
19
|
|
19
20
|
int main(int argc, char *argv[])
|
@@ -57,3 +58,9 @@ int main(int argc, char *argv[])
|
|
57
58
|
__sys_io_uring_register(r[0], 2, (const void *) 0x20000280, 1);
|
58
59
|
return T_EXIT_PASS;
|
59
60
|
}
|
61
|
+
#else
|
62
|
+
int main(int argc, char *argv[])
|
63
|
+
{
|
64
|
+
return T_EXIT_SKIP;
|
65
|
+
}
|
66
|
+
#endif
|
@@ -24,6 +24,7 @@
|
|
24
24
|
#include "helpers.h"
|
25
25
|
#include "../src/syscall.h"
|
26
26
|
|
27
|
+
#ifndef CONFIG_USE_SANITIZER
|
27
28
|
static void sleep_ms(uint64_t ms)
|
28
29
|
{
|
29
30
|
usleep(ms * 1000);
|
@@ -179,3 +180,9 @@ int main(int argc, char *argv[])
|
|
179
180
|
loop();
|
180
181
|
return T_EXIT_PASS;
|
181
182
|
}
|
183
|
+
#else
|
184
|
+
int main(int argc, char *argv[])
|
185
|
+
{
|
186
|
+
return T_EXIT_SKIP;
|
187
|
+
}
|
188
|
+
#endif
|
@@ -60,7 +60,7 @@ static void close_sock_fds(int s_fd[], int c_fd[], int nr, bool fixed)
|
|
60
60
|
close_fds(c_fd, nr);
|
61
61
|
}
|
62
62
|
|
63
|
-
static void queue_send(struct io_uring *ring, int fd)
|
63
|
+
static void *queue_send(struct io_uring *ring, int fd)
|
64
64
|
{
|
65
65
|
struct io_uring_sqe *sqe;
|
66
66
|
struct data *d;
|
@@ -72,9 +72,11 @@ static void queue_send(struct io_uring *ring, int fd)
|
|
72
72
|
sqe = io_uring_get_sqe(ring);
|
73
73
|
io_uring_prep_writev(sqe, fd, &d->iov, 1, 0);
|
74
74
|
sqe->user_data = 1;
|
75
|
+
|
76
|
+
return d;
|
75
77
|
}
|
76
78
|
|
77
|
-
static void queue_recv(struct io_uring *ring, int fd, bool fixed)
|
79
|
+
static void *queue_recv(struct io_uring *ring, int fd, bool fixed)
|
78
80
|
{
|
79
81
|
struct io_uring_sqe *sqe;
|
80
82
|
struct data *d;
|
@@ -88,6 +90,8 @@ static void queue_recv(struct io_uring *ring, int fd, bool fixed)
|
|
88
90
|
sqe->user_data = 2;
|
89
91
|
if (fixed)
|
90
92
|
sqe->flags |= IOSQE_FIXED_FILE;
|
93
|
+
|
94
|
+
return d;
|
91
95
|
}
|
92
96
|
|
93
97
|
static void queue_accept_multishot(struct io_uring *ring, int fd,
|
@@ -274,6 +278,8 @@ static int test_loop(struct io_uring *ring,
|
|
274
278
|
int nr_fds = multishot ? MAX_FDS : 1;
|
275
279
|
int multishot_idx = multishot ? INITIAL_USER_DATA : 0;
|
276
280
|
int err_ret = T_EXIT_FAIL;
|
281
|
+
void* send_d = 0;
|
282
|
+
void* recv_d = 0;
|
277
283
|
|
278
284
|
if (args.overflow)
|
279
285
|
cause_overflow(ring);
|
@@ -340,8 +346,8 @@ static int test_loop(struct io_uring *ring,
|
|
340
346
|
goto out;
|
341
347
|
}
|
342
348
|
|
343
|
-
queue_send(ring, c_fd[0]);
|
344
|
-
queue_recv(ring, s_fd[0], fixed);
|
349
|
+
send_d = queue_send(ring, c_fd[0]);
|
350
|
+
recv_d = queue_recv(ring, s_fd[0], fixed);
|
345
351
|
|
346
352
|
ret = io_uring_submit_and_wait(ring, 2);
|
347
353
|
assert(ret != -1);
|
@@ -365,9 +371,13 @@ static int test_loop(struct io_uring *ring,
|
|
365
371
|
}
|
366
372
|
|
367
373
|
out:
|
374
|
+
free(send_d);
|
375
|
+
free(recv_d);
|
368
376
|
close_sock_fds(s_fd, c_fd, nr_fds, fixed);
|
369
377
|
return T_EXIT_PASS;
|
370
378
|
err:
|
379
|
+
free(send_d);
|
380
|
+
free(recv_d);
|
371
381
|
close_sock_fds(s_fd, c_fd, nr_fds, fixed);
|
372
382
|
return err_ret;
|
373
383
|
}
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#include "helpers.h"
|
15
15
|
#include "../src/syscall.h"
|
16
16
|
|
17
|
+
#ifndef CONFIG_USE_SANITIZER
|
17
18
|
int main(int argc, char *argv[])
|
18
19
|
{
|
19
20
|
if (argc > 1)
|
@@ -52,3 +53,9 @@ int main(int argc, char *argv[])
|
|
52
53
|
__sys_io_uring_setup(0xc9f, (struct io_uring_params *) 0x20000200);
|
53
54
|
return T_EXIT_PASS;
|
54
55
|
}
|
56
|
+
#else
|
57
|
+
int main(int argc, char *argv[])
|
58
|
+
{
|
59
|
+
return T_EXIT_SKIP;
|
60
|
+
}
|
61
|
+
#endif
|
@@ -54,7 +54,7 @@ static int connect_client(struct io_uring *ring, unsigned short peer_port)
|
|
54
54
|
|
55
55
|
sqe = io_uring_get_sqe(ring);
|
56
56
|
io_uring_prep_send(sqe, CLI_INDEX, magic, strlen(magic), 0);
|
57
|
-
sqe->flags |= IOSQE_FIXED_FILE
|
57
|
+
sqe->flags |= IOSQE_FIXED_FILE;
|
58
58
|
|
59
59
|
submitted = ret = io_uring_submit(ring);
|
60
60
|
if (ret < 0)
|
@@ -180,7 +180,7 @@ static int test_good_server(unsigned int ring_flags)
|
|
180
180
|
io_uring_cqe_seen(&ring, cqe);
|
181
181
|
|
182
182
|
sqe = io_uring_get_sqe(&ring);
|
183
|
-
io_uring_prep_recv(sqe, CONN_INDEX, buf,
|
183
|
+
io_uring_prep_recv(sqe, CONN_INDEX, buf, sizeof(buf), 0);
|
184
184
|
sqe->flags |= IOSQE_FIXED_FILE;
|
185
185
|
|
186
186
|
io_uring_submit(&ring);
|
@@ -46,8 +46,10 @@ int main(int argc, char *argv[])
|
|
46
46
|
p.flags = IORING_SETUP_NO_MMAP;
|
47
47
|
ret = io_uring_queue_init_mem(1, &ring, &p, ring_mem, 16384);
|
48
48
|
if (ret < 0) {
|
49
|
-
if (ret == -EINVAL || ret == -ENOMEM)
|
49
|
+
if (ret == -EINVAL || ret == -ENOMEM) {
|
50
|
+
free(ring_mem);
|
50
51
|
return T_EXIT_SKIP;
|
52
|
+
}
|
51
53
|
fprintf(stderr, "queue init failed %d\n", ret);
|
52
54
|
return T_EXIT_FAIL;
|
53
55
|
}
|
@@ -62,8 +64,10 @@ int main(int argc, char *argv[])
|
|
62
64
|
|
63
65
|
ret = io_uring_register_buf_ring(&ring, ®, 0);
|
64
66
|
if (ret) {
|
65
|
-
if (ret == -EINVAL)
|
67
|
+
if (ret == -EINVAL) {
|
68
|
+
free(ring_mem);
|
66
69
|
return T_EXIT_SKIP;
|
70
|
+
}
|
67
71
|
fprintf(stderr, "reg buf ring: %d\n", ret);
|
68
72
|
return T_EXIT_FAIL;
|
69
73
|
}
|
@@ -73,8 +77,10 @@ int main(int argc, char *argv[])
|
|
73
77
|
br = mmap(NULL, ring_size, PROT_READ | PROT_WRITE,
|
74
78
|
MAP_SHARED | MAP_POPULATE, ring.ring_fd, off);
|
75
79
|
if (br == MAP_FAILED) {
|
76
|
-
if (errno == ENOMEM)
|
80
|
+
if (errno == ENOMEM) {
|
81
|
+
free(ring_mem);
|
77
82
|
return T_EXIT_SKIP;
|
83
|
+
}
|
78
84
|
perror("mmap");
|
79
85
|
return T_EXIT_FAIL;
|
80
86
|
}
|
@@ -119,5 +125,6 @@ int main(int argc, char *argv[])
|
|
119
125
|
io_uring_cqe_seen(&ring, cqe);
|
120
126
|
|
121
127
|
io_uring_queue_exit(&ring);
|
128
|
+
free(ring_mem);
|
122
129
|
return T_EXIT_PASS;
|
123
130
|
}
|
@@ -57,6 +57,7 @@ static int test_mixed_reg2(int bgid)
|
|
57
57
|
|
58
58
|
io_uring_free_buf_ring(&ring, br, 32, bgid);
|
59
59
|
io_uring_queue_exit(&ring);
|
60
|
+
free(bufs);
|
60
61
|
return 0;
|
61
62
|
}
|
62
63
|
|
@@ -99,6 +100,7 @@ static int test_mixed_reg(int bgid)
|
|
99
100
|
}
|
100
101
|
|
101
102
|
io_uring_queue_exit(&ring);
|
103
|
+
free(bufs);
|
102
104
|
return 0;
|
103
105
|
}
|
104
106
|
|