|
|
1.1 root 1: #ifndef _CHSYS_
2: #define _CHSYS_
3: #include "../h/param.h"
4: /*
5: * Operating system dependent definitions for UNIX (currently on VMUNIX)
6: * This file contains definitions which must be supplied to the system
7: * independent parts of the NCP.
8: * It should be minimal.
9: */
10: #ifdef VMUNIX
11: #include "cht.h"
12: #endif
13: #define CHSTRCODE /* UNIX interface needs stream code */
14: /*
15: * OP Sys dependent part of connection structure
16: */
17: struct csys_header {
18: #if NCHT > 0
19: struct tty *csys_ttyp; /* tty struct ptr if there is one */
20: #endif
21: char csys_mode; /* How we use this connection */
22: char csys_flags; /* System dependent flags */
23: };
24: /*
25: * cn_sflags definitions.
26: */
27: #define CHIWAIT 01 /* Someone waiting on input */
28: #define CHOWAIT 02 /* Someone waiting to output */
29: #define CHRAW 04 /* this channel is open by raw driver */
30: #define CHCLOSING 010 /* Top end is closing output. Any input
31: should abort the connection */
32: #define cn_mode cn_syshead.csys_mode
33: #define cn_sflags cn_syshead.csys_flags
34: #define cn_ttyp cn_syshead.csys_ttyp
35: #if NCHT == 0
36: #define chtnstate()
37: #define chtxint()
38: #define chtrint()
39: #endif
40:
41: /*
42: * macro definitions for process wakeup
43: */
44: #define NEWSTATE(x) { \
45: wakeup((char *)(x)); \
46: if ((x)->cn_mode == CHTTY) \
47: chtnstate(conn); \
48: else { \
49: INPUT(conn); \
50: OUTPUT(conn); \
51: } \
52: }
53:
54: #define INPUT(x) { \
55: if ((x)->cn_sflags&CHCLOSING) { \
56: (x)->cn_sflags &= ~CHCLOSING; \
57: clsconn(conn, CSCLOSED, NOPKT); \
58: } else { \
59: if ((x)->cn_sflags&CHIWAIT) { \
60: (x)->cn_sflags &= ~CHIWAIT; \
61: wakeup((char *)&(x)->cn_rhead); \
62: } \
63: if ((x)->cn_mode == CHTTY) \
64: chtrint(x); \
65: } \
66: }
67: #define OUTPUT(x) { \
68: if ((x)->cn_sflags&CHOWAIT) { \
69: (x)->cn_sflags &= ~CHOWAIT; \
70: wakeup((char *)&(x)->cn_thead); \
71: } \
72: if ((x)->cn_mode == CHTTY) \
73: chtxint(x); \
74: }
75: #define RFCINPUT { \
76: if (Rfcwaiting) { \
77: Rfcwaiting = 0; \
78: wakeup((char *)&Chrfclist); \
79: } \
80: }
81: /*
82: * These should be lower is software interrupts are used.
83: */
84: #define LOCK (void) spl6()
85: #define UNLOCK (void) spl0()
86:
87: #define NOINPUT(conn)
88: #define NOOUTPUT(conn)
89:
90: extern int Rfcwaiting;
91: /*
92: * The third argument to iomove doesn't use B_READ and B_WRITE to
93: * avoid being the only thing that needs UNIX include files.
94: */
95: #define CHWCOPY(from, to, count) (iomove(to, count, 0), (char *)0)
96: #define CHRCOPY(from, to, count) (iomove(from, count, 1), (char *)0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.