subr_param.c revision 1541
10SN/A/*
2157SN/A * Copyright (c) 1980, 1986, 1989, 1993
30SN/A *	The Regents of the University of California.  All rights reserved.
40SN/A * (c) UNIX System Laboratories, Inc.
50SN/A * All or some portions of this file are derived from material licensed
60SN/A * to the University of California by American Telephone and Telegraph
7157SN/A * Co. or Unix System Laboratories, Inc. and are reproduced herein with
80SN/A * the permission of UNIX System Laboratories, Inc.
9157SN/A *
100SN/A * Redistribution and use in source and binary forms, with or without
110SN/A * modification, are permitted provided that the following conditions
120SN/A * are met:
130SN/A * 1. Redistributions of source code must retain the above copyright
140SN/A *    notice, this list of conditions and the following disclaimer.
150SN/A * 2. Redistributions in binary form must reproduce the above copyright
160SN/A *    notice, this list of conditions and the following disclaimer in the
170SN/A *    documentation and/or other materials provided with the distribution.
180SN/A * 3. All advertising materials mentioning features or use of this software
190SN/A *    must display the following acknowledgement:
200SN/A *	This product includes software developed by the University of
21157SN/A *	California, Berkeley and its contributors.
22157SN/A * 4. Neither the name of the University nor the names of its contributors
23157SN/A *    may be used to endorse or promote products derived from this software
240SN/A *    without specific prior written permission.
250SN/A *
260SN/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
270SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
280SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
290SN/A * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
300SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
310SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
320SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
330SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
340SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
350SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
360SN/A * SUCH DAMAGE.
370SN/A *
380SN/A *	@(#)param.c	8.2 (Berkeley) 1/21/94
390SN/A */
400SN/A
410SN/A#include <sys/param.h>
420SN/A#include <sys/systm.h>
430SN/A#include <sys/socket.h>
440SN/A#include <sys/proc.h>
450SN/A#include <sys/vnode.h>
460SN/A#include <sys/file.h>
470SN/A#include <sys/callout.h>
480SN/A#include <sys/clist.h>
490SN/A#include <sys/mbuf.h>
500SN/A#include <sys/kernel.h>
510SN/A
520SN/A#include <ufs/ufs/quota.h>
530SN/A
540SN/A#ifdef SYSVSHM
550SN/A#include <machine/vmparam.h>
560SN/A#include <sys/shm.h>
570SN/A#endif
580SN/A
590SN/A/*
600SN/A * System parameter formulae.
610SN/A *
620SN/A * This file is copied into each directory where we compile
630SN/A * the kernel; it should be modified there to suit local taste
640SN/A * if necessary.
650SN/A *
660SN/A * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
670SN/A */
680SN/A
690SN/A#ifndef HZ
700SN/A#define	HZ 100
710SN/A#endif
720SN/Aint	hz = HZ;
730SN/Aint	tick = 1000000 / HZ;
740SN/Aint	tickadj = 30000 / (60 * HZ);		/* can adjust 30ms in 60s */
750SN/Astruct	timezone tz = { TIMEZONE, DST };
760SN/A#define	NPROC (20 + 16 * MAXUSERS)
770SN/Aint	maxproc = NPROC;
780SN/A#define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
790SN/A#define	NVNODE (NPROC + NTEXT + 100)
800SN/Aint	desiredvnodes = NVNODE;
810SN/Aint	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
820SN/Aint	ncallout = 16 + NPROC;
830SN/Aint	nclist = 60 + 12 * MAXUSERS;
840SN/Aint	nmbclusters = NMBCLUSTERS;
850SN/Aint	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
860SN/A
870SN/A/*
880SN/A * Values in support of System V compatible shared memory.	XXX
890SN/A */
900SN/A#ifdef SYSVSHM
910SN/A#define	SHMMAX	(SHMMAXPGS*NBPG)
920SN/A#define	SHMMIN	1
930SN/A#define	SHMMNI	32			/* <= SHMMMNI in shm.h */
940SN/A#define	SHMSEG	8
950SN/A#define	SHMALL	(SHMMAXPGS/CLSIZE)
960SN/A
970SN/Astruct	shminfo shminfo = {
980SN/A	SHMMAX,
990SN/A	SHMMIN,
1000SN/A	SHMMNI,
1010SN/A	SHMSEG,
1020SN/A	SHMALL
1030SN/A};
1040SN/A#endif
1050SN/A
1060SN/A/*
1070SN/A * These are initialized at bootstrap time
1080SN/A * to values dependent on memory size
1090SN/A */
1100SN/Aint	nbuf, nswbuf;
1110SN/A
1120SN/A/*
1130SN/A * These have to be allocated somewhere; allocating
1140SN/A * them here forces loader errors if this file is omitted
1150SN/A * (if they've been externed everywhere else; hah!).
1160SN/A */
1170SN/Astruct 	callout *callout;
1180SN/Astruct	cblock *cfree;
1190SN/Astruct	buf *buf, *swbuf;
1200SN/Achar	*buffers;
1210SN/A
1220SN/A/*
1230SN/A * Proc/pgrp hashing.
1240SN/A * Here so that hash table sizes can depend on MAXUSERS/NPROC.
1250SN/A * Hash size must be a power of two.
1260SN/A * NOW omission of this file will cause loader errors!
1270SN/A */
1280SN/A
1290SN/A#if NPROC > 1024
1300SN/A#define	PIDHSZ		512
1310SN/A#else
1320SN/A#if NPROC > 512
1330SN/A#define	PIDHSZ		256
1340SN/A#else
1350SN/A#if NPROC > 256
1360SN/A#define	PIDHSZ		128
1370SN/A#else
1380SN/A#define	PIDHSZ		64
1390SN/A#endif
1400SN/A#endif
1410SN/A#endif
142
143struct	proc *pidhash[PIDHSZ];
144struct	pgrp *pgrphash[PIDHSZ];
145int	pidhashmask = PIDHSZ - 1;
146