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