xref: /original-bsd/sys/conf/param.c (revision 3588a932)
1 /*
2  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)param.c	7.16 (Berkeley) 02/15/91
8  */
9 
10 #ifndef lint
11 char copyright[] =
12 "@(#) Copyright (c) 1980, 1986, 1989 Regents of the University of California.\n\
13  All rights reserved.\n";
14 #endif not lint
15 
16 #include "sys/param.h"
17 #include "sys/systm.h"
18 #include "sys/socket.h"
19 #include "sys/user.h"
20 #include "sys/proc.h"
21 #include "sys/vnode.h"
22 #include "sys/file.h"
23 #include "sys/callout.h"
24 #include "sys/clist.h"
25 #include "sys/mbuf.h"
26 #include "ufs/quota.h"
27 #include "sys/kernel.h"
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 = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
49 struct	timezone tz = { TIMEZONE, DST };
50 #define	NPROC (20 + 8 * MAXUSERS)
51 int	nproc = NPROC;
52 #define NTEXT 100			/* actually the object cache */
53 #define NVNODE (NPROC + NTEXT + 300)
54 long	desiredvnodes = NVNODE;
55 int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
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.
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	proc *proc, *procNPROC;
92 struct	file *file, *fileNFILE;
93 struct 	callout *callout;
94 struct	cblock *cfree;
95 struct	buf *buf, *swbuf;
96 char	*buffers;
97 
98 /*
99  * Proc/pgrp hashing.
100  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
101  * Hash size must be a power of two.
102  * NOW omission of this file will cause loader errors!
103  */
104 
105 #if NPROC > 1024
106 #define	PIDHSZ		512
107 #else
108 #if NPROC > 512
109 #define	PIDHSZ		256
110 #else
111 #if NPROC > 256
112 #define	PIDHSZ		128
113 #else
114 #define	PIDHSZ		64
115 #endif
116 #endif
117 #endif
118 
119 struct	proc *pidhash[PIDHSZ];
120 struct	pgrp *pgrphash[PIDHSZ];
121 int	pidhashmask = PIDHSZ - 1;
122