1 /* $NetBSD: linux_errno.c,v 1.12 2001/11/13 02:08:49 lukem Exp $ */
4 * Copyright (c) 1995 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: linux_errno.c,v 1.12 2001/11/13 02:08:49 lukem Exp $");
35 #include <compat/linux/common/linux_errno.h>
38 * This list is used to translate NetBSD errnos to linux errnos
39 * when returning from a system call. (NetBSD system call->linux program)
41 const int native_to_linux_errno
[] = {
43 LINUX_SCERR_SIGN LINUX_EPERM
,
44 LINUX_SCERR_SIGN LINUX_ENOENT
,
45 LINUX_SCERR_SIGN LINUX_ESRCH
,
46 LINUX_SCERR_SIGN LINUX_EINTR
,
47 LINUX_SCERR_SIGN LINUX_EIO
,
48 LINUX_SCERR_SIGN LINUX_ENXIO
,
49 LINUX_SCERR_SIGN LINUX_E2BIG
,
50 LINUX_SCERR_SIGN LINUX_ENOEXEC
,
51 LINUX_SCERR_SIGN LINUX_EBADF
,
52 LINUX_SCERR_SIGN LINUX_ECHILD
,
53 LINUX_SCERR_SIGN LINUX_EDEADLK
,
54 LINUX_SCERR_SIGN LINUX_ENOMEM
,
55 LINUX_SCERR_SIGN LINUX_EACCES
,
56 LINUX_SCERR_SIGN LINUX_EFAULT
,
57 LINUX_SCERR_SIGN LINUX_ENOTBLK
,
58 LINUX_SCERR_SIGN LINUX_EBUSY
,
59 LINUX_SCERR_SIGN LINUX_EEXIST
,
60 LINUX_SCERR_SIGN LINUX_EXDEV
,
61 LINUX_SCERR_SIGN LINUX_ENODEV
,
62 LINUX_SCERR_SIGN LINUX_ENOTDIR
,
63 LINUX_SCERR_SIGN LINUX_EISDIR
,
64 LINUX_SCERR_SIGN LINUX_EINVAL
,
65 LINUX_SCERR_SIGN LINUX_ENFILE
,
66 LINUX_SCERR_SIGN LINUX_EMFILE
,
67 LINUX_SCERR_SIGN LINUX_ENOTTY
,
68 LINUX_SCERR_SIGN LINUX_ETXTBSY
,
69 LINUX_SCERR_SIGN LINUX_EFBIG
,
70 LINUX_SCERR_SIGN LINUX_ENOSPC
,
71 LINUX_SCERR_SIGN LINUX_ESPIPE
,
72 LINUX_SCERR_SIGN LINUX_EROFS
,
73 LINUX_SCERR_SIGN LINUX_EMLINK
,
74 LINUX_SCERR_SIGN LINUX_EPIPE
,
75 LINUX_SCERR_SIGN LINUX_EDOM
,
76 LINUX_SCERR_SIGN LINUX_ERANGE
,
77 LINUX_SCERR_SIGN LINUX_EAGAIN
,
78 LINUX_SCERR_SIGN LINUX_EINPROGRESS
,
79 LINUX_SCERR_SIGN LINUX_EALREADY
,
80 LINUX_SCERR_SIGN LINUX_ENOTSOCK
,
81 LINUX_SCERR_SIGN LINUX_EDESTADDRREQ
,
82 LINUX_SCERR_SIGN LINUX_EMSGSIZE
,
83 LINUX_SCERR_SIGN LINUX_EPROTOTYPE
,
84 LINUX_SCERR_SIGN LINUX_ENOPROTOOPT
,
85 LINUX_SCERR_SIGN LINUX_EPROTONOSUPPORT
,
86 LINUX_SCERR_SIGN LINUX_ESOCKTNOSUPPORT
,
87 LINUX_SCERR_SIGN LINUX_EOPNOTSUPP
,
88 LINUX_SCERR_SIGN LINUX_EPFNOSUPPORT
,
89 LINUX_SCERR_SIGN LINUX_EAFNOSUPPORT
,
90 LINUX_SCERR_SIGN LINUX_EADDRINUSE
,
91 LINUX_SCERR_SIGN LINUX_EADDRNOTAVAIL
,
92 LINUX_SCERR_SIGN LINUX_ENETDOWN
,
93 LINUX_SCERR_SIGN LINUX_ENETUNREACH
,
94 LINUX_SCERR_SIGN LINUX_ENETRESET
,
95 LINUX_SCERR_SIGN LINUX_ECONNABORTED
,
96 LINUX_SCERR_SIGN LINUX_ECONNRESET
,
97 LINUX_SCERR_SIGN LINUX_ENOBUFS
,
98 LINUX_SCERR_SIGN LINUX_EISCONN
,
99 LINUX_SCERR_SIGN LINUX_ENOTCONN
,
100 LINUX_SCERR_SIGN LINUX_ESHUTDOWN
,
101 LINUX_SCERR_SIGN LINUX_ETOOMANYREFS
,
102 LINUX_SCERR_SIGN LINUX_ETIMEDOUT
,
103 LINUX_SCERR_SIGN LINUX_ECONNREFUSED
,
104 LINUX_SCERR_SIGN LINUX_ELOOP
,
105 LINUX_SCERR_SIGN LINUX_ENAMETOOLONG
,
106 LINUX_SCERR_SIGN LINUX_EHOSTDOWN
,
107 LINUX_SCERR_SIGN LINUX_EHOSTUNREACH
,
108 LINUX_SCERR_SIGN LINUX_ENOTEMPTY
,
109 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EPROCLIM) */
110 LINUX_SCERR_SIGN LINUX_EUSERS
,
111 LINUX_SCERR_SIGN LINUX_EDQUOT
,
112 LINUX_SCERR_SIGN LINUX_ESTALE
,
113 LINUX_SCERR_SIGN LINUX_EREMOTE
,
114 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EBADRPC) */
115 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (ERPCMISMATCH) */
116 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EPROGUNAVAIL) */
117 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EPROGMISMATCH) */
118 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EPROCUNAVAIL) */
119 LINUX_SCERR_SIGN LINUX_ENOLCK
,
120 LINUX_SCERR_SIGN LINUX_ENOSYS
,
121 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EFTYPE) */
122 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (EAUTH) */
123 LINUX_SCERR_SIGN LINUX_ENOSYS
, /* not mapped (ENEEDAUTH) */
124 LINUX_SCERR_SIGN LINUX_EIDRM
,
125 LINUX_SCERR_SIGN LINUX_ENOMSG
, /* 83 */
128 * The rest of the list consists of errors that only
129 * Linux has. They can be used to map them on to
130 * themselves, so Linux emulating syscalls can return
134 LINUX_SCERR_SIGN LINUX_ECHRNG
,
135 LINUX_SCERR_SIGN LINUX_EL2NSYNC
,
136 LINUX_SCERR_SIGN LINUX_EL3HLT
,
137 LINUX_SCERR_SIGN LINUX_EL3RST
,
138 LINUX_SCERR_SIGN LINUX_ELNRNG
,
139 LINUX_SCERR_SIGN LINUX_EUNATCH
,
140 LINUX_SCERR_SIGN LINUX_ENOCSI
,
141 LINUX_SCERR_SIGN LINUX_EL2HLT
,
142 LINUX_SCERR_SIGN LINUX_EBADE
,
143 LINUX_SCERR_SIGN LINUX_EBADR
,
144 LINUX_SCERR_SIGN LINUX_EXFULL
,
145 LINUX_SCERR_SIGN LINUX_ENOANO
,
146 LINUX_SCERR_SIGN LINUX_EBADRQC
,
147 LINUX_SCERR_SIGN LINUX_EBADSLT
,
148 LINUX_SCERR_SIGN LINUX_EDEADLOCK
,
149 LINUX_SCERR_SIGN LINUX_EBFONT
,
150 LINUX_SCERR_SIGN LINUX_ENOSTR
,
151 LINUX_SCERR_SIGN LINUX_ENODATA
,
152 LINUX_SCERR_SIGN LINUX_ETIME
,
153 LINUX_SCERR_SIGN LINUX_ENOSR
,
154 LINUX_SCERR_SIGN LINUX_ENONET
,
155 LINUX_SCERR_SIGN LINUX_ENOPKG
,
156 LINUX_SCERR_SIGN LINUX_ENOLINK
,
157 LINUX_SCERR_SIGN LINUX_EADV
,
158 LINUX_SCERR_SIGN LINUX_ESRMNT
,
159 LINUX_SCERR_SIGN LINUX_ECOMM
,
160 LINUX_SCERR_SIGN LINUX_EPROTO
,
161 LINUX_SCERR_SIGN LINUX_EMULTIHOP
,
162 LINUX_SCERR_SIGN LINUX_EDOTDOT
,
163 LINUX_SCERR_SIGN LINUX_EBADMSG
,
164 LINUX_SCERR_SIGN LINUX_EOVERFLOW
,
165 LINUX_SCERR_SIGN LINUX_ENOTUNIQ
,
166 LINUX_SCERR_SIGN LINUX_EBADFD
,
167 LINUX_SCERR_SIGN LINUX_EREMCHG
,
168 LINUX_SCERR_SIGN LINUX_ELIBACC
,
169 LINUX_SCERR_SIGN LINUX_ELIBBAD
,
170 LINUX_SCERR_SIGN LINUX_ELIBSCN
,
171 LINUX_SCERR_SIGN LINUX_ELIBMAX
,
172 LINUX_SCERR_SIGN LINUX_ELIBEXEC
,
173 LINUX_SCERR_SIGN LINUX_EILSEQ
,
174 LINUX_SCERR_SIGN LINUX_ERESTART
,
175 LINUX_SCERR_SIGN LINUX_ESTRPIPE
,
176 LINUX_SCERR_SIGN LINUX_EUCLEAN
,
177 LINUX_SCERR_SIGN LINUX_ENOTNAM
,
178 LINUX_SCERR_SIGN LINUX_ENAVAIL
,
179 LINUX_SCERR_SIGN LINUX_EISNAM
,
180 LINUX_SCERR_SIGN LINUX_EREMOTEIO
,