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

Function test_replace_all

test/file-register.c:155–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155static int test_replace_all(struct io_uring *ring)
156{
157 int *files, *fds = NULL;
158 int ret, i;
159
160 files = open_files(100, 0, 0);
161 ret = io_uring_register_files(ring, files, 100);
162 if (ret) {
163 fprintf(stderr, "%s: register ret=%d\n", __FUNCTION__, ret);
164 goto err;
165 }
166
167 fds = t_malloc(100 * sizeof(int));
168 for (i = 0; i < 100; i++)
169 fds[i] = -1;
170
171 ret = io_uring_register_files_update(ring, 0, fds, 100);
172 if (ret != 100) {
173 fprintf(stderr, "%s: update ret=%d\n", __FUNCTION__, ret);
174 goto err;
175 }
176
177 ret = io_uring_unregister_files(ring);
178 if (ret) {
179 fprintf(stderr, "%s: unregister ret=%d\n", __FUNCTION__, ret);
180 goto err;
181 }
182
183 close_files(files, 100, 0);
184 if (fds)
185 free(fds);
186 return 0;
187err:
188 close_files(files, 100, 0);
189 if (fds)
190 free(fds);
191 return 1;
192}
193
194static int test_replace(struct io_uring *ring)
195{

Callers 1

mainFunction · 0.85

Calls 6

io_uring_register_filesFunction · 0.85
t_mallocFunction · 0.85
open_filesFunction · 0.70
close_filesFunction · 0.70

Tested by

no test coverage detected