*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> aio_return (2)              
Title
Content
Arch
Section
 

Contents


 aio_return(2)                                                 aio_return(2)




 NAME    [Toc]    [Back]
      aio_return() - return status of an asynchronous I/O operation

 SYNOPSIS    [Toc]    [Back]
      #include <aio.h>

      ssize_t aio_return(struct aiocb *aiocbp);

 DESCRIPTION    [Toc]    [Back]
      The aio_return() function returns the return status associated with
      the aiocb structure referenced by the aiocbp argument.  The return
      value for an asynchronous I/O operation is the value that would be set
      by the corresponding read(), write(), or fsync() operation.  If the
      operation has been queued but not completed, aio_return() returns -1
      and errno is set to EINPROGRESS.  A successful aio_return() call frees
      all kernel resources associated with the calls aiocb referenced by
      aiocbp.

      To use this function, link in the realtime library by specifying -lrt
      on the compiler or linker command line.

 RETURN VALUE    [Toc]    [Back]
      If the aiocb is invalid or if no asynchronous I/O operation is
      enqueued for the aiocb, aio_returns() returns -1 and errno is set to
      indicate the error.  Otherwise, aio_return() returns the error status
      of the referenced aiocb.  See aio_read(2), read(2), aio_write(2),
      write(2), aio_fsync(2), fsync(2) and lio_listio(2) for relevant error
      values.

 ERRORS    [Toc]    [Back]
      If aio_return() detects one of the following error conditions, errno
      is set to the indicated value:

           [EINVAL]       The aiocbp is not a valid address within the
                          process virtual address space.

           [EINVAL]       There was no asynchronous I/O operation enqueued
                          for the referenced aiocb.

 EXAMPLE    [Toc]    [Back]
      The following code sequence illustrates using aio_return() to retrieve
      the error status of an aio_read() operation and free the aiocb for
      future re-use.

           #include <fcntl.h>
           #include <errno.h>
           #include <aio.h>
           char buf[4096];
           int retval; ssize_t nbytes;
           struct aiocb myaiocb;
           bzero( &myaiocb, sizeof (struct aiocb));



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 aio_return(2)                                                 aio_return(2)




           myaiocb.aio_fildes = open( "/dev/null", O_RDONLY);
           myaiocb.aio_offset = 0;
           myaiocb.aio_buf = (void *) buf;
           myaiocb.aio_nbytes = sizeof (buf);
           myaiocb.aio_sigevent.sigev_notify = SIGEV_NONE;
           retval = aio_read( &myaiocb );
           if (retval) perror("aio_read:");
           /* continue processing */
            ...
           /* wait for completion */
           while ( (retval = aio_error( &myaiocb) ) == EINPROGRESS) ;
           /* free the aiocb */
           nbytes = aio_return( &myaiocb);

 SEE ALSO    [Toc]    [Back]
      aio_cancel(2), aio_error(2), aio_fsync(2), aio_read(2),
      aio_suspend(2), aio_write(2), fsync(2), lio_listio(2), read(2),
      write(2), aio(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      aio_return(): POSIX Realtime Extensions, IEEE Std 1003.1b


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
aio_error IRIX return error status of an asynchronous I/O operation
aio_return IRIX return error status of an asynchronous I/O operation
aio_error HP-UX return error status of an asynchronous I/O operation
aio_return FreeBSD retrieve return status of asynchronous I/O operation (REALTIME)
aio_return Tru64 Returns the status of an asynchronous I/O operation (P1003.1b)
aio_error FreeBSD retrieve error status of asynchronous I/O operation (REALTIME)
aio_error Tru64 Returns the error status of a specified asynchronous I/O operation (P1003.1b)
aio_cancel HP-UX cancel an asynchronous I/O operation
aio_write HP-UX start asynchronous write operation
aio_read HP-UX start an asynchronous read operation
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service