polyphony 0.94 → 0.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.gitignore +3 -3
- data/CHANGELOG.md +14 -0
- data/docs/api-reference/fiber.md +2 -2
- data/docs/api-reference/object.md +3 -3
- data/docs/main-concepts/exception-handling.md +2 -2
- data/ext/polyphony/backend_common.c +3 -3
- data/ext/polyphony/backend_io_uring.c +18 -16
- data/ext/polyphony/event.c +1 -1
- data/ext/polyphony/extconf.rb +5 -3
- data/ext/polyphony/fiber.c +5 -13
- data/ext/polyphony/io_extensions.c +1 -1
- data/ext/polyphony/pipe.c +1 -1
- data/ext/polyphony/polyphony.c +1 -1
- data/ext/polyphony/polyphony_ext.c +1 -1
- data/ext/polyphony/queue.c +1 -1
- data/ext/polyphony/ring_buffer.c +1 -0
- data/ext/polyphony/socket_extensions.c +1 -1
- data/ext/polyphony/thread.c +1 -1
- data/lib/polyphony/extensions/enumerator.rb +16 -0
- data/lib/polyphony/extensions/socket.rb +2 -0
- data/lib/polyphony/extensions.rb +1 -0
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +2 -2
- data/test/test_backend.rb +5 -1
- data/test/test_enumerator.rb +46 -0
- data/test/test_io.rb +241 -216
- data/test/test_socket.rb +1 -1
- data/test/test_thread_pool.rb +3 -3
- data/vendor/liburing/.github/workflows/build.yml +51 -5
- data/vendor/liburing/.github/workflows/shellcheck.yml +1 -1
- data/vendor/liburing/.gitignore +6 -123
- data/vendor/liburing/CHANGELOG +35 -0
- data/vendor/liburing/CITATION.cff +11 -0
- data/vendor/liburing/LICENSE +16 -3
- data/vendor/liburing/Makefile +3 -1
- data/vendor/liburing/Makefile.common +1 -0
- data/vendor/liburing/README +14 -2
- data/vendor/liburing/SECURITY.md +6 -0
- data/vendor/liburing/configure +16 -15
- data/vendor/liburing/examples/Makefile +4 -1
- data/vendor/liburing/examples/io_uring-udp.c +395 -0
- data/vendor/liburing/examples/poll-bench.c +101 -0
- data/vendor/liburing/examples/send-zerocopy.c +339 -0
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/man/io_uring.7 +38 -11
- data/vendor/liburing/man/io_uring_buf_ring_add.3 +53 -0
- data/vendor/liburing/man/io_uring_buf_ring_advance.3 +31 -0
- data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +41 -0
- data/vendor/liburing/man/io_uring_buf_ring_init.3 +30 -0
- data/vendor/liburing/man/io_uring_buf_ring_mask.3 +27 -0
- data/vendor/liburing/man/io_uring_cq_advance.3 +29 -15
- data/vendor/liburing/man/io_uring_cq_has_overflow.3 +25 -0
- data/vendor/liburing/man/io_uring_cq_ready.3 +9 -8
- data/vendor/liburing/man/io_uring_cqe_get_data.3 +32 -13
- data/vendor/liburing/man/io_uring_cqe_get_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_cqe_seen.3 +22 -12
- data/vendor/liburing/man/io_uring_enter.2 +249 -32
- data/vendor/liburing/man/io_uring_enter2.2 +1 -0
- data/vendor/liburing/man/io_uring_free_probe.3 +11 -8
- data/vendor/liburing/man/io_uring_get_events.3 +33 -0
- data/vendor/liburing/man/io_uring_get_probe.3 +9 -8
- data/vendor/liburing/man/io_uring_get_sqe.3 +29 -10
- data/vendor/liburing/man/io_uring_opcode_supported.3 +11 -10
- data/vendor/liburing/man/io_uring_peek_cqe.3 +38 -0
- data/vendor/liburing/man/io_uring_prep_accept.3 +197 -0
- data/vendor/liburing/man/io_uring_prep_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_cancel.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_cancel64.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_close.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_close_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_connect.3 +66 -0
- data/vendor/liburing/man/io_uring_prep_fadvise.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_fallocate.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_files_update.3 +92 -0
- data/vendor/liburing/man/io_uring_prep_fsync.3 +70 -0
- data/vendor/liburing/man/io_uring_prep_link.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_linkat.3 +91 -0
- data/vendor/liburing/man/io_uring_prep_madvise.3 +56 -0
- data/vendor/liburing/man/io_uring_prep_mkdir.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_mkdirat.3 +83 -0
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +39 -25
- data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_nop.3 +28 -0
- data/vendor/liburing/man/io_uring_prep_openat.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_openat_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_add.3 +72 -0
- data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_remove.3 +55 -0
- data/vendor/liburing/man/io_uring_prep_poll_update.3 +89 -0
- data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +131 -0
- data/vendor/liburing/man/io_uring_prep_read.3 +33 -14
- data/vendor/liburing/man/io_uring_prep_read_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_readv.3 +49 -15
- data/vendor/liburing/man/io_uring_prep_readv2.3 +49 -17
- data/vendor/liburing/man/io_uring_prep_recv.3 +105 -0
- data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg.3 +124 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +52 -0
- data/vendor/liburing/man/io_uring_prep_rename.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_renameat.3 +96 -0
- data/vendor/liburing/man/io_uring_prep_send.3 +57 -0
- data/vendor/liburing/man/io_uring_prep_send_zc.3 +64 -0
- data/vendor/liburing/man/io_uring_prep_sendmsg.3 +69 -0
- data/vendor/liburing/man/io_uring_prep_shutdown.3 +53 -0
- data/vendor/liburing/man/io_uring_prep_socket.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_splice.3 +80 -0
- data/vendor/liburing/man/io_uring_prep_statx.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_symlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_symlinkat.3 +85 -0
- data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_tee.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_timeout.3 +95 -0
- data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_timeout_update.3 +98 -0
- data/vendor/liburing/man/io_uring_prep_unlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_unlinkat.3 +82 -0
- data/vendor/liburing/man/io_uring_prep_write.3 +32 -15
- data/vendor/liburing/man/io_uring_prep_write_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_writev.3 +50 -16
- data/vendor/liburing/man/io_uring_prep_writev2.3 +50 -17
- data/vendor/liburing/man/io_uring_queue_exit.3 +3 -4
- data/vendor/liburing/man/io_uring_queue_init.3 +58 -13
- data/vendor/liburing/man/io_uring_queue_init_params.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_name.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_out.3 +78 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_validate.3 +1 -0
- data/vendor/liburing/man/io_uring_register.2 +153 -13
- data/vendor/liburing/man/io_uring_register_buf_ring.3 +140 -0
- data/vendor/liburing/man/io_uring_register_buffers.3 +32 -12
- data/vendor/liburing/man/io_uring_register_eventfd.3 +51 -0
- data/vendor/liburing/man/io_uring_register_eventfd_async.3 +1 -0
- data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +52 -0
- data/vendor/liburing/man/io_uring_register_files.3 +33 -11
- data/vendor/liburing/man/io_uring_register_files_sparse.3 +1 -0
- data/vendor/liburing/man/io_uring_register_iowq_aff.3 +61 -0
- data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +71 -0
- data/vendor/liburing/man/io_uring_register_ring_fd.3 +49 -0
- data/vendor/liburing/man/io_uring_register_sync_cancel.3 +71 -0
- data/vendor/liburing/man/io_uring_setup.2 +119 -13
- data/vendor/liburing/man/io_uring_sq_ready.3 +14 -8
- data/vendor/liburing/man/io_uring_sq_space_left.3 +9 -9
- data/vendor/liburing/man/io_uring_sqe_set_data.3 +29 -11
- data/vendor/liburing/man/io_uring_sqe_set_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_sqe_set_flags.3 +38 -11
- data/vendor/liburing/man/io_uring_sqring_wait.3 +13 -9
- data/vendor/liburing/man/io_uring_submit.3 +29 -12
- data/vendor/liburing/man/io_uring_submit_and_get_events.3 +31 -0
- data/vendor/liburing/man/io_uring_submit_and_wait.3 +16 -12
- data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +30 -23
- data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +30 -0
- data/vendor/liburing/man/io_uring_unregister_buffers.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_eventfd.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_files.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +32 -0
- data/vendor/liburing/man/io_uring_wait_cqe.3 +19 -12
- data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +21 -14
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +27 -13
- data/vendor/liburing/man/io_uring_wait_cqes.3 +24 -14
- data/vendor/liburing/src/Makefile +8 -7
- data/vendor/liburing/src/arch/aarch64/lib.h +48 -0
- data/vendor/liburing/src/arch/aarch64/syscall.h +0 -4
- data/vendor/liburing/src/arch/generic/lib.h +0 -4
- data/vendor/liburing/src/arch/generic/syscall.h +29 -16
- data/vendor/liburing/src/arch/syscall-defs.h +41 -14
- data/vendor/liburing/src/arch/x86/lib.h +0 -21
- data/vendor/liburing/src/arch/x86/syscall.h +146 -10
- data/vendor/liburing/src/include/liburing/io_uring.h +245 -5
- data/vendor/liburing/src/include/liburing.h +468 -35
- data/vendor/liburing/src/int_flags.h +1 -0
- data/vendor/liburing/src/lib.h +20 -16
- data/vendor/liburing/src/liburing.map +16 -0
- data/vendor/liburing/src/nolibc.c +1 -1
- data/vendor/liburing/src/queue.c +87 -55
- data/vendor/liburing/src/register.c +129 -53
- data/vendor/liburing/src/setup.c +65 -28
- data/vendor/liburing/src/syscall.c +14 -32
- data/vendor/liburing/src/syscall.h +12 -64
- data/vendor/liburing/test/{232c93d07b74-test.c → 232c93d07b74.c} +8 -9
- data/vendor/liburing/test/{35fa71a030ca-test.c → 35fa71a030ca.c} +4 -4
- data/vendor/liburing/test/{500f9fbadef8-test.c → 500f9fbadef8.c} +7 -7
- data/vendor/liburing/test/{7ad0e4b2f83c-test.c → 7ad0e4b2f83c.c} +8 -7
- data/vendor/liburing/test/{8a9973408177-test.c → 8a9973408177.c} +4 -3
- data/vendor/liburing/test/{917257daa0fe-test.c → 917257daa0fe.c} +3 -2
- data/vendor/liburing/test/Makefile +60 -62
- data/vendor/liburing/test/{a0908ae19763-test.c → a0908ae19763.c} +3 -2
- data/vendor/liburing/test/{a4c0b3decb33-test.c → a4c0b3decb33.c} +3 -2
- data/vendor/liburing/test/accept-link.c +5 -4
- data/vendor/liburing/test/accept-reuse.c +17 -16
- data/vendor/liburing/test/accept-test.c +14 -10
- data/vendor/liburing/test/accept.c +529 -107
- data/vendor/liburing/test/across-fork.c +7 -6
- data/vendor/liburing/test/{b19062a56726-test.c → b19062a56726.c} +3 -2
- data/vendor/liburing/test/{b5837bd5311d-test.c → b5837bd5311d.c} +10 -9
- data/vendor/liburing/test/buf-ring.c +420 -0
- data/vendor/liburing/test/{ce593a6c480a-test.c → ce593a6c480a.c} +15 -12
- data/vendor/liburing/test/connect.c +8 -7
- data/vendor/liburing/test/cq-full.c +5 -4
- data/vendor/liburing/test/cq-overflow.c +242 -12
- data/vendor/liburing/test/cq-peek-batch.c +5 -4
- data/vendor/liburing/test/cq-ready.c +5 -4
- data/vendor/liburing/test/cq-size.c +5 -4
- data/vendor/liburing/test/{d4ae271dfaae-test.c → d4ae271dfaae.c} +2 -2
- data/vendor/liburing/test/{d77a67ed5f27-test.c → d77a67ed5f27.c} +6 -6
- data/vendor/liburing/test/defer-taskrun.c +336 -0
- data/vendor/liburing/test/defer.c +26 -14
- data/vendor/liburing/test/double-poll-crash.c +15 -5
- data/vendor/liburing/test/drop-submit.c +5 -3
- data/vendor/liburing/test/{eeed8b54e0df-test.c → eeed8b54e0df.c} +7 -6
- data/vendor/liburing/test/empty-eownerdead.c +4 -4
- data/vendor/liburing/test/eventfd-disable.c +48 -20
- data/vendor/liburing/test/eventfd-reg.c +10 -9
- data/vendor/liburing/test/eventfd-ring.c +13 -12
- data/vendor/liburing/test/eventfd.c +13 -12
- data/vendor/liburing/test/exit-no-cleanup.c +1 -1
- data/vendor/liburing/test/fadvise.c +3 -3
- data/vendor/liburing/test/fallocate.c +16 -9
- data/vendor/liburing/test/{fc2a85cb02ef-test.c → fc2a85cb02ef.c} +4 -3
- data/vendor/liburing/test/fd-pass.c +187 -0
- data/vendor/liburing/test/file-register.c +302 -36
- data/vendor/liburing/test/file-update.c +62 -4
- data/vendor/liburing/test/file-verify.c +6 -2
- data/vendor/liburing/test/files-exit-hang-poll.c +11 -25
- data/vendor/liburing/test/files-exit-hang-timeout.c +13 -10
- data/vendor/liburing/test/fixed-buf-iter.c +115 -0
- data/vendor/liburing/test/fixed-link.c +10 -10
- data/vendor/liburing/test/fixed-reuse.c +160 -0
- data/vendor/liburing/test/fpos.c +6 -3
- data/vendor/liburing/test/fsync.c +3 -3
- data/vendor/liburing/test/hardlink.c +10 -6
- data/vendor/liburing/test/helpers.c +137 -4
- data/vendor/liburing/test/helpers.h +27 -0
- data/vendor/liburing/test/io-cancel.c +16 -11
- data/vendor/liburing/test/io_uring_enter.c +46 -81
- data/vendor/liburing/test/io_uring_passthrough.c +451 -0
- data/vendor/liburing/test/io_uring_register.c +59 -229
- data/vendor/liburing/test/io_uring_setup.c +24 -29
- data/vendor/liburing/test/iopoll-leak.c +85 -0
- data/vendor/liburing/test/iopoll.c +16 -9
- data/vendor/liburing/test/lfs-openat-write.c +3 -1
- data/vendor/liburing/test/link-timeout.c +4 -3
- data/vendor/liburing/test/link.c +8 -7
- data/vendor/liburing/test/madvise.c +2 -2
- data/vendor/liburing/test/mkdir.c +9 -5
- data/vendor/liburing/test/msg-ring.c +46 -20
- data/vendor/liburing/test/multicqes_drain.c +51 -12
- data/vendor/liburing/test/nolibc.c +60 -0
- data/vendor/liburing/test/nop.c +78 -16
- data/vendor/liburing/test/nvme.h +168 -0
- data/vendor/liburing/test/open-direct-link.c +188 -0
- data/vendor/liburing/test/open-direct-pick.c +180 -0
- data/vendor/liburing/test/openat2.c +3 -3
- data/vendor/liburing/test/poll-cancel-all.c +472 -0
- data/vendor/liburing/test/poll-link.c +9 -18
- data/vendor/liburing/test/poll-mshot-overflow.c +162 -0
- data/vendor/liburing/test/poll-mshot-update.c +83 -33
- data/vendor/liburing/test/pollfree.c +2 -2
- data/vendor/liburing/test/read-before-exit.c +112 -0
- data/vendor/liburing/test/read-write.c +83 -1
- data/vendor/liburing/test/recv-msgall-stream.c +398 -0
- data/vendor/liburing/test/recv-msgall.c +265 -0
- data/vendor/liburing/test/recv-multishot.c +505 -0
- data/vendor/liburing/test/rename.c +2 -5
- data/vendor/liburing/test/ring-leak.c +97 -0
- data/vendor/liburing/test/ringbuf-read.c +200 -0
- data/vendor/liburing/test/rsrc_tags.c +25 -13
- data/vendor/liburing/test/runtests-quiet.sh +11 -0
- data/vendor/liburing/test/runtests.sh +18 -20
- data/vendor/liburing/test/rw_merge_test.c +3 -2
- data/vendor/liburing/test/send-zerocopy.c +684 -0
- data/vendor/liburing/test/send_recv.c +49 -2
- data/vendor/liburing/test/send_recvmsg.c +165 -55
- data/vendor/liburing/test/shutdown.c +3 -4
- data/vendor/liburing/test/sigfd-deadlock.c +22 -8
- data/vendor/liburing/test/single-issuer.c +171 -0
- data/vendor/liburing/test/socket-rw-eagain.c +2 -12
- data/vendor/liburing/test/socket-rw-offset.c +2 -11
- data/vendor/liburing/test/socket-rw.c +2 -11
- data/vendor/liburing/test/socket.c +409 -0
- data/vendor/liburing/test/sq-poll-dup.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +1 -1
- data/vendor/liburing/test/statx.c +2 -2
- data/vendor/liburing/test/submit-and-wait.c +108 -0
- data/vendor/liburing/test/submit-link-fail.c +5 -3
- data/vendor/liburing/test/submit-reuse.c +0 -2
- data/vendor/liburing/test/sync-cancel.c +235 -0
- data/vendor/liburing/test/test.h +35 -0
- data/vendor/liburing/test/timeout-overflow.c +11 -11
- data/vendor/liburing/test/timeout.c +7 -7
- data/vendor/liburing/test/tty-write-dpoll.c +60 -0
- data/vendor/liburing/test/unlink.c +1 -1
- data/vendor/liburing/test/xattr.c +425 -0
- metadata +143 -22
- data/Gemfile.lock +0 -78
@@ -0,0 +1,108 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: Test that io_uring_submit_and_wait_timeout() returns the
|
4
|
+
* right value (submit count) and that it doesn't end up waiting twice.
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
#include <errno.h>
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <unistd.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <string.h>
|
12
|
+
#include <fcntl.h>
|
13
|
+
#include <sys/time.h>
|
14
|
+
|
15
|
+
#include "liburing.h"
|
16
|
+
#include "test.h"
|
17
|
+
|
18
|
+
static unsigned long long mtime_since(const struct timeval *s,
|
19
|
+
const struct timeval *e)
|
20
|
+
{
|
21
|
+
long long sec, usec;
|
22
|
+
|
23
|
+
sec = e->tv_sec - s->tv_sec;
|
24
|
+
usec = (e->tv_usec - s->tv_usec);
|
25
|
+
if (sec > 0 && usec < 0) {
|
26
|
+
sec--;
|
27
|
+
usec += 1000000;
|
28
|
+
}
|
29
|
+
|
30
|
+
sec *= 1000;
|
31
|
+
usec /= 1000;
|
32
|
+
return sec + usec;
|
33
|
+
}
|
34
|
+
|
35
|
+
static unsigned long long mtime_since_now(struct timeval *tv)
|
36
|
+
{
|
37
|
+
struct timeval end;
|
38
|
+
|
39
|
+
gettimeofday(&end, NULL);
|
40
|
+
return mtime_since(tv, &end);
|
41
|
+
}
|
42
|
+
|
43
|
+
static int test(struct io_uring *ring)
|
44
|
+
{
|
45
|
+
struct io_uring_cqe *cqe;
|
46
|
+
struct io_uring_sqe *sqe;
|
47
|
+
struct __kernel_timespec ts;
|
48
|
+
struct timeval tv;
|
49
|
+
int ret, i;
|
50
|
+
|
51
|
+
for (i = 0; i < 1; i++) {
|
52
|
+
sqe = io_uring_get_sqe(ring);
|
53
|
+
if (!sqe) {
|
54
|
+
fprintf(stderr, "get sqe failed at %d\n", i);
|
55
|
+
goto err;
|
56
|
+
}
|
57
|
+
io_uring_prep_nop(sqe);
|
58
|
+
}
|
59
|
+
|
60
|
+
ts.tv_sec = 1;
|
61
|
+
ts.tv_nsec = 0;
|
62
|
+
gettimeofday(&tv, NULL);
|
63
|
+
ret = io_uring_submit_and_wait_timeout(ring, &cqe, 2, &ts, NULL);
|
64
|
+
if (ret < 0) {
|
65
|
+
fprintf(stderr, "submit_and_wait_timeout: %d\n", ret);
|
66
|
+
goto err;
|
67
|
+
}
|
68
|
+
ret = mtime_since_now(&tv);
|
69
|
+
/* allow some slack, should be around 1s */
|
70
|
+
if (ret > 1200) {
|
71
|
+
fprintf(stderr, "wait took too long: %d\n", ret);
|
72
|
+
goto err;
|
73
|
+
}
|
74
|
+
return 0;
|
75
|
+
err:
|
76
|
+
return 1;
|
77
|
+
}
|
78
|
+
|
79
|
+
static int test_ring(void)
|
80
|
+
{
|
81
|
+
struct io_uring ring;
|
82
|
+
struct io_uring_params p = { };
|
83
|
+
int ret;
|
84
|
+
|
85
|
+
p.flags = 0;
|
86
|
+
ret = io_uring_queue_init_params(8, &ring, &p);
|
87
|
+
if (ret) {
|
88
|
+
fprintf(stderr, "ring setup failed: %d\n", ret);
|
89
|
+
return 1;
|
90
|
+
}
|
91
|
+
|
92
|
+
ret = test(&ring);
|
93
|
+
if (ret) {
|
94
|
+
fprintf(stderr, "test failed\n");
|
95
|
+
goto err;
|
96
|
+
}
|
97
|
+
err:
|
98
|
+
io_uring_queue_exit(&ring);
|
99
|
+
return ret;
|
100
|
+
}
|
101
|
+
|
102
|
+
int main(int argc, char *argv[])
|
103
|
+
{
|
104
|
+
if (argc > 1)
|
105
|
+
return 0;
|
106
|
+
|
107
|
+
return test_ring();
|
108
|
+
}
|
@@ -23,7 +23,7 @@ static int test_underprep_fail(bool hardlink, bool drain, bool link_last,
|
|
23
23
|
struct io_uring ring;
|
24
24
|
struct io_uring_sqe *sqe;
|
25
25
|
struct io_uring_cqe *cqe;
|
26
|
-
char buffer[1];
|
26
|
+
char buffer[1] = { };
|
27
27
|
int i, ret, fds[2];
|
28
28
|
|
29
29
|
if (drain)
|
@@ -56,10 +56,12 @@ static int test_underprep_fail(bool hardlink, bool drain, bool link_last,
|
|
56
56
|
|
57
57
|
for (i = 0; i < link_size; i++) {
|
58
58
|
sqe = io_uring_get_sqe(&ring);
|
59
|
-
if (i == fail_idx)
|
59
|
+
if (i == fail_idx) {
|
60
60
|
io_uring_prep_read(sqe, invalid_fd, buffer, 1, 0);
|
61
|
-
|
61
|
+
sqe->ioprio = (short) -1;
|
62
|
+
} else {
|
62
63
|
io_uring_prep_nop(sqe);
|
64
|
+
}
|
63
65
|
|
64
66
|
if (i != link_size - 1 || !link_last)
|
65
67
|
sqe->flags |= link_flags;
|
@@ -26,13 +26,11 @@ struct thread_data {
|
|
26
26
|
static void *flusher(void *__data)
|
27
27
|
{
|
28
28
|
struct thread_data *data = __data;
|
29
|
-
int i = 0;
|
30
29
|
|
31
30
|
while (!data->do_exit) {
|
32
31
|
posix_fadvise(data->fd1, 0, FILE_SIZE, POSIX_FADV_DONTNEED);
|
33
32
|
posix_fadvise(data->fd2, 0, FILE_SIZE, POSIX_FADV_DONTNEED);
|
34
33
|
usleep(10);
|
35
|
-
i++;
|
36
34
|
}
|
37
35
|
|
38
36
|
return NULL;
|
@@ -0,0 +1,235 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: test io_uring_register_sync_cancel()
|
4
|
+
*
|
5
|
+
*/
|
6
|
+
#include <errno.h>
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <unistd.h>
|
9
|
+
#include <stdlib.h>
|
10
|
+
#include <string.h>
|
11
|
+
#include <fcntl.h>
|
12
|
+
|
13
|
+
#include "liburing.h"
|
14
|
+
#include "helpers.h"
|
15
|
+
|
16
|
+
static int no_sync_cancel;
|
17
|
+
|
18
|
+
static int test_sync_cancel_timeout(struct io_uring *ring, int async)
|
19
|
+
{
|
20
|
+
struct io_uring_sync_cancel_reg reg = { };
|
21
|
+
struct io_uring_sqe *sqe;
|
22
|
+
struct io_uring_cqe *cqe;
|
23
|
+
int ret, fds[2], to_prep;
|
24
|
+
char buf[32];
|
25
|
+
|
26
|
+
if (pipe(fds) < 0) {
|
27
|
+
perror("pipe");
|
28
|
+
return 1;
|
29
|
+
}
|
30
|
+
|
31
|
+
to_prep = 1;
|
32
|
+
sqe = io_uring_get_sqe(ring);
|
33
|
+
io_uring_prep_read(sqe, fds[0], buf, sizeof(buf), 0);
|
34
|
+
sqe->user_data = 0x89;
|
35
|
+
if (async)
|
36
|
+
sqe->flags |= IOSQE_ASYNC;
|
37
|
+
|
38
|
+
ret = io_uring_submit(ring);
|
39
|
+
if (ret != to_prep) {
|
40
|
+
fprintf(stderr, "submit=%d\n", ret);
|
41
|
+
return 1;
|
42
|
+
}
|
43
|
+
|
44
|
+
usleep(10000);
|
45
|
+
|
46
|
+
reg.addr = 0x89;
|
47
|
+
reg.timeout.tv_nsec = 1;
|
48
|
+
ret = io_uring_register_sync_cancel(ring, ®);
|
49
|
+
if (async) {
|
50
|
+
/* we expect -ETIME here, but can race and get 0 */
|
51
|
+
if (ret != -ETIME && ret != 0) {
|
52
|
+
fprintf(stderr, "sync_cancel=%d\n", ret);
|
53
|
+
return 1;
|
54
|
+
}
|
55
|
+
} else {
|
56
|
+
if (ret < 0) {
|
57
|
+
fprintf(stderr, "sync_cancel=%d\n", ret);
|
58
|
+
return 1;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
/*
|
63
|
+
* we could _almost_ use peek_cqe() here, but there is still
|
64
|
+
* a small gap where io-wq is done with the request and on
|
65
|
+
* its way to posting a completion, but hasn't done it just
|
66
|
+
* yet. the request is canceled and won't be doing any IO
|
67
|
+
* to buffers etc, but the cqe may not have quite arrived yet.
|
68
|
+
*/
|
69
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
70
|
+
if (ret) {
|
71
|
+
fprintf(stderr, "peek=%d\n", ret);
|
72
|
+
return 1;
|
73
|
+
}
|
74
|
+
if (cqe->res >= 0) {
|
75
|
+
fprintf(stderr, "cqe->res=%d\n", cqe->res);
|
76
|
+
return 1;
|
77
|
+
}
|
78
|
+
io_uring_cqe_seen(ring, cqe);
|
79
|
+
return 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
static int test_sync_cancel(struct io_uring *ring, int async, int nr_all,
|
83
|
+
int use_fd)
|
84
|
+
{
|
85
|
+
struct io_uring_sync_cancel_reg reg = { };
|
86
|
+
struct io_uring_sqe *sqe;
|
87
|
+
struct io_uring_cqe *cqe;
|
88
|
+
int ret, fds[2], to_prep, i;
|
89
|
+
char buf[32];
|
90
|
+
|
91
|
+
if (pipe(fds) < 0) {
|
92
|
+
perror("pipe");
|
93
|
+
return 1;
|
94
|
+
}
|
95
|
+
|
96
|
+
to_prep = 1;
|
97
|
+
if (nr_all)
|
98
|
+
to_prep = 4;
|
99
|
+
for (i = 0; i < to_prep; i++) {
|
100
|
+
sqe = io_uring_get_sqe(ring);
|
101
|
+
io_uring_prep_read(sqe, fds[0], buf, sizeof(buf), 0);
|
102
|
+
sqe->user_data = 0x89;
|
103
|
+
if (async)
|
104
|
+
sqe->flags |= IOSQE_ASYNC;
|
105
|
+
}
|
106
|
+
|
107
|
+
ret = io_uring_submit(ring);
|
108
|
+
if (ret != to_prep) {
|
109
|
+
fprintf(stderr, "submit=%d\n", ret);
|
110
|
+
return 1;
|
111
|
+
}
|
112
|
+
|
113
|
+
usleep(10000);
|
114
|
+
|
115
|
+
if (!use_fd)
|
116
|
+
reg.addr = 0x89;
|
117
|
+
else
|
118
|
+
reg.fd = fds[0];
|
119
|
+
reg.timeout.tv_sec = 200;
|
120
|
+
if (nr_all)
|
121
|
+
reg.flags |= IORING_ASYNC_CANCEL_ALL;
|
122
|
+
if (use_fd)
|
123
|
+
reg.flags |= IORING_ASYNC_CANCEL_FD;
|
124
|
+
ret = io_uring_register_sync_cancel(ring, ®);
|
125
|
+
if (ret < 0) {
|
126
|
+
if (ret == -EINVAL && !no_sync_cancel) {
|
127
|
+
no_sync_cancel = 1;
|
128
|
+
return 0;
|
129
|
+
}
|
130
|
+
fprintf(stderr, "sync_cancel=%d\n", ret);
|
131
|
+
return 1;
|
132
|
+
}
|
133
|
+
|
134
|
+
for (i = 0; i < to_prep; i++) {
|
135
|
+
/*
|
136
|
+
* we could _almost_ use peek_cqe() here, but there is still
|
137
|
+
* a small gap where io-wq is done with the request and on
|
138
|
+
* its way to posting a completion, but hasn't done it just
|
139
|
+
* yet. the request is canceled and won't be doing any IO
|
140
|
+
* to buffers etc, but the cqe may not have quite arrived yet.
|
141
|
+
*/
|
142
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
143
|
+
if (ret) {
|
144
|
+
fprintf(stderr, "peek=%d\n", ret);
|
145
|
+
return 1;
|
146
|
+
}
|
147
|
+
if (cqe->res >= 0) {
|
148
|
+
fprintf(stderr, "cqe->res=%d\n", cqe->res);
|
149
|
+
return 1;
|
150
|
+
}
|
151
|
+
io_uring_cqe_seen(ring, cqe);
|
152
|
+
}
|
153
|
+
|
154
|
+
return 0;
|
155
|
+
}
|
156
|
+
|
157
|
+
int main(int argc, char *argv[])
|
158
|
+
{
|
159
|
+
struct io_uring ring;
|
160
|
+
int ret;
|
161
|
+
|
162
|
+
if (argc > 1)
|
163
|
+
return T_EXIT_SKIP;
|
164
|
+
|
165
|
+
ret = t_create_ring(7, &ring, 0);
|
166
|
+
if (ret == T_SETUP_SKIP)
|
167
|
+
return T_EXIT_SKIP;
|
168
|
+
else if (ret != T_SETUP_OK)
|
169
|
+
return ret;
|
170
|
+
|
171
|
+
ret = test_sync_cancel(&ring, 0, 0, 0);
|
172
|
+
if (ret) {
|
173
|
+
fprintf(stderr, "test_sync_cancel 0 0 0 failed\n");
|
174
|
+
return T_EXIT_FAIL;
|
175
|
+
}
|
176
|
+
if (no_sync_cancel)
|
177
|
+
return T_EXIT_SKIP;
|
178
|
+
|
179
|
+
ret = test_sync_cancel(&ring, 1, 0, 0);
|
180
|
+
if (ret) {
|
181
|
+
fprintf(stderr, "test_sync_cancel 1 0 0 failed\n");
|
182
|
+
return T_EXIT_FAIL;
|
183
|
+
}
|
184
|
+
|
185
|
+
ret = test_sync_cancel(&ring, 0, 1, 0);
|
186
|
+
if (ret) {
|
187
|
+
fprintf(stderr, "test_sync_cancel 0 1 0 failed\n");
|
188
|
+
return T_EXIT_FAIL;
|
189
|
+
}
|
190
|
+
|
191
|
+
ret = test_sync_cancel(&ring, 1, 1, 0);
|
192
|
+
if (ret) {
|
193
|
+
fprintf(stderr, "test_sync_cancel 1 1 0 failed\n");
|
194
|
+
return T_EXIT_FAIL;
|
195
|
+
}
|
196
|
+
|
197
|
+
ret = test_sync_cancel(&ring, 0, 0, 1);
|
198
|
+
if (ret) {
|
199
|
+
fprintf(stderr, "test_sync_cancel 0 0 1 failed\n");
|
200
|
+
return T_EXIT_FAIL;
|
201
|
+
}
|
202
|
+
|
203
|
+
ret = test_sync_cancel(&ring, 1, 0, 1);
|
204
|
+
if (ret) {
|
205
|
+
fprintf(stderr, "test_sync_cancel 1 0 1 failed\n");
|
206
|
+
return T_EXIT_FAIL;
|
207
|
+
}
|
208
|
+
|
209
|
+
ret = test_sync_cancel(&ring, 0, 1, 1);
|
210
|
+
if (ret) {
|
211
|
+
fprintf(stderr, "test_sync_cancel 0 1 1 failed\n");
|
212
|
+
return T_EXIT_FAIL;
|
213
|
+
}
|
214
|
+
|
215
|
+
ret = test_sync_cancel(&ring, 1, 1, 1);
|
216
|
+
if (ret) {
|
217
|
+
fprintf(stderr, "test_sync_cancel 1 1 1 failed\n");
|
218
|
+
return T_EXIT_FAIL;
|
219
|
+
}
|
220
|
+
|
221
|
+
ret = test_sync_cancel_timeout(&ring, 0);
|
222
|
+
if (ret) {
|
223
|
+
fprintf(stderr, "test_sync_cancel_timeout 0\n");
|
224
|
+
return T_EXIT_FAIL;
|
225
|
+
}
|
226
|
+
|
227
|
+
/* must be last, leaves request */
|
228
|
+
ret = test_sync_cancel_timeout(&ring, 1);
|
229
|
+
if (ret) {
|
230
|
+
fprintf(stderr, "test_sync_cancel_timeout 1\n");
|
231
|
+
return T_EXIT_FAIL;
|
232
|
+
}
|
233
|
+
|
234
|
+
return T_EXIT_PASS;
|
235
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: Test configs for tests.
|
4
|
+
*/
|
5
|
+
#ifndef LIBURING_TEST_H
|
6
|
+
#define LIBURING_TEST_H
|
7
|
+
|
8
|
+
#ifdef __cplusplus
|
9
|
+
extern "C" {
|
10
|
+
#endif
|
11
|
+
|
12
|
+
typedef struct io_uring_test_config {
|
13
|
+
unsigned int flags;
|
14
|
+
const char *description;
|
15
|
+
} io_uring_test_config;
|
16
|
+
|
17
|
+
io_uring_test_config io_uring_test_configs[] = {
|
18
|
+
{ 0, "default" },
|
19
|
+
{ IORING_SETUP_SQE128, "large SQE"},
|
20
|
+
{ IORING_SETUP_CQE32, "large CQE"},
|
21
|
+
{ IORING_SETUP_SQE128 | IORING_SETUP_CQE32, "large SQE/CQE" },
|
22
|
+
};
|
23
|
+
|
24
|
+
#define FOR_ALL_TEST_CONFIGS \
|
25
|
+
for (int i = 0; i < sizeof(io_uring_test_configs) / sizeof(io_uring_test_configs[0]); i++)
|
26
|
+
|
27
|
+
#define IORING_GET_TEST_CONFIG_FLAGS() (io_uring_test_configs[i].flags)
|
28
|
+
#define IORING_GET_TEST_CONFIG_DESCRIPTION() (io_uring_test_configs[i].description)
|
29
|
+
|
30
|
+
|
31
|
+
#ifdef __cplusplus
|
32
|
+
}
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#endif
|
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <sys/time.h>
|
11
11
|
|
12
12
|
#include "liburing.h"
|
13
|
+
#include "helpers.h"
|
13
14
|
|
14
15
|
#define TIMEOUT_MSEC 200
|
15
16
|
static int not_supported;
|
@@ -33,14 +34,13 @@ static int check_timeout_support(void)
|
|
33
34
|
ret = io_uring_queue_init_params(1, &ring, &p);
|
34
35
|
if (ret) {
|
35
36
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
36
|
-
return
|
37
|
+
return T_EXIT_FAIL;
|
37
38
|
}
|
38
39
|
|
39
40
|
/* not really a match, but same kernel added batched completions */
|
40
41
|
if (p.features & IORING_FEAT_POLL_32BITS) {
|
41
|
-
fprintf(stdout, "Skipping\n");
|
42
42
|
not_supported = 1;
|
43
|
-
return
|
43
|
+
return T_EXIT_SKIP;
|
44
44
|
}
|
45
45
|
|
46
46
|
sqe = io_uring_get_sqe(&ring);
|
@@ -67,10 +67,10 @@ static int check_timeout_support(void)
|
|
67
67
|
|
68
68
|
io_uring_cqe_seen(&ring, cqe);
|
69
69
|
io_uring_queue_exit(&ring);
|
70
|
-
return
|
70
|
+
return T_EXIT_PASS;
|
71
71
|
err:
|
72
72
|
io_uring_queue_exit(&ring);
|
73
|
-
return
|
73
|
+
return T_EXIT_FAIL;
|
74
74
|
}
|
75
75
|
|
76
76
|
/*
|
@@ -183,22 +183,22 @@ int main(int argc, char *argv[])
|
|
183
183
|
int ret;
|
184
184
|
|
185
185
|
if (argc > 1)
|
186
|
-
return
|
186
|
+
return T_EXIT_SKIP;
|
187
187
|
|
188
188
|
ret = check_timeout_support();
|
189
|
-
if (ret) {
|
189
|
+
if (ret == T_EXIT_FAIL) {
|
190
190
|
fprintf(stderr, "check_timeout_support failed: %d\n", ret);
|
191
|
-
return
|
191
|
+
return T_EXIT_FAIL;
|
192
192
|
}
|
193
193
|
|
194
194
|
if (not_supported)
|
195
|
-
return
|
195
|
+
return T_EXIT_SKIP;
|
196
196
|
|
197
197
|
ret = test_timeout_overflow();
|
198
198
|
if (ret) {
|
199
199
|
fprintf(stderr, "test_timeout_overflow failed\n");
|
200
|
-
return
|
200
|
+
return T_EXIT_FAIL;
|
201
201
|
}
|
202
202
|
|
203
|
-
return
|
203
|
+
return T_EXIT_PASS;
|
204
204
|
}
|
@@ -156,7 +156,7 @@ static int test_single_timeout_nr(struct io_uring *ring, int nr)
|
|
156
156
|
|
157
157
|
/*
|
158
158
|
* NOP commands have user_data as 1. Check that we get the
|
159
|
-
* at least 'nr' NOPs first, then the successfully removed
|
159
|
+
* at least 'nr' NOPs first, then the successfully removed timeout.
|
160
160
|
*/
|
161
161
|
if (io_uring_cqe_get_data(cqe) == NULL) {
|
162
162
|
if (i < nr) {
|
@@ -588,7 +588,7 @@ static int test_multi_timeout(struct io_uring *ring)
|
|
588
588
|
}
|
589
589
|
|
590
590
|
if (cqe->user_data != user_data) {
|
591
|
-
fprintf(stderr, "%s: unexpected timeout req %d
|
591
|
+
fprintf(stderr, "%s: unexpected timeout req %d sequence\n",
|
592
592
|
__FUNCTION__, i+1);
|
593
593
|
goto err;
|
594
594
|
}
|
@@ -678,7 +678,7 @@ static int test_multi_timeout_nr(struct io_uring *ring)
|
|
678
678
|
case 1:
|
679
679
|
/* Should be timeout req_2 */
|
680
680
|
if (cqe->user_data != 2) {
|
681
|
-
fprintf(stderr, "%s: unexpected timeout req %d
|
681
|
+
fprintf(stderr, "%s: unexpected timeout req %d sequence\n",
|
682
682
|
__FUNCTION__, i+1);
|
683
683
|
goto err;
|
684
684
|
}
|
@@ -691,7 +691,7 @@ static int test_multi_timeout_nr(struct io_uring *ring)
|
|
691
691
|
case 2:
|
692
692
|
/* Should be timeout req_1 */
|
693
693
|
if (cqe->user_data != 1) {
|
694
|
-
fprintf(stderr, "%s: unexpected timeout req %d
|
694
|
+
fprintf(stderr, "%s: unexpected timeout req %d sequence\n",
|
695
695
|
__FUNCTION__, i+1);
|
696
696
|
goto err;
|
697
697
|
}
|
@@ -1179,7 +1179,7 @@ static int fill_exec_target(char *dst, char *path)
|
|
1179
1179
|
struct stat sb;
|
1180
1180
|
|
1181
1181
|
/*
|
1182
|
-
* Should either be ./exec-target or test/exec-target
|
1182
|
+
* Should either be ./exec-target.t or test/exec-target.t
|
1183
1183
|
*/
|
1184
1184
|
sprintf(dst, "%s", path);
|
1185
1185
|
return stat(dst, &sb);
|
@@ -1193,8 +1193,8 @@ static int test_timeout_link_cancel(void)
|
|
1193
1193
|
pid_t p;
|
1194
1194
|
int ret, i, wstatus;
|
1195
1195
|
|
1196
|
-
if (fill_exec_target(prog_path, "./exec-target") &&
|
1197
|
-
fill_exec_target(prog_path, "test/exec-target")) {
|
1196
|
+
if (fill_exec_target(prog_path, "./exec-target.t") &&
|
1197
|
+
fill_exec_target(prog_path, "test/exec-target.t")) {
|
1198
1198
|
fprintf(stdout, "Can't find exec-target, skipping\n");
|
1199
1199
|
return 0;
|
1200
1200
|
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Test double poll tty write. A test case for the regression fixed by:
|
4
|
+
*
|
5
|
+
* commit 6e295a664efd083ac9a5c1a8130c45be1db0cde7
|
6
|
+
* Author: Jens Axboe <axboe@kernel.dk>
|
7
|
+
* Date: Tue Mar 22 13:11:28 2022 -0600
|
8
|
+
*
|
9
|
+
* io_uring: fix assuming triggered poll waitqueue is the single poll
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
#include <errno.h>
|
13
|
+
#include <stdio.h>
|
14
|
+
#include <string.h>
|
15
|
+
#include <unistd.h>
|
16
|
+
#include <fcntl.h>
|
17
|
+
|
18
|
+
#include "liburing.h"
|
19
|
+
#include "helpers.h"
|
20
|
+
|
21
|
+
#define SQES 128
|
22
|
+
#define BUFSIZE 512
|
23
|
+
|
24
|
+
int main(int argc, char *argv[])
|
25
|
+
{
|
26
|
+
static char buf[BUFSIZE];
|
27
|
+
struct iovec vecs[SQES];
|
28
|
+
struct io_uring ring;
|
29
|
+
int ret, i, fd;
|
30
|
+
|
31
|
+
if (argc > 1)
|
32
|
+
return 0;
|
33
|
+
|
34
|
+
fd = open("/dev/ttyS0", O_RDWR | O_NONBLOCK);
|
35
|
+
if (fd < 0)
|
36
|
+
return 0;
|
37
|
+
|
38
|
+
ret = t_create_ring(SQES, &ring, 0);
|
39
|
+
if (ret == T_SETUP_SKIP)
|
40
|
+
return 0;
|
41
|
+
else if (ret < 0)
|
42
|
+
return 1;
|
43
|
+
|
44
|
+
for (i = 0; i < SQES; i++) {
|
45
|
+
struct io_uring_sqe *sqe;
|
46
|
+
|
47
|
+
sqe = io_uring_get_sqe(&ring);
|
48
|
+
vecs[i].iov_base = buf;
|
49
|
+
vecs[i].iov_len = sizeof(buf);
|
50
|
+
io_uring_prep_writev(sqe, fd, &vecs[i], 1, 0);
|
51
|
+
}
|
52
|
+
|
53
|
+
ret = io_uring_submit(&ring);
|
54
|
+
if (ret != SQES) {
|
55
|
+
fprintf(stderr, "submit: %d\n", ret);
|
56
|
+
return 1;
|
57
|
+
}
|
58
|
+
|
59
|
+
return 0;
|
60
|
+
}
|
@@ -24,7 +24,7 @@ static int test_unlink(struct io_uring *ring, const char *old)
|
|
24
24
|
fprintf(stderr, "get sqe failed\n");
|
25
25
|
goto err;
|
26
26
|
}
|
27
|
-
|
27
|
+
io_uring_prep_unlink(sqe, old, 0);
|
28
28
|
|
29
29
|
ret = io_uring_submit(ring);
|
30
30
|
if (ret <= 0) {
|