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

Function test_timeout_link_chain3

test/link-timeout.c:861–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859}
860
861static int test_timeout_link_chain3(struct io_uring *ring)
862{
863 struct __kernel_timespec ts;
864 struct io_uring_cqe *cqe;
865 struct io_uring_sqe *sqe;
866 int fds[2], ret, i;
867
868 if (pipe(fds)) {
869 perror("pipe");
870 return 1;
871 }
872
873 sqe = io_uring_get_sqe(ring);
874 if (!sqe) {
875 printf("get sqe failed\n");
876 goto err;
877 }
878 io_uring_prep_poll_add(sqe, fds[0], POLLIN);
879 sqe->flags |= IOSQE_IO_LINK;
880 sqe->user_data = 1;
881
882 sqe = io_uring_get_sqe(ring);
883 if (!sqe) {
884 printf("get sqe failed\n");
885 goto err;
886 }
887 ts.tv_sec = 0;
888 ts.tv_nsec = 1000000;
889 io_uring_prep_link_timeout(sqe, &ts, 0);
890 sqe->flags |= IOSQE_IO_LINK;
891 sqe->user_data = 2;
892
893 sqe = io_uring_get_sqe(ring);
894 if (!sqe) {
895 printf("get sqe failed\n");
896 goto err;
897 }
898 io_uring_prep_nop(sqe);
899 sqe->flags |= IOSQE_IO_LINK;
900 sqe->user_data = 3;
901
902 /* POLL -> TIMEOUT -> NOP */
903
904 sqe = io_uring_get_sqe(ring);
905 if (!sqe) {
906 printf("get sqe failed\n");
907 goto err;
908 }
909 io_uring_prep_poll_add(sqe, fds[0], POLLIN);
910 sqe->flags |= IOSQE_IO_LINK;
911 sqe->user_data = 4;
912
913 sqe = io_uring_get_sqe(ring);
914 if (!sqe) {
915 printf("get sqe failed\n");
916 goto err;
917 }
918 ts.tv_sec = 0;

Callers 1

mainFunction · 0.85

Calls 2

io_uring_submitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected