1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
pub const EMULTIHOP: OsErr = OsErr(72);
pub const EUNATCH: OsErr = OsErr(49);
pub const EAFNOSUPPORT: OsErr = OsErr(97);
pub const EREMCHG: OsErr = OsErr(78);
pub const EACCES: OsErr = OsErr(13);
pub const EDESTADDRREQ: OsErr = OsErr(89);
pub const EILSEQ: OsErr = OsErr(84);
pub const ESPIPE: OsErr = OsErr(29);
pub const EMLINK: OsErr = OsErr(31);
pub const EOWNERDEAD: OsErr = OsErr(130);
pub const ENOTTY: OsErr = OsErr(25);
pub const EBADE: OsErr = OsErr(52);
pub const EBADF: OsErr = OsErr(9);
pub const EBADR: OsErr = OsErr(53);
pub const EADV: OsErr = OsErr(68);
pub const ERANGE: OsErr = OsErr(34);
pub const ECANCELED: OsErr = OsErr(125);
pub const ETXTBSY: OsErr = OsErr(26);
pub const ENOMEM: OsErr = OsErr(12);
pub const EINPROGRESS: OsErr = OsErr(115);
pub const ENOTBLK: OsErr = OsErr(15);
pub const EPROTOTYPE: OsErr = OsErr(91);
pub const ERESTART: OsErr = OsErr(85);
pub const EISNAM: OsErr = OsErr(120);
pub const ENOMSG: OsErr = OsErr(42);
pub const EALREADY: OsErr = OsErr(114);
pub const ETIMEDOUT: OsErr = OsErr(110);
pub const ENODATA: OsErr = OsErr(61);
pub const EINTR: OsErr = OsErr(4);
pub const ENOLINK: OsErr = OsErr(67);
pub const EPERM: OsErr = OsErr(1);
pub const ELOOP: OsErr = OsErr(40);
pub const ENETDOWN: OsErr = OsErr(100);
pub const ESTALE: OsErr = OsErr(116);
pub const ENOSR: OsErr = OsErr(63);
pub const ELNRNG: OsErr = OsErr(48);
pub const EPIPE: OsErr = OsErr(32);
pub const ECHILD: OsErr = OsErr(10);
pub const EBADMSG: OsErr = OsErr(74);
pub const EBFONT: OsErr = OsErr(59);
pub const EREMOTE: OsErr = OsErr(66);
pub const ETOOMANYREFS: OsErr = OsErr(109);
pub const ENONET: OsErr = OsErr(64);
pub const EXFULL: OsErr = OsErr(54);
pub const ENOTEMPTY: OsErr = OsErr(39);
pub const ENOTNAM: OsErr = OsErr(118);
pub const EKEYREJECTED: OsErr = OsErr(129);
pub const ENOCSI: OsErr = OsErr(50);
pub const EADDRINUSE: OsErr = OsErr(98);
pub const ENETRESET: OsErr = OsErr(102);
pub const EISDIR: OsErr = OsErr(21);
pub const EIDRM: OsErr = OsErr(43);
pub const ENOTSOCK: OsErr = OsErr(88);
pub const EHOSTUNREACH: OsErr = OsErr(113);
pub const EBADFD: OsErr = OsErr(77);
pub const EL3HLT: OsErr = OsErr(46);
pub const EL2HLT: OsErr = OsErr(51);
pub const ENOKEY: OsErr = OsErr(126);
pub const EINVAL: OsErr = OsErr(22);
pub const ESHUTDOWN: OsErr = OsErr(108);
pub const ENOMEDIUM: OsErr = OsErr(123);
pub const ELIBSCN: OsErr = OsErr(81);
pub const ENAVAIL: OsErr = OsErr(119);
pub const EOVERFLOW: OsErr = OsErr(75);
pub const EUCLEAN: OsErr = OsErr(117);
pub const EBUSY: OsErr = OsErr(16);
pub const EPROTO: OsErr = OsErr(71);
pub const ENODEV: OsErr = OsErr(19);
pub const EKEYEXPIRED: OsErr = OsErr(127);
pub const EROFS: OsErr = OsErr(30);
pub const ELIBACC: OsErr = OsErr(79);
pub const EHWPOISON: OsErr = OsErr(133);
pub const E2BIG: OsErr = OsErr(7);
pub const EDEADLK: OsErr = OsErr(35);
pub const EL3RST: OsErr = OsErr(47);
pub const ENOTDIR: OsErr = OsErr(20);
pub const ECONNRESET: OsErr = OsErr(104);
pub const ENXIO: OsErr = OsErr(6);
pub const EBADRQC: OsErr = OsErr(56);
pub const ENOSTR: OsErr = OsErr(60);
pub const ENAMETOOLONG: OsErr = OsErr(36);
pub const ESOCKTNOSUPPORT: OsErr = OsErr(94);
pub const ELIBEXEC: OsErr = OsErr(83);
pub const EDOTDOT: OsErr = OsErr(73);
pub const EADDRNOTAVAIL: OsErr = OsErr(99);
pub const ETIME: OsErr = OsErr(62);
pub const EPROTONOSUPPORT: OsErr = OsErr(93);
pub const ENOTRECOVERABLE: OsErr = OsErr(131);
pub const EIO: OsErr = OsErr(5);
pub const ENETUNREACH: OsErr = OsErr(101);
pub const EXDEV: OsErr = OsErr(18);
pub const EDQUOT: OsErr = OsErr(122);
pub const EREMOTEIO: OsErr = OsErr(121);
pub const ENOSPC: OsErr = OsErr(28);
pub const ENOEXEC: OsErr = OsErr(8);
pub const EMSGSIZE: OsErr = OsErr(90);
pub const EDOM: OsErr = OsErr(33);
pub const EFBIG: OsErr = OsErr(27);
pub const ESRCH: OsErr = OsErr(3);
pub const ECHRNG: OsErr = OsErr(44);
pub const EHOSTDOWN: OsErr = OsErr(112);
pub const ENOLCK: OsErr = OsErr(37);
pub const ENFILE: OsErr = OsErr(23);
pub const ENOSYS: OsErr = OsErr(38);
pub const ENOTCONN: OsErr = OsErr(107);
pub const EPFNOSUPPORT: OsErr = OsErr(96);
pub const ENOTSUP: OsErr = EOPNOTSUPP;
pub const ESRMNT: OsErr = OsErr(69);
pub const EDEADLOCK: OsErr = EDEADLK;
pub const ECONNABORTED: OsErr = OsErr(103);
pub const ENOANO: OsErr = OsErr(55);
pub const EISCONN: OsErr = OsErr(106);
pub const EUSERS: OsErr = OsErr(87);
pub const ENOPROTOOPT: OsErr = OsErr(92);
pub const ECOMM: OsErr = OsErr(70);
pub const EMFILE: OsErr = OsErr(24);
pub const ERFKILL: OsErr = OsErr(132);
pub const ENOBUFS: OsErr = OsErr(105);
pub const EFAULT: OsErr = OsErr(14);
pub const EWOULDBLOCK: OsErr = EAGAIN;
pub const ELIBBAD: OsErr = OsErr(80);
pub const ESTRPIPE: OsErr = OsErr(86);
pub const ECONNREFUSED: OsErr = OsErr(111);
pub const EAGAIN: OsErr = OsErr(11);
pub const ELIBMAX: OsErr = OsErr(82);
pub const EEXIST: OsErr = OsErr(17);
pub const EL2NSYNC: OsErr = OsErr(45);
pub const ENOENT: OsErr = OsErr(2);
pub const ENOPKG: OsErr = OsErr(65);
pub const EBADSLT: OsErr = OsErr(57);
pub const EKEYREVOKED: OsErr = OsErr(128);
pub const ENOTUNIQ: OsErr = OsErr(76);
pub const EOPNOTSUPP: OsErr = OsErr(95);
pub const EMEDIUMTYPE: OsErr = OsErr(124);
const error_names: [Option<&'static str>; 134] = [
None,
Some("EPERM"),
Some("ENOENT"),
Some("ESRCH"),
Some("EINTR"),
Some("EIO"),
Some("ENXIO"),
Some("E2BIG"),
Some("ENOEXEC"),
Some("EBADF"),
Some("ECHILD"),
Some("EAGAIN"),
Some("ENOMEM"),
Some("EACCES"),
Some("EFAULT"),
Some("ENOTBLK"),
Some("EBUSY"),
Some("EEXIST"),
Some("EXDEV"),
Some("ENODEV"),
Some("ENOTDIR"),
Some("EISDIR"),
Some("EINVAL"),
Some("ENFILE"),
Some("EMFILE"),
Some("ENOTTY"),
Some("ETXTBSY"),
Some("EFBIG"),
Some("ENOSPC"),
Some("ESPIPE"),
Some("EROFS"),
Some("EMLINK"),
Some("EPIPE"),
Some("EDOM"),
Some("ERANGE"),
Some("EDEADLK"),
Some("ENAMETOOLONG"),
Some("ENOLCK"),
Some("ENOSYS"),
Some("ENOTEMPTY"),
Some("ELOOP"),
None,
Some("ENOMSG"),
Some("EIDRM"),
Some("ECHRNG"),
Some("EL2NSYNC"),
Some("EL3HLT"),
Some("EL3RST"),
Some("ELNRNG"),
Some("EUNATCH"),
Some("ENOCSI"),
Some("EL2HLT"),
Some("EBADE"),
Some("EBADR"),
Some("EXFULL"),
Some("ENOANO"),
Some("EBADRQC"),
Some("EBADSLT"),
None,
Some("EBFONT"),
Some("ENOSTR"),
Some("ENODATA"),
Some("ETIME"),
Some("ENOSR"),
Some("ENONET"),
Some("ENOPKG"),
Some("EREMOTE"),
Some("ENOLINK"),
Some("EADV"),
Some("ESRMNT"),
Some("ECOMM"),
Some("EPROTO"),
Some("EMULTIHOP"),
Some("EDOTDOT"),
Some("EBADMSG"),
Some("EOVERFLOW"),
Some("ENOTUNIQ"),
Some("EBADFD"),
Some("EREMCHG"),
Some("ELIBACC"),
Some("ELIBBAD"),
Some("ELIBSCN"),
Some("ELIBMAX"),
Some("ELIBEXEC"),
Some("EILSEQ"),
Some("ERESTART"),
Some("ESTRPIPE"),
Some("EUSERS"),
Some("ENOTSOCK"),
Some("EDESTADDRREQ"),
Some("EMSGSIZE"),
Some("EPROTOTYPE"),
Some("ENOPROTOOPT"),
Some("EPROTONOSUPPORT"),
Some("ESOCKTNOSUPPORT"),
Some("EOPNOTSUPP"),
Some("EPFNOSUPPORT"),
Some("EAFNOSUPPORT"),
Some("EADDRINUSE"),
Some("EADDRNOTAVAIL"),
Some("ENETDOWN"),
Some("ENETUNREACH"),
Some("ENETRESET"),
Some("ECONNABORTED"),
Some("ECONNRESET"),
Some("ENOBUFS"),
Some("EISCONN"),
Some("ENOTCONN"),
Some("ESHUTDOWN"),
Some("ETOOMANYREFS"),
Some("ETIMEDOUT"),
Some("ECONNREFUSED"),
Some("EHOSTDOWN"),
Some("EHOSTUNREACH"),
Some("EALREADY"),
Some("EINPROGRESS"),
Some("ESTALE"),
Some("EUCLEAN"),
Some("ENOTNAM"),
Some("ENAVAIL"),
Some("EISNAM"),
Some("EREMOTEIO"),
Some("EDQUOT"),
Some("ENOMEDIUM"),
Some("EMEDIUMTYPE"),
Some("ECANCELED"),
Some("ENOKEY"),
Some("EKEYEXPIRED"),
Some("EKEYREVOKED"),
Some("EKEYREJECTED"),
Some("EOWNERDEAD"),
Some("ENOTRECOVERABLE"),
Some("ERFKILL"),
Some("EHWPOISON"),
];
const error_messages: [&'static str; 134] = [
"",
"Operation not permitted",
"No such file or directory",
"No such process",
"Interrupted system call",
"Input/output error",
"No such device or address",
"Argument list too long",
"Exec format error",
"Bad file descriptor",
"No child processes",
"Resource temporarily unavailable",
"Cannot allocate memory",
"Permission denied",
"Bad address",
"Block device required",
"Device or resource busy",
"File exists",
"Invalid cross-device link",
"No such device",
"Not a directory",
"Is a directory",
"Invalid argument",
"Too many open files in system",
"Too many open files",
"Inappropriate ioctl for device",
"Text file busy",
"File too large",
"No space left on device",
"Illegal seek",
"Read-only file system",
"Too many links",
"Broken pipe",
"Numerical argument out of domain",
"Numerical result out of range",
"Resource deadlock avoided",
"File name too long",
"No locks available",
"Function not implemented",
"Directory not empty",
"Too many levels of symbolic links",
"",
"No message of desired type",
"Identifier removed",
"Channel number out of range",
"Level 2 not synchronized",
"Level 3 halted",
"Level 3 reset",
"Link number out of range",
"Protocol driver not attached",
"No CSI structure available",
"Level 2 halted",
"Invalid exchange",
"Invalid request descriptor",
"Exchange full",
"No anode",
"Invalid request code",
"Invalid slot",
"",
"Bad font file format",
"Device not a stream",
"No data available",
"Timer expired",
"Out of streams resources",
"Machine is not on the network",
"Package not installed",
"Object is remote",
"Link has been severed",
"Advertise error",
"Srmount error",
"Communication error on send",
"Protocol error",
"Multihop attempted",
"RFS specific error",
"Bad message",
"Value too large for defined data type",
"Name not unique on network",
"File descriptor in bad state",
"Remote address changed",
"Can not access a needed shared library",
"Accessing a corrupted shared library",
".lib section in a.out corrupted",
"Attempting to link in too many shared libraries",
"Cannot exec a shared library directly",
"Invalid or incomplete multibyte or wide character",
"Interrupted system call should be restarted",
"Streams pipe error",
"Too many users",
"Socket operation on non-socket",
"Destination address required",
"Message too long",
"Protocol wrong type for socket",
"Protocol not available",
"Protocol not supported",
"Socket type not supported",
"Operation not supported",
"Protocol family not supported",
"Address family not supported by protocol",
"Address already in use",
"Cannot assign requested address",
"Network is down",
"Network is unreachable",
"Network dropped connection on reset",
"Software caused connection abort",
"Connection reset by peer",
"No buffer space available",
"Transport endpoint is already connected",
"Transport endpoint is not connected",
"Cannot send after transport endpoint shutdown",
"Too many references: cannot splice",
"Connection timed out",
"Connection refused",
"Host is down",
"No route to host",
"Operation already in progress",
"Operation now in progress",
"Stale file handle",
"Structure needs cleaning",
"Not a XENIX named type file",
"No XENIX semaphores available",
"Is a named type file",
"Remote I/O error",
"Disk quota exceeded",
"No medium found",
"Wrong medium type",
"Operation canceled",
"Required key not available",
"Key has expired",
"Key has been revoked",
"Key was rejected by service",
"Owner died",
"State not recoverable",
"Operation not possible due to RF-kill",
"Memory page has hardware error",
];