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,98 +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_poll_timeout_update 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_timeoute_update \- prepare a request to update an existing timeout
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
12
|
-
.BI "void io_uring_prep_timeout_update(struct io_uring_sqe *" sqe ","
|
13
|
-
.BI " struct __kernel_timespec *" ts ","
|
14
|
-
.BI " __u64 " user_data ","
|
15
|
-
.BI " unsigned " flags ");"
|
16
|
-
.PP
|
17
|
-
.BI "void io_uring_prep_timeout_remove(struct io_uring_sqe *" sqe ","
|
18
|
-
.BI " __u64 " user_data ","
|
19
|
-
.BI " unsigned " flags ");"
|
20
|
-
.fi
|
21
|
-
.SH DESCRIPTION
|
22
|
-
.PP
|
23
|
-
These functions modify or cancel an existing timeout request. The submission
|
24
|
-
queue entry
|
25
|
-
.I sqe
|
26
|
-
is setup to arm a timeout update or removal specified by
|
27
|
-
.I user_data
|
28
|
-
and with modifier flags given by
|
29
|
-
.IR flags .
|
30
|
-
Additionally, the update request includes a
|
31
|
-
.I ts
|
32
|
-
structure, which contains new timeout information.
|
33
|
-
|
34
|
-
For an update request, the
|
35
|
-
.I flags
|
36
|
-
member may contain a bitmask of the following values:
|
37
|
-
.TP
|
38
|
-
.B IORING_TIMEOUT_ABS
|
39
|
-
The value specified in
|
40
|
-
.I ts
|
41
|
-
is an absolute value rather than a relative one.
|
42
|
-
.TP
|
43
|
-
.B IORING_TIMEOUT_BOOTTIME
|
44
|
-
The boottime clock source should be used.
|
45
|
-
.TP
|
46
|
-
.B IORING_TIMEOUT_REALTIME
|
47
|
-
The realtime clock source should be used.
|
48
|
-
.TP
|
49
|
-
.B IORING_TIMEOUT_ETIME_SUCCESS
|
50
|
-
Consider an expired timeout a success in terms of the posted completion.
|
51
|
-
Normally a timeout that triggers would return in a
|
52
|
-
.B -ETIME
|
53
|
-
CQE
|
54
|
-
.I res
|
55
|
-
value.
|
56
|
-
.PP
|
57
|
-
|
58
|
-
.SH RETURN VALUE
|
59
|
-
None
|
60
|
-
.SH ERRORS
|
61
|
-
These are the errors that are reported in the CQE
|
62
|
-
.I res
|
63
|
-
field. On success,
|
64
|
-
.B 0
|
65
|
-
is returned.
|
66
|
-
.TP
|
67
|
-
.B -ENOENT
|
68
|
-
The timeout identified by
|
69
|
-
.I user_data
|
70
|
-
could not be found. It may be invalid, or triggered before the update or
|
71
|
-
removal request was processed.
|
72
|
-
.TP
|
73
|
-
.B -EALREADY
|
74
|
-
The timeout identified by
|
75
|
-
.I user_data
|
76
|
-
is already firing and cannot be canceled.
|
77
|
-
.TP
|
78
|
-
.B -EINVAL
|
79
|
-
One of the fields set in the SQE was invalid. For example, two clocksources
|
80
|
-
where given, or the specified timeout seconds or nanoseconds where < 0.
|
81
|
-
.TP
|
82
|
-
.B -EFAULT
|
83
|
-
io_uring was unable to access the data specified by
|
84
|
-
.IR ts .
|
85
|
-
.SH NOTES
|
86
|
-
As with any request that passes in data in a struct, that data must remain
|
87
|
-
valid until the request has been successfully submitted. It need not remain
|
88
|
-
valid until completion. Once a request has been submitted, the in-kernel
|
89
|
-
state is stable. Very early kernels (5.4 and earlier) required state to be
|
90
|
-
stable until the completion occurred. Applications can test for this
|
91
|
-
behavior by inspecting the
|
92
|
-
.B IORING_FEAT_SUBMIT_STABLE
|
93
|
-
flag passed back from
|
94
|
-
.BR io_uring_queue_init_params (3).
|
95
|
-
.SH SEE ALSO
|
96
|
-
.BR io_uring_get_sqe (3),
|
97
|
-
.BR io_uring_submit (3),
|
98
|
-
.BR io_uring_prep_timeout (3)
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_prep_unlinkat.3
|
@@ -1,82 +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_unlinkat 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_unlinkat \- prepare an unlinkat request
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <fcntl.h>
|
11
|
-
.B #include <unistd.h>
|
12
|
-
.B #include <liburing.h>
|
13
|
-
.PP
|
14
|
-
.BI "void io_uring_prep_unlinkat(struct io_uring_sqe *" sqe ","
|
15
|
-
.BI " int " dirfd ","
|
16
|
-
.BI " const char *" path ","
|
17
|
-
.BI " int " flags ");"
|
18
|
-
.PP
|
19
|
-
.BI "void io_uring_prep_unlink(struct io_uring_sqe *" sqe ","
|
20
|
-
.BI " const char *" path ","
|
21
|
-
.BI " int " flags ");"
|
22
|
-
.fi
|
23
|
-
.SH DESCRIPTION
|
24
|
-
.PP
|
25
|
-
The
|
26
|
-
.BR io_uring_prep_unlinkat (3)
|
27
|
-
function prepares an unlinkat request. The submission queue entry
|
28
|
-
.I sqe
|
29
|
-
is setup to use the directory file descriptor pointed to by
|
30
|
-
.I dirfd
|
31
|
-
to start an unlinkat operation on the path identified by
|
32
|
-
.I path
|
33
|
-
and using the flags given in
|
34
|
-
.IR flags .
|
35
|
-
|
36
|
-
The
|
37
|
-
.BR io_uring_prep_unlink (3)
|
38
|
-
function prepares an unlink request. The submission queue entry
|
39
|
-
.I sqe
|
40
|
-
is setup to start an unlinkat operation on the path identified by
|
41
|
-
.I path
|
42
|
-
relative to the current working directory and using the flags given in
|
43
|
-
.IR flags .
|
44
|
-
|
45
|
-
These functions prepare an async
|
46
|
-
.BR unlinkat (2)
|
47
|
-
or
|
48
|
-
.BR unlink (2)
|
49
|
-
request. See those man pages for details.
|
50
|
-
|
51
|
-
.SH RETURN VALUE
|
52
|
-
None
|
53
|
-
.SH ERRORS
|
54
|
-
The CQE
|
55
|
-
.I res
|
56
|
-
field will contain the result of the operation. See the related man page for
|
57
|
-
details on possible values. 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 NOTES
|
69
|
-
As with any request that passes in data in a struct, that data must remain
|
70
|
-
valid until the request has been successfully submitted. It need not remain
|
71
|
-
valid until completion. Once a request has been submitted, the in-kernel
|
72
|
-
state is stable. Very early kernels (5.4 and earlier) required state to be
|
73
|
-
stable until the completion occurred. Applications can test for this
|
74
|
-
behavior by inspecting the
|
75
|
-
.B IORING_FEAT_SUBMIT_STABLE
|
76
|
-
flag passed back from
|
77
|
-
.BR io_uring_queue_init_params (3).
|
78
|
-
.SH SEE ALSO
|
79
|
-
.BR io_uring_get_sqe (3),
|
80
|
-
.BR io_uring_submit (3),
|
81
|
-
.BR unlinkat (2),
|
82
|
-
.BR unlink (2)
|
@@ -1,67 +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_write 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_write \- prepare I/O write request
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
12
|
-
.BI "void io_uring_prep_write(struct io_uring_sqe *" sqe ","
|
13
|
-
.BI " int " fd ","
|
14
|
-
.BI " const void *" buf ","
|
15
|
-
.BI " unsigned " nbytes ","
|
16
|
-
.BI " __u64 " offset ");"
|
17
|
-
.fi
|
18
|
-
.SH DESCRIPTION
|
19
|
-
.PP
|
20
|
-
The
|
21
|
-
.BR io_uring_prep_write (3)
|
22
|
-
prepares an IO write request. The submission queue entry
|
23
|
-
.I sqe
|
24
|
-
is setup to use the file descriptor
|
25
|
-
.I fd
|
26
|
-
to start writing
|
27
|
-
.I nbytes
|
28
|
-
from 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 write operation commences at the file offset, and the file offset is
|
36
|
-
incremented by the number of bytes written. See
|
37
|
-
.BR write (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 write 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_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_write 3 "February 13, 2022" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_write_fixed \- prepare I/O write request with registered buffer
|
8
|
-
.SH SYNOPSIS
|
9
|
-
.nf
|
10
|
-
.B #include <liburing.h>
|
11
|
-
.PP
|
12
|
-
.BI "void io_uring_prep_write_fixed(struct io_uring_sqe *" sqe ","
|
13
|
-
.BI " int " fd ",
|
14
|
-
.BI " const 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_write_fixed (3)
|
23
|
-
prepares an IO write 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 writing
|
29
|
-
.I nbytes
|
30
|
-
from the buffer
|
31
|
-
.I buf
|
32
|
-
at the specified
|
33
|
-
.I 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_write (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_write (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_writev 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_writev \- prepare vector I/O write 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_writev(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_writev (3)
|
23
|
-
prepares a vectored IO write request. The submission queue entry
|
24
|
-
.I sqe
|
25
|
-
is setup to use the file descriptor
|
26
|
-
.I fd
|
27
|
-
to start writing
|
28
|
-
.I nr_vecs
|
29
|
-
from 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 write operation commences at the file offset, and the file offset is
|
37
|
-
incremented by the number of bytes written. See
|
38
|
-
.BR write (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 write 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_write (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_write (3),
|
84
|
-
.BR io_uring_prep_writev2 (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_writev2 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
|
6
|
-
.SH NAME
|
7
|
-
io_uring_prep_writev2 \- prepare vector I/O write 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_writev2(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_writev2 (3)
|
24
|
-
prepares a vectored IO write request. The submission queue entry
|
25
|
-
.I sqe
|
26
|
-
is setup to use the file descriptor
|
27
|
-
.I fd
|
28
|
-
to start writing
|
29
|
-
.I nr_vecs
|
30
|
-
from 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 write operation commences at the file offset, and the file offset is
|
63
|
-
incremented by the number of bytes written. See
|
64
|
-
.BR write (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 write 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_write (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_write (3),
|
110
|
-
.BR io_uring_prep_writev (3),
|
111
|
-
.BR io_uring_submit (3)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
.\" Copyright (C) 2020 Jens Axboe <axboe@kernel.dk>
|
2
|
-
.\" Copyright (C) 2020 Red Hat, Inc.
|
3
|
-
.\"
|
4
|
-
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
5
|
-
.\"
|
6
|
-
.TH io_uring_queue_exit 3 "July 10, 2020" "liburing-0.7" "liburing Manual"
|
7
|
-
.SH NAME
|
8
|
-
io_uring_queue_exit \- tear down io_uring submission and completion queues
|
9
|
-
.SH SYNOPSIS
|
10
|
-
.nf
|
11
|
-
.B #include <liburing.h>
|
12
|
-
.PP
|
13
|
-
.BI "void io_uring_queue_exit(struct io_uring *" ring ");"
|
14
|
-
.fi
|
15
|
-
.SH DESCRIPTION
|
16
|
-
.PP
|
17
|
-
.BR io_uring_queue_exit (3)
|
18
|
-
will release all resources acquired and initialized by
|
19
|
-
.BR io_uring_queue_init (3).
|
20
|
-
It first unmaps the memory shared between the application and the kernel and then closes the io_uring file descriptor.
|
21
|
-
.SH RETURN VALUE
|
22
|
-
None
|
23
|
-
.SH SEE ALSO
|
24
|
-
.BR io_uring_setup (2),
|
25
|
-
.BR mmap (2),
|
26
|
-
.BR io_uring_queue_init (3)
|
@@ -1,89 +0,0 @@
|
|
1
|
-
.\" Copyright (C) 2020 Jens Axboe <axboe@kernel.dk>
|
2
|
-
.\" Copyright (C) 2020 Red Hat, Inc.
|
3
|
-
.\"
|
4
|
-
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
5
|
-
.\"
|
6
|
-
.TH io_uring_queue_init 3 "July 10, 2020" "liburing-0.7" "liburing Manual"
|
7
|
-
.SH NAME
|
8
|
-
io_uring_queue_init \- setup io_uring submission and completion queues
|
9
|
-
.SH SYNOPSIS
|
10
|
-
.nf
|
11
|
-
.B #include <liburing.h>
|
12
|
-
.PP
|
13
|
-
.BI "int io_uring_queue_init(unsigned " entries ","
|
14
|
-
.BI " struct io_uring *" ring ","
|
15
|
-
.BI " unsigned " flags ");"
|
16
|
-
.PP
|
17
|
-
.BI "int io_uring_queue_init_params(unsigned " entries ","
|
18
|
-
.BI " struct io_uring *" ring ","
|
19
|
-
.BI " struct io_uring_params *" params ");"
|
20
|
-
.fi
|
21
|
-
.SH DESCRIPTION
|
22
|
-
.PP
|
23
|
-
The
|
24
|
-
.BR io_uring_queue_init (3)
|
25
|
-
function executes the
|
26
|
-
.BR io_uring_setup (2)
|
27
|
-
system call to initialize the submission and completion queues in the kernel
|
28
|
-
with at least
|
29
|
-
.I entries
|
30
|
-
entries in the submission queue and then maps the resulting file descriptor to
|
31
|
-
memory shared between the application and the kernel.
|
32
|
-
|
33
|
-
By default, the CQ ring will have twice the number of entries as specified by
|
34
|
-
.I entries
|
35
|
-
for the SQ ring. This is adequate for regular file or storage workloads, but
|
36
|
-
may be too small networked workloads. The SQ ring entries do not impose a limit
|
37
|
-
on the number of in-flight requests that the ring can support, it merely limits
|
38
|
-
the number that can be submitted to the kernel in one go (batch). if the CQ
|
39
|
-
ring overflows, e.g. more entries are generated than fits in the ring before the
|
40
|
-
application can reap them, then the ring enters a CQ ring overflow state. This
|
41
|
-
is indicated by
|
42
|
-
.B IORING_SQ_CQ_OVERFLOW
|
43
|
-
being set in the SQ ring flags. Unless the kernel runs out of available memory,
|
44
|
-
entries are not dropped, but it is a much slower completion path and will slow
|
45
|
-
down request processing. For that reason it should be avoided and the CQ
|
46
|
-
ring sized appropriately for the workload. Setting
|
47
|
-
.I cq_entries
|
48
|
-
in
|
49
|
-
.I struct io_uring_params
|
50
|
-
will tell the kernel to allocate this many entries for the CQ ring, independent
|
51
|
-
of the SQ ring size in given in
|
52
|
-
.IR entries .
|
53
|
-
If the value isn't a power of 2, it will be rounded up to the nearest power of
|
54
|
-
2.
|
55
|
-
|
56
|
-
On success,
|
57
|
-
.BR io_uring_queue_init (3)
|
58
|
-
returns 0 and
|
59
|
-
.I ring
|
60
|
-
will point to the shared memory containing the io_uring queues. On failure
|
61
|
-
.BR -errno
|
62
|
-
is returned.
|
63
|
-
|
64
|
-
.I flags
|
65
|
-
will be passed through to the io_uring_setup syscall (see
|
66
|
-
.BR io_uring_setup (2)).
|
67
|
-
|
68
|
-
If the
|
69
|
-
.BR io_uring_queue_init_params (3)
|
70
|
-
variant is used, then the parameters indicated by
|
71
|
-
.I params
|
72
|
-
will be passed straight through to the
|
73
|
-
.BR io_uring_setup (2)
|
74
|
-
system call.
|
75
|
-
|
76
|
-
On success, the resources held by
|
77
|
-
.I ring
|
78
|
-
should be released via a corresponding call to
|
79
|
-
.BR io_uring_queue_exit (3).
|
80
|
-
.SH RETURN VALUE
|
81
|
-
.BR io_uring_queue_init (3)
|
82
|
-
returns 0 on success and
|
83
|
-
.BR -errno
|
84
|
-
on failure.
|
85
|
-
.SH SEE ALSO
|
86
|
-
.BR io_uring_setup (2),
|
87
|
-
.BR io_uring_register_ring_fd (3),
|
88
|
-
.BR mmap (2),
|
89
|
-
.BR io_uring_queue_exit (3)
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_queue_init.3
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_recvmsg_out.3
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_recvmsg_out.3
|
@@ -1 +0,0 @@
|
|
1
|
-
io_uring_recvmsg_out.3
|