|
|
1.1 root 1: # include <ingres.h>
2: # include "IIglobals.h"
3: # include <sccs.h>
4:
5: SCCSID(@(#)IIpb_read.c 7.1 2/5/81)
6:
7:
8: /*
9: ** IIPB_READ -- read a pipe block
10: **
11: ** This routine reads a pipe block into *ppb. It also handles
12: ** all the low level protocol: RESET blocks, SYNC blocks, META
13: ** blocks, blocks intended for another process, etc.
14: **
15: ** When this routine returns, it returns with a block intended
16: ** for this process, which must be a REGULAR block, a RESPONSE
17: ** block, or an ERROR block.
18: **
19: ** Parameters:
20: ** ppb -- a pointer to the area which wants the block.
21: **
22: ** Returns:
23: ** none
24: **
25: ** Side Effects:
26: ** ppb is set to the named block.
27: ** Virtually any amount of stuff can happen, depending
28: ** on what is coming through the pipe.
29: **
30: ** Trace Flags:
31: ** 12.4 - 12.9
32: */
33:
34:
35: IIpb_read(ppb)
36: register pb_t *ppb;
37: {
38: register int type;
39: register int from;
40:
41: /*
42: ** Top Loop.
43: ** Hang waiting for a normal block. Other blocks are
44: ** handled inside the loop.
45: ** We multiplex 'from' in here temporarily.
46: */
47:
48: for (;;)
49: {
50: from = IIpb_rphys(ppb, IIinput);
51:
52: if (from != PB_IOSIZE)
53: IIsyserr("pb_read: read error (%d)", from);
54:
55: /* set up buffer pointers, etc. */
56: ppb->pb_xptr = ppb->pb_data;
57: ppb->pb_nleft = ppb->pb_nused;
58: type = ppb->pb_type;
59: from = ppb->pb_from;
60:
61: /* do sync block processing */
62: if (type == PB_SYNC)
63: {
64: IISyncs[from]--;
65: continue;
66: }
67:
68: /* see if we are ignoring from this process */
69: if (IISyncs[from] > 0)
70: continue;
71:
72: /*
73: ** Block type dispatching.
74: ** Regular, response, and error blocks return.
75: ** Meta blocks are handled by calling other
76: ** routines.
77: */
78:
79: switch (type)
80: {
81: case PB_REG:
82: case PB_RESP:
83: case PB_ERR:
84: /* handled by readinput() */
85: return;
86:
87: /* insert more meta handling before this line */
88:
89: default:
90: IIsyserr("pb_read: type %d", type);
91: }
92: }
93: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.