xref: /csrg-svn/sys/conf/param.c (revision 44428)
123133Smckusick /*
237766Smckusick  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
337766Smckusick  * All rights reserved.
426395Skarels  *
5*44428Sbostic  * %sccs.include.redist.c%
637766Smckusick  *
7*44428Sbostic  *	@(#)param.c	7.14 (Berkeley) 06/28/90
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 
1637531Smckusick #include "../sys/param.h"
1737531Smckusick #include "../sys/systm.h"
1837531Smckusick #include "../sys/socket.h"
1937531Smckusick #include "../sys/user.h"
2037531Smckusick #include "../sys/proc.h"
2137531Smckusick #include "../sys/text.h"
2237766Smckusick #include "../sys/vnode.h"
2337531Smckusick #include "../sys/file.h"
2437531Smckusick #include "../sys/callout.h"
2537531Smckusick #include "../sys/clist.h"
2637531Smckusick #include "../sys/cmap.h"
2737531Smckusick #include "../sys/mbuf.h"
2837531Smckusick #include "../ufs/quota.h"
2937531Smckusick #include "../sys/kernel.h"
3041562Smckusick #ifdef SYSVSHM
3141562Smckusick #include "machine/vmparam.h"
3241562Smckusick #include "../sys/shm.h"
3341562Smckusick #endif
3441562Smckusick 
353124Swnj /*
363124Swnj  * System parameter formulae.
373124Swnj  *
383124Swnj  * This file is copied into each directory where we compile
393124Swnj  * the kernel; it should be modified there to suit local taste
403124Swnj  * if necessary.
413124Swnj  *
423124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
433124Swnj  */
443124Swnj 
4529929Skarels #ifndef HZ
468229Sroot #define	HZ 100
4729929Skarels #endif
483124Swnj int	hz = HZ;
498229Sroot int	tick = 1000000 / HZ;
5026304Skarels int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
518229Sroot struct	timezone tz = { TIMEZONE, DST };
523124Swnj #define	NPROC (20 + 8 * MAXUSERS)
533124Swnj int	nproc = NPROC;
5441562Smckusick #define	NTEXT (36 + MAXUSERS)
5541562Smckusick int	ntext = NTEXT;
5641562Smckusick #define NVNODE (NPROC + NTEXT + 300)
5742313Smckusick long	desiredvnodes = NVNODE;
5816575Ssam int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
599248Ssam int	ncallout = 16 + NPROC;
6024909Skarels int	nclist = 60 + 12 * MAXUSERS;
615148Swnj int     nmbclusters = NMBCLUSTERS;
6238159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
633124Swnj 
643124Swnj /*
6541562Smckusick  * Values in support of System V compatible shared memory.
6641562Smckusick  */
6741562Smckusick #ifdef SYSVSHM
6841562Smckusick #define	SHMMAX	(SHMMAXPGS*NBPG)
6941562Smckusick #define SHMMIN	1
7041562Smckusick #define SHMMNI	32			/* <= SHMMMNI in shm.h */
7141562Smckusick #define	SHMSEG	8
7241562Smckusick #define SHMALL	(SHMMAXPGS/CLSIZE)
7341562Smckusick 
7441562Smckusick struct	shminfo shminfo = {
7541562Smckusick 	SHMMAX,
7641562Smckusick 	SHMMIN,
7741562Smckusick 	SHMMNI,
7841562Smckusick 	SHMSEG,
7941562Smckusick 	SHMALL
8041562Smckusick };
8141562Smckusick #endif
8241562Smckusick 
8341562Smckusick /*
843124Swnj  * These are initialized at bootstrap time
853124Swnj  * to values dependent on memory size
863124Swnj  */
873124Swnj int	nbuf, nswbuf;
883124Swnj 
893124Swnj /*
903124Swnj  * These have to be allocated somewhere; allocating
9126304Skarels  * them here forces loader errors if this file is omitted
9226304Skarels  * (if they've been externed everywhere else; hah!).
933124Swnj  */
943124Swnj struct	proc *proc, *procNPROC;
953124Swnj struct	text *text, *textNTEXT;
963124Swnj struct	file *file, *fileNFILE;
973124Swnj struct 	callout *callout;
983124Swnj struct	cblock *cfree;
993124Swnj struct	buf *buf, *swbuf;
1003124Swnj char	*buffers;
1013124Swnj struct	cmap *cmap, *ecmap;
10241552Skarels 
10341552Skarels /*
10441552Skarels  * Proc/pgrp hashing.
10541552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
10641552Skarels  * Hash size must be a power of two.
10741552Skarels  * NOW omission of this file will cause loader errors!
10841552Skarels  */
10941552Skarels 
11041552Skarels #if NPROC > 1024
11141552Skarels #define	PIDHSZ		512
11241552Skarels #else
11341552Skarels #if NPROC > 512
11441552Skarels #define	PIDHSZ		256
11541552Skarels #else
11641552Skarels #if NPROC > 256
11741552Skarels #define	PIDHSZ		128
11841552Skarels #else
11941552Skarels #define	PIDHSZ		64
12041552Skarels #endif
12141552Skarels #endif
12241552Skarels #endif
12341552Skarels 
12441552Skarels struct	proc *pidhash[PIDHSZ];
12541552Skarels struct	pgrp *pgrphash[PIDHSZ];
12641552Skarels int	pidhashmask = PIDHSZ - 1;
127