e_os2.h revision 284285
155714Skris/* e_os2.h */ 2109998Smarkm/* ==================================================================== 3109998Smarkm * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. 4109998Smarkm * 5109998Smarkm * Redistribution and use in source and binary forms, with or without 6109998Smarkm * modification, are permitted provided that the following conditions 7109998Smarkm * are met: 8109998Smarkm * 9109998Smarkm * 1. Redistributions of source code must retain the above copyright 10280304Sjkim * notice, this list of conditions and the following disclaimer. 11109998Smarkm * 12109998Smarkm * 2. Redistributions in binary form must reproduce the above copyright 13109998Smarkm * notice, this list of conditions and the following disclaimer in 14109998Smarkm * the documentation and/or other materials provided with the 15109998Smarkm * distribution. 16109998Smarkm * 17109998Smarkm * 3. All advertising materials mentioning features or use of this 18109998Smarkm * software must display the following acknowledgment: 19109998Smarkm * "This product includes software developed by the OpenSSL Project 20109998Smarkm * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21109998Smarkm * 22109998Smarkm * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23109998Smarkm * endorse or promote products derived from this software without 24109998Smarkm * prior written permission. For written permission, please contact 25109998Smarkm * openssl-core@openssl.org. 26109998Smarkm * 27109998Smarkm * 5. Products derived from this software may not be called "OpenSSL" 28109998Smarkm * nor may "OpenSSL" appear in their names without prior written 29109998Smarkm * permission of the OpenSSL Project. 30109998Smarkm * 31109998Smarkm * 6. Redistributions of any form whatsoever must retain the following 32109998Smarkm * acknowledgment: 33109998Smarkm * "This product includes software developed by the OpenSSL Project 34109998Smarkm * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35109998Smarkm * 36109998Smarkm * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37109998Smarkm * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38109998Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39109998Smarkm * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40109998Smarkm * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41109998Smarkm * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42109998Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43109998Smarkm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44109998Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45109998Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46109998Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47109998Smarkm * OF THE POSSIBILITY OF SUCH DAMAGE. 48109998Smarkm * ==================================================================== 49109998Smarkm * 50109998Smarkm * This product includes cryptographic software written by Eric Young 51109998Smarkm * (eay@cryptsoft.com). This product includes software written by Tim 52109998Smarkm * Hudson (tjh@cryptsoft.com). 53109998Smarkm * 54109998Smarkm */ 5555714Skris 56109998Smarkm#include <openssl/opensslconf.h> 57109998Smarkm 5855714Skris#ifndef HEADER_E_OS2_H 59280304Sjkim# define HEADER_E_OS2_H 6055714Skris 6155714Skris#ifdef __cplusplus 6255714Skrisextern "C" { 6355714Skris#endif 6455714Skris 65109998Smarkm/****************************************************************************** 66109998Smarkm * Detect operating systems. This probably needs completing. 67109998Smarkm * The result is that at least one OPENSSL_SYS_os macro should be defined. 68109998Smarkm * However, if none is defined, Unix is assumed. 69109998Smarkm **/ 70109998Smarkm 71280304Sjkim# define OPENSSL_SYS_UNIX 72109998Smarkm 73280304Sjkim/* ---------------------- Macintosh, before MacOS X ----------------------- */ 74280304Sjkim# if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) 75280304Sjkim# undef OPENSSL_SYS_UNIX 76280304Sjkim# define OPENSSL_SYS_MACINTOSH_CLASSIC 77280304Sjkim# endif 78109998Smarkm 79280304Sjkim/* ---------------------- NetWare ----------------------------------------- */ 80280304Sjkim# if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) 81280304Sjkim# undef OPENSSL_SYS_UNIX 82280304Sjkim# define OPENSSL_SYS_NETWARE 83280304Sjkim# endif 84160814Ssimon 85280304Sjkim/* --------------------- Microsoft operating systems ---------------------- */ 86109998Smarkm 87280304Sjkim/* 88280304Sjkim * Note that MSDOS actually denotes 32-bit environments running on top of 89280304Sjkim * MS-DOS, such as DJGPP one. 90280304Sjkim */ 91280304Sjkim# if defined(OPENSSL_SYSNAME_MSDOS) 92280304Sjkim# undef OPENSSL_SYS_UNIX 93280304Sjkim# define OPENSSL_SYS_MSDOS 94280304Sjkim# endif 95109998Smarkm 96280304Sjkim/* 97280304Sjkim * For 32 bit environment, there seems to be the CygWin environment and then 98280304Sjkim * all the others that try to do the same thing Microsoft does... 99280304Sjkim */ 100280304Sjkim# if defined(OPENSSL_SYSNAME_UWIN) 101109998Smarkm# undef OPENSSL_SYS_UNIX 102280304Sjkim# define OPENSSL_SYS_WIN32_UWIN 103109998Smarkm# else 104280304Sjkim# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) 105109998Smarkm# undef OPENSSL_SYS_UNIX 106280304Sjkim# define OPENSSL_SYS_WIN32_CYGWIN 107280304Sjkim# else 108280304Sjkim# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) 109280304Sjkim# undef OPENSSL_SYS_UNIX 110280304Sjkim# define OPENSSL_SYS_WIN32 111280304Sjkim# endif 112284285Sjkim# if defined(_WIN64) || defined(OPENSSL_SYSNAME_WIN64) 113284285Sjkim# undef OPENSSL_SYS_UNIX 114284285Sjkim# if !defined(OPENSSL_SYS_WIN64) 115284285Sjkim# define OPENSSL_SYS_WIN64 116284285Sjkim# endif 117284285Sjkim# endif 118280304Sjkim# if defined(OPENSSL_SYSNAME_WINNT) 119280304Sjkim# undef OPENSSL_SYS_UNIX 120280304Sjkim# define OPENSSL_SYS_WINNT 121280304Sjkim# endif 122280304Sjkim# if defined(OPENSSL_SYSNAME_WINCE) 123280304Sjkim# undef OPENSSL_SYS_UNIX 124280304Sjkim# define OPENSSL_SYS_WINCE 125280304Sjkim# endif 126109998Smarkm# endif 127109998Smarkm# endif 128109998Smarkm 129109998Smarkm/* Anything that tries to look like Microsoft is "Windows" */ 130284285Sjkim# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) 131280304Sjkim# undef OPENSSL_SYS_UNIX 132280304Sjkim# define OPENSSL_SYS_WINDOWS 133280304Sjkim# ifndef OPENSSL_SYS_MSDOS 134280304Sjkim# define OPENSSL_SYS_MSDOS 135280304Sjkim# endif 136109998Smarkm# endif 137109998Smarkm 138280304Sjkim/* 139280304Sjkim * DLL settings. This part is a bit tough, because it's up to the 140280304Sjkim * application implementor how he or she will link the application, so it 141280304Sjkim * requires some macro to be used. 142280304Sjkim */ 143280304Sjkim# ifdef OPENSSL_SYS_WINDOWS 144280304Sjkim# ifndef OPENSSL_OPT_WINDLL 145280304Sjkim# if defined(_WINDLL) /* This is used when building OpenSSL to 146280304Sjkim * indicate that DLL linkage should be used */ 147280304Sjkim# define OPENSSL_OPT_WINDLL 148280304Sjkim# endif 149109998Smarkm# endif 150109998Smarkm# endif 151109998Smarkm 152280304Sjkim/* ------------------------------- OpenVMS -------------------------------- */ 153280304Sjkim# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) 154280304Sjkim# undef OPENSSL_SYS_UNIX 155280304Sjkim# define OPENSSL_SYS_VMS 156280304Sjkim# if defined(__DECC) 157280304Sjkim# define OPENSSL_SYS_VMS_DECC 158280304Sjkim# elif defined(__DECCXX) 159280304Sjkim# define OPENSSL_SYS_VMS_DECC 160280304Sjkim# define OPENSSL_SYS_VMS_DECCXX 161280304Sjkim# else 162280304Sjkim# define OPENSSL_SYS_VMS_NODECC 163280304Sjkim# endif 164109998Smarkm# endif 165109998Smarkm 166280304Sjkim/* -------------------------------- OS/2 ---------------------------------- */ 167280304Sjkim# if defined(__EMX__) || defined(__OS2__) 168280304Sjkim# undef OPENSSL_SYS_UNIX 169280304Sjkim# define OPENSSL_SYS_OS2 170280304Sjkim# endif 171109998Smarkm 172280304Sjkim/* -------------------------------- Unix ---------------------------------- */ 173280304Sjkim# ifdef OPENSSL_SYS_UNIX 174280304Sjkim# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) 175280304Sjkim# define OPENSSL_SYS_LINUX 176280304Sjkim# endif 177280304Sjkim# ifdef OPENSSL_SYSNAME_MPE 178280304Sjkim# define OPENSSL_SYS_MPE 179280304Sjkim# endif 180280304Sjkim# ifdef OPENSSL_SYSNAME_SNI 181280304Sjkim# define OPENSSL_SYS_SNI 182280304Sjkim# endif 183280304Sjkim# ifdef OPENSSL_SYSNAME_ULTRASPARC 184280304Sjkim# define OPENSSL_SYS_ULTRASPARC 185280304Sjkim# endif 186280304Sjkim# ifdef OPENSSL_SYSNAME_NEWS4 187280304Sjkim# define OPENSSL_SYS_NEWS4 188280304Sjkim# endif 189280304Sjkim# ifdef OPENSSL_SYSNAME_MACOSX 190280304Sjkim# define OPENSSL_SYS_MACOSX 191280304Sjkim# endif 192280304Sjkim# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY 193280304Sjkim# define OPENSSL_SYS_MACOSX_RHAPSODY 194280304Sjkim# define OPENSSL_SYS_MACOSX 195280304Sjkim# endif 196280304Sjkim# ifdef OPENSSL_SYSNAME_SUNOS 197280304Sjkim# define OPENSSL_SYS_SUNOS 198280304Sjkim# endif 199280304Sjkim# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) 200280304Sjkim# define OPENSSL_SYS_CRAY 201280304Sjkim# endif 202280304Sjkim# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) 203280304Sjkim# define OPENSSL_SYS_AIX 204280304Sjkim# endif 205109998Smarkm# endif 206280304Sjkim 207280304Sjkim/* -------------------------------- VOS ----------------------------------- */ 208280304Sjkim# if defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS) 209280304Sjkim# define OPENSSL_SYS_VOS 210280304Sjkim# ifdef __HPPA__ 211280304Sjkim# define OPENSSL_SYS_VOS_HPPA 212280304Sjkim# endif 213280304Sjkim# ifdef __IA32__ 214280304Sjkim# define OPENSSL_SYS_VOS_IA32 215280304Sjkim# endif 216109998Smarkm# endif 217280304Sjkim 218280304Sjkim/* ------------------------------ VxWorks --------------------------------- */ 219280304Sjkim# ifdef OPENSSL_SYSNAME_VXWORKS 220280304Sjkim# define OPENSSL_SYS_VXWORKS 221109998Smarkm# endif 222109998Smarkm 223280304Sjkim/* -------------------------------- BeOS ---------------------------------- */ 224280304Sjkim# if defined(__BEOS__) 225280304Sjkim# define OPENSSL_SYS_BEOS 226280304Sjkim# include <sys/socket.h> 227280304Sjkim# if defined(BONE_VERSION) 228280304Sjkim# define OPENSSL_SYS_BEOS_BONE 229280304Sjkim# else 230280304Sjkim# define OPENSSL_SYS_BEOS_R5 231280304Sjkim# endif 232238405Sjkim# endif 233238405Sjkim 234109998Smarkm/** 235109998Smarkm * That's it for OS-specific stuff 236109998Smarkm *****************************************************************************/ 237109998Smarkm 238109998Smarkm/* Specials for I/O an exit */ 239280304Sjkim# ifdef OPENSSL_SYS_MSDOS 240280304Sjkim# define OPENSSL_UNISTD_IO <io.h> 241280304Sjkim# define OPENSSL_DECLARE_EXIT extern void exit(int); 242280304Sjkim# else 243280304Sjkim# define OPENSSL_UNISTD_IO OPENSSL_UNISTD 244280304Sjkim# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ 245280304Sjkim# endif 24655714Skris 247280304Sjkim/*- 248280304Sjkim * Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare 249280304Sjkim * certain global symbols that, with some compilers under VMS, have to be 250280304Sjkim * defined and declared explicitely with globaldef and globalref. 251280304Sjkim * Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare 252280304Sjkim * DLL exports and imports for compilers under Win32. These are a little 253280304Sjkim * more complicated to use. Basically, for any library that exports some 254280304Sjkim * global variables, the following code must be present in the header file 255280304Sjkim * that declares them, before OPENSSL_EXTERN is used: 256280304Sjkim * 257280304Sjkim * #ifdef SOME_BUILD_FLAG_MACRO 258280304Sjkim * # undef OPENSSL_EXTERN 259280304Sjkim * # define OPENSSL_EXTERN OPENSSL_EXPORT 260280304Sjkim * #endif 261280304Sjkim * 262280304Sjkim * The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL 263280304Sjkim * have some generally sensible values, and for OPENSSL_EXTERN to have the 264280304Sjkim * value OPENSSL_IMPORT. 265280304Sjkim */ 26655714Skris 267280304Sjkim# if defined(OPENSSL_SYS_VMS_NODECC) 268280304Sjkim# define OPENSSL_EXPORT globalref 269280304Sjkim# define OPENSSL_IMPORT globalref 270280304Sjkim# define OPENSSL_GLOBAL globaldef 271280304Sjkim# elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) 272280304Sjkim# define OPENSSL_EXPORT extern __declspec(dllexport) 273280304Sjkim# define OPENSSL_IMPORT extern __declspec(dllimport) 274280304Sjkim# define OPENSSL_GLOBAL 275280304Sjkim# else 276280304Sjkim# define OPENSSL_EXPORT extern 277280304Sjkim# define OPENSSL_IMPORT extern 278280304Sjkim# define OPENSSL_GLOBAL 279280304Sjkim# endif 280280304Sjkim# define OPENSSL_EXTERN OPENSSL_IMPORT 281109998Smarkm 282280304Sjkim/*- 283280304Sjkim * Macros to allow global variables to be reached through function calls when 284280304Sjkim * required (if a shared library version requires it, for example. 285280304Sjkim * The way it's done allows definitions like this: 286280304Sjkim * 287280304Sjkim * // in foobar.c 288280304Sjkim * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) 289280304Sjkim * // in foobar.h 290280304Sjkim * OPENSSL_DECLARE_GLOBAL(int,foobar); 291280304Sjkim * #define foobar OPENSSL_GLOBAL_REF(foobar) 292280304Sjkim */ 293280304Sjkim# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION 294280304Sjkim# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ 295280304Sjkim type *_shadow_##name(void) \ 296280304Sjkim { static type _hide_##name=value; return &_hide_##name; } 297280304Sjkim# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) 298280304Sjkim# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) 299280304Sjkim# else 300280304Sjkim# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value; 301280304Sjkim# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name 302280304Sjkim# define OPENSSL_GLOBAL_REF(name) _shadow_##name 303280304Sjkim# endif 304109998Smarkm 305280304Sjkim# if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE) 306238405Sjkim# define ossl_ssize_t long 307280304Sjkim# endif 308238405Sjkim 309280304Sjkim# ifdef OPENSSL_SYS_MSDOS 310238405Sjkim# define ossl_ssize_t long 311280304Sjkim# endif 312238405Sjkim 313280304Sjkim# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) 314238405Sjkim# define ssize_t int 315280304Sjkim# endif 316238405Sjkim 317280304Sjkim# if defined(__ultrix) && !defined(ssize_t) 318280304Sjkim# define ossl_ssize_t int 319280304Sjkim# endif 320238405Sjkim 321280304Sjkim# ifndef ossl_ssize_t 322238405Sjkim# define ossl_ssize_t ssize_t 323280304Sjkim# endif 324238405Sjkim 32555714Skris#ifdef __cplusplus 32655714Skris} 32755714Skris#endif 32855714Skris#endif 329