1 /**
2  * @file errno.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _ERRNO_H_
25 #define	_ERRNO_H_
26 #pragma GCC system_header
27 #include <_mingw.h>
28 
29 /*
30  * Error numbers and access to error reporting.
31  */
32 
33 /*
34  * Error numbers.
35  * TODO: Can't be sure of some of these assignments, I guessed from the
36  * names given by strerror and the defines in the Cygnus errno.h. A lot
37  * of the names from the Cygnus errno.h are not represented, and a few
38  * of the descriptions returned by strerror do not obviously match
39  * their error naming.
40  */
41 #define EPERM		1	/* Operation not permitted */
42 #define	ENOFILE		2	/* No such file or directory */
43 #define	ENOENT		2
44 #define	ESRCH		3	/* No such process */
45 #define	EINTR		4	/* Interrupted function call */
46 #define	EIO		5	/* Input/output error */
47 #define	ENXIO		6	/* No such device or address */
48 #define	E2BIG		7	/* Arg list too long */
49 #define	ENOEXEC		8	/* Exec format error */
50 #define	EBADF		9	/* Bad file descriptor */
51 #define	ECHILD		10	/* No child processes */
52 #define	EAGAIN		11	/* Resource temporarily unavailable */
53 #define	ENOMEM		12	/* Not enough space */
54 #define	EACCES		13	/* Permission denied */
55 #define	EFAULT		14	/* Bad address */
56 /* 15 - Unknown Error */
57 #define	EBUSY		16	/* strerror reports "Resource device" */
58 #define	EEXIST		17	/* File exists */
59 #define	EXDEV		18	/* Improper link (cross-device link?) */
60 #define	ENODEV		19	/* No such device */
61 #define	ENOTDIR		20	/* Not a directory */
62 #define	EISDIR		21	/* Is a directory */
63 #define	EINVAL		22	/* Invalid argument */
64 #define	ENFILE		23	/* Too many open files in system */
65 #define	EMFILE		24	/* Too many open files */
66 #define	ENOTTY		25	/* Inappropriate I/O control operation */
67 /* 26 - Unknown Error */
68 #define	EFBIG		27	/* File too large */
69 #define	ENOSPC		28	/* No space left on device */
70 #define	ESPIPE		29	/* Invalid seek (seek on a pipe?) */
71 #define	EROFS		30	/* Read-only file system */
72 #define	EMLINK		31	/* Too many links */
73 #define	EPIPE		32	/* Broken pipe */
74 #define	EDOM		33	/* Domain error (math functions) */
75 #define	ERANGE		34	/* Result too large (possibly too small) */
76 /* 35 - Unknown Error */
77 #define	EDEADLOCK	36	/* Resource deadlock avoided (non-Cyg) */
78 #define	EDEADLK		36
79 /* 37 - Unknown Error */
80 #define	ENAMETOOLONG	38	/* Filename too long (91 in Cyg?) */
81 #define	ENOLCK		39	/* No locks available (46 in Cyg?) */
82 #define	ENOSYS		40	/* Function not implemented (88 in Cyg?) */
83 #define	ENOTEMPTY	41	/* Directory not empty (90 in Cyg?) */
84 #define	EILSEQ		42	/* Illegal byte sequence */
85 
86 /*
87  * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
88  *       sockets.h header provided with windows32api-0.1.2.
89  *       You should go and put an #if 0 ... #endif around the whole block
90  *       of errors (look at the comment above them).
91  */
92 
93 #ifndef	RC_INVOKED
94 
95 #ifdef	__cplusplus
96 extern "C" {
97 #endif
98 
99 /*
100  * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
101  * stdlib.h.
102  */
103 #ifdef _UWIN
104 #undef errno
105 extern int errno;
106 #else
107 _CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void);
108 #define	errno		(*_errno())
109 #endif
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* Not RC_INVOKED */
116 
117 #endif	/* Not _ERRNO_H_ */
118