|
|
1.1 root 1: #define QPCTL 0100 /* priority control message */
2: #define QBSIZE 64 /* "standard" size of queue block*/
3:
4: /*
5: * data queue
6: */
7: struct queue {
8: struct qinit *qinfo; /* procs and limits for queue */
9: struct block *first; /* first data block */
10: struct block *last; /* last data block */
11: struct queue *next; /* Q of next stream */
12: struct queue *link; /* to next Q for scheduling */
13: caddr_t ptr; /* to private data structure */
14: short count; /* number of blocks on Q */
15: u_short flag;
16: };
17:
18: /* Queue flags */
19: #define QENAB 01 /* Queue is already enabled to run */
20: #define QWANTR 02 /* Someone wants to read Q */
21: #define QWANTW 04 /* Someone wants to write Q */
22: #define QFULL 010 /* Q is considered full */
23: #define QREADR 020 /* This is the reader (first) Q */
24: #define QUSE 040 /* This queue in use (allocation) */
25: #define QNOENB 0100 /* Don't enable Q via putq */
26: #define QDELIM 0200 /* This queue generates delimiters */
27: #define QBIGB 0400 /* This queue would like big blocks */
28:
29: /*
30: * queue information structure
31: */
32: struct qinit {
33: int (*putp)(); /* put procedure */
34: int (*srvp)(); /* service procedure */
35: long (*qopen)(); /* called on startup */
36: int (*qclose)(); /* called on finish */
37: short limit; /* high water mark */
38: short lolimit; /* low water mark */
39: };
40:
41: #define OTHERQ(q) ((q)->flag&QREADR? (q)+1: (q)-1)
42: #define WR(q) (q+1)
43: #define RD(q) (q-1)
44:
45: /*
46: * Queue data block
47: */
48: struct block {
49: struct block *next;
50: u_char *rptr;
51: u_char *wptr;
52: u_char *lim;
53: u_char *base;
54: char type;
55: char class;
56: };
57:
58: /*
59: * Header for a stream: interface to rest of system
60: */
61: struct stdata {
62: struct queue *wrq; /* write queue */
63: struct block *iocblk; /* return block for ioctl */
64: struct inode *inode; /* backptr, for hangups */
65: struct proc *wsel; /* process write-selecting */
66: struct proc *rsel; /* process read-selecting */
67: short pgrp; /* process group, for signals */
68: char flag;
69: char count; /* # processes in stream routines */
70: };
71: #define IOCWAIT 01 /* Someone wants to do ioctl */
72: #define RSLEEP 02 /* Someone wants to read */
73: #define WSLEEP 04 /* Someone wants to write */
74: #define HUNGUP 010 /* Device has vanished */
75: #define RSEL 020 /* read-select collision*/
76: #define WSEL 040 /* write-select collision */
77: #define EXCL 0100 /* exclusive-use (no opens) */
78: #define STWOPEN 0200 /* waiting for 1st open */
79:
80: struct block *getq();
81: int putq();
82: struct block *allocb();
83: struct queue *backq();
84: struct queue *allocq();
85:
86: /*
87: * Control messages (regular priority)
88: */
89: #define M_DATA 0 /* regular data (not ctl) */
90: #define M_BREAK 01 /* line break */
91: #define M_HANGUP 02 /* line disconnect */
92: #define M_DELIM 03 /* data delimiter */
93: #define M_ECHO 04 /* request ACK (1 param) */
94: #define M_ACK 05 /* response to ECHO (1 param) */
95: #define M_IOCTL 06 /* ioctl; set/get params */
96: #define M_DELAY 07 /* real-time xmit delay (1 param) */
97: #define M_CTL 010 /* device-specific control message */
98: #define M_PASS 011 /* pass file */
99: #define M_YDEL 012 /* stream has started generating delims */
100: #define M_NDEL 013 /* stream has stopped generating delims */
101:
102: /*
103: * Control messages (high priority; go to head of queue)
104: */
105: #define M_SIGNAL 0101 /* generate process signal */
106: #define M_FLUSH 0102 /* flush your queues */
107: #define M_STOP 0103 /* stop transmission immediately */
108: #define M_START 0104 /* restart transmission after stop */
109: #define M_IOCACK 0105 /* acknowledge ioctl */
110: #define M_IOCNAK 0106 /* negative ioctl acknowledge */
111: #define M_CLOSE 0107 /* channel closes (dk only) */
112: #define M_IOCWAIT 0110 /* stop ioctl timeout, ack/nak follows later */
113:
114: #define setqsched() mtpr(SIRR, 0x1);
115:
116: /*
117: * for passing files across streams
118: */
119: struct kpassfd {
120: union {
121: struct file *fp;
122: int fd;
123: } f;
124: short uid;
125: short gid;
126: short nice;
127: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.