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

Function fdinfo_read

test/fdinfo.c:27–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static int warned;
26
27static void fdinfo_read(struct io_uring *ring)
28{
29 char fd_name[128];
30 char *buf;
31 int fd;
32
33 buf = malloc(4096);
34
35 sprintf(fd_name, "/proc/self/fdinfo/%d", ring->ring_fd);
36 fd = open(fd_name, O_RDONLY);
37 if (fd < 0) {
38 perror("open");
39 return;
40 }
41
42 do {
43 int ret = read(fd, buf, 4096);
44
45 if (ret < 0) {
46 perror("fdinfo read");
47 break;
48 } else if (ret == 4096) {
49 continue;
50 }
51 break;
52 } while (1);
53
54 close(fd);
55 free(buf);
56}
57
58static int __test_io(const char *file, struct io_uring *ring, int write,
59 int buffered, int sqthread, int fixed, int nonvec,

Callers 2

__test_ioFunction · 0.70
test_eventfd_readFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_eventfd_readFunction · 0.56