xref: /csrg-svn/sys/conf/param.c (revision 50221)
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*50221Skarels  *	@(#)param.c	7.20 (Berkeley) 06/27/91
823133Smckusick  */
93124Swnj 
1046425Sbostic #include "sys/param.h"
1146425Sbostic #include "sys/systm.h"
1246425Sbostic #include "sys/socket.h"
1346425Sbostic #include "sys/proc.h"
1446425Sbostic #include "sys/vnode.h"
1546425Sbostic #include "sys/file.h"
1646425Sbostic #include "sys/callout.h"
1746425Sbostic #include "sys/clist.h"
1846425Sbostic #include "sys/mbuf.h"
1946425Sbostic #include "ufs/quota.h"
2046425Sbostic #include "sys/kernel.h"
2141562Smckusick #ifdef SYSVSHM
2241562Smckusick #include "machine/vmparam.h"
2346425Sbostic #include "sys/shm.h"
2441562Smckusick #endif
2541562Smckusick 
263124Swnj /*
273124Swnj  * System parameter formulae.
283124Swnj  *
293124Swnj  * This file is copied into each directory where we compile
303124Swnj  * the kernel; it should be modified there to suit local taste
313124Swnj  * if necessary.
323124Swnj  *
333124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
343124Swnj  */
353124Swnj 
3629929Skarels #ifndef HZ
378229Sroot #define	HZ 100
3829929Skarels #endif
393124Swnj int	hz = HZ;
408229Sroot int	tick = 1000000 / HZ;
4126304Skarels int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
428229Sroot struct	timezone tz = { TIMEZONE, DST };
43*50221Skarels #define	NPROC (20 + 16 * MAXUSERS)
4448451Skarels int	maxproc = NPROC;
45*50221Skarels #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
46*50221Skarels #define	NVNODE (NPROC + NTEXT + 100)
4742313Smckusick long	desiredvnodes = NVNODE;
48*50221Skarels int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
499248Ssam int	ncallout = 16 + NPROC;
5024909Skarels int	nclist = 60 + 12 * MAXUSERS;
51*50221Skarels int	nmbclusters = NMBCLUSTERS;
5238159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
533124Swnj 
543124Swnj /*
55*50221Skarels  * Values in support of System V compatible shared memory.	XXX
5641562Smckusick  */
5741562Smckusick #ifdef SYSVSHM
5841562Smckusick #define	SHMMAX	(SHMMAXPGS*NBPG)
59*50221Skarels #define	SHMMIN	1
60*50221Skarels #define	SHMMNI	32			/* <= SHMMMNI in shm.h */
6141562Smckusick #define	SHMSEG	8
62*50221Skarels #define	SHMALL	(SHMMAXPGS/CLSIZE)
6341562Smckusick 
6441562Smckusick struct	shminfo shminfo = {
6541562Smckusick 	SHMMAX,
6641562Smckusick 	SHMMIN,
6741562Smckusick 	SHMMNI,
6841562Smckusick 	SHMSEG,
6941562Smckusick 	SHMALL
7041562Smckusick };
7141562Smckusick #endif
7241562Smckusick 
7341562Smckusick /*
743124Swnj  * These are initialized at bootstrap time
753124Swnj  * to values dependent on memory size
763124Swnj  */
773124Swnj int	nbuf, nswbuf;
783124Swnj 
793124Swnj /*
803124Swnj  * These have to be allocated somewhere; allocating
8126304Skarels  * them here forces loader errors if this file is omitted
8226304Skarels  * (if they've been externed everywhere else; hah!).
833124Swnj  */
843124Swnj struct 	callout *callout;
853124Swnj struct	cblock *cfree;
863124Swnj struct	buf *buf, *swbuf;
873124Swnj char	*buffers;
8841552Skarels 
8941552Skarels /*
9041552Skarels  * Proc/pgrp hashing.
9141552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
9241552Skarels  * Hash size must be a power of two.
9341552Skarels  * NOW omission of this file will cause loader errors!
9441552Skarels  */
9541552Skarels 
9641552Skarels #if NPROC > 1024
9741552Skarels #define	PIDHSZ		512
9841552Skarels #else
9941552Skarels #if NPROC > 512
10041552Skarels #define	PIDHSZ		256
10141552Skarels #else
10241552Skarels #if NPROC > 256
10341552Skarels #define	PIDHSZ		128
10441552Skarels #else
10541552Skarels #define	PIDHSZ		64
10641552Skarels #endif
10741552Skarels #endif
10841552Skarels #endif
10941552Skarels 
11041552Skarels struct	proc *pidhash[PIDHSZ];
11141552Skarels struct	pgrp *pgrphash[PIDHSZ];
11241552Skarels int	pidhashmask = PIDHSZ - 1;
113