1: # include   <ingres.h>
   2: # include   <version.h>
   3: # include   <opsys.h>
   4: # include   <pv.h>
   5: # include   <func.h>
   6: # include   <signal.h>
   7: # include   <pipes.h>
   8: # include   <setjmp.h>
   9: # include   <sccs.h>
  10: # include   <symbol.h>
  11: 
  12: /*
  13: **	SYSTTYMON -
  14: **		sets up the pipe block for the sysmod function,
  15: **		and passed the -R flags in the parmvector.
  16: **
  17: **		note: this is kludged in the same way that the
  18: **			ingres monitor is-- there is no systm_mon.
  19: **			all work is done in systm_init.
  20: **
  21: **	SCCSID @(#)sysmon.c	8.1	12/31/84
  22: */
  23: 
  24: 
  25: 
  26: 
  27: extern      systm_mon();
  28: extern      systm_init();
  29: short       tTsysttymon[100];
  30: PARM        pv[PV_MAXPC+ 1];
  31: int     pc;
  32: extern jmp_buf  CmReset;
  33: 
  34: struct fn_def   SysTtyMonFn =
  35: {
  36:     "SYSMONITOR",
  37:     systm_mon,
  38:     systm_init,
  39:     NULL,
  40:     NULL,
  41:     0,
  42:     tTsysttymon,
  43:     100,
  44:     'S',
  45:     0
  46: };
  47: 
  48: systm_init(argc, argv)
  49: int argc;
  50: char    *argv[];
  51: {
  52:     pb_t        pb;
  53:     char        **p;
  54:     char        *pp;
  55: 
  56:     /*
  57: 	**	THIS CODE IS A CLUDGE!!!
  58: 	**
  59: 	**	all work is done in the init function
  60: 	** 	so that the sysmonitor will have control
  61: 	**	before the sysmod function.
  62: 	*/
  63: 
  64:     setjmp(CmReset);
  65: 
  66:     /* arrange to call the sysfunc */
  67:     for ( p = &argv[6]; (pp = *p) != NULL; p++)
  68:     {
  69:         pp = *p;
  70:         if (pp[1] == 'S')
  71:             continue;
  72:         syssetp(PV_STR, pp);
  73:     }
  74:     call_setup(&pb, mdSYSFUNC, NULL);
  75:     pb_prime(&pb, PB_REG);
  76:     pb.pb_proc = 1;     /**** SYSFUNC MUST BE IN PROC ONE ****/
  77:     send_off(&pb, pc, pv);
  78:     pb_tput(PV_EOF, "", 0, &pb);
  79:     pb_flush(&pb);
  80: 
  81:     /* wait for the response */
  82:     readinput(&pb);
  83:     resetp();
  84:     exit();
  85: }
  86: /*
  87: **  SYSSETP -- set parameter
  88: **
  89: **	Sets a parameter, to be later sent by 'call' to whomever.
  90: **	This looks suspiciously like ctlmod/setp.c, except
  91: **	it sets a local pc and pv, and doesnt need to know anything
  92: **	about the Ctx struct.
  93: **
  94: **	Parameters:
  95: **		type -- parameter type.
  96: **			PV_STRING -- a string, 'len' is ignored.
  97: **			PV_INT -- an integer, 'len' is ignored.
  98: **		val -- the value (real value if PV_INT, pointer
  99: **			otherwise).
 100: **		len -- the length of the tuple.
 101: **
 102: **	Returns:
 103: **		none
 104: **
 105: **		Adjusts pc & pv.
 106: **
 107: */
 108: 
 109: syssetp(type, val, len)
 110: register int    type;
 111: char        *val;
 112: register int    len;
 113: {
 114:     PARM    *pp;
 115:     char    *newp;
 116:     extern char *need();
 117:     char    *buf;
 118: 
 119:     /*
 120: 	**  Check the magic bounds.
 121: 	*/
 122: 
 123:     pp = &pv[pc++];
 124: 
 125:     /*
 126: 	**  Figure out the length from the type.
 127: 	*/
 128: 
 129:     switch (type)
 130:     {
 131:       case PV_STR:
 132:         len = length(val) + 1;
 133:         newp = need(Qbuf, len);
 134:         bmove(val, newp, len);
 135:         buf = newp;
 136:         pp->pv_val.pv_str = newp;
 137:         break;
 138: 
 139:       case PV_INT:
 140:         len = sizeof (short);
 141:         pp->pv_val.pv_int = (int) val;
 142:         break;
 143: 
 144: 
 145:       default:
 146:         syserr("syssetp: type %d", type);
 147:     }
 148: 
 149:     /*
 150: 	**  Set up the parameter.
 151: 	*/
 152: 
 153:     pp->pv_type = type;
 154:     pp->pv_len = len;
 155: 
 156: # ifdef xSTR1
 157:     if tTf(0,0)
 158:     {
 159:         lprintf("syssetp: ");
 160:         pr_parm(pp);
 161:     }
 162: # endif
 163: }
 164: /*
 165: **  SYSTM_MON -- "function to implement this module"
 166: **
 167: **	Since we have cludged up this module to work, and hence
 168: **	the init routine should never return, this routine just
 169: **	syserr's.
 170: */
 171: 
 172: systm_mon()
 173: {
 174:     syserr("systm_mon");
 175: }
 176: /*
 177: **  ACC_INIT, PAGEFLUSH -- dummy access method routines
 178: **
 179: **	Since the CM wants to do some basic access method functions,
 180: **	we will let it.
 181: */
 182: 
 183: acc_init()
 184: {
 185: }
 186: 
 187: pageflush(x)
 188: char    *x;
 189: {
 190:     return (0);
 191: }
 192: /*
 193: **  CLOSECATALOG -- dummy catalog close routine.
 194: **
 195: **	To keep from loading access methods.
 196: */
 197: 
 198: closecatalog()
 199: {
 200: }
 201: 
 202: 
 203: /*
 204: **  GET FLAG
 205: **
 206: */
 207: 
 208: getflag(argv, dest)     /* need some data structure to hold the flags */
 209: char    **argv;
 210: char    **dest;
 211: {
 212:     int     destctr;
 213:     int     i;
 214: 
 215:     destctr = 0;
 216:     for (i = 0; i <= 6; i++)
 217:     {
 218:         if (argv[i][0] != NULL)
 219:             strcpy( dest[destctr++], argv[i]);
 220:         else
 221:             return(0);
 222:     }
 223:     return(0);
 224: }

Defined functions

acc_init defined in line 183; never used
closecatalog defined in line 198; never used
getflag defined in line 208; never used
syssetp defined in line 109; used 1 times
  • in line 72
systm_init defined in line 48; used 2 times
systm_mon defined in line 172; used 2 times

Defined variables

SysTtyMonFn defined in line 34; never used
pc defined in line 31; used 2 times
tTsysttymon defined in line 29; used 1 times
  • in line 42
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1130
Valid CSS Valid XHTML 1.0 Strict