| 113 | } |
| 114 | |
| 115 | static void queue_accept_conn(struct io_uring *ring, int fd, |
| 116 | struct accept_test_args args) |
| 117 | { |
| 118 | struct io_uring_sqe *sqe; |
| 119 | int ret; |
| 120 | int fixed_idx = args.fixed ? 0 : -1; |
| 121 | int count = 1 + args.extra_loops; |
| 122 | |
| 123 | if (args.multishot) { |
| 124 | queue_accept_multishot(ring, fd, INITIAL_USER_DATA, args.fixed); |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | while (count--) { |
| 129 | sqe = io_uring_get_sqe(ring); |
| 130 | if (fixed_idx < 0) { |
| 131 | io_uring_prep_accept(sqe, fd, NULL, NULL, 0); |
| 132 | } else { |
| 133 | io_uring_prep_accept_direct(sqe, fd, NULL, NULL, |
| 134 | 0, fixed_idx); |
| 135 | } |
| 136 | ret = io_uring_submit(ring); |
| 137 | assert(ret != -1); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | static int accept_conn(struct io_uring *ring, int fixed_idx, int *multishot, int fd) |
| 142 | { |