1 /* HCONSTS.H (c) Copyright "Fish" (David B. Trout), 2005-2009 */ 2 /* Hercules constants */ 3 4 #ifndef _HCONSTS_H 5 #define _HCONSTS_H 6 7 #include "hercules.h" 8 9 /*-------------------------------------------------------------------*/ 10 /* Miscellaneous system related constants we could be missing... */ 11 /*-------------------------------------------------------------------*/ 12 13 #ifndef MAX_PATH 14 #ifdef PATH_MAX 15 #define MAX_PATH PATH_MAX 16 #else 17 #define MAX_PATH 4096 18 #endif 19 #endif 20 21 #ifndef PATH_SEP 22 #ifdef _MSVC_ 23 #define PATH_SEP "\\" 24 #else 25 #define PATH_SEP "/" 26 #endif 27 #endif 28 29 #if defined( _MSVC_ ) 30 31 // The following are missing from MINGW32/MSVC... 32 33 #ifndef S_IRGRP 34 #define S_IRGRP 0 35 #endif 36 37 #ifndef S_IWGRP 38 #define S_IWGRP 0 39 #endif 40 41 #ifndef SIGUSR2 // (needs defined for OPTION_WAKEUP_SELECT_VIA_PIPE) 42 #define SIGUSR2 31 // (the value's unimportant, but we'll be accurate) 43 #endif 44 45 #ifndef IFNAMSIZ 46 #define IFNAMSIZ 16 47 #endif 48 49 #ifndef IFHWADDRLEN 50 #define IFHWADDRLEN 6 51 #endif 52 53 #ifndef EFAULT 54 #if defined (WSAEFAULT) 55 #define EFAULT WSAEFAULT 56 #else 57 #define EFAULT 14 58 #endif 59 #endif 60 61 #ifndef ENOSYS 62 #if defined (WSASYSCALLFAILURE) 63 #define ENOSYS WSASYSCALLFAILURE 64 #else 65 #define ENOSYS 88 66 #endif 67 #endif 68 69 #ifndef EOPNOTSUPP 70 #if defined (WSAEOPNOTSUPP) 71 #define EOPNOTSUPP WSAEOPNOTSUPP 72 #else 73 #define EOPNOTSUPP 95 74 #endif 75 #endif 76 77 #ifndef ECONNRESET 78 #if defined (WSAECONNRESET) 79 #define ECONNRESET WSAECONNRESET 80 #else 81 #define ECONNRESET 104 82 #endif 83 #endif 84 85 #ifndef ENOBUFS 86 #if defined (ENOMEM) 87 #define ENOBUFS ENOMEM 88 #else 89 #define ENOBUFS 105 90 #endif 91 #endif 92 93 #ifndef EAFNOSUPPORT 94 #if defined (WSAEAFNOSUPPORT) 95 #define EAFNOSUPPORT WSAEAFNOSUPPORT 96 #else 97 #define EAFNOSUPPORT 106 98 #endif 99 #endif 100 101 #ifndef EPROTOTYPE 102 #if defined (WSAEPROTOTYPE) 103 #define EPROTOTYPE WSAEPROTOTYPE 104 #else 105 #define EPROTOTYPE 107 106 #endif 107 #endif 108 109 #ifndef ENOTSOCK 110 #if defined (WSAENOTSOCK) 111 #define ENOTSOCK WSAENOTSOCK 112 #else 113 #define ENOTSOCK 108 114 #endif 115 #endif 116 117 #ifndef EADDRINUSE 118 #if defined (WSAEADDRINUSE) 119 #define EADDRINUSE WSAEADDRINUSE 120 #else 121 #define EADDRINUSE 112 122 #endif 123 #endif 124 125 #ifndef ENETDOWN 126 #if defined (WSAENETDOWN) 127 #define ENETDOWN WSAENETDOWN 128 #else 129 #define ENETDOWN 115 130 #endif 131 #endif 132 133 #ifndef ETIMEDOUT 134 #if defined (WSAETIMEDOUT) 135 #define ETIMEDOUT WSAETIMEDOUT 136 #else 137 #define ETIMEDOUT 116 138 #endif 139 #endif 140 141 #ifndef EINPROGRESS 142 #if defined (WSAEINPROGRESS) 143 #define EINPROGRESS WSAEINPROGRESS 144 #else 145 #define EINPROGRESS 119 146 #endif 147 #endif 148 149 #ifndef EMSGSIZE 150 #if defined (E2BIG) 151 #define EMSGSIZE E2BIG 152 #else 153 #define EMSGSIZE 122 154 #endif 155 #endif 156 157 #ifndef EPROTONOSUPPORT 158 #if defined (WSAEPROTONOSUPPORT) 159 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT 160 #else 161 #define EPROTONOSUPPORT 123 162 #endif 163 #endif 164 165 #ifndef ENOTCONN 166 #if defined (WSAENOTCONN) 167 #define ENOTCONN WSAENOTCONN 168 #else 169 #define ENOTCONN 128 170 #endif 171 #endif 172 173 #ifndef ENOTSUP 174 #if defined (ENOSYS) 175 #define ENOTSUP ENOSYS 176 #else 177 #define ENOTSUP 134 178 #endif 179 #endif 180 181 #ifndef ENOMEDIUM 182 #if defined (ENOENT) 183 #define ENOMEDIUM ENOENT 184 #else 185 #define ENOMEDIUM 135 186 #endif 187 #endif 188 189 #ifndef EOVERFLOW 190 #if defined (ERANGE) 191 #define EOVERFLOW ERANGE 192 #else 193 #define EOVERFLOW 139 194 #endif 195 #endif 196 197 #endif // defined(_MSVC_) 198 199 // CLK_TCK not part of SUSE 7.2 specs; added. (VB) 200 #ifndef CLK_TCK 201 #define CLK_TCK CLOCKS_PER_SEC 202 #endif 203 204 /*-------------------------------------------------------------------*/ 205 /* Console tn3270/telnet session TCP "Keep-Alive" values... */ 206 /*-------------------------------------------------------------------*/ 207 #define KEEPALIVE_IDLE_TIME 3 /* Idle time to first probe */ 208 #define KEEPALIVE_PROBE_INTERVAL 1 /* Probe timeout value */ 209 #define KEEPALIVE_PROBE_COUNT 10 /* Max probe timeouts */ 210 211 /*-------------------------------------------------------------------*/ 212 /* Miscellaneous Hercules-related constants... */ 213 /*-------------------------------------------------------------------*/ 214 215 #define SPACE ' ' /* <---<<< Look close! There's a space there! */ 216 217 /* Definitions for OS tailoring - msb eq mon event, lsb eq oper exc. */ 218 #define OS_NONE 0x7FFFFFFFF7DE7FFFULL /* No spec OS tail. */ 219 #define OS_OS390 0x7FF673FFF7DE7FFDULL /* OS/390 */ 220 #define OS_ZOS 0x7B7673FFF7DE7FB7ULL /* z/OS */ 221 #define OS_VSE 0x7FF673FFF7DE7FFFULL /* VSE */ 222 #define OS_VM 0x7FFFFFFFF7DE7FFCULL /* VM */ 223 #define OS_OPENSOLARIS 0xF8FFFFFFFFDE7FF7ULL /* OpenSolaris */ 224 #define OS_LINUX 0x78FFFFFFF7DE7FF7ULL /* Linux */ 225 226 /* Definitions for program product OS restriction flag. This flag is ORed 227 with the SCLP READ CPU INFO response code. A 4 here makes the CPU look 228 like an IFL (Integrated Facility for Linux) engine, which cannot run 229 licensed ESA/390 or z/Architecture OSes. */ 230 #define PGM_PRD_OS_RESTRICTED 4 /* Restricted */ 231 #define PGM_PRD_OS_LICENSED 0 /* Licensed */ 232 233 /* Storage access bits used by logical_to_main */ 234 #define ACC_CHECK 0x0001 /* Possible storage update*/ 235 #define ACC_WRITE 0x0002 /* Storage update */ 236 #define ACC_READ 0x0004 /* Storage read */ 237 238 /* Storage access bits used by other dat.h routines */ 239 #define ACC_NOTLB 0x0100 /* Don't do TLB lookup */ 240 #define ACC_PTE 0x0200 /* Return page table entry*/ 241 #define ACC_LPTEA 0x0400 /* Esame page table entry */ 242 #define ACC_SPECIAL_ART 0x0800 /* Used by BSG */ 243 #define ACC_ENH_MC 0x1000 /* Used by Enhanced MC */ 244 245 #define ACCTYPE_HW 0 /* Hardware access */ 246 #define ACCTYPE_INSTFETCH ACC_READ /* Instruction fetch */ 247 #define ACCTYPE_READ ACC_READ /* Read storage */ 248 #define ACCTYPE_WRITE_SKP ACC_CHECK /* Write, skip change bit */ 249 #define ACCTYPE_WRITE ACC_WRITE /* Write storage */ 250 #define ACCTYPE_TAR 0 /* TAR instruction */ 251 #define ACCTYPE_LRA ACC_NOTLB /* LRA instruction */ 252 #define ACCTYPE_TPROT 0 /* TPROT instruction */ 253 #define ACCTYPE_IVSK 0 /* ISVK instruction */ 254 #define ACCTYPE_BSG ACC_SPECIAL_ART /* BSG instruction */ 255 #define ACCTYPE_PTE (ACC_PTE|ACC_NOTLB) /* page table entry */ 256 #define ACCTYPE_SIE 0 /* SIE host access */ 257 #define ACCTYPE_STRAG 0 /* STRAG instruction */ 258 #define ACCTYPE_LPTEA (ACC_LPTEA|ACC_NOTLB) /* LPTEA instruction */ 259 #define ACCTYPE_EMC (ACC_ENH_MC|ACCTYPE_WRITE) /* MC instr. */ 260 261 /* Special value for arn parameter for translate functions in dat.c */ 262 /* _USE_... values for killing the "array subscript" warnings */ 263 #define USE_INST_SPACE 20 /* Instruction space virtual */ 264 #define USE_REAL_ADDR 19 /* Real address */ 265 #define USE_PRIMARY_SPACE 18 /* Primary space virtual */ 266 #define USE_SECONDARY_SPACE 17 /* Secondary space virtual */ 267 #define USE_HOME_SPACE 16 /* Home space virtual */ 268 #define USE_ARMODE 16 /* OR with access register 269 number to force AR mode */ 270 271 /* Interception codes used by longjmp/SIE */ 272 #define SIE_NO_INTERCEPT (-1) /* Continue (after pgmint) */ 273 #define SIE_HOST_INTERRUPT (-2) /* Host interrupt pending */ 274 #define SIE_HOST_PGMINT (-3) /* Host program interrupt */ 275 #define SIE_INTERCEPT_INST (-4) /* Instruction interception */ 276 #define SIE_INTERCEPT_INSTCOMP (-5) /* Instr. int TS/CS/CDS */ 277 #define SIE_INTERCEPT_EXTREQ (-6) /* External interrupt */ 278 #define SIE_INTERCEPT_IOREQ (-7) /* I/O interrupt */ 279 #define SIE_INTERCEPT_WAIT (-8) /* Wait state loaded */ 280 #define SIE_INTERCEPT_STOPREQ (-9) /* STOP reqeust */ 281 #define SIE_INTERCEPT_RESTART (-10) /* Restart interrupt */ 282 #define SIE_INTERCEPT_MCK (-11) /* Machine Check interrupt */ 283 #define SIE_INTERCEPT_EXT (-12) /* External interrupt pending*/ 284 #define SIE_INTERCEPT_VALIDITY (-13) /* SIE validity check */ 285 #define SIE_INTERCEPT_PER (-14) /* SIE guest per event */ 286 #define SIE_INTERCEPT_IOINT (-15) /* I/O Interruption */ 287 #define SIE_INTERCEPT_IOINTP (-16) /* I/O Interruption pending */ 288 #define SIE_INTERCEPT_IOINST (-17) /* I/O Instruction */ 289 290 #if defined(SIE_DEBUG_PERFMON) 291 #define SIE_PERF_ENTER 0 /* SIE performance monitor */ 292 #define SIE_PERF_ENTER_F -31 /* Enter Fast (retain state) */ 293 #define SIE_PERF_EXIT -30 /* SIE exit */ 294 #define SIE_PERF_RUNSIE -29 /* run_sie entered */ 295 #define SIE_PERF_RUNLOOP_1 -28 /* run_sie runloop 1 */ 296 #define SIE_PERF_RUNLOOP_2 -27 /* run_sue runloop 2 */ 297 #define SIE_PERF_INTCHECK -26 /* run_sie intcheck */ 298 #define SIE_PERF_EXEC -25 /* run_sie execute inst */ 299 #define SIE_PERF_EXEC_U -24 /* run_sie unrolled exec */ 300 #endif /*defined(SIE_DEBUG_PERFMON)*/ 301 302 /*-------------------------------------------------------------------*/ 303 /* Definitions for CTC protocol types */ 304 /*-------------------------------------------------------------------*/ 305 306 #define CTC_XCA 1 /* XCA device */ 307 #define CTC_LCS 2 /* LCS device */ 308 #define CTC_CETI 3 /* CETI device */ 309 #define CTC_CLAW 4 /* CLAW device */ 310 #define CTC_CTCN 5 /* CTC link via NETBIOS */ 311 #define CTC_CTCT 6 /* CTC link via TCP */ 312 #define CTC_CTCI 7 /* CTC link to TCP/IP stack */ 313 #define CTC_VMNET 8 /* CTC link via wfk's vmnet */ 314 #define CTC_CFC 9 /* Coupling facility channel */ 315 #define CTC_CTCE 10 /* Enhanced CTC link via TCP */ 316 317 #endif // _HCONSTS_H 318