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

Function wait_for

test/connect.c:62–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62static int wait_for(struct io_uring *ring, int fd, int mask)
63{
64 struct io_uring_sqe *sqe;
65 int ret, res;
66
67 sqe = io_uring_get_sqe(ring);
68 if (!sqe) {
69 fprintf(stderr, "unable to get sqe\n");
70 return -1;
71 }
72
73 io_uring_prep_poll_add(sqe, fd, mask);
74 sqe->user_data = 2;
75
76 ret = submit_and_wait(ring, &res);
77 if (ret)
78 return -1;
79
80 if (res < 0) {
81 fprintf(stderr, "poll(): failed with %d\n", res);
82 return -1;
83 }
84
85 return res;
86}
87
88static int listen_on_socket(int fd)
89{

Callers 1

connect_socketFunction · 0.85

Calls 2

submit_and_waitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected