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

Function test_skip

test/file-register.c:582–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static int test_skip(struct io_uring *ring)
583{
584 int *files;
585 int ret;
586
587 files = open_files(100, 0, 0);
588 ret = io_uring_register_files(ring, files, 100);
589 if (ret) {
590 fprintf(stderr, "%s: register ret=%d\n", __FUNCTION__, ret);
591 goto err;
592 }
593
594 files[90] = IORING_REGISTER_FILES_SKIP;
595 ret = io_uring_register_files_update(ring, 90, &files[90], 1);
596 if (ret != 1) {
597 if (ret == -EBADF) {
598 fprintf(stdout, "Skipping files not supported\n");
599 goto done;
600 }
601 fprintf(stderr, "%s: update ret=%d\n", __FUNCTION__, ret);
602 goto err;
603 }
604
605 /* verify can still use file index 90 */
606 if (test_fixed_read_write(ring, 90))
607 goto err;
608
609 ret = io_uring_unregister_files(ring);
610 if (ret) {
611 fprintf(stderr, "%s: unregister ret=%d\n", __FUNCTION__, ret);
612 goto err;
613 }
614
615done:
616 close_files(files, 100, 0);
617 return 0;
618err:
619 close_files(files, 100, 0);
620 return 1;
621}
622
623static int test_sparse_updates(void)
624{

Callers 1

mainFunction · 0.85

Calls 6

io_uring_register_filesFunction · 0.85
test_fixed_read_writeFunction · 0.85
open_filesFunction · 0.70
close_filesFunction · 0.70

Tested by

no test coverage detected