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