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
// Copyright (c) 2022 John Millikin <john@john-millikin.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
//
// SPDX-License-Identifier: 0BSD

//! This library defines a single type, the [Error] enum, which represents the
//! symbolic constants for error numbers defined in the POSIX standard.

#![no_std]

/// Symbolic constants for error numbers defined in the POSIX standard.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[non_exhaustive]
pub enum Error {
	/// Argument list too long.
	E2BIG,
	/// Permission denied.
	EACCES,
	/// Address in use.
	EADDRINUSE,
	/// Address not available.
	EADDRNOTAVAIL,
	/// Address family not supported.
	EAFNOSUPPORT,
	/// Resource unavailable, try again.
	EAGAIN,
	/// Connection already in progress.
	EALREADY,
	/// Bad file descriptor.
	EBADF,
	/// Bad message.
	EBADMSG,
	/// Device or resource busy.
	EBUSY,
	/// Operation canceled.
	ECANCELED,
	/// No child processes.
	ECHILD,
	/// Connection aborted.
	ECONNABORTED,
	/// Connection refused.
	ECONNREFUSED,
	/// Connection reset.
	ECONNRESET,
	/// Resource deadlock would occur.
	EDEADLK,
	/// Destination address required.
	EDESTADDRREQ,
	/// Mathematics argument out of domain of function.
	EDOM,
	/// Reserved.
	EDQUOT,
	/// File exists.
	EEXIST,
	/// Bad address.
	EFAULT,
	/// File too large.
	EFBIG,
	/// Host is unreachable.
	EHOSTUNREACH,
	/// Identifier removed.
	EIDRM,
	/// Illegal byte sequence.
	EILSEQ,
	/// Operation in progress.
	EINPROGRESS,
	/// Interrupted function.
	EINTR,
	/// Invalid argument.
	EINVAL,
	/// I/O error.
	EIO,
	/// Socket is connected.
	EISCONN,
	/// Is a directory.
	EISDIR,
	/// Too many levels of symbolic links.
	ELOOP,
	/// File descriptor value too large.
	EMFILE,
	/// Too many links.
	EMLINK,
	/// Message too large.
	EMSGSIZE,
	/// Reserved.
	EMULTIHOP,
	/// Filename too long.
	ENAMETOOLONG,
	/// Network is down.
	ENETDOWN,
	/// Connection aborted by network.
	ENETRESET,
	/// Network unreachable.
	ENETUNREACH,
	/// Too many files open in system.
	ENFILE,
	/// No buffer space available.
	ENOBUFS,
	/// No message is available on the STREAM head read queue.
	ENODATA,
	/// No such device.
	ENODEV,
	/// No such file or directory.
	ENOENT,
	/// Executable file format error.
	ENOEXEC,
	/// No locks available.
	ENOLCK,
	/// Reserved.
	ENOLINK,
	/// Not enough space.
	ENOMEM,
	/// No message of the desired type.
	ENOMSG,
	/// Protocol not available.
	ENOPROTOOPT,
	/// No space left on device.
	ENOSPC,
	/// No STREAM resources.
	ENOSR,
	/// Not a STREAM.
	ENOSTR,
	/// Functionality not supported.
	ENOSYS,
	/// The socket is not connected.
	ENOTCONN,
	/// Not a directory or a symbolic link to a directory.
	ENOTDIR,
	/// Directory not empty.
	ENOTEMPTY,
	/// State not recoverable.
	ENOTRECOVERABLE,
	/// Not a socket.
	ENOTSOCK,
	/// Not supported.
	ENOTSUP,
	/// Inappropriate I/O control operation.
	ENOTTY,
	/// No such device or address.
	ENXIO,
	/// Operation not supported on socket.
	EOPNOTSUPP,
	/// Value too large to be stored in data type.
	EOVERFLOW,
	/// Previous owner died.
	EOWNERDEAD,
	/// Operation not permitted.
	EPERM,
	/// Broken pipe.
	EPIPE,
	/// Protocol error.
	EPROTO,
	/// Protocol not supported.
	EPROTONOSUPPORT,
	/// Protocol wrong type for socket.
	EPROTOTYPE,
	/// Result too large.
	ERANGE,
	/// Read-only file system.
	EROFS,
	/// Invalid seek.
	ESPIPE,
	/// No such process.
	ESRCH,
	/// Reserved.
	ESTALE,
	/// Stream ioctl() timeout.
	ETIME,
	/// Connection timed out.
	ETIMEDOUT,
	/// Text file busy.
	ETXTBSY,
	/// Operation would block.
	EWOULDBLOCK,
	/// Cross-device link.
	EXDEV,
}