OSDN Git Service

dd42ca6c93ff63d33f7a1267e58db44b7c975df9
[mingw/mingw-org-wsl.git] / include / errno.h
1 /**
2  * @file errno.h
3  * @copy 2012 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
28 /* 
29  * Error numbers and access to error reporting.
30  */
31
32 /* All the headers include this file. */
33 #include <_mingw.h>
34
35 /*
36  * Error numbers.
37  * TODO: Can't be sure of some of these assignments, I guessed from the
38  * names given by strerror and the defines in the Cygnus errno.h. A lot
39  * of the names from the Cygnus errno.h are not represented, and a few
40  * of the descriptions returned by strerror do not obviously match
41  * their error naming.
42  */
43 #define EPERM           1       /* Operation not permitted */
44 #define ENOFILE         2       /* No such file or directory */
45 #define ENOENT          2
46 #define ESRCH           3       /* No such process */
47 #define EINTR           4       /* Interrupted function call */
48 #define EIO             5       /* Input/output error */
49 #define ENXIO           6       /* No such device or address */
50 #define E2BIG           7       /* Arg list too long */
51 #define ENOEXEC         8       /* Exec format error */
52 #define EBADF           9       /* Bad file descriptor */
53 #define ECHILD          10      /* No child processes */
54 #define EAGAIN          11      /* Resource temporarily unavailable */
55 #define ENOMEM          12      /* Not enough space */
56 #define EACCES          13      /* Permission denied */
57 #define EFAULT          14      /* Bad address */
58 /* 15 - Unknown Error */
59 #define EBUSY           16      /* strerror reports "Resource device" */
60 #define EEXIST          17      /* File exists */
61 #define EXDEV           18      /* Improper link (cross-device link?) */
62 #define ENODEV          19      /* No such device */
63 #define ENOTDIR         20      /* Not a directory */
64 #define EISDIR          21      /* Is a directory */
65 #define EINVAL          22      /* Invalid argument */
66 #define ENFILE          23      /* Too many open files in system */
67 #define EMFILE          24      /* Too many open files */
68 #define ENOTTY          25      /* Inappropriate I/O control operation */
69 /* 26 - Unknown Error */
70 #define EFBIG           27      /* File too large */
71 #define ENOSPC          28      /* No space left on device */
72 #define ESPIPE          29      /* Invalid seek (seek on a pipe?) */
73 #define EROFS           30      /* Read-only file system */
74 #define EMLINK          31      /* Too many links */
75 #define EPIPE           32      /* Broken pipe */
76 #define EDOM            33      /* Domain error (math functions) */
77 #define ERANGE          34      /* Result too large (possibly too small) */
78 /* 35 - Unknown Error */
79 #define EDEADLOCK       36      /* Resource deadlock avoided (non-Cyg) */
80 #define EDEADLK         36
81 /* 37 - Unknown Error */
82 #define ENAMETOOLONG    38      /* Filename too long (91 in Cyg?) */
83 #define ENOLCK          39      /* No locks available (46 in Cyg?) */
84 #define ENOSYS          40      /* Function not implemented (88 in Cyg?) */
85 #define ENOTEMPTY       41      /* Directory not empty (90 in Cyg?) */
86 #define EILSEQ          42      /* Illegal byte sequence */
87
88 /*
89  * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
90  *       sockets.h header provided with windows32api-0.1.2.
91  *       You should go and put an #if 0 ... #endif around the whole block
92  *       of errors (look at the comment above them).
93  */
94
95 #ifndef RC_INVOKED
96
97 #ifdef  __cplusplus
98 extern "C" {
99 #endif
100
101 /*
102  * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
103  * stdlib.h.
104  */
105 #ifdef _UWIN
106 #undef errno
107 extern int errno;
108 #else
109 _CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void);
110 #define errno           (*_errno())
111 #endif
112
113 #ifdef  __cplusplus
114 }
115 #endif
116
117 #endif  /* Not RC_INVOKED */
118
119 #endif  /* Not _ERRNO_H_ */