polyphony 1.0.1 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -1
  3. data/.github/workflows/test_io_uring.yml +1 -1
  4. data/.yardopts +1 -0
  5. data/CHANGELOG.md +9 -0
  6. data/README.md +1 -0
  7. data/TODO.md +6 -12
  8. data/docs/advanced-io.md +224 -0
  9. data/docs/cheat-sheet.md +2 -2
  10. data/docs/readme.md +1 -0
  11. data/examples/core/debug.rb +12 -0
  12. data/examples/core/rpc_benchmark.rb +136 -0
  13. data/examples/core/stream_mockup.rb +68 -0
  14. data/examples/core/throttled_loop_inside_move_on_after.rb +13 -0
  15. data/ext/polyphony/backend_common.c +3 -5
  16. data/ext/polyphony/backend_common.h +10 -1
  17. data/ext/polyphony/backend_io_uring.c +6 -6
  18. data/ext/polyphony/backend_libev.c +5 -5
  19. data/ext/polyphony/extconf.rb +6 -0
  20. data/ext/polyphony/fiber.c +21 -1
  21. data/lib/polyphony/extensions/fiber.rb +1 -0
  22. data/lib/polyphony/extensions/io.rb +74 -74
  23. data/lib/polyphony/extensions/object.rb +6 -0
  24. data/lib/polyphony/extensions/socket.rb +39 -39
  25. data/lib/polyphony/version.rb +1 -1
  26. data/polyphony.gemspec +3 -1
  27. data/test/stress.rb +1 -1
  28. data/test/test_fiber.rb +45 -1
  29. data/test/test_io.rb +46 -0
  30. data/test/test_process_supervision.rb +1 -1
  31. data/test/test_resource_pool.rb +1 -1
  32. data/test/test_scenarios.rb +38 -0
  33. data/test/test_socket.rb +1 -2
  34. data/test/test_thread_pool.rb +4 -2
  35. data/test/test_timer.rb +2 -2
  36. metadata +36 -149
  37. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +0 -1
  38. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +0 -1
  39. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +0 -1
  40. data/vendor/liburing/man/io_uring.7 +0 -781
  41. data/vendor/liburing/man/io_uring_buf_ring_add.3 +0 -53
  42. data/vendor/liburing/man/io_uring_buf_ring_advance.3 +0 -31
  43. data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +0 -41
  44. data/vendor/liburing/man/io_uring_buf_ring_init.3 +0 -30
  45. data/vendor/liburing/man/io_uring_buf_ring_mask.3 +0 -27
  46. data/vendor/liburing/man/io_uring_check_version.3 +0 -72
  47. data/vendor/liburing/man/io_uring_close_ring_fd.3 +0 -43
  48. data/vendor/liburing/man/io_uring_cq_advance.3 +0 -49
  49. data/vendor/liburing/man/io_uring_cq_has_overflow.3 +0 -25
  50. data/vendor/liburing/man/io_uring_cq_ready.3 +0 -26
  51. data/vendor/liburing/man/io_uring_cqe_get_data.3 +0 -53
  52. data/vendor/liburing/man/io_uring_cqe_get_data64.3 +0 -1
  53. data/vendor/liburing/man/io_uring_cqe_seen.3 +0 -42
  54. data/vendor/liburing/man/io_uring_enter.2 +0 -1700
  55. data/vendor/liburing/man/io_uring_enter2.2 +0 -1
  56. data/vendor/liburing/man/io_uring_free_probe.3 +0 -27
  57. data/vendor/liburing/man/io_uring_get_events.3 +0 -33
  58. data/vendor/liburing/man/io_uring_get_probe.3 +0 -30
  59. data/vendor/liburing/man/io_uring_get_sqe.3 +0 -57
  60. data/vendor/liburing/man/io_uring_major_version.3 +0 -1
  61. data/vendor/liburing/man/io_uring_minor_version.3 +0 -1
  62. data/vendor/liburing/man/io_uring_opcode_supported.3 +0 -30
  63. data/vendor/liburing/man/io_uring_peek_cqe.3 +0 -38
  64. data/vendor/liburing/man/io_uring_prep_accept.3 +0 -197
  65. data/vendor/liburing/man/io_uring_prep_accept_direct.3 +0 -1
  66. data/vendor/liburing/man/io_uring_prep_cancel.3 +0 -118
  67. data/vendor/liburing/man/io_uring_prep_cancel64.3 +0 -1
  68. data/vendor/liburing/man/io_uring_prep_close.3 +0 -59
  69. data/vendor/liburing/man/io_uring_prep_close_direct.3 +0 -1
  70. data/vendor/liburing/man/io_uring_prep_connect.3 +0 -66
  71. data/vendor/liburing/man/io_uring_prep_fadvise.3 +0 -59
  72. data/vendor/liburing/man/io_uring_prep_fallocate.3 +0 -59
  73. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +0 -1
  74. data/vendor/liburing/man/io_uring_prep_files_update.3 +0 -92
  75. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +0 -1
  76. data/vendor/liburing/man/io_uring_prep_fsync.3 +0 -70
  77. data/vendor/liburing/man/io_uring_prep_getxattr.3 +0 -61
  78. data/vendor/liburing/man/io_uring_prep_link.3 +0 -1
  79. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +0 -94
  80. data/vendor/liburing/man/io_uring_prep_linkat.3 +0 -91
  81. data/vendor/liburing/man/io_uring_prep_madvise.3 +0 -56
  82. data/vendor/liburing/man/io_uring_prep_mkdir.3 +0 -1
  83. data/vendor/liburing/man/io_uring_prep_mkdirat.3 +0 -83
  84. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +0 -92
  85. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +0 -1
  86. data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +0 -1
  87. data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +0 -1
  88. data/vendor/liburing/man/io_uring_prep_nop.3 +0 -28
  89. data/vendor/liburing/man/io_uring_prep_openat.3 +0 -117
  90. data/vendor/liburing/man/io_uring_prep_openat2.3 +0 -117
  91. data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +0 -1
  92. data/vendor/liburing/man/io_uring_prep_openat_direct.3 +0 -1
  93. data/vendor/liburing/man/io_uring_prep_poll_add.3 +0 -72
  94. data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +0 -1
  95. data/vendor/liburing/man/io_uring_prep_poll_remove.3 +0 -55
  96. data/vendor/liburing/man/io_uring_prep_poll_update.3 +0 -89
  97. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +0 -140
  98. data/vendor/liburing/man/io_uring_prep_read.3 +0 -69
  99. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +0 -72
  100. data/vendor/liburing/man/io_uring_prep_readv.3 +0 -85
  101. data/vendor/liburing/man/io_uring_prep_readv2.3 +0 -111
  102. data/vendor/liburing/man/io_uring_prep_recv.3 +0 -105
  103. data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +0 -1
  104. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +0 -124
  105. data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +0 -1
  106. data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +0 -52
  107. data/vendor/liburing/man/io_uring_prep_rename.3 +0 -1
  108. data/vendor/liburing/man/io_uring_prep_renameat.3 +0 -96
  109. data/vendor/liburing/man/io_uring_prep_send.3 +0 -66
  110. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +0 -38
  111. data/vendor/liburing/man/io_uring_prep_send_zc.3 +0 -96
  112. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +0 -1
  113. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +0 -89
  114. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +0 -1
  115. data/vendor/liburing/man/io_uring_prep_setxattr.3 +0 -64
  116. data/vendor/liburing/man/io_uring_prep_shutdown.3 +0 -53
  117. data/vendor/liburing/man/io_uring_prep_socket.3 +0 -118
  118. data/vendor/liburing/man/io_uring_prep_socket_direct.3 +0 -1
  119. data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +0 -1
  120. data/vendor/liburing/man/io_uring_prep_splice.3 +0 -120
  121. data/vendor/liburing/man/io_uring_prep_statx.3 +0 -74
  122. data/vendor/liburing/man/io_uring_prep_symlink.3 +0 -1
  123. data/vendor/liburing/man/io_uring_prep_symlinkat.3 +0 -85
  124. data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +0 -59
  125. data/vendor/liburing/man/io_uring_prep_tee.3 +0 -74
  126. data/vendor/liburing/man/io_uring_prep_timeout.3 +0 -95
  127. data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +0 -1
  128. data/vendor/liburing/man/io_uring_prep_timeout_update.3 +0 -98
  129. data/vendor/liburing/man/io_uring_prep_unlink.3 +0 -1
  130. data/vendor/liburing/man/io_uring_prep_unlinkat.3 +0 -82
  131. data/vendor/liburing/man/io_uring_prep_write.3 +0 -67
  132. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +0 -72
  133. data/vendor/liburing/man/io_uring_prep_writev.3 +0 -85
  134. data/vendor/liburing/man/io_uring_prep_writev2.3 +0 -111
  135. data/vendor/liburing/man/io_uring_queue_exit.3 +0 -26
  136. data/vendor/liburing/man/io_uring_queue_init.3 +0 -89
  137. data/vendor/liburing/man/io_uring_queue_init_params.3 +0 -1
  138. data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +0 -1
  139. data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +0 -1
  140. data/vendor/liburing/man/io_uring_recvmsg_name.3 +0 -1
  141. data/vendor/liburing/man/io_uring_recvmsg_out.3 +0 -82
  142. data/vendor/liburing/man/io_uring_recvmsg_payload.3 +0 -1
  143. data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +0 -1
  144. data/vendor/liburing/man/io_uring_recvmsg_validate.3 +0 -1
  145. data/vendor/liburing/man/io_uring_register.2 +0 -834
  146. data/vendor/liburing/man/io_uring_register_buf_ring.3 +0 -140
  147. data/vendor/liburing/man/io_uring_register_buffers.3 +0 -104
  148. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +0 -1
  149. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +0 -1
  150. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +0 -1
  151. data/vendor/liburing/man/io_uring_register_eventfd.3 +0 -51
  152. data/vendor/liburing/man/io_uring_register_eventfd_async.3 +0 -1
  153. data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +0 -52
  154. data/vendor/liburing/man/io_uring_register_files.3 +0 -112
  155. data/vendor/liburing/man/io_uring_register_files_sparse.3 +0 -1
  156. data/vendor/liburing/man/io_uring_register_files_tags.3 +0 -1
  157. data/vendor/liburing/man/io_uring_register_files_update.3 +0 -1
  158. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +0 -1
  159. data/vendor/liburing/man/io_uring_register_iowq_aff.3 +0 -61
  160. data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +0 -71
  161. data/vendor/liburing/man/io_uring_register_ring_fd.3 +0 -49
  162. data/vendor/liburing/man/io_uring_register_sync_cancel.3 +0 -71
  163. data/vendor/liburing/man/io_uring_setup.2 +0 -669
  164. data/vendor/liburing/man/io_uring_sq_ready.3 +0 -31
  165. data/vendor/liburing/man/io_uring_sq_space_left.3 +0 -25
  166. data/vendor/liburing/man/io_uring_sqe_set_data.3 +0 -48
  167. data/vendor/liburing/man/io_uring_sqe_set_data64.3 +0 -1
  168. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +0 -87
  169. data/vendor/liburing/man/io_uring_sqring_wait.3 +0 -34
  170. data/vendor/liburing/man/io_uring_submit.3 +0 -46
  171. data/vendor/liburing/man/io_uring_submit_and_get_events.3 +0 -31
  172. data/vendor/liburing/man/io_uring_submit_and_wait.3 +0 -38
  173. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +0 -56
  174. data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +0 -30
  175. data/vendor/liburing/man/io_uring_unregister_buffers.3 +0 -27
  176. data/vendor/liburing/man/io_uring_unregister_eventfd.3 +0 -1
  177. data/vendor/liburing/man/io_uring_unregister_files.3 +0 -27
  178. data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +0 -1
  179. data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +0 -32
  180. data/vendor/liburing/man/io_uring_wait_cqe.3 +0 -40
  181. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +0 -43
  182. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +0 -53
  183. data/vendor/liburing/man/io_uring_wait_cqes.3 +0 -56
@@ -1,92 +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_msg_ring 3 "March 10, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_msg_ring \- send a message to another ring
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "void io_uring_prep_msg_ring(struct io_uring_sqe *" sqe ","
13
- .BI " int " fd ","
14
- .BI " unsigned int " len ","
15
- .BI " __u64 " data ","
16
- .BI " unsigned int " flags ");"
17
- .PP
18
- .BI "void io_uring_prep_msg_ring_cqe_flags(struct io_uring_sqe *" sqe ","
19
- .BI " int " fd ","
20
- .BI " unsigned int " len ","
21
- .BI " __u64 " data ","
22
- .BI " unsigned int " flags ","
23
- .BI " unsigned int " cqe_flags ");"
24
- .fi
25
- .SH DESCRIPTION
26
- .PP
27
- .BR io_uring_prep_msg_ring (3)
28
- prepares to send a CQE to an io_uring file descriptor. The submission queue
29
- entry
30
- .I sqe
31
- is setup to use the file descriptor
32
- .IR fd ,
33
- which must identify a io_uring context, to post a CQE on that ring where the
34
- target CQE
35
- .B res
36
- field will contain the content of
37
- .I len
38
- and the
39
- .B user_data
40
- of
41
- .I data
42
- with the request modifier flags set by
43
- .IR flags .
44
- Currently there are no valid flag modifiers, this field must contain
45
- .BR 0 .
46
-
47
- The targeted ring may be any ring that the user has access to, even the ring
48
- itself. This request can be used for simple message passing to another ring,
49
- allowing 32+64 bits of data to be transferred through the
50
- .I len
51
- and
52
- .I data
53
- fields. The use case may be anything from simply waking up someone waiting
54
- on the targeted ring, or it can be used to pass messages between the two
55
- rings.
56
-
57
- .BR io_uring_prep_msg_ring_cqe_flags (3)
58
- is similar to
59
- .BR io_uring_prep_msg_ring (3) .
60
- But has an addition
61
- .I cqe_flags
62
- parameter, which is used to set
63
- .I flags
64
- field on CQE side. That way, you can set the CQE flags field
65
- .I cqe->flags
66
- when sending a message. Be aware that io_uring could potentially set additional
67
- bits into this field.
68
-
69
- .SH RETURN VALUE
70
- None
71
-
72
- .SH ERRORS
73
- These are the errors that are reported in the CQE
74
- .I res
75
- field.
76
- .TP
77
- .B -ENOMEM
78
- The kernel was unable to allocate memory for the request.
79
- .TP
80
- .B -EINVAL
81
- One of the fields set in the SQE was invalid.
82
- .TP
83
- .B -EBADFD
84
- The descriptor passed in
85
- .I fd
86
- does not refer to an io_uring file descriptor, or the ring is in a disabled
87
- state.
88
- .TP
89
- .B -EOVERFLOW
90
- The kernel was unable to fill a CQE on the target ring. This can happen if
91
- the target CQ ring is in an overflow state and the kernel wasn't able to
92
- allocate memory for a new CQE entry.
@@ -1 +0,0 @@
1
- io_uring_prep_msg_ring.3
@@ -1 +0,0 @@
1
- io_uring_prep_accept.3
@@ -1 +0,0 @@
1
- io_uring_prep_accept.3
@@ -1,28 +0,0 @@
1
- .\" Copyright (C) 2022 Samuel Williams
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_prep_nop 3 "October 20, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_nop \- prepare a nop request
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "void io_uring_prep_nop(struct io_uring_sqe *" sqe ");"
13
- .fi
14
- .SH DESCRIPTION
15
- .PP
16
- The
17
- .BR io_uring_prep_nop (3)
18
- function prepares nop (no operation) request. The submission queue entry
19
- .I sqe
20
- does not require any additional setup.
21
-
22
- .SH RETURN VALUE
23
- None
24
- .SH ERRORS
25
- None
26
- .SH SEE ALSO
27
- .BR io_uring_get_sqe (3),
28
- .BR io_uring_submit (3),
@@ -1,117 +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_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)
@@ -1,117 +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_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)
@@ -1 +0,0 @@
1
- io_uring_prep_openat2.3
@@ -1 +0,0 @@
1
- io_uring_prep_openat.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_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_poll_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)
@@ -1 +0,0 @@
1
- io_uring_prep_poll_add.3
@@ -1,55 +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_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)
@@ -1,89 +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_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)