Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ aio_error(3R) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

exec(2)

exit(2)

fork(2)

lseek(2)

read(2)

write(2)

aio_cancel(3R)

aio_fsync(3R)

aio_read(3R)

fsync(3C)

lio_listio(3R)

attributes(5)

interface64(5)

standards(5)

aio_return(3R)

NAME

aio_return, aio_error − retrieve return or error status of asynchronous I/O operation

SYNOPSIS

cc [ flag ... ] file ... −lposix4 [ library ... ]

#include <aio.h>

ssize_t aio_return(struct aiocb ∗ aiocbp);

int aio_error(const struct aiocb ∗ aiocbp);

struct aiocb {
   intaio_fildes;/∗ file descriptor ∗/
   volatile void∗aio_buf;/∗ buffer location ∗/
   size_taio_nbytes;/∗ length of transfer ∗/
   off_taio_offset;/∗ file offset ∗/
   intaio_reqprio;/∗ request priority offset ∗/
   struct sigeventaio_sigevent;/∗ signal number and offset ∗/
   intaio_lio_opcode; /∗ listio operation ∗/
};

struct sigevent {
   intsigev_notify;/∗ notification mode ∗/
   intsigev_signo;/∗ signal number ∗/
   union sigvalsigev_value;/∗ signal value ∗/
};

union sigval {
   intsival_int;/∗ integer value ∗/
   void∗sival_ptr;/∗ pointer value ∗/
};

DESCRIPTION

The aio_return() function returns the return status of the asynchronous I/O request associated with the aiocb structure pointed to by aiocbp.

aio_error() returns the error status of the asynchronous I/O request associated with the aiocb structure pointed to by aiocbp.

The aio_return() function should be called only once to retrieve the valid return status of a given asynchronous operation, after aio_error() has returned a value other than
EINPROGRESS. 

RETURN VALUES

If the asynchronous I/O operation has completed successfully, aio_return() returns the return status, as described for read(2), write(2), and fsync(3C). 

If the asynchronous I/O operation has completed successfully, aio_error() returns 0.  If the operation has not yet completed, then EINPROGRESS is returned.  If the asynchronous I/O operation has completed unsuccessfully, then the error status, as described for read(2), write(2), and fsync(3C) is returned. 

If unsuccessful, aio_return() or aio_error() return -1, and set errno to indicate the error condition. 

ERRORS

The aio_return() and aio_error() functions will fail if:

EINVAL aiocbp does not reference an asynchronous operation which has completed or failed. 

ENOSYS The aio_return() or aio_error() function is not supported. 

USAGE

The aio_return() and aio_error() functions have explicit 64-bit equivalents.  See interface64(5). 

EXAMPLES

#include <aio.h>
#include <errno.h>
#include <signal.h>
struct aiocbmy_aiocb;
struct sigactionmy_sigaction;
voidmy_aio_handler(int, siginfo_t ∗, void ∗);
...
my_sigaction.sa_flags = SA_SIGINFO;
my_sigaction.sa_sigaction = my_aio_handler;
sigsetempty(&my_sigaction.sa_mask);
(void) sigaction(SIGRTMIN, &my_sigaction, NULL);
...
my_aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
my_aiocb.aio_sigevent.sigev_signo = SIGRTMIN;
my_aiocb.aio_sigevent.sigev_value.sival_ptr = &myaiocb;
...
(void) aio_read(&my_aiocb);
...

void
my_aio_handler(int signo, siginfo_t ∗siginfo, void ∗context) {
intmy_errno;
struct aiocb∗my_aiocbp;

my_aiocbp = siginfo.si_value.sival_ptr;
if ((my_errno = aio_error(my_aiocb)) != EINPROGRESS) {
intmy_status = aio_return(my_aiocb);
if (my_status >= 0) { /∗ start another operation ∗/
...
} else{ /∗ handle I/O error ∗/
...
}
}
}

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level Async-Signal-Safe

SEE ALSO

close(2), exec(2), exit(2), fork(2), lseek(2), read(2), write(2), aio_cancel(3R), aio_fsync(3R), aio_read(3R), fsync(3C), lio_listio(3R), attributes(5), interface64(5), standards(5)

NOTES

Applications compiled under Solaris 2.3 and 2.4 and using POSIX (see standards(5)) Asynchronous Input and Output option must be recompiled to work correctly when Solaris supports this option. 

BUGS

In Solaris 2.5, these functions always return −1 and set errno to ENOSYS, because this release does not support the Asynchronous Input and Output option.  Beginning with Solaris 2.6, these interfaces are supported. 
 

SunOS 5.6  —  Last change: 30 Dec 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026