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

Function test_probe

test/probe.c:62–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62static int test_probe(struct io_uring *ring)
63{
64 struct io_uring_probe *p;
65 size_t len;
66 int ret;
67
68 len = sizeof(*p) + 256 * sizeof(struct io_uring_probe_op);
69 p = t_calloc(1, len);
70 ret = io_uring_register_probe(ring, p, 0);
71 if (ret == -EINVAL) {
72 fprintf(stdout, "Probe not supported, skipping\n");
73 no_probe = 1;
74 goto out;
75 } else if (ret) {
76 fprintf(stdout, "Probe returned %d\n", ret);
77 goto err;
78 }
79
80 if (verify_probe(p, 0))
81 goto err;
82
83 /* now grab for all entries */
84 memset(p, 0, len);
85 ret = io_uring_register_probe(ring, p, 256);
86 if (ret == -EINVAL) {
87 fprintf(stdout, "Probe not supported, skipping\n");
88 goto err;
89 } else if (ret) {
90 fprintf(stdout, "Probe returned %d\n", ret);
91 goto err;
92 }
93
94 if (verify_probe(p, 1))
95 goto err;
96
97out:
98 free(p);
99 return 0;
100err:
101 free(p);
102 return 1;
103}
104
105int main(int argc, char *argv[])
106{

Callers 1

mainFunction · 0.85

Calls 3

t_callocFunction · 0.85
io_uring_register_probeFunction · 0.85
verify_probeFunction · 0.85

Tested by

no test coverage detected