1 /* Convert the error number the AIX kernel returns to what the Linux
3 Copyright (C) 2000 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include "linux-errno.h"
25 static int mapping
[] =
28 [AIX_ENOENT
] = ENOENT
,
34 [AIX_ENOEXEC
] = ENOEXEC
,
36 [AIX_ECHILD
] = ECHILD
,
37 [AIX_EAGAIN
] = EAGAIN
,
38 [AIX_ENOMEM
] = ENOMEM
,
39 [AIX_EACCES
] = EACCES
,
40 [AIX_EFAULT
] = EFAULT
,
41 [AIX_ENOTBLK
] = ENOTBLK
,
43 [AIX_EEXIST
] = EEXIST
,
45 [AIX_ENODEV
] = ENODEV
,
46 [AIX_ENOTDIR
] = ENOTDIR
,
47 [AIX_EISDIR
] = EISDIR
,
48 [AIX_EINVAL
] = EINVAL
,
49 [AIX_ENFILE
] = ENFILE
,
50 [AIX_EMFILE
] = EMFILE
,
51 [AIX_ENOTTY
] = ENOTTY
,
52 [AIX_ETXTBSY
] = ETXTBSY
,
54 [AIX_ENOSPC
] = ENOSPC
,
56 [AIX_ECHRNG
] = ECHRNG
,
57 [AIX_EL2NSYNC
] = EL2NSYNC
,
58 [AIX_EL3HLT
] = EL3HLT
,
59 [AIX_EL3RST
] = EL3RST
,
60 [AIX_ELNRNG
] = ELNRNG
,
61 [AIX_EUNATCH
] = EUNATCH
,
62 [AIX_ENOCSI
] = ENOCSI
,
63 [AIX_EL2HLT
] = EL2HLT
,
64 [AIX_EDEADLK
] = EDEADLK
,
65 [AIX_ENOTREADY
] = ENOTREADY
,
66 // EWPROTECT: no Linux equivalent
67 // EFORMAT: no Linux equivalent
68 [AIX_ENOLCK
] = ENOLCK
,
69 // ENOCONNECT: No Linux equivalent
70 [AIX_ESTALE
] = ESTALE
,
71 // EDIST: no Linux equivalent
72 [54] = EAGAIN
, // EWOULDBLOCK
73 [AIX_EINPROGRESS
] = EINPROGRESS
,
74 [AIX_EALREADY
] = EALREADY
,
75 [AIX_ENOTSOCK
] = ENOTSOCK
,
76 [AIX_EDESTADDRREQ
] = EDESTADDRREQ
,
77 [AIX_EMSGSIZE
] = EMSGSIZE
,
78 [AIX_EPROTOTYPE
] = EPROTOTYPE
,
79 [AIX_ENOPROTOOPT
] = ENOPROTOOPT
,
80 [AIX_EPROTONOSUPPORT
] = EPROTONOSUPPORT
,
81 [AIX_ESOCKTNOSUPPORT
] = ESOCKTNOSUPPORT
,
82 [AIX_EOPNOTSUPP
] = EOPNOTSUPP
,
83 [AIX_EPFNOSUPPORT
] = EPFNOSUPPORT
,
84 [AIX_EAFNOSUPPORT
] = EAFNOSUPPORT
,
85 [AIX_EADDRINUSE
] = EADDRINUSE
,
86 [AIX_EADDRNOTAVAIL
] = EADDRNOTAVAIL
,
87 [AIX_ENETDOWN
] = ENETDOWN
,
88 [AIX_ENETUNREACH
] = ENETUNREACH
,
89 [AIX_ENETRESET
] = ENETRESET
,
90 [AIX_ECONNABORTED
] = ECONNABORTED
,
91 [AIX_ECONNRESET
] = ECONNRESET
,
92 [AIX_ENOBUFS
] = ENOBUFS
,
93 [AIX_EISCONN
] = EISCONN
,
94 [AIX_ENOTCONN
] = ENOTCONN
,
95 [AIX_ESHUTDOWN
] = ESHUTDOWN
,
96 [AIX_ETIMEDOUT
] = ETIMEDOUT
,
97 [AIX_ECONNREFUSED
] = ECONNREFUSED
,
98 [AIX_EHOSTDOWN
] = EHOSTDOWN
,
99 [AIX_EHOSTUNREACH
] = EHOSTUNREACH
,
100 [AIX_ERESTART
] = ERESTART
,
101 [AIX_EPROCLIM
] = EPROCLIM
,
102 [AIX_EUSERS
] = EUSERS
,
104 [AIX_ENAMETOOLONG
] = ENAMETOOLONG
,
105 [87] = ENOTEMPTY
, // ENOTEMPTY
106 [AIX_EDQUOT
] = EDQUOT
,
107 [AIX_ECORRUPT
] = ECORRUPT
,
108 [AIX_EREMOTE
] = EREMOTE
,
109 [AIX_ENOSYS
] = ENOSYS
,
110 [AIX_EMEDIA
] = EMEDIA
,
112 [AIX_ENOATTR
] = ENOATTR
,
114 // ENOTRUST: no Linux equivalent
115 [AIX_ETOOMANYREFS
] = ETOOMANYREFS
,
116 [AIX_EILSEQ
] = EILSEQ
,
117 [AIX_ECANCELED
] = ECANCELED
,
120 [AIX_EBADMSG
] = EBADMSG
,
121 [AIX_EPROTO
] = EPROTO
,
122 [AIX_ENODATA
] = ENODATA
,
123 [AIX_ENOSTR
] = ENOSTR
,
124 [AIX_ENOTSUP
] = ENOTSUP
,
125 [AIX_EMULTIHOP
] = EMULTIHOP
,
126 [AIX_ENOLINK
] = ENOLINK
,
127 [AIX_EOVERFLOW
] = EOVERFLOW
132 __errno_aix_to_linux (int err
)
136 if (err
>= 0 && err
< (sizeof (mapping
) / sizeof (mapping
[0]))
137 && ((conv
= mapping
[err
]) != 0 || err
== 0))
140 /* The error value is not known. Create a special value which can
141 be easily recognized as an invalid result. */