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
@@ -430,6 +430,10 @@ static int test(struct io_uring *ring, const char *fname, int buffered,
|
|
430
430
|
fprintf(stderr, "bad read %d, read %d\n", cqe->res, i);
|
431
431
|
goto err;
|
432
432
|
}
|
433
|
+
if (cqe->res < CHUNK_SIZE) {
|
434
|
+
fprintf(stderr, "short read %d, read %d\n", cqe->res, i);
|
435
|
+
goto err;
|
436
|
+
}
|
433
437
|
if (cqe->flags & IORING_CQE_F_BUFFER)
|
434
438
|
index = cqe->flags >> 16;
|
435
439
|
else
|
@@ -621,9 +625,9 @@ int main(int argc, char *argv[])
|
|
621
625
|
|
622
626
|
if (buf == fname)
|
623
627
|
unlink(fname);
|
624
|
-
return
|
628
|
+
return T_EXIT_PASS;
|
625
629
|
err:
|
626
630
|
if (buf == fname)
|
627
631
|
unlink(fname);
|
628
|
-
return
|
632
|
+
return T_EXIT_FAIL;
|
629
633
|
}
|
@@ -15,11 +15,10 @@
|
|
15
15
|
#include <unistd.h>
|
16
16
|
#include <poll.h>
|
17
17
|
#include "liburing.h"
|
18
|
+
#include "helpers.h"
|
18
19
|
|
19
20
|
#define BACKLOG 512
|
20
21
|
|
21
|
-
#define PORT 9100
|
22
|
-
|
23
22
|
static struct io_uring ring;
|
24
23
|
|
25
24
|
static void add_poll(struct io_uring *ring, int fd)
|
@@ -63,15 +62,14 @@ int main(int argc, char *argv[])
|
|
63
62
|
struct io_uring_cqe *cqe;
|
64
63
|
int ret, sock_listen_fd;
|
65
64
|
const int val = 1;
|
66
|
-
int i;
|
67
65
|
|
68
66
|
if (argc > 1)
|
69
|
-
return
|
67
|
+
return T_EXIT_SKIP;
|
70
68
|
|
71
69
|
sock_listen_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
72
70
|
if (sock_listen_fd < 0) {
|
73
71
|
perror("socket");
|
74
|
-
return
|
72
|
+
return T_EXIT_FAIL;
|
75
73
|
}
|
76
74
|
|
77
75
|
setsockopt(sock_listen_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
@@ -80,29 +78,18 @@ int main(int argc, char *argv[])
|
|
80
78
|
serv_addr.sin_family = AF_INET;
|
81
79
|
serv_addr.sin_addr.s_addr = INADDR_ANY;
|
82
80
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
ret = bind(sock_listen_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
|
87
|
-
if (!ret)
|
88
|
-
break;
|
89
|
-
if (errno != EADDRINUSE) {
|
90
|
-
fprintf(stderr, "bind: %s\n", strerror(errno));
|
91
|
-
return 1;
|
92
|
-
}
|
93
|
-
if (i == 99) {
|
94
|
-
printf("Gave up on finding a port, skipping\n");
|
95
|
-
goto out;
|
96
|
-
}
|
81
|
+
if (t_bind_ephemeral_port(sock_listen_fd, &serv_addr)) {
|
82
|
+
perror("bind");
|
83
|
+
return T_EXIT_FAIL;
|
97
84
|
}
|
98
85
|
|
99
86
|
if (listen(sock_listen_fd, BACKLOG) < 0) {
|
100
87
|
perror("Error listening on socket\n");
|
101
|
-
return
|
88
|
+
return T_EXIT_FAIL;
|
102
89
|
}
|
103
90
|
|
104
91
|
if (setup_io_uring())
|
105
|
-
return
|
92
|
+
return T_EXIT_FAIL;
|
106
93
|
|
107
94
|
add_poll(&ring, sock_listen_fd);
|
108
95
|
add_accept(&ring, sock_listen_fd);
|
@@ -110,7 +97,7 @@ int main(int argc, char *argv[])
|
|
110
97
|
ret = io_uring_submit(&ring);
|
111
98
|
if (ret != 2) {
|
112
99
|
fprintf(stderr, "submit=%d\n", ret);
|
113
|
-
return
|
100
|
+
return T_EXIT_FAIL;
|
114
101
|
}
|
115
102
|
|
116
103
|
signal(SIGALRM, alarm_sig);
|
@@ -119,10 +106,9 @@ int main(int argc, char *argv[])
|
|
119
106
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
120
107
|
if (ret) {
|
121
108
|
fprintf(stderr, "wait_cqe=%d\n", ret);
|
122
|
-
return
|
109
|
+
return T_EXIT_FAIL;
|
123
110
|
}
|
124
111
|
|
125
|
-
out:
|
126
112
|
io_uring_queue_exit(&ring);
|
127
|
-
return
|
113
|
+
return T_EXIT_PASS;
|
128
114
|
}
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#include <unistd.h>
|
16
16
|
#include <poll.h>
|
17
17
|
#include "liburing.h"
|
18
|
+
#include "helpers.h"
|
18
19
|
|
19
20
|
#define BACKLOG 512
|
20
21
|
|
@@ -72,12 +73,12 @@ int main(int argc, char *argv[])
|
|
72
73
|
int i;
|
73
74
|
|
74
75
|
if (argc > 1)
|
75
|
-
return
|
76
|
+
return T_EXIT_SKIP;
|
76
77
|
|
77
78
|
sock_listen_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
78
79
|
if (sock_listen_fd < 0) {
|
79
80
|
perror("socket");
|
80
|
-
return
|
81
|
+
return T_EXIT_FAIL;
|
81
82
|
}
|
82
83
|
|
83
84
|
setsockopt(sock_listen_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
@@ -94,21 +95,21 @@ int main(int argc, char *argv[])
|
|
94
95
|
break;
|
95
96
|
if (errno != EADDRINUSE) {
|
96
97
|
fprintf(stderr, "bind: %s\n", strerror(errno));
|
97
|
-
return
|
98
|
+
return T_EXIT_FAIL;
|
98
99
|
}
|
99
100
|
if (i == 99) {
|
100
101
|
printf("Gave up on finding a port, skipping\n");
|
101
|
-
goto
|
102
|
+
goto skip;
|
102
103
|
}
|
103
104
|
}
|
104
105
|
|
105
106
|
if (listen(sock_listen_fd, BACKLOG) < 0) {
|
106
107
|
perror("Error listening on socket\n");
|
107
|
-
return
|
108
|
+
return T_EXIT_FAIL;
|
108
109
|
}
|
109
110
|
|
110
111
|
if (setup_io_uring())
|
111
|
-
return
|
112
|
+
return T_EXIT_FAIL;
|
112
113
|
|
113
114
|
add_timeout(&ring, sock_listen_fd);
|
114
115
|
add_accept(&ring, sock_listen_fd);
|
@@ -116,7 +117,7 @@ int main(int argc, char *argv[])
|
|
116
117
|
ret = io_uring_submit(&ring);
|
117
118
|
if (ret != 2) {
|
118
119
|
fprintf(stderr, "submit=%d\n", ret);
|
119
|
-
return
|
120
|
+
return T_EXIT_FAIL;
|
120
121
|
}
|
121
122
|
|
122
123
|
signal(SIGALRM, alarm_sig);
|
@@ -125,10 +126,12 @@ int main(int argc, char *argv[])
|
|
125
126
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
126
127
|
if (ret) {
|
127
128
|
fprintf(stderr, "wait_cqe=%d\n", ret);
|
128
|
-
return
|
129
|
+
return T_EXIT_FAIL;
|
129
130
|
}
|
130
131
|
|
131
|
-
out:
|
132
132
|
io_uring_queue_exit(&ring);
|
133
|
-
return
|
133
|
+
return T_EXIT_PASS;
|
134
|
+
skip:
|
135
|
+
io_uring_queue_exit(&ring);
|
136
|
+
return T_EXIT_SKIP;
|
134
137
|
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Test fixed buffers with non-iterators.
|
4
|
+
*
|
5
|
+
* Taken from: https://github.com/axboe/liburing/issues/549
|
6
|
+
*/
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <fcntl.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
|
12
|
+
#include "liburing.h"
|
13
|
+
#include "helpers.h"
|
14
|
+
|
15
|
+
#define BUF_SIZE 4096
|
16
|
+
#define BUFFERS 1
|
17
|
+
#define IN_FD "/dev/urandom"
|
18
|
+
#define OUT_FD "/dev/zero"
|
19
|
+
|
20
|
+
static int test(struct io_uring *ring)
|
21
|
+
{
|
22
|
+
struct iovec iov[BUFFERS];
|
23
|
+
struct io_uring_sqe *sqe;
|
24
|
+
struct io_uring_cqe *cqe;
|
25
|
+
int ret, fd_in, fd_out, i;
|
26
|
+
|
27
|
+
fd_in = open(IN_FD, O_RDONLY, 0644);
|
28
|
+
if (fd_in < 0) {
|
29
|
+
perror("open in");
|
30
|
+
return 1;
|
31
|
+
}
|
32
|
+
|
33
|
+
fd_out = open(OUT_FD, O_RDWR, 0644);
|
34
|
+
if (fd_out < 0) {
|
35
|
+
perror("open out");
|
36
|
+
return 1;
|
37
|
+
}
|
38
|
+
|
39
|
+
for (i = 0; i < BUFFERS; i++) {
|
40
|
+
iov[i].iov_base = malloc(BUF_SIZE);
|
41
|
+
iov[i].iov_len = BUF_SIZE;
|
42
|
+
memset(iov[i].iov_base, 0, BUF_SIZE);
|
43
|
+
}
|
44
|
+
|
45
|
+
ret = io_uring_register_buffers(ring, iov, BUFFERS);
|
46
|
+
if (ret) {
|
47
|
+
fprintf(stderr, "Error registering buffers: %s", strerror(-ret));
|
48
|
+
return 1;
|
49
|
+
}
|
50
|
+
|
51
|
+
sqe = io_uring_get_sqe(ring);
|
52
|
+
if (!sqe) {
|
53
|
+
fprintf(stderr, "Could not get SQE.\n");
|
54
|
+
return 1;
|
55
|
+
}
|
56
|
+
|
57
|
+
io_uring_prep_read_fixed(sqe, fd_in, iov[0].iov_base, BUF_SIZE, 0, 0);
|
58
|
+
io_uring_submit(ring);
|
59
|
+
|
60
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
61
|
+
if (ret < 0) {
|
62
|
+
fprintf(stderr, "Error waiting for completion: %s\n", strerror(-ret));
|
63
|
+
return 1;
|
64
|
+
}
|
65
|
+
|
66
|
+
if (cqe->res < 0) {
|
67
|
+
fprintf(stderr, "Error in async operation: %s\n", strerror(-cqe->res));
|
68
|
+
return 1;
|
69
|
+
}
|
70
|
+
io_uring_cqe_seen(ring, cqe);
|
71
|
+
|
72
|
+
sqe = io_uring_get_sqe(ring);
|
73
|
+
if (!sqe) {
|
74
|
+
fprintf(stderr, "Could not get SQE.\n");
|
75
|
+
return 1;
|
76
|
+
}
|
77
|
+
io_uring_prep_write_fixed(sqe, fd_out, iov[0].iov_base, BUF_SIZE, 0, 0);
|
78
|
+
io_uring_submit(ring);
|
79
|
+
|
80
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
81
|
+
if (ret < 0) {
|
82
|
+
fprintf(stderr, "Error waiting for completion: %s\n", strerror(-ret));
|
83
|
+
return 1;
|
84
|
+
}
|
85
|
+
if (cqe->res < 0) {
|
86
|
+
fprintf(stderr, "Error in async operation: %s\n", strerror(-cqe->res));
|
87
|
+
return 1;
|
88
|
+
}
|
89
|
+
io_uring_cqe_seen(ring, cqe);
|
90
|
+
return 0;
|
91
|
+
}
|
92
|
+
|
93
|
+
int main(int argc, char *argv[])
|
94
|
+
{
|
95
|
+
struct io_uring ring;
|
96
|
+
int ret;
|
97
|
+
|
98
|
+
if (argc > 1)
|
99
|
+
return T_EXIT_SKIP;
|
100
|
+
|
101
|
+
ret = t_create_ring(8, &ring, 0);
|
102
|
+
if (ret == T_SETUP_SKIP)
|
103
|
+
return T_EXIT_SKIP;
|
104
|
+
else if (ret < 0)
|
105
|
+
return T_EXIT_FAIL;
|
106
|
+
|
107
|
+
ret = test(&ring);
|
108
|
+
if (ret) {
|
109
|
+
fprintf(stderr, "Test failed\n");
|
110
|
+
return T_EXIT_FAIL;
|
111
|
+
}
|
112
|
+
|
113
|
+
io_uring_queue_exit(&ring);
|
114
|
+
return T_EXIT_PASS;
|
115
|
+
}
|
@@ -19,18 +19,18 @@ int main(int argc, char *argv[])
|
|
19
19
|
int i, fd, ret;
|
20
20
|
|
21
21
|
if (argc > 1)
|
22
|
-
return
|
22
|
+
return T_EXIT_SKIP;
|
23
23
|
|
24
24
|
fd = open("/dev/zero", O_RDONLY);
|
25
25
|
if (fd < 0) {
|
26
26
|
fprintf(stderr, "Failed to open /dev/zero\n");
|
27
|
-
return
|
27
|
+
return T_EXIT_FAIL;
|
28
28
|
}
|
29
29
|
|
30
30
|
if (io_uring_queue_init(32, &ring, 0) < 0) {
|
31
|
-
fprintf(stderr, "
|
31
|
+
fprintf(stderr, "Failed to init io_uring\n");
|
32
32
|
close(fd);
|
33
|
-
return
|
33
|
+
return T_EXIT_FAIL;
|
34
34
|
}
|
35
35
|
|
36
36
|
for (i = 0; i < IOVECS_LEN; ++i) {
|
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|
41
41
|
ret = io_uring_register_buffers(&ring, iovecs, IOVECS_LEN);
|
42
42
|
if (ret) {
|
43
43
|
fprintf(stderr, "Failed to register buffers\n");
|
44
|
-
return
|
44
|
+
return T_EXIT_FAIL;
|
45
45
|
}
|
46
46
|
|
47
47
|
for (i = 0; i < IOVECS_LEN; ++i) {
|
@@ -58,10 +58,10 @@ int main(int argc, char *argv[])
|
|
58
58
|
ret = io_uring_submit_and_wait(&ring, IOVECS_LEN);
|
59
59
|
if (ret < 0) {
|
60
60
|
fprintf(stderr, "Failed to submit IO\n");
|
61
|
-
return
|
61
|
+
return T_EXIT_FAIL;
|
62
62
|
} else if (ret < 2) {
|
63
63
|
fprintf(stderr, "Submitted %d, wanted %d\n", ret, IOVECS_LEN);
|
64
|
-
return
|
64
|
+
return T_EXIT_FAIL;
|
65
65
|
}
|
66
66
|
|
67
67
|
for (i = 0; i < IOVECS_LEN; i++) {
|
@@ -70,12 +70,12 @@ int main(int argc, char *argv[])
|
|
70
70
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
71
71
|
if (ret) {
|
72
72
|
fprintf(stderr, "wait_cqe=%d\n", ret);
|
73
|
-
return
|
73
|
+
return T_EXIT_FAIL;
|
74
74
|
}
|
75
75
|
if (cqe->res != iovecs[i].iov_len) {
|
76
76
|
fprintf(stderr, "read: wanted %ld, got %d\n",
|
77
77
|
(long) iovecs[i].iov_len, cqe->res);
|
78
|
-
return
|
78
|
+
return T_EXIT_FAIL;
|
79
79
|
}
|
80
80
|
io_uring_cqe_seen(&ring, cqe);
|
81
81
|
}
|
@@ -86,5 +86,5 @@ int main(int argc, char *argv[])
|
|
86
86
|
for (i = 0; i < IOVECS_LEN; ++i)
|
87
87
|
free(iovecs[i].iov_base);
|
88
88
|
|
89
|
-
return
|
89
|
+
return T_EXIT_PASS;
|
90
90
|
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: link <open file><read from file><close file> with an existing
|
4
|
+
* file present in the opened slot, verifying that we get the new file
|
5
|
+
* rather than the old one.
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
#include <errno.h>
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <unistd.h>
|
11
|
+
#include <stdlib.h>
|
12
|
+
#include <string.h>
|
13
|
+
#include <fcntl.h>
|
14
|
+
|
15
|
+
#include "liburing.h"
|
16
|
+
#include "helpers.h"
|
17
|
+
|
18
|
+
#define MAX_FILES 8
|
19
|
+
#define FNAME1 ".slot.reuse.1"
|
20
|
+
#define FNAME2 ".slot.reuse.2"
|
21
|
+
#define PAT1 0xaa
|
22
|
+
#define PAT2 0x55
|
23
|
+
#define BSIZE 4096
|
24
|
+
|
25
|
+
static int test(struct io_uring *ring)
|
26
|
+
{
|
27
|
+
struct io_uring_cqe *cqe;
|
28
|
+
struct io_uring_sqe *sqe;
|
29
|
+
char buf[BSIZE];
|
30
|
+
int ret, i;
|
31
|
+
|
32
|
+
/* open FNAME1 in slot 0 */
|
33
|
+
sqe = io_uring_get_sqe(ring);
|
34
|
+
io_uring_prep_openat_direct(sqe, AT_FDCWD, FNAME1, O_RDONLY, 0, 0);
|
35
|
+
sqe->user_data = 1;
|
36
|
+
|
37
|
+
ret = io_uring_submit(ring);
|
38
|
+
if (ret != 1) {
|
39
|
+
fprintf(stderr, "sqe submit failed: %d\n", ret);
|
40
|
+
goto err;
|
41
|
+
}
|
42
|
+
|
43
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
44
|
+
if (ret < 0) {
|
45
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
46
|
+
goto err;
|
47
|
+
}
|
48
|
+
if (cqe->res != 0) {
|
49
|
+
fprintf(stderr, "open res %d\n", ret);
|
50
|
+
goto err;
|
51
|
+
}
|
52
|
+
io_uring_cqe_seen(ring, cqe);
|
53
|
+
|
54
|
+
/*
|
55
|
+
* Now open FNAME2 in that same slot, verifying we get data from
|
56
|
+
* FNAME2 and not FNAME1.
|
57
|
+
*/
|
58
|
+
sqe = io_uring_get_sqe(ring);
|
59
|
+
io_uring_prep_openat_direct(sqe, AT_FDCWD, FNAME2, O_RDONLY, 0, 0);
|
60
|
+
sqe->flags |= IOSQE_IO_LINK;
|
61
|
+
sqe->user_data = 2;
|
62
|
+
|
63
|
+
sqe = io_uring_get_sqe(ring);
|
64
|
+
io_uring_prep_read(sqe, 0, buf, sizeof(buf), 0);
|
65
|
+
sqe->flags |= IOSQE_FIXED_FILE;
|
66
|
+
sqe->flags |= IOSQE_IO_LINK;
|
67
|
+
sqe->user_data = 3;
|
68
|
+
|
69
|
+
sqe = io_uring_get_sqe(ring);
|
70
|
+
io_uring_prep_close_direct(sqe, 0);
|
71
|
+
sqe->user_data = 4;
|
72
|
+
|
73
|
+
ret = io_uring_submit(ring);
|
74
|
+
if (ret != 3) {
|
75
|
+
fprintf(stderr, "sqe submit failed: %d\n", ret);
|
76
|
+
goto err;
|
77
|
+
}
|
78
|
+
|
79
|
+
for (i = 0; i < 3; i++) {
|
80
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
81
|
+
if (ret < 0) {
|
82
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
83
|
+
goto err;
|
84
|
+
}
|
85
|
+
switch (cqe->user_data) {
|
86
|
+
case 2:
|
87
|
+
if (cqe->res) {
|
88
|
+
fprintf(stderr, "bad open %d\n", cqe->res);
|
89
|
+
goto err;
|
90
|
+
}
|
91
|
+
break;
|
92
|
+
case 3:
|
93
|
+
if (cqe->res != sizeof(buf)) {
|
94
|
+
fprintf(stderr, "bad read %d\n", cqe->res);
|
95
|
+
goto err;
|
96
|
+
}
|
97
|
+
break;
|
98
|
+
case 4:
|
99
|
+
if (cqe->res) {
|
100
|
+
fprintf(stderr, "bad close %d\n", cqe->res);
|
101
|
+
goto err;
|
102
|
+
}
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
io_uring_cqe_seen(ring, cqe);
|
106
|
+
}
|
107
|
+
|
108
|
+
for (i = 0; i < sizeof(buf); i++) {
|
109
|
+
if (buf[i] == PAT2)
|
110
|
+
continue;
|
111
|
+
fprintf(stderr, "Bad pattern %x at %d\n", buf[i], i);
|
112
|
+
goto err;
|
113
|
+
}
|
114
|
+
|
115
|
+
return 0;
|
116
|
+
err:
|
117
|
+
return 1;
|
118
|
+
}
|
119
|
+
|
120
|
+
int main(int argc, char *argv[])
|
121
|
+
{
|
122
|
+
struct io_uring ring;
|
123
|
+
struct io_uring_params p = { };
|
124
|
+
int ret, files[MAX_FILES];
|
125
|
+
|
126
|
+
if (argc > 1)
|
127
|
+
return T_EXIT_SKIP;
|
128
|
+
|
129
|
+
ret = io_uring_queue_init_params(8, &ring, &p);
|
130
|
+
if (ret) {
|
131
|
+
fprintf(stderr, "ring setup failed: %d\n", ret);
|
132
|
+
return T_EXIT_FAIL;
|
133
|
+
}
|
134
|
+
if (!(p.features & IORING_FEAT_CQE_SKIP))
|
135
|
+
return T_EXIT_SKIP;
|
136
|
+
|
137
|
+
memset(files, -1, sizeof(files));
|
138
|
+
ret = io_uring_register_files(&ring, files, ARRAY_SIZE(files));
|
139
|
+
if (ret) {
|
140
|
+
fprintf(stderr, "Failed registering files\n");
|
141
|
+
return T_EXIT_FAIL;
|
142
|
+
}
|
143
|
+
|
144
|
+
t_create_file_pattern(FNAME1, 4096, PAT1);
|
145
|
+
t_create_file_pattern(FNAME2, 4096, PAT2);
|
146
|
+
|
147
|
+
ret = test(&ring);
|
148
|
+
if (ret) {
|
149
|
+
fprintf(stderr, "test failed\n");
|
150
|
+
goto err;
|
151
|
+
}
|
152
|
+
|
153
|
+
unlink(FNAME1);
|
154
|
+
unlink(FNAME2);
|
155
|
+
return T_EXIT_PASS;
|
156
|
+
err:
|
157
|
+
unlink(FNAME1);
|
158
|
+
unlink(FNAME2);
|
159
|
+
return T_EXIT_FAIL;
|
160
|
+
}
|
data/vendor/liburing/test/fpos.c
CHANGED
@@ -52,6 +52,9 @@ static int test_read(struct io_uring *ring, bool async, int blocksize)
|
|
52
52
|
unsigned char buff[QUEUE_SIZE * blocksize];
|
53
53
|
unsigned char reordered[QUEUE_SIZE * blocksize];
|
54
54
|
|
55
|
+
memset(buff, 0, QUEUE_SIZE * blocksize);
|
56
|
+
memset(reordered, 0, QUEUE_SIZE * blocksize);
|
57
|
+
|
55
58
|
create_file(".test_fpos_read", FILE_SIZE);
|
56
59
|
fd = open(".test_fpos_read", O_RDONLY);
|
57
60
|
unlink(".test_fpos_read");
|
@@ -225,12 +228,12 @@ int main(int argc, char *argv[])
|
|
225
228
|
int ret;
|
226
229
|
|
227
230
|
if (argc > 1)
|
228
|
-
return
|
231
|
+
return T_EXIT_SKIP;
|
229
232
|
|
230
233
|
ret = io_uring_queue_init(QUEUE_SIZE, &ring, 0);
|
231
234
|
if (ret) {
|
232
235
|
fprintf(stderr, "ring setup failed\n");
|
233
|
-
return
|
236
|
+
return T_EXIT_FAIL;
|
234
237
|
}
|
235
238
|
|
236
239
|
for (int test = 0; test < 8; test++) {
|
@@ -248,5 +251,5 @@ int main(int argc, char *argv[])
|
|
248
251
|
return -1;
|
249
252
|
}
|
250
253
|
}
|
251
|
-
return
|
254
|
+
return T_EXIT_PASS;
|
252
255
|
}
|
@@ -193,12 +193,12 @@ int main(int argc, char *argv[])
|
|
193
193
|
int ret;
|
194
194
|
|
195
195
|
if (argc > 1)
|
196
|
-
return
|
196
|
+
return T_EXIT_SKIP;
|
197
197
|
|
198
198
|
ret = io_uring_queue_init(8, &ring, 0);
|
199
199
|
if (ret) {
|
200
200
|
fprintf(stderr, "ring setup failed\n");
|
201
|
-
return
|
201
|
+
return T_EXIT_FAIL;
|
202
202
|
|
203
203
|
}
|
204
204
|
|
@@ -220,5 +220,5 @@ int main(int argc, char *argv[])
|
|
220
220
|
return ret;
|
221
221
|
}
|
222
222
|
|
223
|
-
return
|
223
|
+
return T_EXIT_PASS;
|
224
224
|
}
|
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <unistd.h>
|
11
11
|
|
12
12
|
#include "liburing.h"
|
13
|
+
#include "helpers.h"
|
13
14
|
|
14
15
|
|
15
16
|
static int do_linkat(struct io_uring *ring, const char *oldname, const char *newname)
|
@@ -74,7 +75,7 @@ int main(int argc, char *argv[])
|
|
74
75
|
struct io_uring ring;
|
75
76
|
|
76
77
|
if (argc > 1)
|
77
|
-
return
|
78
|
+
return T_EXIT_SKIP;
|
78
79
|
|
79
80
|
ret = io_uring_queue_init(8, &ring, 0);
|
80
81
|
if (ret) {
|
@@ -97,7 +98,7 @@ int main(int argc, char *argv[])
|
|
97
98
|
if (ret < 0) {
|
98
99
|
if (ret == -EBADF || ret == -EINVAL) {
|
99
100
|
fprintf(stdout, "linkat not supported, skipping\n");
|
100
|
-
goto
|
101
|
+
goto skip;
|
101
102
|
}
|
102
103
|
fprintf(stderr, "linkat: %s\n", strerror(-ret));
|
103
104
|
goto err1;
|
@@ -120,17 +121,20 @@ int main(int argc, char *argv[])
|
|
120
121
|
goto err2;
|
121
122
|
}
|
122
123
|
|
123
|
-
out:
|
124
124
|
unlinkat(AT_FDCWD, linkname, 0);
|
125
125
|
unlinkat(AT_FDCWD, target, 0);
|
126
126
|
io_uring_queue_exit(&ring);
|
127
|
-
return
|
127
|
+
return T_EXIT_PASS;
|
128
|
+
skip:
|
129
|
+
unlinkat(AT_FDCWD, linkname, 0);
|
130
|
+
unlinkat(AT_FDCWD, target, 0);
|
131
|
+
io_uring_queue_exit(&ring);
|
132
|
+
return T_EXIT_SKIP;
|
128
133
|
err2:
|
129
134
|
unlinkat(AT_FDCWD, linkname, 0);
|
130
135
|
err1:
|
131
136
|
unlinkat(AT_FDCWD, target, 0);
|
132
137
|
err:
|
133
138
|
io_uring_queue_exit(&ring);
|
134
|
-
return
|
139
|
+
return T_EXIT_FAIL;
|
135
140
|
}
|
136
|
-
|