1 /* param.h 4.16 82/03/30 */ 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 #define DEV_BSIZE 512 99 #if CLSIZE==1 100 #define BSIZE 512 /* size of secondary block (bytes) */ 101 #define INOPB 8 /* 8 inodes per block */ 102 #define BMASK 0777 /* BSIZE-1 */ 103 #define BSHIFT 9 /* LOG2(BSIZE) */ 104 #define NMASK 0177 /* NINDIR-1 */ 105 #define NSHIFT 7 /* LOG2(NINDIR) */ 106 #define NICINOD 100 /* number of superblock inodes */ 107 #define NICFREE 50 /* number of superblock free blocks */ 108 109 #endif 110 111 #if CLSIZE==2 112 #define BSIZE 1024 113 #define INOPB 16 114 #define BMASK 01777 115 #define BSHIFT 10 116 #define NMASK 0377 117 #define NSHIFT 8 118 #define NICINOD 100 119 #define NICFREE 178 120 #endif 121 122 #if CLSIZE==4 123 #define BSIZE 2048 124 #define INOPB 32 125 #define BMASK 03777 126 #define BSHIFT 11 127 #define NMASK 0777 128 #define NSHIFT 9 129 #define NICINOD 100 130 #define NICFREE 434 131 #endif 132 133 #ifndef INTRLVE 134 /* macros replacing interleaving functions */ 135 #define dkblock(bp) ((bp)->b_blkno) 136 #define dkunit(bp) (minor((bp)->b_dev) >> 3) 137 #endif 138 139 /* inumber to disk address and inumber to disk offset */ 140 #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 141 #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 142 143 /* file system blocks to disk blocks and back */ 144 #define fsbtodb(b) ((b)*CLSIZE) 145 #define dbtofsb(b) ((b)/CLSIZE) 146 147 #define NINDIR (BSIZE/sizeof(daddr_t)) 148 149 #define CBSIZE 28 /* number of chars in a clist block */ 150 #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 151 152 /* 153 * Macros for fast min/max 154 */ 155 #define MIN(a,b) (((a)<(b))?(a):(b)) 156 #define MAX(a,b) (((a)>(b))?(a):(b)) 157 158 /* 159 * Some macros for units conversion 160 */ 161 /* Core clicks (512 bytes) to segments and vice versa */ 162 #define ctos(x) (x) 163 #define stoc(x) (x) 164 165 /* Core clicks (512 bytes) to disk blocks */ 166 #define ctod(x) (x) 167 168 /* clicks to bytes */ 169 #define ctob(x) ((x)<<9) 170 171 /* bytes to clicks */ 172 #define btoc(x) ((((unsigned)(x)+511)>>9)) 173 174 #ifndef KERNEL 175 #include <sys/types.h> 176 #else 177 #include "../h/types.h" 178 #endif 179 180 /* 181 * Machine-dependent bits and macros 182 */ 183 #define UMODE PSL_CURMOD /* usermode bits */ 184 #define USERMODE(ps) (((ps) & UMODE) == UMODE) 185 186 #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 187 188 /* 189 * Provide about n microseconds of delay 190 */ 191 #define DELAY(n) { register int N = (n); while (--N > 0); } 192