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

Function test_invalid

test/send_recv.c:324–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static int test_invalid(void)
325{
326 struct io_uring ring;
327 int ret, i;
328 int fds[2];
329 struct io_uring_cqe *cqe;
330 struct io_uring_sqe *sqe;
331
332 ret = t_create_ring(8, &ring, IORING_SETUP_SUBMIT_ALL);
333 if (ret) {
334 if (ret == -EINVAL)
335 return 0;
336 return ret;
337 }
338
339 ret = t_create_socket_pair(fds, true);
340 if (ret)
341 return ret;
342
343 sqe = io_uring_get_sqe(&ring);
344 io_uring_prep_sendmsg(sqe, fds[0], NULL, MSG_WAITALL);
345 sqe->flags |= IOSQE_ASYNC;
346
347 sqe = io_uring_get_sqe(&ring);
348 io_uring_prep_recvmsg(sqe, fds[1], NULL, 0);
349 sqe->flags |= IOSQE_ASYNC;
350
351 ret = io_uring_submit_and_wait(&ring, 2);
352 if (ret != 2)
353 return ret;
354
355 for (i = 0; i < 2; i++) {
356 ret = io_uring_peek_cqe(&ring, &cqe);
357 if (ret || cqe->res != -EFAULT)
358 return -1;
359 io_uring_cqe_seen(&ring, cqe);
360 }
361
362 io_uring_queue_exit(&ring);
363 close(fds[0]);
364 close(fds[1]);
365 return 0;
366}
367
368int main(int argc, char *argv[])
369{

Callers 1

mainFunction · 0.70

Calls 5

t_create_ringFunction · 0.85
t_create_socket_pairFunction · 0.85
io_uring_submit_and_waitFunction · 0.85
io_uring_queue_exitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected