1: #
   2: # include   "../../ingres.h"
   3: # include   "../../symbol.h"
   4: # include   "../../pipes.h"
   5: # include   "IIglobals.h"
   6: 
   7: /*
   8: **	Exit ingres --
   9: **		waits for the parser to return,
  10: **		catching all children's death till then
  11: **		or till an error return.
  12: **		In case wait(II) is interrupted while waiting,
  13: **		as evidenced by errno == 4, waiting will resume.
  14: **
  15: */
  16: 
  17: IIexit()
  18: {
  19:     register int    ndx;
  20:     register int    pidptr;
  21:     register int    err;
  22:     int     status;
  23:     int     pidlist[10];
  24:     extern      errno;      /* perror(III) */
  25: 
  26: #	ifdef xETR1
  27:     if (IIdebug)
  28:         printf("IIexit\n");
  29: #	endif
  30: 
  31:     if (close(IIw_down) || close(IIr_down) || close(IIr_front))
  32:         IIsyserr("IIexit:cant't close");
  33: 
  34:     pidptr = 0;
  35:     err = 0;
  36:     errno = 0;
  37:     while ((ndx = wait(&status)) != IIingpid
  38:         && (ndx != -1 || errno == 4))
  39:     {
  40:         if (ndx == -1)
  41:         {
  42:             errno = 0;
  43:             continue;
  44:         }
  45: #		ifdef xETR1
  46:         if (IIdebug)
  47:             printf("caught pid %u death, stat %d, %d\n",
  48:                 ndx, status >> 8, status & 0177);
  49: #		endif
  50: 
  51:         pidlist [pidptr++] = ndx;
  52:         if ((status & 0177) != 0)
  53:         {
  54:             printf("%d: Abnormal Termination %d", ndx, status & 0177);
  55:             if ((status & 0200) != 0)
  56:                 printf(" -- Core Dumped");
  57:             printf("\n");
  58:             err++;
  59:         }
  60:     }
  61:     if (err)
  62:     {
  63:         printf("pid list:");
  64:         for (ndx = 0; ndx < pidptr; ndx++)
  65:             printf(" %u", pidlist[ndx]);
  66:         printf("\n");
  67:     }
  68: 
  69:     IIingpid = 0;
  70: }

Defined functions

IIexit defined in line 17; never used
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 633
Valid CSS Valid XHTML 1.0 Strict