• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Apache NuttX
3  * Copyright 2020 The Apache Software Foundation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 #ifndef __INCLUDE_ERRNO_H
8 #define __INCLUDE_ERRNO_H
9 
10 /****************************************************************************
11  * Included Files
12  ****************************************************************************/
13 
14 /****************************************************************************
15  * Pre-processor Definitions
16  ****************************************************************************/
17 
18 /* Convenience/compatibility definition.  If the errno is accessed from the
19  * internal OS code, then the OS code should use the set_errno() and
20  * get_errno().  Currently, those are just placeholders but would be needed
21  * in the KERNEL mode build in order to instantiate the process address
22  * environment as necessary to access the TLS-based errno variable.
23  */
24 
25 /* Definitions of error numbers and the string that would be
26  * returned by strerror().
27  */
28 #ifndef CONFIG_USB_ERROR_USE_SYSTEM
29 
30 #define EPERM               1
31 #define EPERM_STR           "Operation not permitted"
32 #define ENOENT              2
33 #define ENOENT_STR          "No such file or directory"
34 #define ESRCH               3
35 #define ESRCH_STR           "No such process"
36 #define EINTR               4
37 #define EINTR_STR           "Interrupted system call"
38 #define EIO                 5
39 #define EIO_STR             "I/O error"
40 #define ENXIO               6
41 #define ENXIO_STR           "No such device or address"
42 #define E2BIG               7
43 #define E2BIG_STR           "Arg list too long"
44 #define ENOEXEC             8
45 #define ENOEXEC_STR         "Exec format error"
46 #define EBADF               9
47 #define EBADF_STR           "Bad file number"
48 #define ECHILD              10
49 #define ECHILD_STR          "No child processes"
50 #define EAGAIN              11
51 #define EWOULDBLOCK         EAGAIN
52 #define EAGAIN_STR          "Try again"
53 #define ENOMEM              12
54 #define ENOMEM_STR          "Out of memory"
55 #define EACCES              13
56 #define EACCES_STR          "Permission denied"
57 #define EFAULT              14                         /* Linux errno extension */
58 #define EFAULT_STR          "Bad address"
59 #define ENOTBLK             15
60 #define ENOTBLK_STR         "Block device required"
61 #define EBUSY               16
62 #define EBUSY_STR           "Device or resource busy"
63 #define EEXIST              17
64 #define EEXIST_STR          "File exists"
65 #define EXDEV               18
66 #define EXDEV_STR           "Cross-device link"
67 #define ENODEV              19
68 #define ENODEV_STR          "No such device"
69 #define ENOTDIR             20
70 #define ENOTDIR_STR         "Not a directory"
71 #define EISDIR              21
72 #define EISDIR_STR          "Is a directory"
73 #define EINVAL              22
74 #define EINVAL_STR          "Invalid argument"
75 #define ENFILE              23
76 #define ENFILE_STR          "File table overflow"
77 #define EMFILE              24
78 #define EMFILE_STR          "Too many open files"
79 #define ENOTTY              25
80 #define ENOTTY_STR          "Not a typewriter"
81 #define ETXTBSY             26
82 #define ETXTBSY_STR         "Text file busy"
83 #define EFBIG               27
84 #define EFBIG_STR           "File too large"
85 #define ENOSPC              28
86 #define ENOSPC_STR          "No space left on device"
87 #define ESPIPE              29
88 #define ESPIPE_STR          "Illegal seek"
89 #define EROFS               30
90 #define EROFS_STR           "Read-only file system"
91 #define EMLINK              31
92 #define EMLINK_STR          "Too many links"
93 #define EPIPE               32
94 #define EPIPE_STR           "Broken pipe"
95 #define EDOM                33
96 #define EDOM_STR            "Math argument out of domain of func"
97 #define ERANGE              34
98 #define ERANGE_STR          "Math result not representable"
99 #define ENOMSG              35
100 #define ENOMSG_STR          "No message of desired type"
101 #define EIDRM               36
102 #define EIDRM_STR           "Identifier removed"
103 #define ECHRNG              37                         /* Linux errno extension */
104 #define ECHRNG_STR          "Channel number out of range"
105 #define EL2NSYNC            38                         /* Linux errno extension */
106 #define EL2NSYNC_STR        "Level 2 not synchronized"
107 #define EL3HLT              39                         /* Linux errno extension */
108 #define EL3HLT_STR          "Level 3 halted"
109 #define EL3RST              40                         /* Linux errno extension */
110 #define EL3RST_STR          "Level 3 reset"
111 #define ELNRNG              41                         /* Linux errno extension */
112 #define ELNRNG_STR          "Link number out of range"
113 #define EUNATCH             42                         /* Linux errno extension */
114 #define EUNATCH_STR         "Protocol driver not attached"
115 #define ENOCSI              43                         /* Linux errno extension */
116 #define ENOCSI_STR          "No CSI structure available"
117 #define EL2HLT              44                         /* Linux errno extension */
118 #define EL2HLT_STR          "Level 2 halted"
119 #define EDEADLK             45
120 #define EDEADLK_STR         "Resource deadlock would occur"
121 #define ENOLCK              46
122 #define ENOLCK_STR          "No record locks available"
123 
124 #define EBADE               50                         /* Linux errno extension */
125 #define EBADE_STR           "Invalid exchange"
126 #define EBADR               51                         /* Linux errno extension */
127 #define EBADR_STR           "Invalid request descriptor"
128 #define EXFULL              52                         /* Linux errno extension */
129 #define EXFULL_STR          "Exchange full"
130 #define ENOANO              53                         /* Linux errno extension */
131 #define ENOANO_STR          "No anode"
132 #define EBADRQC             54                         /* Linux errno extension */
133 #define EBADRQC_STR         "Invalid request code"
134 #define EBADSLT             55                         /* Linux errno extension */
135 #define EBADSLT_STR         "Invalid slot"
136 #define EDEADLOCK           56                         /* Linux errno extension */
137 #define EDEADLOCK_STR       "File locking deadlock error"
138 #define EBFONT              57                         /* Linux errno extension */
139 #define EBFONT_STR          "Bad font file format"
140 
141 #define ENOSTR              60
142 #define ENOSTR_STR          "Device not a stream"
143 #define ENODATA             61
144 #define ENODATA_STR         "No data available"
145 #define ETIME               62
146 #define ETIME_STR           "Timer expired"
147 #define ENOSR               63
148 #define ENOSR_STR           "Out of streams resources"
149 #define ENONET              64                         /* Linux errno extension */
150 #define ENONET_STR          "Machine is not on the network"
151 #define ENOPKG              65                         /* Linux errno extension */
152 #define ENOPKG_STR          "Package not installed"
153 #define EREMOTE             66                         /* Linux errno extension */
154 #define EREMOTE_STR         "Object is remote"
155 #define ENOLINK             67
156 #define ENOLINK_STR         "Link has been severed"
157 #define EADV                68                         /* Linux errno extension */
158 #define EADV_STR            "Advertise error"
159 #define ESRMNT              69                         /* Linux errno extension */
160 #define ESRMNT_STR          "Srmount error"
161 #define ECOMM               70                         /* Linux errno extension */
162 #define ECOMM_STR           "Communication error on send"
163 #define EPROTO              71
164 #define EPROTO_STR          "Protocol error"
165 
166 #define EMULTIHOP           74
167 #define EMULTIHOP_STR       "Multihop attempted"
168 #define ELBIN               75                         /* Linux errno extension */
169 #define ELBIN_STR           "Inode is remote"
170 #define EDOTDOT             76                         /* Linux errno extension */
171 #define EDOTDOT_STR         "RFS specific error"
172 #define EBADMSG             77
173 #define EBADMSG_STR         "Not a data message"
174 
175 #define EFTYPE              79
176 #define EFTYPE_STR          "Inappropriate file type or format"
177 #define ENOTUNIQ            80                         /* Linux errno extension */
178 #define ENOTUNIQ_STR        "Name not unique on network"
179 #define EBADFD              81                         /* Linux errno extension */
180 #define EBADFD_STR          "File descriptor in bad state"
181 #define EREMCHG             82                         /* Linux errno extension */
182 #define EREMCHG_STR         "Remote address changed"
183 #define ELIBACC             83                         /* Linux errno extension */
184 #define ELIBACC_STR         "Can not access a needed shared library"
185 #define ELIBBAD             84                         /* Linux errno extension */
186 #define ELIBBAD_STR         "Accessing a corrupted shared library"
187 #define ELIBSCN             85                         /* Linux errno extension */
188 #define ELIBSCN_STR         ".lib section in a.out corrupted"
189 #define ELIBMAX             86                         /* Linux errno extension */
190 #define ELIBMAX_STR         "Attempting to link in too many shared libraries"
191 #define ELIBEXEC            87                         /* Linux errno extension */
192 #define ELIBEXEC_STR        "Cannot exec a shared library directly"
193 #define ENOSYS              88
194 #define ENOSYS_STR          "Function not implemented"
195 #define ENMFILE             89                         /* Cygwin */
196 #define ENMFILE_STR         "No more files"
197 #define ENOTEMPTY           90
198 #define ENOTEMPTY_STR       "Directory not empty"
199 #define ENAMETOOLONG        91
200 #define ENAMETOOLONG_STR    "File name too long"
201 #define ELOOP               92
202 #define ELOOP_STR           "Too many symbolic links encountered"
203 
204 #define EOPNOTSUPP          95
205 #define EOPNOTSUPP_STR      "Operation not supported on transport endpoint"
206 #define EPFNOSUPPORT        96
207 #define EPFNOSUPPORT_STR    "Protocol family not supported"
208 
209 #define ECONNRESET          104
210 #define ECONNRESET_STR      "Connection reset by peer"
211 #define ENOBUFS             105
212 #define ENOBUFS_STR         "No buffer space available"
213 #define EAFNOSUPPORT        106
214 #define EAFNOSUPPORT_STR    "Address family not supported by protocol"
215 #define EPROTOTYPE          107
216 #define EPROTOTYPE_STR      "Protocol wrong type for socket"
217 #define ENOTSOCK            108
218 #define ENOTSOCK_STR        "Socket operation on non-socket"
219 #define ENOPROTOOPT         109
220 #define ENOPROTOOPT_STR     "Protocol not available"
221 #define ESHUTDOWN           110                         /* Linux errno extension */
222 #define ESHUTDOWN_STR       "Cannot send after transport endpoint shutdown"
223 #define ECONNREFUSED        111
224 #define ECONNREFUSED_STR    "Connection refused"
225 #define EADDRINUSE          112
226 #define EADDRINUSE_STR      "Address already in use"
227 #define ECONNABORTED        113
228 #define ECONNABORTED_STR    "Software caused connection abort"
229 #define ENETUNREACH         114
230 #define ENETUNREACH_STR     "Network is unreachable"
231 #define ENETDOWN            115
232 #define ENETDOWN_STR        "Network is down"
233 #define ETIMEDOUT           116
234 #define ETIMEDOUT_STR       "Connection timed out"
235 #define EHOSTDOWN           117
236 #define EHOSTDOWN_STR       "Host is down"
237 #define EHOSTUNREACH        118
238 #define EHOSTUNREACH_STR    "No route to host"
239 #define EINPROGRESS         119
240 #define EINPROGRESS_STR     "Operation now in progress"
241 #define EALREADY            120
242 #define EALREADY_STR        "Socket already connected"
243 #define EDESTADDRREQ        121
244 #define EDESTADDRREQ_STR    "Destination address required"
245 #define EMSGSIZE            122
246 #define EMSGSIZE_STR        "Message too long"
247 #define EPROTONOSUPPORT     123
248 #define EPROTONOSUPPORT_STR "Protocol not supported"
249 #define ESOCKTNOSUPPORT     124                         /* Linux errno extension */
250 #define ESOCKTNOSUPPORT_STR "Socket type not supported"
251 #define EADDRNOTAVAIL       125
252 #define EADDRNOTAVAIL_STR   "Cannot assign requested address"
253 #define ENETRESET           126
254 #define ENETRESET_STR       "Network dropped connection because of reset"
255 #define EISCONN             127
256 #define EISCONN_STR         "Transport endpoint is already connected"
257 #define ENOTCONN            128
258 #define ENOTCONN_STR        "Transport endpoint is not connected"
259 #define ETOOMANYREFS        129
260 #define ETOOMANYREFS_STR    "Too many references: cannot splice"
261 #define EPROCLIM            130
262 #define EPROCLIM_STR        "Limit would be exceeded by attempted fork"
263 #define EUSERS              131
264 #define EUSERS_STR          "Too many users"
265 #define EDQUOT              132
266 #define EDQUOT_STR          "Quota exceeded"
267 #define ESTALE              133
268 #define ESTALE_STR          "Stale NFS file handle"
269 #define ENOTSUP             134
270 #define ENOTSUP_STR         "Not supported"
271 #define ENOMEDIUM           135                         /* Linux errno extension */
272 #define ENOMEDIUM_STR       "No medium found"
273 #define ENOSHARE            136                         /* Cygwin */
274 #define ENOSHARE_STR        "No such host or network path"
275 #define ECASECLASH          137                         /* Cygwin */
276 #define ECASECLASH_STR      "Filename exists with different case"
277 #define EILSEQ              138
278 #define EILSEQ_STR          "Illegal byte sequence"
279 #define EOVERFLOW           139
280 #define EOVERFLOW_STR       "Value too large for defined data type"
281 #define ECANCELED           140
282 #define ECANCELED_STR       "Operation cancelled"
283 #define ENOTRECOVERABLE     141
284 #define ENOTRECOVERABLE_STR "State not recoverable"
285 #define EOWNERDEAD          142
286 #define EOWNERDEAD_STR      "Previous owner died"
287 #define ESTRPIPE            143                         /* Linux errno extension */
288 #define ESTRPIPE_STR        "Streams pipe error"
289 
290 #define __ELASTERROR        2000                        /* Users can add values starting here */
291 #else
292 #include <errno.h>
293 #endif
294 /****************************************************************************
295  * Public Type Definitions
296  ****************************************************************************/
297 
298 /****************************************************************************
299  * Public Function Prototypes
300  ****************************************************************************/
301 
302 #undef EXTERN
303 #if defined(__cplusplus)
304 #define EXTERN extern "C"
305 extern "C"
306 {
307 #else
308 #define EXTERN extern
309 #endif
310 
311 /* Return a pointer to the thread specific errno. */
312 
313 int *__errno(void);
314 
315 #undef EXTERN
316 #if defined(__cplusplus)
317 }
318 #endif
319 
320 #endif /* __INCLUDE_ERRNO_H */
321