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

Function test_invalid_zc

test/send-zerocopy.c:739–779  ·  view source on GitHub ↗

see also send_recv.c:test_invalid */

Source from the content-addressed store, hash-verified

737
738/* see also send_recv.c:test_invalid */
739static int test_invalid_zc(int fds[2])
740{
741 struct io_uring ring;
742 int ret;
743 struct io_uring_cqe *cqe;
744 struct io_uring_sqe *sqe;
745 bool notif = false;
746
747 if (!has_sendmsg)
748 return 0;
749
750 ret = t_create_ring(8, &ring, 0);
751 if (ret)
752 return ret;
753
754 sqe = io_uring_get_sqe(&ring);
755 io_uring_prep_sendmsg(sqe, fds[0], NULL, MSG_WAITALL);
756 sqe->opcode = IORING_OP_SENDMSG_ZC;
757 sqe->flags |= IOSQE_ASYNC;
758
759 ret = io_uring_submit(&ring);
760 if (ret != 1) {
761 fprintf(stderr, "submit failed %i\n", ret);
762 return ret;
763 }
764 ret = io_uring_wait_cqe(&ring, &cqe);
765 if (ret)
766 return 1;
767 if (cqe->flags & IORING_CQE_F_MORE)
768 notif = true;
769 io_uring_cqe_seen(&ring, cqe);
770
771 if (notif) {
772 ret = io_uring_wait_cqe(&ring, &cqe);
773 if (ret)
774 return 1;
775 io_uring_cqe_seen(&ring, cqe);
776 }
777 io_uring_queue_exit(&ring);
778 return 0;
779}
780
781static int run_basic_tests(void)
782{

Callers 1

run_basic_testsFunction · 0.85

Calls 4

t_create_ringFunction · 0.85
io_uring_submitFunction · 0.85
io_uring_queue_exitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected