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