xref: /minix3/minix/drivers/vmm_guest/vbox/err.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /* VirtualBox driver - by D.C. van Moolenbroek */
2*433d6423SLionel Sambuc #include <minix/drivers.h>
3*433d6423SLionel Sambuc #include <errno.h>
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #include "vmmdev.h"
6*433d6423SLionel Sambuc #include "proto.h"
7*433d6423SLionel Sambuc 
8*433d6423SLionel Sambuc static int codes[] = {
9*433d6423SLionel Sambuc   OK,			/*     0: success */
10*433d6423SLionel Sambuc   EGENERIC,		/*    -1: general failure */
11*433d6423SLionel Sambuc   EINVAL,		/*    -2: invalid parameter */
12*433d6423SLionel Sambuc   EINVAL,		/*    -3: invalid magic */
13*433d6423SLionel Sambuc   EBADF,		/*    -4: invalid handle */
14*433d6423SLionel Sambuc   ENOLCK,		/*    -5: lock failed */
15*433d6423SLionel Sambuc   EFAULT,		/*    -6: invalid pointer */
16*433d6423SLionel Sambuc   EGENERIC,		/*    -7: patching IDT failed */
17*433d6423SLionel Sambuc   ENOMEM,		/*    -8: memory allocation failed */
18*433d6423SLionel Sambuc   EEXIST,		/*    -9: already loaded */
19*433d6423SLionel Sambuc   EPERM,		/*   -10: permission denied */
20*433d6423SLionel Sambuc   EINVAL,		/*   -11: version mismatch */
21*433d6423SLionel Sambuc   ENOSYS,		/*   -12: function not implemented */
22*433d6423SLionel Sambuc   EGENERIC,		/*   -13 */
23*433d6423SLionel Sambuc   EGENERIC,		/*   -14 */
24*433d6423SLionel Sambuc   EGENERIC,		/*   -15 */
25*433d6423SLionel Sambuc   EGENERIC,		/*   -16 */
26*433d6423SLionel Sambuc   EGENERIC,		/*   -17 */
27*433d6423SLionel Sambuc   EGENERIC,		/*   -18: not equal */
28*433d6423SLionel Sambuc   EINVAL,		/*   -19: not a symlink */
29*433d6423SLionel Sambuc   ENOMEM,		/*   -20: temporary memory allocation failed */
30*433d6423SLionel Sambuc   EINVAL,		/*   -21: invalid file mode */
31*433d6423SLionel Sambuc   EINVAL,		/*   -22: incorrect call order */
32*433d6423SLionel Sambuc   EGENERIC,		/*   -23: no TLS available */
33*433d6423SLionel Sambuc   EGENERIC,		/*   -24: failed to set TLS */
34*433d6423SLionel Sambuc   EGENERIC,		/*   -25 */
35*433d6423SLionel Sambuc   ENOMEM,		/*   -26: contiguous memory allocation failed */
36*433d6423SLionel Sambuc   ENOMEM,		/*   -27: no memory available for page table */
37*433d6423SLionel Sambuc   EGENERIC,		/*   -28 */
38*433d6423SLionel Sambuc   ESRCH,		/*   -29: thread is dead */
39*433d6423SLionel Sambuc   EINVAL,		/*   -30: thread is not waitable */
40*433d6423SLionel Sambuc   EGENERIC,		/*   -31: page table not present */
41*433d6423SLionel Sambuc   EINVAL,		/*   -32: invalid context */
42*433d6423SLionel Sambuc   EBUSY,		/*   -33: timer is busy */
43*433d6423SLionel Sambuc   EGENERIC,		/*   -34: address conflict */
44*433d6423SLionel Sambuc   EGENERIC,		/*   -35: unresolved error */
45*433d6423SLionel Sambuc   ENOTTY,		/*   -36: invalid function */
46*433d6423SLionel Sambuc   EINVAL,		/*   -37: not supported */
47*433d6423SLionel Sambuc   EACCES,		/*   -38: access denied */
48*433d6423SLionel Sambuc   EINTR,		/*   -39: interrupted */
49*433d6423SLionel Sambuc   ETIMEDOUT,		/*   -40: timeout */
50*433d6423SLionel Sambuc   E2BIG,		/*   -41: buffer overflow */
51*433d6423SLionel Sambuc   E2BIG,		/*   -42: too much data */
52*433d6423SLionel Sambuc   EAGAIN,		/*   -43: max thread number reached */
53*433d6423SLionel Sambuc   EAGAIN,		/*   -44: max process number reached */
54*433d6423SLionel Sambuc   EGENERIC,		/*   -45: signal refused */
55*433d6423SLionel Sambuc   EBUSY,		/*   -46: signal already pending */
56*433d6423SLionel Sambuc   EINVAL,		/*   -47: invalid signal */
57*433d6423SLionel Sambuc   EGENERIC,		/*   -48: state changed */
58*433d6423SLionel Sambuc   EINVAL,		/*   -49: invalid UUID format */
59*433d6423SLionel Sambuc   ESRCH,		/*   -50: process not found */
60*433d6423SLionel Sambuc   OK,			/*   -51: waited-for process is still running */
61*433d6423SLionel Sambuc   EAGAIN,		/*   -52: try again */
62*433d6423SLionel Sambuc   EGENERIC,		/*   -53: generic parse error */
63*433d6423SLionel Sambuc   ERANGE,		/*   -54: value out of range */
64*433d6423SLionel Sambuc   EOVERFLOW,		/*   -55: value too big */
65*433d6423SLionel Sambuc   EGENERIC,		/*   -56: no digits in string */
66*433d6423SLionel Sambuc   ERANGE,		/*   -57: minus sign in unsigned value */
67*433d6423SLionel Sambuc   EILSEQ,		/*   -58: character translation failed */
68*433d6423SLionel Sambuc   EGENERIC,		/*   -59: encountered unicode byte order mark */
69*433d6423SLionel Sambuc   EGENERIC,		/*   -60: encountered unicode surrogate */
70*433d6423SLionel Sambuc   EILSEQ,		/*   -61: invalid UTF8 encoding */
71*433d6423SLionel Sambuc   EILSEQ,		/*   -62: invalid UTF16 encoding */
72*433d6423SLionel Sambuc   EGENERIC,		/*   -63: no UTF16 for character */
73*433d6423SLionel Sambuc   ENOMEM,		/*   -64: string memory allocation failed */
74*433d6423SLionel Sambuc   ENOMEM,		/*   -65: UTF16 string memory allocation failed */
75*433d6423SLionel Sambuc   ENOMEM,		/*   -66: code point array allocation failed */
76*433d6423SLionel Sambuc   EBUSY,		/*   -67: cannot free in-use memory */
77*433d6423SLionel Sambuc   EGENERIC,		/*   -68: timer already active */
78*433d6423SLionel Sambuc   EGENERIC,		/*   -69: timer already suspended */
79*433d6423SLionel Sambuc   ECANCELED,		/*   -70: operation cancelled */
80*433d6423SLionel Sambuc   ENOMEM,		/*   -71: failed to initialize memory object */
81*433d6423SLionel Sambuc   ENOMEM,		/*   -72: low physical memory allocation failed */
82*433d6423SLionel Sambuc   ENOMEM,		/*   -73: physical memory allocation failed */
83*433d6423SLionel Sambuc   EGENERIC,		/*   -74: address too big */
84*433d6423SLionel Sambuc   EGENERIC,		/*   -75: memory mapping failed */
85*433d6423SLionel Sambuc   EGENERIC,		/*   -76: trailing characters */
86*433d6423SLionel Sambuc   EGENERIC,		/*   -77: trailing spaces */
87*433d6423SLionel Sambuc   ESRCH,		/*   -78: not found */
88*433d6423SLionel Sambuc   EGENERIC,		/*   -79: invalid state */
89*433d6423SLionel Sambuc   ENOMEM,		/*   -80: out of resources */
90*433d6423SLionel Sambuc   ENFILE,		/*   -81: no more handles */
91*433d6423SLionel Sambuc   EGENERIC,		/*   -82: preemption disabled */
92*433d6423SLionel Sambuc   EGENERIC,		/*   -83: end of string */
93*433d6423SLionel Sambuc   EGENERIC,		/*   -84: page count out of range */
94*433d6423SLionel Sambuc   EGENERIC,		/*   -85: object destroyed */
95*433d6423SLionel Sambuc   EGENERIC,		/*   -86: dangling objects */
96*433d6423SLionel Sambuc   EGENERIC,		/*   -87: invalid Base64 encoding */
97*433d6423SLionel Sambuc   EGENERIC,		/*   -88: return triggered by callback */
98*433d6423SLionel Sambuc   EGENERIC,		/*   -89: authentication failure */
99*433d6423SLionel Sambuc   EGENERIC,		/*   -90: not a power of two */
100*433d6423SLionel Sambuc   EGENERIC,		/*   -91: ignored */
101*433d6423SLionel Sambuc   EGENERIC,		/*   -92: concurrent access not allowed */
102*433d6423SLionel Sambuc   EGENERIC,		/*   -93: invalid reference sharing */
103*433d6423SLionel Sambuc   EGENERIC,		/*   -94 */
104*433d6423SLionel Sambuc   EGENERIC,		/*   -95: no change */
105*433d6423SLionel Sambuc   ENOMEM,		/*   -96: executable memory allocation failed */
106*433d6423SLionel Sambuc   EINVAL,		/*   -97: unsupported alignment */
107*433d6423SLionel Sambuc   EGENERIC,		/*   -98: duplicate */
108*433d6423SLionel Sambuc   EGENERIC,		/*   -99: missing */
109*433d6423SLionel Sambuc   EIO,			/*  -100: I/O error */
110*433d6423SLionel Sambuc   ENXIO,		/*  -101: open failed */
111*433d6423SLionel Sambuc   ENOENT,		/*  -102: file not found */
112*433d6423SLionel Sambuc   ENOTDIR,		/*  -103: path not found (may also mean ENOENT) */
113*433d6423SLionel Sambuc   EINVAL,		/*  -104: invalid name */
114*433d6423SLionel Sambuc   EEXIST,		/*  -105: already exists */
115*433d6423SLionel Sambuc   ENFILE,		/*  -106: too many open files */
116*433d6423SLionel Sambuc   EIO,			/*  -107: seek error */
117*433d6423SLionel Sambuc   EINVAL,		/*  -108: negative seek */
118*433d6423SLionel Sambuc   ESPIPE,		/*  -109: seek on device */
119*433d6423SLionel Sambuc   EGENERIC,		/*  -110: end of file */
120*433d6423SLionel Sambuc   EIO,			/*  -111: generic read error */
121*433d6423SLionel Sambuc   EIO,			/*  -112: generic write error */
122*433d6423SLionel Sambuc   EROFS,		/*  -113: write protected */
123*433d6423SLionel Sambuc   ETXTBSY,		/*  -114: sharing violation */
124*433d6423SLionel Sambuc   ENOLCK,		/*  -115: file lock failed */
125*433d6423SLionel Sambuc   EAGAIN,		/*  -116: file lock violation */
126*433d6423SLionel Sambuc   EIO,			/*  -117: cannot create file */
127*433d6423SLionel Sambuc   EIO,			/*  -118: cannot delete directory */
128*433d6423SLionel Sambuc   EXDEV,		/*  -119: not the same device */
129*433d6423SLionel Sambuc   ENAMETOOLONG,		/*  -120: file name too long */
130*433d6423SLionel Sambuc   ENXIO,		/*  -121: media not present */
131*433d6423SLionel Sambuc   EIO,			/*  -122: media not recognized */
132*433d6423SLionel Sambuc   OK,			/*  -123: nothing to unlocked */
133*433d6423SLionel Sambuc   EGENERIC,		/*  -124: lock lost */
134*433d6423SLionel Sambuc   ENOTEMPTY,		/*  -125: directory not empty */
135*433d6423SLionel Sambuc   ENOTDIR,		/*  -126: not a directory */
136*433d6423SLionel Sambuc   EISDIR,		/*  -127: is a directory */
137*433d6423SLionel Sambuc   EFBIG,		/*  -128: file too big */
138*433d6423SLionel Sambuc   EGENERIC,		/*  -129: no asynchronous I/O request */
139*433d6423SLionel Sambuc   EGENERIC,		/*  -130: asynchronous I/O in progress */
140*433d6423SLionel Sambuc   EGENERIC,		/*  -131: asynchronous I/O completed */
141*433d6423SLionel Sambuc   EGENERIC,		/*  -132: asynchronous I/O busy */
142*433d6423SLionel Sambuc   EGENERIC,		/*  -133: asynchronous I/O limit exceeded */
143*433d6423SLionel Sambuc   EGENERIC,		/*  -134: asynchronous I/O canceled */
144*433d6423SLionel Sambuc   EGENERIC,		/*  -135: asynchronous I/O not submitted */
145*433d6423SLionel Sambuc   EGENERIC,		/*  -136: asynchronous I/O not prepared */
146*433d6423SLionel Sambuc   EGENERIC,		/*  -137: asynchronous I/O out of resources */
147*433d6423SLionel Sambuc   EBUSY,		/*  -138: device or resource busy */
148*433d6423SLionel Sambuc   EGENERIC,		/*  -139: not a file */
149*433d6423SLionel Sambuc   EGENERIC,		/*  -140: is a file */
150*433d6423SLionel Sambuc   EGENERIC,		/*  -141: unexpected file type */
151*433d6423SLionel Sambuc   EGENERIC,		/*  -142: missing path root specification */
152*433d6423SLionel Sambuc   EGENERIC,		/*  -143: path is relative */
153*433d6423SLionel Sambuc   EGENERIC,		/*  -144: path is not relative */
154*433d6423SLionel Sambuc   EGENERIC,		/*  -145 */
155*433d6423SLionel Sambuc   EGENERIC,		/*  -146 */
156*433d6423SLionel Sambuc   EGENERIC,		/*  -147 */
157*433d6423SLionel Sambuc   EGENERIC,		/*  -148 */
158*433d6423SLionel Sambuc   EGENERIC,		/*  -149 */
159*433d6423SLionel Sambuc   EIO,			/*  -150: disk I/O error */
160*433d6423SLionel Sambuc   ENXIO,		/*  -151: invalid drive number */
161*433d6423SLionel Sambuc   ENOSPC,		/*  -152: disk full */
162*433d6423SLionel Sambuc   EIO,			/*  -153: disk changed */
163*433d6423SLionel Sambuc   EGENERIC,		/*  -154: drive locked */
164*433d6423SLionel Sambuc   ENXIO,		/*  -155: invalid disk format */
165*433d6423SLionel Sambuc   ELOOP,		/*  -156: too many symlinks */
166*433d6423SLionel Sambuc   EOPNOTSUPP,		/*  -157: can not set symlink file times */
167*433d6423SLionel Sambuc   EOPNOTSUPP,		/*  -158: can not change symlink owner */
168*433d6423SLionel Sambuc   EGENERIC,		/*  -159 */
169*433d6423SLionel Sambuc   EGENERIC,		/*  -160 */
170*433d6423SLionel Sambuc   EGENERIC,		/*  -161 */
171*433d6423SLionel Sambuc   EGENERIC,		/*  -162 */
172*433d6423SLionel Sambuc   EGENERIC,		/*  -163 */
173*433d6423SLionel Sambuc   EGENERIC,		/*  -164 */
174*433d6423SLionel Sambuc   EGENERIC,		/*  -165 */
175*433d6423SLionel Sambuc   EGENERIC,		/*  -166 */
176*433d6423SLionel Sambuc   EGENERIC,		/*  -167 */
177*433d6423SLionel Sambuc   EGENERIC,		/*  -168 */
178*433d6423SLionel Sambuc   EGENERIC,		/*  -169 */
179*433d6423SLionel Sambuc   EGENERIC,		/*  -170 */
180*433d6423SLionel Sambuc   EGENERIC,		/*  -171 */
181*433d6423SLionel Sambuc   EGENERIC,		/*  -172 */
182*433d6423SLionel Sambuc   EGENERIC,		/*  -173 */
183*433d6423SLionel Sambuc   EGENERIC,		/*  -174 */
184*433d6423SLionel Sambuc   EGENERIC,		/*  -175 */
185*433d6423SLionel Sambuc   EGENERIC,		/*  -176 */
186*433d6423SLionel Sambuc   EGENERIC,		/*  -177 */
187*433d6423SLionel Sambuc   EGENERIC,		/*  -178 */
188*433d6423SLionel Sambuc   EGENERIC,		/*  -179 */
189*433d6423SLionel Sambuc   EGENERIC,		/*  -180 */
190*433d6423SLionel Sambuc   EGENERIC,		/*  -181 */
191*433d6423SLionel Sambuc   EGENERIC,		/*  -182 */
192*433d6423SLionel Sambuc   EGENERIC,		/*  -183 */
193*433d6423SLionel Sambuc   EGENERIC,		/*  -184 */
194*433d6423SLionel Sambuc   EGENERIC,		/*  -185 */
195*433d6423SLionel Sambuc   EGENERIC,		/*  -186 */
196*433d6423SLionel Sambuc   EGENERIC,		/*  -187 */
197*433d6423SLionel Sambuc   EGENERIC,		/*  -188 */
198*433d6423SLionel Sambuc   EGENERIC,		/*  -189 */
199*433d6423SLionel Sambuc   EGENERIC,		/*  -190 */
200*433d6423SLionel Sambuc   EGENERIC,		/*  -191 */
201*433d6423SLionel Sambuc   EGENERIC,		/*  -192 */
202*433d6423SLionel Sambuc   EGENERIC,		/*  -193 */
203*433d6423SLionel Sambuc   EGENERIC,		/*  -194 */
204*433d6423SLionel Sambuc   EGENERIC,		/*  -195 */
205*433d6423SLionel Sambuc   EGENERIC,		/*  -196 */
206*433d6423SLionel Sambuc   EGENERIC,		/*  -197 */
207*433d6423SLionel Sambuc   EGENERIC,		/*  -198 */
208*433d6423SLionel Sambuc   EGENERIC,		/*  -199 */
209*433d6423SLionel Sambuc   EGENERIC,		/*  -200: search error */
210*433d6423SLionel Sambuc   OK,			/*  -201: no more files */
211*433d6423SLionel Sambuc   ENFILE,		/*  -202: no more search handles available */
212*433d6423SLionel Sambuc };
213*433d6423SLionel Sambuc 
convert_err(int code)214*433d6423SLionel Sambuc int convert_err(int code)
215*433d6423SLionel Sambuc {
216*433d6423SLionel Sambuc /* Return a POSIX error code for the given VirtualBox error code.
217*433d6423SLionel Sambuc  */
218*433d6423SLionel Sambuc   unsigned int index;
219*433d6423SLionel Sambuc 
220*433d6423SLionel Sambuc   index = -code;
221*433d6423SLionel Sambuc 
222*433d6423SLionel Sambuc   if (index < sizeof(codes) / sizeof(codes[0]))
223*433d6423SLionel Sambuc 	return codes[index];
224*433d6423SLionel Sambuc 
225*433d6423SLionel Sambuc   return EGENERIC;
226*433d6423SLionel Sambuc }
227