xref: /csrg-svn/sys/sys/param.h (revision 63)
1*63Sbill /*	param.h	3.1	10/14/12	*/
2*63Sbill 
3*63Sbill /*
4*63Sbill  * tunable variables
5*63Sbill  *
6*63Sbill  * NB: NBUF is well known in locore.s
7*63Sbill  */
8*63Sbill 
9*63Sbill #define	NBUF	48		/* size of buffer cache */
10*63Sbill #define	NINODE	250		/* number of in core inodes */
11*63Sbill #define	NFILE	225		/* number of in core file structures */
12*63Sbill #define	NMOUNT	8		/* number of mountable file systems */
13*63Sbill #define	MAXUPRC	25		/* max processes per user */
14*63Sbill #define	SSIZE	4		/* initial stack size (*512 bytes) */
15*63Sbill #define	SINCR	4		/* increment of stack (*512 bytes) */
16*63Sbill #define	NOFILE	20		/* max open files per process */
17*63Sbill #define	CANBSIZ	256		/* max size of typewriter line */
18*63Sbill #define	SMAPSIZ	(4*NPROC)	/* size of swap allocation area */
19*63Sbill #define	NCALL	40		/* max simultaneous time callouts */
20*63Sbill #define	NPROC	150		/* max number of processes */
21*63Sbill #define	NTEXT	60		/* max number of pure texts */
22*63Sbill #define	NCLIST	500		/* max total clist size */
23*63Sbill #define	HZ	60		/* Ticks/second of the clock */
24*63Sbill #define	TIMEZONE (8*60)		/* Minutes westward from Greenwich */
25*63Sbill #define	DSTFLAG	1		/* Daylight Saving Time applies in this locality */
26*63Sbill #define	MSGBUFS	128		/* Characters saved from error messages */
27*63Sbill #define	NCARGS	5120		/* # characters in exec arglist */
28*63Sbill /*
29*63Sbill  * priorities
30*63Sbill  * probably should not be
31*63Sbill  * altered too much
32*63Sbill  */
33*63Sbill 
34*63Sbill #define	PSWP	0
35*63Sbill #define	PINOD	10
36*63Sbill #define	PRIBIO	20
37*63Sbill #define	PRIUBA	24
38*63Sbill #define	PZERO	25
39*63Sbill #define	PPIPE	26
40*63Sbill #define	PWAIT	30
41*63Sbill #define	PSLEP	40
42*63Sbill #define	PUSER	50
43*63Sbill 
44*63Sbill #define	NZERO	20
45*63Sbill 
46*63Sbill /*
47*63Sbill  * signals
48*63Sbill  * dont change
49*63Sbill  */
50*63Sbill 
51*63Sbill #define	NSIG	17
52*63Sbill /*
53*63Sbill  * No more than 16 signals (1-16) because they are
54*63Sbill  * stored in bits in a word.
55*63Sbill  */
56*63Sbill #define	SIGHUP	1	/* hangup */
57*63Sbill #define	SIGINT	2	/* interrupt (rubout) */
58*63Sbill #define	SIGQUIT	3	/* quit (FS) */
59*63Sbill #define	SIGINS	4	/* illegal instruction */
60*63Sbill #define	SIGTRC	5	/* trace or breakpoint */
61*63Sbill #define	SIGIOT	6	/* iot */
62*63Sbill #define	SIGEMT	7	/* emt */
63*63Sbill #define	SIGFPT	8	/* floating exception */
64*63Sbill #define	SIGKIL	9	/* kill, uncatchable termination */
65*63Sbill #define	SIGBUS	10	/* bus error */
66*63Sbill #define	SIGSEG	11	/* segmentation violation */
67*63Sbill #define	SIGSYS	12	/* bad system call */
68*63Sbill #define	SIGPIPE	13	/* end of pipe */
69*63Sbill #define	SIGCLK	14	/* alarm clock */
70*63Sbill #define	SIGTRM	15	/* Catchable termination */
71*63Sbill 
72*63Sbill /*
73*63Sbill  * fundamental constants of the implementation--
74*63Sbill  * cannot be changed easily.
75*63Sbill  * note: UPAGES is well known in locore.s
76*63Sbill  */
77*63Sbill 
78*63Sbill #define	NBPW	sizeof(int)	/* number of bytes in an integer */
79*63Sbill 
80*63Sbill #define	UPAGES	6		/* pages of u-area */
81*63Sbill #define	NULL	0
82*63Sbill #define	CMASK	0		/* default mask for file creation */
83*63Sbill #define	NODEV	(dev_t)(-1)
84*63Sbill #define	ROOTINO	((ino_t)2)	/* i number of all roots */
85*63Sbill #define	SUPERB	((daddr_t)1)	/* block number of the super block */
86*63Sbill #define	DIRSIZ	14		/* max characters per directory */
87*63Sbill 
88*63Sbill /*
89*63Sbill  * Clustering of hardware pages on machines with ridiculously small
90*63Sbill  * page sizes is done here.  The paging subsystem deals with units of
91*63Sbill  * CLSIZE pte's describing NBPG (from vm.h) pages each... BSIZE must
92*63Sbill  * be CLSIZE*NBPG in the current implementation, that is the paging subsystem
93*63Sbill  * deals with the same size blocks that the file system uses.
94*63Sbill  *
95*63Sbill  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE
96*63Sbill  *
97*63Sbill  * NB: CLSIZE is well known in locore.s.
98*63Sbill  */
99*63Sbill #define	CLSIZE	2
100*63Sbill 
101*63Sbill /* give the base virtual address (first of CLSIZE) */
102*63Sbill #define	clbase(i)	((i) &~ (CLSIZE-1))
103*63Sbill 
104*63Sbill /* round a number of clicks up to a whole cluster */
105*63Sbill #define	clrnd(i)	(((i) + (CLSIZE-1)) &~ (CLSIZE-1))
106*63Sbill 
107*63Sbill #if CLSIZE==1
108*63Sbill #define	BSIZE	512		/* size of secondary block (bytes) */
109*63Sbill #define	INOPB	8		/* 8 inodes per block */
110*63Sbill #define	BMASK	0777		/* BSIZE-1 */
111*63Sbill #define	BSHIFT	9		/* LOG2(BSIZE) */
112*63Sbill #define	NMASK	0177		/* NINDIR-1 */
113*63Sbill #define	NSHIFT	7		/* LOG2(NINDIR) */
114*63Sbill #define	NICINOD	100		/* number of superblock inodes */
115*63Sbill #define	NICFREE	50		/* number of superblock free blocks */
116*63Sbill 
117*63Sbill #endif
118*63Sbill 
119*63Sbill #if CLSIZE==2
120*63Sbill #define	BSIZE	1024
121*63Sbill #define	INOPB	16
122*63Sbill #define	BMASK	01777
123*63Sbill #define	BSHIFT	10
124*63Sbill #define	NMASK	0377
125*63Sbill #define	NSHIFT	8
126*63Sbill #define	NICINOD	100
127*63Sbill #define	NICFREE	178
128*63Sbill #endif
129*63Sbill 
130*63Sbill #if CLSIZE==4
131*63Sbill #define	BSIZE	2048
132*63Sbill #define	INOPB	32
133*63Sbill #define	BMASK	03777
134*63Sbill #define	BSHIFT	11
135*63Sbill #define	NMASK	0777
136*63Sbill #define	NSHIFT	9
137*63Sbill #define	NICINOD	100
138*63Sbill #define	NICFREE	434
139*63Sbill #endif
140*63Sbill 
141*63Sbill #ifndef INTRLVE
142*63Sbill /* macros replacing interleaving functions */
143*63Sbill #define	dkblock(bp)	((bp)->b_blkno)
144*63Sbill #define	dkunit(bp)	(minor((bp)->b_dev) >> 3)
145*63Sbill #endif
146*63Sbill 
147*63Sbill /* inumber to disk address and inumber to disk offset */
148*63Sbill #define	itod(x)	((daddr_t)((((unsigned)(x)+2*INOPB-1)/INOPB)))
149*63Sbill #define	itoo(x)	((int)(((x)+2*INOPB-1)%INOPB))
150*63Sbill 
151*63Sbill /* file system blocks to disk blocks and back */
152*63Sbill #define	fsbtodb(b)	((b)*CLSIZE)
153*63Sbill #define	dbtofsb(b)	((b)/CLSIZE)
154*63Sbill 
155*63Sbill /* BSLOP can be 0 unless you have a TIU/Spider */
156*63Sbill #define	BSLOP	0		/* In case some device needs bigger buffers */
157*63Sbill #define	NINDIR	(BSIZE/sizeof(daddr_t))
158*63Sbill 
159*63Sbill #define	CBSIZE	28		/* number of chars in a clist block */
160*63Sbill #define	CROUND	0x1F		/* clist rounding; sizeof(int *) + CBSIZE -1*/
161*63Sbill #define	CLKTICK	(1000000/(HZ))	/* microseconds in a clock tick */
162*63Sbill 
163*63Sbill /*
164*63Sbill  * Macros for fast min/max
165*63Sbill  */
166*63Sbill #define	MIN(a,b) (((a)<(b))?(a):(b))
167*63Sbill #define	MAX(a,b) (((a)>(b))?(a):(b))
168*63Sbill 
169*63Sbill /*
170*63Sbill  * Some macros for units conversion
171*63Sbill  */
172*63Sbill /* Core clicks (512 bytes) to segments and vice versa */
173*63Sbill #define	ctos(x)	(x)
174*63Sbill #define	stoc(x)	(x)
175*63Sbill 
176*63Sbill /* Core clicks (512 bytes) to disk blocks */
177*63Sbill #define	ctod(x)	(x)
178*63Sbill 
179*63Sbill /* clicks to bytes */
180*63Sbill #define	ctob(x)	((x)<<9)
181*63Sbill 
182*63Sbill /* bytes to clicks */
183*63Sbill #define	btoc(x)	((((unsigned)(x)+511)>>9))
184*63Sbill 
185*63Sbill /* major part of a device */
186*63Sbill #define	major(x)	((int)(((unsigned)(x)>>8)&0377))
187*63Sbill 
188*63Sbill /* minor part of a device */
189*63Sbill #define	minor(x)	((int)((x)&0377))
190*63Sbill 
191*63Sbill /* make a device number */
192*63Sbill #define	makedev(x,y)	((dev_t)(((x)<<8) | (y)))
193*63Sbill 
194*63Sbill typedef	struct { int r[1]; } *	physadr;
195*63Sbill typedef	int		daddr_t;
196*63Sbill typedef	char *		caddr_t;
197*63Sbill typedef	unsigned short	ino_t;
198*63Sbill typedef	int		swblk_t;
199*63Sbill typedef	int		size_t;
200*63Sbill typedef	int		time_t;
201*63Sbill typedef	int		label_t[14];
202*63Sbill typedef	short		dev_t;
203*63Sbill typedef	int		off_t;
204*63Sbill 
205*63Sbill /*
206*63Sbill  * Machine-dependent bits and macros
207*63Sbill  */
208*63Sbill #define	UMODE	PSL_CURMOD		/* usermode bits */
209*63Sbill #define	USERMODE(ps)	(((ps) & UMODE) == UMODE)
210*63Sbill 
211*63Sbill #define	BASEPRI(ps)	(((ps) & PSL_IPL) != 0)
212*63Sbill 
213*63Sbill #ifdef KERNEL
214*63Sbill #ifdef lint
215*63Sbill int	__void__;
216*63Sbill #define	VOID	__void__ = (int)
217*63Sbill #else
218*63Sbill #define	VOID
219*63Sbill #endif
220*63Sbill #endif
221