* Main event loop, Submit our multishot accept request, and then just loop * around handling incoming connections. */
| 2109 | * around handling incoming connections. |
| 2110 | */ |
| 2111 | static int parent_loop(struct io_uring *ring, int fd) |
| 2112 | { |
| 2113 | struct io_uring_sqe *sqe; |
| 2114 | |
| 2115 | /* |
| 2116 | * proxy provides a way to use either multishot receive or not, but |
| 2117 | * for accept, we always use multishot. A multishot accept request |
| 2118 | * needs only be armed once, and then it'll trigger a completion and |
| 2119 | * post a CQE whenever a new connection is accepted. No need to do |
| 2120 | * anything else, unless the multishot accept terminates. This happens |
| 2121 | * if it encounters an error. Applications should check for |
| 2122 | * IORING_CQE_F_MORE in cqe->flags - this tells you if more completions |
| 2123 | * are expected from this request or not. Non-multishot never have |
| 2124 | * this set, where multishot will always have this set unless an error |
| 2125 | * occurs. |
| 2126 | */ |
| 2127 | sqe = get_sqe(ring); |
| 2128 | if (fixed_files) |
| 2129 | io_uring_prep_multishot_accept_direct(sqe, fd, NULL, NULL, 0); |
| 2130 | else |
| 2131 | io_uring_prep_multishot_accept(sqe, fd, NULL, NULL, 0); |
| 2132 | __encode_userdata(sqe, 0, __ACCEPT, 0, fd); |
| 2133 | |
| 2134 | return __event_loop(ring, NULL); |
| 2135 | } |
| 2136 | |
| 2137 | static int init_ring(struct io_uring *ring, int nr_files) |
| 2138 | { |
no test coverage detected