This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / include / crtdll / errno.h
1 /* 
2  * errno.h
3  *
4  * Error numbers and access to error reporting.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26
27 #ifndef _ERRNO_H_
28 #define _ERRNO_H_
29
30 #ifdef  __cplusplus
31 extern "C" {
32 #endif
33
34 /*
35  * Error numbers.
36  * TODO: Can't be sure of some of these assignments, I guessed from the
37  * names given by strerror and the defines in the Cygnus errno.h. A lot
38  * of the names from the Cygnus errno.h are not represented, and a few
39  * of the descriptions returned by strerror do not obviously match
40  * their error naming.
41  */
42 #define EPERM           1       /* Operation not permitted */
43 #define ENOFILE         2       /* No such file or directory */
44 #define ENOENT          2
45 #define ESRCH           3       /* No such process */
46 #define EINTR           4       /* Interrupted function call */
47 #define EIO             5       /* Input/output error */
48 #define ENXIO           6       /* No such device or address */
49 #define E2BIG           7       /* Arg list too long */
50 #define ENOEXEC         8       /* Exec format error */
51 #define EBADF           9       /* Bad file descriptor */
52 #define ECHILD          10      /* No child processes */
53 #define EAGAIN          11      /* Resource temporarily unavailable */
54 #define ENOMEM          12      /* Not enough space */
55 #define EACCES          13      /* Permission denied */
56 #define EFAULT          14      /* Bad address */
57 /* 15 - Unknown Error */
58 #define EBUSY           16      /* strerror reports "Resource device" */
59 #define EEXIST          17      /* File exists */
60 #define EXDEV           18      /* Improper link (cross-device link?) */
61 #define ENODEV          19      /* No such device */
62 #define ENOTDIR         20      /* Not a directory */
63 #define EISDIR          21      /* Is a directory */
64 #define EINVAL          22      /* Invalid argument */
65 #define ENFILE          23      /* Too many open files in system */
66 #define EMFILE          24      /* Too many open files */
67 #define ENOTTY          25      /* Inappropriate I/O control operation */
68 /* 26 - Unknown Error */
69 #define EFBIG           27      /* File too large */
70 #define ENOSPC          28      /* No space left on device */
71 #define ESPIPE          29      /* Invalid seek (seek on a pipe?) */
72 #define EROFS           30      /* Read-only file system */
73 #define EMLINK          31      /* Too many links */
74 #define EPIPE           32      /* Broken pipe */
75 #define EDOM            33      /* Domain error (math functions) */
76 #define ERANGE          34      /* Result too large (possibly too small) */
77 /* 35 - Unknown Error */
78 #define EDEADLOCK       36      /* Resource deadlock avoided (non-Cyg) */
79 #define EDEADLK         36
80 /* 37 - Unknown Error */
81 #define ENAMETOOLONG    38      /* Filename too long (91 in Cyg?) */
82 #define ENOLCK          39      /* No locks available (46 in Cyg?) */
83 #define ENOSYS          40      /* Function not implemented (88 in Cyg?) */
84 #define ENOTEMPTY       41      /* Directory not empty (90 in Cyg?) */
85 #define EILSEQ          42      /* Illegal byte sequence */
86
87 /*
88  * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
89  *       sockets.h header provided with windows32api-0.1.2.
90  *       You should go and put an #if 0 ... #endif around the whole block
91  *       of errors (look at the comment above them).
92  */
93
94 /*
95  * Definitions of macros for the 'variables' errno, _doserrno, sys_nerr and
96  * sys_errlist.
97  */
98 int*    _errno(void);
99 #define errno           (*_errno())
100
101 int*    __doserrno(void);
102 #define _doserrno       (*__doserrno())
103
104 #if     __MSVCRT__
105 /* One of the MSVCRTxx libraries */
106
107 extern int*     __imp__sys_nerr;
108 #define sys_nerr        (*__imp__sys_nerr)
109
110 extern char**   __imp__sys_errlist;
111 #ifndef sys_errlist
112 #define sys_errlist     (__imp__sys_errlist)
113 #endif
114
115 #else
116 /* CRTDLL run time library */
117
118
119 #define _sys_nerr   (*_sys_nerr_dll)
120 extern int*     _sys_nerr_dll;
121 #define sys_nerr        (*_sys_nerr_dll)
122
123 extern const char*      __sys_errlist[];
124 #define sys_errlist     (__sys_errlist)
125
126 #endif
127
128
129
130 #ifdef  __cplusplus
131 }
132 #endif
133
134 #endif