xref: /original-bsd/sys/conf/param.c (revision 3705696b)
1 /*
2  * Copyright (c) 1980, 1986, 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)param.c	8.1 (Berkeley) 06/16/93
8  */
9 
10 #include <sys/param.h>
11 #include <sys/systm.h>
12 #include <sys/socket.h>
13 #include <sys/proc.h>
14 #include <sys/vnode.h>
15 #include <sys/file.h>
16 #include <sys/callout.h>
17 #include <sys/clist.h>
18 #include <sys/mbuf.h>
19 #include <sys/kernel.h>
20 
21 #include <ufs/ufs/quota.h>
22 
23 #ifdef SYSVSHM
24 #include <machine/vmparam.h>
25 #include <sys/shm.h>
26 #endif
27 
28 /*
29  * System parameter formulae.
30  *
31  * This file is copied into each directory where we compile
32  * the kernel; it should be modified there to suit local taste
33  * if necessary.
34  *
35  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
36  */
37 
38 #ifndef HZ
39 #define	HZ 100
40 #endif
41 int	hz = HZ;
42 int	tick = 1000000 / HZ;
43 int	tickadj = 30000 / (60 * HZ);		/* can adjust 30ms in 60s */
44 struct	timezone tz = { TIMEZONE, DST };
45 #define	NPROC (20 + 16 * MAXUSERS)
46 int	maxproc = NPROC;
47 #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
48 #define	NVNODE (NPROC + NTEXT + 100)
49 int	desiredvnodes = NVNODE;
50 int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
51 int	ncallout = 16 + NPROC;
52 int	nclist = 60 + 12 * MAXUSERS;
53 int	nmbclusters = NMBCLUSTERS;
54 int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
55 
56 /*
57  * Values in support of System V compatible shared memory.	XXX
58  */
59 #ifdef SYSVSHM
60 #define	SHMMAX	(SHMMAXPGS*NBPG)
61 #define	SHMMIN	1
62 #define	SHMMNI	32			/* <= SHMMMNI in shm.h */
63 #define	SHMSEG	8
64 #define	SHMALL	(SHMMAXPGS/CLSIZE)
65 
66 struct	shminfo shminfo = {
67 	SHMMAX,
68 	SHMMIN,
69 	SHMMNI,
70 	SHMSEG,
71 	SHMALL
72 };
73 #endif
74 
75 /*
76  * These are initialized at bootstrap time
77  * to values dependent on memory size
78  */
79 int	nbuf, nswbuf;
80 
81 /*
82  * These have to be allocated somewhere; allocating
83  * them here forces loader errors if this file is omitted
84  * (if they've been externed everywhere else; hah!).
85  */
86 struct 	callout *callout;
87 struct	cblock *cfree;
88 struct	buf *buf, *swbuf;
89 char	*buffers;
90 
91 /*
92  * Proc/pgrp hashing.
93  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
94  * Hash size must be a power of two.
95  * NOW omission of this file will cause loader errors!
96  */
97 
98 #if NPROC > 1024
99 #define	PIDHSZ		512
100 #else
101 #if NPROC > 512
102 #define	PIDHSZ		256
103 #else
104 #if NPROC > 256
105 #define	PIDHSZ		128
106 #else
107 #define	PIDHSZ		64
108 #endif
109 #endif
110 #endif
111 
112 struct	proc *pidhash[PIDHSZ];
113 struct	pgrp *pgrphash[PIDHSZ];
114 int	pidhashmask = PIDHSZ - 1;
115