|
|
1.1 root 1: /*
2: * static char ID[] = "@(#) sdp.h: 1.1 3/16/82";
3: */
4: /* take spot audit */
5: #define AUDITNOW 2
6:
7: /* turn audits off */
8: #define AUDITOFF 0
9:
10: /* turn audits on */
11: #define AUDITON 1
12:
13: /* error return from non pointer-valued functions */
14: #define ERROR (-1)
15:
16: /* error return from id valued functions */
17:
18: #define IDERROR (-1l)
19:
20: /* mnemonic to indicate an impossible itemid */
21: #define IDNULL (-2l)
22:
23: /* turn error messages off */
24: #define MESGOFF 0
25:
26: /* turn error messages on */
27: #define MESGON 1
28:
29: /* successful return from non pointer-valued functions */
30: #define SUCCESS 1
31:
32: /* permissions to change item for use */
33: #define WRTN 2
34:
35: /* permissions not to change item for use */
36: #define RNLY 0
37:
38: /* macro for error conditions */
39: #define ERR_RET(f,r) {FATAL(f) ; return(r) ;}
40: /*
41: * If the user includes <stdio.h> ahead of "sdp.h," then sdp_hist will be
42: * defined correctly as pointer to structure FILE; otherwise, sdp_hist will
43: * be define as pointer to char.
44: */
45:
46: #ifdef FILE
47: #define MY_FILE FILE
48: #else
49: #define MY_FILE char
50: #endif
51:
52: typedef long ITEMID ;
53: typedef int FD ;
54: typedef long BOUNDARY ;
55:
56: struct SPACE /* the structure to hold header file */
57: {
58: long version ; /* version number in form YYMMDD */
59: unsigned page_size ; /* number of bytes in a page */
60: ITEMID maxpage ; /* highest byte allotted (page aligned) */
61: ITEMID curpage ; /* id to current page during connection */
62: unsigned curleft ; /* number of bytes left in current page */
63: int perms ; /* whether changes are enabled */
64: int mode ; /* creation mode */
65: int numbfile ; /* number of files comprising space */
66: struct FILEINFO *fileinfo ; /* pointer to file information array */
67: int numbstax ; /* number of allottment stacks */
68: struct STAXINFO *staxinfo ; /* pointer to stack information array */
69: char *head_name ; /* name of address space */
70: ITEMID known_id ; /* for user */
71: struct ENVIRON *environ; /* pointer to environment */
72: struct LIBFILE *lib_file ; /* pointer to file library structure */
73: struct SPACE *next_space ; /* link to next space */
74: long sp1_hash ; /* hash code for audits */
75: long sp2_hash ; /* hash code for audits */
76: } ;
77:
78: struct STATS /* structure to hold paging statistics */
79: {
80: long uses ; /* number of calls to sdp_use */
81: long faults ; /* number of page faults */
82: long writes ; /* number of faults causing writes */
83: int maxuse ; /* largest number of frames in use */
84: int curuse ; /* current number of frames in use */
85: } ;
86:
87: struct ENVIRON /* structure to describe memory setup */
88: {
89: int num_frames ; /* number of frames for swapping */
90: unsigned frame_size ; /* size of frames in bytes */
91: int empties ; /* start of list of empty frames */
92: int cnct_count ; /* spaces connected to this environment */
93: struct MANAGER *manp ; /* pointer to array frame managers */
94: struct LIBMEM *lib_mem ; /* pointer to memory library structure */
95: struct ENVIRON *next_environ ; /* link to next environment */
96: struct STATS stats ; /* holds paging statistics */
97: long en_hash ; /* hash code for audits */
98: } ;
99:
100: struct FILEINFO /* structure to hold file information */
101: {
102: FD desc ; /* file descriptor */
103: long leng ; /* length of file in bytes */
104: } ;
105:
106: struct STAXINFO /* structure to hold stack information */
107: {
108: ITEMID top ; /* itemid to top of stack */
109: long size ; /* size of items in stack */
110: long depth ; /* number of items in stack */
111: } ;
112:
113: struct MANAGER /* structure to manage frames */
114: {
115: struct SPACE *space ; /* space identifier */
116: ITEMID page_id ; /* byte offset in space */
117: long usecount ; /* number of use calls on this id */
118: int ref_chng ; /* reference/change flag */
119: int forward ; /* index of next manager */
120: int backward ; /* index of previous manager */
121: char *frame_pntr ; /* pointer to frame to be managed */
122: long mn_hash ; /* hash code for audits */
123: } ;
124:
125: struct LIBFILE /* pointers to file library functions */
126: {
127: char * (*libbuildname)() ; /* pointer to name build function */
128: int (*libclose)() ; /* pointer to file close function */
129: int (*libcreate)() ; /* pointer to file create function */
130: FD (*libopen)() ; /* pointer to file open function */
131: int (*libread)() ; /* pointer to file read function */
132: int (*libseek)() ; /* pointer to file position function */
133: int (*libunlink)() ; /* pointer to file delete function */
134: int (*libwrite)() ; /* pointer to file write function */
135: } ;
136:
137: struct LIBMEM /* pointers to memory library functions */
138: {
139: int * (*liballoc)() ; /* pointer to memory allocation function*/
140: int (*libfree)() ; /* pointer to memory free function */
141: } ;
142:
143: extern ITEMID sdp_allot() ;
144: extern int sdp_audit() ;
145: extern int sdp_change() ;
146: extern struct SPACE *sdp_connect() ;
147: extern int sdp_destroy() ;
148: extern int sdp_disconnect() ;
149: extern int sdp_generate() ;
150: extern MY_FILE *sdp_hist() ;
151: extern struct ENVIRON *sdp_house() ;
152: extern int sdp_redeem() ;
153: extern struct STATS sdp_stats() ;
154: extern int sdp_sync() ;
155: extern int sdp_unuse() ;
156: extern BOUNDARY *sdp_use() ;
157: extern int sdp_vacate() ;
158:
159: extern int mesg_flag ;
160: extern char *llaerrfile ;
161: extern ITEMID *known_idptr ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.