polyphony 0.94 → 0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +3 -3
  3. data/.github/workflows/test_io_uring.yml +4 -4
  4. data/.gitignore +3 -3
  5. data/CHANGELOG.md +19 -0
  6. data/docs/api-reference/fiber.md +2 -2
  7. data/docs/api-reference/object.md +3 -3
  8. data/docs/main-concepts/exception-handling.md +2 -2
  9. data/examples/adapters/redis_blpop.rb +4 -3
  10. data/examples/adapters/redis_channels.rb +16 -7
  11. data/examples/core/await.rb +1 -1
  12. data/examples/io/readline.rb +19 -0
  13. data/ext/polyphony/backend_common.c +25 -3
  14. data/ext/polyphony/backend_io_uring.c +18 -16
  15. data/ext/polyphony/backend_libev.c +2 -2
  16. data/ext/polyphony/event.c +1 -1
  17. data/ext/polyphony/extconf.rb +5 -3
  18. data/ext/polyphony/fiber.c +5 -13
  19. data/ext/polyphony/io_extensions.c +1 -1
  20. data/ext/polyphony/pipe.c +1 -1
  21. data/ext/polyphony/polyphony.c +1 -1
  22. data/ext/polyphony/polyphony_ext.c +1 -1
  23. data/ext/polyphony/queue.c +1 -1
  24. data/ext/polyphony/ring_buffer.c +1 -0
  25. data/ext/polyphony/socket_extensions.c +1 -1
  26. data/ext/polyphony/thread.c +1 -1
  27. data/lib/polyphony/adapters/readline.rb +6 -4
  28. data/lib/polyphony/adapters/redis.rb +28 -87
  29. data/lib/polyphony/core/channel.rb +15 -0
  30. data/lib/polyphony/core/sync.rb +4 -0
  31. data/lib/polyphony/debugger.rb +2 -2
  32. data/lib/polyphony/extensions/socket.rb +2 -0
  33. data/lib/polyphony/version.rb +1 -1
  34. data/lib/polyphony.rb +4 -0
  35. data/polyphony.gemspec +10 -10
  36. data/test/helper.rb +0 -5
  37. data/test/test_backend.rb +5 -1
  38. data/test/test_enumerator.rb +46 -0
  39. data/test/test_ext.rb +63 -0
  40. data/test/test_io.rb +241 -216
  41. data/test/test_socket.rb +1 -1
  42. data/test/test_thread_pool.rb +5 -5
  43. data/vendor/liburing/.github/workflows/build.yml +51 -5
  44. data/vendor/liburing/.github/workflows/shellcheck.yml +1 -1
  45. data/vendor/liburing/.gitignore +6 -123
  46. data/vendor/liburing/CHANGELOG +35 -0
  47. data/vendor/liburing/CITATION.cff +11 -0
  48. data/vendor/liburing/LICENSE +16 -3
  49. data/vendor/liburing/Makefile +3 -1
  50. data/vendor/liburing/Makefile.common +1 -0
  51. data/vendor/liburing/README +14 -2
  52. data/vendor/liburing/SECURITY.md +6 -0
  53. data/vendor/liburing/configure +16 -15
  54. data/vendor/liburing/examples/Makefile +4 -1
  55. data/vendor/liburing/examples/io_uring-udp.c +395 -0
  56. data/vendor/liburing/examples/poll-bench.c +101 -0
  57. data/vendor/liburing/examples/send-zerocopy.c +339 -0
  58. data/vendor/liburing/liburing.spec +1 -1
  59. data/vendor/liburing/man/io_uring.7 +38 -11
  60. data/vendor/liburing/man/io_uring_buf_ring_add.3 +53 -0
  61. data/vendor/liburing/man/io_uring_buf_ring_advance.3 +31 -0
  62. data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +41 -0
  63. data/vendor/liburing/man/io_uring_buf_ring_init.3 +30 -0
  64. data/vendor/liburing/man/io_uring_buf_ring_mask.3 +27 -0
  65. data/vendor/liburing/man/io_uring_cq_advance.3 +29 -15
  66. data/vendor/liburing/man/io_uring_cq_has_overflow.3 +25 -0
  67. data/vendor/liburing/man/io_uring_cq_ready.3 +9 -8
  68. data/vendor/liburing/man/io_uring_cqe_get_data.3 +32 -13
  69. data/vendor/liburing/man/io_uring_cqe_get_data64.3 +1 -0
  70. data/vendor/liburing/man/io_uring_cqe_seen.3 +22 -12
  71. data/vendor/liburing/man/io_uring_enter.2 +249 -32
  72. data/vendor/liburing/man/io_uring_enter2.2 +1 -0
  73. data/vendor/liburing/man/io_uring_free_probe.3 +11 -8
  74. data/vendor/liburing/man/io_uring_get_events.3 +33 -0
  75. data/vendor/liburing/man/io_uring_get_probe.3 +9 -8
  76. data/vendor/liburing/man/io_uring_get_sqe.3 +29 -10
  77. data/vendor/liburing/man/io_uring_opcode_supported.3 +11 -10
  78. data/vendor/liburing/man/io_uring_peek_cqe.3 +38 -0
  79. data/vendor/liburing/man/io_uring_prep_accept.3 +197 -0
  80. data/vendor/liburing/man/io_uring_prep_accept_direct.3 +1 -0
  81. data/vendor/liburing/man/io_uring_prep_cancel.3 +118 -0
  82. data/vendor/liburing/man/io_uring_prep_cancel64.3 +1 -0
  83. data/vendor/liburing/man/io_uring_prep_close.3 +59 -0
  84. data/vendor/liburing/man/io_uring_prep_close_direct.3 +1 -0
  85. data/vendor/liburing/man/io_uring_prep_connect.3 +66 -0
  86. data/vendor/liburing/man/io_uring_prep_fadvise.3 +59 -0
  87. data/vendor/liburing/man/io_uring_prep_fallocate.3 +59 -0
  88. data/vendor/liburing/man/io_uring_prep_files_update.3 +92 -0
  89. data/vendor/liburing/man/io_uring_prep_fsync.3 +70 -0
  90. data/vendor/liburing/man/io_uring_prep_link.3 +1 -0
  91. data/vendor/liburing/man/io_uring_prep_linkat.3 +91 -0
  92. data/vendor/liburing/man/io_uring_prep_madvise.3 +56 -0
  93. data/vendor/liburing/man/io_uring_prep_mkdir.3 +1 -0
  94. data/vendor/liburing/man/io_uring_prep_mkdirat.3 +83 -0
  95. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +39 -25
  96. data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +1 -0
  97. data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +1 -0
  98. data/vendor/liburing/man/io_uring_prep_nop.3 +28 -0
  99. data/vendor/liburing/man/io_uring_prep_openat.3 +117 -0
  100. data/vendor/liburing/man/io_uring_prep_openat2.3 +117 -0
  101. data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +1 -0
  102. data/vendor/liburing/man/io_uring_prep_openat_direct.3 +1 -0
  103. data/vendor/liburing/man/io_uring_prep_poll_add.3 +72 -0
  104. data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +1 -0
  105. data/vendor/liburing/man/io_uring_prep_poll_remove.3 +55 -0
  106. data/vendor/liburing/man/io_uring_prep_poll_update.3 +89 -0
  107. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +131 -0
  108. data/vendor/liburing/man/io_uring_prep_read.3 +33 -14
  109. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +39 -21
  110. data/vendor/liburing/man/io_uring_prep_readv.3 +49 -15
  111. data/vendor/liburing/man/io_uring_prep_readv2.3 +49 -17
  112. data/vendor/liburing/man/io_uring_prep_recv.3 +105 -0
  113. data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +1 -0
  114. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +124 -0
  115. data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +1 -0
  116. data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +52 -0
  117. data/vendor/liburing/man/io_uring_prep_rename.3 +1 -0
  118. data/vendor/liburing/man/io_uring_prep_renameat.3 +96 -0
  119. data/vendor/liburing/man/io_uring_prep_send.3 +57 -0
  120. data/vendor/liburing/man/io_uring_prep_send_zc.3 +64 -0
  121. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +69 -0
  122. data/vendor/liburing/man/io_uring_prep_shutdown.3 +53 -0
  123. data/vendor/liburing/man/io_uring_prep_socket.3 +118 -0
  124. data/vendor/liburing/man/io_uring_prep_socket_direct.3 +1 -0
  125. data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +1 -0
  126. data/vendor/liburing/man/io_uring_prep_splice.3 +80 -0
  127. data/vendor/liburing/man/io_uring_prep_statx.3 +74 -0
  128. data/vendor/liburing/man/io_uring_prep_symlink.3 +1 -0
  129. data/vendor/liburing/man/io_uring_prep_symlinkat.3 +85 -0
  130. data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +59 -0
  131. data/vendor/liburing/man/io_uring_prep_tee.3 +74 -0
  132. data/vendor/liburing/man/io_uring_prep_timeout.3 +95 -0
  133. data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +1 -0
  134. data/vendor/liburing/man/io_uring_prep_timeout_update.3 +98 -0
  135. data/vendor/liburing/man/io_uring_prep_unlink.3 +1 -0
  136. data/vendor/liburing/man/io_uring_prep_unlinkat.3 +82 -0
  137. data/vendor/liburing/man/io_uring_prep_write.3 +32 -15
  138. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +39 -21
  139. data/vendor/liburing/man/io_uring_prep_writev.3 +50 -16
  140. data/vendor/liburing/man/io_uring_prep_writev2.3 +50 -17
  141. data/vendor/liburing/man/io_uring_queue_exit.3 +3 -4
  142. data/vendor/liburing/man/io_uring_queue_init.3 +58 -13
  143. data/vendor/liburing/man/io_uring_queue_init_params.3 +1 -0
  144. data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +1 -0
  145. data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +1 -0
  146. data/vendor/liburing/man/io_uring_recvmsg_name.3 +1 -0
  147. data/vendor/liburing/man/io_uring_recvmsg_out.3 +78 -0
  148. data/vendor/liburing/man/io_uring_recvmsg_payload.3 +1 -0
  149. data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +1 -0
  150. data/vendor/liburing/man/io_uring_recvmsg_validate.3 +1 -0
  151. data/vendor/liburing/man/io_uring_register.2 +153 -13
  152. data/vendor/liburing/man/io_uring_register_buf_ring.3 +140 -0
  153. data/vendor/liburing/man/io_uring_register_buffers.3 +32 -12
  154. data/vendor/liburing/man/io_uring_register_eventfd.3 +51 -0
  155. data/vendor/liburing/man/io_uring_register_eventfd_async.3 +1 -0
  156. data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +52 -0
  157. data/vendor/liburing/man/io_uring_register_files.3 +33 -11
  158. data/vendor/liburing/man/io_uring_register_files_sparse.3 +1 -0
  159. data/vendor/liburing/man/io_uring_register_iowq_aff.3 +61 -0
  160. data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +71 -0
  161. data/vendor/liburing/man/io_uring_register_ring_fd.3 +49 -0
  162. data/vendor/liburing/man/io_uring_register_sync_cancel.3 +71 -0
  163. data/vendor/liburing/man/io_uring_setup.2 +119 -13
  164. data/vendor/liburing/man/io_uring_sq_ready.3 +14 -8
  165. data/vendor/liburing/man/io_uring_sq_space_left.3 +9 -9
  166. data/vendor/liburing/man/io_uring_sqe_set_data.3 +29 -11
  167. data/vendor/liburing/man/io_uring_sqe_set_data64.3 +1 -0
  168. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +38 -11
  169. data/vendor/liburing/man/io_uring_sqring_wait.3 +13 -9
  170. data/vendor/liburing/man/io_uring_submit.3 +29 -12
  171. data/vendor/liburing/man/io_uring_submit_and_get_events.3 +31 -0
  172. data/vendor/liburing/man/io_uring_submit_and_wait.3 +16 -12
  173. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +30 -23
  174. data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +30 -0
  175. data/vendor/liburing/man/io_uring_unregister_buffers.3 +11 -10
  176. data/vendor/liburing/man/io_uring_unregister_eventfd.3 +1 -0
  177. data/vendor/liburing/man/io_uring_unregister_files.3 +11 -10
  178. data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +1 -0
  179. data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +32 -0
  180. data/vendor/liburing/man/io_uring_wait_cqe.3 +19 -12
  181. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +21 -14
  182. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +27 -13
  183. data/vendor/liburing/man/io_uring_wait_cqes.3 +24 -14
  184. data/vendor/liburing/src/Makefile +8 -7
  185. data/vendor/liburing/src/arch/aarch64/lib.h +48 -0
  186. data/vendor/liburing/src/arch/aarch64/syscall.h +0 -4
  187. data/vendor/liburing/src/arch/generic/lib.h +0 -4
  188. data/vendor/liburing/src/arch/generic/syscall.h +29 -16
  189. data/vendor/liburing/src/arch/syscall-defs.h +41 -14
  190. data/vendor/liburing/src/arch/x86/lib.h +0 -21
  191. data/vendor/liburing/src/arch/x86/syscall.h +146 -10
  192. data/vendor/liburing/src/include/liburing/io_uring.h +245 -5
  193. data/vendor/liburing/src/include/liburing.h +468 -35
  194. data/vendor/liburing/src/int_flags.h +1 -0
  195. data/vendor/liburing/src/lib.h +20 -16
  196. data/vendor/liburing/src/liburing.map +16 -0
  197. data/vendor/liburing/src/nolibc.c +1 -1
  198. data/vendor/liburing/src/queue.c +87 -55
  199. data/vendor/liburing/src/register.c +129 -53
  200. data/vendor/liburing/src/setup.c +65 -28
  201. data/vendor/liburing/src/syscall.c +14 -32
  202. data/vendor/liburing/src/syscall.h +12 -64
  203. data/vendor/liburing/test/{232c93d07b74-test.c → 232c93d07b74.c} +8 -9
  204. data/vendor/liburing/test/{35fa71a030ca-test.c → 35fa71a030ca.c} +4 -4
  205. data/vendor/liburing/test/{500f9fbadef8-test.c → 500f9fbadef8.c} +7 -7
  206. data/vendor/liburing/test/{7ad0e4b2f83c-test.c → 7ad0e4b2f83c.c} +8 -7
  207. data/vendor/liburing/test/{8a9973408177-test.c → 8a9973408177.c} +4 -3
  208. data/vendor/liburing/test/{917257daa0fe-test.c → 917257daa0fe.c} +3 -2
  209. data/vendor/liburing/test/Makefile +60 -62
  210. data/vendor/liburing/test/{a0908ae19763-test.c → a0908ae19763.c} +3 -2
  211. data/vendor/liburing/test/{a4c0b3decb33-test.c → a4c0b3decb33.c} +3 -2
  212. data/vendor/liburing/test/accept-link.c +5 -4
  213. data/vendor/liburing/test/accept-reuse.c +17 -16
  214. data/vendor/liburing/test/accept-test.c +14 -10
  215. data/vendor/liburing/test/accept.c +529 -107
  216. data/vendor/liburing/test/across-fork.c +7 -6
  217. data/vendor/liburing/test/{b19062a56726-test.c → b19062a56726.c} +3 -2
  218. data/vendor/liburing/test/{b5837bd5311d-test.c → b5837bd5311d.c} +10 -9
  219. data/vendor/liburing/test/buf-ring.c +420 -0
  220. data/vendor/liburing/test/{ce593a6c480a-test.c → ce593a6c480a.c} +15 -12
  221. data/vendor/liburing/test/connect.c +8 -7
  222. data/vendor/liburing/test/cq-full.c +5 -4
  223. data/vendor/liburing/test/cq-overflow.c +242 -12
  224. data/vendor/liburing/test/cq-peek-batch.c +5 -4
  225. data/vendor/liburing/test/cq-ready.c +5 -4
  226. data/vendor/liburing/test/cq-size.c +5 -4
  227. data/vendor/liburing/test/{d4ae271dfaae-test.c → d4ae271dfaae.c} +2 -2
  228. data/vendor/liburing/test/{d77a67ed5f27-test.c → d77a67ed5f27.c} +6 -6
  229. data/vendor/liburing/test/defer-taskrun.c +336 -0
  230. data/vendor/liburing/test/defer.c +26 -14
  231. data/vendor/liburing/test/double-poll-crash.c +15 -5
  232. data/vendor/liburing/test/drop-submit.c +5 -3
  233. data/vendor/liburing/test/{eeed8b54e0df-test.c → eeed8b54e0df.c} +7 -6
  234. data/vendor/liburing/test/empty-eownerdead.c +4 -4
  235. data/vendor/liburing/test/eventfd-disable.c +48 -20
  236. data/vendor/liburing/test/eventfd-reg.c +10 -9
  237. data/vendor/liburing/test/eventfd-ring.c +13 -12
  238. data/vendor/liburing/test/eventfd.c +13 -12
  239. data/vendor/liburing/test/exit-no-cleanup.c +1 -1
  240. data/vendor/liburing/test/fadvise.c +3 -3
  241. data/vendor/liburing/test/fallocate.c +16 -9
  242. data/vendor/liburing/test/{fc2a85cb02ef-test.c → fc2a85cb02ef.c} +4 -3
  243. data/vendor/liburing/test/fd-pass.c +187 -0
  244. data/vendor/liburing/test/file-register.c +302 -36
  245. data/vendor/liburing/test/file-update.c +62 -4
  246. data/vendor/liburing/test/file-verify.c +6 -2
  247. data/vendor/liburing/test/files-exit-hang-poll.c +11 -25
  248. data/vendor/liburing/test/files-exit-hang-timeout.c +13 -10
  249. data/vendor/liburing/test/fixed-buf-iter.c +115 -0
  250. data/vendor/liburing/test/fixed-link.c +10 -10
  251. data/vendor/liburing/test/fixed-reuse.c +160 -0
  252. data/vendor/liburing/test/fpos.c +6 -3
  253. data/vendor/liburing/test/fsync.c +3 -3
  254. data/vendor/liburing/test/hardlink.c +10 -6
  255. data/vendor/liburing/test/helpers.c +137 -4
  256. data/vendor/liburing/test/helpers.h +27 -0
  257. data/vendor/liburing/test/io-cancel.c +16 -11
  258. data/vendor/liburing/test/io_uring_enter.c +46 -81
  259. data/vendor/liburing/test/io_uring_passthrough.c +451 -0
  260. data/vendor/liburing/test/io_uring_register.c +59 -229
  261. data/vendor/liburing/test/io_uring_setup.c +24 -29
  262. data/vendor/liburing/test/iopoll-leak.c +85 -0
  263. data/vendor/liburing/test/iopoll.c +16 -9
  264. data/vendor/liburing/test/lfs-openat-write.c +3 -1
  265. data/vendor/liburing/test/link-timeout.c +4 -3
  266. data/vendor/liburing/test/link.c +8 -7
  267. data/vendor/liburing/test/madvise.c +2 -2
  268. data/vendor/liburing/test/mkdir.c +9 -5
  269. data/vendor/liburing/test/msg-ring.c +46 -20
  270. data/vendor/liburing/test/multicqes_drain.c +51 -12
  271. data/vendor/liburing/test/nolibc.c +60 -0
  272. data/vendor/liburing/test/nop.c +78 -16
  273. data/vendor/liburing/test/nvme.h +168 -0
  274. data/vendor/liburing/test/open-direct-link.c +188 -0
  275. data/vendor/liburing/test/open-direct-pick.c +180 -0
  276. data/vendor/liburing/test/openat2.c +3 -3
  277. data/vendor/liburing/test/poll-cancel-all.c +472 -0
  278. data/vendor/liburing/test/poll-link.c +9 -18
  279. data/vendor/liburing/test/poll-mshot-overflow.c +162 -0
  280. data/vendor/liburing/test/poll-mshot-update.c +83 -33
  281. data/vendor/liburing/test/pollfree.c +2 -2
  282. data/vendor/liburing/test/read-before-exit.c +112 -0
  283. data/vendor/liburing/test/read-write.c +83 -1
  284. data/vendor/liburing/test/recv-msgall-stream.c +398 -0
  285. data/vendor/liburing/test/recv-msgall.c +265 -0
  286. data/vendor/liburing/test/recv-multishot.c +505 -0
  287. data/vendor/liburing/test/rename.c +2 -5
  288. data/vendor/liburing/test/ring-leak.c +97 -0
  289. data/vendor/liburing/test/ringbuf-read.c +200 -0
  290. data/vendor/liburing/test/rsrc_tags.c +25 -13
  291. data/vendor/liburing/test/runtests-quiet.sh +11 -0
  292. data/vendor/liburing/test/runtests.sh +18 -20
  293. data/vendor/liburing/test/rw_merge_test.c +3 -2
  294. data/vendor/liburing/test/send-zerocopy.c +684 -0
  295. data/vendor/liburing/test/send_recv.c +49 -2
  296. data/vendor/liburing/test/send_recvmsg.c +165 -55
  297. data/vendor/liburing/test/shutdown.c +3 -4
  298. data/vendor/liburing/test/sigfd-deadlock.c +22 -8
  299. data/vendor/liburing/test/single-issuer.c +171 -0
  300. data/vendor/liburing/test/socket-rw-eagain.c +2 -12
  301. data/vendor/liburing/test/socket-rw-offset.c +2 -11
  302. data/vendor/liburing/test/socket-rw.c +2 -11
  303. data/vendor/liburing/test/socket.c +409 -0
  304. data/vendor/liburing/test/sq-poll-dup.c +1 -1
  305. data/vendor/liburing/test/sq-poll-share.c +1 -1
  306. data/vendor/liburing/test/statx.c +2 -2
  307. data/vendor/liburing/test/submit-and-wait.c +108 -0
  308. data/vendor/liburing/test/submit-link-fail.c +5 -3
  309. data/vendor/liburing/test/submit-reuse.c +0 -2
  310. data/vendor/liburing/test/sync-cancel.c +235 -0
  311. data/vendor/liburing/test/test.h +35 -0
  312. data/vendor/liburing/test/timeout-overflow.c +11 -11
  313. data/vendor/liburing/test/timeout.c +7 -7
  314. data/vendor/liburing/test/tty-write-dpoll.c +60 -0
  315. data/vendor/liburing/test/unlink.c +1 -1
  316. data/vendor/liburing/test/xattr.c +425 -0
  317. metadata +160 -52
  318. data/Gemfile.lock +0 -78
@@ -15,6 +15,7 @@
15
15
  #include <unistd.h>
16
16
 
17
17
  #include "liburing.h"
18
+ #include "helpers.h"
18
19
 
19
20
 
20
21
  struct forktestmem
@@ -141,13 +142,13 @@ int main(int argc, char *argv[])
141
142
  pid_t p;
142
143
 
143
144
  if (argc > 1)
144
- return 0;
145
+ return T_EXIT_SKIP;
145
146
 
146
147
  shmem = mmap(0, sizeof(struct forktestmem), PROT_READ|PROT_WRITE,
147
148
  MAP_SHARED | MAP_ANONYMOUS, 0, 0);
148
149
  if (!shmem) {
149
150
  fprintf(stderr, "mmap failed\n");
150
- exit(1);
151
+ exit(T_EXIT_FAIL);
151
152
  }
152
153
 
153
154
  pthread_barrierattr_init(&shmem->barrierattr);
@@ -157,12 +158,12 @@ int main(int argc, char *argv[])
157
158
  ret = io_uring_queue_init(10, &shmem->ring, 0);
158
159
  if (ret < 0) {
159
160
  fprintf(stderr, "queue init failed\n");
160
- exit(1);
161
+ exit(T_EXIT_FAIL);
161
162
  }
162
163
 
163
164
  if (mkdtemp(tmpdir) == NULL) {
164
165
  fprintf(stderr, "temp directory creation failed\n");
165
- exit(1);
166
+ exit(T_EXIT_FAIL);
166
167
  }
167
168
 
168
169
  shared_fd = open_tempfile(tmpdir, "shared");
@@ -275,9 +276,9 @@ int main(int argc, char *argv[])
275
276
  goto errcleanup;
276
277
 
277
278
  cleanup(tmpdir);
278
- exit(0);
279
+ exit(T_EXIT_PASS);
279
280
 
280
281
  errcleanup:
281
282
  cleanup(tmpdir);
282
- exit(1);
283
+ exit(T_EXIT_FAIL);
283
284
  }
@@ -11,12 +11,13 @@
11
11
  #include <unistd.h>
12
12
 
13
13
  #include "liburing.h"
14
+ #include "helpers.h"
14
15
  #include "../src/syscall.h"
15
16
 
16
17
  int main(int argc, char *argv[])
17
18
  {
18
19
  if (argc > 1)
19
- return 0;
20
+ return T_EXIT_SKIP;
20
21
 
21
22
  mmap((void *) 0x20000000, 0x1000000, 3, 0x32, -1, 0);
22
23
 
@@ -49,5 +50,5 @@ int main(int argc, char *argv[])
49
50
  *(uint32_t*)0x2000026c = 0;
50
51
  *(uint64_t*)0x20000270 = 0;
51
52
  __sys_io_uring_setup(0xc9f, (struct io_uring_params *) 0x20000200);
52
- return 0;
53
+ return T_EXIT_PASS;
53
54
  }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  #include <stdio.h>
6
6
  #include "liburing.h"
7
+ #include "helpers.h"
7
8
 
8
9
  int main(int argc, char *argv[])
9
10
  {
@@ -17,11 +18,11 @@ int main(int argc, char *argv[])
17
18
  };
18
19
 
19
20
  if (argc > 1)
20
- return 0;
21
+ return T_EXIT_SKIP;
21
22
 
22
23
  if (io_uring_queue_init(4, &ring, 0) != 0) {
23
24
  fprintf(stderr, "ring setup failed\n");
24
- return 1;
25
+ return T_EXIT_FAIL;
25
26
  }
26
27
 
27
28
  /*
@@ -31,14 +32,14 @@ int main(int argc, char *argv[])
31
32
  sqe = io_uring_get_sqe(&ring);
32
33
  if (!sqe) {
33
34
  fprintf(stderr, "get sqe failed\n");
34
- return 1;
35
+ return T_EXIT_FAIL;
35
36
  }
36
37
  io_uring_prep_timeout(sqe, &ts, (unsigned)-1, 0);
37
38
 
38
39
  ret = io_uring_submit(&ring);
39
40
  if (ret != 1) {
40
41
  fprintf(stderr, "Got submit %d, expected 1\n", ret);
41
- return 1;
42
+ return T_EXIT_FAIL;
42
43
  }
43
44
 
44
45
  /*
@@ -50,28 +51,28 @@ int main(int argc, char *argv[])
50
51
  sqe = io_uring_get_sqe(&ring);
51
52
  if (!sqe) {
52
53
  fprintf(stderr, "get sqe failed\n");
53
- return 1;
54
+ return T_EXIT_FAIL;
54
55
  }
55
56
  io_uring_prep_nop(sqe);
56
57
 
57
58
  ret = io_uring_submit_and_wait(&ring, 2);
58
59
  if (ret != 1) {
59
60
  fprintf(stderr, "Got submit %d, expected 1\n", ret);
60
- return 1;
61
+ return T_EXIT_FAIL;
61
62
  }
62
63
 
63
64
  if (io_uring_peek_cqe(&ring, &cqe) != 0) {
64
65
  fprintf(stderr, "Unable to peek cqe!\n");
65
- return 1;
66
+ return T_EXIT_FAIL;
66
67
  }
67
68
 
68
69
  io_uring_cqe_seen(&ring, cqe);
69
70
 
70
71
  if (io_uring_peek_cqe(&ring, &cqe) != 0) {
71
72
  fprintf(stderr, "Unable to peek cqe!\n");
72
- return 1;
73
+ return T_EXIT_FAIL;
73
74
  }
74
75
 
75
76
  io_uring_queue_exit(&ring);
76
- return 0;
77
+ return T_EXIT_PASS;
77
78
  }
@@ -0,0 +1,420 @@
1
+ /* SPDX-License-Identifier: MIT */
2
+ /*
3
+ * Description: run various shared buffer ring sanity checks
4
+ *
5
+ */
6
+ #include <errno.h>
7
+ #include <stdio.h>
8
+ #include <unistd.h>
9
+ #include <stdlib.h>
10
+ #include <string.h>
11
+ #include <fcntl.h>
12
+
13
+ #include "liburing.h"
14
+ #include "helpers.h"
15
+
16
+ static int no_buf_ring;
17
+
18
+ /* test trying to register classic group when ring group exists */
19
+ static int test_mixed_reg2(int bgid)
20
+ {
21
+ struct io_uring_buf_reg reg = { };
22
+ struct io_uring_sqe *sqe;
23
+ struct io_uring_cqe *cqe;
24
+ struct io_uring ring;
25
+ void *ptr, *bufs;
26
+ int ret;
27
+
28
+ ret = t_create_ring(1, &ring, 0);
29
+ if (ret == T_SETUP_SKIP)
30
+ return 0;
31
+ else if (ret != T_SETUP_OK)
32
+ return 1;
33
+
34
+ if (posix_memalign(&ptr, 4096, 4096))
35
+ return 1;
36
+
37
+ reg.ring_addr = (unsigned long) ptr;
38
+ reg.ring_entries = 32;
39
+ reg.bgid = bgid;
40
+
41
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
42
+ if (ret) {
43
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
44
+ return 1;
45
+ }
46
+
47
+ /* provide classic buffers, group 1 */
48
+ bufs = malloc(8 * 1024);
49
+ sqe = io_uring_get_sqe(&ring);
50
+ io_uring_prep_provide_buffers(sqe, bufs, 1024, 8, bgid, 0);
51
+ io_uring_submit(&ring);
52
+ ret = io_uring_wait_cqe(&ring, &cqe);
53
+ if (ret) {
54
+ fprintf(stderr, "wait_cqe %d\n", ret);
55
+ return 1;
56
+ }
57
+ if (cqe->res != -EEXIST && cqe->res != -EINVAL) {
58
+ fprintf(stderr, "cqe res %d\n", cqe->res);
59
+ return 1;
60
+ }
61
+ io_uring_cqe_seen(&ring, cqe);
62
+
63
+ io_uring_queue_exit(&ring);
64
+ return 0;
65
+ }
66
+
67
+ /* test trying to register ring group when classic group exists */
68
+ static int test_mixed_reg(int bgid)
69
+ {
70
+ struct io_uring_buf_reg reg = { };
71
+ struct io_uring_sqe *sqe;
72
+ struct io_uring_cqe *cqe;
73
+ struct io_uring ring;
74
+ void *ptr, *bufs;
75
+ int ret;
76
+
77
+ ret = t_create_ring(1, &ring, 0);
78
+ if (ret == T_SETUP_SKIP)
79
+ return 0;
80
+ else if (ret != T_SETUP_OK)
81
+ return 1;
82
+
83
+ /* provide classic buffers, group 1 */
84
+ bufs = malloc(8 * 1024);
85
+ sqe = io_uring_get_sqe(&ring);
86
+ io_uring_prep_provide_buffers(sqe, bufs, 1024, 8, bgid, 0);
87
+ io_uring_submit(&ring);
88
+ ret = io_uring_wait_cqe(&ring, &cqe);
89
+ if (ret) {
90
+ fprintf(stderr, "wait_cqe %d\n", ret);
91
+ return 1;
92
+ }
93
+ if (cqe->res) {
94
+ fprintf(stderr, "cqe res %d\n", cqe->res);
95
+ return 1;
96
+ }
97
+ io_uring_cqe_seen(&ring, cqe);
98
+
99
+ if (posix_memalign(&ptr, 4096, 4096))
100
+ return 1;
101
+
102
+ reg.ring_addr = (unsigned long) ptr;
103
+ reg.ring_entries = 32;
104
+ reg.bgid = bgid;
105
+
106
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
107
+ if (ret != -EEXIST) {
108
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
109
+ return 1;
110
+ }
111
+
112
+ io_uring_queue_exit(&ring);
113
+ return 0;
114
+ }
115
+
116
+ static int test_double_reg_unreg(int bgid)
117
+ {
118
+ struct io_uring_buf_reg reg = { };
119
+ struct io_uring ring;
120
+ void *ptr;
121
+ int ret;
122
+
123
+ ret = t_create_ring(1, &ring, 0);
124
+ if (ret == T_SETUP_SKIP)
125
+ return 0;
126
+ else if (ret != T_SETUP_OK)
127
+ return 1;
128
+
129
+ if (posix_memalign(&ptr, 4096, 4096))
130
+ return 1;
131
+
132
+ reg.ring_addr = (unsigned long) ptr;
133
+ reg.ring_entries = 32;
134
+ reg.bgid = bgid;
135
+
136
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
137
+ if (ret) {
138
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
139
+ return 1;
140
+ }
141
+
142
+ /* check that 2nd register with same bgid fails */
143
+ reg.ring_addr = (unsigned long) ptr;
144
+ reg.ring_entries = 32;
145
+ reg.bgid = bgid;
146
+
147
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
148
+ if (ret != -EEXIST) {
149
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
150
+ return 1;
151
+ }
152
+
153
+ ret = io_uring_unregister_buf_ring(&ring, bgid);
154
+ if (ret) {
155
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
156
+ return 1;
157
+ }
158
+
159
+ ret = io_uring_unregister_buf_ring(&ring, bgid);
160
+ if (ret != -EINVAL && ret != -ENOENT) {
161
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
162
+ return 1;
163
+ }
164
+
165
+ io_uring_queue_exit(&ring);
166
+ return 0;
167
+ }
168
+
169
+ static int test_reg_unreg(int bgid)
170
+ {
171
+ struct io_uring_buf_reg reg = { };
172
+ struct io_uring ring;
173
+ void *ptr;
174
+ int ret;
175
+
176
+ ret = t_create_ring(1, &ring, 0);
177
+ if (ret == T_SETUP_SKIP)
178
+ return 0;
179
+ else if (ret != T_SETUP_OK)
180
+ return 1;
181
+
182
+ if (posix_memalign(&ptr, 4096, 4096))
183
+ return 1;
184
+
185
+ reg.ring_addr = (unsigned long) ptr;
186
+ reg.ring_entries = 32;
187
+ reg.bgid = bgid;
188
+
189
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
190
+ if (ret) {
191
+ if (ret == -EINVAL) {
192
+ no_buf_ring = 1;
193
+ return 0;
194
+ }
195
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
196
+ return 1;
197
+ }
198
+
199
+ ret = io_uring_unregister_buf_ring(&ring, bgid);
200
+ if (ret) {
201
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
202
+ return 1;
203
+ }
204
+
205
+ io_uring_queue_exit(&ring);
206
+ return 0;
207
+ }
208
+
209
+ static int test_bad_reg(int bgid)
210
+ {
211
+ struct io_uring ring;
212
+ int ret;
213
+ struct io_uring_buf_reg reg = { };
214
+
215
+ ret = t_create_ring(1, &ring, 0);
216
+ if (ret == T_SETUP_SKIP)
217
+ return 0;
218
+ else if (ret != T_SETUP_OK)
219
+ return 1;
220
+
221
+ reg.ring_addr = 4096;
222
+ reg.ring_entries = 32;
223
+ reg.bgid = bgid;
224
+
225
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
226
+ if (!ret)
227
+ fprintf(stderr, "Buffer ring register worked unexpectedly\n");
228
+
229
+ io_uring_queue_exit(&ring);
230
+ return !ret;
231
+ }
232
+
233
+ static int test_one_read(int fd, int bgid, struct io_uring *ring)
234
+ {
235
+ int ret;
236
+ struct io_uring_cqe *cqe;
237
+ struct io_uring_sqe *sqe;
238
+
239
+ sqe = io_uring_get_sqe(ring);
240
+ if (!sqe) {
241
+ fprintf(stderr, "get sqe failed\n");
242
+ return -1;
243
+ }
244
+
245
+ io_uring_prep_read(sqe, fd, NULL, 1, 0);
246
+ sqe->flags |= IOSQE_BUFFER_SELECT;
247
+ sqe->buf_group = bgid;
248
+ ret = io_uring_submit(ring);
249
+ if (ret <= 0) {
250
+ fprintf(stderr, "sqe submit failed: %d\n", ret);
251
+ return -1;
252
+ }
253
+
254
+ ret = io_uring_wait_cqe(ring, &cqe);
255
+ if (ret < 0) {
256
+ fprintf(stderr, "wait completion %d\n", ret);
257
+ return -1;
258
+ }
259
+ ret = cqe->res;
260
+ io_uring_cqe_seen(ring, cqe);
261
+
262
+ if (ret == -ENOBUFS)
263
+ return ret;
264
+
265
+ if (ret != 1) {
266
+ fprintf(stderr, "read result %d\n", ret);
267
+ return -1;
268
+ }
269
+
270
+ return cqe->flags >> 16;
271
+ }
272
+
273
+ static int test_running(int bgid, int entries, int loops)
274
+ {
275
+ struct io_uring_buf_reg reg = { };
276
+ struct io_uring ring;
277
+ void *ptr;
278
+ char buffer[8];
279
+ int ret;
280
+ int ring_size = (entries * sizeof(struct io_uring_buf) + 4095) & (~4095);
281
+ int ring_mask = io_uring_buf_ring_mask(entries);
282
+
283
+ int loop, idx;
284
+ bool *buffers;
285
+ struct io_uring_buf_ring *br;
286
+ int read_fd;
287
+
288
+ ret = t_create_ring(1, &ring, 0);
289
+ if (ret == T_SETUP_SKIP)
290
+ return 0;
291
+ else if (ret != T_SETUP_OK)
292
+ return 1;
293
+
294
+ if (posix_memalign(&ptr, 4096, ring_size))
295
+ return 1;
296
+
297
+ br = (struct io_uring_buf_ring *)ptr;
298
+ io_uring_buf_ring_init(br);
299
+
300
+ buffers = malloc(sizeof(bool) * entries);
301
+ if (!buffers)
302
+ return 1;
303
+
304
+ read_fd = open("/dev/zero", O_RDONLY);
305
+ if (read_fd < 0)
306
+ return 1;
307
+
308
+ reg.ring_addr = (unsigned long) ptr;
309
+ reg.ring_entries = entries;
310
+ reg.bgid = bgid;
311
+
312
+ ret = io_uring_register_buf_ring(&ring, &reg, 0);
313
+ if (ret) {
314
+ /* by now should have checked if this is supported or not */
315
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
316
+ return 1;
317
+ }
318
+
319
+ for (loop = 0; loop < loops; loop++) {
320
+ memset(buffers, 0, sizeof(bool) * entries);
321
+ for (idx = 0; idx < entries; idx++)
322
+ io_uring_buf_ring_add(br, buffer, sizeof(buffer), idx, ring_mask, idx);
323
+ io_uring_buf_ring_advance(br, entries);
324
+
325
+ for (idx = 0; idx < entries; idx++) {
326
+ memset(buffer, 1, sizeof(buffer));
327
+ ret = test_one_read(read_fd, bgid, &ring);
328
+ if (ret < 0) {
329
+ fprintf(stderr, "bad run %d/%d = %d\n", loop, idx, ret);
330
+ return ret;
331
+ }
332
+ if (buffers[ret]) {
333
+ fprintf(stderr, "reused buffer %d/%d = %d!\n", loop, idx, ret);
334
+ return 1;
335
+ }
336
+ if (buffer[0] != 0) {
337
+ fprintf(stderr, "unexpected read %d %d/%d = %d!\n",
338
+ (int)buffer[0], loop, idx, ret);
339
+ return 1;
340
+ }
341
+ if (buffer[1] != 1) {
342
+ fprintf(stderr, "unexpected spilled read %d %d/%d = %d!\n",
343
+ (int)buffer[1], loop, idx, ret);
344
+ return 1;
345
+ }
346
+ buffers[ret] = true;
347
+ }
348
+ ret = test_one_read(read_fd, bgid, &ring);
349
+ if (ret != -ENOBUFS) {
350
+ fprintf(stderr, "expected enobufs run %d = %d\n", loop, ret);
351
+ return 1;
352
+ }
353
+
354
+ }
355
+
356
+ ret = io_uring_unregister_buf_ring(&ring, bgid);
357
+ if (ret) {
358
+ fprintf(stderr, "Buffer ring register failed %d\n", ret);
359
+ return 1;
360
+ }
361
+
362
+ close(read_fd);
363
+ io_uring_queue_exit(&ring);
364
+ free(buffers);
365
+ return 0;
366
+ }
367
+
368
+ int main(int argc, char *argv[])
369
+ {
370
+ int bgids[] = { 1, 127, -1 };
371
+ int entries[] = {1, 32768, 4096, -1 };
372
+ int ret, i;
373
+
374
+ if (argc > 1)
375
+ return T_EXIT_SKIP;
376
+
377
+ for (i = 0; bgids[i] != -1; i++) {
378
+ ret = test_reg_unreg(bgids[i]);
379
+ if (ret) {
380
+ fprintf(stderr, "test_reg_unreg failed\n");
381
+ return T_EXIT_FAIL;
382
+ }
383
+ if (no_buf_ring)
384
+ break;
385
+
386
+ ret = test_bad_reg(bgids[i]);
387
+ if (ret) {
388
+ fprintf(stderr, "test_bad_reg failed\n");
389
+ return T_EXIT_FAIL;
390
+ }
391
+
392
+ ret = test_double_reg_unreg(bgids[i]);
393
+ if (ret) {
394
+ fprintf(stderr, "test_double_reg_unreg failed\n");
395
+ return T_EXIT_FAIL;
396
+ }
397
+
398
+ ret = test_mixed_reg(bgids[i]);
399
+ if (ret) {
400
+ fprintf(stderr, "test_mixed_reg failed\n");
401
+ return T_EXIT_FAIL;
402
+ }
403
+
404
+ ret = test_mixed_reg2(bgids[i]);
405
+ if (ret) {
406
+ fprintf(stderr, "test_mixed_reg2 failed\n");
407
+ return T_EXIT_FAIL;
408
+ }
409
+ }
410
+
411
+ for (i = 0; !no_buf_ring && entries[i] != -1; i++) {
412
+ ret = test_running(2, entries[i], 3);
413
+ if (ret) {
414
+ fprintf(stderr, "test_running(%d) failed\n", entries[i]);
415
+ return T_EXIT_FAIL;
416
+ }
417
+ }
418
+
419
+ return T_EXIT_PASS;
420
+ }
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
46
46
  pthread_t tid;
47
47
 
48
48
  if (argc > 1)
49
- return 0;
49
+ return T_EXIT_SKIP;
50
50
 
51
51
  /* Create an eventfd to be registered with the loop to be
52
52
  * notified of events being ready
@@ -54,14 +54,14 @@ int main(int argc, char *argv[])
54
54
  loop_fd = eventfd(0, EFD_CLOEXEC);
55
55
  if (loop_fd == -1) {
56
56
  fprintf(stderr, "eventfd errno=%d\n", errno);
57
- return 1;
57
+ return T_EXIT_FAIL;
58
58
  }
59
59
 
60
60
  /* Create an eventfd that can create events */
61
61
  use_fd = other_fd = eventfd(0, EFD_CLOEXEC);
62
62
  if (other_fd == -1) {
63
63
  fprintf(stderr, "eventfd errno=%d\n", errno);
64
- return 1;
64
+ return T_EXIT_FAIL;
65
65
  }
66
66
 
67
67
  if (use_sqpoll)
@@ -70,21 +70,21 @@ int main(int argc, char *argv[])
70
70
  /* Setup the ring with a registered event fd to be notified on events */
71
71
  ret = t_create_ring_params(8, &ring, &p);
72
72
  if (ret == T_SETUP_SKIP)
73
- return 0;
73
+ return T_EXIT_PASS;
74
74
  else if (ret < 0)
75
75
  return ret;
76
76
 
77
77
  ret = io_uring_register_eventfd(&ring, loop_fd);
78
78
  if (ret < 0) {
79
79
  fprintf(stderr, "register_eventfd=%d\n", ret);
80
- return 1;
80
+ return T_EXIT_FAIL;
81
81
  }
82
82
 
83
83
  if (use_sqpoll) {
84
84
  ret = io_uring_register_files(&ring, &other_fd, 1);
85
85
  if (ret < 0) {
86
86
  fprintf(stderr, "register_files=%d\n", ret);
87
- return 1;
87
+ return T_EXIT_FAIL;
88
88
  }
89
89
  use_fd = 0;
90
90
  }
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
98
98
  ret = io_uring_submit(&ring);
99
99
  if (ret != 1) {
100
100
  fprintf(stderr, "submit=%d\n", ret);
101
- return 1;
101
+ return T_EXIT_FAIL;
102
102
  }
103
103
 
104
104
  /*
@@ -111,13 +111,16 @@ int main(int argc, char *argv[])
111
111
  (void*) (intptr_t) other_fd);
112
112
 
113
113
  /* Wait on the event fd for an event to be ready */
114
- ret = read(loop_fd, buf, 8);
114
+ do {
115
+ ret = read(loop_fd, buf, 8);
116
+ } while (ret < 0 && errno == EINTR);
117
+
115
118
  if (ret < 0) {
116
119
  perror("read");
117
- return 1;
120
+ return T_EXIT_FAIL;
118
121
  } else if (ret != 8) {
119
122
  fprintf(stderr, "Odd-sized eventfd read: %d\n", ret);
120
- return 1;
123
+ return T_EXIT_FAIL;
121
124
  }
122
125
 
123
126
 
@@ -128,9 +131,9 @@ int main(int argc, char *argv[])
128
131
  }
129
132
  if (cqe->res < 0) {
130
133
  fprintf(stderr, "cqe->res=%d\n", cqe->res);
131
- return 1;
134
+ return T_EXIT_FAIL;
132
135
  }
133
136
 
134
137
  io_uring_cqe_seen(&ring, cqe);
135
- return 0;
138
+ return T_EXIT_PASS;
136
139
  }
@@ -17,6 +17,7 @@
17
17
  #include <arpa/inet.h>
18
18
 
19
19
  #include "liburing.h"
20
+ #include "helpers.h"
20
21
 
21
22
  static int no_connect;
22
23
  static unsigned short use_port;
@@ -360,12 +361,12 @@ int main(int argc, char *argv[])
360
361
  int ret;
361
362
 
362
363
  if (argc > 1)
363
- return 0;
364
+ return T_EXIT_SKIP;
364
365
 
365
366
  ret = io_uring_queue_init(8, &ring, 0);
366
367
  if (ret) {
367
368
  fprintf(stderr, "io_uring_queue_setup() = %d\n", ret);
368
- return 1;
369
+ return T_EXIT_FAIL;
369
370
  }
370
371
 
371
372
  srand(getpid());
@@ -376,23 +377,23 @@ int main(int argc, char *argv[])
376
377
  ret = test_connect_with_no_peer(&ring);
377
378
  if (ret == -1) {
378
379
  fprintf(stderr, "test_connect_with_no_peer(): failed\n");
379
- return 1;
380
+ return T_EXIT_FAIL;
380
381
  }
381
382
  if (no_connect)
382
- return 0;
383
+ return T_EXIT_SKIP;
383
384
 
384
385
  ret = test_connect(&ring);
385
386
  if (ret == -1) {
386
387
  fprintf(stderr, "test_connect(): failed\n");
387
- return 1;
388
+ return T_EXIT_FAIL;
388
389
  }
389
390
 
390
391
  ret = test_connect_timeout(&ring);
391
392
  if (ret == -1) {
392
393
  fprintf(stderr, "test_connect_timeout(): failed\n");
393
- return 1;
394
+ return T_EXIT_FAIL;
394
395
  }
395
396
 
396
397
  io_uring_queue_exit(&ring);
397
- return 0;
398
+ return T_EXIT_PASS;
398
399
  }