OSDN Git Service

Merge mingwrt-3.22.4 updates into 5.0-active branch.
[mingw/mingw-org-wsl.git] / mingwrt / include / errno.h
1 /*
2  * errno.h
3  *
4  * Definition of error codes, and error code retrieval mechanism.
5  *
6  * $Id$
7  *
8  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
9  * Copyright (C) 1997-1999, 2001, 2003-2005, 2007, 2016, MinGW.org Project.
10  *
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice, this permission notice, and the following
20  * disclaimer shall be included in all copies or substantial portions of
21  * the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  *
31  */
32 #ifndef _ERRNO_H
33 #define _ERRNO_H
34
35 /* All MinGW headers are expected to include <_mingw.h>
36  */
37 #include <_mingw.h>
38
39 /* Error code numbers.
40  *
41  * TODO: Can't be sure of some of these assignments, I guessed from the
42  * names given by strerror and the defines in the Cygnus errno.h. A lot
43  * of the names from the Cygnus errno.h are not represented, and a few
44  * of the descriptions returned by strerror do not obviously match
45  * their error naming.
46  */
47 #define EPERM            1      /* Operation not permitted */
48 #define ENOFILE          2      /* No such file or directory */
49 #define ENOENT           2
50 #define ESRCH            3      /* No such process */
51 #define EINTR            4      /* Interrupted function call */
52 #define EIO              5      /* Input/output error */
53 #define ENXIO            6      /* No such device or address */
54 #define E2BIG            7      /* Arg list too long */
55 #define ENOEXEC          8      /* Exec format error */
56 #define EBADF            9      /* Bad file descriptor */
57 #define ECHILD          10      /* No child processes */
58 #define EAGAIN          11      /* Resource temporarily unavailable */
59 #define ENOMEM          12      /* Not enough space */
60 #define EACCES          13      /* Permission denied */
61 #define EFAULT          14      /* Bad address */
62 /* 15 - Unknown Error */
63 #define EBUSY           16      /* strerror reports "Resource device" */
64 #define EEXIST          17      /* File exists */
65 #define EXDEV           18      /* Improper link (cross-device link?) */
66 #define ENODEV          19      /* No such device */
67 #define ENOTDIR         20      /* Not a directory */
68 #define EISDIR          21      /* Is a directory */
69 #define EINVAL          22      /* Invalid argument */
70 #define ENFILE          23      /* Too many open files in system */
71 #define EMFILE          24      /* Too many open files */
72 #define ENOTTY          25      /* Inappropriate I/O control operation */
73 /* 26 - Unknown Error */
74 #define EFBIG           27      /* File too large */
75 #define ENOSPC          28      /* No space left on device */
76 #define ESPIPE          29      /* Invalid seek (seek on a pipe?) */
77 #define EROFS           30      /* Read-only file system */
78 #define EMLINK          31      /* Too many links */
79 #define EPIPE           32      /* Broken pipe */
80 #define EDOM            33      /* Domain error (math functions) */
81 #define ERANGE          34      /* Result too large (possibly too small) */
82 /* 35 - Unknown Error */
83 #define EDEADLOCK       36      /* Resource deadlock avoided (non-Cyg) */
84 #define EDEADLK         36
85 /* 37 - Unknown Error */
86 #define ENAMETOOLONG    38      /* Filename too long (91 in Cyg?) */
87 #define ENOLCK          39      /* No locks available (46 in Cyg?) */
88 #define ENOSYS          40      /* Function not implemented (88 in Cyg?) */
89 #define ENOTEMPTY       41      /* Directory not empty (90 in Cyg?) */
90 #define EILSEQ          42      /* Illegal byte sequence */
91
92 #ifndef RC_INVOKED
93
94 _BEGIN_C_DECLS
95
96 /* Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
97  * stdlib.h.
98  */
99 #ifdef _UWIN
100 #undef errno
101 extern int errno;
102 #else
103 _CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void);
104 #define errno           (*_errno())
105 #endif
106
107 _END_C_DECLS
108
109 #endif  /* ! RC_INVOKED */
110
111 #if defined __PTW32_H && ! defined _PTW32_ERRNO_H
112 /* As a courtesy to users of pthreads-win32, ensure that the appropriate
113  * additional error codes, as defined by that package, are automatically
114  * defined when <errno.h> is included AFTER any pthreads-win32 header; a
115  * complementary hook, in <_ptw32.h>, ensures that such additional error
116  * codes are defined, if <errno.h> is included BEFORE any pthreads-win32
117  * header is subsequently included.
118  *
119  * NOTE: this assumes pthreads-win32-2.10 or later, with corresponding
120  * MinGW.org patches applied; it will favour "ptw32_errno.h" installed
121  * in the mingwrt system include directory.
122  */
123 #include "ptw32_errno.h"
124
125 #endif  /* __PTW32_H */
126 #endif  /* !_ERRNO_H: $RCSfile$: end of file */