1: # include <stdio.h> 2: # include "ctlmod.h" 3: # include "pipes.h" 4: # include <symbol.h> 5: # include <tree.h> 6: # include <resp.h> 7: # include <sccs.h> 8: 9: SCCSID(@(#)send_off.c 8.1 12/31/84) 10: 11: /* 12: ** SEND_OFF -- send a call off to another process 13: ** 14: ** This routine sends a call off to the process indicated 15: ** ppb->pb_proc. It also sends parameters pc & pv. It 16: ** just sends it, and does not wait for a response. 17: ** 18: ** WARNING: 19: ** The pipe buffer is not flushed after putting out 20: ** the call; this must be done by the caller. 21: ** 22: ** Parameters: 23: ** ppb -- a pointer to a pipe block which is used 24: ** as the I/O area, and also identifies 25: ** the target process. 26: ** pc -- the parameter count. 27: ** pv -- the parameter vector. 28: ** 29: ** Returns: 30: ** none 31: ** 32: ** Side Effects: 33: ** none 34: ** 35: ** Trace Flags: 36: ** 11.0 - 11.7 37: */ 38: 39: send_off(ppb, pc, pv) 40: register pb_t *ppb; 41: int pc; 42: register PARM *pv; 43: { 44: register int i; 45: 46: # ifdef xCTR1 47: if (tTf(11, 0)) 48: { 49: lprintf("send_off: "); 50: pb_dump(ppb, FALSE); 51: } 52: # endif 53: 54: /* 55: ** Flush out catalog pages and standard output so that 56: ** changes will show through. 57: */ 58: 59: closecatalog(FALSE); 60: fflush(stdout); 61: clrbit(PB_EOF, ppb->pb_stat); 62: 63: /* 64: ** Cycle through the parameters writing each one out. 65: */ 66: 67: if (ppb->pb_type == PB_RESP) 68: { 69: pb_put((char *) &Resp, sizeof Resp, ppb); 70: /* 71: send_arg(&Resp.resp_rval, ppb); 72: */ 73: } 74: else 75: { 76: for (i = 0; i < pc; i++) 77: { 78: send_arg(&pv[i], ppb); 79: } 80: } 81: 82: /* deallocate the space allocated to these parameters */ 83: freebuf(Qbuf, Ctx.ctx_pmark); 84: # ifdef xCTR1 85: if (tTf(11, 1)) 86: lprintf("send_off: free %d\n", Ctx.ctx_pmark); 87: # endif 88: } 89: /* 90: ** SEND_ARG -- send argument down pipe. 91: ** 92: ** Parameters: 93: ** pparm -- the parameter to send. 94: ** ppb -- the pipe to send it to. 95: ** 96: ** Returns: 97: ** none. 98: ** 99: ** Side Effects: 100: ** none. 101: ** 102: ** Called By: 103: ** send_off 104: ** do_seq 105: */ 106: 107: send_arg(pparm, ppb) 108: register PARM *pparm; 109: register pb_t *ppb; 110: { 111: register char *p; 112: extern pb_put(); 113: 114: switch (pparm->pv_type) 115: { 116: case PV_STR: 117: p = pparm->pv_val.pv_str; 118: pb_tput(PV_STR, p, length(p) + 1, ppb); 119: break; 120: 121: case PV_INT: 122: pb_tput(PV_INT, &pparm->pv_val.pv_int, sizeof (pparm->pv_val.pv_int), ppb); 123: break; 124: 125: case PV_QTREE: 126: pb_tput(PV_QTREE, "", 0, ppb); 127: writeqry((QTREE *) pparm->pv_val.pv_qtree, pb_put, (int) ppb); 128: break; 129: 130: case PV_TUPLE: 131: pb_tput(PV_TUPLE, pparm->pv_val.pv_tuple, pparm->pv_len, ppb); 132: break; 133: 134: case PV_EOF: 135: break; 136: 137: default: 138: syserr("send_arg: type %d", pparm->pv_type); 139: } 140: }