1 /*
2 Copyright (c) 1982, 1986, 1993
3 The Regents of the University of California.  All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 3. Neither the name of the University nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 SUCH DAMAGE.
28  */
29 /* errno is not a global variable, because that would make using it
30    non-reentrant.  Instead, its address is returned by the function
31    __errno.  */
32 
33 #ifndef _SYS_ERRNO_H_
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 #define _SYS_ERRNO_H_
38 
39 #include <sys/config.h>
40 
41 /* Please don't use these variables directly.
42    Use strerror instead. */
43 extern __IMPORT const char * const _sys_errlist[];
44 extern __IMPORT int _sys_nerr;
45 #ifdef __CYGWIN__
46 extern __IMPORT const char * const sys_errlist[];
47 extern __IMPORT int sys_nerr;
48 extern __IMPORT char *program_invocation_name;
49 extern __IMPORT char *program_invocation_short_name;
50 #endif
51 
52 #ifdef NEWLIB_GLOBAL_ERRNO
53 #define NEWLIB_THREAD_LOCAL_ERRNO
54 #else
55 #define NEWLIB_THREAD_LOCAL_ERRNO NEWLIB_THREAD_LOCAL
56 #endif
57 
58 #ifdef __PICOLIBC_ERRNO_FUNCTION
59 int *__PICOLIBC_ERRNO_FUNCTION(void);
60 #define errno (*__PICOLIBC_ERRNO_FUNCTION())
61 #else
62 extern NEWLIB_THREAD_LOCAL_ERRNO int errno;
63 #define errno		errno
64 #endif
65 
66 #define __errno_r(ptr)	(errno)
67 #define _REENT_ERRNO(r) (errno)
68 
69 #define	EPERM 1		/* Not owner */
70 #define	ENOENT 2	/* No such file or directory */
71 #define	ESRCH 3		/* No such process */
72 #define	EINTR 4		/* Interrupted system call */
73 #define	EIO 5		/* I/O error */
74 #define	ENXIO 6		/* No such device or address */
75 #define	E2BIG 7		/* Arg list too long */
76 #define	ENOEXEC 8	/* Exec format error */
77 #define	EBADF 9		/* Bad file number */
78 #define	ECHILD 10	/* No children */
79 #define	EAGAIN 11	/* No more processes */
80 #define	ENOMEM 12	/* Not enough space */
81 #define	EACCES 13	/* Permission denied */
82 #define	EFAULT 14	/* Bad address */
83 #ifdef __LINUX_ERRNO_EXTENSIONS__
84 #define	ENOTBLK 15	/* Block device required */
85 #endif
86 #define	EBUSY 16	/* Device or resource busy */
87 #define	EEXIST 17	/* File exists */
88 #define	EXDEV 18	/* Cross-device link */
89 #define	ENODEV 19	/* No such device */
90 #define	ENOTDIR 20	/* Not a directory */
91 #define	EISDIR 21	/* Is a directory */
92 #define	EINVAL 22	/* Invalid argument */
93 #define	ENFILE 23	/* Too many open files in system */
94 #define	EMFILE 24	/* File descriptor value too large */
95 #define	ENOTTY 25	/* Not a character device */
96 #define	ETXTBSY 26	/* Text file busy */
97 #define	EFBIG 27	/* File too large */
98 #define	ENOSPC 28	/* No space left on device */
99 #define	ESPIPE 29	/* Illegal seek */
100 #define	EROFS 30	/* Read-only file system */
101 #define	EMLINK 31	/* Too many links */
102 #define	EPIPE 32	/* Broken pipe */
103 #define	EDOM 33		/* Mathematics argument out of domain of function */
104 #define	ERANGE 34	/* Result too large */
105 #define	ENOMSG 35	/* No message of desired type */
106 #define	EIDRM 36	/* Identifier removed */
107 #ifdef __LINUX_ERRNO_EXTENSIONS__
108 #define	ECHRNG 37	/* Channel number out of range */
109 #define	EL2NSYNC 38	/* Level 2 not synchronized */
110 #define	EL3HLT 39	/* Level 3 halted */
111 #define	EL3RST 40	/* Level 3 reset */
112 #define	ELNRNG 41	/* Link number out of range */
113 #define	EUNATCH 42	/* Protocol driver not attached */
114 #define	ENOCSI 43	/* No CSI structure available */
115 #define	EL2HLT 44	/* Level 2 halted */
116 #endif
117 #define	EDEADLK 45	/* Deadlock */
118 #define	ENOLCK 46	/* No lock */
119 #ifdef __LINUX_ERRNO_EXTENSIONS__
120 #define EBADE 50	/* Invalid exchange */
121 #define EBADR 51	/* Invalid request descriptor */
122 #define EXFULL 52	/* Exchange full */
123 #define ENOANO 53	/* No anode */
124 #define EBADRQC 54	/* Invalid request code */
125 #define EBADSLT 55	/* Invalid slot */
126 #define EDEADLOCK 56	/* File locking deadlock error */
127 #define EBFONT 57	/* Bad font file fmt */
128 #endif
129 #define ENOSTR 60	/* Not a stream */
130 #define ENODATA 61	/* No data (for no delay io) */
131 #define ETIME 62	/* Stream ioctl timeout */
132 #define ENOSR 63	/* No stream resources */
133 #ifdef __LINUX_ERRNO_EXTENSIONS__
134 #define ENONET 64	/* Machine is not on the network */
135 #define ENOPKG 65	/* Package not installed */
136 #define EREMOTE 66	/* The object is remote */
137 #endif
138 #define ENOLINK 67	/* Virtual circuit is gone */
139 #ifdef __LINUX_ERRNO_EXTENSIONS__
140 #define EADV 68		/* Advertise error */
141 #define ESRMNT 69	/* Srmount error */
142 #define	ECOMM 70	/* Communication error on send */
143 #endif
144 #define EPROTO 71	/* Protocol error */
145 #define	EMULTIHOP 74	/* Multihop attempted */
146 #ifdef __LINUX_ERRNO_EXTENSIONS__
147 #define	ELBIN 75	/* Inode is remote (not really error) */
148 #define	EDOTDOT 76	/* Cross mount point (not really error) */
149 #endif
150 #define EBADMSG 77	/* Bad message */
151 #define EFTYPE 79	/* Inappropriate file type or format */
152 #ifdef __LINUX_ERRNO_EXTENSIONS__
153 #define ENOTUNIQ 80	/* Given log. name not unique */
154 #define EBADFD 81	/* f.d. invalid for this operation */
155 #define EREMCHG 82	/* Remote address changed */
156 #define ELIBACC 83	/* Can't access a needed shared lib */
157 #define ELIBBAD 84	/* Accessing a corrupted shared lib */
158 #define ELIBSCN 85	/* .lib section in a.out corrupted */
159 #define ELIBMAX 86	/* Attempting to link in too many libs */
160 #define ELIBEXEC 87	/* Attempting to exec a shared library */
161 #endif
162 #define ENOSYS 88	/* Function not implemented */
163 #ifdef __CYGWIN__
164 #define ENMFILE 89      /* No more files */
165 #endif
166 #define ENOTEMPTY 90	/* Directory not empty */
167 #define ENAMETOOLONG 91	/* File or path name too long */
168 #define ELOOP 92	/* Too many symbolic links */
169 #define EOPNOTSUPP 95	/* Operation not supported on socket */
170 #define EPFNOSUPPORT 96 /* Protocol family not supported */
171 #define ECONNRESET 104  /* Connection reset by peer */
172 #define ENOBUFS 105	/* No buffer space available */
173 #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
174 #define EPROTOTYPE 107	/* Protocol wrong type for socket */
175 #define ENOTSOCK 108	/* Socket operation on non-socket */
176 #define ENOPROTOOPT 109	/* Protocol not available */
177 #ifdef __LINUX_ERRNO_EXTENSIONS__
178 #define ESHUTDOWN 110	/* Can't send after socket shutdown */
179 #endif
180 #define ECONNREFUSED 111	/* Connection refused */
181 #define EADDRINUSE 112		/* Address already in use */
182 #define ECONNABORTED 113	/* Software caused connection abort */
183 #define ENETUNREACH 114		/* Network is unreachable */
184 #define ENETDOWN 115		/* Network interface is not configured */
185 #define ETIMEDOUT 116		/* Connection timed out */
186 #define EHOSTDOWN 117		/* Host is down */
187 #define EHOSTUNREACH 118	/* Host is unreachable */
188 #define EINPROGRESS 119		/* Connection already in progress */
189 #define EALREADY 120		/* Socket already connected */
190 #define EDESTADDRREQ 121	/* Destination address required */
191 #define EMSGSIZE 122		/* Message too long */
192 #define EPROTONOSUPPORT 123	/* Unknown protocol */
193 #ifdef __LINUX_ERRNO_EXTENSIONS__
194 #define ESOCKTNOSUPPORT 124	/* Socket type not supported */
195 #endif
196 #define EADDRNOTAVAIL 125	/* Address not available */
197 #define ENETRESET 126		/* Connection aborted by network */
198 #define EISCONN 127		/* Socket is already connected */
199 #define ENOTCONN 128		/* Socket is not connected */
200 #define ETOOMANYREFS 129
201 #ifdef __LINUX_ERRNO_EXTENSIONS__
202 #define EPROCLIM 130
203 #define EUSERS 131
204 #endif
205 #define EDQUOT 132
206 #define ESTALE 133
207 #define ENOTSUP 134		/* Not supported */
208 #ifdef __LINUX_ERRNO_EXTENSIONS__
209 #define ENOMEDIUM 135   /* No medium (in tape drive) */
210 #endif
211 #ifdef __CYGWIN__
212 #define ENOSHARE 136    /* No such host or network path */
213 #define ECASECLASH 137  /* Filename exists with different case */
214 #endif
215 #define EILSEQ 138		/* Illegal byte sequence */
216 #define EOVERFLOW 139	/* Value too large for defined data type */
217 #define ECANCELED 140	/* Operation canceled */
218 #define ENOTRECOVERABLE 141	/* State not recoverable */
219 #define EOWNERDEAD 142	/* Previous owner died */
220 #ifdef __LINUX_ERRNO_EXTENSIONS__
221 #define ESTRPIPE 143	/* Streams pipe error */
222 #endif
223 #define EWOULDBLOCK EAGAIN	/* Operation would block */
224 
225 #define __ELASTERROR 2000	/* Users can add values starting here */
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 #endif /* _SYS_ERRNO_H */
231