2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
45 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
47 .TH AIO_ERROR 3C "Feb 5, 2008"
49 aio_error \- retrieve errors status for an asynchronous I/O operation
55 \fBint\fR \fBaio_error\fR(\fBconst struct aiocb *\fR\fIaiocbp\fR);
61 The \fBaio_error()\fR function returns the error status associated with the
62 \fBaiocb\fR structure referenced by the \fIaiocbp\fR argument. The error status
63 for an asynchronous I/O operation is the \fBerrno\fR value that would be set by
64 the corresponding \fBread\fR(2), \fBwrite\fR(2), or \fBfsync\fR(3C) operation.
65 If the operation has not yet completed, then the error status will be equal to
70 If the asynchronous I/O operation has completed successfully, then \fB0\fR is
71 returned. If the asynchronous operation has completed unsuccessfully, then the
72 error status, as described for \fBread\fR(2), \fBwrite\fR(2), and
73 \fBfsync\fR(3C), is returned. If the asynchronous I/O operation has not yet
74 completed, then \fBEINPROGRESS\fR is returned.
78 The \fBaio_error()\fR function may fail if:
85 The \fIaiocbp\fR argument does not refer to an asynchronous operation whose
86 return status has not yet been retrieved.
91 \fBExample 1 \fRThe following is an example of an error handling routine using
92 the \fBaio_error()\fR function.
99 struct aiocb my_aiocb;
100 struct sigaction my_sigaction;
101 void my_aio_handler(int, siginfo_t *, void *);
103 my_sigaction.sa_flags = SA_SIGINFO;
104 my_sigaction.sa_sigaction = my_aio_handler;
105 sigemptyset(&my_sigaction.sa_mask);
106 (void) sigaction(SIGRTMIN, &my_sigaction, NULL);
108 my_aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
109 my_aiocb.aio_sigevent.sigev_signo = SIGRTMIN;
110 my_aiocb.aio_sigevent.sigev_value.sival_ptr = &myaiocb;
112 (void) aio_read(&my_aiocb);
115 my_aio_handler(int signo, siginfo_t *siginfo, void *context) {
117 struct aiocb *my_aiocbp;
119 my_aiocbp = siginfo->si_value.sival_ptr;
120 if ((my_errno = aio_error(my_aiocb)) != EINPROGRESS) {
121 int my_status = aio_return(my_aiocb);
122 if (my_status >= 0){ /* start another operation */
124 } else { /* handle I/O error */
135 See \fBattributes\fR(5) for descriptions of the following attributes:
143 ATTRIBUTE TYPE ATTRIBUTE VALUE
145 Interface Stability Committed
147 MT-Level Async-Signal-Safe
149 Standard See \fBstandards\fR(5).
155 \fB_Exit\fR(2), \fBclose\fR(2), \fBfork\fR(2), \fBlseek\fR(2), \fBread\fR(2),
156 \fBwrite\fR(2), \fBaio.h\fR(3HEAD), \fBaio_cancel\fR(3C), \fBaio_fsync\fR(3C),
157 \fBaio_read\fR(3C), \fBaio_return\fR(3C), \fBaio_write\fR(3C),
158 \fBlio_listio\fR(3C), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5),