From ce193eddcea00e3d8947fd5fcc751c032ca8a13e Mon Sep 17 00:00:00 2001 From: Jan Jaeger Date: Tue, 13 Nov 2001 18:43:21 +0000 Subject: [PATCH] Fix halt and clear subchannel on CTC type devices Fix logmsg macro to appear as a singular statement git-svn-id: file:///home/jj/hercules.svn/trunk@466 956126f8-22a0-4046-8f4a-272fa8102e63 --- CHANGES | 2 ++ Makefile.in | 10 +++++----- cardrdr.c | 2 +- channel.c | 19 +++++++++++++++++-- ckddasd.c | 2 +- ctcadpt.c | 11 +++++++++++ fbadasd.c | 6 +++--- hercules.h | 12 +++++++----- impl.c | 3 ++- machchk.c | 14 ++++++++++++++ panel.c | 16 ++++++++-------- service.c | 4 ++-- tapedev.c | 4 ++-- 13 files changed, 75 insertions(+), 30 deletions(-) diff --git a/CHANGES b/CHANGES index bd021af9..6dd2e4f0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +13 Nov 2001 Fix halt and clear subchannel on CTC type devices - Jan Jaeger +13 Nov 2001 Fix logmsg macro to appear as a singular statement - Jan Jaeger 09 Nov 2001 Add HMC cdrom type IPL support - Jan Jaeger 09 Nov 2001 Fix hang in synchronize_broadcast - Greg Smith 09 Nov 2001 Make MODEL_DEPENDENT more specific with CS and STCM - Paul Leisy diff --git a/Makefile.in b/Makefile.in index 6a72d70c..2b8b71fa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -403,11 +403,11 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive -DIST_COMMON = README $(noinst_HEADERS) ./stamp-h.in INSTALL Makefile.am \ - Makefile.in TODO aclocal.m4 autoconf/README \ - autoconf/config.guess autoconf/config.sub autoconf/depcomp \ - autoconf/install-sh autoconf/missing autoconf/mkinstalldirs \ - config.h.in configure configure.ac +DIST_COMMON = $(noinst_HEADERS) ./stamp-h.in INSTALL Makefile.am \ + Makefile.in aclocal.m4 autoconf/README autoconf/config.guess \ + autoconf/config.sub autoconf/depcomp autoconf/install-sh \ + autoconf/missing autoconf/mkinstalldirs config.h.in configure \ + configure.ac DIST_SUBDIRS = $(SUBDIRS) SOURCES = $(cckd2ckd_SOURCES) $(cckdcdsk_SOURCES) $(cckdcomp_SOURCES) $(cckdswap_SOURCES) $(ckd2cckd_SOURCES) $(dasdinit_SOURCES) $(dasdisup_SOURCES) $(dasdload_SOURCES) $(dasdls_SOURCES) $(dasdpdsu_SOURCES) $(dmap2hrc_SOURCES) $(hercifc_SOURCES) $(hercules_SOURCES) $(hetget_SOURCES) $(hetinit_SOURCES) $(hetmap_SOURCES) $(hetupd_SOURCES) $(tapecopy_SOURCES) $(tapemap_SOURCES) $(tapesplt_SOURCES) diff --git a/cardrdr.c b/cardrdr.c index c7a394c7..becb7c1f 100644 --- a/cardrdr.c +++ b/cardrdr.c @@ -561,7 +561,7 @@ int rc; /* Return code */ { if (rc < 0) logmsg ("HHC407I Error reading file %s: %s\n", - dev->filename, strerror(errno)) + dev->filename, strerror(errno)); else logmsg ("HHC408I Unexpected end of file on %s\n", dev->filename); diff --git a/channel.c b/channel.c index 2e4b8c67..09a35cac 100644 --- a/channel.c +++ b/channel.c @@ -518,6 +518,13 @@ void clear_subchan (REGS *regs, DEVBLK *dev) dev->scsw.flag2 |= SCSW2_AC_RESUM; signal_condition (&dev->resumecond); } +#if !defined(NO_SIGABEND_HANDLER) + else + { + if( dev->ctctype ) + signal_thread(dev->tid, SIGUSR2); + } +#endif /*!defined(NO_SIGABEND_HANDLER)*/ /* Release the device lock */ release_lock (&dev->lock); @@ -633,6 +640,13 @@ int halt_subchan (REGS *regs, DEVBLK *dev) dev->scsw.flag2 |= SCSW2_AC_RESUM; signal_condition (&dev->resumecond); } +#if !defined(NO_SIGABEND_HANDLER) + else + { + if( dev->ctctype ) + signal_thread(dev->tid, SIGUSR2); + } +#endif /*!defined(NO_SIGABEND_HANDLER)*/ /* Release the device lock */ release_lock (&dev->lock); @@ -853,6 +867,7 @@ void device_thread () sysblk.ioq = dev->nextioq; if (sysblk.ioq && sysblk.devtwait) signal_condition(&sysblk.ioqcond); + dev->tid = thread_id(); release_lock (&sysblk.ioqlock); switch (sysblk.arch_mode) @@ -864,6 +879,7 @@ void device_thread () } obtain_lock(&sysblk.ioqlock); + dev->tid = 0; } if (sysblk.devtmax < 0 @@ -1320,7 +1336,6 @@ int ARCH_DEP(device_attention) (DEVBLK *dev, BYTE unitstat) int ARCH_DEP(startio) (DEVBLK *dev, ORB *orb) /*@IWZ*/ { #if !defined(OPTION_FISHIO) -TID tid; /* Device thread thread id */ DEVBLK *previoq, *ioq; /* Device I/O queue pointers */ int rc; /* Return code */ #endif // !defined(OPTION_FISHIO) @@ -1402,7 +1417,7 @@ int rc; /* Return code */ signal_condition(&sysblk.ioqcond); else if (sysblk.devtmax == 0 || sysblk.devtnbr < sysblk.devtmax) { - rc = create_device_thread(&tid,&sysblk.detattr,device_thread,NULL); + rc = create_device_thread(&dev->tid,&sysblk.detattr,device_thread,NULL); if (rc != 0 && sysblk.devtnbr == 0) { logmsg ("HHC760I %4.4X create_thread error: %s", diff --git a/ckddasd.c b/ckddasd.c index a8963b5d..5ca91c2b 100644 --- a/ckddasd.c +++ b/ckddasd.c @@ -357,7 +357,7 @@ int cckd=0; /* 1 if compressed CKD */ { if (rc < 0) logmsg ("HHC354I %s read error: %s\n", - dev->filename, strerror(errno)) + dev->filename, strerror(errno)); else logmsg ("HHC355I %s CKD header incomplete\n", dev->filename); diff --git a/ctcadpt.c b/ctcadpt.c index a3e2365f..9679b5c2 100644 --- a/ctcadpt.c +++ b/ctcadpt.c @@ -1042,6 +1042,11 @@ static struct timeval tv; /* Timeout time for 'select' */ case -1: { + if(errno == EINTR) + { +// logmsg("read interrupted for ctc %4.4X\n",dev->devnum); + return; + } logmsg ("HHC869I %4.4X Error reading from %s: %s\n", dev->devnum, dev->filename, strerror(errno)); dev->sense[0] = SENSE_EC; @@ -1318,6 +1323,8 @@ int n; /* -2 will cause an error status to be set */ return -2; } + if( n == EINTR ) + return -3; logmsg ("%4.4X: Error: read: %s\n", dev->devnum, strerror(errno)); sleep(2); @@ -1371,6 +1378,8 @@ int lastlen = 2; /* block length at last pckt */ while (1) { c = bufgetc(dev, lastlen == 2); if (c < 0) { + if(c == -3) + return 0; /* End of input buffer. Return what we have. */ setblkheader (iobuf, lastlen); @@ -1399,6 +1408,8 @@ int lastlen = 2; /* block length at last pckt */ case SLIP_ESC: c = bufgetc(dev, lastlen == 2); if (c < 0) { + if(c == -3) + return 0; /* End of input buffer. Return what we have. */ setblkheader (iobuf, lastlen); diff --git a/fbadasd.c b/fbadasd.c index 091bfbac..52bf839a 100644 --- a/fbadasd.c +++ b/fbadasd.c @@ -338,7 +338,7 @@ int repcnt; /* Replication count */ /* Handle read error condition */ if (rc < 0) logmsg ("HHC312I Read error in file %s: %s\n", - dev->filename, strerror(errno)) + dev->filename, strerror(errno)); else logmsg ("HHC313I Unexpected end of file in %s\n", dev->filename); @@ -498,7 +498,7 @@ int repcnt; /* Replication count */ /* Handle read error condition */ if (rc < 0) logmsg ("HHC316I Read error in file %s: %s\n", - dev->filename, strerror(errno)) + dev->filename, strerror(errno)); else logmsg ("HHC317I Unexpected end of filein %s\n", dev->filename); @@ -926,7 +926,7 @@ int blkfactor; /* Number of device blocks /* Handle read error condition */ if (rc < 0) logmsg ("HHC323I Read error in file %s: %s\n", - dev->filename, strerror(errno)) + dev->filename, strerror(errno)); else logmsg ("HHC324I Unexpected end of file in %s\n", dev->filename); diff --git a/hercules.h b/hercules.h index 2205df76..67b3e463 100644 --- a/hercules.h +++ b/hercules.h @@ -111,19 +111,21 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid); /*-------------------------------------------------------------------*/ #ifndef FLUSHLOG #define logmsg(a...) \ - { \ + do { \ fprintf(sysblk.msgpipew, a); \ - } + } while(0) #else #define logmsg(a...) \ - { \ + do { \ fprintf(sysblk.msgpipew, a); \ fflush(sysblk.msgpipew); \ - } + } while(0) #endif #define DEVTRACE(format, a...) \ + do { \ if(dev->ccwtrace||dev->ccwstep) \ - fprintf(sysblk.msgpipew, "%4.4X:" format, dev->devnum, a) + fprintf(sysblk.msgpipew, "%4.4X:" format, dev->devnum, a); \ + } while(0) /* Debugging */ diff --git a/impl.c b/impl.c index fb0f0036..d6a593a9 100644 --- a/impl.c +++ b/impl.c @@ -174,7 +174,8 @@ TID paneltid; || sigaction(SIGFPE, &sa, NULL) || sigaction(SIGSEGV, &sa, NULL) || sigaction(SIGBUS, &sa, NULL) - || sigaction(SIGUSR1, &sa, NULL) ) + || sigaction(SIGUSR1, &sa, NULL) + || sigaction(SIGUSR2, &sa, NULL) ) { fprintf (stderr, "HHC031I Cannot register SIG ILL/FPE/SEGV/BUS handler: %s\n", diff --git a/machchk.c b/machchk.c index 48c4f9e9..7cc447f5 100644 --- a/machchk.c +++ b/machchk.c @@ -264,6 +264,20 @@ int i; tid = thread_id(); + if( signo == SIGUSR2 ) + { + DEVBLK *dev; + for (dev = sysblk.firstdev; dev != NULL; dev = dev->nextdev) + if (dev->tid == tid) break; + if( dev == NULL) + logmsg("signal USR2 received for undetermined device\n"); +#if 0 + else + logmsg("signal USR2 received for device %4.4X\n",dev->devnum); +#endif + return; + } + #ifdef FEATURE_CPU_RECONFIG for (i = 0; i < MAX_CPU_ENGINES; i++) #else /*!FEATURE_CPU_RECONFIG*/ diff --git a/panel.c b/panel.c index 25efff8f..b895cb4b 100644 --- a/panel.c +++ b/panel.c @@ -658,11 +658,11 @@ int i; if(regs->arch_mode < ARCH_900) for (i = 0; i < 16; i++) logmsg ("GR%2.2d=%8.8X%s", i, regs->GR_L(i), - ((i & 0x03) == 0x03) ? "\n" : "\t") + ((i & 0x03) == 0x03) ? "\n" : "\t"); else for (i = 0; i < 16; i++) logmsg ("R%1.1X=%16.16llX%s", i, regs->GR_G(i), - ((i & 0x03) == 0x03) ? "\n" : " ") + ((i & 0x03) == 0x03) ? "\n" : " "); } /* end function display_regs */ @@ -676,11 +676,11 @@ int i; if(regs->arch_mode < ARCH_900) for (i = 0; i < 16; i++) logmsg ("CR%2.2d=%8.8X%s", i, regs->CR_L(i), - ((i & 0x03) == 0x03) ? "\n" : "\t") + ((i & 0x03) == 0x03) ? "\n" : "\t"); else for (i = 0; i < 16; i++) logmsg ("C%1.1X=%16.16llX%s", i, regs->CR_G(i), - ((i & 0x03) == 0x03) ? "\n" : " ") + ((i & 0x03) == 0x03) ? "\n" : " "); } /* end function display_cregs */ @@ -693,7 +693,7 @@ int i; for (i = 0; i < 16; i++) logmsg ("AR%2.2d=%8.8X%s", i, regs->AR(i), - ((i & 0x03) == 0x03) ? "\n" : "\t") + ((i & 0x03) == 0x03) ? "\n" : "\t"); } /* end function display_aregs */ @@ -1582,9 +1582,9 @@ BYTE *cmdarg; /* -> Command argument */ if (strcmp(cmd,"pr") == 0) { if(regs->arch_mode > ARCH_390) - logmsg ("Prefix=%16.16llX\n", regs->PX_G) + logmsg ("Prefix=%16.16llX\n", regs->PX_G); else - logmsg ("Prefix=%8.8X\n", regs->PX_L) + logmsg ("Prefix=%8.8X\n", regs->PX_L); return NULL; } @@ -1875,7 +1875,7 @@ BYTE *cmdarg; /* -> Command argument */ #else /*!_FEATURE_CPU_RECONFIG*/ if(cpu < 0 || cpu > sysblk.numcpu) #endif /*!_FEATURE_CPU_RECONFIG*/ - logmsg ("CPU%4.4X not configured\n",cpu) + logmsg ("CPU%4.4X not configured\n",cpu); else sysblk.pcpu = cpu; return NULL; diff --git a/service.c b/service.c index 84ee2229..3176cd43 100644 --- a/service.c +++ b/service.c @@ -1332,9 +1332,9 @@ BYTE *xstmap; /* Xstore bitmap, zero means || sysblk.cp_send_mask != old_cp_send_mask) { if (sysblk.cp_recv_mask != 0 || sysblk.cp_send_mask != 0) - logmsg ("HHC701I SYSCONS interface active\n") + logmsg ("HHC701I SYSCONS interface active\n"); else - logmsg ("HHC702I SYSCONS interface inactive\n") + logmsg ("HHC702I SYSCONS interface inactive\n"); } /* Set response code X'0020' in SCCB header */ diff --git a/tapedev.c b/tapedev.c index 81c274f6..fc82c8cc 100644 --- a/tapedev.c +++ b/tapedev.c @@ -1263,7 +1263,7 @@ long density; /* Tape density code */ if (tapeinfo[i].t_name != NULL) logmsg ("HHC218I %s device type: %s\n", - dev->filename, tapeinfo[i].t_name) + dev->filename, tapeinfo[i].t_name); else logmsg ("HHC219I %s device type: 0x%lX\n", dev->filename, stblk.mt_type); @@ -1276,7 +1276,7 @@ long density; /* Tape density code */ if (densinfo[i].t_name != NULL) logmsg ("HHC220I %s tape density: %s\n", - dev->filename, densinfo[i].t_name) + dev->filename, densinfo[i].t_name); else logmsg ("HHC221I %s tape density code: 0x%lX\n", dev->filename, density);