xref: /csrg-svn/sys/conf/param.c (revision 41552)
123133Smckusick /*
237766Smckusick  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
337766Smckusick  * All rights reserved.
426395Skarels  *
537766Smckusick  * Redistribution and use in source and binary forms are permitted
637766Smckusick  * provided that the above copyright notice and this paragraph are
737766Smckusick  * duplicated in all such forms and that any documentation,
837766Smckusick  * advertising materials, and other materials related to such
937766Smckusick  * distribution and use acknowledge that the software was developed
1037766Smckusick  * by the University of California, Berkeley.  The name of the
1137766Smckusick  * University may not be used to endorse or promote products derived
1237766Smckusick  * from this software without specific prior written permission.
1337766Smckusick  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1437766Smckusick  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1537766Smckusick  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1637766Smckusick  *
17*41552Skarels  *	@(#)param.c	7.11 (Berkeley) 05/10/90
1823133Smckusick  */
193124Swnj 
2023133Smckusick #ifndef lint
2123133Smckusick char copyright[] =
2237766Smckusick "@(#) Copyright (c) 1980, 1986, 1989 Regents of the University of California.\n\
2323133Smckusick  All rights reserved.\n";
2423133Smckusick #endif not lint
2523133Smckusick 
2637531Smckusick #include "../sys/param.h"
2737531Smckusick #include "../sys/systm.h"
2837531Smckusick #include "../sys/socket.h"
2937531Smckusick #include "../sys/user.h"
3037531Smckusick #include "../sys/proc.h"
3137531Smckusick #include "../sys/text.h"
3237766Smckusick #include "../sys/vnode.h"
3337531Smckusick #include "../sys/file.h"
3437531Smckusick #include "../sys/callout.h"
3537531Smckusick #include "../sys/clist.h"
3637531Smckusick #include "../sys/cmap.h"
3737531Smckusick #include "../sys/mbuf.h"
3837531Smckusick #include "../ufs/quota.h"
3937531Smckusick #include "../sys/kernel.h"
403124Swnj /*
413124Swnj  * System parameter formulae.
423124Swnj  *
433124Swnj  * This file is copied into each directory where we compile
443124Swnj  * the kernel; it should be modified there to suit local taste
453124Swnj  * if necessary.
463124Swnj  *
473124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
483124Swnj  */
493124Swnj 
5029929Skarels #ifndef HZ
518229Sroot #define	HZ 100
5229929Skarels #endif
533124Swnj int	hz = HZ;
548229Sroot int	tick = 1000000 / HZ;
5526304Skarels int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
568229Sroot struct	timezone tz = { TIMEZONE, DST };
573124Swnj #define	NPROC (20 + 8 * MAXUSERS)
583124Swnj int	nproc = NPROC;
5918649Skarels int	ntext = 36 + MAXUSERS;
6039377Smckusick #define NVNODE ((NPROC + 16 + MAXUSERS) + 32)
6140875Smckusick int	desiredvnodes = NVNODE;
6216575Ssam int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
639248Ssam int	ncallout = 16 + NPROC;
6424909Skarels int	nclist = 60 + 12 * MAXUSERS;
655148Swnj int     nmbclusters = NMBCLUSTERS;
6638159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
673124Swnj 
683124Swnj /*
693124Swnj  * These are initialized at bootstrap time
703124Swnj  * to values dependent on memory size
713124Swnj  */
723124Swnj int	nbuf, nswbuf;
733124Swnj 
743124Swnj /*
753124Swnj  * These have to be allocated somewhere; allocating
7626304Skarels  * them here forces loader errors if this file is omitted
7726304Skarels  * (if they've been externed everywhere else; hah!).
783124Swnj  */
793124Swnj struct	proc *proc, *procNPROC;
803124Swnj struct	text *text, *textNTEXT;
813124Swnj struct	file *file, *fileNFILE;
823124Swnj struct 	callout *callout;
833124Swnj struct	cblock *cfree;
843124Swnj struct	buf *buf, *swbuf;
853124Swnj char	*buffers;
863124Swnj struct	cmap *cmap, *ecmap;
87*41552Skarels 
88*41552Skarels /*
89*41552Skarels  * Proc/pgrp hashing.
90*41552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
91*41552Skarels  * Hash size must be a power of two.
92*41552Skarels  * NOW omission of this file will cause loader errors!
93*41552Skarels  */
94*41552Skarels 
95*41552Skarels #if NPROC > 1024
96*41552Skarels #define	PIDHSZ		512
97*41552Skarels #else
98*41552Skarels #if NPROC > 512
99*41552Skarels #define	PIDHSZ		256
100*41552Skarels #else
101*41552Skarels #if NPROC > 256
102*41552Skarels #define	PIDHSZ		128
103*41552Skarels #else
104*41552Skarels #define	PIDHSZ		64
105*41552Skarels #endif
106*41552Skarels #endif
107*41552Skarels #endif
108*41552Skarels 
109*41552Skarels struct	proc *pidhash[PIDHSZ];
110*41552Skarels struct	pgrp *pgrphash[PIDHSZ];
111*41552Skarels int	pidhashmask = PIDHSZ - 1;
112