9330 stack overflow when creating a deeply nested dataset
[unleashed.git] / usr / src / man / man3c / aio_error.3c
blob84b9a84b5d281d70ae010726a8aefed1ea40d7e6
1 .\"
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/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
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.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
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.
30 .\"
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.
35 .\"
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]
41 .\"
42 .\"
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.
46 .\"
47 .TH AIO_ERROR 3C "Feb 5, 2008"
48 .SH NAME
49 aio_error \- retrieve errors status for an asynchronous I/O operation
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <aio.h>
55 \fBint\fR \fBaio_error\fR(\fBconst struct aiocb *\fR\fIaiocbp\fR);
56 .fi
58 .SH DESCRIPTION
59 .sp
60 .LP
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
66 \fBEINPROGRESS\fR.
67 .SH RETURN VALUES
68 .sp
69 .LP
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.
75 .SH ERRORS
76 .sp
77 .LP
78 The \fBaio_error()\fR function may fail if:
79 .sp
80 .ne 2
81 .na
82 \fB\fBEINVAL\fR\fR
83 .ad
84 .RS 10n
85 The \fIaiocbp\fR argument does not refer to an asynchronous operation whose
86 return status has not yet been retrieved.
87 .RE
89 .SH USAGE
90 .sp
91 .LP
92 The \fBaio_error()\fR function has a transitional interface for 64-bit file
93 offsets.  See \fBlf64\fR(5).
94 .SH EXAMPLES
95 .LP
96 \fBExample 1 \fRThe following is an example of an error handling routine using
97 the \fBaio_error()\fR function.
98 .sp
99 .in +2
101 #include <aio.h>
102 #include <errno.h>
103 #include <signal.h>
104 struct aiocb      my_aiocb;
105 struct sigaction  my_sigaction;
106 void              my_aio_handler(int, siginfo_t *, void *);
107 \|.\|.\|.
108 my_sigaction.sa_flags = SA_SIGINFO;
109 my_sigaction.sa_sigaction = my_aio_handler;
110 sigemptyset(&my_sigaction.sa_mask);
111 (void) sigaction(SIGRTMIN, &my_sigaction, NULL);
112 \|.\|.\|.
113 my_aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
114 my_aiocb.aio_sigevent.sigev_signo = SIGRTMIN;
115 my_aiocb.aio_sigevent.sigev_value.sival_ptr = &myaiocb;
116 \|.\|.\|.
117 (void) aio_read(&my_aiocb);
118 \|.\|.\|.
119 void
120 my_aio_handler(int signo, siginfo_t *siginfo, void *context) {
121 int     my_errno;
122 struct aiocb    *my_aiocbp;
124 my_aiocbp = siginfo->si_value.sival_ptr;
125     if ((my_errno = aio_error(my_aiocb)) != EINPROGRESS) {
126         int my_status = aio_return(my_aiocb);
127             if (my_status >= 0){ /* start another operation */
128                     \|.\|.\|.
129             } else        { /* handle I/O error */
130                      \|.\|.\|.
131             }
132     }
135 .in -2
137 .SH ATTRIBUTES
140 See \fBattributes\fR(5) for descriptions of the following attributes:
145 box;
146 c | c
147 l | l .
148 ATTRIBUTE TYPE  ATTRIBUTE VALUE
150 Interface Stability     Committed
152 MT-Level        Async-Signal-Safe
154 Standard        See \fBstandards\fR(5).
157 .SH SEE ALSO
160 \fB_Exit\fR(2), \fBclose\fR(2), \fBfork\fR(2), \fBlseek\fR(2), \fBread\fR(2),
161 \fBwrite\fR(2), \fBaio.h\fR(3HEAD), \fBaio_cancel\fR(3C), \fBaio_fsync\fR(3C),
162 \fBaio_read\fR(3C), \fBaio_return\fR(3C), \fBaio_write\fR(3C),
163 \fBlio_listio\fR(3C), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5),
164 \fBlf64\fR(5), \fBstandards\fR(5)