1 | #include <aio.h> |
---|---|
2 | #include <errno.h> |
3 | #include <fcntl.h> |
4 | #include <stdio.h> |
5 | #include <string.h> |
6 | #include <unistd.h> |
7 | |
8 | static int |
9 | do_test (void) |
10 | { |
11 | int fd = open (file: "/dev/full", O_RDWR); |
12 | if (fd == -1) |
13 | { |
14 | puts (s: "could not open /dev/full"); |
15 | return 0; |
16 | } |
17 | |
18 | struct aiocb req; |
19 | req.aio_fildes = fd; |
20 | req.aio_lio_opcode = LIO_WRITE; |
21 | req.aio_reqprio = 0; |
22 | req.aio_buf = (void *) "hello"; |
23 | req.aio_nbytes = 5; |
24 | req.aio_offset = 0; |
25 | req.aio_sigevent.sigev_notify = SIGEV_NONE; |
26 | |
27 | struct aiocb *list[1]; |
28 | list[0] = &req; |
29 | |
30 | int r = lio_listio (LIO_WAIT, list: list, nent: 1, NULL); |
31 | int e = errno; |
32 | |
33 | printf (format: "r = %d, e = %d (%s)\n", r, e, strerror (errnum: e)); |
34 | |
35 | return r != -1 || e != EIO; |
36 | } |
37 | |
38 | #define TEST_FUNCTION do_test () |
39 | #include "../test-skeleton.c" |
40 |