polyphony 0.98 → 0.99.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -1
  3. data/.rubocop.yml +3 -3
  4. data/.yardopts +30 -0
  5. data/CHANGELOG.md +11 -0
  6. data/LICENSE +1 -1
  7. data/README.md +63 -29
  8. data/Rakefile +1 -5
  9. data/TODO.md +0 -4
  10. data/docs/{main-concepts/concurrency.md → concurrency.md} +2 -9
  11. data/docs/{main-concepts/design-principles.md → design-principles.md} +3 -9
  12. data/docs/{main-concepts/exception-handling.md → exception-handling.md} +2 -9
  13. data/docs/{main-concepts/extending.md → extending.md} +2 -9
  14. data/docs/faq.md +3 -16
  15. data/docs/{main-concepts/fiber-scheduling.md → fiber-scheduling.md} +1 -9
  16. data/docs/link_rewriter.rb +16 -0
  17. data/docs/{getting-started/overview.md → overview.md} +1 -30
  18. data/docs/{getting-started/tutorial.md → tutorial.md} +3 -28
  19. data/docs/{_posts/2020-07-26-polyphony-0.44.md → whats-new.md} +3 -1
  20. data/examples/adapters/redis_client.rb +3 -2
  21. data/examples/io/echo_server.rb +1 -1
  22. data/examples/io/echo_server_plain_ruby.rb +26 -0
  23. data/examples/io/https_server_sni_2.rb +14 -8
  24. data/ext/polyphony/backend_io_uring.c +154 -9
  25. data/ext/polyphony/backend_io_uring_context.c +21 -12
  26. data/ext/polyphony/backend_io_uring_context.h +12 -7
  27. data/ext/polyphony/backend_libev.c +1 -1
  28. data/ext/polyphony/extconf.rb +25 -8
  29. data/ext/polyphony/fiber.c +79 -2
  30. data/ext/polyphony/io_extensions.c +53 -0
  31. data/ext/polyphony/libev.h +0 -2
  32. data/ext/polyphony/pipe.c +42 -2
  33. data/ext/polyphony/polyphony.c +345 -31
  34. data/ext/polyphony/polyphony.h +9 -2
  35. data/ext/polyphony/queue.c +181 -0
  36. data/ext/polyphony/ring_buffer.c +0 -1
  37. data/ext/polyphony/runqueue.c +8 -1
  38. data/ext/polyphony/runqueue_ring_buffer.c +13 -0
  39. data/ext/polyphony/runqueue_ring_buffer.h +2 -1
  40. data/ext/polyphony/socket_extensions.c +6 -0
  41. data/ext/polyphony/thread.c +34 -2
  42. data/lib/polyphony/adapters/process.rb +11 -1
  43. data/lib/polyphony/adapters/sequel.rb +1 -1
  44. data/lib/polyphony/core/channel.rb +2 -0
  45. data/lib/polyphony/core/debug.rb +1 -1
  46. data/lib/polyphony/core/global_api.rb +25 -24
  47. data/lib/polyphony/core/resource_pool.rb +7 -6
  48. data/lib/polyphony/core/sync.rb +55 -2
  49. data/lib/polyphony/core/thread_pool.rb +3 -3
  50. data/lib/polyphony/core/timer.rb +8 -8
  51. data/lib/polyphony/extensions/exception.rb +2 -0
  52. data/lib/polyphony/extensions/fiber.rb +15 -13
  53. data/lib/polyphony/extensions/io.rb +161 -16
  54. data/lib/polyphony/extensions/kernel.rb +20 -2
  55. data/lib/polyphony/extensions/openssl.rb +101 -12
  56. data/lib/polyphony/extensions/pipe.rb +103 -7
  57. data/lib/polyphony/extensions/process.rb +13 -1
  58. data/lib/polyphony/extensions/socket.rb +93 -27
  59. data/lib/polyphony/extensions/thread.rb +9 -1
  60. data/lib/polyphony/extensions/timeout.rb +1 -1
  61. data/lib/polyphony/version.rb +2 -1
  62. data/lib/polyphony.rb +27 -7
  63. data/polyphony.gemspec +1 -8
  64. data/test/stress.rb +1 -1
  65. data/test/test_global_api.rb +45 -7
  66. data/test/test_io.rb +6 -7
  67. data/test/test_socket.rb +157 -0
  68. data/test/test_sync.rb +42 -1
  69. data/test/test_timer.rb +5 -5
  70. data/vendor/liburing/.github/workflows/build.yml +7 -16
  71. data/vendor/liburing/.gitignore +5 -0
  72. data/vendor/liburing/CHANGELOG +23 -1
  73. data/vendor/liburing/Makefile +4 -3
  74. data/vendor/liburing/Makefile.common +1 -0
  75. data/vendor/liburing/README +48 -0
  76. data/vendor/liburing/configure +76 -6
  77. data/vendor/liburing/debian/changelog +11 -0
  78. data/vendor/liburing/debian/control +7 -16
  79. data/vendor/liburing/debian/liburing-dev.manpages +3 -6
  80. data/vendor/liburing/debian/liburing2.install +1 -0
  81. data/vendor/liburing/debian/liburing2.symbols +56 -0
  82. data/vendor/liburing/debian/rules +15 -68
  83. data/vendor/liburing/examples/Makefile +4 -0
  84. data/vendor/liburing/examples/io_uring-close-test.c +123 -0
  85. data/vendor/liburing/examples/io_uring-udp.c +1 -1
  86. data/vendor/liburing/examples/send-zerocopy.c +315 -56
  87. data/vendor/liburing/examples/ucontext-cp.c +2 -17
  88. data/vendor/liburing/liburing-ffi.pc.in +12 -0
  89. data/vendor/liburing/liburing.pc.in +1 -1
  90. data/vendor/liburing/liburing.spec +1 -1
  91. data/vendor/liburing/make-debs.sh +3 -3
  92. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +1 -0
  93. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +1 -0
  94. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +1 -0
  95. data/vendor/liburing/man/io_uring_buf_ring_add.3 +6 -6
  96. data/vendor/liburing/man/io_uring_check_version.3 +72 -0
  97. data/vendor/liburing/man/io_uring_close_ring_fd.3 +43 -0
  98. data/vendor/liburing/man/io_uring_major_version.3 +1 -0
  99. data/vendor/liburing/man/io_uring_minor_version.3 +1 -0
  100. data/vendor/liburing/man/io_uring_prep_accept.3 +1 -1
  101. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +1 -0
  102. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +1 -0
  103. data/vendor/liburing/man/io_uring_prep_getxattr.3 +61 -0
  104. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +94 -0
  105. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +22 -2
  106. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +1 -0
  107. data/vendor/liburing/man/io_uring_prep_poll_add.3 +1 -1
  108. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +18 -9
  109. data/vendor/liburing/man/io_uring_prep_readv.3 +3 -3
  110. data/vendor/liburing/man/io_uring_prep_readv2.3 +3 -3
  111. data/vendor/liburing/man/io_uring_prep_recv.3 +5 -5
  112. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +4 -4
  113. data/vendor/liburing/man/io_uring_prep_send.3 +9 -0
  114. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +38 -0
  115. data/vendor/liburing/man/io_uring_prep_send_zc.3 +39 -7
  116. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +1 -0
  117. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +20 -0
  118. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +1 -0
  119. data/vendor/liburing/man/io_uring_prep_setxattr.3 +64 -0
  120. data/vendor/liburing/man/io_uring_prep_splice.3 +40 -0
  121. data/vendor/liburing/man/io_uring_prep_writev.3 +2 -2
  122. data/vendor/liburing/man/io_uring_prep_writev2.3 +2 -2
  123. data/vendor/liburing/man/io_uring_recvmsg_out.3 +13 -9
  124. data/vendor/liburing/man/io_uring_register.2 +15 -9
  125. data/vendor/liburing/man/io_uring_register_buf_ring.3 +4 -4
  126. data/vendor/liburing/man/io_uring_register_buffers.3 +49 -6
  127. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +1 -0
  128. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +1 -0
  129. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +1 -0
  130. data/vendor/liburing/man/io_uring_register_files.3 +60 -5
  131. data/vendor/liburing/man/io_uring_register_files_tags.3 +1 -0
  132. data/vendor/liburing/man/io_uring_register_files_update.3 +1 -0
  133. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +1 -0
  134. data/vendor/liburing/man/io_uring_setup.2 +31 -2
  135. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +1 -1
  136. data/vendor/liburing/src/Makefile +25 -3
  137. data/vendor/liburing/src/ffi.c +15 -0
  138. data/vendor/liburing/src/include/liburing/io_uring.h +30 -7
  139. data/vendor/liburing/src/include/liburing.h +190 -148
  140. data/vendor/liburing/src/int_flags.h +1 -0
  141. data/vendor/liburing/src/lib.h +5 -16
  142. data/vendor/liburing/src/liburing-ffi.map +172 -0
  143. data/vendor/liburing/src/liburing.map +11 -0
  144. data/vendor/liburing/src/nolibc.c +9 -2
  145. data/vendor/liburing/src/queue.c +2 -2
  146. data/vendor/liburing/src/register.c +66 -96
  147. data/vendor/liburing/src/setup.c +5 -4
  148. data/vendor/liburing/src/version.c +21 -0
  149. data/vendor/liburing/test/232c93d07b74.c +3 -3
  150. data/vendor/liburing/test/35fa71a030ca.c +3 -3
  151. data/vendor/liburing/test/500f9fbadef8.c +2 -0
  152. data/vendor/liburing/test/917257daa0fe.c +1 -1
  153. data/vendor/liburing/test/Makefile +27 -7
  154. data/vendor/liburing/test/a0908ae19763.c +2 -2
  155. data/vendor/liburing/test/a4c0b3decb33.c +2 -2
  156. data/vendor/liburing/test/accept-link.c +4 -4
  157. data/vendor/liburing/test/accept-reuse.c +5 -7
  158. data/vendor/liburing/test/accept.c +34 -31
  159. data/vendor/liburing/test/b19062a56726.c +1 -1
  160. data/vendor/liburing/test/buf-ring.c +58 -4
  161. data/vendor/liburing/test/ce593a6c480a.c +2 -2
  162. data/vendor/liburing/test/close-opath.c +2 -1
  163. data/vendor/liburing/test/connect.c +8 -0
  164. data/vendor/liburing/test/cq-overflow.c +14 -8
  165. data/vendor/liburing/test/d4ae271dfaae.c +1 -1
  166. data/vendor/liburing/test/defer-taskrun.c +64 -9
  167. data/vendor/liburing/test/defer.c +1 -1
  168. data/vendor/liburing/test/double-poll-crash.c +3 -3
  169. data/vendor/liburing/test/eeed8b54e0df.c +8 -3
  170. data/vendor/liburing/test/eploop.c +74 -0
  171. data/vendor/liburing/test/eventfd-ring.c +1 -1
  172. data/vendor/liburing/test/eventfd.c +1 -1
  173. data/vendor/liburing/test/evloop.c +73 -0
  174. data/vendor/liburing/test/exit-no-cleanup.c +1 -1
  175. data/vendor/liburing/test/fadvise.c +1 -1
  176. data/vendor/liburing/test/fc2a85cb02ef.c +3 -3
  177. data/vendor/liburing/test/fd-pass.c +35 -16
  178. data/vendor/liburing/test/file-register.c +61 -0
  179. data/vendor/liburing/test/file-verify.c +2 -2
  180. data/vendor/liburing/test/files-exit-hang-timeout.c +2 -2
  181. data/vendor/liburing/test/fixed-link.c +1 -1
  182. data/vendor/liburing/test/fsnotify.c +118 -0
  183. data/vendor/liburing/test/hardlink.c +1 -1
  184. data/vendor/liburing/test/helpers.c +54 -2
  185. data/vendor/liburing/test/helpers.h +4 -0
  186. data/vendor/liburing/test/io-cancel.c +3 -1
  187. data/vendor/liburing/test/io_uring_passthrough.c +39 -8
  188. data/vendor/liburing/test/io_uring_setup.c +3 -80
  189. data/vendor/liburing/test/iopoll-overflow.c +118 -0
  190. data/vendor/liburing/test/iopoll.c +90 -4
  191. data/vendor/liburing/test/lfs-openat-write.c +7 -9
  192. data/vendor/liburing/test/lfs-openat.c +6 -8
  193. data/vendor/liburing/test/link_drain.c +31 -5
  194. data/vendor/liburing/test/madvise.c +1 -1
  195. data/vendor/liburing/test/msg-ring-flags.c +192 -0
  196. data/vendor/liburing/test/msg-ring-overflow.c +159 -0
  197. data/vendor/liburing/test/msg-ring.c +173 -13
  198. data/vendor/liburing/test/multicqes_drain.c +22 -19
  199. data/vendor/liburing/test/nvme.h +4 -3
  200. data/vendor/liburing/test/pipe-bug.c +95 -0
  201. data/vendor/liburing/test/poll-link.c +3 -3
  202. data/vendor/liburing/test/poll-many.c +41 -19
  203. data/vendor/liburing/test/poll-mshot-overflow.c +105 -2
  204. data/vendor/liburing/test/poll-race-mshot.c +292 -0
  205. data/vendor/liburing/test/poll-race.c +105 -0
  206. data/vendor/liburing/test/poll.c +244 -26
  207. data/vendor/liburing/test/pollfree.c +5 -5
  208. data/vendor/liburing/test/read-before-exit.c +20 -3
  209. data/vendor/liburing/test/read-write.c +2 -0
  210. data/vendor/liburing/test/recv-multishot.c +96 -3
  211. data/vendor/liburing/test/reg-reg-ring.c +90 -0
  212. data/vendor/liburing/test/rename.c +1 -1
  213. data/vendor/liburing/test/ring-leak.c +0 -1
  214. data/vendor/liburing/test/ring-leak2.c +1 -1
  215. data/vendor/liburing/test/ringbuf-read.c +10 -6
  216. data/vendor/liburing/test/send-zerocopy.c +273 -103
  217. data/vendor/liburing/test/send_recv.c +7 -4
  218. data/vendor/liburing/test/sendmsg_fs_cve.c +2 -2
  219. data/vendor/liburing/test/single-issuer.c +7 -9
  220. data/vendor/liburing/test/skip-cqe.c +3 -4
  221. data/vendor/liburing/test/socket.c +0 -1
  222. data/vendor/liburing/test/sq-poll-dup.c +10 -3
  223. data/vendor/liburing/test/sq-poll-kthread.c +1 -1
  224. data/vendor/liburing/test/sq-poll-share.c +3 -2
  225. data/vendor/liburing/test/sqpoll-cancel-hang.c +17 -6
  226. data/vendor/liburing/test/sqpoll-disable-exit.c +4 -4
  227. data/vendor/liburing/test/symlink.c +2 -1
  228. data/vendor/liburing/test/test.h +2 -1
  229. data/vendor/liburing/test/timeout-new.c +11 -7
  230. data/vendor/liburing/test/timeout.c +1 -2
  231. data/vendor/liburing/test/unlink.c +1 -1
  232. data/vendor/liburing/test/version.c +25 -0
  233. data/vendor/liburing/test/wakeup-hang.c +1 -1
  234. data/vendor/liburing/test/xattr.c +8 -4
  235. metadata +57 -44
  236. data/docs/_config.yml +0 -64
  237. data/docs/_includes/head.html +0 -40
  238. data/docs/_includes/title.html +0 -1
  239. data/docs/_sass/custom/custom.scss +0 -10
  240. data/docs/_sass/overrides.scss +0 -0
  241. data/docs/api-reference/exception.md +0 -31
  242. data/docs/api-reference/fiber.md +0 -425
  243. data/docs/api-reference/index.md +0 -9
  244. data/docs/api-reference/io.md +0 -36
  245. data/docs/api-reference/object.md +0 -99
  246. data/docs/api-reference/polyphony-baseexception.md +0 -33
  247. data/docs/api-reference/polyphony-cancel.md +0 -26
  248. data/docs/api-reference/polyphony-moveon.md +0 -24
  249. data/docs/api-reference/polyphony-net.md +0 -20
  250. data/docs/api-reference/polyphony-process.md +0 -28
  251. data/docs/api-reference/polyphony-resourcepool.md +0 -59
  252. data/docs/api-reference/polyphony-restart.md +0 -18
  253. data/docs/api-reference/polyphony-terminate.md +0 -18
  254. data/docs/api-reference/polyphony-threadpool.md +0 -67
  255. data/docs/api-reference/polyphony-throttler.md +0 -77
  256. data/docs/api-reference/polyphony.md +0 -36
  257. data/docs/api-reference/thread.md +0 -88
  258. data/docs/favicon.ico +0 -0
  259. data/docs/getting-started/index.md +0 -10
  260. data/docs/getting-started/installing.md +0 -34
  261. data/vendor/liburing/debian/compat +0 -1
  262. data/vendor/liburing/debian/liburing1-udeb.install +0 -1
  263. data/vendor/liburing/debian/liburing1.install +0 -1
  264. data/vendor/liburing/debian/liburing1.symbols +0 -32
  265. /data/{docs/assets/img → assets}/echo-fibers.svg +0 -0
  266. /data/{docs → assets}/polyphony-logo.png +0 -0
  267. /data/{docs/assets/img → assets}/sleeping-fiber.svg +0 -0
@@ -0,0 +1,72 @@
1
+ .\" Copyright (C) 2022 Christian Hergert <chergert@redhat.com>
2
+ .\"
3
+ .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
+ .\"
5
+ .TH io_uring_check_version 3 "December 1, 2022" "liburing-2.4" "liburing Manual"
6
+ .SH NAME
7
+ io_uring_check_version \- functions and macros to check the liburing version
8
+ .SH SYNOPSIS
9
+ .nf
10
+ .B #include <liburing.h>
11
+ .PP
12
+ .BI "bool io_uring_check_version(int " major ", int " minor ");"
13
+ .BI "IO_URING_CHECK_VERSION(" major ", " minor ");"
14
+ .PP
15
+ .BI "int io_uring_major_version(void);"
16
+ .BI "IO_URING_VERSION_MAJOR;"
17
+ .PP
18
+ .BI "int io_uring_minor_version(void);"
19
+ .BI "IO_URING_VERSION_MINOR;"
20
+ .fi
21
+ .SH DESCRIPTION
22
+ .PP
23
+ The
24
+ .BR io_uring_check_version (3)
25
+ function returns
26
+ .I true
27
+ if the liburing library loaded by the dynamic linker is greater-than
28
+ or equal-to the
29
+ .I major
30
+ and
31
+ .I minor
32
+ numbers provided.
33
+
34
+ .PP
35
+ The
36
+ .BR IO_URING_CHECK_VERSION (3)
37
+ macro returns
38
+ .I 1
39
+ if the liburing library being compiled against is greater-than or equal-to the
40
+ .I major
41
+ and
42
+ .I minor
43
+ numbers provided.
44
+
45
+ .PP
46
+ The
47
+ .BR io_uring_major_version (3)
48
+ function returns the
49
+ .I major
50
+ version number of the liburing library loaded by the dynamic linker.
51
+
52
+ .PP
53
+ The
54
+ .BR IO_URING_VERSION_MAJOR (3)
55
+ macro returns the
56
+ .I major
57
+ version number of the liburing library being compiled against.
58
+
59
+ .PP
60
+ The
61
+ .BR io_uring_minor_version (3)
62
+ function returns the
63
+ .I minor
64
+ version number of the liburing library loaded by the dynamic linker.
65
+
66
+ .PP
67
+ The
68
+ .BR IO_URING_VERSION_MINOR (3)
69
+ macro returns the
70
+ .I minor
71
+ version number of the liburing library being compiled against.
72
+
@@ -0,0 +1,43 @@
1
+ .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
+ .\" Copyright (C) 2022 Josh Triplett <josh@joshtriplett.org>
3
+ .\"
4
+ .\" SPDX-License-Identifier: LGPL-2.0-or-later
5
+ .\"
6
+ .TH io_uring_close_ring_fd 3 "September 25, 2022" "liburing-2.4" "liburing Manual"
7
+ .SH NAME
8
+ io_uring_close_ring_fd \- close a ring file descriptor and use it only via registered index
9
+ .SH SYNOPSIS
10
+ .nf
11
+ .B #include <liburing.h>
12
+ .PP
13
+ .BI "int io_uring_close_ring_fd(struct io_uring *" ring ");"
14
+ .fi
15
+ .SH DESCRIPTION
16
+ .PP
17
+ .BR io_uring_close_ring_fd (3)
18
+ closes the ring file descriptor, which must have been previously registered.
19
+ The file will remain open, but accessible only via the registered index, not
20
+ via any file descriptor. Subsequent liburing calls will continue to work, using
21
+ the registered ring fd.
22
+
23
+ The kernel must support
24
+ .BR IORING_FEAT_REG_REG_RING .
25
+
26
+ Libraries that must avoid disrupting their users' uses of file descriptors, and
27
+ must continue working even in the face of
28
+ .BR close_range (2)
29
+ and similar, can use
30
+ .BR io_uring_close_ring_fd (3)
31
+ to work with liburing without having any open file descriptor.
32
+
33
+ .SH NOTES
34
+ Each thread that wants to make use of io_uring must register the fd. A library
35
+ that may get called from arbitrary theads may need to detect when it gets
36
+ called on a previously unseen thread and create and register a ring for that
37
+ thread.
38
+ .SH RETURN VALUE
39
+ Returns 1 on success, or
40
+ .BR -errno
41
+ on error.
42
+ .SH SEE ALSO
43
+ .BR io_uring_register_ring_fd (3)
@@ -0,0 +1 @@
1
+ io_uring_check_version.3
@@ -0,0 +1 @@
1
+ io_uring_check_version.3
@@ -92,7 +92,7 @@ will have an unused table index dynamically chosen and returned for each connect
92
92
  If both forms of direct selection will be employed, specific and dynamic, see
93
93
  .BR io_uring_register_file_alloc_range (3)
94
94
  for setting up the table so dynamically chosen entries are made against
95
- a different range than that targetted by specific requests.
95
+ a different range than that targeted by specific requests.
96
96
 
97
97
  Note that old kernels don't check the SQE
98
98
  .I file_index
@@ -0,0 +1 @@
1
+ io_uring_prep_getxattr.3
@@ -0,0 +1 @@
1
+ io_uring_prep_setxattr.3
@@ -0,0 +1,61 @@
1
+ .\" Copyright (C) 2023 Rutvik Patel <heyrutvik@gmail.com>
2
+ .\"
3
+ .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
+ .\"
5
+ .TH io_uring_prep_getxattr 3 "January 23, 2023" "liburing-2.4" "liburing Manual"
6
+ .SH NAME
7
+ io_uring_prep_getxattr, io_uring_prep_fgetxattr \- prepare a request to get an
8
+ extended attribute value
9
+ .SH SYNOPSIS
10
+ .nf
11
+ .B #include <liburing.h>
12
+ .PP
13
+ .BI "void io_uring_prep_getxattr(struct io_uring_sqe *" sqe ","
14
+ .BI " const char *" name ","
15
+ .BI " char *" value ","
16
+ .BI " const char *" path ","
17
+ .BI " unsigned int " len ");"
18
+ .PP
19
+ .BI "void io_uring_prep_fgetxattr(struct io_uring_sqe *" sqe ","
20
+ .BI " int " fd ","
21
+ .BI " const char *" name ","
22
+ .BI " char *" value ","
23
+ .BI " unsigned int " len ");"
24
+ .fi
25
+ .SH DESCRIPTION
26
+ .PP
27
+ The
28
+ .BR io_uring_prep_getxattr (3)
29
+ function prepares a request to get an extended attribute value. The submission
30
+ queue entry
31
+ .I sqe
32
+ is setup to get the
33
+ .I value
34
+ of the extended attribute identified by
35
+ .I name
36
+ and associated with the given
37
+ .I path
38
+ in the filesystem.
39
+ The
40
+ .I len
41
+ argument specifies the size (in bytes) of
42
+ .IR value .
43
+
44
+ .BR io_uring_prep_fgetxattr (3)
45
+ is identical to
46
+ .BR io_uring_prep_getxattr (3),
47
+ only the open file referred to by
48
+ .I fd
49
+ is interrogated in place of
50
+ .IR path .
51
+
52
+ This function prepares an async
53
+ .BR getxattr (2)
54
+ request. See that man page for details.
55
+
56
+ .SH RETURN VALUE
57
+ None
58
+
59
+ .SH SEE ALSO
60
+ .BR io_uring_get_sqe (3),
61
+ .BR getxattr (2)
@@ -0,0 +1,94 @@
1
+ .\" Copyright (C) 2023 Rutvik Patel <heyrutvik@gmail.com>
2
+ .\"
3
+ .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
+ .\"
5
+ .TH io_uring_prep_link_timeout 3 "January 23, 2023" "liburing-2.4" "liburing Manual"
6
+ .SH NAME
7
+ io_uring_prep_link_timeout \- a timeout request for linked sqes
8
+ .SH SYNOPSIS
9
+ .nf
10
+ .B #include <liburing.h>
11
+ .PP
12
+ .BI "void io_uring_prep_link_timeout(struct io_uring_sqe *" sqe ","
13
+ .BI " struct __kernel_timespec *" ts ","
14
+ .BI " unsigned " flags ");"
15
+ .fi
16
+ .SH DESCRIPTION
17
+ .PP
18
+ The
19
+ .BR io_uring_prep_link_timeout (3)
20
+ function prepares a timeout request for linked sqes. The submission queue entry
21
+ .I sqe
22
+ is setup a timeout specified by
23
+ .IR ts .
24
+ The flags argument holds modifier
25
+ .I flags
26
+ for the timeout behaviour of the request.
27
+
28
+ The
29
+ .I ts
30
+ argument must be filled in with the appropriate information for the timeout. It looks as follows:
31
+ .PP
32
+ .in +4n
33
+ .EX
34
+ struct __kernel_timespec {
35
+ __kernel_time64_t tv_sec;
36
+ long long tv_nsec;
37
+ };
38
+ .EE
39
+ .in
40
+ .PP
41
+
42
+ The
43
+ .I flags
44
+ argument may contain:
45
+ .TP
46
+ .B IORING_TIMEOUT_ABS
47
+ The value specified in
48
+ .I ts
49
+ is an absolute value rather than a relative one.
50
+ .TP
51
+ .B IORING_TIMEOUT_BOOTTIME
52
+ The boottime clock source should be used.
53
+ .TP
54
+ .B IORING_TIMEOUT_REALTIME
55
+ The realtime clock source should be used.
56
+ .TP
57
+ .B IORING_TIMEOUT_ETIME_SUCCESS
58
+ Consider an expired timeout a success in terms of the posted completion.
59
+ .PP
60
+
61
+ It is invalid to create a chain (linked sqes) consisting only of a link timeout
62
+ request. If all the requests in the chain are completed before timeout, then the
63
+ link timeout request gets cancelled. Upon timeout, all the uncompleted requests
64
+ in the chain get cancelled.
65
+
66
+ .SH RETURN VALUE
67
+ None
68
+
69
+ .SH ERRORS
70
+ .PP
71
+ These are the errors that are reported in the CQE
72
+ .I res
73
+ field. On success,
74
+ .B 0
75
+ is returned.
76
+ .TP
77
+ .B -ETIME
78
+ The specified timeout occurred and triggered the completion event.
79
+ .TP
80
+ .B -EINVAL
81
+ One of the fields set in the SQE was invalid. For example, two clock sources
82
+ where given, or the specified timeout seconds or nanoseconds where < 0.
83
+ .TP
84
+ .B -EFAULT
85
+ io_uring was unable to access the data specified by ts.
86
+ .TP
87
+ .B -ECANCELED
88
+ The timeout was canceled because all submitted requests were completed successfully
89
+ or one of the requests resulted in failure.
90
+
91
+
92
+ .SH SEE ALSO
93
+ .BR io_uring_get_sqe (3),
94
+ .BR io_uring_prep_timeout (3)
@@ -14,11 +14,18 @@ io_uring_prep_msg_ring \- send a message to another ring
14
14
  .BI " unsigned int " len ","
15
15
  .BI " __u64 " data ","
16
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 ");"
17
24
  .fi
18
25
  .SH DESCRIPTION
19
26
  .PP
20
27
  .BR io_uring_prep_msg_ring (3)
21
- prepares a to send a CQE to an io_uring file descriptor. The submission queue
28
+ prepares to send a CQE to an io_uring file descriptor. The submission queue
22
29
  entry
23
30
  .I sqe
24
31
  is setup to use the file descriptor
@@ -47,6 +54,18 @@ fields. The use case may be anything from simply waking up someone waiting
47
54
  on the targeted ring, or it can be used to pass messages between the two
48
55
  rings.
49
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
+
50
69
  .SH RETURN VALUE
51
70
  None
52
71
 
@@ -64,7 +83,8 @@ One of the fields set in the SQE was invalid.
64
83
  .B -EBADFD
65
84
  The descriptor passed in
66
85
  .I fd
67
- does not refer to an io_uring file descriptor.
86
+ does not refer to an io_uring file descriptor, or the ring is in a disabled
87
+ state.
68
88
  .TP
69
89
  .B -EOVERFLOW
70
90
  The kernel was unable to fill a CQE on the target ring. This can happen if
@@ -0,0 +1 @@
1
+ io_uring_prep_msg_ring.3
@@ -33,7 +33,7 @@ argument.
33
33
  The default behavior is a single-shot poll request. When the specified event
34
34
  has triggered, a completion CQE is posted and no more events will be generated
35
35
  by the poll request.
36
- .BR io_uring_prep_multishot (3)
36
+ .BR io_uring_prep_poll_multishot (3)
37
37
  behaves identically in terms of events, but it persist across notifications
38
38
  and will repeatedly post notifications for the same registration. A CQE
39
39
  posted from a multishot poll request will have
@@ -24,8 +24,10 @@ function prepares a request for providing the kernel with buffers. The
24
24
  submission queue entry
25
25
  .I sqe
26
26
  is setup to consume
27
+ .I nr
28
+ number of
27
29
  .I len
28
- number of buffers starting at
30
+ sized buffers starting at
29
31
  .I addr
30
32
  and identified by the buffer group ID of
31
33
  .I bgid
@@ -68,6 +70,18 @@ of 0, then the buffer IDs will range from
68
70
  The application must be aware of this to make sense of the buffer ID passed
69
71
  back in the CQE.
70
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
+
71
85
  Not all requests support buffer selection, as it only really makes sense for
72
86
  requests that receive data from the kernel rather than write or provide data.
73
87
  Currently, this mode of operation is supported for any file read or socket
@@ -88,8 +102,9 @@ These are the errors that are reported in the CQE
88
102
  .I res
89
103
  field. On success,
90
104
  .I res
91
- will contain the number of successfully provided buffers. On error,
92
- the following errors can occur.
105
+ will contain
106
+ .B 0
107
+ or the number of successfully provided buffers.
93
108
  .TP
94
109
  .B -ENOMEM
95
110
  The kernel was unable to allocate memory for the request.
@@ -107,12 +122,6 @@ buffers can be specified.
107
122
  .B -EFAULT
108
123
  Some of the user memory given was invalid for the application.
109
124
  .TP
110
- .B -EBADF
111
- On of the descriptors located in
112
- .I fds
113
- didn't refer to a valid file descriptor, or one of the file descriptors in
114
- the array referred to an io_uring instance.
115
- .TP
116
125
  .B -EOVERFLOW
117
126
  The product of
118
127
  .I len
@@ -43,7 +43,7 @@ possible to provide the desired IO offset from the application or library.
43
43
 
44
44
  On files that are not capable of seeking, the offset must be 0 or -1.
45
45
 
46
- After the write has been prepared it can be submitted with one of the submit
46
+ After the read has been prepared it can be submitted with one of the submit
47
47
  functions.
48
48
 
49
49
  .SH RETURN VALUE
@@ -64,8 +64,8 @@ directly in the CQE
64
64
  .I res
65
65
  field.
66
66
  .SH NOTES
67
- Unless an application explicitly needs to pass in more than iovec, it is more
68
- efficient to use
67
+ Unless an application explicitly needs to pass in more than one iovec, it
68
+ is more efficient to use
69
69
  .BR io_uring_prep_read (3)
70
70
  rather than this function, as no state has to be maintained for a
71
71
  non-vectored IO request.
@@ -69,7 +69,7 @@ possible to provide the desired IO offset from the application or library.
69
69
 
70
70
  On files that are not capable of seeking, the offset must be 0 or -1.
71
71
 
72
- After the write has been prepared, it can be submitted with one of the submit
72
+ After the read has been prepared, it can be submitted with one of the submit
73
73
  functions.
74
74
 
75
75
  .SH RETURN VALUE
@@ -90,8 +90,8 @@ directly in the CQE
90
90
  .I res
91
91
  field.
92
92
  .SH NOTES
93
- Unless an application explicitly needs to pass in more than iovec, it is more
94
- efficient to use
93
+ Unless an application explicitly needs to pass in more than one iovec, it
94
+ is more efficient to use
95
95
  .BR io_uring_prep_read (3)
96
96
  rather than this function, as no state has to be maintained for a
97
97
  non-vectored IO request.
@@ -30,10 +30,10 @@ queue entry
30
30
  .I sqe
31
31
  is setup to use the file descriptor
32
32
  .I sockfd
33
- to start receiving the data into the buffer destination
33
+ to start receiving the data into the destination buffer
34
34
  .I buf
35
35
  of size
36
- .I size
36
+ .I len
37
37
  and with modifier flags
38
38
  .IR flags .
39
39
 
@@ -43,14 +43,14 @@ request. See that man page for details on the arguments specified to this
43
43
  prep helper.
44
44
 
45
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 be 0
47
- , the
46
+ which repeatedly posts a CQE when data is available. It requires length to
47
+ be 0, the
48
48
  .B IOSQE_BUFFER_SELECT
49
49
  flag to be set and no
50
50
  .B MSG_WAITALL
51
51
  flag to be set.
52
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 it's result.
53
+ The application should check the flags of each CQE, regardless of its result.
54
54
  If a posted CQE does not have the
55
55
  .B IORING_CQE_F_MORE
56
56
  flag set then the multishot receive will be done and the application should issue a
@@ -49,20 +49,20 @@ flag to be set and no
49
49
  .B MSG_WAITALL
50
50
  flag to be set.
51
51
  Therefore each CQE will take a buffer out of a provided buffer pool for receiving.
52
- The application should check the flags of each CQE, regardless of it's result.
52
+ The application should check the flags of each CQE, regardless of its result.
53
53
  If a posted CQE does not have the
54
54
  .B IORING_CQE_F_MORE
55
55
  flag set then the multishot receive will be done and the application should issue a
56
56
  new request.
57
57
 
58
58
  Unlike
59
- .BR recvmsg (2)
60
- , multishot recvmsg will prepend a
59
+ .BR recvmsg (2),
60
+ multishot recvmsg will prepend a
61
61
  .I struct io_uring_recvmsg_out
62
62
  which describes the layout of the rest of the buffer in combination with the initial
63
63
  .I struct msghdr
64
64
  submitted with the request. See
65
- .B io_uring_recvmsg_out (3)
65
+ .BR io_uring_recvmsg_out (3)
66
66
  for more information on accessing the data.
67
67
 
68
68
  Multishot variants are available since kernel 6.0.
@@ -30,6 +30,15 @@ of size
30
30
  bytes and with modifier flags
31
31
  .IR flags .
32
32
 
33
+ Note that using
34
+ .B IOSQE_IO_LINK
35
+ with this request type requires the setting of
36
+ .B MSG_WAITALL
37
+ in the
38
+ .IR flags
39
+ argument, as a short send isn't a considered an error condition without
40
+ that being set.
41
+
33
42
  This function prepares an async
34
43
  .BR send (2)
35
44
  request. See that man page for details.
@@ -0,0 +1,38 @@
1
+ .\" Copyright (C) 2023 Rutvik Patel <heyrutvik@gmail.com>
2
+ .\"
3
+ .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
+ .\"
5
+ .TH io_uring_prep_send_set_addr 3 "January 23, 2023" "liburing-2.4" "liburing Manual"
6
+ .SH NAME
7
+ io_uring_prep_send_set_addr \- set address details for send requests
8
+ .SH SYNOPSIS
9
+ .nf
10
+ .B #include <liburing.h>
11
+ .PP
12
+ .BI "void io_uring_prep_send_set_addr(struct io_uring_sqe *" sqe ","
13
+ .BI " const struct sockaddr *" dest_addr ","
14
+ .BI " __u16 " addr_len ");"
15
+ .fi
16
+ .SH DESCRIPTION
17
+ .PP
18
+ The
19
+ .BR io_uring_prep_send_set_addr (3)
20
+ function sets a socket destination address specified by
21
+ .I dest_addr
22
+ and its length using
23
+ .I addr_len
24
+ parameters. It can be used once
25
+ .I sqe
26
+ is prepared using any of the
27
+ .BR send (2)
28
+ io_uring helpers. See man pages of
29
+ .BR io_uring_prep_send (3)
30
+ or
31
+ .BR io_uring_prep_send_zc (3).
32
+ .SH RETURN VALUE
33
+ None
34
+ .SH SEE ALSO
35
+ .BR io_uring_get_sqe (3),
36
+ .BR io_uring_prep_send (3),
37
+ .BR io_uring_prep_send_zc (3),
38
+ .BR send (2)
@@ -10,11 +10,19 @@ io_uring_prep_send_zc \- prepare a zerocopy send request
10
10
  .B #include <liburing.h>
11
11
  .PP
12
12
  .BI "void io_uring_prep_send_zc(struct io_uring_sqe *" sqe ","
13
- .BI " int " sockfd ","
14
- .BI " const void *" buf ","
15
- .BI " size_t " len ","
16
- .BI " int " flags ","
17
- .BI " int " zc_flags ");"
13
+ .BI " int " sockfd ","
14
+ .BI " const void *" buf ","
15
+ .BI " size_t " len ","
16
+ .BI " int " flags ","
17
+ .BI " unsigned " zc_flags ");"
18
+ .PP
19
+ .BI "void io_uring_prep_send_zc_fixed(struct io_uring_sqe *" sqe ","
20
+ .BI " int " sockfd ","
21
+ .BI " const void *" buf ","
22
+ .BI " size_t " len ","
23
+ .BI " int " flags ","
24
+ .BI " unsigned " zc_flags ");"
25
+ .BI " unsigned " buf_index ");"
18
26
  .fi
19
27
  .SH DESCRIPTION
20
28
  .PP
@@ -29,11 +37,35 @@ to start sending the data from
29
37
  of size
30
38
  .I len
31
39
  bytes with send modifier flags
32
- .IR flags
40
+ .I flags
33
41
  and zerocopy modifier flags
34
42
  .IR zc_flags .
35
43
 
36
- This function prepares an async zerocopy
44
+ The
45
+ .BR io_uring_prep_send_zc_fixed (3)
46
+ works just like
47
+ .BR io_uring_prep_send_zc (3)
48
+ except it requires the use of buffers that have been registered with
49
+ .BR io_uring_register_buffers (3).
50
+ The
51
+ .I buf
52
+ and
53
+ .I len
54
+ arguments must fall within a region specified by
55
+ .I buf_index
56
+ in the previously registered buffer. The buffer need not be aligned with the
57
+ start of the registered buffer.
58
+
59
+ Note that using
60
+ .B IOSQE_IO_LINK
61
+ with this request type requires the setting of
62
+ .B MSG_WAITALL
63
+ in the
64
+ .I flags
65
+ argument, as a short send isn't considered an error condition without
66
+ that being set.
67
+
68
+ These functions prepare an async zerocopy
37
69
  .BR send (2)
38
70
  request. See that man page for details. For details on the zerocopy nature
39
71
  of it, see
@@ -0,0 +1 @@
1
+ io_uring_prep_send_zc.3
@@ -15,6 +15,11 @@ io_uring_prep_sendmsg \- prepare a sendmsg request
15
15
  .BI " int " fd ","
16
16
  .BI " const struct msghdr *" msg ","
17
17
  .BI " unsigned " flags ");"
18
+ .PP
19
+ .BI "void io_uring_prep_sendmsg_zc(struct io_uring_sqe *" sqe ","
20
+ .BI " int " fd ","
21
+ .BI " const struct msghdr *" msg ","
22
+ .BI " unsigned " flags ");"
18
23
  .fi
19
24
  .SH DESCRIPTION
20
25
  .PP
@@ -32,6 +37,21 @@ defined flags in the
32
37
  .I flags
33
38
  argument.
34
39
 
40
+ The
41
+ .BR io_uring_prep_sendmsg_zc (3)
42
+ accepts the same parameters as
43
+ .BR io_uring_prep_sendmsg (3)
44
+ but prepares a zerocopy sendmsg request.
45
+
46
+ Note that using
47
+ .B IOSQE_IO_LINK
48
+ with this request type requires the setting of
49
+ .B MSG_WAITALL
50
+ in the
51
+ .I flags
52
+ argument, as a short send isn't considered an error condition without
53
+ that being set.
54
+
35
55
  This function prepares an async
36
56
  .BR sendmsg (2)
37
57
  request. See that man page for details.
@@ -0,0 +1 @@
1
+ io_uring_prep_sendmsg.3