--- cardrdr.c;1 2009-02-09 07:55:14 +0000 +++ cardrdr.c;2 2012-05-20 23:51:48 +0100 @@ -9,6 +9,9 @@ /*-------------------------------------------------------------------*/ // $Log$ +// Revision 1.48? 2009/10/23 23:53:16 peter +// Add error checking after fdopen +// // Revision 1.47 2007/11/21 22:54:13 fish // Use new BEGIN_DEVICE_CLASS_QUERY macro // @@ -479,7 +482,23 @@ /* Save the file descriptor in the device block */ dev->fd = rc; +#ifdef __VMS + dev->fh = fdopen(dev->fd, "r"); +#else /* __VMS */ dev->fh = fdopen(dev->fd, "rb"); +#endif /* __VMS */ + if (dev->fh == NULL) + { + /* Something went wrong with fdopen */ + + logmsg (_("HHCRD020E Error calling fdopen on file %s: %s\n"), + dev->filename, strerror(errno)); + + /* Set unit check with equipment check */ + dev->sense[0] = SENSE_EC; + *unitstat = CSW_CE | CSW_DE | CSW_UC; + return -1; + } /* If neither EBCDIC nor ASCII was specified, attempt to detect the format by inspecting the first 160 bytes */ --- console.c;1 2010-02-12 23:58:38 +0000 +++ console.c;2 2012-05-20 23:46:22 +0100 @@ -322,7 +322,7 @@ #define TNSERROR logmsg -#define BUFLEN_3270 65536 /* 3270 Send/Receive buffer */ +#define BUFLEN_3270 65535 /* 3270 Send/Receive buffer */ #define BUFLEN_1052 150 /* 1052 Send/Receive buffer */ --- ctcadpt.c;1 2009-05-14 02:09:14 +0100 +++ ctcadpt.c;2 2012-05-20 23:58:28 +0100 @@ -138,8 +138,52 @@ NULL /* Hercules resume */ }; -extern DEVHND ctci_device_hndinfo; -extern DEVHND lcs_device_hndinfo; +DEVHND ctci_device_hndinfo = +{ + &CTCX_Init, /* Device Initialisation */ + &CTCX_ExecuteCCW, /* Device CCW execute */ + &CTCX_Close, /* Device Close */ + &CTCX_Query, /* Device Query */ + NULL, /* Device Start channel pgm */ + NULL, /* Device End channel pgm */ + NULL, /* Device Resume channel pgm */ + NULL, /* Device Suspend channel pgm */ + NULL, /* Device Read */ + NULL, /* Device Write */ + NULL, /* Device Query used */ + NULL, /* Device Reserve */ + NULL, /* Device Release */ + NULL, /* Device Attention */ + NULL, /* Immediate CCW Codes */ + NULL, /* Signal Adapter Input */ + NULL, /* Signal Adapter Output */ + NULL, /* Hercules suspend */ + NULL /* Hercules resume */ +}; + +DEVHND lcs_device_hndinfo = +{ + &CTCX_Init, /* Device Initialisation */ + &CTCX_ExecuteCCW, /* Device CCW execute */ + &CTCX_Close, /* Device Close */ + &CTCX_Query, /* Device Query */ + NULL, /* Device Start channel pgm */ + NULL, /* Device End channel pgm */ + NULL, /* Device Resume channel pgm */ + NULL, /* Device Suspend channel pgm */ + NULL, /* Device Read */ + NULL, /* Device Write */ + NULL, /* Device Query used */ + NULL, /* Device Reserve */ + NULL, /* Device Release */ + NULL, /* Device Attention */ + NULL, /* Immediate CCW Codes */ + NULL, /* Signal Adapter Input */ + NULL, /* Signal Adapter Output */ + NULL, /* Hercules suspend */ + NULL /* Hercules resume */ +}; + // ==================================================================== // Primary Module Entry Points --- esame.c;1 2010-02-18 19:05:44 +0000 +++ esame.c;2 2012-05-21 17:12:40 +0100 @@ -8191,7 +8191,7 @@ { switch(mode) { -#if defined(_390) +#if defined(_390) && defined(FEATURE_ESAME_N3_ESA390) case ARCH_390: *data_len=sizeof(s390_stfl_data); return &s390_stfl_data[0]; --- hetlib.c;1 2009-02-09 07:55:16 +0000 +++ hetlib.c;2 2012-05-21 10:11:36 +0100 @@ -12,6 +12,9 @@ // $Id: hetlib.c 5125 2009-01-23 12:01:44Z bernard $ // // $Log$ +// Revision 1.35 2011/02/04 22:38:04 peter +// Fix open mode for VMS +// // Revision 1.34 2007/11/21 23:30:41 fish // (comment change only) // @@ -197,7 +200,11 @@ /* || Open the tape file */ +#ifdef __VMS + omode = "r+"; +#else /* __VMS */ omode = "r+b"; +#endif /* __VMS */ if(!(flags & HETOPEN_READONLY)) { fd = open( pathname, O_RDWR | O_BINARY | oflags, S_IRUSR | S_IWUSR | S_IRGRP ); @@ -207,7 +214,11 @@ /* || Retry open if file resides on readonly file system */ +#ifdef __VMS + omode = "r"; +#else /* __VMS */ omode = "rb"; +#endif /* __VMS */ thetb->writeprotect = TRUE; fd = open( pathname, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP ); } --- hmacros.h;1 2010-02-03 21:45:57 +0000 +++ hmacros.h;2 2012-05-21 09:51:34 +0100 @@ -40,6 +40,11 @@ #define read_pipe(f,b,n) recv(f,b,n,0) #define write_pipe(f,b,n) send(f,b,(int)n,0) #define close_pipe(f) closesocket(f) +#elif defined( __VMS ) + #define create_pipe(a) socketpair(AF_INET,SOCK_STREAM,IPPROTO_IP,a) + #define read_pipe(f,b,n) recv(f,b,n,0) + #define write_pipe(f,b,n) send(f,b,(int)n,0) + #define close_pipe(f) close(f) #else #define create_pipe(f) pipe(f) #define read_pipe(f,b,n) read(f,b,n) --- hostopts.h;1 2010-01-08 22:56:27 +0000 +++ hostopts.h;2 2012-05-21 16:42:11 +0100 @@ -327,6 +327,38 @@ #undef OPTION_EXTCURS /* Normal cursor handling */ +/*-------------------------------------------------------------------*/ +/* VMS options... */ +/*-------------------------------------------------------------------*/ +#elif defined(__VMS) /* VMS options */ +/* Similar to OTHER with a few differences */ + +#define DLL_IMPORT extern /* (a safe default) */ +#define DLL_EXPORT + +#undef TUNTAP_IFF_RUNNING_NEEDED /* (NO tuntap support) */ +#undef OPTION_SCSI_TAPE /* (NO SCSI tape support) */ +#undef OPTION_SCSI_ERASE_TAPE /* (NOT supported) */ +#undef OPTION_SCSI_ERASE_GAP /* (NOT supported) */ +#undef OPTION_FBA_BLKDEVICE /* (no FBA BLKDEVICE support)*/ + +#define MAX_DEVICE_THREADS 0 /* (0 == unlimited) */ +#undef MIXEDCASE_FILENAMES_ARE_UNIQUE /* ("Foo" and "fOo" the same)*/ + +#define DEFAULT_HERCPRIO 0 +#define DEFAULT_TOD_PRIO -20 +#define DEFAULT_CPU_PRIO 15 +#define DEFAULT_DEV_PRIO 8 + +#if defined( HAVE_FORK ) + #define HOW_TO_IMPLEMENT_SH_COMMAND USE_FORK_API_FOR_SH_COMMAND +#else + #define HOW_TO_IMPLEMENT_SH_COMMAND USE_ANSI_SYSTEM_API_FOR_SH_COMMAND +#endif +#define SET_CONSOLE_CURSOR_SHAPE_METHOD CURSOR_SHAPE_NOT_SUPPORTED +#undef OPTION_EXTCURS /* Normal cursor handling */ + + /*-------------------------------------------------------------------*/ /* Hard-coded OTHER (DEFAULT) host-specific features and options... */ /*-------------------------------------------------------------------*/ --- hsocket.c;1 2009-02-09 07:55:15 +0000 +++ hsocket.c;2 2012-05-21 00:34:48 +0100 @@ -18,6 +18,10 @@ #include "hercules.h" +#if !defined(SOCKET_ERROR) +#define SOCKET_ERROR -1 +#endif + /************************************************************************ NAME: read_socket - read a passed number of bytes from a socket. @@ -56,7 +60,7 @@ while (nleft > 0) { -#ifdef _MSVC_ +#if defined( _MSVC_ ) || defined( __VMS ) nread = recv(fd, ptr, nleft, 0); if ((nread == SOCKET_ERROR) || (nread < 0)) { --- opcode.c;1 2010-01-08 22:56:27 +0000 +++ opcode.c;2 2012-05-21 17:23:34 +0100 @@ -3197,7 +3197,11 @@ /*B2AD*/ GENx___x___x___ , /*B2AE*/ GENx___x___x___ , /*B2AF*/ GENx___x___x___ , +#ifdef FEATURE_ESAME_N3_ESA390 /*B2B0*/ GENx___x390x900 (store_facility_list_extended,S,"STFLE"), /*!SARCH */ /*@Z9*/ +#else + /*B2B0*/ GENx___x___x___ , +#endif /*B2B1*/ GENx___x390x900 (store_facility_list,S,"STFL"), /*B2B2*/ GENx___x___x900 (load_program_status_word_extended,S,"LPSWE"), /*B2B3*/ GENx___x___x___ , /*(store_etr_attachment_information,?,"STEAI"),*/ --- panel.c;1 2010-03-05 03:14:45 +0000 +++ panel.c;2 2012-05-21 16:49:03 +0100 @@ -40,6 +40,10 @@ #include "fillfnam.h" #include "hconsole.h" +#ifdef __VMS +#include +#endif // __VMS + #define DISPLAY_INSTRUCTION_OPERANDS #define PANEL_MAX_ROWS (256) @@ -1790,12 +1794,17 @@ void panel_display (void) #endif // defined(OPTION_DYNAMIC_LOAD) { -#ifndef _MSVC_ +#if !defined( _MSVC_ ) && !defined( __VMS ) int rc; /* Return code */ int maxfd; /* Highest file descriptor */ fd_set readset; /* Select file descriptors */ struct timeval tv; /* Select timeout structure */ -#endif // _MSVC_ +#endif // !_MSVC_ && !__VMS +#ifdef __VMS + int efn, status, lib$signal(), lib$get_ef(), sys$assign(), vms_getch(); + short channel; + $DESCRIPTOR(input, "SYS$COMMAND:"); +#endif // __VMS int i; /* Array subscripts */ int len; /* Length */ REGS *regs; /* -> CPU register context */ @@ -1826,6 +1835,20 @@ "tid="TIDPAT", pid=%d\n"), thread_id(), getpid()); +#ifdef __VMS + + /* Reserve an event flag for calling sys$qiow in vms_getch() */ + + status = lib$get_ef(&efn); + if (!(status & 1)) lib$signal(status); + + /* Assign a channel to sys$command for vms_getch() */ + + status = sys$assign(&input, &channel, 0, 0); + if (!(status & 1)) lib$signal(status); + +#endif // __VMS + /* Notify logger_thread we're in control */ sysblk.panel_init = 1; @@ -1928,7 +1951,22 @@ kbbuf[kblen=1] = '\0'; translate_keystroke( kbbuf, &kblen ); -#else // !defined( _MSVC_ ) +#elif defined( __VMS ) + /* Wait for keyboard input */ +#define WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS (20) + for (i=sysblk.panrate/WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS; + i && !(kbbuf[0] = vms_getch(efn, channel)); i--) + usleep(WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS * 1000); + + ADJ_SCREEN_SIZE(); + + /* If keyboard input has [finally] arrived, then process it */ + if ( kbbuf[0] ) + { + kbbuf[kblen=1] = '\0'; + translate_keystroke( kbbuf, &kblen ); + +#else // !defined( _MSVC_ ) && !defined( __VMS ) /* Set the file descriptors for select */ FD_ZERO (&readset); @@ -1967,7 +2005,7 @@ kbbuf[kblen] = '\0'; -#endif // defined( _MSVC_ ) +#endif // defined( _MSVC_ ) || defined( __VMS ) /* =NP= : Intercept NP commands & process */ if (NPDup == 1) @@ -2462,6 +2500,10 @@ } #endif // defined(OPTION_EXTCURS) + /* Translate CR into LF for unix type processing */ + + if (kbbuf[i] == '\r') kbbuf[i] = '\n'; + /* Process the command when the ENTER key is pressed */ if (kbbuf[i] == '\n') { if (cmdlen == 0 && NPDup == 0 && !sysblk.inststep &&