| 153 | } |
| 154 | |
| 155 | enum t_setup_ret t_register_buffers(struct io_uring *ring, |
| 156 | const struct iovec *iovecs, |
| 157 | unsigned nr_iovecs) |
| 158 | { |
| 159 | int ret; |
| 160 | |
| 161 | ret = io_uring_register_buffers(ring, iovecs, nr_iovecs); |
| 162 | if (!ret) |
| 163 | return T_SETUP_OK; |
| 164 | |
| 165 | if ((ret == -EPERM || ret == -ENOMEM) && geteuid()) { |
| 166 | fprintf(stdout, "too large non-root buffer registration, skip\n"); |
| 167 | return T_SETUP_SKIP; |
| 168 | } |
| 169 | |
| 170 | fprintf(stderr, "buffer register failed: %s\n", strerror(-ret)); |
| 171 | return ret; |
| 172 | } |
| 173 | |
| 174 | int t_create_socket_pair(int fd[2], bool stream) |
| 175 | { |