posix_errno/posix-errno.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//! This library defines a single type, the [Error] enum, which represents the
17//! symbolic constants for error numbers defined in the POSIX standard.
18
19#![no_std]
20
21/// Symbolic constants for error numbers defined in the POSIX standard.
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[non_exhaustive]
24pub enum Error {
25 /// Argument list too long.
26 E2BIG,
27 /// Permission denied.
28 EACCES,
29 /// Address in use.
30 EADDRINUSE,
31 /// Address not available.
32 EADDRNOTAVAIL,
33 /// Address family not supported.
34 EAFNOSUPPORT,
35 /// Resource unavailable, try again.
36 EAGAIN,
37 /// Connection already in progress.
38 EALREADY,
39 /// Bad file descriptor.
40 EBADF,
41 /// Bad message.
42 EBADMSG,
43 /// Device or resource busy.
44 EBUSY,
45 /// Operation canceled.
46 ECANCELED,
47 /// No child processes.
48 ECHILD,
49 /// Connection aborted.
50 ECONNABORTED,
51 /// Connection refused.
52 ECONNREFUSED,
53 /// Connection reset.
54 ECONNRESET,
55 /// Resource deadlock would occur.
56 EDEADLK,
57 /// Destination address required.
58 EDESTADDRREQ,
59 /// Mathematics argument out of domain of function.
60 EDOM,
61 /// Reserved.
62 EDQUOT,
63 /// File exists.
64 EEXIST,
65 /// Bad address.
66 EFAULT,
67 /// File too large.
68 EFBIG,
69 /// Host is unreachable.
70 EHOSTUNREACH,
71 /// Identifier removed.
72 EIDRM,
73 /// Illegal byte sequence.
74 EILSEQ,
75 /// Operation in progress.
76 EINPROGRESS,
77 /// Interrupted function.
78 EINTR,
79 /// Invalid argument.
80 EINVAL,
81 /// I/O error.
82 EIO,
83 /// Socket is connected.
84 EISCONN,
85 /// Is a directory.
86 EISDIR,
87 /// Too many levels of symbolic links.
88 ELOOP,
89 /// File descriptor value too large.
90 EMFILE,
91 /// Too many links.
92 EMLINK,
93 /// Message too large.
94 EMSGSIZE,
95 /// Reserved.
96 EMULTIHOP,
97 /// Filename too long.
98 ENAMETOOLONG,
99 /// Network is down.
100 ENETDOWN,
101 /// Connection aborted by network.
102 ENETRESET,
103 /// Network unreachable.
104 ENETUNREACH,
105 /// Too many files open in system.
106 ENFILE,
107 /// No buffer space available.
108 ENOBUFS,
109 /// No message is available on the STREAM head read queue.
110 ENODATA,
111 /// No such device.
112 ENODEV,
113 /// No such file or directory.
114 ENOENT,
115 /// Executable file format error.
116 ENOEXEC,
117 /// No locks available.
118 ENOLCK,
119 /// Reserved.
120 ENOLINK,
121 /// Not enough space.
122 ENOMEM,
123 /// No message of the desired type.
124 ENOMSG,
125 /// Protocol not available.
126 ENOPROTOOPT,
127 /// No space left on device.
128 ENOSPC,
129 /// No STREAM resources.
130 ENOSR,
131 /// Not a STREAM.
132 ENOSTR,
133 /// Functionality not supported.
134 ENOSYS,
135 /// The socket is not connected.
136 ENOTCONN,
137 /// Not a directory or a symbolic link to a directory.
138 ENOTDIR,
139 /// Directory not empty.
140 ENOTEMPTY,
141 /// State not recoverable.
142 ENOTRECOVERABLE,
143 /// Not a socket.
144 ENOTSOCK,
145 /// Not supported.
146 ENOTSUP,
147 /// Inappropriate I/O control operation.
148 ENOTTY,
149 /// No such device or address.
150 ENXIO,
151 /// Operation not supported on socket.
152 EOPNOTSUPP,
153 /// Value too large to be stored in data type.
154 EOVERFLOW,
155 /// Previous owner died.
156 EOWNERDEAD,
157 /// Operation not permitted.
158 EPERM,
159 /// Broken pipe.
160 EPIPE,
161 /// Protocol error.
162 EPROTO,
163 /// Protocol not supported.
164 EPROTONOSUPPORT,
165 /// Protocol wrong type for socket.
166 EPROTOTYPE,
167 /// Result too large.
168 ERANGE,
169 /// Read-only file system.
170 EROFS,
171 /// Invalid seek.
172 ESPIPE,
173 /// No such process.
174 ESRCH,
175 /// Reserved.
176 ESTALE,
177 /// Stream ioctl() timeout.
178 ETIME,
179 /// Connection timed out.
180 ETIMEDOUT,
181 /// Text file busy.
182 ETXTBSY,
183 /// Operation would block.
184 EWOULDBLOCK,
185 /// Cross-device link.
186 EXDEV,
187}