| 106 | } |
| 107 | |
| 108 | static int test_del(struct io_uring *ring, int efd) |
| 109 | { |
| 110 | struct io_uring_sqe *sqe; |
| 111 | struct io_uring_cqe *cqe; |
| 112 | struct epoll_event ev, out[2]; |
| 113 | int i, ret; |
| 114 | char tmp[16]; |
| 115 | |
| 116 | memset(out, 0, sizeof(out)); |
| 117 | sqe = io_uring_get_sqe(ring); |
| 118 | io_uring_prep_epoll_wait(sqe, efd, out, 2, 0); |
| 119 | sqe->user_data = 1; |
| 120 | io_uring_submit(ring); |
| 121 | |
| 122 | ev.events = EPOLLIN; |
| 123 | ev.data.fd = fds[0][0]; |
| 124 | ret = epoll_ctl(efd, EPOLL_CTL_DEL, fds[0][0], &ev); |
| 125 | if (ret < 0) { |
| 126 | perror("epoll_ctl"); |
| 127 | return T_EXIT_FAIL; |
| 128 | } |
| 129 | |
| 130 | for (i = 0; i < 2; i++) { |
| 131 | ret = write(fds[i][1], "foo", 3); |
| 132 | if (ret < 0) |
| 133 | perror("write"); |
| 134 | } |
| 135 | |
| 136 | for (i = 0; i < 1; i++) { |
| 137 | ret = io_uring_wait_cqe(ring, &cqe); |
| 138 | if (ret) { |
| 139 | fprintf(stderr, "wait_cqe ret = %d\n", ret); |
| 140 | break; |
| 141 | } |
| 142 | io_uring_cqe_seen(ring, cqe); |
| 143 | } |
| 144 | |
| 145 | for (i = 0; i < 2; i++) { |
| 146 | ret = read(fds[i][0], tmp, sizeof(tmp)); |
| 147 | if (ret < 0) |
| 148 | perror("read"); |
| 149 | } |
| 150 | |
| 151 | ev.events = EPOLLIN; |
| 152 | ev.data.fd = fds[0][0]; |
| 153 | ret = epoll_ctl(efd, EPOLL_CTL_ADD, fds[0][0], &ev); |
| 154 | if (ret < 0) { |
| 155 | perror("epoll_ctl"); |
| 156 | return T_EXIT_FAIL; |
| 157 | } |
| 158 | |
| 159 | return 0; |
| 160 | } |
| 161 | |
| 162 | static int test_remove(struct io_uring *ring, int efd) |
| 163 | { |
no test coverage detected