]>
Commit | Line | Data |
---|---|---|
b6cff313 RS |
1 | /* |
2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. | |
0f113f3e | 3 | * |
b6cff313 RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
8 | */ |
9 | ||
10 | #ifndef HEADER_E_OS_H | |
0f113f3e | 11 | # define HEADER_E_OS_H |
d02b48c6 | 12 | |
0f113f3e | 13 | # include <openssl/opensslconf.h> |
06018c46 | 14 | |
0f113f3e MC |
15 | # include <openssl/e_os2.h> |
16 | /* | |
17 | * <openssl/e_os2.h> contains what we can justify to make visible to the | |
18 | * outside; this file e_os.h is not part of the exported interface. | |
19 | */ | |
fa470a84 | 20 | |
d02b48c6 RE |
21 | #ifdef __cplusplus |
22 | extern "C" { | |
23 | #endif | |
24 | ||
58964a49 | 25 | /* Used to checking reference counts, most while doing perl5 stuff :-) */ |
f3f1cf84 | 26 | # if defined(OPENSSL_NO_STDIO) |
f3f1cf84 RS |
27 | # if defined(REF_PRINT) |
28 | # error "REF_PRINT requires stdio" | |
29 | # endif | |
0f113f3e | 30 | # endif |
f3f1cf84 | 31 | |
43708c15 | 32 | /* |
5f584013 AP |
33 | * Format specifier for printing size_t. Original conundrum was to |
34 | * get it working with -Wformat [-Werror], which can be considered | |
35 | * overzelaous, especially in multi-platform context, but it's | |
36 | * conscious choice... | |
43708c15 | 37 | */ |
5f584013 AP |
38 | # if defined(_WIN64) |
39 | # define OSSLzu "I64u" /* One would expect _WIN{64|32} cases after | |
40 | * __STDC_VERSION__, but there are corner | |
41 | * cases of MinGW compilers that link with | |
42 | * non-compliant MSVCRT.DLL... */ | |
43 | # elif defined(_WIN32) | |
44 | # define OSSLzu "u" | |
45 | # elif defined(__VMS) | |
46 | # define OSSLzu "u" /* VMS suffers from similar problem as MinGW, | |
47 | * i.e. C RTL falling behind compiler. Recall | |
48 | * that sizeof(size_t)==4 even in LP64 case. */ | |
49 | # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
43708c15 | 50 | # define OSSLzu "zu" |
5f584013 AP |
51 | # elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__==4 |
52 | # define OSSLzu "u" /* 'lu' should have worked, but when generating | |
53 | * 32-bit code gcc still complains :-( */ | |
43708c15 | 54 | # else |
5f584013 AP |
55 | # define OSSLzu "lu" /* To see that is works recall what does L |
56 | * stand for in ILP32 and LP64 */ | |
43708c15 RS |
57 | # endif |
58 | ||
463a7b8c | 59 | # if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO) |
f3f1cf84 | 60 | # define REF_ASSERT_ISNT(test) \ |
040d43b3 | 61 | (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0) |
f3f1cf84 RS |
62 | # else |
63 | # define REF_ASSERT_ISNT(i) | |
984d6c60 | 64 | # endif |
f3f1cf84 RS |
65 | # ifdef REF_PRINT |
66 | # define REF_PRINT_COUNT(a, b) \ | |
67 | fprintf(stderr, "%p:%4d:%s\n", b, b->references, a) | |
68 | # else | |
69 | # define REF_PRINT_COUNT(a, b) | |
984d6c60 | 70 | # endif |
58964a49 | 71 | |
a773b52a | 72 | # define osslargused(x) (void)x |
040d43b3 | 73 | # define OPENSSL_CONF "openssl.cnf" |
a773b52a | 74 | |
0f113f3e MC |
75 | # ifndef DEVRANDOM |
76 | /* | |
77 | * set this to a comma-separated list of 'random' device files to try out. My | |
78 | * default, we will try to read at least one of these files | |
79 | */ | |
80 | # define DEVRANDOM "/dev/urandom","/dev/random","/dev/srandom" | |
81 | # endif | |
0423f812 | 82 | # if !defined(OPENSSL_NO_EGD) && !defined(DEVRANDOM_EGD) |
0f113f3e MC |
83 | /* |
84 | * set this to a comma-separated list of 'egd' sockets to try out. These | |
85 | * sockets will be tried in the order listed in case accessing the device | |
86 | * files listed in DEVRANDOM did not return enough entropy. | |
87 | */ | |
88 | # define DEVRANDOM_EGD "/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy" | |
89 | # endif | |
d02b48c6 | 90 | |
cff55b90 | 91 | # if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI) |
3e83e686 RL |
92 | # define NO_SYS_PARAM_H |
93 | # define NO_CHMOD | |
94 | # define NO_SYSLOG | |
0f113f3e MC |
95 | # endif |
96 | ||
d02b48c6 RE |
97 | /******************************************************************** |
98 | The Microsoft section | |
99 | ********************************************************************/ | |
0f113f3e | 100 | # if defined(OPENSSL_SYS_WIN32) && !defined(WIN32) |
b8384651 | 101 | # define WIN32 |
0f113f3e MC |
102 | # endif |
103 | # if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS) | |
cf1b7d96 | 104 | # define WINDOWS |
0f113f3e MC |
105 | # endif |
106 | # if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS) | |
cf1b7d96 | 107 | # define MSDOS |
0f113f3e | 108 | # endif |
d02b48c6 | 109 | |
4d60c7e1 | 110 | # if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS) |
9a1e34e5 | 111 | # define GETPID_IS_MEANINGLESS |
0f113f3e | 112 | # endif |
9a1e34e5 | 113 | |
0f113f3e MC |
114 | # ifdef WIN32 |
115 | # define NO_SYS_UN_H | |
116 | # define get_last_sys_error() GetLastError() | |
117 | # define clear_sys_error() SetLastError(0) | |
118 | # if !defined(WINNT) | |
119 | # define WIN_CONSOLE_BUG | |
120 | # endif | |
121 | # else | |
122 | # define get_last_sys_error() errno | |
123 | # define clear_sys_error() errno=0 | |
124 | # endif | |
58964a49 | 125 | |
0f113f3e MC |
126 | # if defined(WINDOWS) |
127 | # define get_last_socket_error() WSAGetLastError() | |
128 | # define clear_socket_error() WSASetLastError(0) | |
129 | # define readsocket(s,b,n) recv((s),(b),(n),0) | |
130 | # define writesocket(s,b,n) send((s),(b),(n),0) | |
131 | # elif defined(__DJGPP__) | |
132 | # define WATT32 | |
2c25ebd1 | 133 | # define WATT32_NO_OLDIES |
0f113f3e MC |
134 | # define get_last_socket_error() errno |
135 | # define clear_socket_error() errno=0 | |
136 | # define closesocket(s) close_s(s) | |
137 | # define readsocket(s,b,n) read_s(s,b,n) | |
138 | # define writesocket(s,b,n) send(s,b,n,0) | |
139 | # elif defined(OPENSSL_SYS_VMS) | |
140 | # define get_last_socket_error() errno | |
141 | # define clear_socket_error() errno=0 | |
142 | # define ioctlsocket(a,b,c) ioctl(a,b,c) | |
143 | # define closesocket(s) close(s) | |
144 | # define readsocket(s,b,n) recv((s),(b),(n),0) | |
145 | # define writesocket(s,b,n) send((s),(b),(n),0) | |
146 | # elif defined(OPENSSL_SYS_VXWORKS) | |
147 | # define get_last_socket_error() errno | |
148 | # define clear_socket_error() errno=0 | |
149 | # define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c)) | |
150 | # define closesocket(s) close(s) | |
151 | # define readsocket(s,b,n) read((s),(b),(n)) | |
152 | # define writesocket(s,b,n) write((s),(char *)(b),(n)) | |
0f113f3e MC |
153 | # else |
154 | # define get_last_socket_error() errno | |
155 | # define clear_socket_error() errno=0 | |
156 | # define ioctlsocket(a,b,c) ioctl(a,b,c) | |
157 | # define closesocket(s) close(s) | |
158 | # define readsocket(s,b,n) read((s),(b),(n)) | |
159 | # define writesocket(s,b,n) write((s),(b),(n)) | |
160 | # endif | |
58964a49 | 161 | |
0f113f3e | 162 | # if (defined(WINDOWS) || defined(MSDOS)) |
d02b48c6 | 163 | |
f642ebc1 | 164 | # ifdef __DJGPP__ |
0f113f3e MC |
165 | # include <unistd.h> |
166 | # include <sys/stat.h> | |
167 | # include <sys/socket.h> | |
2c25ebd1 | 168 | # include <sys/un.h> |
0f113f3e MC |
169 | # include <tcp.h> |
170 | # include <netdb.h> | |
171 | # define _setmode setmode | |
172 | # define _O_TEXT O_TEXT | |
173 | # define _O_BINARY O_BINARY | |
2c25ebd1 RL |
174 | # define HAS_LFN_SUPPORT(name) (pathconf((name), _PC_NAME_MAX) > 12) |
175 | # undef DEVRANDOM_EGD /* Neither MS-DOS nor FreeDOS provide 'egd' sockets. */ | |
0f113f3e MC |
176 | # undef DEVRANDOM |
177 | # define DEVRANDOM "/dev/urandom\x24" | |
178 | # endif /* __DJGPP__ */ | |
f642ebc1 | 179 | |
0056ef5d | 180 | # ifndef S_IFDIR |
0f113f3e | 181 | # define S_IFDIR _S_IFDIR |
0056ef5d | 182 | # endif |
6e064240 | 183 | |
0056ef5d | 184 | # ifndef S_IFMT |
0f113f3e | 185 | # define S_IFMT _S_IFMT |
0056ef5d | 186 | # endif |
6e064240 | 187 | |
f642ebc1 | 188 | # if !defined(WINNT) && !defined(__DJGPP__) |
0f113f3e | 189 | # define NO_SYSLOG |
0056ef5d RL |
190 | # endif |
191 | # define NO_DIRENT | |
d02b48c6 | 192 | |
d02b48c6 | 193 | # ifdef WINDOWS |
0f113f3e | 194 | # if !defined(_WIN32_WCE) && !defined(_WIN32_WINNT) |
e476f942 | 195 | /* |
0f113f3e MC |
196 | * Defining _WIN32_WINNT here in e_os.h implies certain "discipline." |
197 | * Most notably we ought to check for availability of each specific | |
0ee05b73 AP |
198 | * routine that was introduced after denoted _WIN32_WINNT with |
199 | * GetProcAddress(). Normally newer functions are masked with higher | |
200 | * _WIN32_WINNT in SDK headers. So that if you wish to use them in | |
201 | * some module, you'd need to override _WIN32_WINNT definition in | |
202 | * the target module in order to "reach for" prototypes, but replace | |
203 | * calls to new functions with indirect calls. Alternatively it | |
204 | * might be possible to achieve the goal by /DELAYLOAD-ing .DLLs | |
205 | * and check for current OS version instead. | |
0f113f3e | 206 | */ |
0ee05b73 | 207 | # define _WIN32_WINNT 0x0501 |
0f113f3e | 208 | # endif |
2469e76b | 209 | # if defined(_WIN32_WINNT) || defined(_WIN32_WCE) |
61aa2134 AP |
210 | /* |
211 | * Just like defining _WIN32_WINNT including winsock2.h implies | |
8711efb4 | 212 | * certain "discipline" for maintaining [broad] binary compatibility. |
61aa2134 AP |
213 | * As long as structures are invariant among Winsock versions, |
214 | * it's sufficient to check for specific Winsock2 API availability | |
215 | * at run-time [DSO_global_lookup is recommended]... | |
216 | */ | |
0f113f3e MC |
217 | # include <winsock2.h> |
218 | # include <ws2tcpip.h> | |
8711efb4 | 219 | /* yes, they have to be #included prior to <windows.h> */ |
0f113f3e MC |
220 | # endif |
221 | # include <windows.h> | |
222 | # include <stdio.h> | |
223 | # include <stddef.h> | |
224 | # include <errno.h> | |
225 | # if defined(_WIN32_WCE) && !defined(EACCES) | |
226 | # define EACCES 13 | |
227 | # endif | |
228 | # include <string.h> | |
229 | # ifdef _WIN64 | |
230 | # define strlen(s) _strlen31(s) | |
1875e6db | 231 | /* cut strings to 2GB */ |
55c7a4cf | 232 | static __inline unsigned int _strlen31(const char *str) |
0f113f3e MC |
233 | { |
234 | unsigned int len = 0; | |
235 | while (*str && len < 0x80000000U) | |
236 | str++, len++; | |
237 | return len & 0x7FFFFFFF; | |
238 | } | |
239 | # endif | |
240 | # include <malloc.h> | |
241 | # if defined(_MSC_VER) && _MSC_VER<=1200 && defined(_MT) && defined(isspace) | |
e527201f | 242 | /* compensate for bug in VC6 ctype.h */ |
0f113f3e MC |
243 | # undef isspace |
244 | # undef isdigit | |
245 | # undef isalnum | |
246 | # undef isupper | |
247 | # undef isxdigit | |
248 | # endif | |
249 | # if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(_DLL) && defined(stdin) | |
250 | # if _MSC_VER>=1300 && _MSC_VER<1600 | |
251 | # undef stdin | |
252 | # undef stdout | |
253 | # undef stderr | |
254 | FILE *__iob_func(); | |
255 | # define stdin (&__iob_func()[0]) | |
256 | # define stdout (&__iob_func()[1]) | |
257 | # define stderr (&__iob_func()[2]) | |
258 | # elif _MSC_VER<1300 && defined(I_CAN_LIVE_WITH_LNK4049) | |
259 | # undef stdin | |
260 | # undef stdout | |
261 | # undef stderr | |
262 | /* | |
263 | * pre-1300 has __p__iob(), but it's available only in msvcrt.lib, | |
264 | * or in other words with /MD. Declaring implicit import, i.e. with | |
265 | * _imp_ prefix, works correctly with all compiler options, but | |
266 | * without /MD results in LINK warning LNK4049: 'locally defined | |
267 | * symbol "__iob" imported'. | |
e527201f | 268 | */ |
0f113f3e MC |
269 | extern FILE *_imp___iob; |
270 | # define stdin (&_imp___iob[0]) | |
271 | # define stdout (&_imp___iob[1]) | |
272 | # define stderr (&_imp___iob[2]) | |
e527201f | 273 | # endif |
0f113f3e | 274 | # endif |
d02b48c6 | 275 | # endif |
0f113f3e MC |
276 | # include <io.h> |
277 | # include <fcntl.h> | |
d02b48c6 | 278 | |
0bf23d9b | 279 | # ifdef OPENSSL_SYS_WINCE |
0f113f3e | 280 | # define OPENSSL_NO_POSIX_IO |
0bf23d9b RL |
281 | # endif |
282 | ||
be7b4458 | 283 | # define EXIT(n) exit(n) |
d02b48c6 | 284 | # define LIST_SEPARATOR_CHAR ';' |
0056ef5d | 285 | # ifndef X_OK |
0f113f3e | 286 | # define X_OK 0 |
0056ef5d RL |
287 | # endif |
288 | # ifndef W_OK | |
0f113f3e | 289 | # define W_OK 2 |
0056ef5d RL |
290 | # endif |
291 | # ifndef R_OK | |
0f113f3e | 292 | # define R_OK 4 |
0056ef5d | 293 | # endif |
0bf23d9b | 294 | # ifdef OPENSSL_SYS_WINCE |
0f113f3e | 295 | # define DEFAULT_HOME "" |
0bf23d9b | 296 | # else |
0f113f3e | 297 | # define DEFAULT_HOME "C:" |
0bf23d9b | 298 | # endif |
d02b48c6 | 299 | |
86d21d0b | 300 | /* Avoid Visual Studio 13 GetVersion deprecated problems */ |
0f113f3e MC |
301 | # if defined(_MSC_VER) && _MSC_VER>=1800 |
302 | # define check_winnt() (1) | |
303 | # define check_win_minplat(x) (1) | |
304 | # else | |
305 | # define check_winnt() (GetVersion() < 0x80000000) | |
306 | # define check_win_minplat(x) (LOBYTE(LOWORD(GetVersion())) >= (x)) | |
307 | # endif | |
f511b25a | 308 | |
0f113f3e | 309 | # else /* The non-microsoft world */ |
d02b48c6 | 310 | |
cf1b7d96 | 311 | # ifdef OPENSSL_SYS_VMS |
0f113f3e MC |
312 | # define VMS 1 |
313 | /* | |
314 | * some programs don't include stdlib, so exit() and others give implicit | |
315 | * function warnings | |
316 | */ | |
317 | # include <stdlib.h> | |
318 | # if defined(__DECC) | |
319 | # include <unistd.h> | |
320 | # else | |
321 | # include <unixlib.h> | |
322 | # endif | |
0f113f3e | 323 | # define LIST_SEPARATOR_CHAR ',' |
0c61e299 | 324 | /* We don't have any well-defined random devices on VMS, yet... */ |
0f113f3e | 325 | # undef DEVRANDOM |
1d97c843 TH |
326 | /*- |
327 | We need to do this since VMS has the following coding on status codes: | |
511e596b RL |
328 | |
329 | Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ... | |
330 | The important thing to know is that odd numbers are considered | |
0f113f3e | 331 | good, while even ones are considered errors. |
511e596b RL |
332 | Bits 3-15: actual status number |
333 | Bits 16-27: facility number. 0 is considered "unknown" | |
334 | Bits 28-31: control bits. If bit 28 is set, the shell won't try to | |
335 | output the message (which, for random codes, just looks ugly) | |
336 | ||
337 | So, what we do here is to change 0 to 1 to get the default success status, | |
338 | and everything else is shifted up to fit into the status number field, and | |
f625d383 | 339 | the status is tagged as an error, which is what is wanted here. |
c3944a99 RL |
340 | |
341 | Finally, we add the VMS C facility code 0x35a000, because there are some | |
342 | programs, such as Perl, that will reinterpret the code back to something | |
343 | POSIXly. 'man perlvms' explains it further. | |
f625d383 | 344 | |
c3944a99 RL |
345 | NOTE: the perlvms manual wants to turn all codes 2 to 255 into success |
346 | codes (status type = 1). I couldn't disagree more. Fortunately, the | |
347 | status type doesn't seem to bother Perl. | |
511e596b RL |
348 | -- Richard Levitte |
349 | */ | |
f625d383 RL |
350 | # define EXIT(n) exit((n) ? (((n) << 3) | 2 | 0x10000000 | 0x35a000) : 1) |
351 | ||
0f113f3e | 352 | # define NO_SYS_PARAM_H |
c168a027 | 353 | # define NO_SYS_UN_H |
4d8743f4 | 354 | |
b8f304f7 RL |
355 | # define DEFAULT_HOME "SYS$LOGIN:" |
356 | ||
d02b48c6 | 357 | # else |
06018c46 | 358 | /* !defined VMS */ |
0f113f3e MC |
359 | # ifdef OPENSSL_UNISTD |
360 | # include OPENSSL_UNISTD | |
361 | # else | |
362 | # include <unistd.h> | |
363 | # endif | |
364 | # ifndef NO_SYS_TYPES_H | |
365 | # include <sys/types.h> | |
366 | # endif | |
367 | # ifdef OPENSSL_SYS_WIN32_CYGWIN | |
368 | # include <io.h> | |
369 | # include <fcntl.h> | |
370 | # endif | |
371 | ||
0f113f3e | 372 | # define LIST_SEPARATOR_CHAR ':' |
0f113f3e | 373 | # define EXIT(n) exit(n) |
d02b48c6 | 374 | # endif |
d02b48c6 | 375 | |
0f113f3e | 376 | # endif |
7d7d2cbc | 377 | |
d02b48c6 RE |
378 | /*************/ |
379 | ||
0f113f3e | 380 | # ifdef USE_SOCKETS |
ffbc5b57 DW |
381 | # ifdef OPENSSL_NO_SOCK |
382 | # elif defined(WINDOWS) || defined(MSDOS) | |
37b1f8bd | 383 | /* windows world */ |
ffbc5b57 | 384 | # if !defined(__DJGPP__) |
0f113f3e MC |
385 | # if defined(_WIN32_WCE) && _WIN32_WCE<410 |
386 | # define getservbyname _masked_declaration_getservbyname | |
387 | # endif | |
388 | # if !defined(IPPROTO_IP) | |
a6efc2d1 | 389 | /* winsock[2].h was included already? */ |
0f113f3e MC |
390 | # include <winsock.h> |
391 | # endif | |
392 | # ifdef getservbyname | |
393 | # undef getservbyname | |
63d3a9c5 | 394 | /* this is used to be wcecompat/include/winsock_extras.h */ |
0f113f3e MC |
395 | struct servent *PASCAL getservbyname(const char *, const char *); |
396 | # endif | |
63d3a9c5 | 397 | |
0f113f3e | 398 | # ifdef _WIN64 |
1875e6db AP |
399 | /* |
400 | * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because | |
401 | * the value constitutes an index in per-process table of limited size | |
b13fdc48 AP |
402 | * and not a real pointer. And we also depend on fact that all processors |
403 | * Windows run on happen to be two's-complement, which allows to | |
404 | * interchange INVALID_SOCKET and -1. | |
1875e6db | 405 | */ |
0f113f3e MC |
406 | # define socket(d,t,p) ((int)socket(d,t,p)) |
407 | # define accept(s,f,l) ((int)accept(s,f,l)) | |
d02b48c6 | 408 | # endif |
0f113f3e | 409 | # else |
0f113f3e | 410 | # endif |
d02b48c6 | 411 | |
0f113f3e | 412 | # else |
d02b48c6 | 413 | |
0f113f3e MC |
414 | # ifndef NO_SYS_PARAM_H |
415 | # include <sys/param.h> | |
416 | # endif | |
417 | # ifdef OPENSSL_SYS_VXWORKS | |
418 | # include <time.h> | |
419 | # endif | |
420 | ||
421 | # include <netdb.h> | |
422 | # if defined(OPENSSL_SYS_VMS_NODECC) | |
423 | # include <socket.h> | |
424 | # include <in.h> | |
425 | # include <inet.h> | |
426 | # else | |
427 | # include <sys/socket.h> | |
428 | # ifndef NO_SYS_UN_H | |
429 | # ifdef OPENSSL_SYS_VXWORKS | |
430 | # include <streams/un.h> | |
431 | # else | |
432 | # include <sys/un.h> | |
433 | # endif | |
434 | # ifndef UNIX_PATH_MAX | |
435 | # define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path) | |
436 | # endif | |
a545c6f6 | 437 | # endif |
0f113f3e | 438 | # ifdef FILIO_H |
f6739c3d | 439 | # include <sys/filio.h> /* FIONBIO in some SVR4, e.g. unixware, solaris */ |
0f113f3e MC |
440 | # endif |
441 | # include <netinet/in.h> | |
442 | # include <arpa/inet.h> | |
28a0841b | 443 | # include <netinet/tcp.h> |
0f113f3e MC |
444 | # endif |
445 | ||
446 | # ifdef OPENSSL_SYS_AIX | |
447 | # include <sys/select.h> | |
448 | # endif | |
449 | ||
450 | # ifdef __QNX__ | |
451 | # include <sys/select.h> | |
452 | # endif | |
453 | ||
2f2c805a AP |
454 | # ifndef VMS |
455 | # include <sys/ioctl.h> | |
0f113f3e | 456 | # else |
2f2c805a AP |
457 | /* ioctl is only in VMS > 7.0 and when socketshr is not used */ |
458 | # if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000) | |
0f113f3e | 459 | # include <sys/ioctl.h> |
d02b48c6 | 460 | # endif |
0f113f3e | 461 | # endif |
d02b48c6 | 462 | |
0f113f3e MC |
463 | # ifdef VMS |
464 | # include <unixio.h> | |
465 | # if defined(TCPIP_TYPE_SOCKETSHR) | |
466 | # include <socketshr.h> | |
d02b48c6 | 467 | # endif |
0f113f3e MC |
468 | # endif |
469 | ||
0f113f3e MC |
470 | # ifndef INVALID_SOCKET |
471 | # define INVALID_SOCKET (-1) | |
472 | # endif /* INVALID_SOCKET */ | |
d02b48c6 | 473 | # endif |
a6dab873 | 474 | |
0f113f3e MC |
475 | /* |
476 | * Some IPv6 implementations are broken, disable them in known bad versions. | |
a6dab873 DSH |
477 | */ |
478 | # if !defined(OPENSSL_USE_IPV6) | |
0f113f3e MC |
479 | # if defined(AF_INET6) && !defined(NETWARE_CLIB) |
480 | # define OPENSSL_USE_IPV6 1 | |
481 | # else | |
482 | # define OPENSSL_USE_IPV6 0 | |
483 | # endif | |
a6dab873 DSH |
484 | # endif |
485 | ||
0f113f3e | 486 | # endif |
d02b48c6 | 487 | |
0f113f3e MC |
488 | # ifndef OPENSSL_EXIT |
489 | # if defined(MONOLITH) && !defined(OPENSSL_C) | |
490 | # define OPENSSL_EXIT(n) return(n) | |
491 | # else | |
492 | # define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0) | |
493 | # endif | |
1c3e4a36 | 494 | # endif |
1c3e4a36 | 495 | |
d02b48c6 RE |
496 | /***********************************************/ |
497 | ||
0f113f3e | 498 | # if defined(OPENSSL_SYS_WINDOWS) |
e6fa67fa RL |
499 | # define strcasecmp _stricmp |
500 | # define strncasecmp _strnicmp | |
dc6b5c7b RL |
501 | # if (_MSC_VER >= 1310) |
502 | # define open _open | |
503 | # define fdopen _fdopen | |
504 | # define close _close | |
8d95ca36 M |
505 | # ifndef strdup |
506 | # define strdup _strdup | |
507 | # endif | |
dc6b5c7b RL |
508 | # define unlink _unlink |
509 | # endif | |
7233bea2 RL |
510 | # else |
511 | # include <strings.h> | |
0f113f3e | 512 | # endif |
3bfd99bf | 513 | |
6a89a25c | 514 | /* vxworks */ |
0f113f3e MC |
515 | # if defined(OPENSSL_SYS_VXWORKS) |
516 | # include <ioLib.h> | |
517 | # include <tickLib.h> | |
518 | # include <sysLib.h> | |
6a89a25c | 519 | |
0f113f3e | 520 | # define TTY_STRUCT int |
6a89a25c | 521 | |
0f113f3e | 522 | # define sleep(a) taskDelay((a) * sysClkRateGet()) |
6a89a25c | 523 | |
0f113f3e MC |
524 | # include <vxWorks.h> |
525 | # include <sockLib.h> | |
526 | # include <taskLib.h> | |
6a89a25c | 527 | |
0f113f3e | 528 | # define getpid taskIdSelf |
6a89a25c | 529 | |
0f113f3e MC |
530 | /* |
531 | * NOTE: these are implemented by helpers in database app! if the database is | |
532 | * not linked, we need to implement them elswhere | |
533 | */ | |
6a89a25c RL |
534 | struct hostent *gethostbyname(const char *name); |
535 | struct hostent *gethostbyaddr(const char *addr, int length, int type); | |
536 | struct servent *getservbyname(const char *name, const char *proto); | |
537 | ||
0f113f3e | 538 | # endif |
6a89a25c RL |
539 | /* end vxworks */ |
540 | ||
b6eb9827 DSH |
541 | #define OSSL_NELEM(x) (sizeof(x)/sizeof(x[0])) |
542 | ||
43c56417 KR |
543 | #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION |
544 | # define CRYPTO_memcmp memcmp | |
545 | #endif | |
546 | ||
d02b48c6 RE |
547 | #ifdef __cplusplus |
548 | } | |
549 | #endif | |
550 | ||
551 | #endif |