polyphony 0.94 → 0.96
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 +3 -3
- data/.github/workflows/test_io_uring.yml +4 -4
- data/.gitignore +3 -3
- data/CHANGELOG.md +19 -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/adapters/redis_blpop.rb +4 -3
- data/examples/adapters/redis_channels.rb +16 -7
- data/examples/core/await.rb +1 -1
- data/examples/io/readline.rb +19 -0
- data/ext/polyphony/backend_common.c +25 -3
- data/ext/polyphony/backend_io_uring.c +18 -16
- data/ext/polyphony/backend_libev.c +2 -2
- 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/adapters/readline.rb +6 -4
- data/lib/polyphony/adapters/redis.rb +28 -87
- data/lib/polyphony/core/channel.rb +15 -0
- data/lib/polyphony/core/sync.rb +4 -0
- data/lib/polyphony/debugger.rb +2 -2
- data/lib/polyphony/extensions/socket.rb +2 -0
- data/lib/polyphony/version.rb +1 -1
- data/lib/polyphony.rb +4 -0
- data/polyphony.gemspec +10 -10
- data/test/helper.rb +0 -5
- data/test/test_backend.rb +5 -1
- data/test/test_enumerator.rb +46 -0
- data/test/test_ext.rb +63 -0
- data/test/test_io.rb +241 -216
- data/test/test_socket.rb +1 -1
- data/test/test_thread_pool.rb +5 -5
- 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 +160 -52
- data/Gemfile.lock +0 -78
@@ -4,38 +4,58 @@
|
|
4
4
|
.\"
|
5
5
|
.TH io_uring_register_buffers 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
6
|
.SH NAME
|
7
|
-
io_uring_register_buffers
|
8
|
-
.fi
|
7
|
+
io_uring_register_buffers \- register buffers for fixed buffer operations
|
9
8
|
.SH SYNOPSIS
|
10
9
|
.nf
|
11
|
-
.
|
10
|
+
.B #include <liburing.h>
|
12
11
|
.PP
|
13
|
-
.BI "int io_uring_register_buffers(struct io_uring *ring,
|
14
|
-
.BI " const struct iovec *iovecs,
|
15
|
-
.BI " unsigned nr_iovecs)"
|
12
|
+
.BI "int io_uring_register_buffers(struct io_uring *" ring ",
|
13
|
+
.BI " const struct iovec *" iovecs ",
|
14
|
+
.BI " unsigned " nr_iovecs ");"
|
16
15
|
.PP
|
16
|
+
.BI "int io_uring_register_buffers_sparse(struct io_uring *" ring ",
|
17
|
+
.BI " unsigned " nr_iovecs ");"
|
18
|
+
.fi
|
17
19
|
.SH DESCRIPTION
|
18
20
|
.PP
|
19
|
-
The
|
21
|
+
The
|
22
|
+
.BR io_uring_register_buffers (3)
|
23
|
+
function registers
|
20
24
|
.I nr_iovecs
|
21
25
|
number of buffers defined by the array
|
22
26
|
.I iovecs
|
23
27
|
belonging to the
|
24
|
-
.
|
28
|
+
.IR ring .
|
29
|
+
|
30
|
+
The
|
31
|
+
.BR io_uring_register_buffers_sparse (3)
|
32
|
+
function registers
|
33
|
+
.I nr_iovecs
|
34
|
+
empty buffers belonging to the
|
35
|
+
.IR ring .
|
36
|
+
These buffers must be updated before use, using eg
|
37
|
+
.BR io_uring_register_buffers_update_tag (3).
|
25
38
|
|
26
39
|
After the caller has registered the buffers, they can be used with one of the
|
27
40
|
fixed buffers functions.
|
28
41
|
|
29
42
|
Registered buffers is an optimization that is useful in conjunction with
|
30
43
|
.B O_DIRECT
|
31
|
-
reads and writes, where maps the specified range into the kernel once when
|
32
|
-
the buffer is registered
|
44
|
+
reads and writes, where it maps the specified range into the kernel once when
|
45
|
+
the buffer is registered rather than doing a map and unmap for each IO
|
33
46
|
every time IO is performed to that region. Additionally, it also avoids
|
34
47
|
manipulating the page reference counts for each IO.
|
35
48
|
|
36
49
|
.SH RETURN VALUE
|
37
50
|
On success
|
38
51
|
.BR io_uring_register_buffers (3)
|
39
|
-
|
52
|
+
and
|
53
|
+
.BR io_uring_register_buffers_sparse (3)
|
54
|
+
return 0. On failure they return
|
55
|
+
.BR -errno .
|
40
56
|
.SH SEE ALSO
|
41
|
-
.BR io_uring_get_sqe (3),
|
57
|
+
.BR io_uring_get_sqe (3),
|
58
|
+
.BR io_uring_unregister_buffers (3),
|
59
|
+
.BR io_uring_register_buf_ring (3),
|
60
|
+
.BR io_uring_prep_read_fixed (3),
|
61
|
+
.BR io_uring_prep_write_fixed (3)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_eventfd 3 "April 16, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_eventfd \- register an eventfd with a ring
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "int io_uring_register_eventfd(struct io_uring *" ring ","
|
13
|
+
.BI " int " fd ");"
|
14
|
+
.PP
|
15
|
+
.BI "int io_uring_register_eventfd_async(struct io_uring *" ring ","
|
16
|
+
.BI " int " fd ");"
|
17
|
+
.PP
|
18
|
+
.BI "int io_uring_unregister_eventfd(struct io_uring *" ring ");"
|
19
|
+
.fi
|
20
|
+
.SH DESCRIPTION
|
21
|
+
.PP
|
22
|
+
.BR io_uring_register_eventfd (3)
|
23
|
+
registers the eventfd file descriptor
|
24
|
+
.I fd
|
25
|
+
with the ring identified by
|
26
|
+
.IR ring .
|
27
|
+
|
28
|
+
Whenever completions are posted to the CQ ring, an eventfd notification
|
29
|
+
is generated with the registered eventfd descriptor. If
|
30
|
+
.BR io_uring_register_eventfd_async (3)
|
31
|
+
is used, only events that completed out-of-line will trigger a notification.
|
32
|
+
|
33
|
+
It notifications are no longer desired,
|
34
|
+
.BR io_uring_unregister_eventfd (3)
|
35
|
+
may be called to remove the eventfd registration. No eventfd argument is
|
36
|
+
needed, as a ring can only have a single eventfd registered.
|
37
|
+
|
38
|
+
.SH NOTES
|
39
|
+
While io_uring generally takes care to avoid spurious events, they can occur.
|
40
|
+
Similarly, batched completions of CQEs may only trigger a single eventfd
|
41
|
+
notification even if multiple CQEs are posted. The application should make no
|
42
|
+
assumptions on number of events being available having a direct correlation to
|
43
|
+
eventfd notifications posted. An eventfd notification must thus only be treated
|
44
|
+
as a hint to check the CQ ring for completions.
|
45
|
+
.SH RETURN VALUE
|
46
|
+
Returns 0 on success, or
|
47
|
+
or
|
48
|
+
.BR -errno
|
49
|
+
on error.
|
50
|
+
.SH SEE ALSO
|
51
|
+
.BR eventfd (2)
|
@@ -0,0 +1 @@
|
|
1
|
+
io_uring_register_eventfd.3
|
@@ -0,0 +1,52 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_file_alloc_range 3 "Oct 21, 2022" "liburing-2.3" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_file_alloc_range \- set range for fixed file allocations
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "int io_uring_register_file_alloc_range(struct io_uring *" ring ",
|
13
|
+
.BI " unsigned " off ","
|
14
|
+
.BI " unsigned " len ");"
|
15
|
+
.BI "
|
16
|
+
.fi
|
17
|
+
.SH DESCRIPTION
|
18
|
+
.PP
|
19
|
+
The
|
20
|
+
.BR io_uring_register_file_alloc_range (3)
|
21
|
+
function sets the allowable range for fixed file index allocations within the
|
22
|
+
kernel. When requests that can instantiate a new fixed file are used with
|
23
|
+
.B IORING_FILE_INDEX_ALLOC ,
|
24
|
+
the application is asking the kernel to allocate a new fixed file descriptor
|
25
|
+
rather than pass in a specific value for one. By default, the kernel will
|
26
|
+
pick any available fixed file descriptor within the range available. Calling
|
27
|
+
this function with
|
28
|
+
.I off
|
29
|
+
set to the starting offset and
|
30
|
+
.I len
|
31
|
+
set to the number of descriptors, the application can limit the allocated
|
32
|
+
descriptors to that particular range. This effectively allows the application
|
33
|
+
to set aside a range just for dynamic allocations, with the remainder being
|
34
|
+
used for specific values.
|
35
|
+
|
36
|
+
The application must have registered a fixed file table upfront, eg through
|
37
|
+
.BR io_uring_register_files (3)
|
38
|
+
or
|
39
|
+
.BR io_uring_register_files_sparse (3) .
|
40
|
+
|
41
|
+
Available since 6.0.
|
42
|
+
|
43
|
+
.SH RETURN VALUE
|
44
|
+
On success
|
45
|
+
.BR io_uring_register_buf_ring (3)
|
46
|
+
returns 0. On failure it returns
|
47
|
+
.BR -errno .
|
48
|
+
.SH SEE ALSO
|
49
|
+
.BR io_uring_register_files (3)
|
50
|
+
.BR io_uring_prep_accept_direct (3)
|
51
|
+
.BR io_uring_prep_openat_direct (3)
|
52
|
+
.BR io_uring_prep_socket_direct (3)
|
@@ -4,19 +4,23 @@
|
|
4
4
|
.\"
|
5
5
|
.TH io_uring_register_files 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
6
|
.SH NAME
|
7
|
-
io_uring_register_files
|
8
|
-
.fi
|
7
|
+
io_uring_register_files \- register file descriptors
|
9
8
|
.SH SYNOPSIS
|
10
9
|
.nf
|
11
|
-
.
|
10
|
+
.B #include <liburing.h>
|
12
11
|
.PP
|
13
|
-
.BI "int io_uring_register_files(struct io_uring *ring,"
|
14
|
-
.BI " const int *files,"
|
15
|
-
.BI " unsigned nr_files)"
|
12
|
+
.BI "int io_uring_register_files(struct io_uring *" ring ","
|
13
|
+
.BI " const int *" files ","
|
14
|
+
.BI " unsigned " nr_files ");"
|
16
15
|
.PP
|
16
|
+
.BI "int io_uring_register_files_sparse(struct io_uring *" ring ","
|
17
|
+
.BI " unsigned " nr_files ");"
|
18
|
+
.fi
|
17
19
|
.SH DESCRIPTION
|
18
20
|
.PP
|
19
|
-
The
|
21
|
+
The
|
22
|
+
.BR io_uring_register_files (3)
|
23
|
+
function registers
|
20
24
|
.I nr_files
|
21
25
|
number of file descriptors defined by the array
|
22
26
|
.I files
|
@@ -24,12 +28,30 @@ belonging to the
|
|
24
28
|
.I ring
|
25
29
|
for subsequent operations.
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
The
|
32
|
+
.BR io_uring_register_files_sparse (3)
|
33
|
+
function registers an empty file table of
|
34
|
+
.I nr_files
|
35
|
+
number of file descriptors. The sparse variant is available in kernels 5.19
|
36
|
+
and later.
|
37
|
+
|
38
|
+
Registering a file table is a prerequisite for using any request that uses
|
39
|
+
direct descriptors.
|
40
|
+
|
41
|
+
Registered files have less overhead per operation than normal files. This
|
42
|
+
is due to the kernel grabbing a reference count on a file when an operation
|
43
|
+
begins, and dropping it when it's done. When the process file table is
|
44
|
+
shared, for example if the process has ever created any threads, then this
|
45
|
+
cost goes up even more. Using registered files reduces the overhead of
|
46
|
+
file reference management across requests that operate on a file.
|
29
47
|
|
30
48
|
.SH RETURN VALUE
|
31
49
|
On success
|
32
50
|
.BR io_uring_register_files (3)
|
33
|
-
|
51
|
+
and
|
52
|
+
.BR io_uring_register_files_sparse (3)
|
53
|
+
return 0. On failure they return
|
54
|
+
.BR -errno .
|
34
55
|
.SH SEE ALSO
|
35
|
-
.BR io_uring_get_sqe (3),
|
56
|
+
.BR io_uring_get_sqe (3),
|
57
|
+
.BR io_uring_unregister_files (3)
|
@@ -0,0 +1 @@
|
|
1
|
+
io_uring_register_files.3
|
@@ -0,0 +1,61 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_iowq_aff 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_iowq_aff \- register async worker CPU affinities
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <sched.h>
|
11
|
+
.B #include <liburing.h>
|
12
|
+
.PP
|
13
|
+
.BI "int io_uring_register_iowq_aff(struct io_uring *" ring ","
|
14
|
+
.BI " size_t " cpusz ","
|
15
|
+
.BI " const cpu_set_t *" mask ");
|
16
|
+
.PP
|
17
|
+
.BI "void io_uring_unregister_iowq_aff(struct io_uring *" ring ");"
|
18
|
+
.fi
|
19
|
+
.SH DESCRIPTION
|
20
|
+
.PP
|
21
|
+
The
|
22
|
+
.BR io_uring_prep_register_iowq_aff (3)
|
23
|
+
function registers a set of CPU affinities to be used by the io_uring async
|
24
|
+
workers. By default, io_uring async workers are allowed to run on any CPU in
|
25
|
+
the system. If this function is called with
|
26
|
+
.I ring
|
27
|
+
set to the ring in question and
|
28
|
+
.I mask
|
29
|
+
set to a pointer to a
|
30
|
+
.B cpu_set_t
|
31
|
+
value and
|
32
|
+
.I cpusz
|
33
|
+
set to the size of the CPU set, then async workers will only be allowed to run
|
34
|
+
on the CPUs specified in the mask. Existing workers may need to hit a schedule
|
35
|
+
point before they are migrated.
|
36
|
+
|
37
|
+
For unregistration,
|
38
|
+
.BR io_uring_unregister_iowq_aff (3)
|
39
|
+
may be called to restore CPU affinities to the default.
|
40
|
+
|
41
|
+
.SH RETURN VALUE
|
42
|
+
Returns
|
43
|
+
.B 0
|
44
|
+
on success, or any of the following values in case of error.
|
45
|
+
.TP
|
46
|
+
.B -EFAULT
|
47
|
+
The kernel was unable to copy the memory pointer to by
|
48
|
+
.I mask
|
49
|
+
as it was invalid.
|
50
|
+
.TP
|
51
|
+
.B -ENOMEM
|
52
|
+
The kernel was unable to allocate memory for the new CPU mask.
|
53
|
+
.TP
|
54
|
+
.B -EINVAL
|
55
|
+
.I cpusz
|
56
|
+
or
|
57
|
+
.I mask
|
58
|
+
was NULL/0, or any other value specified was invalid.
|
59
|
+
.SH SEE ALSO
|
60
|
+
.BR io_uring_queue_init (3),
|
61
|
+
.BR io_uring_register (2)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_iowq_max_workers 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_iowq_max_workers \- modify the maximum allowed async workers
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "int io_uring_register_iowq_max_workers(struct io_uring *" ring ","
|
13
|
+
.BI " unsigned int *" values ");"
|
14
|
+
.fi
|
15
|
+
.SH DESCRIPTION
|
16
|
+
.PP
|
17
|
+
io_uring async workers are split into two types:
|
18
|
+
.TP
|
19
|
+
.B Bounded
|
20
|
+
These workers have a bounded execution time. Examples of that are filesystem
|
21
|
+
reads, which normally complete in a relatively short amount of time. In case
|
22
|
+
of disk failures, they are still bounded by a timeout operation that will
|
23
|
+
abort them if exceeded.
|
24
|
+
.TP
|
25
|
+
.B Unbounded
|
26
|
+
Work items here may take an indefinite amount of time to complete. Examples
|
27
|
+
include doing IO to sockets, pipes, or any other non-regular type of file.
|
28
|
+
|
29
|
+
.PP
|
30
|
+
By default, the amount of bounded IO workers is limited to how many SQ entries
|
31
|
+
the ring was setup with, or 4 times the number of online CPUs in the system,
|
32
|
+
whichever is smaller. Unbounded workers are only limited by the process task
|
33
|
+
limit, as indicated by the rlimit
|
34
|
+
.B RLIMIT_NPROC
|
35
|
+
limit.
|
36
|
+
|
37
|
+
This can be modified by calling
|
38
|
+
.B io_uring_register_iowq_max_workers
|
39
|
+
with
|
40
|
+
.I ring
|
41
|
+
set to the ring in question, and
|
42
|
+
.I values
|
43
|
+
pointing to an array of two values. The first element should contain the number
|
44
|
+
of desired bounded workers, and the second element should contain the number
|
45
|
+
of desired unbounded workers. These are both maximum values, io_uring will
|
46
|
+
not maintain a high count of idle workers, they are reaped when they are not
|
47
|
+
necessary anymore.
|
48
|
+
|
49
|
+
If called with both values set to 0, the existing values are returned.
|
50
|
+
|
51
|
+
.SH RETURN VALUE
|
52
|
+
Returns
|
53
|
+
.B 0
|
54
|
+
on success, with
|
55
|
+
.I values
|
56
|
+
containing the previous values for the settings. On error, any of the following
|
57
|
+
may be returned.
|
58
|
+
.TP
|
59
|
+
.B -EFAULT
|
60
|
+
The kernel was unable to copy the memory pointer to by
|
61
|
+
.I values
|
62
|
+
as it was invalid.
|
63
|
+
.TP
|
64
|
+
.B -EINVAL
|
65
|
+
.I values
|
66
|
+
was
|
67
|
+
.B NULL
|
68
|
+
or the new values exceeded the maximum allowed value.
|
69
|
+
.SH SEE ALSO
|
70
|
+
.BR io_uring_queue_init (3),
|
71
|
+
.BR io_uring_register (2)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_ring_fd 3 "March 11, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_ring_fd \- register a ring file descriptor
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "int io_uring_register_ring_fd(struct io_uring *" ring ");"
|
13
|
+
.fi
|
14
|
+
.SH DESCRIPTION
|
15
|
+
.PP
|
16
|
+
.BR io_uring_register_ring_fd (3)
|
17
|
+
registers the file descriptor of the ring.
|
18
|
+
|
19
|
+
Whenever
|
20
|
+
.BR io_uring_enter (2)
|
21
|
+
is called to submit request or wait for completions, the kernel must grab a
|
22
|
+
reference to the file descriptor. If the application using io_uring is threaded,
|
23
|
+
the file table is marked as shared, and the reference grab and put of the file
|
24
|
+
descriptor count is more expensive than it is for a non-threaded application.
|
25
|
+
|
26
|
+
Similarly to how io_uring allows registration of files, this allow registration
|
27
|
+
of the ring file descriptor itself. This reduces the overhead of the
|
28
|
+
.BR io_uring_enter (2)
|
29
|
+
system call.
|
30
|
+
|
31
|
+
If an application using liburing is threaded, then an application should call
|
32
|
+
this function to register the ring descriptor when a ring is set up. See NOTES
|
33
|
+
for restrictions when a ring is shared.
|
34
|
+
|
35
|
+
.SH NOTES
|
36
|
+
When the ring descriptor is registered, it is stored internally in the
|
37
|
+
.I struct io_uring
|
38
|
+
structure. For applications that share a ring between threads, for example
|
39
|
+
having one thread do submits and another reap events, then this optimization
|
40
|
+
cannot be used as each thread may have a different index for the registered
|
41
|
+
ring fd.
|
42
|
+
.SH RETURN VALUE
|
43
|
+
Returns 1 on success, indicating that one file descriptor was registered,
|
44
|
+
or
|
45
|
+
.BR -errno
|
46
|
+
on error.
|
47
|
+
.SH SEE ALSO
|
48
|
+
.BR io_uring_unregister_ring_fd (3),
|
49
|
+
.BR io_uring_register_files (3)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_register_sync_cancel 3 "September 21, 2022" "liburing-2.3" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_register_sync_cancel \- issue a synchronous cancelation request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "int io_uring_register_sync_cancel(struct io_uring *" ring ",
|
13
|
+
.BI " struct io_uring_sync_cancel_reg *" reg ");
|
14
|
+
.PP
|
15
|
+
.SH DESCRIPTION
|
16
|
+
.PP
|
17
|
+
The
|
18
|
+
.BR io_uring_register_sync_cancel (3)
|
19
|
+
function performs a synchronous cancelation request based on the parameters
|
20
|
+
specified in
|
21
|
+
.I reg .
|
22
|
+
|
23
|
+
The
|
24
|
+
.I reg
|
25
|
+
argument must be filled in with the appropriate information for the
|
26
|
+
cancelation request. It looks as follows:
|
27
|
+
.PP
|
28
|
+
.in +4n
|
29
|
+
.EX
|
30
|
+
struct io_uring_sync_cancel_reg {
|
31
|
+
__u64 addr;
|
32
|
+
__s32 fd;
|
33
|
+
__u32 flags;
|
34
|
+
struct __kernel_timespec timeout;
|
35
|
+
__u64 pad[4];
|
36
|
+
};
|
37
|
+
.EE
|
38
|
+
.in
|
39
|
+
.PP
|
40
|
+
|
41
|
+
The arguments largely mirror what the async prep functions support, see
|
42
|
+
.BR io_uring_prep_cancel (3)
|
43
|
+
for details. Similarly, the return value is the same. The exception is the
|
44
|
+
.I timeout
|
45
|
+
argument, which can be used to limit the time that the kernel will wait for
|
46
|
+
cancelations to be successful. If the
|
47
|
+
.I tv_sec
|
48
|
+
and
|
49
|
+
.I tv_nsec
|
50
|
+
values are set to anything but
|
51
|
+
.B -1UL ,
|
52
|
+
then they indicate a relative timeout upon which cancelations should be
|
53
|
+
completed by.
|
54
|
+
|
55
|
+
The
|
56
|
+
.I pad
|
57
|
+
values must be zero filled.
|
58
|
+
|
59
|
+
.SH RETURN VALUE
|
60
|
+
See
|
61
|
+
.BR io_uring_prep_cancel (3)
|
62
|
+
for details on the return value. If
|
63
|
+
.I timeout
|
64
|
+
is set to indicate a timeout, then
|
65
|
+
.B -ETIME
|
66
|
+
will be returned if exceeded. If an unknown value is set in the request,
|
67
|
+
or if the pad values are not cleared to zero, then
|
68
|
+
.I -EINVAL
|
69
|
+
is returned.
|
70
|
+
.SH SEE ALSO
|
71
|
+
.BR io_uring_prep_cancel (3)
|