File tree Expand file tree Collapse file tree 2 files changed +70
-4
lines changed Expand file tree Collapse file tree 2 files changed +70
-4
lines changed Original file line number Diff line number Diff line change 1
- #include <linux/aio_abi.h>
2
1
#include <sys/syscall.h>
3
2
#include <fcntl.h>
4
3
#include <stdio.h>
7
6
#include <errno.h>
8
7
#include <stdint.h>
9
8
9
+ typedef uint64_t aio_context_t ;
10
+
11
+ enum {
12
+ IOCB_CMD_PREAD = 0 ,
13
+ IOCB_CMD_PWRITE = 1 ,
14
+ IOCB_CMD_FSYNC = 2 ,
15
+ IOCB_CMD_FDSYNC = 3 ,
16
+ IOCB_CMD_NOOP = 6 ,
17
+ IOCB_CMD_PREADV = 7 ,
18
+ IOCB_CMD_PWRITEV = 8 ,
19
+ };
20
+
21
+ struct iocb {
22
+ uint64_t aio_data ;
23
+ uint32_t aio_key ;
24
+ uint32_t aio_rw_flags ;
25
+ uint16_t aio_lio_opcode ;
26
+ int16_t aio_reqprio ;
27
+ uint32_t aio_fildes ;
28
+ uint64_t aio_buf ;
29
+ uint64_t aio_nbytes ;
30
+ int64_t aio_offset ;
31
+ uint64_t aio_reserved2 ;
32
+ uint32_t aio_flags ;
33
+ uint32_t aio_resfd ;
34
+ };
35
+
36
+ struct io_event {
37
+ uint64_t data ;
38
+ uint64_t obj ;
39
+ int64_t res ;
40
+ int64_t res2 ;
41
+ };
42
+
10
43
const char * info = "Welcome to ASYNC world!" ;
11
44
12
45
void main () {
Original file line number Diff line number Diff line change 1
- #include <linux/aio_abi.h>
2
1
#include <sys/syscall.h>
3
2
#include <sys/uio.h>
4
3
#include <fcntl.h>
8
7
#include <errno.h>
9
8
#include <stdint.h>
10
9
10
+ typedef uint64_t aio_context_t ;
11
+
12
+ enum {
13
+ IOCB_CMD_PREAD = 0 ,
14
+ IOCB_CMD_PWRITE = 1 ,
15
+ IOCB_CMD_FSYNC = 2 ,
16
+ IOCB_CMD_FDSYNC = 3 ,
17
+ IOCB_CMD_NOOP = 6 ,
18
+ IOCB_CMD_PREADV = 7 ,
19
+ IOCB_CMD_PWRITEV = 8 ,
20
+ };
21
+
22
+ struct iocb {
23
+ uint64_t aio_data ;
24
+ uint32_t aio_key ;
25
+ uint32_t aio_rw_flags ;
26
+ uint16_t aio_lio_opcode ;
27
+ int16_t aio_reqprio ;
28
+ uint32_t aio_fildes ;
29
+ uint64_t aio_buf ;
30
+ uint64_t aio_nbytes ;
31
+ int64_t aio_offset ;
32
+ uint64_t aio_reserved2 ;
33
+ uint32_t aio_flags ;
34
+ uint32_t aio_resfd ;
35
+ };
36
+
37
+ struct io_event {
38
+ uint64_t data ;
39
+ uint64_t obj ;
40
+ int64_t res ;
41
+ int64_t res2 ;
42
+ };
43
+
11
44
const char * info0 = "Welcome to ASYNC world - " ;
12
45
const char * info1 = "now you're writing with vectors" ;
13
46
@@ -77,7 +110,7 @@ void main() {
77
110
printf ("evt.obj matches &req\n" );
78
111
} else {
79
112
printf ("evt.obj does NOT match &req, 0x%llX given\n" , evt .obj );
80
- printf ("(&req is 0x%llX)\n" , (__u64 )(uintptr_t )& req );
113
+ printf ("(&req is 0x%llX)\n" , (uint64_t )(uintptr_t )& req );
81
114
}
82
115
83
116
printf ("evt.res: %lld\n" , evt .res );
@@ -126,7 +159,7 @@ void main() {
126
159
printf ("evt.obj matches &req\n" );
127
160
} else {
128
161
printf ("evt.obj does NOT match &req, 0x%llX given\n" , evt .obj );
129
- printf ("(&req is 0x%llX)\n" , (__u64 )(uintptr_t )& req );
162
+ printf ("(&req is 0x%llX)\n" , (uint64_t )(uintptr_t )& req );
130
163
}
131
164
132
165
printf ("evt.res: %lld\n" , evt .res );
You can’t perform that action at this time.
0 commit comments