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

Function create_file

test/fpos.c:20–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#define QUEUE_SIZE 2048
19
20static void create_file(const char *file, size_t size)
21{
22 ssize_t ret;
23 char *buf;
24 size_t idx;
25 int fd;
26
27 buf = t_malloc(size);
28 for (idx = 0; idx < size; ++idx) {
29 /* write 0 or 1 */
30 buf[idx] = (unsigned char)(idx & 0x01);
31 }
32
33 fd = open(file, O_WRONLY | O_CREAT, 0644);
34 assert(fd >= 0);
35
36 ret = write(fd, buf, size);
37 fsync(fd);
38 close(fd);
39 free(buf);
40 assert(ret == size);
41}
42
43static int test_read(struct io_uring *ring, bool async, int blocksize)
44{

Callers 1

test_readFunction · 0.70

Calls 1

t_mallocFunction · 0.85

Tested by 1

test_readFunction · 0.56