unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Page:
Section:
Apropos / Subsearch:
optional field



 aio_error(2)							aio_error(2)




 NAME
      aio_error() - return error status of an asynchronous I/O operation

 SYNOPSIS
      #include <&lt&lt&lt;aio.h>&gt&gt&gt;

      int aio_error(const struct aiocb *aiocbp);

 DESCRIPTION
      The aio_error() function returns the error status of the asynchronous
      I/O operation that was initiated with the aiocb and referenced by
      aiocbp.  The error status for an asynchronous I/O operation is the
      errno value set by the corresponding read(), write(), or fsync()
      function.

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

 RETURN VALUE
      If the aiocb is invalid or if no asynchronous I/O operation is
      enqueued for the aiocb, aio_error() returns -1 and errno is set to
      indicate the error.  If the operation has been queued but not
      completed, aio_error() returns EINPROGRESS.  Otherwise, aio_error()
      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
      If aio_error() detects one of the following error conditions, errno is
      set to the indicated value:

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

 EXAMPLE
      The following code sequence illustrates using aio_error() to retrieve
      the error status of an aio_read() operation.

	   #include <&lt&lt&lt;fcntl.h>&gt&gt&gt;
	   #include <&lt&lt&lt;errno.h>&gt&gt&gt;
	   #include <&lt&lt&lt;aio.h>&gt&gt&gt;
	   char buf[4096];
	   ssize_t nbytes; int retval;
	   struct aiocb myaiocb;
	   bzero( &&amp&amp&amp;myaiocb, sizeof (struct aiocb));
	   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( &&amp&amp&amp;myaiocb );



 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000






 aio_error(2)							aio_error(2)




	   if (retval) perror("aio_read:");
	   /* continue processing */
	    ...
	   /* wait for completion */
	   while ( (retval = aio_error( &&amp&amp&amp;myaiocb) ) == EINPROGRESS) ;
	   /* free the aiocb */
	   nbytes = aio_return( &&amp&amp&amp;myaiocb);

 SEE ALSO
      aio_cancel(2), aio_fsync(2), aio_read(2), aio_return(2),
      aio_suspend(2), aio_write(2), fsync(2), lio_listio(2), read(2),
      write(2), aio(5).

 STANDARDS CONFORMANCE
      aio_error(): POSIX Realtime Extensions, IEEE Std 1003.1b







































 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000