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