xref: /original-bsd/sys/conf/param.c (revision ba762ddc)
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.17 (Berkeley) 04/20/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/proc.h"
20 #include "sys/vnode.h"
21 #include "sys/file.h"
22 #include "sys/callout.h"
23 #include "sys/clist.h"
24 #include "sys/mbuf.h"
25 #include "ufs/quota.h"
26 #include "sys/kernel.h"
27 #ifdef SYSVSHM
28 #include "machine/vmparam.h"
29 #include "sys/shm.h"
30 #endif
31 
32 /*
33  * System parameter formulae.
34  *
35  * This file is copied into each directory where we compile
36  * the kernel; it should be modified there to suit local taste
37  * if necessary.
38  *
39  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
40  */
41 
42 #ifndef HZ
43 #define	HZ 100
44 #endif
45 int	hz = HZ;
46 int	tick = 1000000 / HZ;
47 int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
48 struct	timezone tz = { TIMEZONE, DST };
49 #define	NPROC (20 + 8 * MAXUSERS)
50 int	maxproc = NPROC;
51 #define NTEXT 100			/* actually the object cache */
52 #define NVNODE (NPROC + NTEXT + 300)
53 long	desiredvnodes = NVNODE;
54 int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
55 int	ncallout = 16 + NPROC;
56 int	nclist = 60 + 12 * MAXUSERS;
57 int     nmbclusters = NMBCLUSTERS;
58 int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
59 
60 /*
61  * Values in support of System V compatible shared memory.
62  */
63 #ifdef SYSVSHM
64 #define	SHMMAX	(SHMMAXPGS*NBPG)
65 #define SHMMIN	1
66 #define SHMMNI	32			/* <= SHMMMNI in shm.h */
67 #define	SHMSEG	8
68 #define SHMALL	(SHMMAXPGS/CLSIZE)
69 
70 struct	shminfo shminfo = {
71 	SHMMAX,
72 	SHMMIN,
73 	SHMMNI,
74 	SHMSEG,
75 	SHMALL
76 };
77 #endif
78 
79 /*
80  * These are initialized at bootstrap time
81  * to values dependent on memory size
82  */
83 int	nbuf, nswbuf;
84 
85 /*
86  * These have to be allocated somewhere; allocating
87  * them here forces loader errors if this file is omitted
88  * (if they've been externed everywhere else; hah!).
89  */
90 struct	file *file, *fileNFILE;
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