HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
l
lio_listio(2) lio_listio(2)
[EINVAL] The
sigevent specified by sig is not valid.
[EINVAL] The
mode argument is neither LIO_WAIT nor LIO_NOWAIT .
[EINVAL] The value of the
nent argument is negative or greater than the maximum value
allowed. The maximum value allowed can be obtained using the
sysconf() call
with the argument
_SC_AIO_LISTIO_MAX
.
[EINTR] The
mode argument was LIO_WAIT and a signal was delivered while waiting for the
requested operations to complete. This signal may result from completion of one or
more of the requested operations and other requests may still be pending or com-
pleted.
Once an operation has been enqueued by lio_listio()
, the following errors, in addition to all of the
errors normally reported by the appropriate
read() or
write() function, may be reported asynchro-
nously by a subsequent call to
aio_error() or
aio_return() referencing its aiocbp.
[EBADF] The
aiocbp->aio_fildes
was not a valid file descriptor open for reading or writ-
ing as appropriate to the
aio_lio_opcode
.
[EINVAL] The value of
aiocbp->aio_reqprio
is not valid, or the value of aiocbp-
>aio_nbytes
is invalid, or the file offset implied by aiocbp->aio_offset
or
aiocbp->aio_offset
+aiocbp->aio_nbytes is not valid.
[EIO] One or more of the enqueued operations did not complete successfully.
EXAMPLE
The following code sequence and call to
lio_listio() starts two asynchronous write operations and
one asynchronous read operation and waits for all operations to complete.
#include <fcntl.h>
#include <errno.h>
#include <aio.h>
char buf1[4096], buf2[4096], buf3[4096];
int nent;
struct aiocb myaiocb1, myaiocb2, myaiocb3;
struct aiocb *list[] = { &myaiocb1, &myaiocb2, &myaiocb3 };
bzero( &myaiocb1, sizeof (struct aiocb));
bzero( &myaiocb2, sizeof (struct aiocb));
bzero( &myaiocb3, sizeof (struct aiocb));
myaiocb1.aio_fildes = open( "/dev/null", O_RDWR);
myaiocb3.aio_fildes = myaiocb2.aio_fildes = myaiocb1.aio_fildes;
myaiocb1.aio_offset = 0;
myaiocb3.aio_offset = myaiocb2.aio_offset = myaiocb1.aio_offset;
myaiocb1.aio_buf = (void *) buf1;
myaiocb2.aio_buf = (void *) buf2;
myaiocb3.aio_buf = (void *) buf3;
myaiocb3.aio_nbytes = sizeof (buf3);
myaiocb2.aio_nbytes = sizeof (buf2);
myaiocb1.aio_nbytes = sizeof (buf1);
myaiocb1.aio_lio_opcode = myaiocb3.aio_lio_opcode = LIO_WRITE;
myaiocb2.aio_lio_opcode = LIO_READ;
myaiocb1.aio_sigevent.sigev_notify = SIGEV_NONE;
myaiocb2.aio_sigevent.sigev_notify = SIGEV_NONE;
myaiocb3.aio_sigevent.sigev_notify = SIGEV_NONE;
retval = lio_listio( LIO_WAIT, list, 3, NULL );
if (retval) perror("lio_listio:");
while ( nent-- ) { (void) aio_return( list[nent] ); }
SEE ALSO
aio_cancel(2), aio_error(2), aio_fsync(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), read(2),
write(2), aio(5).
STANDARDS CONFORMANCE
lio_listio() : POSIX Realtime Extensions, IEEE Std 1003.1b
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 175