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