The aio_error or aio_error64 subroutine includes information for the POSIX AIO aio_error subroutine (as defined in the IEEE std 1003.1-2001), and the Legacy AIO aio_error subroutine.
POSIX AIO aio_error Subroutine
Retrieves error status for an asynchronous I/O operation.
Standard C Library (libc.a)
#include <aio.h> int aio_error (aiocbp) const struct aiocb *aiocbp;
The aio_error subroutine returns the error status associated with the aiocb structure. This structure is referenced by the aiocbp parameter. The error status for an asynchronous I/O operation is the synchronous I/O errno value that would be set by the corresponding read, write, or fsync subroutine. If the subroutine has not yet completed, the error status is equal to EINPROGRESS.
aiocbp | Points to the aiocb structure associated with the I/O operation. |
The aiocb structure is defined in the /usr/include/aio.h file and contains the following members:
int aio_fildes off_t aio_offset char *aio_buf size_t aio_nbytes int aio_reqprio struct sigevent aio_sigevent int aio_lio_opcode
The aio_error and aio_error64 subroutines can be called from the process environment only.
If the asynchronous I/O operation has completed successfully, the aio_error subroutine returns a 0. If unsuccessful, the error status (as described for the read, write, and fsync subroutines) is returned. If the asynchronous I/O operation has not yet completed, EINPROGRESS is returned.
EINVAL | The aiocbp parameter does not refer to an asynchronous operation whose return status has not yet been retrieved. |
aio_cancel or aio_cancel64 Subroutine, aio_fsync Subroutine, aio_read or aio_read64 Subroutine, aio_return or aio_return64 Subroutine, aio_write or aio_write64 Subroutine, close Subroutine, exec: execl, execle, execlp, execv, execve, execvp, or exect Subroutine, exit, atexit, _exit, or _Exit Subroutine, fork, f_fork, or vfork Subroutine, fsync or fsync_range Subroutine, lio_listio or lio_listio64 Subroutine, and lseek, llseek or lseek64 Subroutine.
read, readx, readv, readvx, or pread Subroutine and write, writex, writev, writevx or pwrite Subroutines in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 2.
Legacy AIO aio_error Subroutine
Retrieves the error status of an asynchronous I/O request.
Standard C Library (libc.a)
#include <aio.h>
int
aio_error(handle)
aio_handle_t handle;
int aio_error64(handle)
aio_handle_t handle;
The aio_error subroutine retrieves the error status of the asynchronous request associated with the handle parameter. The error status is the errno value that would be set by the corresponding I/O operation. The error status is EINPROG if the I/O operation is still in progress.
The aio_error64 subroutine is similar to the aio_error subroutine except that it retrieves the error status associated with an aiocb64 control block.
#define _AIO_AIX_SOURCE #include <sys/aio.h>or, on the command line when compiling enter:
->xlc ... -D_AIO_AIX_SOURCE ... legacy_aio_program.c
The aiocb structure is defined in the /usr/include/aio.h file and contains the following members:
int aio_whence off_t aio_offset char *aio_buf size_t aio_nbytes int aio_reqprio struct event aio_event struct osigevent aio_event int aio_flag aiohandle_t aio_handle
The aio_error and aio_error64 subroutines can be called from the process environment only.
0 | Indicates that the operation completed successfully. |
ECANCELED | Indicates that the I/O request was canceled due to an aio_cancel subroutine call. |
EINPROG | Indicates that the I/O request has not completed.
An errno value described in the aio_read (aio_read or aio_read64 Subroutine), aio_write (aio_write or aio_write64 Subroutine), and lio_listio (lio_listio or lio_listio64 Subroutine) subroutines: Indicates that the operation was not queued successfully. For example, if the aio_read subroutine is called with an unusable file descriptor, it (aio_read) returns a value of -1 and sets the errno global variable to EBADF. A subsequent call of the aio_error subroutine with the handle of the unsuccessful aio control block (aiocb) structure returns EBADF. An errno value of the corresponding I/O operation: Indicates that the operation was initiated successfully, but the actual I/O operation was unsuccessful. For example, calling the aio_write subroutine on a file located in a full file system returns a value of 0, which indicates the request was queued successfully. However, when the I/O operation is complete (that is, when the aio_error subroutine no longer returns EINPROG), the aio_error subroutine returns ENOSPC. This indicates that the I/O was unsuccessful. |
aio_cancel or aio_cancel64 Subroutine, aio_read or aio_read64 Subroutine, aio_return or aio_return64 Subroutine, aio_suspend or aio_suspend64 Subroutine, aio_write or aio_write64 Subroutine, lio_listio or lio_listio64 Subroutine, and lio_listio or lio_listio64 Subroutine.
The Asynchronous I/O Overview and the Communications I/O Subsystem: Programming Introduction in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.
The Input and Output Handling Programmer's Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs describes the files, commands, and subroutines used for low-level, stream, terminal, and asynchronous I/O interfaces.