test/sq-poll-dup: modify ring fd hack to work with enter_ring_fd No application should be directly modifying the ring_fd, it's done just to test some internals. Make sure it works with the split of ring_fd and enter_ring_fd. Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/test/sq-poll-dup.c b/test/sq-poll-dup.c index 9596866..0076a31 100644 --- a/test/sq-poll-dup.c +++ b/test/sq-poll-dup.c
@@ -10,7 +10,6 @@ #include <string.h> #include <fcntl.h> #include <sys/types.h> -#include <poll.h> #include <sys/eventfd.h> #include <sys/resource.h> @@ -29,9 +28,14 @@ static int wait_io(struct io_uring *ring, int nr_ios) { struct io_uring_cqe *cqe; + int ret; while (nr_ios) { - io_uring_wait_cqe(ring, &cqe); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) { + fprintf(stderr, "wait_ret=%d\n", ret); + return 1; + } if (cqe->res != BS) { fprintf(stderr, "Unexpected ret %d\n", cqe->res); return 1; @@ -123,7 +127,7 @@ ring_fd = dup(rings[0].ring_fd); if (close_ring) close(rings[0].ring_fd); - rings[0].ring_fd = ring_fd; + rings[0].ring_fd = rings[0].enter_ring_fd = ring_fd; if (do_dup_and_close) goto done;