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

Function test_single_fsync

test/fsync.c:16–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include "liburing.h"
15
16static int test_single_fsync(struct io_uring *ring)
17{
18 struct io_uring_cqe *cqe;
19 struct io_uring_sqe *sqe;
20 char buf[32];
21 int fd, ret;
22
23 sprintf(buf, "./XXXXXX");
24 fd = mkstemp(buf);
25 if (fd < 0) {
26 perror("open");
27 return 1;
28 }
29
30 sqe = io_uring_get_sqe(ring);
31 if (!sqe) {
32 fprintf(stderr, "get sqe failed\n");
33 goto err;
34 }
35
36 io_uring_prep_fsync(sqe, fd, 0);
37
38 ret = io_uring_submit(ring);
39 if (ret <= 0) {
40 fprintf(stderr, "sqe submit failed: %d\n", ret);
41 goto err;
42 }
43
44 ret = io_uring_wait_cqe(ring, &cqe);
45 if (ret < 0) {
46 fprintf(stderr, "wait completion %d\n", ret);
47 goto err;
48 }
49
50 io_uring_cqe_seen(ring, cqe);
51 unlink(buf);
52 return 0;
53err:
54 unlink(buf);
55 return 1;
56}
57
58static int test_barrier_fsync(struct io_uring *ring)
59{

Callers 1

mainFunction · 0.70

Calls 2

io_uring_submitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected