xref: /original-bsd/sys/conf/param.c (revision e1db577d)
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.22 (Berkeley) 07/12/92
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/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 = 30000 / (60 * HZ);		/* can adjust 30ms in 60s */
42 struct	timezone tz = { TIMEZONE, DST };
43 #define	NPROC (20 + 16 * MAXUSERS)
44 int	maxproc = NPROC;
45 #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
46 #define	NVNODE (NPROC + NTEXT + 100)
47 long	desiredvnodes = NVNODE;
48 int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
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.	XXX
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 	callout *callout;
85 struct	cblock *cfree;
86 struct	buf *buf, *swbuf;
87 char	*buffers;
88 
89 /*
90  * Proc/pgrp hashing.
91  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
92  * Hash size must be a power of two.
93  * NOW omission of this file will cause loader errors!
94  */
95 
96 #if NPROC > 1024
97 #define	PIDHSZ		512
98 #else
99 #if NPROC > 512
100 #define	PIDHSZ		256
101 #else
102 #if NPROC > 256
103 #define	PIDHSZ		128
104 #else
105 #define	PIDHSZ		64
106 #endif
107 #endif
108 #endif
109 
110 struct	proc *pidhash[PIDHSZ];
111 struct	pgrp *pgrphash[PIDHSZ];
112 int	pidhashmask = PIDHSZ - 1;
113