1 /* param.h 4.15 82/02/15 */ 2 3 /* 4 * Tunable variables which do not usually vary per system. 5 * 6 * The sizes of most system tables are configured 7 * into each system description. The file system buffer 8 * cache size is assigned based on available memory. 9 * The tables whose sizes don't vary often are given here. 10 */ 11 12 #define NMOUNT 15 /* number of mountable file systems */ 13 #define MSWAPX 15 /* pseudo mount table index for swapdev */ 14 #define MAXUPRC 25 /* max processes per user */ 15 #define SSIZE 4 /* initial stack size (*512 bytes) */ 16 #define SINCR 4 /* increment of stack (*512 bytes) */ 17 #define NOFILE 20 /* max open files per process */ 18 /* NOFILE MUST NOT BE >= 31; SEE pte.h */ 19 #define CANBSIZ 256 /* max size of typewriter line */ 20 #define NCARGS 10240 /* # characters in exec arglist */ 21 22 /* 23 * priorities 24 * probably should not be 25 * altered too much 26 */ 27 28 #define PSWP 0 29 #define PINOD 10 30 #define PRIBIO 20 31 #define PRIUBA 24 32 #define PZERO 25 33 #define PPIPE 26 34 #define PWAIT 30 35 #define PSLEP 40 36 #define PUSER 50 37 38 #define NZERO 20 39 40 /* 41 * signals 42 * dont change 43 */ 44 45 #ifndef NSIG 46 #include <signal.h> 47 #endif 48 49 /* 50 * Return values from tsleep(). 51 */ 52 #define TS_OK 0 /* normal wakeup */ 53 #define TS_TIME 1 /* timed-out wakeup */ 54 #define TS_SIG 2 /* asynchronous signal wakeup */ 55 56 /* 57 * fundamental constants of the implementation-- 58 * cannot be changed easily. 59 */ 60 61 #define NBBY 8 /* number of bits in a byte */ 62 #define NBPW sizeof(int) /* number of bytes in an integer */ 63 #define NBPG 512 64 #define PGOFSET (NBPG-1) /* byte offset into page */ 65 #define PGSHIFT 9 /* LOG2(NBPG) */ 66 67 #define UPAGES 8 /* pages of u-area */ 68 #define NULL 0 69 #define CMASK 0 /* default mask for file creation */ 70 #define NODEV (dev_t)(-1) 71 #define ROOTINO ((ino_t)2) /* i number of all roots */ 72 #define SUPERB ((daddr_t)1) /* block number of the super block */ 73 #define DIRSIZ 14 /* max characters per directory */ 74 #define NGRPS 256 /* max number groups */ 75 76 /* 77 * Clustering of hardware pages on machines with ridiculously small 78 * page sizes is done here. The paging subsystem deals with units of 79 * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 80 * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 81 * deals with the same size blocks that the file system uses. 82 * 83 * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 84 */ 85 #define CLSIZE 2 86 #define CLBYTES (CLSIZE*NBPG) 87 #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 88 #define claligned(x) ((((int)(x))&CLOFSET)==0) 89 #define CLOFF CLOFSET 90 #define CLSHIFT (PGSHIFT+1) 91 92 /* give the base virtual address (first of CLSIZE) */ 93 #define clbase(i) ((i) &~ (CLSIZE-1)) 94 95 /* round a number of clicks up to a whole cluster */ 96 #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 97 98 #if CLSIZE==1 99 #define BSIZE 512 /* size of secondary block (bytes) */ 100 #define INOPB 8 /* 8 inodes per block */ 101 #define BMASK 0777 /* BSIZE-1 */ 102 #define BSHIFT 9 /* LOG2(BSIZE) */ 103 #define NMASK 0177 /* NINDIR-1 */ 104 #define NSHIFT 7 /* LOG2(NINDIR) */ 105 #define NICINOD 100 /* number of superblock inodes */ 106 #define NICFREE 50 /* number of superblock free blocks */ 107 108 #endif 109 110 #if CLSIZE==2 111 #define BSIZE 1024 112 #define INOPB 16 113 #define BMASK 01777 114 #define BSHIFT 10 115 #define NMASK 0377 116 #define NSHIFT 8 117 #define NICINOD 100 118 #define NICFREE 178 119 #endif 120 121 #if CLSIZE==4 122 #define BSIZE 2048 123 #define INOPB 32 124 #define BMASK 03777 125 #define BSHIFT 11 126 #define NMASK 0777 127 #define NSHIFT 9 128 #define NICINOD 100 129 #define NICFREE 434 130 #endif 131 132 #ifndef INTRLVE 133 /* macros replacing interleaving functions */ 134 #define dkblock(bp) ((bp)->b_blkno) 135 #define dkunit(bp) (minor((bp)->b_dev) >> 3) 136 #endif 137 138 /* inumber to disk address and inumber to disk offset */ 139 #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 140 #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 141 142 /* file system blocks to disk blocks and back */ 143 #define fsbtodb(b) ((b)*CLSIZE) 144 #define dbtofsb(b) ((b)/CLSIZE) 145 146 #define NINDIR (BSIZE/sizeof(daddr_t)) 147 148 #define CBSIZE 28 /* number of chars in a clist block */ 149 #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 150 151 /* 152 * Macros for fast min/max 153 */ 154 #define MIN(a,b) (((a)<(b))?(a):(b)) 155 #define MAX(a,b) (((a)>(b))?(a):(b)) 156 157 /* 158 * Some macros for units conversion 159 */ 160 /* Core clicks (512 bytes) to segments and vice versa */ 161 #define ctos(x) (x) 162 #define stoc(x) (x) 163 164 /* Core clicks (512 bytes) to disk blocks */ 165 #define ctod(x) (x) 166 167 /* clicks to bytes */ 168 #define ctob(x) ((x)<<9) 169 170 /* bytes to clicks */ 171 #define btoc(x) ((((unsigned)(x)+511)>>9)) 172 173 #ifndef KERNEL 174 #include <sys/types.h> 175 #else 176 #include "../h/types.h" 177 #endif 178 179 /* 180 * Machine-dependent bits and macros 181 */ 182 #define UMODE PSL_CURMOD /* usermode bits */ 183 #define USERMODE(ps) (((ps) & UMODE) == UMODE) 184 185 #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 186 187 /* 188 * Provide about n microseconds of delay 189 */ 190 #define DELAY(n) { register int N = (n); while (--N > 0); } 191