Back to index

glibc  2.9
tst-aio8.c
Go to the documentation of this file.
00001 #include <aio.h>
00002 #include <errno.h>
00003 #include <fcntl.h>
00004 #include <stdio.h>
00005 #include <string.h>
00006 #include <unistd.h>
00007 
00008 static int
00009 do_test (void)
00010 {
00011   int fd = open ("/dev/full", O_RDWR);
00012   if (fd == -1)
00013     {
00014       puts ("could not open /dev/full");
00015       return 0;
00016     }
00017 
00018   struct aiocb req;
00019   req.aio_fildes = fd;
00020   req.aio_lio_opcode = LIO_WRITE;
00021   req.aio_reqprio = 0;
00022   req.aio_buf = (void *) "hello";
00023   req.aio_nbytes = 5;
00024   req.aio_offset = 0;
00025   req.aio_sigevent.sigev_notify = SIGEV_NONE;
00026 
00027   struct aiocb *list[1];
00028   list[0] = &req;
00029 
00030   int r = lio_listio (LIO_WAIT, list, 1, NULL);
00031   int e = errno;
00032 
00033   printf ("r = %d, e = %d (%s)\n", r, e, strerror (e));
00034 
00035   return r != -1 || e != EIO;
00036 }
00037 
00038 #define TEST_FUNCTION do_test ()
00039 #include "../test-skeleton.c"