polyphony 1.0.1 → 1.1
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 +1 -1
- data/.github/workflows/test_io_uring.yml +1 -1
- data/.yardopts +1 -0
- data/CHANGELOG.md +9 -0
- data/README.md +1 -0
- data/TODO.md +6 -12
- data/docs/advanced-io.md +224 -0
- data/docs/cheat-sheet.md +2 -2
- data/docs/readme.md +1 -0
- data/examples/core/debug.rb +12 -0
- data/examples/core/rpc_benchmark.rb +136 -0
- data/examples/core/stream_mockup.rb +68 -0
- data/examples/core/throttled_loop_inside_move_on_after.rb +13 -0
- data/ext/polyphony/backend_common.c +3 -5
- data/ext/polyphony/backend_common.h +10 -1
- data/ext/polyphony/backend_io_uring.c +6 -6
- data/ext/polyphony/backend_libev.c +5 -5
- data/ext/polyphony/extconf.rb +6 -0
- data/ext/polyphony/fiber.c +21 -1
- data/lib/polyphony/extensions/fiber.rb +1 -0
- data/lib/polyphony/extensions/io.rb +74 -74
- data/lib/polyphony/extensions/object.rb +6 -0
- data/lib/polyphony/extensions/socket.rb +39 -39
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +3 -1
- data/test/stress.rb +1 -1
- data/test/test_fiber.rb +45 -1
- data/test/test_io.rb +46 -0
- data/test/test_process_supervision.rb +1 -1
- data/test/test_resource_pool.rb +1 -1
- data/test/test_scenarios.rb +38 -0
- data/test/test_socket.rb +1 -2
- data/test/test_thread_pool.rb +4 -2
- data/test/test_timer.rb +2 -2
- metadata +36 -149
- data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +0 -1
- data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +0 -1
- data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +0 -1
- data/vendor/liburing/man/io_uring.7 +0 -781
- data/vendor/liburing/man/io_uring_buf_ring_add.3 +0 -53
- data/vendor/liburing/man/io_uring_buf_ring_advance.3 +0 -31
- data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +0 -41
- data/vendor/liburing/man/io_uring_buf_ring_init.3 +0 -30
- data/vendor/liburing/man/io_uring_buf_ring_mask.3 +0 -27
- data/vendor/liburing/man/io_uring_check_version.3 +0 -72
- data/vendor/liburing/man/io_uring_close_ring_fd.3 +0 -43
- data/vendor/liburing/man/io_uring_cq_advance.3 +0 -49
- data/vendor/liburing/man/io_uring_cq_has_overflow.3 +0 -25
- data/vendor/liburing/man/io_uring_cq_ready.3 +0 -26
- data/vendor/liburing/man/io_uring_cqe_get_data.3 +0 -53
- data/vendor/liburing/man/io_uring_cqe_get_data64.3 +0 -1
- data/vendor/liburing/man/io_uring_cqe_seen.3 +0 -42
- data/vendor/liburing/man/io_uring_enter.2 +0 -1700
- data/vendor/liburing/man/io_uring_enter2.2 +0 -1
- data/vendor/liburing/man/io_uring_free_probe.3 +0 -27
- data/vendor/liburing/man/io_uring_get_events.3 +0 -33
- data/vendor/liburing/man/io_uring_get_probe.3 +0 -30
- data/vendor/liburing/man/io_uring_get_sqe.3 +0 -57
- data/vendor/liburing/man/io_uring_major_version.3 +0 -1
- data/vendor/liburing/man/io_uring_minor_version.3 +0 -1
- data/vendor/liburing/man/io_uring_opcode_supported.3 +0 -30
- data/vendor/liburing/man/io_uring_peek_cqe.3 +0 -38
- data/vendor/liburing/man/io_uring_prep_accept.3 +0 -197
- data/vendor/liburing/man/io_uring_prep_accept_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_cancel.3 +0 -118
- data/vendor/liburing/man/io_uring_prep_cancel64.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_close.3 +0 -59
- data/vendor/liburing/man/io_uring_prep_close_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_connect.3 +0 -66
- data/vendor/liburing/man/io_uring_prep_fadvise.3 +0 -59
- data/vendor/liburing/man/io_uring_prep_fallocate.3 +0 -59
- data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_files_update.3 +0 -92
- data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_fsync.3 +0 -70
- data/vendor/liburing/man/io_uring_prep_getxattr.3 +0 -61
- data/vendor/liburing/man/io_uring_prep_link.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_link_timeout.3 +0 -94
- data/vendor/liburing/man/io_uring_prep_linkat.3 +0 -91
- data/vendor/liburing/man/io_uring_prep_madvise.3 +0 -56
- data/vendor/liburing/man/io_uring_prep_mkdir.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_mkdirat.3 +0 -83
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +0 -92
- data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_nop.3 +0 -28
- data/vendor/liburing/man/io_uring_prep_openat.3 +0 -117
- data/vendor/liburing/man/io_uring_prep_openat2.3 +0 -117
- data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_openat_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_poll_add.3 +0 -72
- data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_poll_remove.3 +0 -55
- data/vendor/liburing/man/io_uring_prep_poll_update.3 +0 -89
- data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +0 -140
- data/vendor/liburing/man/io_uring_prep_read.3 +0 -69
- data/vendor/liburing/man/io_uring_prep_read_fixed.3 +0 -72
- data/vendor/liburing/man/io_uring_prep_readv.3 +0 -85
- data/vendor/liburing/man/io_uring_prep_readv2.3 +0 -111
- data/vendor/liburing/man/io_uring_prep_recv.3 +0 -105
- data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_recvmsg.3 +0 -124
- data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +0 -52
- data/vendor/liburing/man/io_uring_prep_rename.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_renameat.3 +0 -96
- data/vendor/liburing/man/io_uring_prep_send.3 +0 -66
- data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +0 -38
- data/vendor/liburing/man/io_uring_prep_send_zc.3 +0 -96
- data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_sendmsg.3 +0 -89
- data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_setxattr.3 +0 -64
- data/vendor/liburing/man/io_uring_prep_shutdown.3 +0 -53
- data/vendor/liburing/man/io_uring_prep_socket.3 +0 -118
- data/vendor/liburing/man/io_uring_prep_socket_direct.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_splice.3 +0 -120
- data/vendor/liburing/man/io_uring_prep_statx.3 +0 -74
- data/vendor/liburing/man/io_uring_prep_symlink.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_symlinkat.3 +0 -85
- data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +0 -59
- data/vendor/liburing/man/io_uring_prep_tee.3 +0 -74
- data/vendor/liburing/man/io_uring_prep_timeout.3 +0 -95
- data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_timeout_update.3 +0 -98
- data/vendor/liburing/man/io_uring_prep_unlink.3 +0 -1
- data/vendor/liburing/man/io_uring_prep_unlinkat.3 +0 -82
- data/vendor/liburing/man/io_uring_prep_write.3 +0 -67
- data/vendor/liburing/man/io_uring_prep_write_fixed.3 +0 -72
- data/vendor/liburing/man/io_uring_prep_writev.3 +0 -85
- data/vendor/liburing/man/io_uring_prep_writev2.3 +0 -111
- data/vendor/liburing/man/io_uring_queue_exit.3 +0 -26
- data/vendor/liburing/man/io_uring_queue_init.3 +0 -89
- data/vendor/liburing/man/io_uring_queue_init_params.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_name.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_out.3 +0 -82
- data/vendor/liburing/man/io_uring_recvmsg_payload.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +0 -1
- data/vendor/liburing/man/io_uring_recvmsg_validate.3 +0 -1
- data/vendor/liburing/man/io_uring_register.2 +0 -834
- data/vendor/liburing/man/io_uring_register_buf_ring.3 +0 -140
- data/vendor/liburing/man/io_uring_register_buffers.3 +0 -104
- data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +0 -1
- data/vendor/liburing/man/io_uring_register_buffers_tags.3 +0 -1
- data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +0 -1
- data/vendor/liburing/man/io_uring_register_eventfd.3 +0 -51
- data/vendor/liburing/man/io_uring_register_eventfd_async.3 +0 -1
- data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +0 -52
- data/vendor/liburing/man/io_uring_register_files.3 +0 -112
- data/vendor/liburing/man/io_uring_register_files_sparse.3 +0 -1
- data/vendor/liburing/man/io_uring_register_files_tags.3 +0 -1
- data/vendor/liburing/man/io_uring_register_files_update.3 +0 -1
- data/vendor/liburing/man/io_uring_register_files_update_tag.3 +0 -1
- data/vendor/liburing/man/io_uring_register_iowq_aff.3 +0 -61
- data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +0 -71
- data/vendor/liburing/man/io_uring_register_ring_fd.3 +0 -49
- data/vendor/liburing/man/io_uring_register_sync_cancel.3 +0 -71
- data/vendor/liburing/man/io_uring_setup.2 +0 -669
- data/vendor/liburing/man/io_uring_sq_ready.3 +0 -31
- data/vendor/liburing/man/io_uring_sq_space_left.3 +0 -25
- data/vendor/liburing/man/io_uring_sqe_set_data.3 +0 -48
- data/vendor/liburing/man/io_uring_sqe_set_data64.3 +0 -1
- data/vendor/liburing/man/io_uring_sqe_set_flags.3 +0 -87
- data/vendor/liburing/man/io_uring_sqring_wait.3 +0 -34
- data/vendor/liburing/man/io_uring_submit.3 +0 -46
- data/vendor/liburing/man/io_uring_submit_and_get_events.3 +0 -31
- data/vendor/liburing/man/io_uring_submit_and_wait.3 +0 -38
- data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +0 -56
- data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +0 -30
- data/vendor/liburing/man/io_uring_unregister_buffers.3 +0 -27
- data/vendor/liburing/man/io_uring_unregister_eventfd.3 +0 -1
- data/vendor/liburing/man/io_uring_unregister_files.3 +0 -27
- data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +0 -1
- data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +0 -32
- data/vendor/liburing/man/io_uring_wait_cqe.3 +0 -40
- data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +0 -43
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +0 -53
- data/vendor/liburing/man/io_uring_wait_cqes.3 +0 -56
@@ -1,140 +0,0 @@
|
|
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 nr
|
28
|
-
number of
|
29
|
-
.I len
|
30
|
-
sized buffers starting at
|
31
|
-
.I addr
|
32
|
-
and identified by the buffer group ID of
|
33
|
-
.I bgid
|
34
|
-
and numbered sequentially starting at
|
35
|
-
.IR bid .
|
36
|
-
|
37
|
-
This function sets up a request to provide buffers to the io_uring context
|
38
|
-
that can be used by read or receive operations. This is done by filling in
|
39
|
-
the SQE
|
40
|
-
.I buf_group
|
41
|
-
field and setting
|
42
|
-
.B IOSQE_BUFFER_SELECT
|
43
|
-
in the SQE
|
44
|
-
.I flags
|
45
|
-
member. If buffer selection is used for a request, no buffer should be provided
|
46
|
-
in the address field. Instead, the group ID is set to match one that was
|
47
|
-
previously provided to the kernel. The kernel will then select a buffer from
|
48
|
-
this group for the IO operation. On successful completion of the IO request,
|
49
|
-
the CQE
|
50
|
-
.I flags
|
51
|
-
field will have
|
52
|
-
.B IORING_CQE_F_BUFFER
|
53
|
-
set and the selected buffer ID will be indicated by the upper 16-bits of the
|
54
|
-
.I flags
|
55
|
-
field.
|
56
|
-
|
57
|
-
Different buffer group IDs can be used by the application to have different
|
58
|
-
sizes or types of buffers available. Once a buffer has been consumed for an
|
59
|
-
operation, it is no longer known to io_uring. It must be re-provided if so
|
60
|
-
desired or freed by the application if no longer needed.
|
61
|
-
|
62
|
-
The buffer IDs are internally tracked from
|
63
|
-
.I bid
|
64
|
-
and sequentially ascending from that value. If
|
65
|
-
.B 16
|
66
|
-
buffers are provided and start with an initial
|
67
|
-
.I bid
|
68
|
-
of 0, then the buffer IDs will range from
|
69
|
-
.BR 0..15 .
|
70
|
-
The application must be aware of this to make sense of the buffer ID passed
|
71
|
-
back in the CQE.
|
72
|
-
|
73
|
-
Buffer IDs always range from
|
74
|
-
.B 0
|
75
|
-
to
|
76
|
-
.B 65535 ,
|
77
|
-
as there are only 16-bits available in the CQE to pass them back. This range
|
78
|
-
is independent of how the buffer group initially got created. Attempting to
|
79
|
-
add buffer IDs larger than that, or buffer IDs that will wrap when cast to
|
80
|
-
a 16-bit value, will cause the request to fail with
|
81
|
-
.B -E2BIG
|
82
|
-
or
|
83
|
-
.B -EINVAL .
|
84
|
-
|
85
|
-
Not all requests support buffer selection, as it only really makes sense for
|
86
|
-
requests that receive data from the kernel rather than write or provide data.
|
87
|
-
Currently, this mode of operation is supported for any file read or socket
|
88
|
-
receive request. Attempting to use
|
89
|
-
.B IOSQE_BUFFER_SELECT
|
90
|
-
with a command that doesn't support it will result in a CQE
|
91
|
-
.I res
|
92
|
-
error of
|
93
|
-
.BR -EINVAL .
|
94
|
-
Buffer selection will work with operations that take a
|
95
|
-
.B struct iovec
|
96
|
-
as its data destination, but only if 1 iovec is provided.
|
97
|
-
.
|
98
|
-
.SH RETURN VALUE
|
99
|
-
None
|
100
|
-
.SH ERRORS
|
101
|
-
These are the errors that are reported in the CQE
|
102
|
-
.I res
|
103
|
-
field. On success,
|
104
|
-
.I res
|
105
|
-
will contain
|
106
|
-
.B 0
|
107
|
-
or the number of successfully provided buffers.
|
108
|
-
.TP
|
109
|
-
.B -ENOMEM
|
110
|
-
The kernel was unable to allocate memory for the request.
|
111
|
-
.TP
|
112
|
-
.B -EINVAL
|
113
|
-
One of the fields set in the SQE was invalid.
|
114
|
-
.TP
|
115
|
-
.B -E2BIG
|
116
|
-
The number of buffers provided was too big, or the
|
117
|
-
.I bid
|
118
|
-
was too big. A max value of
|
119
|
-
.B USHRT_MAX
|
120
|
-
buffers can be specified.
|
121
|
-
.TP
|
122
|
-
.B -EFAULT
|
123
|
-
Some of the user memory given was invalid for the application.
|
124
|
-
.TP
|
125
|
-
.B -EOVERFLOW
|
126
|
-
The product of
|
127
|
-
.I len
|
128
|
-
and
|
129
|
-
.I nr
|
130
|
-
exceed the valid amount or overflowed, or the sum of
|
131
|
-
.I addr
|
132
|
-
and the length of buffers overflowed.
|
133
|
-
.TP
|
134
|
-
.B -EBUSY
|
135
|
-
Attempt to update a slot that is already used.
|
136
|
-
.SH SEE ALSO
|
137
|
-
.BR io_uring_get_sqe (3),
|
138
|
-
.BR io_uring_submit (3),
|
139
|
-
.BR io_uring_register (2),
|
140
|
-
.BR io_uring_prep_remove_buffers (3)
|
@@ -1,69 +0,0 @@
|
|
1
|
-
.\" Copyright (C) 2021 Stefan Roesch <shr@fb.com>
|
2
|
-
.\"
|
3
|
-
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
-
.\"
|
5
|
-
.TH io_uring_prep_read 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_read \- prepare I/O read request
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
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
|
18
|
-
.SH DESCRIPTION
|
19
|
-
.PP
|
20
|
-
The
|
21
|
-
.BR io_uring_prep_read (3)
|
22
|
-
prepares an IO read request. The submission queue entry
|
23
|
-
.I sqe
|
24
|
-
is setup to use the file descriptor
|
25
|
-
.I fd
|
26
|
-
to start reading
|
27
|
-
.I nbytes
|
28
|
-
into the buffer
|
29
|
-
.I buf
|
30
|
-
at the specified
|
31
|
-
.IR offset .
|
32
|
-
|
33
|
-
On files that support seeking, if the offset is set to
|
34
|
-
.BR -1 ,
|
35
|
-
the read operation commences at the file offset, and the file offset is
|
36
|
-
incremented by the number of bytes read. See
|
37
|
-
.BR read (2)
|
38
|
-
for more details. Note that for an async API, reading and updating the
|
39
|
-
current file offset may result in unpredictable behavior, unless access
|
40
|
-
to the file is serialized. It is not encouraged to use this feature, if it's
|
41
|
-
possible to provide the desired IO offset from the application or library.
|
42
|
-
|
43
|
-
On files that are not capable of seeking, the offset must be 0 or -1.
|
44
|
-
|
45
|
-
After the read has been prepared it can be submitted with one of the submit
|
46
|
-
functions.
|
47
|
-
|
48
|
-
.SH RETURN VALUE
|
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.
|
65
|
-
.SH SEE ALSO
|
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)
|
@@ -1,72 +0,0 @@
|
|
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_read 3 "February 13, 2022" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_read_fixed \- prepare I/O read request with registered buffer
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
12
|
-
.BI "void io_uring_prep_read_fixed(struct io_uring_sqe *" sqe ","
|
13
|
-
.BI " int " fd ","
|
14
|
-
.BI " void *" buf ","
|
15
|
-
.BI " unsigned " nbytes ","
|
16
|
-
.BI " __u64 " offset ","
|
17
|
-
.BI " int " buf_index ");"
|
18
|
-
.fi
|
19
|
-
.SH DESCRIPTION
|
20
|
-
.PP
|
21
|
-
The
|
22
|
-
.BR io_uring_prep_read_fixed (3)
|
23
|
-
prepares an IO read request with a previously registered IO buffer. The
|
24
|
-
submission queue entry
|
25
|
-
.I sqe
|
26
|
-
is setup to use the file descriptor
|
27
|
-
.I fd
|
28
|
-
to start reading
|
29
|
-
.I nbytes
|
30
|
-
into the buffer
|
31
|
-
.I buf
|
32
|
-
at the specified
|
33
|
-
.IR offset ,
|
34
|
-
and with the buffer matching the registered index of
|
35
|
-
.IR buf_index .
|
36
|
-
|
37
|
-
This works just like
|
38
|
-
.BR io_uring_prep_read (3)
|
39
|
-
except it requires the use of buffers that have been registered with
|
40
|
-
.BR io_uring_register_buffers (3).
|
41
|
-
The
|
42
|
-
.I buf
|
43
|
-
and
|
44
|
-
.I nbytes
|
45
|
-
arguments must fall within a region specified by
|
46
|
-
.I buf_index
|
47
|
-
in the previously registered buffer. The buffer need not be aligned with
|
48
|
-
the start of the registered buffer.
|
49
|
-
|
50
|
-
After the read has been prepared it can be submitted with one of the submit
|
51
|
-
functions.
|
52
|
-
|
53
|
-
.SH RETURN VALUE
|
54
|
-
None
|
55
|
-
.SH ERRORS
|
56
|
-
The CQE
|
57
|
-
.I res
|
58
|
-
field will contain the result of the operation. See the related man page for
|
59
|
-
details on possible values. Note that where synchronous system calls will return
|
60
|
-
.B -1
|
61
|
-
on failure and set
|
62
|
-
.I errno
|
63
|
-
to the actual error value, io_uring never uses
|
64
|
-
.IR errno .
|
65
|
-
Instead it returns the negated
|
66
|
-
.I errno
|
67
|
-
directly in the CQE
|
68
|
-
.I res
|
69
|
-
field.
|
70
|
-
.SH SEE ALSO
|
71
|
-
.BR io_uring_prep_read (3),
|
72
|
-
.BR io_uring_register_buffers (3)
|
@@ -1,85 +0,0 @@
|
|
1
|
-
.\" Copyright (C) 2021 Stefan Roesch <shr@fb.com>
|
2
|
-
.\"
|
3
|
-
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
-
.\"
|
5
|
-
.TH io_uring_prep_readv 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_readv \- prepare vector I/O read request
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <sys/uio.h>
|
11
|
-
.B #include <liburing.h>
|
12
|
-
.PP
|
13
|
-
.BI "void io_uring_prep_readv(struct io_uring_sqe *" sqe ","
|
14
|
-
.BI " int " fd ","
|
15
|
-
.BI " const struct iovec *" iovecs ","
|
16
|
-
.BI " unsigned " nr_vecs ","
|
17
|
-
.BI " __u64 " offset ");"
|
18
|
-
.fi
|
19
|
-
.SH DESCRIPTION
|
20
|
-
.PP
|
21
|
-
The
|
22
|
-
.BR io_uring_prep_readv (3)
|
23
|
-
prepares a vectored IO read request. The submission queue entry
|
24
|
-
.I sqe
|
25
|
-
is setup to use the file descriptor
|
26
|
-
.I fd
|
27
|
-
to start reading
|
28
|
-
.I nr_vecs
|
29
|
-
into the
|
30
|
-
.I iovecs
|
31
|
-
array at the specified
|
32
|
-
.IR offset .
|
33
|
-
|
34
|
-
On files that support seeking, if the offset is set to
|
35
|
-
.BR -1 ,
|
36
|
-
the read operation commences at the file offset, and the file offset is
|
37
|
-
incremented by the number of bytes read. See
|
38
|
-
.BR read (2)
|
39
|
-
for more details. Note that for an async API, reading and updating the
|
40
|
-
current file offset may result in unpredictable behavior, unless access
|
41
|
-
to the file is serialized. It is not encouraged to use this feature, if it's
|
42
|
-
possible to provide the desired IO offset from the application or library.
|
43
|
-
|
44
|
-
On files that are not capable of seeking, the offset must be 0 or -1.
|
45
|
-
|
46
|
-
After the read has been prepared it can be submitted with one of the submit
|
47
|
-
functions.
|
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. See the related man page for
|
55
|
-
details on possible values. Note that where synchronous system calls will return
|
56
|
-
.B -1
|
57
|
-
on failure and set
|
58
|
-
.I errno
|
59
|
-
to the actual error value, io_uring never uses
|
60
|
-
.IR errno .
|
61
|
-
Instead it returns the negated
|
62
|
-
.I errno
|
63
|
-
directly in the CQE
|
64
|
-
.I res
|
65
|
-
field.
|
66
|
-
.SH NOTES
|
67
|
-
Unless an application explicitly needs to pass in more than one iovec, it
|
68
|
-
is more efficient to use
|
69
|
-
.BR io_uring_prep_read (3)
|
70
|
-
rather than this function, as no state has to be maintained for a
|
71
|
-
non-vectored IO request.
|
72
|
-
As with any request that passes in data in a struct, that data must remain
|
73
|
-
valid until the request has been successfully submitted. It need not remain
|
74
|
-
valid until completion. Once a request has been submitted, the in-kernel
|
75
|
-
state is stable. Very early kernels (5.4 and earlier) required state to be
|
76
|
-
stable until the completion occurred. Applications can test for this
|
77
|
-
behavior by inspecting the
|
78
|
-
.B IORING_FEAT_SUBMIT_STABLE
|
79
|
-
flag passed back from
|
80
|
-
.BR io_uring_queue_init_params (3).
|
81
|
-
.SH SEE ALSO
|
82
|
-
.BR io_uring_get_sqe (3),
|
83
|
-
.BR io_uring_prep_read (3),
|
84
|
-
.BR io_uring_prep_readv2 (3),
|
85
|
-
.BR io_uring_submit (3)
|
@@ -1,111 +0,0 @@
|
|
1
|
-
.\" Copyright (C) 2021 Stefan Roesch <shr@fb.com>
|
2
|
-
.\"
|
3
|
-
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
4
|
-
.\"
|
5
|
-
.TH io_uring_prep_readv2 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_readv2 \- prepare vector I/O read request with flags
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <sys/uio.h>
|
11
|
-
.B #include <liburing.h>
|
12
|
-
.PP
|
13
|
-
.BI "void io_uring_prep_readv2(struct io_uring_sqe *" sqe ","
|
14
|
-
.BI " int " fd ","
|
15
|
-
.BI " const struct iovec *" iovecs ","
|
16
|
-
.BI " unsigned " nr_vecs ","
|
17
|
-
.BI " __u64 " offset ","
|
18
|
-
.BI " int " flags ");"
|
19
|
-
.fi
|
20
|
-
.SH DESCRIPTION
|
21
|
-
.PP
|
22
|
-
The
|
23
|
-
.BR io_uring_prep_readv2 (3)
|
24
|
-
prepares a vectored IO read request. The submission queue entry
|
25
|
-
.I sqe
|
26
|
-
is setup to use the file descriptor
|
27
|
-
.I fd
|
28
|
-
to start reading
|
29
|
-
.I nr_vecs
|
30
|
-
into the
|
31
|
-
.I iovecs
|
32
|
-
array at the specified
|
33
|
-
.IR offset .
|
34
|
-
The behavior of the function can be controlled with the
|
35
|
-
.I flags
|
36
|
-
parameter.
|
37
|
-
|
38
|
-
Supported values for
|
39
|
-
.I flags
|
40
|
-
are:
|
41
|
-
.TP
|
42
|
-
.B RWF_HIPRI
|
43
|
-
High priority request, poll if possible
|
44
|
-
.TP
|
45
|
-
.B RWF_DSYNC
|
46
|
-
per-IO O_DSYNC
|
47
|
-
.TP
|
48
|
-
.B RWF_SYNC
|
49
|
-
per-IO O_SYNC
|
50
|
-
.TP
|
51
|
-
.B RWF_NOWAIT
|
52
|
-
per-IO, return
|
53
|
-
.B -EAGAIN
|
54
|
-
if operation would block
|
55
|
-
.TP
|
56
|
-
.B RWF_APPEND
|
57
|
-
per-IO O_APPEND
|
58
|
-
|
59
|
-
.P
|
60
|
-
On files that support seeking, if the offset is set to
|
61
|
-
.BR -1 ,
|
62
|
-
the read operation commences at the file offset, and the file offset is
|
63
|
-
incremented by the number of bytes read. See
|
64
|
-
.BR read (2)
|
65
|
-
for more details. Note that for an async API, reading and updating the
|
66
|
-
current file offset may result in unpredictable behavior, unless access
|
67
|
-
to the file is serialized. It is not encouraged to use this feature, if it's
|
68
|
-
possible to provide the desired IO offset from the application or library.
|
69
|
-
|
70
|
-
On files that are not capable of seeking, the offset must be 0 or -1.
|
71
|
-
|
72
|
-
After the read has been prepared, it can be submitted with one of the submit
|
73
|
-
functions.
|
74
|
-
|
75
|
-
.SH RETURN VALUE
|
76
|
-
None
|
77
|
-
.SH ERRORS
|
78
|
-
The CQE
|
79
|
-
.I res
|
80
|
-
field will contain the result of the operation. See the related man page for
|
81
|
-
details on possible values. Note that where synchronous system calls will return
|
82
|
-
.B -1
|
83
|
-
on failure and set
|
84
|
-
.I errno
|
85
|
-
to the actual error value, io_uring never uses
|
86
|
-
.IR errno .
|
87
|
-
Instead it returns the negated
|
88
|
-
.I errno
|
89
|
-
directly in the CQE
|
90
|
-
.I res
|
91
|
-
field.
|
92
|
-
.SH NOTES
|
93
|
-
Unless an application explicitly needs to pass in more than one iovec, it
|
94
|
-
is more efficient to use
|
95
|
-
.BR io_uring_prep_read (3)
|
96
|
-
rather than this function, as no state has to be maintained for a
|
97
|
-
non-vectored IO request.
|
98
|
-
As with any request that passes in data in a struct, that data must remain
|
99
|
-
valid until the request has been successfully submitted. It need not remain
|
100
|
-
valid until completion. Once a request has been submitted, the in-kernel
|
101
|
-
state is stable. Very early kernels (5.4 and earlier) required state to be
|
102
|
-
stable until the completion occurred. Applications can test for this
|
103
|
-
behavior by inspecting the
|
104
|
-
.B IORING_FEAT_SUBMIT_STABLE
|
105
|
-
flag passed back from
|
106
|
-
.BR io_uring_queue_init_params (3).
|
107
|
-
.SH SEE ALSO
|
108
|
-
.BR io_uring_get_sqe (3),
|
109
|
-
.BR io_uring_prep_read (3),
|
110
|
-
.BR io_uring_prep_readv (3),
|
111
|
-
.BR io_uring_submit (3)
|
@@ -1,105 +0,0 @@
|
|
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_recv 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_recv \- prepare a recv request
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
12
|
-
.BI "void io_uring_prep_recv(struct io_uring_sqe *" sqe ","
|
13
|
-
.BI " int " sockfd ","
|
14
|
-
.BI " void *" buf ","
|
15
|
-
.BI " size_t " len ","
|
16
|
-
.BI " int " flags ");"
|
17
|
-
.PP
|
18
|
-
.BI "void io_uring_prep_recv_multishot(struct io_uring_sqe *" sqe ","
|
19
|
-
.BI " int " sockfd ","
|
20
|
-
.BI " void *" buf ","
|
21
|
-
.BI " size_t " len ","
|
22
|
-
.BI " int " flags ");"
|
23
|
-
.fi
|
24
|
-
.SH DESCRIPTION
|
25
|
-
.PP
|
26
|
-
The
|
27
|
-
.BR io_uring_prep_recv (3)
|
28
|
-
function prepares a recv request. The submission
|
29
|
-
queue entry
|
30
|
-
.I sqe
|
31
|
-
is setup to use the file descriptor
|
32
|
-
.I sockfd
|
33
|
-
to start receiving the data into the destination buffer
|
34
|
-
.I buf
|
35
|
-
of size
|
36
|
-
.I len
|
37
|
-
and with modifier flags
|
38
|
-
.IR flags .
|
39
|
-
|
40
|
-
This function prepares an async
|
41
|
-
.BR recv (2)
|
42
|
-
request. See that man page for details on the arguments specified to this
|
43
|
-
prep helper.
|
44
|
-
|
45
|
-
The multishot version allows the application to issue a single receive request,
|
46
|
-
which repeatedly posts a CQE when data is available. It requires length to
|
47
|
-
be 0, the
|
48
|
-
.B IOSQE_BUFFER_SELECT
|
49
|
-
flag to be set and no
|
50
|
-
.B MSG_WAITALL
|
51
|
-
flag to be set.
|
52
|
-
Therefore each CQE will take a buffer out of a provided buffer pool for receiving.
|
53
|
-
The application should check the flags of each CQE, regardless of its result.
|
54
|
-
If a posted CQE does not have the
|
55
|
-
.B IORING_CQE_F_MORE
|
56
|
-
flag set then the multishot receive will be done and the application should issue a
|
57
|
-
new request.
|
58
|
-
Multishot variants are available since kernel 6.0.
|
59
|
-
|
60
|
-
|
61
|
-
After calling this function, additional io_uring internal modifier flags
|
62
|
-
may be set in the SQE
|
63
|
-
.I ioprio
|
64
|
-
field. The following flags are supported:
|
65
|
-
.TP
|
66
|
-
.B IORING_RECVSEND_POLL_FIRST
|
67
|
-
If set, io_uring will assume the socket is currently empty and attempting to
|
68
|
-
receive data will be unsuccessful. For this case, io_uring will arm internal
|
69
|
-
poll and trigger a receive of the data when the socket has data to be read.
|
70
|
-
This initial receive attempt can be wasteful for the case where the socket
|
71
|
-
is expected to be empty, setting this flag will bypass the initial receive
|
72
|
-
attempt and go straight to arming poll. If poll does indicate that data is
|
73
|
-
ready to be received, the operation will proceed.
|
74
|
-
|
75
|
-
Can be used with the CQE
|
76
|
-
.B IORING_CQE_F_SOCK_NONEMPTY
|
77
|
-
flag, which io_uring will set on CQEs after a
|
78
|
-
.BR recv (2)
|
79
|
-
or
|
80
|
-
.BR recvmsg (2)
|
81
|
-
operation. If set, the socket still had data to be read after the operation
|
82
|
-
completed. Both these flags are available since 5.19.
|
83
|
-
.P
|
84
|
-
|
85
|
-
.SH RETURN VALUE
|
86
|
-
None
|
87
|
-
.SH ERRORS
|
88
|
-
The CQE
|
89
|
-
.I res
|
90
|
-
field will contain the result of the operation. See the related man page for
|
91
|
-
details on possible values. Note that where synchronous system calls will return
|
92
|
-
.B -1
|
93
|
-
on failure and set
|
94
|
-
.I errno
|
95
|
-
to the actual error value, io_uring never uses
|
96
|
-
.IR errno .
|
97
|
-
Instead it returns the negated
|
98
|
-
.I errno
|
99
|
-
directly in the CQE
|
100
|
-
.I res
|
101
|
-
field.
|
102
|
-
.SH SEE ALSO
|
103
|
-
.BR io_uring_get_sqe (3),
|
104
|
-
.BR io_uring_submit (3),
|
105
|
-
.BR recv (2)
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_prep_recv.3
|