1 /*	$NetBSD: rumpuser_errtrans.c,v 1.1 2013/04/30 12:39:20 pooka Exp $	*/
2 
3 /*
4  * pseudo-automatically generated.  PLEASE DO EDIT (e.g. in case there
5  * are errnos which are defined to be the same value)
6  *
7  *   awk '/^#define/{printf "#ifdef %s\n\tcase %-15s: return %s;\n#endif\n", \
8  *        $2, $2, $3}' < errno.h
9  *
10  */
11 
12 #include <errno.h>
13 
14 /*
15  * Translate host errno to rump kernel errno
16  */
17 int rumpuser__errtrans(int); /* a naughty decouple */
18 int
rumpuser__errtrans(int hosterr)19 rumpuser__errtrans(int hosterr)
20 {
21 
22 	/* just in case the vompiler is being silly */
23 	if (hosterr == 0)
24 		return 0;
25 
26 	switch (hosterr) {
27 #ifdef EPERM
28 	case EPERM          : return 1;
29 #endif
30 #ifdef ENOENT
31 	case ENOENT         : return 2;
32 #endif
33 #ifdef ESRCH
34 	case ESRCH          : return 3;
35 #endif
36 #ifdef EINTR
37 	case EINTR          : return 4;
38 #endif
39 #ifdef EIO
40 	case EIO            : return 5;
41 #endif
42 #ifdef ENXIO
43 	case ENXIO          : return 6;
44 #endif
45 #ifdef E2BIG
46 	case E2BIG          : return 7;
47 #endif
48 #ifdef ENOEXEC
49 	case ENOEXEC        : return 8;
50 #endif
51 #ifdef EBADF
52 	case EBADF          : return 9;
53 #endif
54 #ifdef ECHILD
55 	case ECHILD         : return 10;
56 #endif
57 #ifdef EDEADLK
58 	case EDEADLK        : return 11;
59 #endif
60 #ifdef ENOMEM
61 	case ENOMEM         : return 12;
62 #endif
63 #ifdef EACCES
64 	case EACCES         : return 13;
65 #endif
66 #ifdef EFAULT
67 	case EFAULT         : return 14;
68 #endif
69 #ifdef ENOTBLK
70 	case ENOTBLK        : return 15;
71 #endif
72 #ifdef EBUSY
73 	case EBUSY          : return 16;
74 #endif
75 #ifdef EEXIST
76 	case EEXIST         : return 17;
77 #endif
78 #ifdef EXDEV
79 	case EXDEV          : return 18;
80 #endif
81 #ifdef ENODEV
82 	case ENODEV         : return 19;
83 #endif
84 #ifdef ENOTDIR
85 	case ENOTDIR        : return 20;
86 #endif
87 #ifdef EISDIR
88 	case EISDIR         : return 21;
89 #endif
90 #ifdef EINVAL
91 	case EINVAL         : return 22;
92 #endif
93 #ifdef ENFILE
94 	case ENFILE         : return 23;
95 #endif
96 #ifdef EMFILE
97 	case EMFILE         : return 24;
98 #endif
99 #ifdef ENOTTY
100 	case ENOTTY         : return 25;
101 #endif
102 #ifdef ETXTBSY
103 	case ETXTBSY        : return 26;
104 #endif
105 #ifdef EFBIG
106 	case EFBIG          : return 27;
107 #endif
108 #ifdef ENOSPC
109 	case ENOSPC         : return 28;
110 #endif
111 #ifdef ESPIPE
112 	case ESPIPE         : return 29;
113 #endif
114 #ifdef EROFS
115 	case EROFS          : return 30;
116 #endif
117 #ifdef EMLINK
118 	case EMLINK         : return 31;
119 #endif
120 #ifdef EPIPE
121 	case EPIPE          : return 32;
122 #endif
123 #ifdef EDOM
124 	case EDOM           : return 33;
125 #endif
126 #ifdef ERANGE
127 	case ERANGE         : return 34;
128 #endif
129 #ifdef EAGAIN
130 	case EAGAIN         : return 35;
131 #endif
132 #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
133 	case EWOULDBLOCK    : return 35;
134 #endif
135 #ifdef EINPROGRESS
136 	case EINPROGRESS    : return 36;
137 #endif
138 #ifdef EALREADY
139 	case EALREADY       : return 37;
140 #endif
141 #ifdef ENOTSOCK
142 	case ENOTSOCK       : return 38;
143 #endif
144 #ifdef EDESTADDRREQ
145 	case EDESTADDRREQ   : return 39;
146 #endif
147 #ifdef EMSGSIZE
148 	case EMSGSIZE       : return 40;
149 #endif
150 #ifdef EPROTOTYPE
151 	case EPROTOTYPE     : return 41;
152 #endif
153 #ifdef ENOPROTOOPT
154 	case ENOPROTOOPT    : return 42;
155 #endif
156 #ifdef EPROTONOSUPPORT
157 	case EPROTONOSUPPORT: return 43;
158 #endif
159 #ifdef ESOCKTNOSUPPORT
160 	case ESOCKTNOSUPPORT: return 44;
161 #endif
162 #ifdef EOPNOTSUPP
163 	case EOPNOTSUPP     : return 45;
164 #endif
165 #ifdef EPFNOSUPPORT
166 	case EPFNOSUPPORT   : return 46;
167 #endif
168 #ifdef EAFNOSUPPORT
169 	case EAFNOSUPPORT   : return 47;
170 #endif
171 #ifdef EADDRINUSE
172 	case EADDRINUSE     : return 48;
173 #endif
174 #ifdef EADDRNOTAVAIL
175 	case EADDRNOTAVAIL  : return 49;
176 #endif
177 #ifdef ENETDOWN
178 	case ENETDOWN       : return 50;
179 #endif
180 #ifdef ENETUNREACH
181 	case ENETUNREACH    : return 51;
182 #endif
183 #ifdef ENETRESET
184 	case ENETRESET      : return 52;
185 #endif
186 #ifdef ECONNABORTED
187 	case ECONNABORTED   : return 53;
188 #endif
189 #ifdef ECONNRESET
190 	case ECONNRESET     : return 54;
191 #endif
192 #ifdef ENOBUFS
193 	case ENOBUFS        : return 55;
194 #endif
195 #ifdef EISCONN
196 	case EISCONN        : return 56;
197 #endif
198 #ifdef ENOTCONN
199 	case ENOTCONN       : return 57;
200 #endif
201 #ifdef ESHUTDOWN
202 	case ESHUTDOWN      : return 58;
203 #endif
204 #ifdef ETOOMANYREFS
205 	case ETOOMANYREFS   : return 59;
206 #endif
207 #ifdef ETIMEDOUT
208 	case ETIMEDOUT      : return 60;
209 #endif
210 #ifdef ECONNREFUSED
211 	case ECONNREFUSED   : return 61;
212 #endif
213 #ifdef ELOOP
214 	case ELOOP          : return 62;
215 #endif
216 #ifdef ENAMETOOLONG
217 	case ENAMETOOLONG   : return 63;
218 #endif
219 #ifdef EHOSTDOWN
220 	case EHOSTDOWN      : return 64;
221 #endif
222 #ifdef EHOSTUNREACH
223 	case EHOSTUNREACH   : return 65;
224 #endif
225 #ifdef ENOTEMPTY
226 	case ENOTEMPTY      : return 66;
227 #endif
228 #ifdef EPROCLIM
229 	case EPROCLIM       : return 67;
230 #endif
231 #ifdef EUSERS
232 	case EUSERS         : return 68;
233 #endif
234 #ifdef EDQUOT
235 	case EDQUOT         : return 69;
236 #endif
237 #ifdef ESTALE
238 	case ESTALE         : return 70;
239 #endif
240 #ifdef EREMOTE
241 	case EREMOTE        : return 71;
242 #endif
243 #ifdef EBADRPC
244 	case EBADRPC        : return 72;
245 #endif
246 #ifdef ERPCMISMATCH
247 	case ERPCMISMATCH   : return 73;
248 #endif
249 #ifdef EPROGUNAVAIL
250 	case EPROGUNAVAIL   : return 74;
251 #endif
252 #ifdef EPROGMISMATCH
253 	case EPROGMISMATCH  : return 75;
254 #endif
255 #ifdef EPROCUNAVAIL
256 	case EPROCUNAVAIL   : return 76;
257 #endif
258 #ifdef ENOLCK
259 	case ENOLCK         : return 77;
260 #endif
261 #ifdef ENOSYS
262 	case ENOSYS         : return 78;
263 #endif
264 #ifdef EFTYPE
265 	case EFTYPE         : return 79;
266 #endif
267 #ifdef EAUTH
268 	case EAUTH          : return 80;
269 #endif
270 #ifdef ENEEDAUTH
271 	case ENEEDAUTH      : return 81;
272 #endif
273 #ifdef EIDRM
274 	case EIDRM          : return 82;
275 #endif
276 #ifdef ENOMSG
277 	case ENOMSG         : return 83;
278 #endif
279 #ifdef EOVERFLOW
280 	case EOVERFLOW      : return 84;
281 #endif
282 #ifdef EILSEQ
283 	case EILSEQ         : return 85;
284 #endif
285 #if defined(ENOTSUP) && (!defined(EOPNOTSUPP) || ENOTSUP != EOPNOTSUPP)
286 	case ENOTSUP        : return 86;
287 #endif
288 #ifdef ECANCELED
289 	case ECANCELED      : return 87;
290 #endif
291 #ifdef EBADMSG
292 	case EBADMSG        : return 88;
293 #endif
294 #ifdef ENODATA
295 	case ENODATA        : return 89;
296 #endif
297 #ifdef ENOSR
298 	case ENOSR          : return 90;
299 #endif
300 #ifdef ENOSTR
301 	case ENOSTR         : return 91;
302 #endif
303 #ifdef ETIME
304 	case ETIME          : return 92;
305 #endif
306 #ifdef ENOATTR
307 	case ENOATTR        : return 93;
308 #endif
309 #ifdef EMULTIHOP
310 	case EMULTIHOP      : return 94;
311 #endif
312 #ifdef ENOLINK
313 	case ENOLINK        : return 95;
314 #endif
315 #ifdef EPROTO
316 	case EPROTO         : return 96;
317 #endif
318 
319 	default             : return 22; /* EINVAL */
320 	}
321 }
322