polyphony 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/TODO.md +4 -0
  4. data/examples/core/debug.rb +12 -0
  5. data/examples/core/rpc_benchmark.rb +136 -0
  6. data/lib/polyphony/extensions/fiber.rb +1 -0
  7. data/lib/polyphony/extensions/socket.rb +42 -42
  8. data/lib/polyphony/version.rb +1 -1
  9. data/polyphony.gemspec +3 -1
  10. data/test/test_socket.rb +1 -1
  11. metadata +32 -149
  12. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +0 -1
  13. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +0 -1
  14. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +0 -1
  15. data/vendor/liburing/man/io_uring.7 +0 -781
  16. data/vendor/liburing/man/io_uring_buf_ring_add.3 +0 -53
  17. data/vendor/liburing/man/io_uring_buf_ring_advance.3 +0 -31
  18. data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +0 -41
  19. data/vendor/liburing/man/io_uring_buf_ring_init.3 +0 -30
  20. data/vendor/liburing/man/io_uring_buf_ring_mask.3 +0 -27
  21. data/vendor/liburing/man/io_uring_check_version.3 +0 -72
  22. data/vendor/liburing/man/io_uring_close_ring_fd.3 +0 -43
  23. data/vendor/liburing/man/io_uring_cq_advance.3 +0 -49
  24. data/vendor/liburing/man/io_uring_cq_has_overflow.3 +0 -25
  25. data/vendor/liburing/man/io_uring_cq_ready.3 +0 -26
  26. data/vendor/liburing/man/io_uring_cqe_get_data.3 +0 -53
  27. data/vendor/liburing/man/io_uring_cqe_get_data64.3 +0 -1
  28. data/vendor/liburing/man/io_uring_cqe_seen.3 +0 -42
  29. data/vendor/liburing/man/io_uring_enter.2 +0 -1700
  30. data/vendor/liburing/man/io_uring_enter2.2 +0 -1
  31. data/vendor/liburing/man/io_uring_free_probe.3 +0 -27
  32. data/vendor/liburing/man/io_uring_get_events.3 +0 -33
  33. data/vendor/liburing/man/io_uring_get_probe.3 +0 -30
  34. data/vendor/liburing/man/io_uring_get_sqe.3 +0 -57
  35. data/vendor/liburing/man/io_uring_major_version.3 +0 -1
  36. data/vendor/liburing/man/io_uring_minor_version.3 +0 -1
  37. data/vendor/liburing/man/io_uring_opcode_supported.3 +0 -30
  38. data/vendor/liburing/man/io_uring_peek_cqe.3 +0 -38
  39. data/vendor/liburing/man/io_uring_prep_accept.3 +0 -197
  40. data/vendor/liburing/man/io_uring_prep_accept_direct.3 +0 -1
  41. data/vendor/liburing/man/io_uring_prep_cancel.3 +0 -118
  42. data/vendor/liburing/man/io_uring_prep_cancel64.3 +0 -1
  43. data/vendor/liburing/man/io_uring_prep_close.3 +0 -59
  44. data/vendor/liburing/man/io_uring_prep_close_direct.3 +0 -1
  45. data/vendor/liburing/man/io_uring_prep_connect.3 +0 -66
  46. data/vendor/liburing/man/io_uring_prep_fadvise.3 +0 -59
  47. data/vendor/liburing/man/io_uring_prep_fallocate.3 +0 -59
  48. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +0 -1
  49. data/vendor/liburing/man/io_uring_prep_files_update.3 +0 -92
  50. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +0 -1
  51. data/vendor/liburing/man/io_uring_prep_fsync.3 +0 -70
  52. data/vendor/liburing/man/io_uring_prep_getxattr.3 +0 -61
  53. data/vendor/liburing/man/io_uring_prep_link.3 +0 -1
  54. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +0 -94
  55. data/vendor/liburing/man/io_uring_prep_linkat.3 +0 -91
  56. data/vendor/liburing/man/io_uring_prep_madvise.3 +0 -56
  57. data/vendor/liburing/man/io_uring_prep_mkdir.3 +0 -1
  58. data/vendor/liburing/man/io_uring_prep_mkdirat.3 +0 -83
  59. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +0 -92
  60. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +0 -1
  61. data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +0 -1
  62. data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +0 -1
  63. data/vendor/liburing/man/io_uring_prep_nop.3 +0 -28
  64. data/vendor/liburing/man/io_uring_prep_openat.3 +0 -117
  65. data/vendor/liburing/man/io_uring_prep_openat2.3 +0 -117
  66. data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +0 -1
  67. data/vendor/liburing/man/io_uring_prep_openat_direct.3 +0 -1
  68. data/vendor/liburing/man/io_uring_prep_poll_add.3 +0 -72
  69. data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +0 -1
  70. data/vendor/liburing/man/io_uring_prep_poll_remove.3 +0 -55
  71. data/vendor/liburing/man/io_uring_prep_poll_update.3 +0 -89
  72. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +0 -140
  73. data/vendor/liburing/man/io_uring_prep_read.3 +0 -69
  74. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +0 -72
  75. data/vendor/liburing/man/io_uring_prep_readv.3 +0 -85
  76. data/vendor/liburing/man/io_uring_prep_readv2.3 +0 -111
  77. data/vendor/liburing/man/io_uring_prep_recv.3 +0 -105
  78. data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +0 -1
  79. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +0 -124
  80. data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +0 -1
  81. data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +0 -52
  82. data/vendor/liburing/man/io_uring_prep_rename.3 +0 -1
  83. data/vendor/liburing/man/io_uring_prep_renameat.3 +0 -96
  84. data/vendor/liburing/man/io_uring_prep_send.3 +0 -66
  85. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +0 -38
  86. data/vendor/liburing/man/io_uring_prep_send_zc.3 +0 -96
  87. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +0 -1
  88. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +0 -89
  89. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +0 -1
  90. data/vendor/liburing/man/io_uring_prep_setxattr.3 +0 -64
  91. data/vendor/liburing/man/io_uring_prep_shutdown.3 +0 -53
  92. data/vendor/liburing/man/io_uring_prep_socket.3 +0 -118
  93. data/vendor/liburing/man/io_uring_prep_socket_direct.3 +0 -1
  94. data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +0 -1
  95. data/vendor/liburing/man/io_uring_prep_splice.3 +0 -120
  96. data/vendor/liburing/man/io_uring_prep_statx.3 +0 -74
  97. data/vendor/liburing/man/io_uring_prep_symlink.3 +0 -1
  98. data/vendor/liburing/man/io_uring_prep_symlinkat.3 +0 -85
  99. data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +0 -59
  100. data/vendor/liburing/man/io_uring_prep_tee.3 +0 -74
  101. data/vendor/liburing/man/io_uring_prep_timeout.3 +0 -95
  102. data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +0 -1
  103. data/vendor/liburing/man/io_uring_prep_timeout_update.3 +0 -98
  104. data/vendor/liburing/man/io_uring_prep_unlink.3 +0 -1
  105. data/vendor/liburing/man/io_uring_prep_unlinkat.3 +0 -82
  106. data/vendor/liburing/man/io_uring_prep_write.3 +0 -67
  107. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +0 -72
  108. data/vendor/liburing/man/io_uring_prep_writev.3 +0 -85
  109. data/vendor/liburing/man/io_uring_prep_writev2.3 +0 -111
  110. data/vendor/liburing/man/io_uring_queue_exit.3 +0 -26
  111. data/vendor/liburing/man/io_uring_queue_init.3 +0 -89
  112. data/vendor/liburing/man/io_uring_queue_init_params.3 +0 -1
  113. data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +0 -1
  114. data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +0 -1
  115. data/vendor/liburing/man/io_uring_recvmsg_name.3 +0 -1
  116. data/vendor/liburing/man/io_uring_recvmsg_out.3 +0 -82
  117. data/vendor/liburing/man/io_uring_recvmsg_payload.3 +0 -1
  118. data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +0 -1
  119. data/vendor/liburing/man/io_uring_recvmsg_validate.3 +0 -1
  120. data/vendor/liburing/man/io_uring_register.2 +0 -834
  121. data/vendor/liburing/man/io_uring_register_buf_ring.3 +0 -140
  122. data/vendor/liburing/man/io_uring_register_buffers.3 +0 -104
  123. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +0 -1
  124. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +0 -1
  125. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +0 -1
  126. data/vendor/liburing/man/io_uring_register_eventfd.3 +0 -51
  127. data/vendor/liburing/man/io_uring_register_eventfd_async.3 +0 -1
  128. data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +0 -52
  129. data/vendor/liburing/man/io_uring_register_files.3 +0 -112
  130. data/vendor/liburing/man/io_uring_register_files_sparse.3 +0 -1
  131. data/vendor/liburing/man/io_uring_register_files_tags.3 +0 -1
  132. data/vendor/liburing/man/io_uring_register_files_update.3 +0 -1
  133. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +0 -1
  134. data/vendor/liburing/man/io_uring_register_iowq_aff.3 +0 -61
  135. data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +0 -71
  136. data/vendor/liburing/man/io_uring_register_ring_fd.3 +0 -49
  137. data/vendor/liburing/man/io_uring_register_sync_cancel.3 +0 -71
  138. data/vendor/liburing/man/io_uring_setup.2 +0 -669
  139. data/vendor/liburing/man/io_uring_sq_ready.3 +0 -31
  140. data/vendor/liburing/man/io_uring_sq_space_left.3 +0 -25
  141. data/vendor/liburing/man/io_uring_sqe_set_data.3 +0 -48
  142. data/vendor/liburing/man/io_uring_sqe_set_data64.3 +0 -1
  143. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +0 -87
  144. data/vendor/liburing/man/io_uring_sqring_wait.3 +0 -34
  145. data/vendor/liburing/man/io_uring_submit.3 +0 -46
  146. data/vendor/liburing/man/io_uring_submit_and_get_events.3 +0 -31
  147. data/vendor/liburing/man/io_uring_submit_and_wait.3 +0 -38
  148. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +0 -56
  149. data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +0 -30
  150. data/vendor/liburing/man/io_uring_unregister_buffers.3 +0 -27
  151. data/vendor/liburing/man/io_uring_unregister_eventfd.3 +0 -1
  152. data/vendor/liburing/man/io_uring_unregister_files.3 +0 -27
  153. data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +0 -1
  154. data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +0 -32
  155. data/vendor/liburing/man/io_uring_wait_cqe.3 +0 -40
  156. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +0 -43
  157. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +0 -53
  158. data/vendor/liburing/man/io_uring_wait_cqes.3 +0 -56
@@ -1 +0,0 @@
1
- io_uring_enter.2
@@ -1,27 +0,0 @@
1
- .\" Copyright (C) 2022 Stefan Roesch <shr@fb.com>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_free_probe 3 "January 25, 2022" "liburing-2.1" "liburing Manual"
6
- .SH NAME
7
- io_uring_free_probe \- free probe instance
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "void io_uring_free_probe(struct io_uring_probe *" probe ");"
13
- .fi
14
- .SH DESCRIPTION
15
- .PP
16
- The function
17
- .BR io_uring_free_probe (3)
18
- frees the
19
- .I probe
20
- instance allocated with the
21
- .BR io_uring_get_probe (3)
22
- function.
23
-
24
- .SH RETURN VALUE
25
- None
26
- .SH SEE ALSO
27
- .BR io_uring_get_probe (3)
@@ -1,33 +0,0 @@
1
- .\" Copyright (C) 2022 Dylan Yudaken
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_get_events 3 "September 5, 2022" "liburing-2.3" "liburing Manual"
6
- .SH NAME
7
- io_uring_get_events \- Flush outstanding requests to CQE ring
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_get_events(struct io_uring *" ring ");"
13
- .fi
14
- .SH DESCRIPTION
15
- .PP
16
- The
17
- .BR io_uring_get_events (3)
18
- function runs outstanding work and flushes completion events to the CQE ring.
19
-
20
- There can be events needing to be flushed if the ring was full and had overflowed.
21
- Alternatively if the ring was setup with the
22
- .BR IORING_SETUP_DEFER_TASKRUN
23
- flag then this will process outstanding tasks, possibly resulting in more CQEs.
24
-
25
- .SH RETURN VALUE
26
- On success
27
- .BR io_uring_get_events (3)
28
- returns 0. On failure it returns
29
- .BR -errno .
30
- .SH SEE ALSO
31
- .BR io_uring_get_sqe (3),
32
- .BR io_uring_submit_and_get_events (3),
33
- .BR io_uring_cq_has_overflow (3)
@@ -1,30 +0,0 @@
1
- .\" Copyright (C) 2022 Stefan Roesch <shr@fb.com>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_get_probe 3 "January 25, 2022" "liburing-2.1" "liburing Manual"
6
- .SH NAME
7
- io_uring_get_probe \- get probe instance
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "io_uring_probe *io_uring_get_probe(void);"
13
- .fi
14
- .SH DESCRIPTION
15
- .PP
16
- The function
17
- .BR io_uring_get_probe (3)
18
- returns an allocated io_uring_probe structure to the caller. The caller is
19
- responsible for freeing the structure with the function
20
- .BR io_uring_free_probe (3).
21
-
22
- .SH NOTES
23
- Earlier versions of the Linux kernel do not support probe. If the kernel
24
- doesn't support probe, this function will return NULL.
25
-
26
- .SH RETURN VALUE
27
- On success it returns an allocated io_uring_probe structure, otherwise
28
- it returns NULL.
29
- .SH SEE ALSO
30
- .BR io_uring_free_probe (3)
@@ -1,57 +0,0 @@
1
- .\" Copyright (C) 2020 Jens Axboe <axboe@kernel.dk>
2
- .\" Copyright (C) 2020 Red Hat, Inc.
3
- .\"
4
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
5
- .\"
6
- .TH io_uring_get_sqe 3 "July 10, 2020" "liburing-0.7" "liburing Manual"
7
- .SH NAME
8
- io_uring_get_sqe \- get the next available submission queue entry from the
9
- submission queue
10
- .SH SYNOPSIS
11
- .nf
12
- .B #include <liburing.h>
13
- .PP
14
- .BI "struct io_uring_sqe *io_uring_get_sqe(struct io_uring *" ring ");"
15
- .fi
16
- .SH DESCRIPTION
17
- .PP
18
- The
19
- .BR io_uring_get_sqe (3)
20
- function gets the next available submission queue entry from the submission
21
- queue belonging to the
22
- .I ring
23
- param.
24
-
25
- On success
26
- .BR io_uring_get_sqe (3)
27
- returns a pointer to the submission queue entry. On failure NULL is returned.
28
-
29
- If a submission queue entry is returned, it should be filled out via one of the
30
- prep functions such as
31
- .BR io_uring_prep_read (3)
32
- and submitted via
33
- .BR io_uring_submit (3).
34
-
35
- Note that neither
36
- .BR io_uring_get_sqe
37
- nor the prep functions set (or clear) the
38
- .B user_data
39
- field of the SQE. If the caller expects
40
- .BR io_uring_cqe_get_data (3)
41
- or
42
- .BR io_uring_cqe_get_data64 (3)
43
- to return valid data when reaping IO completions, either
44
- .BR io_uring_sqe_set_data (3)
45
- or
46
- .BR io_uring_sqe_set_data64 (3)
47
- .B MUST
48
- have been called before submitting the request.
49
-
50
- .SH RETURN VALUE
51
- .BR io_uring_get_sqe (3)
52
- returns a pointer to the next submission queue event on success and NULL on
53
- failure. If NULL is returned, the SQ ring is currently full and entries must
54
- be submitted for processing before new ones can get allocated.
55
- .SH SEE ALSO
56
- .BR io_uring_submit (3),
57
- .BR io_uring_sqe_set_data (3)
@@ -1 +0,0 @@
1
- io_uring_check_version.3
@@ -1 +0,0 @@
1
- io_uring_check_version.3
@@ -1,30 +0,0 @@
1
- .\" Copyright (C) 2022 Stefan Roesch <shr@fb.com>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_opcode_supported 3 "January 25, 2022" "liburing-2.1" "liburing Manual"
6
- .SH NAME
7
- io_uring_opcode_supported \- is op code supported?
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_opcode_supported(struct io_uring_probe *" probe ","
13
- .BI " int " opcode ");"
14
- .fi
15
- .SH DESCRIPTION
16
- .PP
17
- The function
18
- .BR io_uring_opcode_supported (3)
19
- allows the caller to determine if the passed in
20
- .I opcode
21
- belonging to the
22
- .I probe
23
- param is supported. An instance of the io_uring_probe instance can be
24
- obtained by calling the function
25
- .BR io_uring_get_probe (3).
26
-
27
- .SH RETURN VALUE
28
- On success it returns 1, otherwise it returns 0.
29
- .SH SEE ALSO
30
- .BR io_uring_get_probe (3)
@@ -1,38 +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_peek_cqe 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_peek_cqe \- check if an io_uring completion event is available
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_peek_cqe(struct io_uring *" ring ","
13
- .BI " struct io_uring_cqe **" cqe_ptr ");"
14
- .fi
15
- .SH DESCRIPTION
16
- .PP
17
- The
18
- .BR io_uring_peek_cqe (3)
19
- function returns an IO completion from the queue belonging to the
20
- .I ring
21
- param, if one is readily available. On successful return,
22
- .I cqe_ptr
23
- param is filled with a valid CQE entry.
24
-
25
- This function does not enter the kernel to wait for an event, an event
26
- is only returned if it's already available in the CQ ring.
27
-
28
- .SH RETURN VALUE
29
- On success
30
- .BR io_uring_peek_cqe (3)
31
- returns
32
- .B 0
33
- and the cqe_ptr parameter is filled in. On failure it returns
34
- .BR -EAGAIN .
35
- .SH SEE ALSO
36
- .BR io_uring_submit (3),
37
- .BR io_uring_wait_cqes (3),
38
- .BR io_uring_wait_cqe (3)
@@ -1,197 +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_accept 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_accept \- prepare an accept request
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <sys/socket.h>
11
- .B #include <liburing.h>
12
- .PP
13
- .BI "void io_uring_prep_accept(struct io_uring_sqe *" sqe ","
14
- .BI " int " sockfd ","
15
- .BI " struct sockaddr *" addr ","
16
- .BI " socklen_t *" addrlen ","
17
- .BI " int " flags ");"
18
- .PP
19
- .BI "void io_uring_prep_accept_direct(struct io_uring_sqe *" sqe ","
20
- .BI " int " sockfd ","
21
- .BI " struct sockaddr *" addr ","
22
- .BI " socklen_t *" addrlen ","
23
- .BI " int " flags ","
24
- .BI " unsigned int " file_index ");"
25
- .PP
26
- .BI "void io_uring_prep_multishot_accept(struct io_uring_sqe *" sqe ","
27
- .BI " int " sockfd ","
28
- .BI " struct sockaddr *" addr ","
29
- .BI " socklen_t *" addrlen ","
30
- .BI " int " flags ");"
31
- .PP
32
- .BI "void io_uring_prep_multishot_accept_direct(struct io_uring_sqe *" sqe ","
33
- .BI " int " sockfd ","
34
- .BI " struct sockaddr *" addr ","
35
- .BI " socklen_t *" addrlen ","
36
- .BI " int " flags ");"
37
- .fi
38
- .SH DESCRIPTION
39
- .PP
40
- The
41
- .BR io_uring_prep_accept (3)
42
- function and its three variants prepare an accept request similar to
43
- .BR accept4 (2).
44
- The submission queue entry
45
- .I sqe
46
- is setup to use the file descriptor
47
- .I sockfd
48
- to start accepting a connection request described by the socket address at
49
- .I addr
50
- and of structure length
51
- .I addrlen
52
- and using modifier flags in
53
- .IR flags .
54
-
55
- The three variants allow combining the direct file table and multishot features.
56
-
57
- Direct descriptors are io_uring private file descriptors. They
58
- avoid some of the overhead associated with thread shared file tables and
59
- can be used in any io_uring request that takes a file descriptor.
60
- The two direct variants here create such direct descriptors.
61
- Subsequent to their creation, they can be used by setting
62
- .B IOSQE_FIXED_FILE
63
- in the SQE
64
- .I flags
65
- member, and setting the SQE
66
- .I fd
67
- field to the direct descriptor value rather than the regular file
68
- descriptor. Direct descriptors are managed like registered files.
69
-
70
- To use an accept direct variant, the application must first have registered
71
- a file table of a desired size using
72
- .BR io_uring_register_files (3)
73
- or
74
- .BR io_uring_register_files_sparse (3).
75
- Once registered,
76
- .BR io_uring_prep_accept_direct (3)
77
- allows an entry in that table to be specifically selected through the
78
- .I file_index
79
- argument.
80
- If the specified entry already contains a file, the file will first be removed
81
- from the table and closed, consistent with the behavior of updating an
82
- existing file with
83
- .BR io_uring_register_files_update (3).
84
- .I file_index
85
- can also be set to
86
- .B IORING_FILE_INDEX_ALLOC
87
- for this variant and
88
- an unused table index will be dynamically chosen and returned.
89
- Likewise,
90
- .B io_uring_prep_multishot_accept_direct
91
- will have an unused table index dynamically chosen and returned for each connection accepted.
92
- If both forms of direct selection will be employed, specific and dynamic, see
93
- .BR io_uring_register_file_alloc_range (3)
94
- for setting up the table so dynamically chosen entries are made against
95
- a different range than that targeted by specific requests.
96
-
97
- Note that old kernels don't check the SQE
98
- .I file_index
99
- field meaning
100
- applications cannot rely on a
101
- .B -EINVAL
102
- CQE
103
- .I res
104
- being returned when the kernel is too old because older kernels
105
- may not recognize they are being asked to use a direct table slot.
106
-
107
- When a direct descriptor accept request asks for a table slot to be
108
- dynamically chosen but there are no free entries,
109
- .B -ENFILE
110
- is returned as the CQE
111
- .IR res .
112
-
113
- The multishot variants allow an application to issue
114
- a single accept request, which will repeatedly trigger a CQE when a connection
115
- request comes in. Like other multishot type requests, the application should
116
- look at the CQE
117
- .I flags
118
- and see if
119
- .B IORING_CQE_F_MORE
120
- is set on completion as an indication of whether or not the accept request
121
- will generate further CQEs. Note that for the multishot variants, setting
122
- .B addr
123
- and
124
- .B addrlen
125
- may not make a lot of sense, as the same value would be used for every
126
- accepted connection. This means that the data written to
127
- .B addr
128
- may be overwritten by a new connection before the application has had time
129
- to process a past connection. If the application knows that a new connection
130
- cannot come in before a previous one has been processed, it may be used as
131
- expected. The multishot variants are available since 5.19.
132
-
133
- See the man page
134
- .BR accept4 (2)
135
- for details of the accept function itself.
136
-
137
- .SH RETURN VALUE
138
- None
139
- .SH ERRORS
140
- The CQE
141
- .I res
142
- field will contain the result of the operation.
143
-
144
- .BR io_uring_prep_accept (3)
145
- generates the installed file descriptor as its result.
146
-
147
- .BR io_uring_prep_accept_direct (3)
148
- and
149
- .I file_index
150
- set to a specific direct descriptor
151
- generates
152
- .B 0
153
- on success.
154
- The caller must remember which direct descriptor was picked for this request.
155
-
156
- .BR io_uring_prep_accept_direct (3)
157
- and
158
- .I file_index
159
- set to
160
- .B IORING_FILE_INDEX_ALLOC
161
- generates the dynamically chosen direct descriptor.
162
-
163
- .BR io_uring_prep_multishot_accept (3)
164
- generates the installed file descriptor in each result.
165
-
166
- .BR io_uring_prep_multishot_accept_direct (3),
167
- generates the dynamically chosen direct descriptor in each result.
168
-
169
- Note that where synchronous system calls will return
170
- .B -1
171
- on failure and set
172
- .I errno
173
- to the actual error value, io_uring never uses
174
- .IR errno .
175
- Instead it generates the negated
176
- .I errno
177
- directly in the CQE
178
- .I res
179
- field.
180
- .SH NOTES
181
- As with any request that passes in data in a struct, that data must remain
182
- valid until the request has been successfully submitted. It need not remain
183
- valid until completion. Once a request has been submitted, the in-kernel
184
- state is stable. Very early kernels (5.4 and earlier) required state to be
185
- stable until the completion occurred. Applications can test for this
186
- behavior by inspecting the
187
- .B IORING_FEAT_SUBMIT_STABLE
188
- flag passed back from
189
- .BR io_uring_queue_init_params (3).
190
- .SH SEE ALSO
191
- .BR io_uring_get_sqe (3),
192
- .BR io_uring_submit (3),
193
- .BR io_uring_register_files (3),
194
- .BR io_uring_register_files_sparse (3),
195
- .BR io_uring_register_file_alloc_range (3),
196
- .BR io_uring_register (2),
197
- .BR accept4 (2)
@@ -1 +0,0 @@
1
- io_uring_prep_accept.3
@@ -1,118 +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_cancel 3 "March 12, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_cancel \- prepare a cancelation request
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "void io_uring_prep_cancel64(struct io_uring_sqe *" sqe ","
13
- .BI " __u64 " user_data ","
14
- .BI " int " flags ");"
15
- .PP
16
- .BI "void io_uring_prep_cancel(struct io_uring_sqe *" sqe ","
17
- .BI " void *" user_data ","
18
- .BI " int " flags ");"
19
- .PP
20
- .BI "void io_uring_prep_cancel_fd(struct io_uring_sqe *" sqe ","
21
- .BI " int " fd ","
22
- .BI " int " flags ");"
23
- .fi
24
- .SH DESCRIPTION
25
- .PP
26
- The
27
- .BR io_uring_prep_cancel (3)
28
- function prepares a cancelation request. The submission queue entry
29
- .I sqe
30
- is prepared to cancel an existing request identified by
31
- .IR user_data .
32
- For the
33
- .I flags
34
- argument, see below.
35
-
36
- .BR io_uring_prep_cancel64 (3)
37
- is identical to
38
- .BR io_uring_prep_cancel (3) ,
39
- except it takes a 64-bit integer rather than a pointer type.
40
-
41
- The cancelation request will attempt to find the previously issued request
42
- identified by
43
- .I user_data
44
- and cancel it. The identifier is what the previously issued request has in
45
- their
46
- .I user_data
47
- field in the SQE.
48
-
49
- The
50
- .BR io_uring_prep_cancel_fd (3)
51
- function prepares a cancelation request. The submission queue entry
52
- .I sqe
53
- is prepared to cancel an existing request that used the file descriptor
54
- .IR fd .
55
- For the
56
- .I flags
57
- argument, see below.
58
-
59
- The cancelation request will attempt to find the previously issued request
60
- that used
61
- .I fd
62
- as the file descriptor and cancel it.
63
-
64
- By default, the first request matching the criteria given will be canceled.
65
- This can be modified with any of the following flags passed in:
66
- .TP
67
- .B IORING_ASYNC_CANCEL_ALL
68
- Cancel all requests that match the given criteria, rather than just canceling
69
- the first one found. Available since 5.19.
70
- .TP
71
- .B IORING_ASYNC_CANCEL_FD
72
- Match based on the file descriptor used in the original request rather than
73
- the user_data. This is what
74
- .BR io_uring_prep_cancel_fd (3)
75
- sets up. Available since 5.19.
76
- .TP
77
- .B IORING_ASYNC_CANCEL_ANY
78
- Match any request in the ring, regardless of user_data or file descriptor.
79
- Can be used to cancel any pending request in the ring. Available since 5.19.
80
- .P
81
-
82
- .SH RETURN VALUE
83
- None
84
- .SH ERRORS
85
- These are the errors that are reported in the CQE
86
- .I res
87
- field. If no flags are used to cancel multiple requests,
88
- .B 0
89
- is returned on success. If flags are used to match multiple requests, then
90
- a positive value is returned indicating how many requests were found and
91
- canceled.
92
- .TP
93
- .B -ENOENT
94
- The request identified by
95
- .I user_data
96
- could not be located. This could be because it completed before the cancelation
97
- request was issued, or if an invalid identifier is used.
98
- .TP
99
- .B -EINVAL
100
- One of the fields set in the SQE was invalid.
101
- .TP
102
- .B -EALREADY
103
- The execution state of the request has progressed far enough that cancelation
104
- is no longer possible. This should normally mean that it will complete shortly,
105
- either successfully, or interrupted due to the cancelation.
106
- .SH NOTES
107
- Although the cancelation request uses async request syntax, the kernel side of
108
- the cancelation is always run synchronously. It is guaranteed that a CQE is
109
- always generated by the time the cancel request has been submitted. If the
110
- cancelation is successful, the completion for the request targeted for
111
- cancelation will have been posted by the time submission returns. For
112
- .B -EALREADY
113
- it may take a bit of time to do so. For this case, the caller must wait for the
114
- canceled request to post its completion event.
115
- .SH SEE ALSO
116
- .BR io_uring_prep_poll_remove (3),
117
- .BR io_uring_get_sqe (3),
118
- .BR io_uring_submit (3)
@@ -1 +0,0 @@
1
- io_uring_prep_cancel.3
@@ -1,59 +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_close 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_close \- prepare a file descriptor close request
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "void io_uring_prep_close(struct io_uring_sqe *" sqe ","
13
- .BI " int " fd ");"
14
- .PP
15
- .BI "void io_uring_prep_close_direct(struct io_uring_sqe *" sqe ","
16
- .BI " unsigned " file_index ");"
17
- .PP
18
- .fi
19
- .SH DESCRIPTION
20
- .PP
21
- The
22
- .BR io_uring_prep_close (3)
23
- function prepares a close request. The submission queue entry
24
- .I sqe
25
- is setup to close the file descriptor indicated by
26
- .IR fd .
27
-
28
- For a direct descriptor close request, the offset is specified by the
29
- .I file_index
30
- argument instead of the
31
- .IR fd .
32
- This is identical to unregistering the direct descriptor, and is provided as
33
- a convenience.
34
-
35
- These functions prepare an async
36
- .BR close (2)
37
- request. See that man page for details.
38
-
39
- .SH RETURN VALUE
40
- None
41
- .SH ERRORS
42
- The CQE
43
- .I res
44
- field will contain the result of the operation. See the related man page for
45
- details on possible values. Note that where synchronous system calls will return
46
- .B -1
47
- on failure and set
48
- .I errno
49
- to the actual error value, io_uring never uses
50
- .IR errno .
51
- Instead it returns the negated
52
- .I errno
53
- directly in the CQE
54
- .I res
55
- field.
56
- .SH SEE ALSO
57
- .BR io_uring_get_sqe (3),
58
- .BR io_uring_submit (3),
59
- .BR close (2)
@@ -1 +0,0 @@
1
- io_uring_prep_close.3
@@ -1,66 +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_connect 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_prep_connect \- prepare a connect request
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <sys/types.h>
11
- .B #include <sys/socket.h>
12
- .B #include <liburing.h>
13
- .PP
14
- .BI "void io_uring_prep_connect(struct io_uring_sqe *" sqe ","
15
- .BI " int " sockfd ","
16
- .BI " const struct sockaddr *" addr ","
17
- .BI " socklen_t " addrlen ");"
18
- .fi
19
- .SH DESCRIPTION
20
- .PP
21
- The
22
- .BR io_uring_prep_connect (3)
23
- function prepares a connect request. The submission queue entry
24
- .I sqe
25
- is setup to use the file descriptor
26
- .I sockfd
27
- to start connecting to the destination described by the socket address at
28
- .I addr
29
- and of structure length
30
- .IR addrlen .
31
-
32
- This function prepares an async
33
- .BR connect (2)
34
- request. See that man page for details.
35
-
36
- .SH RETURN VALUE
37
- None
38
- .SH ERRORS
39
- The CQE
40
- .I res
41
- field will contain the result of the operation. See the related man page for
42
- details on possible values. Note that where synchronous system calls will return
43
- .B -1
44
- on failure and set
45
- .I errno
46
- to the actual error value, io_uring never uses
47
- .IR errno .
48
- Instead it returns the negated
49
- .I errno
50
- directly in the CQE
51
- .I res
52
- field.
53
- .SH NOTES
54
- As with any request that passes in data in a struct, that data must remain
55
- valid until the request has been successfully submitted. It need not remain
56
- valid until completion. Once a request has been submitted, the in-kernel
57
- state is stable. Very early kernels (5.4 and earlier) required state to be
58
- stable until the completion occurred. Applications can test for this
59
- behavior by inspecting the
60
- .B IORING_FEAT_SUBMIT_STABLE
61
- flag passed back from
62
- .BR io_uring_queue_init_params (3).
63
- .SH SEE ALSO
64
- .BR io_uring_get_sqe (3),
65
- .BR io_uring_submit (3),
66
- .BR connect (2)