xref: /csrg-svn/sys/sys/param.h (revision 254)
1 /*	param.h	3.6	06/07/80	*/
2 
3 /*
4  * tunable variables
5  *
6  * NB: NBUF is well known in locore.s
7  */
8 
9 #define	NBUF	48		/* size of buffer cache */
10 #define	NINODE	250		/* number of in core inodes */
11 #define	NFILE	225		/* number of in core file structures */
12 #define	NMOUNT	8		/* number of mountable file systems */
13 #define	MAXUPRC	25		/* max processes per user */
14 #define	SSIZE	4		/* initial stack size (*512 bytes) */
15 #define	SINCR	4		/* increment of stack (*512 bytes) */
16 #define	NOFILE	20		/* max open files per process */
17 #define	CANBSIZ	256		/* max size of typewriter line */
18 #define	SMAPSIZ	(4*NPROC)	/* size of swap allocation area */
19 #define	NCALL	40		/* max simultaneous time callouts */
20 #define	NPROC	150		/* max number of processes */
21 #define	NTEXT	60		/* max number of pure texts */
22 #define	NCLIST	500		/* max total clist size */
23 #define	HZ	60		/* Ticks/second of the clock */
24 #define	TIMEZONE (8*60)		/* Minutes westward from Greenwich */
25 #define	DSTFLAG	1		/* Daylight Saving Time applies in this locality */
26 #define	MSGBUFS	128		/* Characters saved from error messages */
27 #define	NCARGS	5120		/* # characters in exec arglist */
28 /*
29  * priorities
30  * probably should not be
31  * altered too much
32  */
33 
34 #define	PSWP	0
35 #define	PINOD	10
36 #define	PRIBIO	20
37 #define	PRIUBA	24
38 #define	PZERO	25
39 #define	PPIPE	26
40 #define	PWAIT	30
41 #define	PSLEP	40
42 #define	PUSER	50
43 
44 #define	NZERO	20
45 
46 /*
47  * signals
48  * dont change
49  */
50 
51 #ifndef	NSIG
52 #include <signal.h>
53 #endif
54 
55 /*
56  * Return values from tsleep().
57  */
58 #define	TS_OK	0	/* normal wakeup */
59 #define	TS_TIME	1	/* timed-out wakeup */
60 #define	TS_SIG	2	/* asynchronous signal wakeup */
61 
62 /*
63  * fundamental constants of the implementation--
64  * cannot be changed easily.
65  * note: UPAGES is well known in locore.s
66  */
67 
68 #define	NBPW	sizeof(int)	/* number of bytes in an integer */
69 
70 #define	UPAGES	6		/* pages of u-area */
71 #define	NULL	0
72 #define	CMASK	0		/* default mask for file creation */
73 #define	NODEV	(dev_t)(-1)
74 #define	ROOTINO	((ino_t)2)	/* i number of all roots */
75 #define	SUPERB	((daddr_t)1)	/* block number of the super block */
76 #define	DIRSIZ	14		/* max characters per directory */
77 
78 /*
79  * Clustering of hardware pages on machines with ridiculously small
80  * page sizes is done here.  The paging subsystem deals with units of
81  * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
82  * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
83  * deals with the same size blocks that the file system uses.
84  *
85  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
86  *
87  * NB: CLSIZE is well known in locore.s.
88  */
89 #define	CLSIZE	2
90 
91 /* give the base virtual address (first of CLSIZE) */
92 #define	clbase(i)	((i) &~ (CLSIZE-1))
93 
94 /* round a number of clicks up to a whole cluster */
95 #define	clrnd(i)	(((i) + (CLSIZE-1)) &~ (CLSIZE-1))
96 
97 #if CLSIZE==1
98 #define	BSIZE	512		/* size of secondary block (bytes) */
99 #define	INOPB	8		/* 8 inodes per block */
100 #define	BMASK	0777		/* BSIZE-1 */
101 #define	BSHIFT	9		/* LOG2(BSIZE) */
102 #define	NMASK	0177		/* NINDIR-1 */
103 #define	NSHIFT	7		/* LOG2(NINDIR) */
104 #define	NICINOD	100		/* number of superblock inodes */
105 #define	NICFREE	50		/* number of superblock free blocks */
106 
107 #endif
108 
109 #if CLSIZE==2
110 #define	BSIZE	1024
111 #define	INOPB	16
112 #define	BMASK	01777
113 #define	BSHIFT	10
114 #define	NMASK	0377
115 #define	NSHIFT	8
116 #define	NICINOD	100
117 #define	NICFREE	178
118 #endif
119 
120 #if CLSIZE==4
121 #define	BSIZE	2048
122 #define	INOPB	32
123 #define	BMASK	03777
124 #define	BSHIFT	11
125 #define	NMASK	0777
126 #define	NSHIFT	9
127 #define	NICINOD	100
128 #define	NICFREE	434
129 #endif
130 
131 #ifndef INTRLVE
132 /* macros replacing interleaving functions */
133 #define	dkblock(bp)	((bp)->b_blkno)
134 #define	dkunit(bp)	(minor((bp)->b_dev) >> 3)
135 #endif
136 
137 /* inumber to disk address and inumber to disk offset */
138 #define	itod(x)	((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB)))
139 #define	itoo(x)	((int)(((x)+2*INOPB-1)%INOPB))
140 
141 /* file system blocks to disk blocks and back */
142 #define	fsbtodb(b)	((b)*CLSIZE)
143 #define	dbtofsb(b)	((b)/CLSIZE)
144 
145 #define	NINDIR	(BSIZE/sizeof(daddr_t))
146 
147 #define	CBSIZE	28		/* number of chars in a clist block */
148 #define	CROUND	0x1F		/* clist rounding; sizeof(int *) + CBSIZE -1*/
149 #define	CLKTICK	(1000000/(HZ))	/* microseconds in a clock tick */
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 /* major part of a device */
174 #define	major(x)	((int)(((unsigned)(x)>>8)&0377))
175 
176 /* minor part of a device */
177 #define	minor(x)	((int)((x)&0377))
178 
179 /* make a device number */
180 #define	makedev(x,y)	((dev_t)(((x)<<8) | (y)))
181 
182 typedef	struct { int r[1]; } *	physadr;
183 typedef	int		daddr_t;
184 typedef	char *		caddr_t;
185 typedef	unsigned short	ino_t;
186 typedef	int		swblk_t;
187 typedef	int		size_t;
188 typedef	int		time_t;
189 typedef	int		label_t[14];
190 typedef	short		dev_t;
191 typedef	int		off_t;
192 
193 /*
194  * Machine-dependent bits and macros
195  */
196 #define	UMODE	PSL_CURMOD		/* usermode bits */
197 #define	USERMODE(ps)	(((ps) & UMODE) == UMODE)
198 
199 #define	BASEPRI(ps)	(((ps) & PSL_IPL) != 0)
200