1 /* HSTDINC.H (c) Copyright Roger Bowler, 1999-2009 */ 2 /* Hercules precompilation-eligible Header Files */ 3 4 /* This file contains #include statements for all of the header */ 5 /* files which are not dependent on the mainframe architectural */ 6 /* features selected and thus are eligible for precompilation */ 7 8 #ifndef _HSTDINC_H 9 #define _HSTDINC_H 10 11 #ifdef HAVE_CONFIG_H 12 #include <config.h> // Hercules build configuration options/settings 13 #endif 14 15 /////////////////////////////////////////////////////////////////////// 16 // Required and optional SYSTEM headers... 17 ////////////////////////////////////////////////////////////////////// 18 19 #define _REENTRANT /* Ensure that reentrant code is generated *JJ */ 20 #define _THREAD_SAFE /* Some systems use this instead *JJ */ 21 22 #if defined(HAVE_STRSIGNAL) && defined(__GNUC__) && !defined(_GNU_SOURCE) 23 #define _GNU_SOURCE /* required by strsignal() *JJ */ 24 #endif 25 26 /* Required headers -- These we ALWAYS need to have... */ 27 28 #ifdef _MSVC_ 29 // The following ensures certain functions get defined... 30 // (such as TryEnterCriticalSection and InitializeCriticalSectionAndSpinCount) 31 #ifndef _WIN32_WINNT 32 #define _WIN32_WINNT 0x0403 // Windows 98 or WinNT SP4 or greater 33 #endif 34 #include <winsock2.h> // Windows Sockets 2 35 #include <mstcpip.h> // (need struct tcp_keepalive) 36 #endif 37 #ifdef WIN32 38 #include <windows.h> 39 #endif 40 #ifdef _MSVC_ 41 #include <tchar.h> 42 #include <wincon.h> 43 #include <conio.h> 44 #include <io.h> 45 #include <lmcons.h> 46 #include <tlhelp32.h> 47 #include <dbghelp.h> 48 #include <crtdbg.h> 49 #endif 50 51 #include <stdio.h> 52 #include <stdlib.h> 53 #include <stdarg.h> 54 #include <string.h> 55 #include <setjmp.h> 56 #include <ctype.h> 57 #include <errno.h> 58 #include <fcntl.h> 59 #ifndef O_BINARY 60 #define O_BINARY 0 61 #endif 62 #ifndef O_NONBLOCK 63 #define O_NONBLOCK 0 64 #endif 65 #include <limits.h> 66 #include <time.h> 67 #include <sys/stat.h> 68 #if !defined(_MSVC_) 69 #include <sys/time.h> 70 #include <sys/ioctl.h> 71 #endif 72 #include <sys/types.h> 73 74 /* Optional headers -- These we can live without */ 75 76 /* PROGRAMMING NOTE: On Darwin, <sys/socket.h> must be included before 77 <net/if.h>, and on older Darwin systems, before <net/route.h> and 78 <netinet/in.h> */ 79 #ifdef HAVE_SYS_SOCKET_H 80 #include <sys/socket.h> 81 #endif 82 #ifdef HAVE_ARPA_INET_H 83 #include <arpa/inet.h> 84 #endif 85 #if defined(BUILD_HERCIFC) 86 #ifdef HAVE_LINUX_IF_TUN_H 87 #include <linux/if_tun.h> 88 #endif 89 #ifdef HAVE_NET_ROUTE_H 90 #include <net/route.h> 91 #endif 92 #endif 93 // (just make it easier to #include hercifc.h) 94 #if defined(BUILD_HERCIFC) || defined(_MSVC_) || !defined(HAVE_LINUX_IF_TUN_H) || !defined(HAVE_NET_IF_H) 95 #define NEED_HERCIFC_H 96 #endif 97 #ifdef HAVE_NET_IF_H 98 #include <net/if.h> 99 #endif 100 #ifdef HAVE_NETINET_IN_H 101 #include <netinet/in.h> 102 #endif 103 #ifdef HAVE_NETINET_TCP_H 104 #include <netinet/tcp.h> 105 #endif 106 #ifdef HAVE_SYS_IOCTL_H 107 #include <sys/ioctl.h> 108 #endif 109 #ifdef HAVE_SYS_MMAN_H 110 #include <sys/mman.h> 111 #endif 112 #ifdef HAVE_SYS_PARAM_H 113 #include <sys/param.h> 114 #endif 115 #ifdef HAVE_SYS_MOUNT_H 116 #include <sys/mount.h> 117 #endif 118 #ifdef HAVE_SYS_MTIO_H 119 #include <sys/mtio.h> 120 #endif 121 #ifdef HAVE_SYS_RESOURCE_H 122 #include <sys/resource.h> 123 #endif 124 #ifdef HAVE_SYS_UN_H 125 #include <sys/un.h> 126 #endif 127 #ifdef HAVE_SYS_UIO_H 128 #include <sys/uio.h> 129 #endif 130 #ifdef HAVE_SYS_UTSNAME_H 131 #include <sys/utsname.h> 132 #endif 133 #ifdef HAVE_SYS_WAIT_H 134 #include <sys/wait.h> 135 #endif 136 #ifdef HAVE_BYTESWAP_H 137 #ifndef NO_ASM_BYTESWAP 138 #include <byteswap.h> 139 #endif 140 #endif 141 #ifdef HAVE_BZLIB_H 142 // windows.h #defines 'small' as char and bzlib.h 143 // uses it for a variable name so we must #undef. 144 #if defined(__CYGWIN__) 145 #undef small 146 #endif 147 #include <bzlib.h> 148 /* ISW 20050427 : CCKD_BZIP2/HET_BZIP2 are usually */ 149 /* controlled by config.h (automagic). If config.h */ 150 /* is not present however, then define them here. */ 151 #if !defined(HAVE_CONFIG_H) 152 #define CCKD_BZIP2 153 #define HET_BZIP2 154 #endif 155 #endif 156 #ifdef HAVE_DIRENT_H 157 #include <dirent.h> 158 #endif 159 #ifdef OPTION_DYNAMIC_LOAD 160 #ifdef HDL_USE_LIBTOOL 161 #include <ltdl.h> 162 #else 163 #if defined(__MINGW__) || defined(_MSVC_) 164 #include "w32dl.h" 165 #else 166 #include <dlfcn.h> 167 #endif 168 #endif 169 #endif 170 #ifdef HAVE_ICONV 171 #include <iconv.h> 172 #endif 173 #ifdef HAVE_INTTYPES_H 174 #include <inttypes.h> 175 #endif 176 #ifdef HAVE_MALLOC_H 177 #include <malloc.h> 178 #endif 179 #ifdef HAVE_MATH_H 180 #include <math.h> 181 #endif 182 #ifdef HAVE_NETDB_H 183 #include <netdb.h> 184 #endif 185 #ifdef HAVE_PWD_H 186 #include <pwd.h> 187 #endif 188 #ifdef HAVE_REGEX_H 189 #include <regex.h> 190 #endif 191 #ifdef HAVE_SCHED_H 192 #include <sched.h> 193 #endif 194 #ifdef HAVE_SIGNAL_H 195 #include <signal.h> 196 #endif 197 #ifdef HAVE_TIME_H 198 #include <time.h> 199 #endif 200 #ifdef HAVE_TERMIOS_H 201 #include <termios.h> 202 #endif 203 #ifdef HAVE_ZLIB_H 204 #include <zlib.h> 205 #endif 206 #ifdef HAVE_SYS_CAPABILITY_H 207 #include <sys/capability.h> 208 #endif 209 #ifdef HAVE_SYS_PRCTL_H 210 #include <sys/prctl.h> 211 #endif 212 213 // Some Hercules specific files, NOT guest arch dependent 214 #if defined(_MSVC_) 215 #include "hercwind.h" // Hercules definitions for Windows 216 #else 217 #include <unistd.h> // Unix standard definitions 218 #endif 219 220 #ifdef C99_FLEXIBLE_ARRAYS 221 #define FLEXIBLE_ARRAY // ("DEVBLK *memdev[];" syntax is supported) 222 #else 223 #define FLEXIBLE_ARRAY 0 // ("DEVBLK *memdev[0];" must be used instead) 224 #endif 225 226 #include "hostopts.h" // Must come before htypes.h 227 #include "htypes.h" // Hercules-wide data types 228 229 #endif // _HSTDINC_H 230