1 /***
2 * errno.h - system wide error numbers (set by system calls)
3 *
4 *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
5 *
6 * Purpose:
7 *       This file defines the system-wide error numbers (set by
8 *       system calls).  Conforms to the XENIX standard.  Extended
9 *       for compatibility with Uniforum standard.
10 *       [System V]
11 *
12 *       [Public]
13 *
14 ****/
15 
16 #if     _MSC_VER > 1000
17 #pragma once
18 #endif
19 
20 #if !defined(_INC_ERRNO)
21 #define _INC_ERRNO
22 
23 #if !defined(_WIN32)
24 #error ERROR: Only Win32 targets supported!
25 #endif
26 
27 #include <winsock.h>
28 
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32 
33 
34 
35 /* Define _CRTIMP */
36 
37 #ifndef _CRTIMP
38 #if defined(_DLL)
39 #define _CRTIMP __declspec(dllimport)
40 #else   /* ndef _DLL */
41 #define _CRTIMP
42 #endif  /* _DLL */
43 #endif  /* _CRTIMP */
44 
45 
46 /* Define __cdecl for non-Microsoft compilers */
47 
48 #if ( !defined(_MSC_VER) && !defined(__cdecl) )
49 #define __cdecl
50 #endif
51 
52 /* Define _CRTAPI1 (for compatibility with the NT SDK) */
53 
54 #if !defined(_CRTAPI1)
55 #if	_MSC_VER >= 800 && _M_IX86 >= 300
56 #define _CRTAPI1 __cdecl
57 #else
58 #define _CRTAPI1
59 #endif
60 #endif
61 
62 #if !defined(PTW32_STATIC_LIB)
63 #  if defined(PTW32_BUILD)
64 #    define PTW32_DLLPORT __declspec (dllexport)
65 #  else
66 #    define PTW32_DLLPORT __declspec (dllimport)
67 #  endif
68 #else
69 #  define PTW32_DLLPORT
70 #endif
71 
72 /* declare reference to errno */
73 
74 #if (defined(_MT) || defined(_MD) || defined(_DLL)) && !defined(_MAC)
75 PTW32_DLLPORT int * __cdecl _errno(void);
76 #define errno   (*_errno())
77 #else   /* ndef _MT && ndef _MD && ndef _DLL */
78 _CRTIMP extern int errno;
79 #endif  /* _MT || _MD || _DLL */
80 
81 /* Error Codes */
82 
83 #define EPERM           1
84 #define ENOENT          2
85 #define ESRCH           3
86 #define EINTR           4
87 #define EIO             5
88 #define ENXIO           6
89 #define E2BIG           7
90 #define ENOEXEC         8
91 #define EBADF           9
92 #define ECHILD          10
93 #define EAGAIN          11
94 #define ENOMEM          12
95 #define EACCES          13
96 #define EFAULT          14
97 #define EBUSY           16
98 #define EEXIST          17
99 #define EXDEV           18
100 #define ENODEV          19
101 #define ENOTDIR         20
102 #define EISDIR          21
103 #define EINVAL          22
104 #define ENFILE          23
105 #define EMFILE          24
106 #define ENOTTY          25
107 #define EFBIG           27
108 #define ENOSPC          28
109 #define ESPIPE          29
110 #define EROFS           30
111 #define EMLINK          31
112 #define EPIPE           32
113 #define EDOM            33
114 #define ERANGE          34
115 #define EDEADLK         36
116 
117 /* defined differently in winsock.h on WinCE */
118 #if !defined(ENAMETOOLONG)
119 #define ENAMETOOLONG    38
120 #endif
121 
122 #define ENOLCK          39
123 #define ENOSYS          40
124 
125 /* defined differently in winsock.h on WinCE */
126 #if !defined(ENOTEMPTY)
127 #define ENOTEMPTY       41
128 #endif
129 
130 #define EILSEQ          42
131 
132 /* POSIX 2008 - robust mutexes */
133 #define EOWNERDEAD	43
134 #define ENOTRECOVERABLE	44
135 
136 /*
137  * Support EDEADLOCK for compatibiity with older MS-C versions.
138  */
139 #define EDEADLOCK       EDEADLK
140 
141 #if defined(__cplusplus)
142 }
143 #endif
144 
145 #endif  /* _INC_ERRNO */
146