annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/openssl/e_os2.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /*
jpayne@69 2 * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
jpayne@69 3 *
jpayne@69 4 * Licensed under the OpenSSL license (the "License"). You may not use
jpayne@69 5 * this file except in compliance with the License. You can obtain a copy
jpayne@69 6 * in the file LICENSE in the source distribution or at
jpayne@69 7 * https://www.openssl.org/source/license.html
jpayne@69 8 */
jpayne@69 9
jpayne@69 10 #ifndef HEADER_E_OS2_H
jpayne@69 11 # define HEADER_E_OS2_H
jpayne@69 12
jpayne@69 13 # include <openssl/opensslconf.h>
jpayne@69 14
jpayne@69 15 #ifdef __cplusplus
jpayne@69 16 extern "C" {
jpayne@69 17 #endif
jpayne@69 18
jpayne@69 19 /******************************************************************************
jpayne@69 20 * Detect operating systems. This probably needs completing.
jpayne@69 21 * The result is that at least one OPENSSL_SYS_os macro should be defined.
jpayne@69 22 * However, if none is defined, Unix is assumed.
jpayne@69 23 **/
jpayne@69 24
jpayne@69 25 # define OPENSSL_SYS_UNIX
jpayne@69 26
jpayne@69 27 /* --------------------- Microsoft operating systems ---------------------- */
jpayne@69 28
jpayne@69 29 /*
jpayne@69 30 * Note that MSDOS actually denotes 32-bit environments running on top of
jpayne@69 31 * MS-DOS, such as DJGPP one.
jpayne@69 32 */
jpayne@69 33 # if defined(OPENSSL_SYS_MSDOS)
jpayne@69 34 # undef OPENSSL_SYS_UNIX
jpayne@69 35 # endif
jpayne@69 36
jpayne@69 37 /*
jpayne@69 38 * For 32 bit environment, there seems to be the CygWin environment and then
jpayne@69 39 * all the others that try to do the same thing Microsoft does...
jpayne@69 40 */
jpayne@69 41 /*
jpayne@69 42 * UEFI lives here because it might be built with a Microsoft toolchain and
jpayne@69 43 * we need to avoid the false positive match on Windows.
jpayne@69 44 */
jpayne@69 45 # if defined(OPENSSL_SYS_UEFI)
jpayne@69 46 # undef OPENSSL_SYS_UNIX
jpayne@69 47 # elif defined(OPENSSL_SYS_UWIN)
jpayne@69 48 # undef OPENSSL_SYS_UNIX
jpayne@69 49 # define OPENSSL_SYS_WIN32_UWIN
jpayne@69 50 # else
jpayne@69 51 # if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN)
jpayne@69 52 # define OPENSSL_SYS_WIN32_CYGWIN
jpayne@69 53 # else
jpayne@69 54 # if defined(_WIN32) || defined(OPENSSL_SYS_WIN32)
jpayne@69 55 # undef OPENSSL_SYS_UNIX
jpayne@69 56 # if !defined(OPENSSL_SYS_WIN32)
jpayne@69 57 # define OPENSSL_SYS_WIN32
jpayne@69 58 # endif
jpayne@69 59 # endif
jpayne@69 60 # if defined(_WIN64) || defined(OPENSSL_SYS_WIN64)
jpayne@69 61 # undef OPENSSL_SYS_UNIX
jpayne@69 62 # if !defined(OPENSSL_SYS_WIN64)
jpayne@69 63 # define OPENSSL_SYS_WIN64
jpayne@69 64 # endif
jpayne@69 65 # endif
jpayne@69 66 # if defined(OPENSSL_SYS_WINNT)
jpayne@69 67 # undef OPENSSL_SYS_UNIX
jpayne@69 68 # endif
jpayne@69 69 # if defined(OPENSSL_SYS_WINCE)
jpayne@69 70 # undef OPENSSL_SYS_UNIX
jpayne@69 71 # endif
jpayne@69 72 # endif
jpayne@69 73 # endif
jpayne@69 74
jpayne@69 75 /* Anything that tries to look like Microsoft is "Windows" */
jpayne@69 76 # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
jpayne@69 77 # undef OPENSSL_SYS_UNIX
jpayne@69 78 # define OPENSSL_SYS_WINDOWS
jpayne@69 79 # ifndef OPENSSL_SYS_MSDOS
jpayne@69 80 # define OPENSSL_SYS_MSDOS
jpayne@69 81 # endif
jpayne@69 82 # endif
jpayne@69 83
jpayne@69 84 /*
jpayne@69 85 * DLL settings. This part is a bit tough, because it's up to the
jpayne@69 86 * application implementor how he or she will link the application, so it
jpayne@69 87 * requires some macro to be used.
jpayne@69 88 */
jpayne@69 89 # ifdef OPENSSL_SYS_WINDOWS
jpayne@69 90 # ifndef OPENSSL_OPT_WINDLL
jpayne@69 91 # if defined(_WINDLL) /* This is used when building OpenSSL to
jpayne@69 92 * indicate that DLL linkage should be used */
jpayne@69 93 # define OPENSSL_OPT_WINDLL
jpayne@69 94 # endif
jpayne@69 95 # endif
jpayne@69 96 # endif
jpayne@69 97
jpayne@69 98 /* ------------------------------- OpenVMS -------------------------------- */
jpayne@69 99 # if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS)
jpayne@69 100 # if !defined(OPENSSL_SYS_VMS)
jpayne@69 101 # undef OPENSSL_SYS_UNIX
jpayne@69 102 # endif
jpayne@69 103 # define OPENSSL_SYS_VMS
jpayne@69 104 # if defined(__DECC)
jpayne@69 105 # define OPENSSL_SYS_VMS_DECC
jpayne@69 106 # elif defined(__DECCXX)
jpayne@69 107 # define OPENSSL_SYS_VMS_DECC
jpayne@69 108 # define OPENSSL_SYS_VMS_DECCXX
jpayne@69 109 # else
jpayne@69 110 # define OPENSSL_SYS_VMS_NODECC
jpayne@69 111 # endif
jpayne@69 112 # endif
jpayne@69 113
jpayne@69 114 /* -------------------------------- Unix ---------------------------------- */
jpayne@69 115 # ifdef OPENSSL_SYS_UNIX
jpayne@69 116 # if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX)
jpayne@69 117 # define OPENSSL_SYS_LINUX
jpayne@69 118 # endif
jpayne@69 119 # if defined(_AIX) && !defined(OPENSSL_SYS_AIX)
jpayne@69 120 # define OPENSSL_SYS_AIX
jpayne@69 121 # endif
jpayne@69 122 # endif
jpayne@69 123
jpayne@69 124 /* -------------------------------- VOS ----------------------------------- */
jpayne@69 125 # if defined(__VOS__) && !defined(OPENSSL_SYS_VOS)
jpayne@69 126 # define OPENSSL_SYS_VOS
jpayne@69 127 # ifdef __HPPA__
jpayne@69 128 # define OPENSSL_SYS_VOS_HPPA
jpayne@69 129 # endif
jpayne@69 130 # ifdef __IA32__
jpayne@69 131 # define OPENSSL_SYS_VOS_IA32
jpayne@69 132 # endif
jpayne@69 133 # endif
jpayne@69 134
jpayne@69 135 /**
jpayne@69 136 * That's it for OS-specific stuff
jpayne@69 137 *****************************************************************************/
jpayne@69 138
jpayne@69 139 /* Specials for I/O an exit */
jpayne@69 140 # ifdef OPENSSL_SYS_MSDOS
jpayne@69 141 # define OPENSSL_UNISTD_IO <io.h>
jpayne@69 142 # define OPENSSL_DECLARE_EXIT extern void exit(int);
jpayne@69 143 # else
jpayne@69 144 # define OPENSSL_UNISTD_IO OPENSSL_UNISTD
jpayne@69 145 # define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
jpayne@69 146 # endif
jpayne@69 147
jpayne@69 148 /*-
jpayne@69 149 * OPENSSL_EXTERN is normally used to declare a symbol with possible extra
jpayne@69 150 * attributes to handle its presence in a shared library.
jpayne@69 151 * OPENSSL_EXPORT is used to define a symbol with extra possible attributes
jpayne@69 152 * to make it visible in a shared library.
jpayne@69 153 * Care needs to be taken when a header file is used both to declare and
jpayne@69 154 * define symbols. Basically, for any library that exports some global
jpayne@69 155 * variables, the following code must be present in the header file that
jpayne@69 156 * declares them, before OPENSSL_EXTERN is used:
jpayne@69 157 *
jpayne@69 158 * #ifdef SOME_BUILD_FLAG_MACRO
jpayne@69 159 * # undef OPENSSL_EXTERN
jpayne@69 160 * # define OPENSSL_EXTERN OPENSSL_EXPORT
jpayne@69 161 * #endif
jpayne@69 162 *
jpayne@69 163 * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN
jpayne@69 164 * have some generally sensible values.
jpayne@69 165 */
jpayne@69 166
jpayne@69 167 # if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
jpayne@69 168 # define OPENSSL_EXPORT extern __declspec(dllexport)
jpayne@69 169 # define OPENSSL_EXTERN extern __declspec(dllimport)
jpayne@69 170 # else
jpayne@69 171 # define OPENSSL_EXPORT extern
jpayne@69 172 # define OPENSSL_EXTERN extern
jpayne@69 173 # endif
jpayne@69 174
jpayne@69 175 /*-
jpayne@69 176 * Macros to allow global variables to be reached through function calls when
jpayne@69 177 * required (if a shared library version requires it, for example.
jpayne@69 178 * The way it's done allows definitions like this:
jpayne@69 179 *
jpayne@69 180 * // in foobar.c
jpayne@69 181 * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
jpayne@69 182 * // in foobar.h
jpayne@69 183 * OPENSSL_DECLARE_GLOBAL(int,foobar);
jpayne@69 184 * #define foobar OPENSSL_GLOBAL_REF(foobar)
jpayne@69 185 */
jpayne@69 186 # ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
jpayne@69 187 # define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \
jpayne@69 188 type *_shadow_##name(void) \
jpayne@69 189 { static type _hide_##name=value; return &_hide_##name; }
jpayne@69 190 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
jpayne@69 191 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
jpayne@69 192 # else
jpayne@69 193 # define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value;
jpayne@69 194 # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
jpayne@69 195 # define OPENSSL_GLOBAL_REF(name) _shadow_##name
jpayne@69 196 # endif
jpayne@69 197
jpayne@69 198 # ifdef _WIN32
jpayne@69 199 # ifdef _WIN64
jpayne@69 200 # define ossl_ssize_t __int64
jpayne@69 201 # define OSSL_SSIZE_MAX _I64_MAX
jpayne@69 202 # else
jpayne@69 203 # define ossl_ssize_t int
jpayne@69 204 # define OSSL_SSIZE_MAX INT_MAX
jpayne@69 205 # endif
jpayne@69 206 # endif
jpayne@69 207
jpayne@69 208 # if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t)
jpayne@69 209 # define ossl_ssize_t INTN
jpayne@69 210 # define OSSL_SSIZE_MAX MAX_INTN
jpayne@69 211 # endif
jpayne@69 212
jpayne@69 213 # ifndef ossl_ssize_t
jpayne@69 214 # define ossl_ssize_t ssize_t
jpayne@69 215 # if defined(SSIZE_MAX)
jpayne@69 216 # define OSSL_SSIZE_MAX SSIZE_MAX
jpayne@69 217 # elif defined(_POSIX_SSIZE_MAX)
jpayne@69 218 # define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
jpayne@69 219 # else
jpayne@69 220 # define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1))
jpayne@69 221 # endif
jpayne@69 222 # endif
jpayne@69 223
jpayne@69 224 # ifdef DEBUG_UNUSED
jpayne@69 225 # define __owur __attribute__((__warn_unused_result__))
jpayne@69 226 # else
jpayne@69 227 # define __owur
jpayne@69 228 # endif
jpayne@69 229
jpayne@69 230 /* Standard integer types */
jpayne@69 231 # if defined(OPENSSL_SYS_UEFI)
jpayne@69 232 typedef INT8 int8_t;
jpayne@69 233 typedef UINT8 uint8_t;
jpayne@69 234 typedef INT16 int16_t;
jpayne@69 235 typedef UINT16 uint16_t;
jpayne@69 236 typedef INT32 int32_t;
jpayne@69 237 typedef UINT32 uint32_t;
jpayne@69 238 typedef INT64 int64_t;
jpayne@69 239 typedef UINT64 uint64_t;
jpayne@69 240 # elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
jpayne@69 241 defined(__osf__) || defined(__sgi) || defined(__hpux) || \
jpayne@69 242 defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__)
jpayne@69 243 # include <inttypes.h>
jpayne@69 244 # elif defined(_MSC_VER) && _MSC_VER<1600
jpayne@69 245 /*
jpayne@69 246 * minimally required typdefs for systems not supporting inttypes.h or
jpayne@69 247 * stdint.h: currently just older VC++
jpayne@69 248 */
jpayne@69 249 typedef signed char int8_t;
jpayne@69 250 typedef unsigned char uint8_t;
jpayne@69 251 typedef short int16_t;
jpayne@69 252 typedef unsigned short uint16_t;
jpayne@69 253 typedef int int32_t;
jpayne@69 254 typedef unsigned int uint32_t;
jpayne@69 255 typedef __int64 int64_t;
jpayne@69 256 typedef unsigned __int64 uint64_t;
jpayne@69 257 # else
jpayne@69 258 # include <stdint.h>
jpayne@69 259 # endif
jpayne@69 260
jpayne@69 261 /* ossl_inline: portable inline definition usable in public headers */
jpayne@69 262 # if !defined(inline) && !defined(__cplusplus)
jpayne@69 263 # if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
jpayne@69 264 /* just use inline */
jpayne@69 265 # define ossl_inline inline
jpayne@69 266 # elif defined(__GNUC__) && __GNUC__>=2
jpayne@69 267 # define ossl_inline __inline__
jpayne@69 268 # elif defined(_MSC_VER)
jpayne@69 269 /*
jpayne@69 270 * Visual Studio: inline is available in C++ only, however
jpayne@69 271 * __inline is available for C, see
jpayne@69 272 * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
jpayne@69 273 */
jpayne@69 274 # define ossl_inline __inline
jpayne@69 275 # else
jpayne@69 276 # define ossl_inline
jpayne@69 277 # endif
jpayne@69 278 # else
jpayne@69 279 # define ossl_inline inline
jpayne@69 280 # endif
jpayne@69 281
jpayne@69 282 # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \
jpayne@69 283 !defined(__cplusplus)
jpayne@69 284 # define ossl_noreturn _Noreturn
jpayne@69 285 # elif defined(__GNUC__) && __GNUC__ >= 2
jpayne@69 286 # define ossl_noreturn __attribute__((noreturn))
jpayne@69 287 # else
jpayne@69 288 # define ossl_noreturn
jpayne@69 289 # endif
jpayne@69 290
jpayne@69 291 /* ossl_unused: portable unused attribute for use in public headers */
jpayne@69 292 # if defined(__GNUC__)
jpayne@69 293 # define ossl_unused __attribute__((unused))
jpayne@69 294 # else
jpayne@69 295 # define ossl_unused
jpayne@69 296 # endif
jpayne@69 297
jpayne@69 298 #ifdef __cplusplus
jpayne@69 299 }
jpayne@69 300 #endif
jpayne@69 301 #endif