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

Function get_file_size

examples/io_uring-cp.c:43–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static int get_file_size(int fd, off_t *size)
44{
45 struct stat st;
46
47 if (fstat(fd, &st) < 0)
48 return -1;
49 if (S_ISREG(st.st_mode)) {
50 *size = st.st_size;
51 return 0;
52 } else if (S_ISBLK(st.st_mode)) {
53 unsigned long long bytes;
54
55 if (ioctl(fd, BLKGETSIZE64, &bytes) != 0)
56 return -1;
57
58 *size = bytes;
59 return 0;
60 }
61
62 return -1;
63}
64
65static void queue_prepped(struct io_uring *ring, struct io_data *data)
66{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected