xref: /csrg-svn/sys/conf/param.c (revision 42313)
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*42313Smckusick  *	@(#)param.c	7.13 (Berkeley) 05/24/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"
4041562Smckusick #ifdef SYSVSHM
4141562Smckusick #include "machine/vmparam.h"
4241562Smckusick #include "../sys/shm.h"
4341562Smckusick #endif
4441562Smckusick 
453124Swnj /*
463124Swnj  * System parameter formulae.
473124Swnj  *
483124Swnj  * This file is copied into each directory where we compile
493124Swnj  * the kernel; it should be modified there to suit local taste
503124Swnj  * if necessary.
513124Swnj  *
523124Swnj  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
533124Swnj  */
543124Swnj 
5529929Skarels #ifndef HZ
568229Sroot #define	HZ 100
5729929Skarels #endif
583124Swnj int	hz = HZ;
598229Sroot int	tick = 1000000 / HZ;
6026304Skarels int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
618229Sroot struct	timezone tz = { TIMEZONE, DST };
623124Swnj #define	NPROC (20 + 8 * MAXUSERS)
633124Swnj int	nproc = NPROC;
6441562Smckusick #define	NTEXT (36 + MAXUSERS)
6541562Smckusick int	ntext = NTEXT;
6641562Smckusick #define NVNODE (NPROC + NTEXT + 300)
67*42313Smckusick long	desiredvnodes = NVNODE;
6816575Ssam int	nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
699248Ssam int	ncallout = 16 + NPROC;
7024909Skarels int	nclist = 60 + 12 * MAXUSERS;
715148Swnj int     nmbclusters = NMBCLUSTERS;
7238159Smckusick int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
733124Swnj 
743124Swnj /*
7541562Smckusick  * Values in support of System V compatible shared memory.
7641562Smckusick  */
7741562Smckusick #ifdef SYSVSHM
7841562Smckusick #define	SHMMAX	(SHMMAXPGS*NBPG)
7941562Smckusick #define SHMMIN	1
8041562Smckusick #define SHMMNI	32			/* <= SHMMMNI in shm.h */
8141562Smckusick #define	SHMSEG	8
8241562Smckusick #define SHMALL	(SHMMAXPGS/CLSIZE)
8341562Smckusick 
8441562Smckusick struct	shminfo shminfo = {
8541562Smckusick 	SHMMAX,
8641562Smckusick 	SHMMIN,
8741562Smckusick 	SHMMNI,
8841562Smckusick 	SHMSEG,
8941562Smckusick 	SHMALL
9041562Smckusick };
9141562Smckusick #endif
9241562Smckusick 
9341562Smckusick /*
943124Swnj  * These are initialized at bootstrap time
953124Swnj  * to values dependent on memory size
963124Swnj  */
973124Swnj int	nbuf, nswbuf;
983124Swnj 
993124Swnj /*
1003124Swnj  * These have to be allocated somewhere; allocating
10126304Skarels  * them here forces loader errors if this file is omitted
10226304Skarels  * (if they've been externed everywhere else; hah!).
1033124Swnj  */
1043124Swnj struct	proc *proc, *procNPROC;
1053124Swnj struct	text *text, *textNTEXT;
1063124Swnj struct	file *file, *fileNFILE;
1073124Swnj struct 	callout *callout;
1083124Swnj struct	cblock *cfree;
1093124Swnj struct	buf *buf, *swbuf;
1103124Swnj char	*buffers;
1113124Swnj struct	cmap *cmap, *ecmap;
11241552Skarels 
11341552Skarels /*
11441552Skarels  * Proc/pgrp hashing.
11541552Skarels  * Here so that hash table sizes can depend on MAXUSERS/NPROC.
11641552Skarels  * Hash size must be a power of two.
11741552Skarels  * NOW omission of this file will cause loader errors!
11841552Skarels  */
11941552Skarels 
12041552Skarels #if NPROC > 1024
12141552Skarels #define	PIDHSZ		512
12241552Skarels #else
12341552Skarels #if NPROC > 512
12441552Skarels #define	PIDHSZ		256
12541552Skarels #else
12641552Skarels #if NPROC > 256
12741552Skarels #define	PIDHSZ		128
12841552Skarels #else
12941552Skarels #define	PIDHSZ		64
13041552Skarels #endif
13141552Skarels #endif
13241552Skarels #endif
13341552Skarels 
13441552Skarels struct	proc *pidhash[PIDHSZ];
13541552Skarels struct	pgrp *pgrphash[PIDHSZ];
13641552Skarels int	pidhashmask = PIDHSZ - 1;
137