subr_param.c revision 67046
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1980, 1986, 1989, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 3. All advertising materials mentioning features or use of this software
191541Srgrimes *    must display the following acknowledgement:
201541Srgrimes *	This product includes software developed by the University of
211541Srgrimes *	California, Berkeley and its contributors.
221541Srgrimes * 4. Neither the name of the University nor the names of its contributors
231541Srgrimes *    may be used to endorse or promote products derived from this software
241541Srgrimes *    without specific prior written permission.
251541Srgrimes *
261541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361541Srgrimes * SUCH DAMAGE.
371541Srgrimes *
3814526Shsu *	@(#)param.c	8.3 (Berkeley) 8/20/94
3950477Speter * $FreeBSD: head/sys/kern/subr_param.c 67046 2000-10-12 22:37:28Z jasone $
401541Srgrimes */
411541Srgrimes
4241774Sdillon#include <stddef.h>
4341774Sdillon
4414328Speter#include "opt_param.h"
4513226Swollman
461541Srgrimes#include <sys/param.h>
471541Srgrimes
481541Srgrimes/*
491541Srgrimes * System parameter formulae.
501541Srgrimes *
511541Srgrimes * This file is copied into each directory where we compile
521541Srgrimes * the kernel; it should be modified there to suit local taste
531541Srgrimes * if necessary.
541541Srgrimes *
559369Sdg * Compiled with -DMAXUSERS=xx
561541Srgrimes */
571541Srgrimes
581541Srgrimes#ifndef HZ
591541Srgrimes#define	HZ 100
601541Srgrimes#endif
611541Srgrimesint	hz = HZ;
621541Srgrimesint	tick = 1000000 / HZ;
6337087Sbdeint	tickadj = howmany(30000, 60 * HZ);	/* can adjust 30ms in 60s */
641541Srgrimes#define	NPROC (20 + 16 * MAXUSERS)
6545515Sdes#ifndef MAXFILES
6633882Sguido#define MAXFILES (NPROC*2)
6745515Sdes#endif
685455Sdgint	maxproc = NPROC;			/* maximum # of processes */
696577Sguidoint	maxprocperuid = NPROC-1;		/* maximum # of processes per user */
7033882Sguidoint	maxfiles = MAXFILES;			/* system wide open files limit */
7133882Sguidoint	maxfilesperproc = MAXFILES;		/* per-process open files limit */
7233882Sguidoint	ncallout = 16 + NPROC + MAXFILES;	/* maximum # of timer events */
7354478Sgreenint	mbuf_wait = 32;				/* mbuf sleep time in ticks */
748747Sdg
7540931Sdg/* maximum # of sf_bufs (sendfile(2) zero-copy virtual buffers) */
7640931Sdg#ifndef NSFBUFS
7740931Sdg#define	NSFBUFS (512 + MAXUSERS * 16)
7840931Sdg#endif
7940931Sdgint	nsfbufs = NSFBUFS;
8040931Sdg
811541Srgrimes/*
829759Sbde * These may be set to nonzero here or by patching.
839759Sbde * If they are nonzero at bootstrap time then they are
849759Sbde * initialized to values dependent on the memory size.
851541Srgrimes */
869759Sbde#ifdef	NBUF
879759Sbdeint	nbuf = NBUF;
889759Sbde#else
899759Sbdeint	nbuf = 0;
909759Sbde#endif
919759Sbdeint	nswbuf = 0;
921541Srgrimes
931541Srgrimes/*
941541Srgrimes * These have to be allocated somewhere; allocating
951541Srgrimes * them here forces loader errors if this file is omitted
961541Srgrimes * (if they've been externed everywhere else; hah!).
971541Srgrimes */
989759Sbdestruct	buf *swbuf;
9967046Sjasone
10067046Sjasone/*
10167046Sjasone * Total number of shared mutexes to protect all lockmgr locks.
10267046Sjasone */
10367046Sjasone#ifndef	LOCKMUTEX
10467046Sjasone#define LOCKMUTEX	10
10567046Sjasone#endif
10667046Sjasoneint	lock_nmtx = LOCKMUTEX;
107