polyphony 0.94 → 0.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.gitignore +3 -3
- data/CHANGELOG.md +14 -0
- data/docs/api-reference/fiber.md +2 -2
- data/docs/api-reference/object.md +3 -3
- data/docs/main-concepts/exception-handling.md +2 -2
- data/ext/polyphony/backend_common.c +3 -3
- data/ext/polyphony/backend_io_uring.c +18 -16
- data/ext/polyphony/event.c +1 -1
- data/ext/polyphony/extconf.rb +5 -3
- data/ext/polyphony/fiber.c +5 -13
- data/ext/polyphony/io_extensions.c +1 -1
- data/ext/polyphony/pipe.c +1 -1
- data/ext/polyphony/polyphony.c +1 -1
- data/ext/polyphony/polyphony_ext.c +1 -1
- data/ext/polyphony/queue.c +1 -1
- data/ext/polyphony/ring_buffer.c +1 -0
- data/ext/polyphony/socket_extensions.c +1 -1
- data/ext/polyphony/thread.c +1 -1
- data/lib/polyphony/extensions/enumerator.rb +16 -0
- data/lib/polyphony/extensions/socket.rb +2 -0
- data/lib/polyphony/extensions.rb +1 -0
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +2 -2
- data/test/test_backend.rb +5 -1
- data/test/test_enumerator.rb +46 -0
- data/test/test_io.rb +241 -216
- data/test/test_socket.rb +1 -1
- data/test/test_thread_pool.rb +3 -3
- data/vendor/liburing/.github/workflows/build.yml +51 -5
- data/vendor/liburing/.github/workflows/shellcheck.yml +1 -1
- data/vendor/liburing/.gitignore +6 -123
- data/vendor/liburing/CHANGELOG +35 -0
- data/vendor/liburing/CITATION.cff +11 -0
- data/vendor/liburing/LICENSE +16 -3
- data/vendor/liburing/Makefile +3 -1
- data/vendor/liburing/Makefile.common +1 -0
- data/vendor/liburing/README +14 -2
- data/vendor/liburing/SECURITY.md +6 -0
- data/vendor/liburing/configure +16 -15
- data/vendor/liburing/examples/Makefile +4 -1
- data/vendor/liburing/examples/io_uring-udp.c +395 -0
- data/vendor/liburing/examples/poll-bench.c +101 -0
- data/vendor/liburing/examples/send-zerocopy.c +339 -0
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/man/io_uring.7 +38 -11
- data/vendor/liburing/man/io_uring_buf_ring_add.3 +53 -0
- data/vendor/liburing/man/io_uring_buf_ring_advance.3 +31 -0
- data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +41 -0
- data/vendor/liburing/man/io_uring_buf_ring_init.3 +30 -0
- data/vendor/liburing/man/io_uring_buf_ring_mask.3 +27 -0
- data/vendor/liburing/man/io_uring_cq_advance.3 +29 -15
- data/vendor/liburing/man/io_uring_cq_has_overflow.3 +25 -0
- data/vendor/liburing/man/io_uring_cq_ready.3 +9 -8
- data/vendor/liburing/man/io_uring_cqe_get_data.3 +32 -13
- data/vendor/liburing/man/io_uring_cqe_get_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_cqe_seen.3 +22 -12
- data/vendor/liburing/man/io_uring_enter.2 +249 -32
- data/vendor/liburing/man/io_uring_enter2.2 +1 -0
- data/vendor/liburing/man/io_uring_free_probe.3 +11 -8
- data/vendor/liburing/man/io_uring_get_events.3 +33 -0
- data/vendor/liburing/man/io_uring_get_probe.3 +9 -8
- data/vendor/liburing/man/io_uring_get_sqe.3 +29 -10
- data/vendor/liburing/man/io_uring_opcode_supported.3 +11 -10
- data/vendor/liburing/man/io_uring_peek_cqe.3 +38 -0
- data/vendor/liburing/man/io_uring_prep_accept.3 +197 -0
- data/vendor/liburing/man/io_uring_prep_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_cancel.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_cancel64.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_close.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_close_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_connect.3 +66 -0
- data/vendor/liburing/man/io_uring_prep_fadvise.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_fallocate.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_files_update.3 +92 -0
- data/vendor/liburing/man/io_uring_prep_fsync.3 +70 -0
- data/vendor/liburing/man/io_uring_prep_link.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_linkat.3 +91 -0
- data/vendor/liburing/man/io_uring_prep_madvise.3 +56 -0
- data/vendor/liburing/man/io_uring_prep_mkdir.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_mkdirat.3 +83 -0
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +39 -25
- data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_nop.3 +28 -0
- data/vendor/liburing/man/io_uring_prep_openat.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_openat_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_add.3 +72 -0
- data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_remove.3 +55 -0
- data/vendor/liburing/man/io_uring_prep_poll_update.3 +89 -0
- data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +131 -0
- data/vendor/liburing/man/io_uring_prep_read.3 +33 -14
- data/vendor/liburing/man/io_uring_prep_read_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_readv.3 +49 -15
- data/vendor/liburing/man/io_uring_prep_readv2.3 +49 -17
- data/vendor/liburing/man/io_uring_prep_recv.3 +105 -0
- data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg.3 +124 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +52 -0
- data/vendor/liburing/man/io_uring_prep_rename.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_renameat.3 +96 -0
- data/vendor/liburing/man/io_uring_prep_send.3 +57 -0
- data/vendor/liburing/man/io_uring_prep_send_zc.3 +64 -0
- data/vendor/liburing/man/io_uring_prep_sendmsg.3 +69 -0
- data/vendor/liburing/man/io_uring_prep_shutdown.3 +53 -0
- data/vendor/liburing/man/io_uring_prep_socket.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_splice.3 +80 -0
- data/vendor/liburing/man/io_uring_prep_statx.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_symlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_symlinkat.3 +85 -0
- data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_tee.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_timeout.3 +95 -0
- data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_timeout_update.3 +98 -0
- data/vendor/liburing/man/io_uring_prep_unlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_unlinkat.3 +82 -0
- data/vendor/liburing/man/io_uring_prep_write.3 +32 -15
- data/vendor/liburing/man/io_uring_prep_write_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_writev.3 +50 -16
- data/vendor/liburing/man/io_uring_prep_writev2.3 +50 -17
- data/vendor/liburing/man/io_uring_queue_exit.3 +3 -4
- data/vendor/liburing/man/io_uring_queue_init.3 +58 -13
- data/vendor/liburing/man/io_uring_queue_init_params.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_name.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_out.3 +78 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_validate.3 +1 -0
- data/vendor/liburing/man/io_uring_register.2 +153 -13
- data/vendor/liburing/man/io_uring_register_buf_ring.3 +140 -0
- data/vendor/liburing/man/io_uring_register_buffers.3 +32 -12
- data/vendor/liburing/man/io_uring_register_eventfd.3 +51 -0
- data/vendor/liburing/man/io_uring_register_eventfd_async.3 +1 -0
- data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +52 -0
- data/vendor/liburing/man/io_uring_register_files.3 +33 -11
- data/vendor/liburing/man/io_uring_register_files_sparse.3 +1 -0
- data/vendor/liburing/man/io_uring_register_iowq_aff.3 +61 -0
- data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +71 -0
- data/vendor/liburing/man/io_uring_register_ring_fd.3 +49 -0
- data/vendor/liburing/man/io_uring_register_sync_cancel.3 +71 -0
- data/vendor/liburing/man/io_uring_setup.2 +119 -13
- data/vendor/liburing/man/io_uring_sq_ready.3 +14 -8
- data/vendor/liburing/man/io_uring_sq_space_left.3 +9 -9
- data/vendor/liburing/man/io_uring_sqe_set_data.3 +29 -11
- data/vendor/liburing/man/io_uring_sqe_set_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_sqe_set_flags.3 +38 -11
- data/vendor/liburing/man/io_uring_sqring_wait.3 +13 -9
- data/vendor/liburing/man/io_uring_submit.3 +29 -12
- data/vendor/liburing/man/io_uring_submit_and_get_events.3 +31 -0
- data/vendor/liburing/man/io_uring_submit_and_wait.3 +16 -12
- data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +30 -23
- data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +30 -0
- data/vendor/liburing/man/io_uring_unregister_buffers.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_eventfd.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_files.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +32 -0
- data/vendor/liburing/man/io_uring_wait_cqe.3 +19 -12
- data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +21 -14
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +27 -13
- data/vendor/liburing/man/io_uring_wait_cqes.3 +24 -14
- data/vendor/liburing/src/Makefile +8 -7
- data/vendor/liburing/src/arch/aarch64/lib.h +48 -0
- data/vendor/liburing/src/arch/aarch64/syscall.h +0 -4
- data/vendor/liburing/src/arch/generic/lib.h +0 -4
- data/vendor/liburing/src/arch/generic/syscall.h +29 -16
- data/vendor/liburing/src/arch/syscall-defs.h +41 -14
- data/vendor/liburing/src/arch/x86/lib.h +0 -21
- data/vendor/liburing/src/arch/x86/syscall.h +146 -10
- data/vendor/liburing/src/include/liburing/io_uring.h +245 -5
- data/vendor/liburing/src/include/liburing.h +468 -35
- data/vendor/liburing/src/int_flags.h +1 -0
- data/vendor/liburing/src/lib.h +20 -16
- data/vendor/liburing/src/liburing.map +16 -0
- data/vendor/liburing/src/nolibc.c +1 -1
- data/vendor/liburing/src/queue.c +87 -55
- data/vendor/liburing/src/register.c +129 -53
- data/vendor/liburing/src/setup.c +65 -28
- data/vendor/liburing/src/syscall.c +14 -32
- data/vendor/liburing/src/syscall.h +12 -64
- data/vendor/liburing/test/{232c93d07b74-test.c → 232c93d07b74.c} +8 -9
- data/vendor/liburing/test/{35fa71a030ca-test.c → 35fa71a030ca.c} +4 -4
- data/vendor/liburing/test/{500f9fbadef8-test.c → 500f9fbadef8.c} +7 -7
- data/vendor/liburing/test/{7ad0e4b2f83c-test.c → 7ad0e4b2f83c.c} +8 -7
- data/vendor/liburing/test/{8a9973408177-test.c → 8a9973408177.c} +4 -3
- data/vendor/liburing/test/{917257daa0fe-test.c → 917257daa0fe.c} +3 -2
- data/vendor/liburing/test/Makefile +60 -62
- data/vendor/liburing/test/{a0908ae19763-test.c → a0908ae19763.c} +3 -2
- data/vendor/liburing/test/{a4c0b3decb33-test.c → a4c0b3decb33.c} +3 -2
- data/vendor/liburing/test/accept-link.c +5 -4
- data/vendor/liburing/test/accept-reuse.c +17 -16
- data/vendor/liburing/test/accept-test.c +14 -10
- data/vendor/liburing/test/accept.c +529 -107
- data/vendor/liburing/test/across-fork.c +7 -6
- data/vendor/liburing/test/{b19062a56726-test.c → b19062a56726.c} +3 -2
- data/vendor/liburing/test/{b5837bd5311d-test.c → b5837bd5311d.c} +10 -9
- data/vendor/liburing/test/buf-ring.c +420 -0
- data/vendor/liburing/test/{ce593a6c480a-test.c → ce593a6c480a.c} +15 -12
- data/vendor/liburing/test/connect.c +8 -7
- data/vendor/liburing/test/cq-full.c +5 -4
- data/vendor/liburing/test/cq-overflow.c +242 -12
- data/vendor/liburing/test/cq-peek-batch.c +5 -4
- data/vendor/liburing/test/cq-ready.c +5 -4
- data/vendor/liburing/test/cq-size.c +5 -4
- data/vendor/liburing/test/{d4ae271dfaae-test.c → d4ae271dfaae.c} +2 -2
- data/vendor/liburing/test/{d77a67ed5f27-test.c → d77a67ed5f27.c} +6 -6
- data/vendor/liburing/test/defer-taskrun.c +336 -0
- data/vendor/liburing/test/defer.c +26 -14
- data/vendor/liburing/test/double-poll-crash.c +15 -5
- data/vendor/liburing/test/drop-submit.c +5 -3
- data/vendor/liburing/test/{eeed8b54e0df-test.c → eeed8b54e0df.c} +7 -6
- data/vendor/liburing/test/empty-eownerdead.c +4 -4
- data/vendor/liburing/test/eventfd-disable.c +48 -20
- data/vendor/liburing/test/eventfd-reg.c +10 -9
- data/vendor/liburing/test/eventfd-ring.c +13 -12
- data/vendor/liburing/test/eventfd.c +13 -12
- data/vendor/liburing/test/exit-no-cleanup.c +1 -1
- data/vendor/liburing/test/fadvise.c +3 -3
- data/vendor/liburing/test/fallocate.c +16 -9
- data/vendor/liburing/test/{fc2a85cb02ef-test.c → fc2a85cb02ef.c} +4 -3
- data/vendor/liburing/test/fd-pass.c +187 -0
- data/vendor/liburing/test/file-register.c +302 -36
- data/vendor/liburing/test/file-update.c +62 -4
- data/vendor/liburing/test/file-verify.c +6 -2
- data/vendor/liburing/test/files-exit-hang-poll.c +11 -25
- data/vendor/liburing/test/files-exit-hang-timeout.c +13 -10
- data/vendor/liburing/test/fixed-buf-iter.c +115 -0
- data/vendor/liburing/test/fixed-link.c +10 -10
- data/vendor/liburing/test/fixed-reuse.c +160 -0
- data/vendor/liburing/test/fpos.c +6 -3
- data/vendor/liburing/test/fsync.c +3 -3
- data/vendor/liburing/test/hardlink.c +10 -6
- data/vendor/liburing/test/helpers.c +137 -4
- data/vendor/liburing/test/helpers.h +27 -0
- data/vendor/liburing/test/io-cancel.c +16 -11
- data/vendor/liburing/test/io_uring_enter.c +46 -81
- data/vendor/liburing/test/io_uring_passthrough.c +451 -0
- data/vendor/liburing/test/io_uring_register.c +59 -229
- data/vendor/liburing/test/io_uring_setup.c +24 -29
- data/vendor/liburing/test/iopoll-leak.c +85 -0
- data/vendor/liburing/test/iopoll.c +16 -9
- data/vendor/liburing/test/lfs-openat-write.c +3 -1
- data/vendor/liburing/test/link-timeout.c +4 -3
- data/vendor/liburing/test/link.c +8 -7
- data/vendor/liburing/test/madvise.c +2 -2
- data/vendor/liburing/test/mkdir.c +9 -5
- data/vendor/liburing/test/msg-ring.c +46 -20
- data/vendor/liburing/test/multicqes_drain.c +51 -12
- data/vendor/liburing/test/nolibc.c +60 -0
- data/vendor/liburing/test/nop.c +78 -16
- data/vendor/liburing/test/nvme.h +168 -0
- data/vendor/liburing/test/open-direct-link.c +188 -0
- data/vendor/liburing/test/open-direct-pick.c +180 -0
- data/vendor/liburing/test/openat2.c +3 -3
- data/vendor/liburing/test/poll-cancel-all.c +472 -0
- data/vendor/liburing/test/poll-link.c +9 -18
- data/vendor/liburing/test/poll-mshot-overflow.c +162 -0
- data/vendor/liburing/test/poll-mshot-update.c +83 -33
- data/vendor/liburing/test/pollfree.c +2 -2
- data/vendor/liburing/test/read-before-exit.c +112 -0
- data/vendor/liburing/test/read-write.c +83 -1
- data/vendor/liburing/test/recv-msgall-stream.c +398 -0
- data/vendor/liburing/test/recv-msgall.c +265 -0
- data/vendor/liburing/test/recv-multishot.c +505 -0
- data/vendor/liburing/test/rename.c +2 -5
- data/vendor/liburing/test/ring-leak.c +97 -0
- data/vendor/liburing/test/ringbuf-read.c +200 -0
- data/vendor/liburing/test/rsrc_tags.c +25 -13
- data/vendor/liburing/test/runtests-quiet.sh +11 -0
- data/vendor/liburing/test/runtests.sh +18 -20
- data/vendor/liburing/test/rw_merge_test.c +3 -2
- data/vendor/liburing/test/send-zerocopy.c +684 -0
- data/vendor/liburing/test/send_recv.c +49 -2
- data/vendor/liburing/test/send_recvmsg.c +165 -55
- data/vendor/liburing/test/shutdown.c +3 -4
- data/vendor/liburing/test/sigfd-deadlock.c +22 -8
- data/vendor/liburing/test/single-issuer.c +171 -0
- data/vendor/liburing/test/socket-rw-eagain.c +2 -12
- data/vendor/liburing/test/socket-rw-offset.c +2 -11
- data/vendor/liburing/test/socket-rw.c +2 -11
- data/vendor/liburing/test/socket.c +409 -0
- data/vendor/liburing/test/sq-poll-dup.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +1 -1
- data/vendor/liburing/test/statx.c +2 -2
- data/vendor/liburing/test/submit-and-wait.c +108 -0
- data/vendor/liburing/test/submit-link-fail.c +5 -3
- data/vendor/liburing/test/submit-reuse.c +0 -2
- data/vendor/liburing/test/sync-cancel.c +235 -0
- data/vendor/liburing/test/test.h +35 -0
- data/vendor/liburing/test/timeout-overflow.c +11 -11
- data/vendor/liburing/test/timeout.c +7 -7
- data/vendor/liburing/test/tty-write-dpoll.c +60 -0
- data/vendor/liburing/test/unlink.c +1 -1
- data/vendor/liburing/test/xattr.c +425 -0
- metadata +143 -22
- data/Gemfile.lock +0 -78
@@ -0,0 +1,117 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_openat 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_openat \- prepare an openat request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <sys/types.h>
|
11
|
+
.B #include <sys/stat.h>
|
12
|
+
.B #include <fcntl.h>
|
13
|
+
.B #include <liburing.h>
|
14
|
+
.PP
|
15
|
+
.BI "void io_uring_prep_openat(struct io_uring_sqe *" sqe ","
|
16
|
+
.BI " int " dfd ","
|
17
|
+
.BI " const char *" path ","
|
18
|
+
.BI " int " flags ","
|
19
|
+
.BI " mode_t " mode ");"
|
20
|
+
.PP
|
21
|
+
.BI "void io_uring_prep_openat_direct(struct io_uring_sqe *" sqe ","
|
22
|
+
.BI " int " dfd ","
|
23
|
+
.BI " const char *" path ","
|
24
|
+
.BI " int " flags ","
|
25
|
+
.BI " mode_t " mode ","
|
26
|
+
.BI " unsigned " file_index ");"
|
27
|
+
.fi
|
28
|
+
.SH DESCRIPTION
|
29
|
+
.PP
|
30
|
+
The
|
31
|
+
.BR io_uring_prep_openat (3)
|
32
|
+
function prepares an openat request. The submission queue entry
|
33
|
+
.I sqe
|
34
|
+
is setup to use the directory file descriptor
|
35
|
+
.I dfd
|
36
|
+
to start opening a file described by
|
37
|
+
.I path
|
38
|
+
and using the open flags in
|
39
|
+
.I flags
|
40
|
+
and using the file mode bits specified in
|
41
|
+
.IR mode .
|
42
|
+
|
43
|
+
For a direct descriptor open request, the offset is specified by the
|
44
|
+
.I file_index
|
45
|
+
argument. Direct descriptors are io_uring private file descriptors. They
|
46
|
+
avoid some of the overhead associated with thread shared file tables, and
|
47
|
+
can be used in any io_uring request that takes a file descriptor. To do so,
|
48
|
+
.B IOSQE_FIXED_FILE
|
49
|
+
must be set in the SQE
|
50
|
+
.I flags
|
51
|
+
member, and the SQE
|
52
|
+
.I fd
|
53
|
+
field should use the direct descriptor value rather than the regular file
|
54
|
+
descriptor. Direct descriptors are managed like registered files.
|
55
|
+
|
56
|
+
If the direct variant is used, the application must first have registered
|
57
|
+
a file table using
|
58
|
+
.BR io_uring_register_files (3)
|
59
|
+
of the appropriate size. Once registered, a direct accept request may use any
|
60
|
+
entry in that table, as long as it is within the size of the registered table.
|
61
|
+
If a specified entry already contains a file, the file will first be removed
|
62
|
+
from the table and closed. It's consistent with the behavior of updating an
|
63
|
+
existing file with
|
64
|
+
.BR io_uring_register_files_update (3).
|
65
|
+
Note that old kernels don't check the SQE
|
66
|
+
.I file_index
|
67
|
+
field, which is not a problem for liburing helpers, but users of the raw
|
68
|
+
io_uring interface need to zero SQEs to avoid unexpected behavior.
|
69
|
+
|
70
|
+
If
|
71
|
+
.B IORING_FILE_INDEX_ALLOC
|
72
|
+
is used as the
|
73
|
+
.I file_index
|
74
|
+
for a direct open, then io_uring will allocate a free direct descriptor in
|
75
|
+
the existing table. The allocated descriptor is returned in the CQE
|
76
|
+
.I res
|
77
|
+
field just like it would be for a non-direct open request. If no more entries
|
78
|
+
are available in the direct descriptor table,
|
79
|
+
.B -ENFILE
|
80
|
+
is returned instead.
|
81
|
+
|
82
|
+
These functions prepare an async
|
83
|
+
.BR openat (2)
|
84
|
+
request. See that man page for details.
|
85
|
+
|
86
|
+
.SH RETURN VALUE
|
87
|
+
None
|
88
|
+
.SH ERRORS
|
89
|
+
The CQE
|
90
|
+
.I res
|
91
|
+
field will contain the result of the operation. See the related man page for
|
92
|
+
details on possible values. Note that where synchronous system calls will return
|
93
|
+
.B -1
|
94
|
+
on failure and set
|
95
|
+
.I errno
|
96
|
+
to the actual error value, io_uring never uses
|
97
|
+
.IR errno .
|
98
|
+
Instead it returns the negated
|
99
|
+
.I errno
|
100
|
+
directly in the CQE
|
101
|
+
.I res
|
102
|
+
field.
|
103
|
+
.SH NOTES
|
104
|
+
As with any request that passes in data in a struct, that data must remain
|
105
|
+
valid until the request has been successfully submitted. It need not remain
|
106
|
+
valid until completion. Once a request has been submitted, the in-kernel
|
107
|
+
state is stable. Very early kernels (5.4 and earlier) required state to be
|
108
|
+
stable until the completion occurred. Applications can test for this
|
109
|
+
behavior by inspecting the
|
110
|
+
.B IORING_FEAT_SUBMIT_STABLE
|
111
|
+
flag passed back from
|
112
|
+
.BR io_uring_queue_init_params (3).
|
113
|
+
.SH SEE ALSO
|
114
|
+
.BR io_uring_get_sqe (3),
|
115
|
+
.BR io_uring_submit (3),
|
116
|
+
.BR io_uring_register (2),
|
117
|
+
.BR openat (2)
|
@@ -0,0 +1,117 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_openat2 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_openat2 \- prepare an openat2 request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <sys/types.h>
|
11
|
+
.B #include <sys/stat.h>
|
12
|
+
.B #include <fcntl.h>
|
13
|
+
.B #include <linux/openat2.h>
|
14
|
+
.B #include <liburing.h>
|
15
|
+
.PP
|
16
|
+
.BI "void io_uring_prep_openat2(struct io_uring_sqe *" sqe ","
|
17
|
+
.BI " int " dfd ","
|
18
|
+
.BI " const char *" path ","
|
19
|
+
.BI " int " flags ","
|
20
|
+
.BI " struct open_how *" how ");"
|
21
|
+
.PP
|
22
|
+
.BI "void io_uring_prep_openat2_direct(struct io_uring_sqe *" sqe ","
|
23
|
+
.BI " int " dfd ","
|
24
|
+
.BI " const char *" path ","
|
25
|
+
.BI " int " flags ","
|
26
|
+
.BI " struct open_how *" how ","
|
27
|
+
.BI " unsigned " file_index ");"
|
28
|
+
.fi
|
29
|
+
.SH DESCRIPTION
|
30
|
+
.PP
|
31
|
+
The
|
32
|
+
.BR io_uring_prep_openat2 (3)
|
33
|
+
function prepares an openat2 request. The submission queue entry
|
34
|
+
.I sqe
|
35
|
+
is setup to use the directory file descriptor
|
36
|
+
.I dfd
|
37
|
+
to start opening a file described by
|
38
|
+
.I path
|
39
|
+
and using the open flags in
|
40
|
+
.I flags
|
41
|
+
and using the instructions on how to open the file given in
|
42
|
+
.IR how .
|
43
|
+
|
44
|
+
For a direct descriptor open request, the offset is specified by the
|
45
|
+
.I file_index
|
46
|
+
argument. Direct descriptors are io_uring private file descriptors. They
|
47
|
+
avoid some of the overhead associated with thread shared file tables, and
|
48
|
+
can be used in any io_uring request that takes a file descriptor. To do so,
|
49
|
+
.B IOSQE_FIXED_FILE
|
50
|
+
must be set in the SQE
|
51
|
+
.I flags
|
52
|
+
member, and the SQE
|
53
|
+
.I fd
|
54
|
+
field should use the direct descriptor value rather than the regular file
|
55
|
+
descriptor. Direct descriptors are managed like registered files.
|
56
|
+
|
57
|
+
If the direct variant is used, the application must first have registered
|
58
|
+
a file table using
|
59
|
+
.BR io_uring_register_files (3)
|
60
|
+
of the appropriate size. Once registered, a direct accept request may use any
|
61
|
+
entry in that table, as long as it is within the size of the registered table.
|
62
|
+
If a specified entry already contains a file, the file will first be removed
|
63
|
+
from the table and closed. It's consistent with the behavior of updating an
|
64
|
+
existing file with
|
65
|
+
.BR io_uring_register_files_update (3).
|
66
|
+
Note that old kernels don't check the SQE
|
67
|
+
.I file_index
|
68
|
+
field, which is not a problem for liburing helpers, but users of the raw
|
69
|
+
io_uring interface need to zero SQEs to avoid unexpected behavior.
|
70
|
+
If
|
71
|
+
.B IORING_FILE_INDEX_ALLOC
|
72
|
+
is used as the
|
73
|
+
.I file_index
|
74
|
+
for a direct open, then io_uring will allocate a free direct descriptor in
|
75
|
+
the existing table. The allocated descriptor is returned in the CQE
|
76
|
+
.I res
|
77
|
+
field just like it would be for a non-direct open request. If no more entries
|
78
|
+
are available in the direct descriptor table,
|
79
|
+
.B -ENFILE
|
80
|
+
is returned instead.
|
81
|
+
|
82
|
+
These functions prepare an async
|
83
|
+
.BR openat2 (2)
|
84
|
+
request. See that man page for details.
|
85
|
+
|
86
|
+
.SH RETURN VALUE
|
87
|
+
None
|
88
|
+
.SH ERRORS
|
89
|
+
The CQE
|
90
|
+
.I res
|
91
|
+
field will contain the result of the operation. See the related man page for
|
92
|
+
details on possible values. Note that where synchronous system calls will return
|
93
|
+
.B -1
|
94
|
+
on failure and set
|
95
|
+
.I errno
|
96
|
+
to the actual error value, io_uring never uses
|
97
|
+
.IR errno .
|
98
|
+
Instead it returns the negated
|
99
|
+
.I errno
|
100
|
+
directly in the CQE
|
101
|
+
.I res
|
102
|
+
field.
|
103
|
+
.SH NOTES
|
104
|
+
As with any request that passes in data in a struct, that data must remain
|
105
|
+
valid until the request has been successfully submitted. It need not remain
|
106
|
+
valid until completion. Once a request has been submitted, the in-kernel
|
107
|
+
state is stable. Very early kernels (5.4 and earlier) required state to be
|
108
|
+
stable until the completion occurred. Applications can test for this
|
109
|
+
behavior by inspecting the
|
110
|
+
.B IORING_FEAT_SUBMIT_STABLE
|
111
|
+
flag passed back from
|
112
|
+
.BR io_uring_queue_init_params (3).
|
113
|
+
.SH SEE ALSO
|
114
|
+
.BR io_uring_get_sqe (3),
|
115
|
+
.BR io_uring_submit (3),
|
116
|
+
.BR io_uring_register (2),
|
117
|
+
.BR openat2 (2)
|
@@ -0,0 +1 @@
|
|
1
|
+
io_uring_prep_openat2.3
|
@@ -0,0 +1 @@
|
|
1
|
+
io_uring_prep_openat.3
|
@@ -0,0 +1,72 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_poll_add 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_poll_add \- prepare a poll request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <poll.h>
|
11
|
+
.B #include <liburing.h>
|
12
|
+
.PP
|
13
|
+
.BI "void io_uring_prep_poll_add(struct io_uring_sqe *" sqe ","
|
14
|
+
.BI " int " fd ","
|
15
|
+
.BI " unsigned " poll_mask ");"
|
16
|
+
.PP
|
17
|
+
.BI "void io_uring_prep_poll_multishot(struct io_uring_sqe *" sqe ","
|
18
|
+
.BI " int " fd ","
|
19
|
+
.BI " unsigned " poll_mask ");"
|
20
|
+
.fi
|
21
|
+
.SH DESCRIPTION
|
22
|
+
.PP
|
23
|
+
The
|
24
|
+
.BR io_uring_prep_poll_add (3)
|
25
|
+
function prepares a poll request. The submission queue entry
|
26
|
+
.I sqe
|
27
|
+
is setup to use the file descriptor
|
28
|
+
.I fd
|
29
|
+
that should get polled, with the events desired specified in the
|
30
|
+
.I poll_mask
|
31
|
+
argument.
|
32
|
+
|
33
|
+
The default behavior is a single-shot poll request. When the specified event
|
34
|
+
has triggered, a completion CQE is posted and no more events will be generated
|
35
|
+
by the poll request.
|
36
|
+
.BR io_uring_prep_multishot (3)
|
37
|
+
behaves identically in terms of events, but it persist across notifications
|
38
|
+
and will repeatedly post notifications for the same registration. A CQE
|
39
|
+
posted from a multishot poll request will have
|
40
|
+
.B IORING_CQE_F_MORE
|
41
|
+
set in the CQE
|
42
|
+
.I flags
|
43
|
+
member, indicating that the application should expect more completions from
|
44
|
+
this request. If the multishot poll request gets terminated or experiences
|
45
|
+
an error, this flag will not be set in the CQE. If this happens, the application
|
46
|
+
should not expect further CQEs from the original request and must reissue a
|
47
|
+
new one if it still wishes to get notifications on this file descriptor.
|
48
|
+
|
49
|
+
.SH RETURN VALUE
|
50
|
+
None
|
51
|
+
.SH ERRORS
|
52
|
+
The CQE
|
53
|
+
.I res
|
54
|
+
field will contain the result of the operation, which is a bitmask of the
|
55
|
+
events notified. See the
|
56
|
+
.BR poll (2)
|
57
|
+
man page for details. Note that where synchronous system calls will return
|
58
|
+
.B -1
|
59
|
+
on failure and set
|
60
|
+
.I errno
|
61
|
+
to the actual error value, io_uring never uses
|
62
|
+
.IR errno .
|
63
|
+
Instead it returns the negated
|
64
|
+
.I errno
|
65
|
+
directly in the CQE
|
66
|
+
.I res
|
67
|
+
field.
|
68
|
+
.SH SEE ALSO
|
69
|
+
.BR io_uring_get_sqe (3),
|
70
|
+
.BR io_uring_submit (3),
|
71
|
+
.BR poll (2),
|
72
|
+
.BR epoll_ctl (3)
|
@@ -0,0 +1 @@
|
|
1
|
+
io_uring_prep_poll_add.3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_poll_remove 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_poll_remove \- prepare a poll deletion request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "void io_uring_prep_poll_remove(struct io_uring_sqe *" sqe ","
|
13
|
+
.BI " __u64 " user_data ");"
|
14
|
+
.BI "
|
15
|
+
.fi
|
16
|
+
.SH DESCRIPTION
|
17
|
+
.PP
|
18
|
+
The
|
19
|
+
.BR io_uring_prep_poll_remove (3)
|
20
|
+
function prepares a poll removal request. The submission queue entry
|
21
|
+
.I sqe
|
22
|
+
is setup to remove a poll request identified by
|
23
|
+
.I user_data
|
24
|
+
|
25
|
+
Works like
|
26
|
+
.BR io_uring_prep_cancel (3)
|
27
|
+
except only looks for poll requests. Apart from that, behavior is identical.
|
28
|
+
See that man page for specific details.
|
29
|
+
|
30
|
+
.SH RETURN VALUE
|
31
|
+
None
|
32
|
+
.SH ERRORS
|
33
|
+
These are the errors that are reported in the CQE
|
34
|
+
.I res
|
35
|
+
field. On success,
|
36
|
+
.B 0
|
37
|
+
is returned.
|
38
|
+
.TP
|
39
|
+
.B -ENOENT
|
40
|
+
The request identified by
|
41
|
+
.I user_data
|
42
|
+
could not be located. This could be because it completed before the cancelation
|
43
|
+
request was issued, or if an invalid identifier is used.
|
44
|
+
.TP
|
45
|
+
.B -EINVAL
|
46
|
+
One of the fields set in the SQE was invalid.
|
47
|
+
.TP
|
48
|
+
.B -EALREADY
|
49
|
+
The execution state of the request has progressed far enough that cancelation
|
50
|
+
is no longer possible. This should normally mean that it will complete shortly,
|
51
|
+
either successfully, or interrupted due to the cancelation.
|
52
|
+
.SH SEE ALSO
|
53
|
+
.BR io_uring_get_sqe (3),
|
54
|
+
.BR io_uring_submit (3),
|
55
|
+
.BR io_uring_prep_cancel (3)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_poll_update 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_poll_update \- update an existing poll request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <poll.h>
|
11
|
+
.B #include <liburing.h>
|
12
|
+
.PP
|
13
|
+
.BI "void io_uring_prep_poll_update(struct io_uring_sqe *" sqe ","
|
14
|
+
.BI " __u64 " old_user_data ","
|
15
|
+
.BI " __u64 " new_user_data ","
|
16
|
+
.BI " unsigned " poll_mask ","
|
17
|
+
.BI " unsigned " flags ");"
|
18
|
+
.fi
|
19
|
+
.SH DESCRIPTION
|
20
|
+
.PP
|
21
|
+
The
|
22
|
+
.BR io_uring_prep_poll_update (3)
|
23
|
+
function prepares a poll update request. The submission queue entry
|
24
|
+
.I sqe
|
25
|
+
is setup to update a poll request identified by
|
26
|
+
.IR old_user_data ,
|
27
|
+
replacing it with the
|
28
|
+
.I new_user_data
|
29
|
+
information. The
|
30
|
+
.I poll_mask
|
31
|
+
arguments contains the new mask to use for the poll request, and
|
32
|
+
.I flags
|
33
|
+
argument contains modifier flags telling io_uring what fields to update.
|
34
|
+
|
35
|
+
The
|
36
|
+
.I flags
|
37
|
+
modifier flags is a bitmask and may contain and OR'ed mask of:
|
38
|
+
.TP
|
39
|
+
.B IORING_POLL_UPDATE_EVENTS
|
40
|
+
If set, the poll update request will replace the existing events being waited
|
41
|
+
for with the ones specified in the
|
42
|
+
.I poll_mask
|
43
|
+
argument to the function.
|
44
|
+
.TP
|
45
|
+
.B IORING_POLL_UPDATE_USER_DATA
|
46
|
+
If set, the poll update request will update the existing user_data of the
|
47
|
+
request with the value passed in as the
|
48
|
+
.I new_user_data
|
49
|
+
argument.
|
50
|
+
.TP
|
51
|
+
.B IORING_POLL_ADD_MULTI
|
52
|
+
If set, this will change the poll request from a singleshot to a multishot
|
53
|
+
request. This must be used along with
|
54
|
+
.B IORING_POLL_UPDATE_EVENTS
|
55
|
+
as the event field must be updated to enable multishot.
|
56
|
+
|
57
|
+
.SH RETURN VALUE
|
58
|
+
None
|
59
|
+
.SH ERRORS
|
60
|
+
These are the errors that are reported in the CQE
|
61
|
+
.I res
|
62
|
+
field. On success,
|
63
|
+
.B 0
|
64
|
+
is returned.
|
65
|
+
.TP
|
66
|
+
.B -ENOENT
|
67
|
+
The request identified by
|
68
|
+
.I user_data
|
69
|
+
could not be located. This could be because it completed before the cancelation
|
70
|
+
request was issued, or if an invalid identifier is used.
|
71
|
+
.TP
|
72
|
+
.B -EINVAL
|
73
|
+
One of the fields set in the SQE was invalid.
|
74
|
+
.TP
|
75
|
+
.B -EALREADY
|
76
|
+
The execution state of the request has progressed far enough that cancelation
|
77
|
+
is no longer possible. This should normally mean that it will complete shortly,
|
78
|
+
either successfully, or interrupted due to the cancelation.
|
79
|
+
.TP
|
80
|
+
.B -ECANCELED
|
81
|
+
.B IORING_POLL_UPDATE_EVENTS
|
82
|
+
was set and an error occurred re-arming the poll request with the new mask.
|
83
|
+
The original poll request is terminated if this happens, and that termination
|
84
|
+
CQE will contain the reason for the error re-arming.
|
85
|
+
.SH SEE ALSO
|
86
|
+
.BR io_uring_get_sqe (3),
|
87
|
+
.BR io_uring_submit (3),
|
88
|
+
.BR io_uring_prep_poll_add (3),
|
89
|
+
.BR io_uring_prep_poll_multishot (3)
|
@@ -0,0 +1,131 @@
|
|
1
|
+
.\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
|
2
|
+
.\"
|
3
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
+
.\"
|
5
|
+
.TH io_uring_prep_provide_buffers 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
+
.SH NAME
|
7
|
+
io_uring_prep_provide_buffers \- prepare a provide buffers request
|
8
|
+
.SH SYNOPSIS
|
9
|
+
.nf
|
10
|
+
.B #include <liburing.h>
|
11
|
+
.PP
|
12
|
+
.BI "void io_uring_prep_provide_buffers(struct io_uring_sqe *" sqe ","
|
13
|
+
.BI " void *" addr ","
|
14
|
+
.BI " int " len ","
|
15
|
+
.BI " int " nr ","
|
16
|
+
.BI " int " bgid ","
|
17
|
+
.BI " int " bid ");"
|
18
|
+
.fi
|
19
|
+
.SH DESCRIPTION
|
20
|
+
.PP
|
21
|
+
The
|
22
|
+
.BR io_uring_prep_provide_buffers (3)
|
23
|
+
function prepares a request for providing the kernel with buffers. The
|
24
|
+
submission queue entry
|
25
|
+
.I sqe
|
26
|
+
is setup to consume
|
27
|
+
.I len
|
28
|
+
number of buffers starting at
|
29
|
+
.I addr
|
30
|
+
and identified by the buffer group ID of
|
31
|
+
.I bgid
|
32
|
+
and numbered sequentially starting at
|
33
|
+
.IR bid .
|
34
|
+
|
35
|
+
This function sets up a request to provide buffers to the io_uring context
|
36
|
+
that can be used by read or receive operations. This is done by filling in
|
37
|
+
the SQE
|
38
|
+
.I buf_group
|
39
|
+
field and setting
|
40
|
+
.B IOSQE_BUFFER_SELECT
|
41
|
+
in the SQE
|
42
|
+
.I flags
|
43
|
+
member. If buffer selection is used for a request, no buffer should be provided
|
44
|
+
in the address field. Instead, the group ID is set to match one that was
|
45
|
+
previously provided to the kernel. The kernel will then select a buffer from
|
46
|
+
this group for the IO operation. On successful completion of the IO request,
|
47
|
+
the CQE
|
48
|
+
.I flags
|
49
|
+
field will have
|
50
|
+
.B IORING_CQE_F_BUFFER
|
51
|
+
set and the selected buffer ID will be indicated by the upper 16-bits of the
|
52
|
+
.I flags
|
53
|
+
field.
|
54
|
+
|
55
|
+
Different buffer group IDs can be used by the application to have different
|
56
|
+
sizes or types of buffers available. Once a buffer has been consumed for an
|
57
|
+
operation, it is no longer known to io_uring. It must be re-provided if so
|
58
|
+
desired or freed by the application if no longer needed.
|
59
|
+
|
60
|
+
The buffer IDs are internally tracked from
|
61
|
+
.I bid
|
62
|
+
and sequentially ascending from that value. If
|
63
|
+
.B 16
|
64
|
+
buffers are provided and start with an initial
|
65
|
+
.I bid
|
66
|
+
of 0, then the buffer IDs will range from
|
67
|
+
.BR 0..15 .
|
68
|
+
The application must be aware of this to make sense of the buffer ID passed
|
69
|
+
back in the CQE.
|
70
|
+
|
71
|
+
Not all requests support buffer selection, as it only really makes sense for
|
72
|
+
requests that receive data from the kernel rather than write or provide data.
|
73
|
+
Currently, this mode of operation is supported for any file read or socket
|
74
|
+
receive request. Attempting to use
|
75
|
+
.B IOSQE_BUFFER_SELECT
|
76
|
+
with a command that doesn't support it will result in a CQE
|
77
|
+
.I res
|
78
|
+
error of
|
79
|
+
.BR -EINVAL .
|
80
|
+
Buffer selection will work with operations that take a
|
81
|
+
.B struct iovec
|
82
|
+
as its data destination, but only if 1 iovec is provided.
|
83
|
+
.
|
84
|
+
.SH RETURN VALUE
|
85
|
+
None
|
86
|
+
.SH ERRORS
|
87
|
+
These are the errors that are reported in the CQE
|
88
|
+
.I res
|
89
|
+
field. On success,
|
90
|
+
.I res
|
91
|
+
will contain the number of successfully provided buffers. On error,
|
92
|
+
the following errors can occur.
|
93
|
+
.TP
|
94
|
+
.B -ENOMEM
|
95
|
+
The kernel was unable to allocate memory for the request.
|
96
|
+
.TP
|
97
|
+
.B -EINVAL
|
98
|
+
One of the fields set in the SQE was invalid.
|
99
|
+
.TP
|
100
|
+
.B -E2BIG
|
101
|
+
The number of buffers provided was too big, or the
|
102
|
+
.I bid
|
103
|
+
was too big. A max value of
|
104
|
+
.B USHRT_MAX
|
105
|
+
buffers can be specified.
|
106
|
+
.TP
|
107
|
+
.B -EFAULT
|
108
|
+
Some of the user memory given was invalid for the application.
|
109
|
+
.TP
|
110
|
+
.B -EBADF
|
111
|
+
On of the descriptors located in
|
112
|
+
.I fds
|
113
|
+
didn't refer to a valid file descriptor, or one of the file descriptors in
|
114
|
+
the array referred to an io_uring instance.
|
115
|
+
.TP
|
116
|
+
.B -EOVERFLOW
|
117
|
+
The product of
|
118
|
+
.I len
|
119
|
+
and
|
120
|
+
.I nr
|
121
|
+
exceed the valid amount or overflowed, or the sum of
|
122
|
+
.I addr
|
123
|
+
and the length of buffers overflowed.
|
124
|
+
.TP
|
125
|
+
.B -EBUSY
|
126
|
+
Attempt to update a slot that is already used.
|
127
|
+
.SH SEE ALSO
|
128
|
+
.BR io_uring_get_sqe (3),
|
129
|
+
.BR io_uring_submit (3),
|
130
|
+
.BR io_uring_register (2),
|
131
|
+
.BR io_uring_prep_remove_buffers (3)
|
@@ -4,21 +4,22 @@
|
|
4
4
|
.\"
|
5
5
|
.TH io_uring_prep_read 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
6
|
.SH NAME
|
7
|
-
io_uring_prep_read
|
8
|
-
|
7
|
+
io_uring_prep_read \- prepare I/O read request
|
9
8
|
.SH SYNOPSIS
|
10
9
|
.nf
|
11
|
-
.
|
10
|
+
.B #include <liburing.h>
|
12
11
|
.PP
|
13
|
-
.BI "void io_uring_prep_read(struct io_uring_sqe *sqe,"
|
14
|
-
.BI " int fd,"
|
15
|
-
.BI " void *buf,"
|
16
|
-
.BI " unsigned nbytes,"
|
17
|
-
.BI " __u64 offset)"
|
18
|
-
|
12
|
+
.BI "void io_uring_prep_read(struct io_uring_sqe *" sqe ","
|
13
|
+
.BI " int " fd ","
|
14
|
+
.BI " void *" buf ","
|
15
|
+
.BI " unsigned " nbytes ","
|
16
|
+
.BI " __u64 " offset ");"
|
17
|
+
.fi
|
19
18
|
.SH DESCRIPTION
|
20
19
|
.PP
|
21
|
-
The
|
20
|
+
The
|
21
|
+
.BR io_uring_prep_read (3)
|
22
|
+
prepares an IO read request. The submission queue entry
|
22
23
|
.I sqe
|
23
24
|
is setup to use the file descriptor
|
24
25
|
.I fd
|
@@ -27,10 +28,10 @@ to start reading
|
|
27
28
|
into the buffer
|
28
29
|
.I buf
|
29
30
|
at the specified
|
30
|
-
.
|
31
|
+
.IR offset .
|
31
32
|
|
32
33
|
On files that support seeking, if the offset is set to
|
33
|
-
.
|
34
|
+
.BR -1 ,
|
34
35
|
the read operation commences at the file offset, and the file offset is
|
35
36
|
incremented by the number of bytes read. See
|
36
37
|
.BR read (2)
|
@@ -39,12 +40,30 @@ current file offset may result in unpredictable behavior, unless access
|
|
39
40
|
to the file is serialized. It is not encouraged to use this feature, if it's
|
40
41
|
possible to provide the desired IO offset from the application or library.
|
41
42
|
|
42
|
-
On files that are not capable of seeking, the offset
|
43
|
+
On files that are not capable of seeking, the offset must be 0 or -1.
|
43
44
|
|
44
45
|
After the read has been prepared it can be submitted with one of the submit
|
45
46
|
functions.
|
46
47
|
|
47
48
|
.SH RETURN VALUE
|
48
49
|
None
|
50
|
+
.SH ERRORS
|
51
|
+
The CQE
|
52
|
+
.I res
|
53
|
+
field will contain the result of the operation. See the related man page for
|
54
|
+
details on possible values. Note that where synchronous system calls will return
|
55
|
+
.B -1
|
56
|
+
on failure and set
|
57
|
+
.I errno
|
58
|
+
to the actual error value, io_uring never uses
|
59
|
+
.IR errno .
|
60
|
+
Instead it returns the negated
|
61
|
+
.I errno
|
62
|
+
directly in the CQE
|
63
|
+
.I res
|
64
|
+
field.
|
49
65
|
.SH SEE ALSO
|
50
|
-
.BR io_uring_get_sqe (3),
|
66
|
+
.BR io_uring_get_sqe (3),
|
67
|
+
.BR io_uring_prep_readv (3),
|
68
|
+
.BR io_uring_prep_readv2 (3),
|
69
|
+
.BR io_uring_submit (3)
|