1#![allow(dead_code)]
2
3use crate::Errno;
6impl Errno {
7 pub const EJUSTRETURN: Self = Self(-2);
9 pub const ERESTART: Self = Self(-1);
11 pub const EPERM: Self = Self(1);
13 pub const ENOENT: Self = Self(2);
15 pub const ESRCH: Self = Self(3);
17 pub const EINTR: Self = Self(4);
19 pub const EIO: Self = Self(5);
21 pub const ENXIO: Self = Self(6);
23 pub const E2BIG: Self = Self(7);
25 pub const ENOEXEC: Self = Self(8);
27 pub const EBADF: Self = Self(9);
29 pub const ECHILD: Self = Self(10);
31 pub const EDEADLK: Self = Self(11);
33 pub const ENOMEM: Self = Self(12);
35 pub const EACCES: Self = Self(13);
37 pub const EFAULT: Self = Self(14);
39 pub const ENOTBLK: Self = Self(15);
41 pub const EBUSY: Self = Self(16);
43 pub const EEXIST: Self = Self(17);
45 pub const EXDEV: Self = Self(18);
47 pub const ENODEV: Self = Self(19);
49 pub const ENOTDIR: Self = Self(20);
51 pub const EISDIR: Self = Self(21);
53 pub const EINVAL: Self = Self(22);
55 pub const ENFILE: Self = Self(23);
57 pub const EMFILE: Self = Self(24);
59 pub const ENOTTY: Self = Self(25);
61 pub const ETXTBSY: Self = Self(26);
63 pub const EFBIG: Self = Self(27);
65 pub const ENOSPC: Self = Self(28);
67 pub const ESPIPE: Self = Self(29);
69 pub const EROFS: Self = Self(30);
71 pub const EMLINK: Self = Self(31);
73 pub const EPIPE: Self = Self(32);
75 pub const EDOM: Self = Self(33);
77 pub const ERANGE: Self = Self(34);
79 pub const EAGAIN: Self = Self(35);
81 pub const EINPROGRESS: Self = Self(36);
83 pub const EALREADY: Self = Self(37);
85 pub const ENOTSOCK: Self = Self(38);
87 pub const EDESTADDRREQ: Self = Self(39);
89 pub const EMSGSIZE: Self = Self(40);
91 pub const EPROTOTYPE: Self = Self(41);
93 pub const ENOPROTOOPT: Self = Self(42);
95 pub const EPROTONOSUPPORT: Self = Self(43);
97 pub const ESOCKTNOSUPPORT: Self = Self(44);
99 pub const EOPNOTSUPP: Self = Self(45);
101 pub const EPFNOSUPPORT: Self = Self(46);
103 pub const EAFNOSUPPORT: Self = Self(47);
105 pub const EADDRINUSE: Self = Self(48);
107 pub const EADDRNOTAVAIL: Self = Self(49);
109 pub const ENETDOWN: Self = Self(50);
111 pub const ENETUNREACH: Self = Self(51);
113 pub const ENETRESET: Self = Self(52);
115 pub const ECONNABORTED: Self = Self(53);
117 pub const ECONNRESET: Self = Self(54);
119 pub const ENOBUFS: Self = Self(55);
121 pub const EISCONN: Self = Self(56);
123 pub const ENOTCONN: Self = Self(57);
125 pub const ESHUTDOWN: Self = Self(58);
127 pub const ETOOMANYREFS: Self = Self(59);
129 pub const ETIMEDOUT: Self = Self(60);
131 pub const ECONNREFUSED: Self = Self(61);
133 pub const ELOOP: Self = Self(62);
135 pub const ENAMETOOLONG: Self = Self(63);
137 pub const EHOSTDOWN: Self = Self(64);
139 pub const EHOSTUNREACH: Self = Self(65);
141 pub const ENOTEMPTY: Self = Self(66);
143 pub const EPROCLIM: Self = Self(67);
145 pub const EUSERS: Self = Self(68);
147 pub const EDQUOT: Self = Self(69);
149 pub const ESTALE: Self = Self(70);
151 pub const EREMOTE: Self = Self(71);
153 pub const EBADRPC: Self = Self(72);
155 pub const ERPCMISMATCH: Self = Self(73);
157 pub const EPROGUNAVAIL: Self = Self(74);
159 pub const EPROGMISMATCH: Self = Self(75);
161 pub const EPROCUNAVAIL: Self = Self(76);
163 pub const ENOLCK: Self = Self(77);
165 pub const ENOSYS: Self = Self(78);
167 pub const EFTYPE: Self = Self(79);
169 pub const EAUTH: Self = Self(80);
171 pub const ENEEDAUTH: Self = Self(81);
173 pub const EIPSEC: Self = Self(82);
175 pub const ENOATTR: Self = Self(83);
177 pub const EILSEQ: Self = Self(84);
179 pub const ENOMEDIUM: Self = Self(85);
181 pub const EMEDIUMTYPE: Self = Self(86);
183 pub const EOVERFLOW: Self = Self(87);
185 pub const ECANCELED: Self = Self(88);
187 pub const EIDRM: Self = Self(89);
189 pub const ENOMSG: Self = Self(90);
191 pub const ENOTSUP: Self = Self(91);
193 pub const EBADMSG: Self = Self(92);
195 pub const ENOTRECOVERABLE: Self = Self(93);
197 pub const EOWNERDEAD: Self = Self(94);
199 pub const EPROTO: Self = Self(95);
201 pub const EWOULDBLOCK: Self = Self::EAGAIN;
203
204 pub const MIN: i32 = -2;
205 pub const MAX: i32 = 95;
206
207 #[cfg(feature = "iter")]
208 pub(crate) const ALL: [i32; 97] = [
209 -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
210 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
211 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
212 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
213 93, 94, 95,
214 ];
215
216 pub(crate) fn name_and_description(&self) -> Option<(&'static str, &'static str)> {
217 match self.0 {
218 -2 => Some(("EJUSTRETURN", "don't modify regs, just return")),
219 -1 => Some(("ERESTART", "restart syscall")),
220 1 => Some(("EPERM", "Operation not permitted")),
221 2 => Some(("ENOENT", "No such file or directory")),
222 3 => Some(("ESRCH", "No such process")),
223 4 => Some(("EINTR", "Interrupted system call")),
224 5 => Some(("EIO", "Input/output error")),
225 6 => Some(("ENXIO", "Device not configured")),
226 7 => Some(("E2BIG", "Argument list too long")),
227 8 => Some(("ENOEXEC", "Exec format error")),
228 9 => Some(("EBADF", "Bad file descriptor")),
229 10 => Some(("ECHILD", "No child processes")),
230 11 => Some(("EDEADLK", "Resource deadlock avoided")),
231 12 => Some(("ENOMEM", "Cannot allocate memory")),
232 13 => Some(("EACCES", "Permission denied")),
233 14 => Some(("EFAULT", "Bad address")),
234 15 => Some(("ENOTBLK", "Block device required")),
235 16 => Some(("EBUSY", "Device busy")),
236 17 => Some(("EEXIST", "File exists")),
237 18 => Some(("EXDEV", "Cross-device link")),
238 19 => Some(("ENODEV", "Operation not supported by device")),
239 20 => Some(("ENOTDIR", "Not a directory")),
240 21 => Some(("EISDIR", "Is a directory")),
241 22 => Some(("EINVAL", "Invalid argument")),
242 23 => Some(("ENFILE", "Too many open files in system")),
243 24 => Some(("EMFILE", "Too many open files")),
244 25 => Some(("ENOTTY", "Inappropriate ioctl for device")),
245 26 => Some(("ETXTBSY", "Text file busy")),
246 27 => Some(("EFBIG", "File too large")),
247 28 => Some(("ENOSPC", "No space left on device")),
248 29 => Some(("ESPIPE", "Illegal seek")),
249 30 => Some(("EROFS", "Read-only file system")),
250 31 => Some(("EMLINK", "Too many links")),
251 32 => Some(("EPIPE", "Broken pipe")),
252 33 => Some(("EDOM", "Numerical argument out of domain")),
253 34 => Some(("ERANGE", "Result too large")),
254 35 => Some(("EAGAIN", "Resource temporarily unavailable")),
255 36 => Some(("EINPROGRESS", "Operation now in progress")),
256 37 => Some(("EALREADY", "Operation already in progress")),
257 38 => Some(("ENOTSOCK", "Socket operation on non-socket")),
258 39 => Some(("EDESTADDRREQ", "Destination address required")),
259 40 => Some(("EMSGSIZE", "Message too long")),
260 41 => Some(("EPROTOTYPE", "Protocol wrong type for socket")),
261 42 => Some(("ENOPROTOOPT", "Protocol not available")),
262 43 => Some(("EPROTONOSUPPORT", "Protocol not supported")),
263 44 => Some(("ESOCKTNOSUPPORT", "Socket type not supported")),
264 45 => Some(("EOPNOTSUPP", "Operation not supported")),
265 46 => Some(("EPFNOSUPPORT", "Protocol family not supported")),
266 47 => Some((
267 "EAFNOSUPPORT",
268 "Address family not supported by protocol family",
269 )),
270 48 => Some(("EADDRINUSE", "Address already in use")),
271 49 => Some(("EADDRNOTAVAIL", "Can't assign requested address")),
272 50 => Some(("ENETDOWN", "Network is down")),
273 51 => Some(("ENETUNREACH", "Network is unreachable")),
274 52 => Some(("ENETRESET", "Network dropped connection on reset")),
275 53 => Some(("ECONNABORTED", "Software caused connection abort")),
276 54 => Some(("ECONNRESET", "Connection reset by peer")),
277 55 => Some(("ENOBUFS", "No buffer space available")),
278 56 => Some(("EISCONN", "Socket is already connected")),
279 57 => Some(("ENOTCONN", "Socket is not connected")),
280 58 => Some(("ESHUTDOWN", "Can't send after socket shutdown")),
281 59 => Some(("ETOOMANYREFS", "Too many references: can't splice")),
282 60 => Some(("ETIMEDOUT", "Operation timed out")),
283 61 => Some(("ECONNREFUSED", "Connection refused")),
284 62 => Some(("ELOOP", "Too many levels of symbolic links")),
285 63 => Some(("ENAMETOOLONG", "File name too long")),
286 64 => Some(("EHOSTDOWN", "Host is down")),
287 65 => Some(("EHOSTUNREACH", "No route to host")),
288 66 => Some(("ENOTEMPTY", "Directory not empty")),
289 67 => Some(("EPROCLIM", "Too many processes")),
290 68 => Some(("EUSERS", "Too many users")),
291 69 => Some(("EDQUOT", "Disk quota exceeded")),
292 70 => Some(("ESTALE", "Stale NFS file handle")),
293 71 => Some(("EREMOTE", "Too many levels of remote in path")),
294 72 => Some(("EBADRPC", "RPC struct is bad")),
295 73 => Some(("ERPCMISMATCH", "RPC version wrong")),
296 74 => Some(("EPROGUNAVAIL", "RPC program not available")),
297 75 => Some(("EPROGMISMATCH", "Program version wrong")),
298 76 => Some(("EPROCUNAVAIL", "Bad procedure for program")),
299 77 => Some(("ENOLCK", "No locks available")),
300 78 => Some(("ENOSYS", "Function not implemented")),
301 79 => Some(("EFTYPE", "Inappropriate file type or format")),
302 80 => Some(("EAUTH", "Authentication error")),
303 81 => Some(("ENEEDAUTH", "Need authenticator")),
304 82 => Some(("EIPSEC", "IPsec processing failure")),
305 83 => Some(("ENOATTR", "Attribute not found")),
306 84 => Some(("EILSEQ", "Illegal byte sequence")),
307 85 => Some(("ENOMEDIUM", "No medium found")),
308 86 => Some(("EMEDIUMTYPE", "Wrong medium type")),
309 87 => Some(("EOVERFLOW", "Value too large to be stored in data type")),
310 88 => Some(("ECANCELED", "Operation canceled")),
311 89 => Some(("EIDRM", "Identifier removed")),
312 90 => Some(("ENOMSG", "No message of desired type")),
313 91 => Some(("ENOTSUP", "Not supported")),
314 92 => Some(("EBADMSG", "Bad message")),
315 93 => Some(("ENOTRECOVERABLE", "State not recoverable")),
316 94 => Some(("EOWNERDEAD", "Previous owner died")),
317 95 => Some(("EPROTO", "Protocol error")),
318 _ => None,
319 }
320 }
321}