1: # 2: /* 3: ** COPYRIGHT 4: ** 5: ** The Regents of the University of California 6: ** 7: ** 1977 8: ** 9: ** This program material is the property of the 10: ** Regents of the University of California and 11: ** may not be reproduced or disclosed without 12: ** the prior written permission of the owner. 13: */ 14: 15: 16: /* 17: ** Accessparam structure -- this structure is filled by 18: ** the paramd() and parami() routines. It gives a list of 19: ** key domains in their key sequence order. 20: */ 21: 22: struct accessparam 23: { 24: int mode; /* mode of relation, NOKEY, RANGEKEY, EXACTKEY */ 25: int sec_index; /* TRUE if relation is a secondary index. else FALSE */ 26: char keydno[MAXDOM + 1]; 27: }; 28: 29: /* 30: ** RETCODE STRUCTURE 31: ** This structure is passed back after each query to the front end 32: ** to give query status. 33: */ 34: 35: struct retcode 36: { 37: long rc_tupcount; /* count of tuples which satisfied */ 38: int rc_status; /* result status for the query */ 39: char rc_siteid[2]; /* reserved for distributed decomp */ 40: }; 41: 42: 43: 44: 45: /* 46: ** Desxx structure -- This structure is used by opencatalog and 47: ** closecatalog. It is used to maintain a list of system relations 48: ** for caching. 49: */ 50: 51: struct desxx 52: { 53: char *cach_relname; /* name of the relation */ 54: struct descriptor *cach_desc; /* desc to use */ 55: struct descriptor *cach_alias; /* alias for above descriptor */}; 56: 57: 58: /* 59: ** Relation status bits 60: ** 61: ** These bits are in the relation relation, in the "relstat" 62: ** field. They define status information about the relation. 63: */ 64: 65: # define S_CATALOG 0000001 /* system catalog */ 66: # define S_NOUPDT 0000002 /* no update allowed */ 67: # define S_PROTUPS 0000004 /* tuples exist in 'protect' */ 68: # define S_INTEG 0000010 /* integrity constrained */ 69: # define S_CONCUR 0000020 /* concurrency enforced */ 70: # define S_VIEW 0000040 /* relation is a view */ 71: # define S_VBASE 0000100 /* base rel for a view */ 72: # define S_INDEX 0000200 /* is a sec indx */ 73: # define S_BINARY 0000400 /* print char domains in binary */ 74: # define S_DISTRIBUTED 0001000 /* reserved for distributed rels */ 75: # define S_DISCRIT 0002000 /* resrved for distr temp rel */ 76: # define S_DISCOPY 0004000 /* reserved for distributed rels */ 77: # define S_PROTALL 0010000 /* if clear, all permission */ 78: # define S_PROTRET 0020000 /* if clear, read permission */ 79: 80: /* 81: ** Protection bits are defined as follows: 82: ** 83: ** S_PROTUPS -- if set, there are tuples for this relation in the 84: ** 85: ** S_PROTALL, S_PROTRET -- AS shown from the following table:* protect catalog. 86: ** PROTALL PROTRET meaning 87: ** 1 1 Need to look in the protect catalog to tell. 88: ** 1 0 Permit RETRIEVE to ALL case. 89: ** 0 1 Permit ALL to ALL case. 90: ** 0 0 Permit ALL to ALL and RETRIEVE to ALL. 91: */ 92: 93: /* 94: ** User status bits 95: ** 96: ** These bits are in the status field of the users file. They end 97: ** up in a variable "Status" after a call to initucode. 98: */ 99: 100: # define U_CREATDB 0000001 /* can create data bases */ 101: # define U_DRCTUPDT 0000002 /* can specify direct update */ 102: # define U_UPSYSCAT 0000004 /* can update system catalogs directly */ 103: # define U_TRACE 0000020 /* can use trace flags */ 104: # define U_QRYMODOFF 0000040 /* can turn off qrymod */ 105: # define U_APROCTAB 0000100 /* can use arbitrary proctab */ 106: # define U_EPROCTAB 0000200 /* can use =proctab form */ 107: # define U_SUPER 0100000 /* ingres superuser */ 108: 109: /* 110: ** The following defines declare the field number in the users 111: ** file for each field. 112: */ 113: 114: # define UF_NAME 0 /* login name */ 115: # define UF_UCODE 1 /* user code */ 116: # define UF_UID 2 /* UNIX user id */ 117: # define UF_GID 3 /* UNIX group id */ 118: # define UF_STAT 4 /* status bits */ 119: # define UF_FLAGS 5 /* default flags */ 120: # define UF_PTAB 6 /* default proctab */ 121: # define UF_IFILE 7 /* monitor init file */ 122: # define UF_DBLIST 9 /* list of valid databases */ 123: 124: # define UF_NFIELDS 10 /* TOTAL number of fields */ 125: 126: /* 127: ** Usercode contains the current user's INGRES user-id code. 128: ** Pathname contains the name of the INGRES subtree. 129: */ 130: 131: extern char *Usercode; 132: extern char *Pathname; 133: 134: 135: 136: /* 137: ** This is for type conversion, to avoid ugly pointer 138: ** casts all over the place: 139: */ 140: 141: # define i1deref(x) (*((char *)(x))) 142: # define i2deref(x) (*((int *)(x))) 143: # define i4deref(x) (*((long *)(x))) 144: # define f4deref(x) (*((float *)(x))) 145: # define f8deref(x) (*((double *)(x))) 146: 147: 148: /* 149: ** PRINTED OUTPUT ARGUMENTS 150: ** 151: ** The following struct describes the printed output available 152: ** to the user. 153: */ 154: 155: struct out_arg 156: { 157: int c0width; /* minimum width of "c" field */ 158: int i1width; /* width of "i1" field */ 159: int i2width; /* width of "i2" field */ 160: int i4width; /* width of "i4" field */ 161: int f4width; /* width of "f4" field */ 162: int f8width; /* width of "f8" field */ 163: int f4prec; /* number of decimal places on "f4" */ 164: int f8prec; /* number of decimal places on "f8" */ 165: char f4style; /* "f4" output style */ 166: char f8style; /* "f8" output style */ 167: int linesperpage; /* number of lines per output page */ 168: char coldelim; /* column delimiter */ 169: }; 170: 171: /* maximum width of any of the above fields */ 172: # define MAXFIELD 255 173: 174: /* 175: ** any text line read from a file (for example, .../files/users) can 176: ** be at most MAXLINE bytes long. buffers designed for holding 177: ** such info should be decleared as char buf[MAXLINE + 1] to allow 178: ** for the null terminator. 179: */ 180: 181: # define MAXLINE 256 182: 183: 184: /* 185: ** Assorted system stuff 186: ** 187: ** FILEMODE is the file mode on a 'creat' call for all files in 188: ** the database and probably other external files. 189: */ 190: 191: # define FILEMODE 0600 /* db file mode */ 192: 193: /* 194: ** defines to specify the execid of each process in the 195: ** current process structure. 196: ** The constants are named with "EXEC_" concatenated with 197: ** the process name. 198: */ 199: # define EXEC_DBU '#' /* data base utilities (or overlays) */ 200: # define EXEC_DECOMP '$' /* decomposition process */ 201: # define EXEC_OVQP '&' /* one variable query processor */ 202: # define EXEC_QRYMOD '*' /* query modification for view, protection, integrity */ 203: # define EXEC_PARSER '@' /* parser, scanner */ 204: # define EXEC_FRONT '^' /* could be equel prog or terminal monitor */ 205: # define EXEC_ERROR '%' /* exec_id of an error block */ 206: 207: /* stuff giving information about the machine */ 208: # define WORDSIZE 16 /* number of bits in word */ 209: # define LOG2WORDSIZE 4 /* log base 2 of WORDSIZE */