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

Function test_shrink

test/file-register.c:67–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static int test_shrink(struct io_uring *ring)
68{
69 int ret, off, fd;
70 int *files;
71
72 files = open_files(50, 0, 0);
73 ret = io_uring_register_files(ring, files, 50);
74 if (ret) {
75 fprintf(stderr, "%s: register ret=%d\n", __FUNCTION__, ret);
76 goto err;
77 }
78
79 off = 0;
80 do {
81 fd = -1;
82 ret = io_uring_register_files_update(ring, off, &fd, 1);
83 if (ret != 1) {
84 if (off == 50 && ret == -EINVAL)
85 break;
86 fprintf(stderr, "%s: update ret=%d\n", __FUNCTION__, ret);
87 break;
88 }
89 off++;
90 } while (1);
91
92 ret = io_uring_unregister_files(ring);
93 if (ret) {
94 fprintf(stderr, "%s: unregister ret=%d\n", __FUNCTION__, ret);
95 goto err;
96 }
97
98 close_files(files, 50, 0);
99 return 0;
100err:
101 close_files(files, 50, 0);
102 return 1;
103}
104
105
106static int test_grow(struct io_uring *ring)

Callers 1

mainFunction · 0.85

Calls 5

io_uring_register_filesFunction · 0.85
open_filesFunction · 0.70
close_filesFunction · 0.70

Tested by

no test coverage detected