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
/// Multihop attempted
pub const EMULTIHOP: OsErr = OsErr(72);
/// Protocol driver not attached
pub const EUNATCH: OsErr = OsErr(49);
/// Address family not supported by protocol
pub const EAFNOSUPPORT: OsErr = OsErr(97);
/// Remote address changed
pub const EREMCHG: OsErr = OsErr(78);
/// Permission denied
pub const EACCES: OsErr = OsErr(13);
/// Destination address required
pub const EDESTADDRREQ: OsErr = OsErr(89);
/// Invalid or incomplete multibyte or wide character
pub const EILSEQ: OsErr = OsErr(84);
/// Illegal seek
pub const ESPIPE: OsErr = OsErr(29);
/// Too many links
pub const EMLINK: OsErr = OsErr(31);
/// Owner died
pub const EOWNERDEAD: OsErr = OsErr(130);
/// Inappropriate ioctl for device
pub const ENOTTY: OsErr = OsErr(25);
/// Invalid exchange
pub const EBADE: OsErr = OsErr(52);
/// Bad file descriptor
pub const EBADF: OsErr = OsErr(9);
/// Invalid request descriptor
pub const EBADR: OsErr = OsErr(53);
/// Advertise error
pub const EADV: OsErr = OsErr(68);
/// Numerical result out of range
pub const ERANGE: OsErr = OsErr(34);
/// Operation canceled
pub const ECANCELED: OsErr = OsErr(125);
/// Text file busy
pub const ETXTBSY: OsErr = OsErr(26);
/// Cannot allocate memory
pub const ENOMEM: OsErr = OsErr(12);
/// Operation now in progress
pub const EINPROGRESS: OsErr = OsErr(115);
/// Block device required
pub const ENOTBLK: OsErr = OsErr(15);
/// Protocol wrong type for socket
pub const EPROTOTYPE: OsErr = OsErr(91);
/// Interrupted system call should be restarted
pub const ERESTART: OsErr = OsErr(85);
/// Is a named type file
pub const EISNAM: OsErr = OsErr(120);
/// No message of desired type
pub const ENOMSG: OsErr = OsErr(42);
/// Operation already in progress
pub const EALREADY: OsErr = OsErr(114);
/// Connection timed out
pub const ETIMEDOUT: OsErr = OsErr(110);
/// No data available
pub const ENODATA: OsErr = OsErr(61);
/// Interrupted system call
pub const EINTR: OsErr = OsErr(4);
/// Link has been severed
pub const ENOLINK: OsErr = OsErr(67);
/// Operation not permitted
pub const EPERM: OsErr = OsErr(1);
/// Too many levels of symbolic links
pub const ELOOP: OsErr = OsErr(40);
/// Network is down
pub const ENETDOWN: OsErr = OsErr(100);
/// Stale file handle
pub const ESTALE: OsErr = OsErr(116);
/// Out of streams resources
pub const ENOSR: OsErr = OsErr(63);
/// Link number out of range
pub const ELNRNG: OsErr = OsErr(48);
/// Broken pipe
pub const EPIPE: OsErr = OsErr(32);
/// No child processes
pub const ECHILD: OsErr = OsErr(10);
/// Bad message
pub const EBADMSG: OsErr = OsErr(74);
/// Bad font file format
pub const EBFONT: OsErr = OsErr(59);
/// Object is remote
pub const EREMOTE: OsErr = OsErr(66);
/// Too many references: cannot splice
pub const ETOOMANYREFS: OsErr = OsErr(109);
/// Machine is not on the network
pub const ENONET: OsErr = OsErr(64);
/// Exchange full
pub const EXFULL: OsErr = OsErr(54);
/// Directory not empty
pub const ENOTEMPTY: OsErr = OsErr(39);
/// Not a XENIX named type file
pub const ENOTNAM: OsErr = OsErr(118);
/// Key was rejected by service
pub const EKEYREJECTED: OsErr = OsErr(129);
/// No CSI structure available
pub const ENOCSI: OsErr = OsErr(50);
/// Address already in use
pub const EADDRINUSE: OsErr = OsErr(98);
/// Network dropped connection on reset
pub const ENETRESET: OsErr = OsErr(102);
/// Is a directory
pub const EISDIR: OsErr = OsErr(21);
/// Identifier removed
pub const EIDRM: OsErr = OsErr(43);
/// Socket operation on non-socket
pub const ENOTSOCK: OsErr = OsErr(88);
/// No route to host
pub const EHOSTUNREACH: OsErr = OsErr(113);
/// File descriptor in bad state
pub const EBADFD: OsErr = OsErr(77);
/// Level 3 halted
pub const EL3HLT: OsErr = OsErr(46);
/// Level 2 halted
pub const EL2HLT: OsErr = OsErr(51);
/// Required key not available
pub const ENOKEY: OsErr = OsErr(126);
/// Invalid argument
pub const EINVAL: OsErr = OsErr(22);
/// Cannot send after transport endpoint shutdown
pub const ESHUTDOWN: OsErr = OsErr(108);
/// No medium found
pub const ENOMEDIUM: OsErr = OsErr(123);
/// .lib section in a.out corrupted
pub const ELIBSCN: OsErr = OsErr(81);
/// No XENIX semaphores available
pub const ENAVAIL: OsErr = OsErr(119);
/// Value too large for defined data type
pub const EOVERFLOW: OsErr = OsErr(75);
/// Structure needs cleaning
pub const EUCLEAN: OsErr = OsErr(117);
/// Device or resource busy
pub const EBUSY: OsErr = OsErr(16);
/// Protocol error
pub const EPROTO: OsErr = OsErr(71);
/// No such device
pub const ENODEV: OsErr = OsErr(19);
/// Key has expired
pub const EKEYEXPIRED: OsErr = OsErr(127);
/// Read-only file system
pub const EROFS: OsErr = OsErr(30);
/// Can not access a needed shared library
pub const ELIBACC: OsErr = OsErr(79);
/// Memory page has hardware error
pub const EHWPOISON: OsErr = OsErr(133);
/// Argument list too long
pub const E2BIG: OsErr = OsErr(7);
/// Resource deadlock avoided
pub const EDEADLK: OsErr = OsErr(35);
/// Level 3 reset
pub const EL3RST: OsErr = OsErr(47);
/// Not a directory
pub const ENOTDIR: OsErr = OsErr(20);
/// Connection reset by peer
pub const ECONNRESET: OsErr = OsErr(104);
/// No such device or address
pub const ENXIO: OsErr = OsErr(6);
/// Invalid request code
pub const EBADRQC: OsErr = OsErr(56);
/// Device not a stream
pub const ENOSTR: OsErr = OsErr(60);
/// File name too long
pub const ENAMETOOLONG: OsErr = OsErr(36);
/// Socket type not supported
pub const ESOCKTNOSUPPORT: OsErr = OsErr(94);
/// Cannot exec a shared library directly
pub const ELIBEXEC: OsErr = OsErr(83);
/// RFS specific error
pub const EDOTDOT: OsErr = OsErr(73);
/// Cannot assign requested address
pub const EADDRNOTAVAIL: OsErr = OsErr(99);
/// Timer expired
pub const ETIME: OsErr = OsErr(62);
/// Protocol not supported
pub const EPROTONOSUPPORT: OsErr = OsErr(93);
/// State not recoverable
pub const ENOTRECOVERABLE: OsErr = OsErr(131);
/// Input/output error
pub const EIO: OsErr = OsErr(5);
/// Network is unreachable
pub const ENETUNREACH: OsErr = OsErr(101);
/// Invalid cross-device link
pub const EXDEV: OsErr = OsErr(18);
/// Disk quota exceeded
pub const EDQUOT: OsErr = OsErr(122);
/// Remote I/O error
pub const EREMOTEIO: OsErr = OsErr(121);
/// No space left on device
pub const ENOSPC: OsErr = OsErr(28);
/// Exec format error
pub const ENOEXEC: OsErr = OsErr(8);
/// Message too long
pub const EMSGSIZE: OsErr = OsErr(90);
/// Numerical argument out of domain
pub const EDOM: OsErr = OsErr(33);
/// File too large
pub const EFBIG: OsErr = OsErr(27);
/// No such process
pub const ESRCH: OsErr = OsErr(3);
/// Channel number out of range
pub const ECHRNG: OsErr = OsErr(44);
/// Host is down
pub const EHOSTDOWN: OsErr = OsErr(112);
/// No locks available
pub const ENOLCK: OsErr = OsErr(37);
/// Too many open files in system
pub const ENFILE: OsErr = OsErr(23);
/// Function not implemented
pub const ENOSYS: OsErr = OsErr(38);
/// Transport endpoint is not connected
pub const ENOTCONN: OsErr = OsErr(107);
/// Protocol family not supported
pub const EPFNOSUPPORT: OsErr = OsErr(96);
/// Alias for [EOPNOTSUPP](constant.EOPNOTSUPP.html)
pub const ENOTSUP: OsErr = EOPNOTSUPP;
/// Srmount error
pub const ESRMNT: OsErr = OsErr(69);
/// Alias for [EDEADLK](constant.EDEADLK.html)
pub const EDEADLOCK: OsErr = EDEADLK;
/// Software caused connection abort
pub const ECONNABORTED: OsErr = OsErr(103);
/// No anode
pub const ENOANO: OsErr = OsErr(55);
/// Transport endpoint is already connected
pub const EISCONN: OsErr = OsErr(106);
/// Too many users
pub const EUSERS: OsErr = OsErr(87);
/// Protocol not available
pub const ENOPROTOOPT: OsErr = OsErr(92);
/// Communication error on send
pub const ECOMM: OsErr = OsErr(70);
/// Too many open files
pub const EMFILE: OsErr = OsErr(24);
/// Operation not possible due to RF-kill
pub const ERFKILL: OsErr = OsErr(132);
/// No buffer space available
pub const ENOBUFS: OsErr = OsErr(105);
/// Bad address
pub const EFAULT: OsErr = OsErr(14);
/// Alias for [EAGAIN](constant.EAGAIN.html)
pub const EWOULDBLOCK: OsErr = EAGAIN;
/// Accessing a corrupted shared library
pub const ELIBBAD: OsErr = OsErr(80);
/// Streams pipe error
pub const ESTRPIPE: OsErr = OsErr(86);
/// Connection refused
pub const ECONNREFUSED: OsErr = OsErr(111);
/// Resource temporarily unavailable
pub const EAGAIN: OsErr = OsErr(11);
/// Attempting to link in too many shared libraries
pub const ELIBMAX: OsErr = OsErr(82);
/// File exists
pub const EEXIST: OsErr = OsErr(17);
/// Level 2 not synchronized
pub const EL2NSYNC: OsErr = OsErr(45);
/// No such file or directory
pub const ENOENT: OsErr = OsErr(2);
/// Package not installed
pub const ENOPKG: OsErr = OsErr(65);
/// Invalid slot
pub const EBADSLT: OsErr = OsErr(57);
/// Key has been revoked
pub const EKEYREVOKED: OsErr = OsErr(128);
/// Name not unique on network
pub const ENOTUNIQ: OsErr = OsErr(76);
/// Operation not supported
pub const EOPNOTSUPP: OsErr = OsErr(95);
/// Wrong medium type
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",
];