1 /* param.h 4.11 81/05/05 */ 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 75 /* 76 * Clustering of hardware pages on machines with ridiculously small 77 * page sizes is done here. The paging subsystem deals with units of 78 * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must 79 * be CLSIZE*NBPG in the current implementation, that is the paging subsystem 80 * deals with the same size blocks that the file system uses. 81 * 82 * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE 83 */ 84 #define CLSIZE 2 85 #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ 86 87 /* give the base virtual address (first of CLSIZE) */ 88 #define clbase(i) ((i) &~ (CLSIZE-1)) 89 90 /* round a number of clicks up to a whole cluster */ 91 #define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) 92 93 #if CLSIZE==1 94 #define BSIZE 512 /* size of secondary block (bytes) */ 95 #define INOPB 8 /* 8 inodes per block */ 96 #define BMASK 0777 /* BSIZE-1 */ 97 #define BSHIFT 9 /* LOG2(BSIZE) */ 98 #define NMASK 0177 /* NINDIR-1 */ 99 #define NSHIFT 7 /* LOG2(NINDIR) */ 100 #define NICINOD 100 /* number of superblock inodes */ 101 #define NICFREE 50 /* number of superblock free blocks */ 102 103 #endif 104 105 #if CLSIZE==2 106 #define BSIZE 1024 107 #define INOPB 16 108 #define BMASK 01777 109 #define BSHIFT 10 110 #define NMASK 0377 111 #define NSHIFT 8 112 #define NICINOD 100 113 #define NICFREE 178 114 #endif 115 116 #if CLSIZE==4 117 #define BSIZE 2048 118 #define INOPB 32 119 #define BMASK 03777 120 #define BSHIFT 11 121 #define NMASK 0777 122 #define NSHIFT 9 123 #define NICINOD 100 124 #define NICFREE 434 125 #endif 126 127 #ifndef INTRLVE 128 /* macros replacing interleaving functions */ 129 #define dkblock(bp) ((bp)->b_blkno) 130 #define dkunit(bp) (minor((bp)->b_dev) >> 3) 131 #endif 132 133 /* inumber to disk address and inumber to disk offset */ 134 #define itod(x) ((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB))) 135 #define itoo(x) ((int)(((x)+2*INOPB-1)%INOPB)) 136 137 /* file system blocks to disk blocks and back */ 138 #define fsbtodb(b) ((b)*CLSIZE) 139 #define dbtofsb(b) ((b)/CLSIZE) 140 141 #define NINDIR (BSIZE/sizeof(daddr_t)) 142 143 #define CBSIZE 28 /* number of chars in a clist block */ 144 #define CROUND 0x1F /* clist rounding; sizeof(int *) + CBSIZE -1*/ 145 #define CLKTICK (1000000/(HZ)) /* microseconds in a clock tick */ 146 147 /* 148 * Macros for fast min/max 149 */ 150 #define MIN(a,b) (((a)<(b))?(a):(b)) 151 #define MAX(a,b) (((a)>(b))?(a):(b)) 152 153 /* 154 * Some macros for units conversion 155 */ 156 /* Core clicks (512 bytes) to segments and vice versa */ 157 #define ctos(x) (x) 158 #define stoc(x) (x) 159 160 /* Core clicks (512 bytes) to disk blocks */ 161 #define ctod(x) (x) 162 163 /* clicks to bytes */ 164 #define ctob(x) ((x)<<9) 165 166 /* bytes to clicks */ 167 #define btoc(x) ((((unsigned)(x)+511)>>9)) 168 169 #ifndef KERNEL 170 #include <sys/types.h> 171 #else 172 #include "../h/types.h" 173 #endif 174 175 /* 176 * Machine-dependent bits and macros 177 */ 178 #define UMODE PSL_CURMOD /* usermode bits */ 179 #define USERMODE(ps) (((ps) & UMODE) == UMODE) 180 181 #define BASEPRI(ps) (((ps) & PSL_IPL) != 0) 182 183 /* 184 * Provide about n microseconds of delay 185 */ 186 #define DELAY(n) { register int N = (n); while (--N > 0); } 187