1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/* Convert the error number the AIX kernel returns to what the Linux
application expects. */
#include <errno.h>
#include "linux-errno.h"
static int mapping[] =
{
[EPERM] = LINUX_EPERM,
[ENOENT] = LINUX_ENOENT,
[ESRCH] = LINUX_ESRCH,
[EINTR] = LINUX_EINTR,
[EIO] = LINUX_EIO,
[ENXIO] = LINUX_ENXIO,
[E2BIG] = LINUX_E2BIG,
[ENOEXEC] = LINUX_ENOEXEC,
[EBADF] = LINUX_EBADF,
[ECHILD] = LINUX_ECHILD,
[EAGAIN] = LINUX_EAGAIN,
[ENOMEM] = LINUX_ENOMEM,
[EACCES] = LINUX_EACCES,
[EFAULT] = LINUX_EFAULT,
[ENOTBLK] = LINUX_ENOTBLK,
[EBUSY] = LINUX_EBUSY,
[EEXIST] = LINUX_EEXIST,
[EXDEV] = LINUX_EXDEV,
[ENODEV] = LINUX_ENODEV,
[ENOTDIR] = LINUX_ENOTDIR,
[EISDIR] = LINUX_EISDIR,
[EINVAL] = LINUX_EINVAL,
[ENFILE] = LINUX_ENFILE,
[EMFILE] = LINUX_EMFILE,
[ENOTTY] = LINUX_ENOTTY,
[ETXTBSY] = LINUX_ETXTBSY,
[EFBIG] = LINUX_EFBIG,
[ENOSPC] = LINUX_ENOSPC,
[EIDRM] = LINUX_EIDRM,
[ECHRNG] = LINUX_ECHRNG,
[EL2NSYNC] = LINUX_EL2NSYNC,
[EL3HLT] = LINUX_EL3HLT,
[EL3RST] = LINUX_EL3RST,
[ELNRNG] = LINUX_ELNRNG,
[EUNATCH] = LINUX_EUNATCH,
[ENOCSI] = LINUX_ENOCSI,
[EL2HLT] = LINUX_EL2HLT,
[EDEADLK] = LINUX_EDEADLK,
[ENOTREADY] = LINUX_ENOTREADY,
// EWPROTECT: no Linux equivalent
// EFORMAT: no Linux equivalent
[ENOLCK] = LINUX_ENOLCK,
// ENOCONNECT: No Linux equivalent
[ESTALE] = LINUX_ESTALE,
// EDIST: no Linux equivalent
[54] = LINUX_EAGAIN, // EWOULDBLOCK
[EINPROGRESS] = LINUX_EINPROGRESS,
[EALREADY] = LINUX_EALREADY,
[ENOTSOCK] = LINUX_ENOTSOCK,
[EDESTADDRREQ] = LINUX_EDESTADDRREQ,
[EMSGSIZE] = LINUX_EMSGSIZE,
[EPROTOTYPE] = LINUX_EPROTOTYPE,
[ENOPROTOOPT] = LINUX_ENOPROTOOPT,
[EPROTONOSUPPORT] = LINUX_EPROTONOSUPPORT,
[ESOCKTNOSUPPORT] = LINUX_ESOCKTNOSUPPORT,
[EOPNOTSUPP] = LINUX_EOPNOTSUPP,
[EPFNOSUPPORT] = LINUX_EPFNOSUPPORT,
[EAFNOSUPPORT] = LINUX_EAFNOSUPPORT,
[EADDRINUSE] = LINUX_EADDRINUSE,
[EADDRNOTAVAIL] = LINUX_EADDRNOTAVAIL,
[ENETDOWN] = LINUX_ENETDOWN,
[ENETUNREACH] = LINUX_ENETUNREACH,
[ENETRESET] = LINUX_ENETRESET,
[ECONNABORTED] = LINUX_ECONNABORTED,
[ECONNRESET] = LINUX_ECONNRESET,
[ENOBUFS] = LINUX_ENOBUFS,
[EISCONN] = LINUX_EISCONN,
[ENOTCONN] = LINUX_ENOTCONN,
[ESHUTDOWN] = LINUX_ESHUTDOWN,
[ETIMEDOUT] = LINUX_ETIMEDOUT,
[ECONNREFUSED] = LINUX_ECONNREFUSED,
[EHOSTDOWN] = LINUX_EHOSTDOWN,
[EHOSTUNREACH] = LINUX_EHOSTUNREACH,
[ERESTART] = LINUX_ERESTART,
[EPROCLIM] = LINUX_EPROCLIM,
[EUSERS] = LINUX_EUSERS,
[ELOOP] = LINUX_ELOOP,
[ENAMETOOLONG] = LINUX_ENAMETOOLONG,
[87] = LINUX_ENOTEMPTY, // ENOTEMPTY
[EDQUOT] = LINUX_EDQUOT,
[ECORRUPT] = LINUX_ECORRUPT,
[EREMOTE] = LINUX_EREMOTE,
[ENOSYS] = LINUX_ENOSYS,
[EMEDIA] = LINUX_EMEDIA,
[ESOFT] = LINUX_ESOFT,
[ENOATTR] = LINUX_ENOATTR,
[ESAD] = LINUX_ESAD,
// ENOTRUST: no Linux equivalent
[ETOOMANYREFS] = LINUX_ETOOMANYREFS,
[EILSEQ] = LINUX_EILSEQ,
[ECANCELED] = LINUX_ECANCELED,
[ENOSR] = LINUX_ENOSR,
[ETIME] = LINUX_ETIME,
[EBADMSG] = LINUX_EBADMSG,
[EPROTO] = LINUX_EPROTO,
[ENODATA] = LINUX_ENODATA,
[ENOSTR] = LINUX_ENOSTR,
[ENOTSUP] = LINUX_ENOTSUP,
[EMULTIHOP] = LINUX_EMULTIHOP,
[ENOLINK] = LINUX_ENOLINK,
[EOVERFLOW] = LINUX_EOVERFLOW
};
int
__errno_aix_to_linux (int err)
{
int conv;
if (err >= 0 && err < (sizeof (mapping) / sizeof (mapping[0]))
&& ((conv = mapping[err]) != 0 || err == 0))
return conv;
/* The error value is not known. Create a special value which can
be easily recognized as an invalid result. */
return 512 + err;
}
|