linux_errno/linux-errno_generic.rs
1// Copyright (c) 2022 John Millikin <john@john-millikin.com>
2//
3// Permission to use, copy, modify, and/or distribute this software for any
4// purpose with or without fee is hereby granted.
5//
6// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12// PERFORMANCE OF THIS SOFTWARE.
13//
14// SPDX-License-Identifier: 0BSD
15
16#![allow(unused)]
17
18errno_constants! {
19 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/errno-base.h?h=v5.19
20
21 /// Operation not permitted
22 EPERM = 1,
23 /// No such file or directory
24 ENOENT = 2,
25 /// No such process
26 ESRCH = 3,
27 /// Interrupted system call
28 EINTR = 4,
29 /// I/O error
30 EIO = 5,
31 /// No such device or address
32 ENXIO = 6,
33 /// Argument list too long
34 E2BIG = 7,
35 /// Exec format error
36 ENOEXEC = 8,
37 /// Bad file number
38 EBADF = 9,
39
40 /// No child processes
41 ECHILD = 10,
42 /// Try again
43 EAGAIN = 11,
44 /// Out of memory
45 ENOMEM = 12,
46 /// Permission denied
47 EACCES = 13,
48 /// Bad address
49 EFAULT = 14,
50 /// Block device required
51 ENOTBLK = 15,
52 /// Device or resource busy
53 EBUSY = 16,
54 /// File exists
55 EEXIST = 17,
56 /// Cross-device link
57 EXDEV = 18,
58 /// No such device
59 ENODEV = 19,
60
61 /// Not a directory
62 ENOTDIR = 20,
63 /// Is a directory
64 EISDIR = 21,
65 /// Invalid argument
66 EINVAL = 22,
67 /// File table overflow
68 ENFILE = 23,
69 /// Too many open files
70 EMFILE = 24,
71 /// Not a typewriter
72 ENOTTY = 25,
73 /// Text file busy
74 ETXTBSY = 26,
75 /// File too large
76 EFBIG = 27,
77 /// No space left on device
78 ENOSPC = 28,
79 /// Illegal seek
80 ESPIPE = 29,
81
82 /// Read-only file system
83 EROFS = 30,
84 /// Too many links
85 EMLINK = 31,
86 /// Broken pipe
87 EPIPE = 32,
88 /// Math argument out of domain of func
89 EDOM = 33,
90 /// Math result not representable
91 ERANGE = 34,
92
93 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/errno.h?h=v5.19
94
95 /// Resource deadlock would occur
96 EDEADLK = 35,
97 /// File name too long
98 ENAMETOOLONG = 36,
99 /// No record locks available
100 ENOLCK = 37,
101 /// Invalid system call number
102 ENOSYS = 38,
103 /// Directory not empty
104 ENOTEMPTY = 39,
105
106 /// Too many symbolic links encountered
107 ELOOP = 40,
108 /// No message of desired type
109 ENOMSG = 42,
110 /// Identifier removed
111 EIDRM = 43,
112 /// Channel number out of range
113 ECHRNG = 44,
114 /// Level 2 not synchronized
115 EL2NSYNC = 45,
116 /// Level 3 halted
117 EL3HLT = 46,
118 /// Level 3 reset
119 EL3RST = 47,
120 /// Link number out of range
121 ELNRNG = 48,
122 /// Protocol driver not attached
123 EUNATCH = 49,
124
125 /// No CSI structure available
126 ENOCSI = 50,
127 /// Level 2 halted
128 EL2HLT = 51,
129 /// Invalid exchange
130 EBADE = 52,
131 /// Invalid request descriptor
132 EBADR = 53,
133 /// Exchange full
134 EXFULL = 54,
135 /// No anode
136 ENOANO = 55,
137 /// Invalid request code
138 EBADRQC = 56,
139 /// Invalid slot
140 EBADSLT = 57,
141 /// Bad font file format
142 EBFONT = 59,
143
144 /// Device not a stream
145 ENOSTR = 60,
146 /// No data available
147 ENODATA = 61,
148 /// Timer expired
149 ETIME = 62,
150 /// Out of streams resources
151 ENOSR = 63,
152 /// Machine is not on the network
153 ENONET = 64,
154 /// Package not installed
155 ENOPKG = 65,
156 /// Object is remote
157 EREMOTE = 66,
158 /// Link has been severed
159 ENOLINK = 67,
160 /// Advertise error
161 EADV = 68,
162 /// Srmount error
163 ESRMNT = 69,
164
165 /// Communication error on send
166 ECOMM = 70,
167 /// Protocol error
168 EPROTO = 71,
169 /// Multihop attempted
170 EMULTIHOP = 72,
171 /// RFS specific error
172 EDOTDOT = 73,
173 /// Not a data message
174 EBADMSG = 74,
175 /// Value too large for defined data type
176 EOVERFLOW = 75,
177 /// Name not unique on network
178 ENOTUNIQ = 76,
179 /// File descriptor in bad state
180 EBADFD = 77,
181 /// Remote address changed
182 EREMCHG = 78,
183 /// Can not access a needed shared library
184 ELIBACC = 79,
185
186 /// Accessing a corrupted shared library
187 ELIBBAD = 80,
188 /// .lib section in a.out corrupted
189 ELIBSCN = 81,
190 /// Attempting to link in too many shared libraries
191 ELIBMAX = 82,
192 /// Cannot exec a shared library directly
193 ELIBEXEC = 83,
194 /// Illegal byte sequence
195 EILSEQ = 84,
196 /// Interrupted system call should be restarted
197 ERESTART = 85,
198 /// Streams pipe error
199 ESTRPIPE = 86,
200 /// Too many users
201 EUSERS = 87,
202 /// Socket operation on non-socket
203 ENOTSOCK = 88,
204 /// Destination address required
205 EDESTADDRREQ = 89,
206
207 /// Message too long
208 EMSGSIZE = 90,
209 /// Protocol wrong type for socket
210 EPROTOTYPE = 91,
211 /// Protocol not available
212 ENOPROTOOPT = 92,
213 /// Protocol not supported
214 EPROTONOSUPPORT = 93,
215 /// Socket type not supported
216 ESOCKTNOSUPPORT = 94,
217 /// Operation not supported on transport endpoint
218 EOPNOTSUPP = 95,
219 /// Protocol family not supported
220 EPFNOSUPPORT = 96,
221 /// Address family not supported by protocol
222 EAFNOSUPPORT = 97,
223 /// Address already in use
224 EADDRINUSE = 98,
225 /// Cannot assign requested address
226 EADDRNOTAVAIL = 99,
227
228 /// Network is down
229 ENETDOWN = 100,
230 /// Network is unreachable
231 ENETUNREACH = 101,
232 /// Network dropped connection because of reset
233 ENETRESET = 102,
234 /// Software caused connection abort
235 ECONNABORTED = 103,
236 /// Connection reset by peer
237 ECONNRESET = 104,
238 /// No buffer space available
239 ENOBUFS = 105,
240 /// Transport endpoint is already connected
241 EISCONN = 106,
242 /// Transport endpoint is not connected
243 ENOTCONN = 107,
244 /// Cannot send after transport endpoint shutdown
245 ESHUTDOWN = 108,
246 /// Too many references: cannot splice
247 ETOOMANYREFS = 109,
248
249 /// Connection timed out
250 ETIMEDOUT = 110,
251 /// Connection refused
252 ECONNREFUSED = 111,
253 /// Host is down
254 EHOSTDOWN = 112,
255 /// No route to host
256 EHOSTUNREACH = 113,
257 /// Operation already in progress
258 EALREADY = 114,
259 /// Operation now in progress
260 EINPROGRESS = 115,
261 /// Stale file handle
262 ESTALE = 116,
263 /// Structure needs cleaning
264 EUCLEAN = 117,
265 /// Not a XENIX named type file
266 ENOTNAM = 118,
267 /// No XENIX semaphores available
268 ENAVAIL = 119,
269
270 /// Is a named type file
271 EISNAM = 120,
272 /// Remote I/O error
273 EREMOTEIO = 121,
274 /// Quota exceeded
275 EDQUOT = 122,
276 /// No medium found
277 ENOMEDIUM = 123,
278 /// Wrong medium type
279 EMEDIUMTYPE = 124,
280 /// Operation Canceled
281 ECANCELED = 125,
282 /// Required key not available
283 ENOKEY = 126,
284 /// Key has expired
285 EKEYEXPIRED = 127,
286 /// Key has been revoked
287 EKEYREVOKED = 128,
288 /// Key was rejected by service
289 EKEYREJECTED = 129,
290
291 /// Owner died
292 EOWNERDEAD = 130,
293 /// State not recoverable
294 ENOTRECOVERABLE = 131,
295 /// Operation not possible due to RF-kill
296 ERFKILL = 132,
297 /// Memory page has hardware error
298 EHWPOISON = 133,
299}
300
301/// Alias for [EDEADLK]
302pub const EDEADLOCK: crate::Error = EDEADLK;
303
304/// Operation would block (alias for [EAGAIN])
305pub const EWOULDBLOCK: crate::Error = EAGAIN;