Files
org-hyperion-cules/hercwind.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

221 lines
6.7 KiB
C

/* HERCWIND.H (c) Copyright Roger Bowler, 2005-2012 */
/* MSVC Environment Specific Definitions */
/* */
/* Released under "The Q Public License Version 1" */
/* (http://www.hercules-390.org/herclic.html) as modifications to */
/* Hercules. */
/*-------------------------------------------------------------------*/
/* Header file containing additional data structures and function */
/* prototypes required by Hercules in the MSVC environment */
/*-------------------------------------------------------------------*/
#include "hstdinc.h" /* Standard header file includes */
#if !defined(_HERCWIND_H)
#define _HERCWIND_H
// PROGRAMMING NOTE: Cygwin has a bug in setvbuf requiring us
// to do an 'fflush()' after each stdout/err write, and it doesn't
// hurt doing it for the MSVC build either...
#define NEED_LOGMSG_FFLUSH
#if !defined( _MSVC_ )
#error This file is only for building Hercules with MSVC
#endif
#if defined( _MSC_VER ) && (_MSC_VER < VS2002)
#error MSVC compiler versions less than 13.0 (Visual Studio 2002) not supported.
#endif
#pragma intrinsic( memset, memcmp, memcpy )
#ifdef _MAX_PATH
#define PATH_MAX _MAX_PATH
#else
#ifdef FILENAME_MAX
#define PATH_MAX FILENAME_MAX
#else
#define PATH_MAX 260
#endif
#endif
struct dirent
{
long d_ino;
char d_name[FILENAME_MAX + 1];
};
typedef unsigned char u_char;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned __int8 u_int8_t;
typedef signed __int8 int8_t;
typedef unsigned __int16 u_int16_t;
typedef signed __int16 int16_t;
typedef unsigned __int32 u_int32_t;
typedef signed __int32 int32_t;
typedef unsigned __int64 u_int64_t;
typedef signed __int64 int64_t;
typedef int32_t pid_t;
typedef int32_t mode_t;
typedef u_int32_t in_addr_t;
#if defined( _WIN64 )
#define SIZEOF_INT_P 8
#define SIZEOF_SIZE_T 8
typedef int64_t ssize_t;
#else
#define SIZEOF_INT_P 4
#define SIZEOF_SIZE_T 4
typedef int32_t ssize_t;
#endif
#include <io.h>
#include <share.h>
#include <process.h>
#include <signal.h>
#include <direct.h>
#define STDIN_FILENO fileno(stdin)
#define STDOUT_FILENO fileno(stdout)
#define STDERR_FILENO fileno(stderr)
/* Bit settings for open() and stat() functions */
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define S_IRGRP _S_IREAD
#define S_IROTH _S_IREAD
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
#define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
/* Bit settings for access() function */
#define F_OK 0
#define W_OK 2
#define R_OK 4
#define strcasecmp stricmp
#define strncasecmp strnicmp
#if !defined(_TRUNCATE)
#define _TRUNCATE ((size_t)-1) // normally #defined in <crtdefs.h>
#endif
// Using _snprintf_s(,,_TRUNCATE,...) ensures the buffer will ALWAYS be null terminated */
#define snprintf(_buf, _size, ...) _snprintf_s((_buf), (_size), _TRUNCATE, ## __VA_ARGS__ )
#define vsnprintf _vsnprintf
#define strerror w32_strerror
#define strerror_r w32_strerror_r
#define srandom srand
#define random rand
#define inline __inline
#define __inline__ __inline
#define HAVE_STRUCT_IN_ADDR_S_ADDR
#define HAVE_U_INT
#define HAVE_U_INT8_T
#define HAVE_LIBMSVCRT
#define HAVE_SYS_MTIO_H // (ours is called 'w32mtio.h')
#ifndef MAX_CPU_ENGINES
#define MAX_CPU_ENGINES 8
#endif
#if !defined(ENABLE_CONFIG_INCLUDE) && !defined(NO_CONFIG_INCLUDE)
#define ENABLE_CONFIG_INCLUDE /* enable config file includes */
#endif
#if !defined(ENABLE_SYSTEM_SYMBOLS) && !defined(NO_SYSTEM_SYMBOLS)
#define ENABLE_SYSTEM_SYMBOLS /* access to system symbols */
#endif
#if !defined(ENABLE_BUILTIN_SYMBOLS) && !defined(NO_BUILTIN_SYMBOLS)
#define ENABLE_BUILTIN_SYMBOLS /* Internal Symbols */
#endif
#if defined(ENABLE_BUILTIN_SYMBOLS) && !defined(ENABLE_SYSTEM_SYMBOLS)
#error ENABLE_BUILTIN_SYMBOLS requires ENABLE_SYMBOLS_SYMBOLS
#endif
#define OPTION_FTHREADS
#define HAVE_STRSIGNAL
#if !defined(OPTION_NO_EXTERNAL_GUI)
#if !defined(EXTERNALGUI)
#define EXTERNALGUI
#endif
#else
#undef EXTERNALGUI
#endif
#define NO_SETUID
#define NO_SIGABEND_HANDLER
#undef NO_ATTR_REGPARM // ( ATTR_REGPARM(x) == __fastcall )
#define HAVE_ATTR_REGPARM // ( ATTR_REGPARM(x) == __fastcall )
#define C99_FLEXIBLE_ARRAYS // ("DEVBLK *memdev[];" supported)
//#include "getopt.h"
#define HAVE_GETOPT_LONG
#include <math.h>
#define HAVE_SQRTL
#define HAVE_LDEXPL
#define HAVE_FABSL
#define HAVE_FMODL
#define HAVE_FREXPL
// The following are needed by 'hostopts.h'...
#define HAVE_DECL_SIOCSIFNETMASK 1 // ( supported by CTCI-WIN)
#define HAVE_DECL_SIOCSIFBRDADDR 1 // ( supported by CTCI-WIN)
#define HAVE_DECL_SIOCGIFHWADDR 1 // ( supported by CTCI-WIN)
#define HAVE_DECL_SIOCSIFHWADDR 1 // ( supported by CTCI-WIN)
#define HAVE_DECL_SIOCADDRT 0 // (UNsupported by CTCI-WIN)
#define HAVE_DECL_SIOCDELRT 0 // (UNsupported by CTCI-WIN)
#define HAVE_DECL_SIOCDIFADDR 0 // (UNsupported by CTCI-WIN)
// SCSI tape handling transparency/portability
#define HAVE_DECL_MTEOTWARN 1 // (always true since I made it up!)
#define HAVE_DECL_MTEWARN 1 // (same as HAVE_DECL_MTEOTWARN)
// GNUWin32 PCRE (Perl-Compatible Regular Expressions) support...
#if defined(HAVE_PCRE)
// (earlier packages failed to define this so we must do so ourselves)
#define PCRE_DATA_SCOPE
// extern __declspec(dllimport)
#include PCRE_INCNAME // (passed by makefile)
#define OPTION_HAO // Hercules Automatic Operator
#endif
// IDs for various POSIX.1b interval timers and system clocks
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
#if !defined( HQA_KEEPALIVE ) // (if hqa.h isn't defining these for us)
#define HAVE_BASIC_KEEPALIVE
#define HAVE_FULL_KEEPALIVE
#endif
#endif /*!defined(_HERCWIND_H)*/