xref: /csrg-svn/sys/conf/param.c (revision 63471)
123133Smckusick /*
2*63471Sbostic  * Copyright (c) 1980, 1986, 1989, 1993
3*63471Sbostic  *	The Regents of the University of California.  All rights reserved.
426395Skarels  *
544428Sbostic  * %sccs.include.redist.c%
637766Smckusick  *
7*63471Sbostic  *	@(#)param.c	8.1 (Berkeley) 06/16/93
823133Smckusick  */
93124Swnj 
1056502Sbostic #include <sys/param.h>
1156502Sbostic #include <sys/systm.h>
1256502Sbostic #include <sys/socket.h>
1356502Sbostic #include <sys/proc.h>
1456502Sbostic #include <sys/vnode.h>
1556502Sbostic #include <sys/file.h>
1656502Sbostic #include <sys/callout.h>
1756502Sbostic #include <sys/clist.h>
1856502Sbostic #include <sys/mbuf.h>
1956502Sbostic #include <sys/kernel.h>
2056502Sbostic 
2156502Sbostic #include <ufs/ufs/quota.h>
2256502Sbostic 
2341562Smckusick #ifdef SYSVSHM
2456502Sbostic #include <machine/vmparam.h>
2556502Sbostic #include <sys/shm.h>
2641562Smckusick #endif
2741562Smckusick 
283124Swnj /*
293124Swnj  * System parameter formulae.
303124Swnj  *
313124Swnj  * This file is copied into each directory where we compile
323124Swnj  * the kernel; it should be modified there to suit local taste
333124Swnj  * if necessary.
343124Swnj  *
353124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
363124Swnj  */
373124Swnj 
3829929Skarels #ifndef HZ
398229Sroot #define	HZ 100
4029929Skarels #endif
413124Swnj int	hz = HZ;
428229Sroot int	tick = 1000000 / HZ;
4355055Storek int	tickadj = 30000 / (60 * HZ);		/* can adjust 30ms in 60s */
448229Sroot struct	timezone tz = { TIMEZONE, DST };
4550221Skarels #define	NPROC (20 + 16 * MAXUSERS)
4648451Skarels int	maxproc = NPROC;
4750221Skarels #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
4850221Skarels #define	NVNODE (NPROC + NTEXT + 100)
4963470Smckusick int	desiredvnodes = NVNODE;
5050221Skarels int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
519248Ssam int	ncallout = 16 + NPROC;
5224909Skarels int	nclist = 60 + 12 * MAXUSERS;
5350221Skarels int	nmbclusters = NMBCLUSTERS;
5438159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
553124Swnj 
563124Swnj /*
5750221Skarels  * Values in support of System V compatible shared memory.	XXX
5841562Smckusick  */
5941562Smckusick #ifdef SYSVSHM
6041562Smckusick #define	SHMMAX	(SHMMAXPGS*NBPG)
6150221Skarels #define	SHMMIN	1
6250221Skarels #define	SHMMNI	32			/* <= SHMMMNI in shm.h */
6341562Smckusick #define	SHMSEG	8
6450221Skarels #define	SHMALL	(SHMMAXPGS/CLSIZE)
6541562Smckusick 
6641562Smckusick struct	shminfo shminfo = {
6741562Smckusick 	SHMMAX,
6841562Smckusick 	SHMMIN,
6941562Smckusick 	SHMMNI,
7041562Smckusick 	SHMSEG,
7141562Smckusick 	SHMALL
7241562Smckusick };
7341562Smckusick #endif
7441562Smckusick 
7541562Smckusick /*
763124Swnj  * These are initialized at bootstrap time
773124Swnj  * to values dependent on memory size
783124Swnj  */
793124Swnj int	nbuf, nswbuf;
803124Swnj 
813124Swnj /*
823124Swnj  * These have to be allocated somewhere; allocating
8326304Skarels  * them here forces loader errors if this file is omitted
8426304Skarels  * (if they've been externed everywhere else; hah!).
853124Swnj  */
863124Swnj struct 	callout *callout;
873124Swnj struct	cblock *cfree;
883124Swnj struct	buf *buf, *swbuf;
893124Swnj char	*buffers;
9041552Skarels 
9141552Skarels /*
9241552Skarels  * Proc/pgrp hashing.
9341552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
9441552Skarels  * Hash size must be a power of two.
9541552Skarels  * NOW omission of this file will cause loader errors!
9641552Skarels  */
9741552Skarels 
9841552Skarels #if NPROC > 1024
9941552Skarels #define	PIDHSZ		512
10041552Skarels #else
10141552Skarels #if NPROC > 512
10241552Skarels #define	PIDHSZ		256
10341552Skarels #else
10441552Skarels #if NPROC > 256
10541552Skarels #define	PIDHSZ		128
10641552Skarels #else
10741552Skarels #define	PIDHSZ		64
10841552Skarels #endif
10941552Skarels #endif
11041552Skarels #endif
11141552Skarels 
11241552Skarels struct	proc *pidhash[PIDHSZ];
11341552Skarels struct	pgrp *pgrphash[PIDHSZ];
11441552Skarels int	pidhashmask = PIDHSZ - 1;
115