xref: /csrg-svn/sys/conf/param.c (revision 48451)
123133Smckusick /*
237766Smckusick  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
337766Smckusick  * All rights reserved.
426395Skarels  *
544428Sbostic  * %sccs.include.redist.c%
637766Smckusick  *
7*48451Skarels  *	@(#)param.c	7.17 (Berkeley) 04/20/91
823133Smckusick  */
93124Swnj 
1023133Smckusick #ifndef lint
1123133Smckusick char copyright[] =
1237766Smckusick "@(#) Copyright (c) 1980, 1986, 1989 Regents of the University of California.\n\
1323133Smckusick  All rights reserved.\n";
1423133Smckusick #endif not lint
1523133Smckusick 
1646425Sbostic #include "sys/param.h"
1746425Sbostic #include "sys/systm.h"
1846425Sbostic #include "sys/socket.h"
1946425Sbostic #include "sys/proc.h"
2046425Sbostic #include "sys/vnode.h"
2146425Sbostic #include "sys/file.h"
2246425Sbostic #include "sys/callout.h"
2346425Sbostic #include "sys/clist.h"
2446425Sbostic #include "sys/mbuf.h"
2546425Sbostic #include "ufs/quota.h"
2646425Sbostic #include "sys/kernel.h"
2741562Smckusick #ifdef SYSVSHM
2841562Smckusick #include "machine/vmparam.h"
2946425Sbostic #include "sys/shm.h"
3041562Smckusick #endif
3141562Smckusick 
323124Swnj /*
333124Swnj  * System parameter formulae.
343124Swnj  *
353124Swnj  * This file is copied into each directory where we compile
363124Swnj  * the kernel; it should be modified there to suit local taste
373124Swnj  * if necessary.
383124Swnj  *
393124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
403124Swnj  */
413124Swnj 
4229929Skarels #ifndef HZ
438229Sroot #define	HZ 100
4429929Skarels #endif
453124Swnj int	hz = HZ;
468229Sroot int	tick = 1000000 / HZ;
4726304Skarels int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
488229Sroot struct	timezone tz = { TIMEZONE, DST };
493124Swnj #define	NPROC (20 + 8 * MAXUSERS)
50*48451Skarels int	maxproc = NPROC;
5145756Smckusick #define NTEXT 100			/* actually the object cache */
5241562Smckusick #define NVNODE (NPROC + NTEXT + 300)
5342313Smckusick long	desiredvnodes = NVNODE;
5416575Ssam int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
559248Ssam int	ncallout = 16 + NPROC;
5624909Skarels int	nclist = 60 + 12 * MAXUSERS;
575148Swnj int     nmbclusters = NMBCLUSTERS;
5838159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
593124Swnj 
603124Swnj /*
6141562Smckusick  * Values in support of System V compatible shared memory.
6241562Smckusick  */
6341562Smckusick #ifdef SYSVSHM
6441562Smckusick #define	SHMMAX	(SHMMAXPGS*NBPG)
6541562Smckusick #define SHMMIN	1
6641562Smckusick #define SHMMNI	32			/* <= SHMMMNI in shm.h */
6741562Smckusick #define	SHMSEG	8
6841562Smckusick #define SHMALL	(SHMMAXPGS/CLSIZE)
6941562Smckusick 
7041562Smckusick struct	shminfo shminfo = {
7141562Smckusick 	SHMMAX,
7241562Smckusick 	SHMMIN,
7341562Smckusick 	SHMMNI,
7441562Smckusick 	SHMSEG,
7541562Smckusick 	SHMALL
7641562Smckusick };
7741562Smckusick #endif
7841562Smckusick 
7941562Smckusick /*
803124Swnj  * These are initialized at bootstrap time
813124Swnj  * to values dependent on memory size
823124Swnj  */
833124Swnj int	nbuf, nswbuf;
843124Swnj 
853124Swnj /*
863124Swnj  * These have to be allocated somewhere; allocating
8726304Skarels  * them here forces loader errors if this file is omitted
8826304Skarels  * (if they've been externed everywhere else; hah!).
893124Swnj  */
903124Swnj struct	file *file, *fileNFILE;
913124Swnj struct 	callout *callout;
923124Swnj struct	cblock *cfree;
933124Swnj struct	buf *buf, *swbuf;
943124Swnj char	*buffers;
9541552Skarels 
9641552Skarels /*
9741552Skarels  * Proc/pgrp hashing.
9841552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
9941552Skarels  * Hash size must be a power of two.
10041552Skarels  * NOW omission of this file will cause loader errors!
10141552Skarels  */
10241552Skarels 
10341552Skarels #if NPROC > 1024
10441552Skarels #define	PIDHSZ		512
10541552Skarels #else
10641552Skarels #if NPROC > 512
10741552Skarels #define	PIDHSZ		256
10841552Skarels #else
10941552Skarels #if NPROC > 256
11041552Skarels #define	PIDHSZ		128
11141552Skarels #else
11241552Skarels #define	PIDHSZ		64
11341552Skarels #endif
11441552Skarels #endif
11541552Skarels #endif
11641552Skarels 
11741552Skarels struct	proc *pidhash[PIDHSZ];
11841552Skarels struct	pgrp *pgrphash[PIDHSZ];
11941552Skarels int	pidhashmask = PIDHSZ - 1;
120