hermit_abi/
errno.rs

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