summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CORE/sys/errno2.h
blob: 3ca85e33ae79dd47dce10ff65738d1acf99d3b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef _INC_SYS_ERRNO2
#define _INC_SYS_ERRNO2

/* Too late to include winsock2.h if winsock.h has already been loaded */
#ifndef _WINSOCKAPI_
#  if defined(UNDER_CE) && UNDER_CE <= 300
     /* winsock2 only for 4.00+ */
#    include <winsock.h>
#  else
#    include <winsock2.h>
#  endif
#endif

/* Ensure all the Exxx constants required by convert_wsa_error_to_errno() in
 * win32/win32sck.c are defined. Many are defined in <errno.h> already (more so
 * in VC++ 2010 and above and some MinGW/gcc-4.8 and above, which have an extra
 * "POSIX supplement") so, for the sake of compatibility with third-party code
 * linked into XS modules, we must be careful not to redefine them; for the
 * remainder we define our own values, namely the corresponding WSAExxx values.
 *
 * These definitions are also used as a supplement to the use of <errno.h> in
 * the Errno and POSIX modules, both of which may be used to test the value of
 * $!, which may have these values assigned to it (via code in win32/win32sck.c
 * and the $! case in Perl_magic_set()). It also provides numerous otherwise
 * missing values in the (hard-coded) list of Exxx constants exported by POSIX.
 * Finally, three of the non-standard errno.h values (actually all now in the
 * POSIX supplement in VC10+ and some MinGW/gcc-4.8+) are used in the perl core.
 *
 * This list is in the same order as that in convert_wsa_error_to_errno(). A
 * handful of WSAExxx constants used by that function have no corresponding Exxx
 * constant in any errno.h so there is no point in making up values for them;
 * they are just returned unchanged by that function so we do not need to worry
 * about them here.
 */

/* EINTR is a standard errno.h value */
/* EBADF is a standard errno.h value */
/* EACCES is a standard errno.h value */
/* EFAULT is a standard errno.h value */
/* EINVAL is a standard errno.h value */
/* EMFILE is a standard errno.h value */

#ifndef EWOULDBLOCK		/* New in VC10 */
#  define EWOULDBLOCK		WSAEWOULDBLOCK
#endif
#ifndef EINPROGRESS		/* New in VC10 */
#  define EINPROGRESS		WSAEINPROGRESS
#endif
#ifndef EALREADY		/* New in VC10 */
#  define EALREADY		WSAEALREADY
#endif
#ifndef ENOTSOCK		/* New in VC10 and needed in doio.c */
#  define ENOTSOCK		WSAENOTSOCK
#endif
#ifndef EDESTADDRREQ		/* New in VC10 */
#  define EDESTADDRREQ		WSAEDESTADDRREQ
#endif
#ifndef EMSGSIZE		/* New in VC10 */
#  define EMSGSIZE		WSAEMSGSIZE
#endif
#ifndef EPROTOTYPE		/* New in VC10 */
#  define EPROTOTYPE		WSAEPROTOTYPE
#endif
#ifndef ENOPROTOOPT		/* New in VC10 */
#  define ENOPROTOOPT		WSAENOPROTOOPT
#endif
#ifndef EPROTONOSUPPORT		/* New in VC10 */
#  define EPROTONOSUPPORT	WSAEPROTONOSUPPORT
#endif
#ifndef ESOCKTNOSUPPORT		/* Not in errno.h but wanted by POSIX.pm */
#  define ESOCKTNOSUPPORT	WSAESOCKTNOSUPPORT
#endif
#ifndef EOPNOTSUPP		/* New in VC10 */
#  define EOPNOTSUPP		WSAEOPNOTSUPP
#endif
#ifndef EPFNOSUPPORT		/* Not in errno.h but wanted by POSIX.pm */
#  define EPFNOSUPPORT		WSAEPFNOSUPPORT
#endif
#ifndef EAFNOSUPPORT		/* New in VC10 and needed in util.c */
#  define EAFNOSUPPORT		WSAEAFNOSUPPORT
#endif
#ifndef EADDRINUSE		/* New in VC10 */
#  define EADDRINUSE		WSAEADDRINUSE
#endif
#ifndef EADDRNOTAVAIL		/* New in VC10 */
#  define EADDRNOTAVAIL		WSAEADDRNOTAVAIL
#endif
#ifndef ENETDOWN		/* New in VC10 */
#  define ENETDOWN		WSAENETDOWN
#endif
#ifndef ENETUNREACH		/* New in VC10 */
#  define ENETUNREACH		WSAENETUNREACH
#endif
#ifndef ENETRESET		/* New in VC10 */
#  define ENETRESET		WSAENETRESET
#endif
#ifndef ECONNABORTED		/* New in VC10 and needed in util.c */
#  define ECONNABORTED		WSAECONNABORTED
#endif
#ifndef ECONNRESET		/* New in VC10 */
#  define ECONNRESET		WSAECONNRESET
#endif
#ifndef ENOBUFS			/* New in VC10 */
#  define ENOBUFS		WSAENOBUFS
#endif
#ifndef EISCONN			/* New in VC10 */
#  define EISCONN		WSAEISCONN
#endif
#ifndef ENOTCONN		/* New in VC10 */
#  define ENOTCONN		WSAENOTCONN
#endif
#ifndef ESHUTDOWN		/* Not in errno.h but wanted by POSIX.pm */
#  define ESHUTDOWN		WSAESHUTDOWN
#endif
#ifndef ETOOMANYREFS		/* Not in errno.h but wanted by POSIX.pm */
#  define ETOOMANYREFS		WSAETOOMANYREFS
#endif
#ifndef ETIMEDOUT		/* New in VC10 */
#  define ETIMEDOUT		WSAETIMEDOUT
#endif
#ifndef ECONNREFUSED		/* New in VC10 */
#  define ECONNREFUSED		WSAECONNREFUSED
#endif
#ifndef ELOOP			/* New in VC10 */
#  define ELOOP			WSAELOOP
#endif

/* ENAMETOOLONG is a standard errno.h value */

/* EHOSTDOWN is not in errno.h and despite being wanted by POSIX.pm we cannot
 * provide any sane value since there is no WSAEHOSTDOWN */

#ifndef EHOSTUNREACH		/* New in VC10 */
#  define EHOSTUNREACH		WSAEHOSTUNREACH
#endif

/* ENOTEMPTY is a standard errno.h value */

#ifndef EPROCLIM		/* Not in errno.h but wanted by POSIX.pm */
#  define EPROCLIM		WSAEPROCLIM
#endif
#ifndef EUSERS			/* Not in errno.h but wanted by POSIX.pm */
#  define EUSERS		WSAEUSERS
#endif
#ifndef EDQUOT			/* Not in errno.h but wanted by POSIX.pm */
#  define EDQUOT		WSAEDQUOT
#endif
#ifndef ESTALE			/* Not in errno.h but wanted by POSIX.pm */
#  define ESTALE		WSAESTALE
#endif
#ifndef EREMOTE			/* Not in errno.h but wanted by POSIX.pm */
#  define EREMOTE		WSAEREMOTE
#endif

/* EDISCON is not an errno.h value at all */
/* ENOMORE is not an errno.h value at all */

#ifndef ECANCELED		/* New in VC10 */
#  ifdef WSAECANCELLED		/* New in WinSock2 */
#    define ECANCELED		WSAECANCELLED
#  endif
#endif

/* EINVALIDPROCTABLE is not an errno.h value at all */
/* EINVALIDPROVIDER is not an errno.h value at all */
/* EPROVIDERFAILEDINIT is not an errno.h value at all */
/* EREFUSED is not an errno.h value at all */

/* Set a flag indicating whether <errno.h> has the POSIX supplement (the first
 * constant in which is EADDRINUSE). If so then we won't have just defined it as
 * WSAEADDRINUSE above.
 */
#undef ERRNO_HAS_POSIX_SUPPLEMENT
#if EADDRINUSE != WSAEADDRINUSE
#  define ERRNO_HAS_POSIX_SUPPLEMENT
#endif

#endif /* _INC_SYS_ERRNO2 */