Changeset f100a83 for examples/io_uring.c
- Timestamp:
- Mar 24, 2020, 3:59:13 PM (5 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:
- 276ae57e
- Parents:
- ae66348
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/io_uring.c
rae66348 rf100a83 33 33 io_uring_prep_readv(sqe, fd, &iov, 1, 0); 34 34 35 sqe->user_data = data; 36 35 37 /* tell the kernel we have an sqe ready for consumption */ 36 38 io_uring_submit(&ring); … … 38 40 /* wait for the sqe to complete */ 39 41 int ret = io_uring_wait_cqe(&ring, &cqe); 40 printf("%d\n", ret); 42 43 /* read and process cqe event */ 44 if(ret == 0) { 45 char * out = cqe->user_data; 46 signed int len = cqe->res; 47 io_uring_cqe_seen(&ring, cqe); 41 48 42 /* read and process cqe event */ 43 printf("%s", data); 44 io_uring_cqe_seen(&ring, cqe); 49 if(len > 0) { 50 printf("%.*s", len, out); 51 } 52 } 53 else { 54 printf("%d\n", ret); 55 io_uring_cqe_seen(&ring, cqe); 56 } 45 57 46 58 io_uring_queue_exit(&ring);
Note: See TracChangeset
for help on using the changeset viewer.