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