- Timestamp:
- Jul 27, 2020, 1:32:39 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- f3ed2af
- Parents:
- 5b15c4f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/io_uring.c
r5b15c4f ra86b1b85 1 #define _GNU_SOURCE 2 1 3 #include <fcntl.h> 2 4 #include <liburing.h> 3 5 #include <stdio.h> 6 #include <string.h> 4 7 #include <unistd.h> 5 8 … … 12 15 } 13 16 14 int fd = open(argv[1], 0);17 int fd = open(argv[1], O_DIRECT); 15 18 if(fd < 0) { 16 19 printf("Could not open file %s.\n", argv[1]); … … 23 26 24 27 /* init liburing */ 25 io_uring_queue_init(256, &ring, 0);28 io_uring_queue_init(256, &ring, IORING_SETUP_IOPOLL); 26 29 27 30 /* declare required structs */ … … 40 43 /* wait for the sqe to complete */ 41 44 int ret = io_uring_wait_cqe(&ring, &cqe); 42 45 43 46 /* read and process cqe event */ 44 47 if(ret == 0) { … … 49 52 if(len > 0) { 50 53 printf("%.*s", len, out); 54 } 55 else if( len < 0 ) { 56 fprintf(stderr, "readv returned error : %s\n", strerror(-len)); 51 57 } 52 58 }
Note: See TracChangeset
for help on using the changeset viewer.