Define __ASSUME_AT_RANDOM.
[glibc/history.git] / rt / tst-aio8.c
blobb03639dabd083b987010a80c7acb5a0505bfae7d
1 #include <aio.h>
2 #include <errno.h>
3 #include <fcntl.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <unistd.h>
8 static int
9 do_test (void)
11 int fd = open ("/dev/full", O_RDWR);
12 if (fd == -1)
14 puts ("could not open /dev/full");
15 return 0;
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;
27 struct aiocb *list[1];
28 list[0] = &req;
30 int r = lio_listio (LIO_WAIT, list, 1, NULL);
31 int e = errno;
33 printf ("r = %d, e = %d (%s)\n", r, e, strerror (e));
35 return r != -1 || e != EIO;
38 #define TEST_FUNCTION do_test ()
39 #include "../test-skeleton.c"