MCPcopy Create free account
hub / github.com/axboe/liburing / test_ready

Function test_ready

test/epwait.c:21–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19static atomic_bool keep_running;
20
21static int test_ready(struct io_uring *ring, int efd)
22{
23 struct io_uring_sqe *sqe;
24 struct io_uring_cqe *cqe;
25 struct epoll_event out[2];
26 char tmp[16];
27 int i, ret;
28
29 for (i = 0; i < 2; i++) {
30 ret = write(fds[i][1], "foo", 3);
31 if (ret < 0)
32 perror("write");
33 }
34
35 memset(out, 0, sizeof(out));
36 sqe = io_uring_get_sqe(ring);
37 io_uring_prep_epoll_wait(sqe, efd, out, 2, 0);
38 sqe->user_data = 1;
39 io_uring_submit(ring);
40
41 for (i = 0; i < 1; i++) {
42 ret = io_uring_wait_cqe(ring, &cqe);
43 if (ret) {
44 fprintf(stderr, "wait_cqe ret = %d\n", ret);
45 return 1;
46 }
47 if (cqe->res == -EINVAL) {
48 no_epoll_wait = 1;
49 return 0;
50 }
51 io_uring_cqe_seen(ring, cqe);
52 }
53
54 for (i = 0; i < 2; i++) {
55 ret = read(out[i].data.fd, tmp, sizeof(tmp));
56 if (ret < 0)
57 perror("read");
58 }
59
60 return 0;
61}
62
63static int test_not_ready(struct io_uring *ring, int efd)
64{

Callers 1

testFunction · 0.70

Calls 2

io_uring_submitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected