1aio_error(3C)            Standard C Library Functions            aio_error(3C)
2
3
4

NAME

6       aio_error - retrieve errors status for an asynchronous I/O operation
7

SYNOPSIS

9       #include <aio.h>
10
11       int aio_error(const struct aiocb *aiocbp);
12
13

DESCRIPTION

15       The  aio_error()  function returns the error status associated with the
16       aiocb structure referenced by the aiocbp argument. The error status for
17       an  asynchronous  I/O operation is the errno value that would be set by
18       the corresponding read(2), write(2), or  fsync(3C)  operation.  If  the
19       operation has not yet completed, then the error status will be equal to
20       EINPROGRESS.
21

RETURN VALUES

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

ERRORS

30       The aio_error() function may fail if:
31
32       EINVAL    The aiocbp argument does not refer to an asynchronous  opera‐
33                 tion whose return status has not yet been retrieved.
34
35

USAGE

37       The  aio_error()  function has a transitional interface for 64-bit file
38       offsets.  See lf64(5).
39

EXAMPLES

41       Example 1 The following is an example  of  an  error  handling  routine
42       using the aio_error() function.
43
44         #include <aio.h>
45         #include <errno.h>
46         #include <signal.h>
47         struct aiocb      my_aiocb;
48         struct sigaction  my_sigaction;
49         void              my_aio_handler(int, siginfo_t *, void *);
50         ...
51         my_sigaction.sa_flags = SA_SIGINFO;
52         my_sigaction.sa_sigaction = my_aio_handler;
53         sigemptyset(&my_sigaction.sa_mask);
54         (void) sigaction(SIGRTMIN, &my_sigaction, NULL);
55         ...
56         my_aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
57         my_aiocb.aio_sigevent.sigev_signo = SIGRTMIN;
58         my_aiocb.aio_sigevent.sigev_value.sival_ptr = &myaiocb;
59         ...
60         (void) aio_read(&my_aiocb);
61         ...
62         void
63         my_aio_handler(int signo, siginfo_t *siginfo, void *context) {
64         int  my_errno;
65         struct aiocb   *my_aiocbp;
66
67         my_aiocbp = siginfo->si_value.sival_ptr;
68             if ((my_errno = aio_error(my_aiocb)) != EINPROGRESS) {
69                 int my_status = aio_return(my_aiocb);
70                     if (my_status >= 0){ /* start another operation */
71                             ...
72                     } else        { /* handle I/O error */
73                              ...
74                     }
75             }
76         }
77
78

ATTRIBUTES

80       See attributes(5) for descriptions of the following attributes:
81
82
83
84
85       ┌─────────────────────────────┬─────────────────────────────┐
86       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
87       ├─────────────────────────────┼─────────────────────────────┤
88       │Interface Stability          │Committed                    │
89       ├─────────────────────────────┼─────────────────────────────┤
90       │MT-Level                     │Async-Signal-Safe            │
91       ├─────────────────────────────┼─────────────────────────────┤
92       │Standard                     │See standards(5).            │
93       └─────────────────────────────┴─────────────────────────────┘
94

SEE ALSO

96       _Exit(2), close(2), fork(2), lseek(2), read(2), write(2), aio.h(3HEAD),
97       aio_cancel(3C),    aio_fsync(3C),     aio_read(3C),     aio_return(3C),
98       aio_write(3C), lio_listio(3C), signal.h(3HEAD), attributes(5), lf64(5),
99       standards(5)
100
101
102
103SunOS 5.11                        5 Feb 2008                     aio_error(3C)
Impressum