polyphony 0.93 → 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/examples/pipes/echo_server.rb +1 -1
- data/examples/pipes/http_server.rb +33 -0
- data/ext/polyphony/backend_common.c +53 -8
- data/ext/polyphony/backend_common.h +21 -13
- data/ext/polyphony/backend_io_uring.c +85 -147
- data/ext/polyphony/backend_libev.c +58 -89
- data/ext/polyphony/event.c +1 -1
- data/ext/polyphony/extconf.rb +7 -5
- data/ext/polyphony/fiber.c +5 -13
- data/ext/polyphony/io_extensions.c +68 -68
- data/ext/polyphony/pipe.c +1 -1
- data/ext/polyphony/polyphony.c +23 -23
- data/ext/polyphony/polyphony.h +0 -9
- 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_global_api.rb +1 -1
- 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 +148 -26
- data/Gemfile.lock +0 -82
@@ -13,8 +13,9 @@
|
|
13
13
|
#include <sys/eventfd.h>
|
14
14
|
|
15
15
|
#include "liburing.h"
|
16
|
+
#include "helpers.h"
|
16
17
|
|
17
|
-
int
|
18
|
+
static int test(bool defer)
|
18
19
|
{
|
19
20
|
struct io_uring_params p = {};
|
20
21
|
struct io_uring_sqe *sqe;
|
@@ -27,36 +28,37 @@ int main(int argc, char *argv[])
|
|
27
28
|
};
|
28
29
|
int ret, evfd, i;
|
29
30
|
|
30
|
-
if (
|
31
|
-
|
31
|
+
if (defer)
|
32
|
+
p.flags |= IORING_SETUP_SINGLE_ISSUER |
|
33
|
+
IORING_SETUP_DEFER_TASKRUN;
|
32
34
|
|
33
35
|
ret = io_uring_queue_init_params(64, &ring, &p);
|
34
36
|
if (ret) {
|
35
37
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
36
|
-
return
|
38
|
+
return T_EXIT_FAIL;
|
37
39
|
}
|
38
40
|
|
39
41
|
evfd = eventfd(0, EFD_CLOEXEC);
|
40
42
|
if (evfd < 0) {
|
41
43
|
perror("eventfd");
|
42
|
-
return
|
44
|
+
return T_EXIT_FAIL;
|
43
45
|
}
|
44
46
|
|
45
47
|
ret = io_uring_register_eventfd(&ring, evfd);
|
46
48
|
if (ret) {
|
47
49
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
48
|
-
return
|
50
|
+
return T_EXIT_FAIL;
|
49
51
|
}
|
50
52
|
|
51
53
|
if (!io_uring_cq_eventfd_enabled(&ring)) {
|
52
54
|
fprintf(stderr, "eventfd disabled\n");
|
53
|
-
return
|
55
|
+
return T_EXIT_FAIL;
|
54
56
|
}
|
55
57
|
|
56
58
|
ret = io_uring_cq_eventfd_toggle(&ring, false);
|
57
59
|
if (ret) {
|
58
60
|
fprintf(stdout, "Skipping, CQ flags not available!\n");
|
59
|
-
return
|
61
|
+
return T_EXIT_SKIP;
|
60
62
|
}
|
61
63
|
|
62
64
|
sqe = io_uring_get_sqe(&ring);
|
@@ -66,7 +68,7 @@ int main(int argc, char *argv[])
|
|
66
68
|
ret = io_uring_submit(&ring);
|
67
69
|
if (ret != 1) {
|
68
70
|
fprintf(stderr, "submit: %d\n", ret);
|
69
|
-
return
|
71
|
+
return T_EXIT_FAIL;
|
70
72
|
}
|
71
73
|
|
72
74
|
for (i = 0; i < 63; i++) {
|
@@ -78,24 +80,24 @@ int main(int argc, char *argv[])
|
|
78
80
|
ret = io_uring_submit(&ring);
|
79
81
|
if (ret != 63) {
|
80
82
|
fprintf(stderr, "submit: %d\n", ret);
|
81
|
-
return
|
83
|
+
return T_EXIT_FAIL;
|
82
84
|
}
|
83
85
|
|
84
86
|
for (i = 0; i < 63; i++) {
|
85
87
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
86
88
|
if (ret) {
|
87
89
|
fprintf(stderr, "wait: %d\n", ret);
|
88
|
-
return
|
90
|
+
return T_EXIT_FAIL;
|
89
91
|
}
|
90
92
|
|
91
93
|
switch (cqe->user_data) {
|
92
94
|
case 1: /* eventfd */
|
93
95
|
fprintf(stderr, "eventfd unexpected: %d\n", (int)ptr);
|
94
|
-
return
|
96
|
+
return T_EXIT_FAIL;
|
95
97
|
case 2:
|
96
98
|
if (cqe->res) {
|
97
99
|
fprintf(stderr, "nop: %d\n", cqe->res);
|
98
|
-
return
|
100
|
+
return T_EXIT_FAIL;
|
99
101
|
}
|
100
102
|
break;
|
101
103
|
}
|
@@ -105,7 +107,7 @@ int main(int argc, char *argv[])
|
|
105
107
|
ret = io_uring_cq_eventfd_toggle(&ring, true);
|
106
108
|
if (ret) {
|
107
109
|
fprintf(stderr, "io_uring_cq_eventfd_toggle: %d\n", ret);
|
108
|
-
return
|
110
|
+
return T_EXIT_FAIL;
|
109
111
|
}
|
110
112
|
|
111
113
|
sqe = io_uring_get_sqe(&ring);
|
@@ -115,37 +117,63 @@ int main(int argc, char *argv[])
|
|
115
117
|
ret = io_uring_submit(&ring);
|
116
118
|
if (ret != 1) {
|
117
119
|
fprintf(stderr, "submit: %d\n", ret);
|
118
|
-
return
|
120
|
+
return T_EXIT_FAIL;
|
119
121
|
}
|
120
122
|
|
121
123
|
for (i = 0; i < 2; i++) {
|
122
124
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
123
125
|
if (ret) {
|
124
126
|
fprintf(stderr, "wait: %d\n", ret);
|
125
|
-
return
|
127
|
+
return T_EXIT_FAIL;
|
126
128
|
}
|
127
129
|
|
128
130
|
switch (cqe->user_data) {
|
129
131
|
case 1: /* eventfd */
|
130
132
|
if (cqe->res != sizeof(ptr)) {
|
131
133
|
fprintf(stderr, "read res: %d\n", cqe->res);
|
132
|
-
return
|
134
|
+
return T_EXIT_FAIL;
|
133
135
|
}
|
134
136
|
|
135
137
|
if (ptr != 1) {
|
136
138
|
fprintf(stderr, "eventfd: %d\n", (int)ptr);
|
137
|
-
return
|
139
|
+
return T_EXIT_FAIL;
|
138
140
|
}
|
139
141
|
break;
|
140
142
|
case 2:
|
141
143
|
if (cqe->res) {
|
142
144
|
fprintf(stderr, "nop: %d\n", cqe->res);
|
143
|
-
return
|
145
|
+
return T_EXIT_FAIL;
|
144
146
|
}
|
145
147
|
break;
|
146
148
|
}
|
147
149
|
io_uring_cqe_seen(&ring, cqe);
|
148
150
|
}
|
149
151
|
|
150
|
-
|
152
|
+
io_uring_queue_exit(&ring);
|
153
|
+
close(evfd);
|
154
|
+
return T_EXIT_PASS;
|
155
|
+
}
|
156
|
+
|
157
|
+
int main(int argc, char *argv[])
|
158
|
+
{
|
159
|
+
int ret;
|
160
|
+
|
161
|
+
if (argc > 1)
|
162
|
+
return T_EXIT_SKIP;
|
163
|
+
|
164
|
+
ret = test(false);
|
165
|
+
if (ret != T_EXIT_PASS) {
|
166
|
+
fprintf(stderr, "%s: test(false) failed\n", argv[0]);
|
167
|
+
return ret;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (t_probe_defer_taskrun()) {
|
171
|
+
ret = test(true);
|
172
|
+
if (ret != T_EXIT_PASS) {
|
173
|
+
fprintf(stderr, "%s: test(true) failed\n", argv[0]);
|
174
|
+
return ret;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
return ret;
|
151
179
|
}
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include <sys/eventfd.h>
|
14
14
|
|
15
15
|
#include "liburing.h"
|
16
|
+
#include "helpers.h"
|
16
17
|
|
17
18
|
int main(int argc, char *argv[])
|
18
19
|
{
|
@@ -21,39 +22,39 @@ int main(int argc, char *argv[])
|
|
21
22
|
int ret, evfd[2], i;
|
22
23
|
|
23
24
|
if (argc > 1)
|
24
|
-
return
|
25
|
+
return T_EXIT_SKIP;
|
25
26
|
|
26
27
|
ret = io_uring_queue_init_params(8, &ring, &p);
|
27
28
|
if (ret) {
|
28
29
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
29
|
-
return
|
30
|
+
return T_EXIT_FAIL;
|
30
31
|
}
|
31
32
|
|
32
33
|
evfd[0] = eventfd(0, EFD_CLOEXEC);
|
33
34
|
evfd[1] = eventfd(0, EFD_CLOEXEC);
|
34
35
|
if (evfd[0] < 0 || evfd[1] < 0) {
|
35
36
|
perror("eventfd");
|
36
|
-
return
|
37
|
+
return T_EXIT_FAIL;
|
37
38
|
}
|
38
39
|
|
39
40
|
ret = io_uring_register_eventfd(&ring, evfd[0]);
|
40
41
|
if (ret) {
|
41
42
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
42
|
-
return
|
43
|
+
return T_EXIT_FAIL;
|
43
44
|
}
|
44
45
|
|
45
46
|
/* Check that registrering again will get -EBUSY */
|
46
47
|
ret = io_uring_register_eventfd(&ring, evfd[1]);
|
47
48
|
if (ret != -EBUSY) {
|
48
49
|
fprintf(stderr, "unexpected 2nd register: %d\n", ret);
|
49
|
-
return
|
50
|
+
return T_EXIT_FAIL;
|
50
51
|
}
|
51
52
|
close(evfd[1]);
|
52
53
|
|
53
54
|
ret = io_uring_unregister_eventfd(&ring);
|
54
55
|
if (ret) {
|
55
56
|
fprintf(stderr, "unexpected unregister: %d\n", ret);
|
56
|
-
return
|
57
|
+
return T_EXIT_FAIL;
|
57
58
|
}
|
58
59
|
|
59
60
|
/* loop 100 registers/unregister */
|
@@ -61,16 +62,16 @@ int main(int argc, char *argv[])
|
|
61
62
|
ret = io_uring_register_eventfd(&ring, evfd[0]);
|
62
63
|
if (ret) {
|
63
64
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
64
|
-
return
|
65
|
+
return T_EXIT_FAIL;
|
65
66
|
}
|
66
67
|
|
67
68
|
ret = io_uring_unregister_eventfd(&ring);
|
68
69
|
if (ret) {
|
69
70
|
fprintf(stderr, "unexpected unregister: %d\n", ret);
|
70
|
-
return
|
71
|
+
return T_EXIT_FAIL;
|
71
72
|
}
|
72
73
|
}
|
73
74
|
|
74
75
|
close(evfd[0]);
|
75
|
-
return
|
76
|
+
return T_EXIT_PASS;
|
76
77
|
}
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include <sys/eventfd.h>
|
14
14
|
|
15
15
|
#include "liburing.h"
|
16
|
+
#include "helpers.h"
|
16
17
|
|
17
18
|
int main(int argc, char *argv[])
|
18
19
|
{
|
@@ -22,45 +23,45 @@ int main(int argc, char *argv[])
|
|
22
23
|
int ret, evfd1, evfd2;
|
23
24
|
|
24
25
|
if (argc > 1)
|
25
|
-
return
|
26
|
+
return T_EXIT_SKIP;
|
26
27
|
|
27
28
|
ret = io_uring_queue_init_params(8, &ring1, &p);
|
28
29
|
if (ret) {
|
29
30
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
30
|
-
return
|
31
|
+
return T_EXIT_FAIL;
|
31
32
|
}
|
32
33
|
if (!(p.features & IORING_FEAT_CUR_PERSONALITY)) {
|
33
34
|
fprintf(stdout, "Skipping\n");
|
34
|
-
return
|
35
|
+
return T_EXIT_SKIP;
|
35
36
|
}
|
36
37
|
ret = io_uring_queue_init(8, &ring2, 0);
|
37
38
|
if (ret) {
|
38
39
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
39
|
-
return
|
40
|
+
return T_EXIT_FAIL;
|
40
41
|
}
|
41
42
|
|
42
43
|
evfd1 = eventfd(0, EFD_CLOEXEC);
|
43
44
|
if (evfd1 < 0) {
|
44
45
|
perror("eventfd");
|
45
|
-
return
|
46
|
+
return T_EXIT_FAIL;
|
46
47
|
}
|
47
48
|
|
48
49
|
evfd2 = eventfd(0, EFD_CLOEXEC);
|
49
50
|
if (evfd2 < 0) {
|
50
51
|
perror("eventfd");
|
51
|
-
return
|
52
|
+
return T_EXIT_FAIL;
|
52
53
|
}
|
53
54
|
|
54
55
|
ret = io_uring_register_eventfd(&ring1, evfd1);
|
55
56
|
if (ret) {
|
56
57
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
57
|
-
return
|
58
|
+
return T_EXIT_FAIL;
|
58
59
|
}
|
59
60
|
|
60
61
|
ret = io_uring_register_eventfd(&ring2, evfd2);
|
61
62
|
if (ret) {
|
62
63
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
63
|
-
return
|
64
|
+
return T_EXIT_FAIL;
|
64
65
|
}
|
65
66
|
|
66
67
|
sqe = io_uring_get_sqe(&ring1);
|
@@ -74,13 +75,13 @@ int main(int argc, char *argv[])
|
|
74
75
|
ret = io_uring_submit(&ring1);
|
75
76
|
if (ret != 1) {
|
76
77
|
fprintf(stderr, "submit: %d\n", ret);
|
77
|
-
return
|
78
|
+
return T_EXIT_FAIL;
|
78
79
|
}
|
79
80
|
|
80
81
|
ret = io_uring_submit(&ring2);
|
81
82
|
if (ret != 1) {
|
82
83
|
fprintf(stderr, "submit: %d\n", ret);
|
83
|
-
return
|
84
|
+
return T_EXIT_FAIL;
|
84
85
|
}
|
85
86
|
|
86
87
|
sqe = io_uring_get_sqe(&ring1);
|
@@ -90,8 +91,8 @@ int main(int argc, char *argv[])
|
|
90
91
|
ret = io_uring_submit(&ring1);
|
91
92
|
if (ret != 1) {
|
92
93
|
fprintf(stderr, "submit: %d\n", ret);
|
93
|
-
return
|
94
|
+
return T_EXIT_FAIL;
|
94
95
|
}
|
95
96
|
|
96
|
-
return
|
97
|
+
return T_EXIT_PASS;
|
97
98
|
}
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include <sys/eventfd.h>
|
14
14
|
|
15
15
|
#include "liburing.h"
|
16
|
+
#include "helpers.h"
|
16
17
|
|
17
18
|
int main(int argc, char *argv[])
|
18
19
|
{
|
@@ -28,28 +29,28 @@ int main(int argc, char *argv[])
|
|
28
29
|
int ret, evfd, i;
|
29
30
|
|
30
31
|
if (argc > 1)
|
31
|
-
return
|
32
|
+
return T_EXIT_SKIP;
|
32
33
|
|
33
34
|
ret = io_uring_queue_init_params(8, &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
|
if (!(p.features & IORING_FEAT_CUR_PERSONALITY)) {
|
39
40
|
fprintf(stdout, "Skipping\n");
|
40
|
-
return
|
41
|
+
return T_EXIT_SKIP;
|
41
42
|
}
|
42
43
|
|
43
44
|
evfd = eventfd(0, EFD_CLOEXEC);
|
44
45
|
if (evfd < 0) {
|
45
46
|
perror("eventfd");
|
46
|
-
return
|
47
|
+
return T_EXIT_FAIL;
|
47
48
|
}
|
48
49
|
|
49
50
|
ret = io_uring_register_eventfd(&ring, evfd);
|
50
51
|
if (ret) {
|
51
52
|
fprintf(stderr, "failed to register evfd: %d\n", ret);
|
52
|
-
return
|
53
|
+
return T_EXIT_FAIL;
|
53
54
|
}
|
54
55
|
|
55
56
|
sqe = io_uring_get_sqe(&ring);
|
@@ -65,7 +66,7 @@ int main(int argc, char *argv[])
|
|
65
66
|
ret = io_uring_submit(&ring);
|
66
67
|
if (ret != 2) {
|
67
68
|
fprintf(stderr, "submit: %d\n", ret);
|
68
|
-
return
|
69
|
+
return T_EXIT_FAIL;
|
69
70
|
}
|
70
71
|
|
71
72
|
sqe = io_uring_get_sqe(&ring);
|
@@ -75,38 +76,38 @@ int main(int argc, char *argv[])
|
|
75
76
|
ret = io_uring_submit(&ring);
|
76
77
|
if (ret != 1) {
|
77
78
|
fprintf(stderr, "submit: %d\n", ret);
|
78
|
-
return
|
79
|
+
return T_EXIT_FAIL;
|
79
80
|
}
|
80
81
|
|
81
82
|
for (i = 0; i < 3; i++) {
|
82
83
|
ret = io_uring_wait_cqe(&ring, &cqe);
|
83
84
|
if (ret) {
|
84
85
|
fprintf(stderr, "wait: %d\n", ret);
|
85
|
-
return
|
86
|
+
return T_EXIT_FAIL;
|
86
87
|
}
|
87
88
|
switch (cqe->user_data) {
|
88
89
|
case 1:
|
89
90
|
/* POLLIN */
|
90
91
|
if (cqe->res != 1) {
|
91
92
|
fprintf(stderr, "poll: %d\n", cqe->res);
|
92
|
-
return
|
93
|
+
return T_EXIT_FAIL;
|
93
94
|
}
|
94
95
|
break;
|
95
96
|
case 2:
|
96
97
|
if (cqe->res != sizeof(ptr)) {
|
97
98
|
fprintf(stderr, "read: %d\n", cqe->res);
|
98
|
-
return
|
99
|
+
return T_EXIT_FAIL;
|
99
100
|
}
|
100
101
|
break;
|
101
102
|
case 3:
|
102
103
|
if (cqe->res) {
|
103
104
|
fprintf(stderr, "nop: %d\n", cqe->res);
|
104
|
-
return
|
105
|
+
return T_EXIT_FAIL;
|
105
106
|
}
|
106
107
|
break;
|
107
108
|
}
|
108
109
|
io_uring_cqe_seen(&ring, cqe);
|
109
110
|
}
|
110
111
|
|
111
|
-
return
|
112
|
+
return T_EXIT_PASS;
|
112
113
|
}
|
@@ -73,7 +73,7 @@ static int do_fadvise(struct io_uring *ring, int fd, off_t offset, off_t len,
|
|
73
73
|
if (ret == -EINVAL || ret == -EBADF) {
|
74
74
|
fprintf(stdout, "Fadvise not supported, skipping\n");
|
75
75
|
unlink(".fadvise.tmp");
|
76
|
-
exit(
|
76
|
+
exit(T_EXIT_SKIP);
|
77
77
|
} else if (ret) {
|
78
78
|
fprintf(stderr, "cqe->res=%d\n", cqe->res);
|
79
79
|
}
|
@@ -194,9 +194,9 @@ int main(int argc, char *argv[])
|
|
194
194
|
if (fname != argv[1])
|
195
195
|
unlink(fname);
|
196
196
|
io_uring_queue_exit(&ring);
|
197
|
-
return
|
197
|
+
return T_EXIT_PASS;
|
198
198
|
err:
|
199
199
|
if (fname != argv[1])
|
200
200
|
unlink(fname);
|
201
|
-
return
|
201
|
+
return T_EXIT_FAIL;
|
202
202
|
}
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#include <fcntl.h>
|
15
15
|
|
16
16
|
#include "liburing.h"
|
17
|
+
#include "helpers.h"
|
17
18
|
|
18
19
|
static int no_fallocate;
|
19
20
|
|
@@ -66,14 +67,15 @@ static int test_fallocate_rlimit(struct io_uring *ring)
|
|
66
67
|
if (cqe->res == -EINVAL) {
|
67
68
|
fprintf(stdout, "Fallocate not supported, skipping\n");
|
68
69
|
no_fallocate = 1;
|
69
|
-
goto
|
70
|
+
goto skip;
|
70
71
|
} else if (cqe->res != -EFBIG) {
|
71
72
|
fprintf(stderr, "Expected -EFBIG: %d\n", cqe->res);
|
72
73
|
goto err;
|
73
74
|
}
|
74
75
|
io_uring_cqe_seen(ring, cqe);
|
75
|
-
out:
|
76
76
|
return 0;
|
77
|
+
skip:
|
78
|
+
return T_EXIT_SKIP;
|
77
79
|
err:
|
78
80
|
return 1;
|
79
81
|
}
|
@@ -116,7 +118,7 @@ static int test_fallocate(struct io_uring *ring)
|
|
116
118
|
if (cqe->res == -EINVAL) {
|
117
119
|
fprintf(stdout, "Fallocate not supported, skipping\n");
|
118
120
|
no_fallocate = 1;
|
119
|
-
goto
|
121
|
+
goto skip;
|
120
122
|
}
|
121
123
|
if (cqe->res) {
|
122
124
|
fprintf(stderr, "cqe->res=%d\n", cqe->res);
|
@@ -135,8 +137,9 @@ static int test_fallocate(struct io_uring *ring)
|
|
135
137
|
goto err;
|
136
138
|
}
|
137
139
|
|
138
|
-
out:
|
139
140
|
return 0;
|
141
|
+
skip:
|
142
|
+
return T_EXIT_SKIP;
|
140
143
|
err:
|
141
144
|
return 1;
|
142
145
|
}
|
@@ -219,17 +222,19 @@ int main(int argc, char *argv[])
|
|
219
222
|
int ret;
|
220
223
|
|
221
224
|
if (argc > 1)
|
222
|
-
return
|
225
|
+
return T_EXIT_SKIP;
|
223
226
|
|
224
227
|
ret = io_uring_queue_init(8, &ring, 0);
|
225
228
|
if (ret) {
|
226
229
|
fprintf(stderr, "ring setup failed\n");
|
227
|
-
return
|
230
|
+
return T_EXIT_FAIL;
|
228
231
|
}
|
229
232
|
|
230
233
|
ret = test_fallocate(&ring);
|
231
234
|
if (ret) {
|
232
|
-
|
235
|
+
if (ret != T_EXIT_SKIP) {
|
236
|
+
fprintf(stderr, "test_fallocate failed\n");
|
237
|
+
}
|
233
238
|
return ret;
|
234
239
|
}
|
235
240
|
|
@@ -241,9 +246,11 @@ int main(int argc, char *argv[])
|
|
241
246
|
|
242
247
|
ret = test_fallocate_rlimit(&ring);
|
243
248
|
if (ret) {
|
244
|
-
|
249
|
+
if (ret != T_EXIT_SKIP) {
|
250
|
+
fprintf(stderr, "test_fallocate_rlimit failed\n");
|
251
|
+
}
|
245
252
|
return ret;
|
246
253
|
}
|
247
254
|
|
248
|
-
return
|
255
|
+
return T_EXIT_PASS;
|
249
256
|
}
|
@@ -16,6 +16,7 @@
|
|
16
16
|
#include <unistd.h>
|
17
17
|
|
18
18
|
#include "liburing.h"
|
19
|
+
#include "helpers.h"
|
19
20
|
#include "../src/syscall.h"
|
20
21
|
|
21
22
|
static bool write_file(const char* file, const char* what, ...)
|
@@ -83,11 +84,11 @@ uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
|
|
83
84
|
int main(int argc, char *argv[])
|
84
85
|
{
|
85
86
|
if (argc > 1)
|
86
|
-
return
|
87
|
+
return T_EXIT_SKIP;
|
87
88
|
mmap((void *) 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0);
|
88
89
|
if (setup_fault()) {
|
89
90
|
printf("Test needs failslab/fail_futex/fail_page_alloc enabled, skipped\n");
|
90
|
-
return
|
91
|
+
return T_EXIT_SKIP;
|
91
92
|
}
|
92
93
|
intptr_t res = 0;
|
93
94
|
*(uint32_t*)0x20000000 = 0;
|
@@ -127,5 +128,5 @@ int main(int argc, char *argv[])
|
|
127
128
|
*(uint32_t*)0x20000080 = r[1];
|
128
129
|
inject_fault(1);
|
129
130
|
__sys_io_uring_register(r[0], 2ul, (const void *) 0x20000080ul, 1ul);
|
130
|
-
return
|
131
|
+
return T_EXIT_PASS;
|
131
132
|
}
|