mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Code to convert error codes from AIX to Linux.
This commit is contained in:
parent
f57e29a591
commit
0d5037b5bb
125
sysdeps/unix/sysv/aix/linux/errnoconv.c
Normal file
125
sysdeps/unix/sysv/aix/linux/errnoconv.c
Normal file
@ -0,0 +1,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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user