# 2.11BSD#431 - /usr/ingres/source/monitor/quit.c

##### Functions

    quit              X

       1: /*
       2:  * @(#)		quit.c	1.1	(2.11BSD)	1996/3/22
       3: */
       4:
       5: #include    <stdio.h>
       6: #include    <signal.h>
       7: #include    <string.h>
       8:
       9: # include   "../ingres.h"
      10: # include   "../aux.h"
      11: # include   "../pipes.h"
      12: # include   "monitor.h"
      13:
      14: /*
      15: **  QUIT INGRES
      16: **
      17: **	This routine starts the death of the other processes.  It
      18: **	then prints out the logout message, and then waits for the
      19: **	rest of the system to die.  Note, however, that no relations
      20: **	are removed; this must be done using the PURGE command.
      21: **
      22: **	Uses trace flag 1
      23: **
      24: **	History:
      25: **		3/2/79 (eric) -- Changed to close Trapfile.
      26: */
      27:
      28: extern  char    *sys_siglist[];
      29:
      30: quit()
      31: {
      32:     register int    ndx;
      33:     register int    pidptr;
      34:     register int    err;
      35:     char        buf[100];
      36:     int     status;
      37:     int     pidlist[50];
      38:     extern int  (*Exitfn)();
      39:     extern      exit();
      40:     char        indexx[0400];
      41:     char        *cp;
      42:
      43: #	ifdef xMTR1
      44:     if (tTf(1, -1))
      45:         printf("entered quit\n");
      46: #	endif
      47:
      48:     /* INTERCEPT ALL FURTHER INTERRUPTS */
      49:     signal(1, 1);
      50:     signal(2, 1);
      51:     Exitfn = &exit;
      52:
      53:     close(W_down);
      54:
      55: #	ifdef xMTR3
      56:     if (tTf(1, 2))
      57:         printf("unlinking %s\n", Qbname);
      58: #	endif
      59:
      60:     /* REMOVE THE QUERY-BUFFER FILE */
      61:     fclose(Qryiop);
      62:     unlink(Qbname);
      63:     if (Trapfile != NULL)
      64:         fclose(Trapfile);
      65:     pidptr = 0;
      66:     err = 0;
      67:
      68:     /* clear out the system error index table */
      69:     bzero(indexx, sizeof (indexx));
      70:
      71:     /* wait for all process to terminate */
      72:     while ((ndx = wait(&status)) != -1)
      73:     {
      74: #		ifdef xMTR2
      75:         if (tTf(1, 5))
      76:             printf("quit: pid %u: %d/%d\n",
      77:                 ndx, status >> 8, status & 0177);
      78: #		endif
      79:         pidlist[pidptr++] = ndx;
      80:         if ((status & 0177) != 0)
      81:         {
      82:             printf("%d: ", ndx);
      83:             ndx = status & 0177;
      84:             if (ndx > NSIG)
      85:                 printf("Abnormal Termination %d", ndx);
      86:             else
      87:                 printf("%s", sys_siglist[ndx]);
      88:             if ((status & 0200) != 0)
      89:                 printf(" -- Core Dumped");
      90:             printf("\n");
      91:             err++;
      92:             indexx[0377 - ndx]++;
      93:         }
      94:         else
      95:         {
      96:             indexx[(status >> 8) & 0377]++;
      97:         }
      98:     }
      99:     if (err)
     100:     {
     101:         printf("pid list:");
     102:         for (ndx = 0; ndx < pidptr; ndx++)
     103:             printf(" %u", pidlist[ndx]);
     104:         printf("\n");
     105:     }
     106:
     107:     /* print index of system errors */
     108:     err = 0;
     109:     for (ndx = 1; ndx <= 0377; ndx++)
     110:     {
     111:         if (indexx[ndx] == 0)
     112:             continue;
     113:         cp = syserrlst(ndx);
     114:         if (!cp)
     115:             break;
     116:         if (err == 0)
     117:             printf("\nUNIX error dictionary:\n");
     118:         printf("%3d: %s\n", ndx, cp);
     119:         if (err == 0)
     120:             err = ndx;
     121:     }
     122:     if (err)
     123:         printf("\n");
     124:
     125:     /* PRINT LOGOUT CUE ? */
     126:     if (Nodayfile >= 0)
     127:     {
     128:         time(buf);
     129:         printf("INGRES version %s logout\n%s", Version, ctime(buf));
     130:         if (getuser(Usercode, buf) == 0)
     131:         {
     132:             for (ndx = 0; buf[ndx]; ndx++)
     133:                 if (buf[ndx] == ':')
     134:                     break;
     135:             buf[ndx] = 0;
     136:             printf("goodbye %s ", buf);
     137:         }
     138:         else
     139:             printf("goodbye ");
     140:         printf("-- come again\n");
     141:     }
     142: #	ifdef xMTR1
     143:     if (tTf(1, 3))
     144:         printf("quit: exit(%d)\n", err);
     145: #	endif
     146:     exit(err);
     147: }

#### Defined functions

quit defined in line 30; used 5 times

- in /usr/ingres/source/monitor/main.c line 59, 73, 79, 163
- in /usr/ingres/source/monitor/monitor.c line 147

Last modified: 1996-03-23 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1231 |