Files
org-hyperion-cules/hconsts.h
Fish (David B. Trout) a2e06edcc9 Fixes for unreliable console keepalive issue #44:
1. Fix configure.ac tcp.h header and keepalive constant checks and report during ./configure the keepalive support that was detected (none, basic or full).

2. #include the correct tcp.h header in hstdinc.h

3. Issue warning message at build time (during make) when full keepalive support is missing or partial.

4. Report partial or missing keepalive build support via version.c "With" and "Without" messages.

5. Issue error or warning in both impl.c as well as in 'conkpalv' command/statement processing function when keepalive support is either missing or only partially supported. Same for the 2703 device 'ka=' option too.

6. Enhance set_socket_keepalive function to let the caller know not only about failures but also about partial-only successes (so they can be reported).

7. Fix the bad setsockopt call in the Linux version of the set_socket_keepalive function that was using the wrong value, which was at the heart of the problem. (Note: setsockopt was returning "success" anyway even though it had actually failed! [to accomplish anything].)

8. Introduce new get_socket_keepalive function to allow retrieval and reporting of current keepalive settings for a given socket.

9. Manually maintain socket keepalive values for Windows builds so it too can support retrieval of current values via new get_socket_keepalive function. (see comments in w32util.c "get_socket_keepalive" function!)

10. Minor HTML documentation edits.
2015-01-19 13:35:29 -08:00

351 lines
13 KiB
C

/* HCONSTS.H (c) Copyright "Fish" (David B. Trout), 2005-2012 */
/* Hercules #define constants... */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) as modifications to */
/* Hercules. */
// This header auto-#included by 'hercules.h'...
//
// The <config.h> header and other required headers are
// presumed to have already been #included ahead of it...
#ifndef _HCONSTS_H
#define _HCONSTS_H
#include "hercules.h"
/*-------------------------------------------------------------------*/
/* Miscellaneous system related constants we could be missing... */
/*-------------------------------------------------------------------*/
#ifndef MAX_PATH
#ifdef PATH_MAX
#define MAX_PATH PATH_MAX
#else
#define MAX_PATH 4096
#endif
#endif
#define PATH_SEP "/"
#if defined( _MSVC_ )
// The following are missing from MINGW32/MSVC...
#ifndef S_IRGRP
#define S_IRGRP 0
#endif
#ifndef S_IWGRP
#define S_IWGRP 0
#endif
#ifndef SIGUSR2
#define SIGUSR2 31
#endif
#ifndef IFNAMSIZ
#define IFNAMSIZ 16
#endif
#ifndef IFHWADDRLEN
#define IFHWADDRLEN 6
#endif
#ifndef EFAULT
#if defined (WSAEFAULT)
#define EFAULT WSAEFAULT
#else
#define EFAULT 14
#endif
#endif
#ifndef ENOSYS
#if defined (WSASYSCALLFAILURE)
#define ENOSYS WSASYSCALLFAILURE
#else
#define ENOSYS 88
#endif
#endif
#ifndef EOPNOTSUPP
#if defined (WSAEOPNOTSUPP)
#define EOPNOTSUPP WSAEOPNOTSUPP
#else
#define EOPNOTSUPP 95
#endif
#endif
#ifndef ECONNRESET
#if defined (WSAECONNRESET)
#define ECONNRESET WSAECONNRESET
#else
#define ECONNRESET 104
#endif
#endif
#ifndef ENOBUFS
#if defined (ENOMEM)
#define ENOBUFS ENOMEM
#else
#define ENOBUFS 105
#endif
#endif
#ifndef EAFNOSUPPORT
#if defined (WSAEAFNOSUPPORT)
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#else
#define EAFNOSUPPORT 106
#endif
#endif
#ifndef EPROTOTYPE
#if defined (WSAEPROTOTYPE)
#define EPROTOTYPE WSAEPROTOTYPE
#else
#define EPROTOTYPE 107
#endif
#endif
#ifndef ENOTSOCK
#if defined (WSAENOTSOCK)
#define ENOTSOCK WSAENOTSOCK
#else
#define ENOTSOCK 108
#endif
#endif
#ifndef EADDRINUSE
#if defined (WSAEADDRINUSE)
#define EADDRINUSE WSAEADDRINUSE
#else
#define EADDRINUSE 112
#endif
#endif
#ifndef ENETDOWN
#if defined (WSAENETDOWN)
#define ENETDOWN WSAENETDOWN
#else
#define ENETDOWN 115
#endif
#endif
#ifndef ETIMEDOUT
#if defined (WSAETIMEDOUT)
#define ETIMEDOUT WSAETIMEDOUT
#else
#define ETIMEDOUT 116
#endif
#endif
#ifndef EINPROGRESS
#if defined (WSAEINPROGRESS)
#define EINPROGRESS WSAEINPROGRESS
#else
#define EINPROGRESS 119
#endif
#endif
#ifndef EMSGSIZE
#if defined (E2BIG)
#define EMSGSIZE E2BIG
#else
#define EMSGSIZE 122
#endif
#endif
#ifndef EPROTONOSUPPORT
#if defined (WSAEPROTONOSUPPORT)
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#else
#define EPROTONOSUPPORT 123
#endif
#endif
#ifndef ENOTCONN
#if defined (WSAENOTCONN)
#define ENOTCONN WSAENOTCONN
#else
#define ENOTCONN 128
#endif
#endif
#ifndef ENOTSUP
#if defined (ENOSYS)
#define ENOTSUP ENOSYS
#else
#define ENOTSUP 134
#endif
#endif
#ifndef ENOMEDIUM
#if defined (ENOENT)
#define ENOMEDIUM ENOENT
#else
#define ENOMEDIUM 135
#endif
#endif
#ifndef EOVERFLOW
#if defined (ERANGE)
#define EOVERFLOW ERANGE
#else
#define EOVERFLOW 139
#endif
#endif
#endif // defined(_MSVC_)
// CLK_TCK not part of SUSE 7.2 specs; added. (VB)
#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC
#endif
/*-------------------------------------------------------------------*/
/* Default console tn3270/telnet session TCP keepalive values */
/*-------------------------------------------------------------------*/
#ifdef _MSVC_
// On Windows Vista and later the default probe count is 10 and
// cannot be changed via setsockopt (only via registry entry).
// On Windows pre-Vista it defaults to 5 probes and can't be
// changed via setsockopt (only via registry entry). Refer to
// function "kasock_init()" in module w32util.c for details.
#define KEEPALIVE_IDLE_TIME 3 /* Idle time to first probe */
#define KEEPALIVE_PROBE_INTERVAL 1 /* Probe timeout value */
#define KEEPALIVE_PROBE_COUNT 10 /* Max probe timeouts */
#else // *nix
// I'm not sure if this is true for all *nix'es, but I know that it
// is for my CentOS 6.4 system: the probe count defaults to '9' and
// apparently cannot be changed via setsockopt. Attempts to change
// it via setsockopt return "succeess" (rc==0), but the value isn't
// actually changed. The value you requested is not honored. A call
// to getsockopt always returns '9'. Other *nix'es may use different
// values or behave differently.
#define KEEPALIVE_IDLE_TIME 3 /* Idle time to first probe */
#define KEEPALIVE_PROBE_INTERVAL 1 /* Probe timeout value */
#define KEEPALIVE_PROBE_COUNT 9 /* Max probe timeouts */
#endif
/*-------------------------------------------------------------------*/
/* Miscellaneous Hercules-related constants... */
/*-------------------------------------------------------------------*/
#if defined(OPTION_WINDOWS_HOST_FILENAMES)
#define PATHSEPC '\\' /* Windows Versions */
#define PATHSEPS "\\"
#else
#define PATHSEPC '/' /* Everyone else */
#define PATHSEPS "/"
#endif
#define SPACE ' ' /* <---<<< Look close! There's a space there! */
/* Definitions for OS tailoring - msb eq mon event, lsb eq oper exc. */
#define OS_NONE 0x7FFFFFFFF7DE7FFFULL /* No spec OS tail. */
#define OS_OS390 0x7FF673FFF7DE7FFDULL /* OS/390 */
#define OS_ZOS 0x7B7673FFF7DE7FB7ULL /* z/OS */
#define OS_VSE 0x7FF673FFF7DE7FFFULL /* VSE */
#define OS_VM 0x7FFFFFFFF7DE7FFCULL /* VM */
#define OS_OPENSOLARIS 0xF8FFFFFFFFDE7FF7ULL /* OpenSolaris */
#if !defined(NO_IEEE_SUPPORT)
#define OS_LINUX 0x78FFFFFFF7DE7FF7ULL /* Linux */
#else
#define OS_LINUX 0x78FFFFFFF7DE7FD6ULL /* Linux */
#endif
/* Definitions for program product OS restriction flag. This flag is ORed
with the SCLP READ CPU INFO response code. A 4 here makes the CPU look
like an IFL (Integrated Facility for Linux) engine, which cannot run
licensed ESA/390 or z/Architecture OSes. */
#define PGM_PRD_OS_RESTRICTED 4 /* Restricted */
#define PGM_PRD_OS_LICENSED 0 /* Licensed */
/* Storage access bits used by logical_to_main */
#define ACC_CHECK 0x0001 /* Possible storage update*/
#define ACC_WRITE 0x0002 /* Storage update */
#define ACC_READ 0x0004 /* Storage read */
/* Storage access bits used by other dat.h routines */
#define ACC_NOTLB 0x0100 /* Don't do TLB lookup */
#define ACC_PTE 0x0200 /* Return page table entry*/
#define ACC_LPTEA 0x0400 /* Esame page table entry */
#define ACC_SPECIAL_ART 0x0800 /* Used by BSG */
#define ACC_ENH_MC 0x1000 /* Used by Enhanced MC */
#define ACCTYPE_HW 0 /* Hardware access */
#define ACCTYPE_INSTFETCH ACC_READ /* Instruction fetch */
#define ACCTYPE_READ ACC_READ /* Read storage */
#define ACCTYPE_WRITE_SKP ACC_CHECK /* Write, skip change bit */
#define ACCTYPE_WRITE ACC_WRITE /* Write storage */
#define ACCTYPE_TAR 0 /* TAR instruction */
#define ACCTYPE_LRA ACC_NOTLB /* LRA instruction */
#define ACCTYPE_TPROT 0 /* TPROT instruction */
#define ACCTYPE_IVSK 0 /* ISVK instruction */
#define ACCTYPE_BSG ACC_SPECIAL_ART /* BSG instruction */
#define ACCTYPE_PTE (ACC_PTE|ACC_NOTLB) /* page table entry */
#define ACCTYPE_SIE 0 /* SIE host access */
#define ACCTYPE_STRAG 0 /* STRAG instruction */
#define ACCTYPE_LPTEA (ACC_LPTEA|ACC_NOTLB) /* LPTEA instruction */
#define ACCTYPE_EMC (ACC_ENH_MC|ACCTYPE_WRITE) /* MC instr. */
/* Special value for arn parameter for translate functions in dat.c */
#define USE_INST_SPACE (-1) /* Instruction space virtual */
#define USE_REAL_ADDR (-2) /* Real address */
#define USE_PRIMARY_SPACE (-3) /* Primary space virtual */
#define USE_SECONDARY_SPACE (-4) /* Secondary space virtual */
#define USE_HOME_SPACE (-5) /* Home space virtual */
#define USE_ARMODE 16 /* OR with access register
number to force AR mode */
/* Interception codes used by longjmp/SIE */
#define SIE_NO_INTERCEPT (-1) /* Continue (after pgmint) */
#define SIE_HOST_INTERRUPT (-2) /* Host interrupt pending */
#define SIE_HOST_PGMINT (-3) /* Host program interrupt */
#define SIE_INTERCEPT_INST (-4) /* Instruction interception */
#define SIE_INTERCEPT_INSTCOMP (-5) /* Instr. int TS/CS/CDS */
#define SIE_INTERCEPT_EXTREQ (-6) /* External interrupt */
#define SIE_INTERCEPT_IOREQ (-7) /* I/O interrupt */
#define SIE_INTERCEPT_WAIT (-8) /* Wait state loaded */
#define SIE_INTERCEPT_STOPREQ (-9) /* STOP reqeust */
#define SIE_INTERCEPT_RESTART (-10) /* Restart interrupt */
#define SIE_INTERCEPT_MCK (-11) /* Machine Check interrupt */
#define SIE_INTERCEPT_EXT (-12) /* External interrupt pending*/
#define SIE_INTERCEPT_VALIDITY (-13) /* SIE validity check */
#define SIE_INTERCEPT_PER (-14) /* SIE guest per event */
#define SIE_INTERCEPT_IOINT (-15) /* I/O Interruption */
#define SIE_INTERCEPT_IOINTP (-16) /* I/O Interruption pending */
#define SIE_INTERCEPT_IOINST (-17) /* I/O Instruction */
#if defined(SIE_DEBUG_PERFMON)
#define SIE_PERF_ENTER 0 /* SIE performance monitor */
#define SIE_PERF_ENTER_F -31 /* Enter Fast (retain state) */
#define SIE_PERF_EXIT -30 /* SIE exit */
#define SIE_PERF_RUNSIE -29 /* run_sie entered */
#define SIE_PERF_RUNLOOP_1 -28 /* run_sie runloop 1 */
#define SIE_PERF_RUNLOOP_2 -27 /* run_sue runloop 2 */
#define SIE_PERF_INTCHECK -26 /* run_sie intcheck */
#define SIE_PERF_EXEC -25 /* run_sie execute inst */
#define SIE_PERF_EXEC_U -24 /* run_sie unrolled exec */
#endif /*defined(SIE_DEBUG_PERFMON)*/
/*-------------------------------------------------------------------*/
/* Definitions for CTC protocol types */
/*-------------------------------------------------------------------*/
#define CTC_XCA 1 /* XCA device */
#define CTC_LCS 2 /* LCS device */
#define CTC_CETI 3 /* CETI device */
#define CTC_CLAW 4 /* CLAW device */
#define CTC_CTCN 5 /* CTC link via NETBIOS */
#define CTC_CTCT 6 /* CTC link via TCP */
#define CTC_CTCI 7 /* CTC link to TCP/IP stack */
#define CTC_VMNET 8 /* CTC link via wfk's vmnet */
#define CTC_CFC 9 /* Coupling facility channel */
#define CTC_PTP 10 /* PTP link to TCP/IP stack */
#define CTC_CTCE 11 /* Enhanced CTC link via TCP */
#endif // _HCONSTS_H