* Helper for setting up an io_uring instance, skipping if the given user isn't * allowed to. */
| 125 | * allowed to. |
| 126 | */ |
| 127 | enum t_setup_ret t_create_ring_params(int depth, struct io_uring *ring, |
| 128 | struct io_uring_params *p) |
| 129 | { |
| 130 | int ret; |
| 131 | |
| 132 | ret = io_uring_queue_init_params(depth, ring, p); |
| 133 | if (!ret) |
| 134 | return T_SETUP_OK; |
| 135 | if ((p->flags & IORING_SETUP_SQPOLL) && ret == -EPERM && geteuid()) { |
| 136 | fprintf(stdout, "SQPOLL skipped for regular user\n"); |
| 137 | return T_SETUP_SKIP; |
| 138 | } |
| 139 | if (ret == -EINVAL) |
| 140 | return T_SETUP_SKIP; |
| 141 | |
| 142 | fprintf(stderr, "queue_init: %s\n", strerror(-ret)); |
| 143 | return ret; |
| 144 | } |
| 145 | |
| 146 | enum t_setup_ret t_create_ring(int depth, struct io_uring *ring, |
| 147 | unsigned int flags) |