| 61 | } |
| 62 | |
| 63 | static int test_not_ready(struct io_uring *ring, int efd) |
| 64 | { |
| 65 | struct io_uring_sqe *sqe; |
| 66 | struct io_uring_cqe *cqe; |
| 67 | struct epoll_event out[2]; |
| 68 | int i, ret, nr; |
| 69 | char tmp[16]; |
| 70 | |
| 71 | memset(out, 0, sizeof(out)); |
| 72 | sqe = io_uring_get_sqe(ring); |
| 73 | io_uring_prep_epoll_wait(sqe, efd, out, 2, 0); |
| 74 | sqe->user_data = 1; |
| 75 | io_uring_submit(ring); |
| 76 | |
| 77 | for (i = 0; i < 2; i++) { |
| 78 | usleep(10000); |
| 79 | ret = write(fds[i][1], "foo", 3); |
| 80 | if (ret < 0) |
| 81 | perror("write"); |
| 82 | } |
| 83 | |
| 84 | nr = 0; |
| 85 | for (i = 0; i < 1; i++) { |
| 86 | ret = io_uring_wait_cqe(ring, &cqe); |
| 87 | if (ret) { |
| 88 | fprintf(stderr, "wait_cqe ret = %d\n", ret); |
| 89 | break; |
| 90 | } |
| 91 | nr = cqe->res; |
| 92 | io_uring_cqe_seen(ring, cqe); |
| 93 | if (nr < 0) { |
| 94 | fprintf(stderr, "not ready res %d\n", nr); |
| 95 | return 1; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | for (i = 0; i < nr; i++) { |
| 100 | ret = read(out[i].data.fd, tmp, sizeof(tmp)); |
| 101 | if (ret < 0) |
| 102 | perror("read"); |
| 103 | } |
| 104 | |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | static int test_del(struct io_uring *ring, int efd) |
| 109 | { |
no test coverage detected