1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1980, 1986, 1989, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * (c) UNIX System Laboratories, Inc. 5df8bae1dSRodney W. Grimes * All or some portions of this file are derived from material licensed 6df8bae1dSRodney W. Grimes * to the University of California by American Telephone and Telegraph 7df8bae1dSRodney W. Grimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8df8bae1dSRodney W. Grimes * the permission of UNIX System Laboratories, Inc. 9df8bae1dSRodney W. Grimes * 10df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 11df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 12df8bae1dSRodney W. Grimes * are met: 13df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 14df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 15df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 16df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 17df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 18df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 19df8bae1dSRodney W. Grimes * must display the following acknowledgement: 20df8bae1dSRodney W. Grimes * This product includes software developed by the University of 21df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 22df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 23df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 24df8bae1dSRodney W. Grimes * without specific prior written permission. 25df8bae1dSRodney W. Grimes * 26df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36df8bae1dSRodney W. Grimes * SUCH DAMAGE. 37df8bae1dSRodney W. Grimes * 38df8bae1dSRodney W. Grimes * @(#)param.c 8.2 (Berkeley) 1/21/94 3950c73f36SGarrett Wollman * $Id: param.c,v 1.13 1995/12/10 13:44:55 phk Exp $ 40df8bae1dSRodney W. Grimes */ 41df8bae1dSRodney W. Grimes 4250c73f36SGarrett Wollman #include "opt_sysvipc.h" 4350c73f36SGarrett Wollman 44df8bae1dSRodney W. Grimes #include <sys/param.h> 45df8bae1dSRodney W. Grimes #include <sys/systm.h> 46df8bae1dSRodney W. Grimes #include <sys/socket.h> 47df8bae1dSRodney W. Grimes #include <sys/proc.h> 48df8bae1dSRodney W. Grimes #include <sys/vnode.h> 49df8bae1dSRodney W. Grimes #include <sys/file.h> 50df8bae1dSRodney W. Grimes #include <sys/callout.h> 51df8bae1dSRodney W. Grimes #include <sys/clist.h> 52df8bae1dSRodney W. Grimes #include <sys/mbuf.h> 53df8bae1dSRodney W. Grimes #include <sys/kernel.h> 54df8bae1dSRodney W. Grimes 55df8bae1dSRodney W. Grimes #include <ufs/ufs/quota.h> 56df8bae1dSRodney W. Grimes 57df8bae1dSRodney W. Grimes #ifdef SYSVSHM 58df8bae1dSRodney W. Grimes #include <machine/vmparam.h> 59df8bae1dSRodney W. Grimes #include <sys/shm.h> 60df8bae1dSRodney W. Grimes #endif 613d903220SDoug Rabson #ifdef SYSVSEM 6250c73f36SGarrett Wollman #include <sys/sem.h> 633d903220SDoug Rabson #endif 643d903220SDoug Rabson #ifdef SYSVMSG 6550c73f36SGarrett Wollman #include <sys/msg.h> 663d903220SDoug Rabson #endif 67df8bae1dSRodney W. Grimes 68df8bae1dSRodney W. Grimes /* 69df8bae1dSRodney W. Grimes * System parameter formulae. 70df8bae1dSRodney W. Grimes * 71df8bae1dSRodney W. Grimes * This file is copied into each directory where we compile 72df8bae1dSRodney W. Grimes * the kernel; it should be modified there to suit local taste 73df8bae1dSRodney W. Grimes * if necessary. 74df8bae1dSRodney W. Grimes * 75ac7e6123SDavid Greenman * Compiled with -DMAXUSERS=xx 76df8bae1dSRodney W. Grimes */ 77df8bae1dSRodney W. Grimes 78df8bae1dSRodney W. Grimes #ifndef HZ 79df8bae1dSRodney W. Grimes #define HZ 100 80df8bae1dSRodney W. Grimes #endif 81df8bae1dSRodney W. Grimes int hz = HZ; 82df8bae1dSRodney W. Grimes int tick = 1000000 / HZ; 83df8bae1dSRodney W. Grimes int tickadj = 30000 / (60 * HZ); /* can adjust 30ms in 60s */ 84df8bae1dSRodney W. Grimes #define NPROC (20 + 16 * MAXUSERS) 850d94caffSDavid Greenman int maxproc = NPROC; /* maximum # of processes */ 86e6373c9eSGuido van Rooij int maxprocperuid = NPROC-1; /* maximum # of processes per user */ 87ec2bb6adSDavid Greenman int maxfiles = NPROC*2; /* system wide open files limit */ 88cddc961aSDavid Greenman int maxfilesperproc = NPROC*2; /* per-process open files limit */ 890d94caffSDavid Greenman int ncallout = 16 + NPROC; /* maximum # of timer events */ 90cddc961aSDavid Greenman 91cddc961aSDavid Greenman /* maximum # of mbuf clusters */ 92cddc961aSDavid Greenman #ifndef NMBCLUSTERS 93cddc961aSDavid Greenman int nmbclusters = 512 + MAXUSERS * 16; 94cddc961aSDavid Greenman #else 95df8bae1dSRodney W. Grimes int nmbclusters = NMBCLUSTERS; 96cddc961aSDavid Greenman #endif 97cddc961aSDavid Greenman 98df8bae1dSRodney W. Grimes int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ 99df8bae1dSRodney W. Grimes 100df8bae1dSRodney W. Grimes /* 101df8bae1dSRodney W. Grimes * Values in support of System V compatible shared memory. XXX 102df8bae1dSRodney W. Grimes */ 103df8bae1dSRodney W. Grimes #ifdef SYSVSHM 1043ab1adc5SJoerg Wunsch #ifndef SHMMAX 105df8bae1dSRodney W. Grimes #define SHMMAX (SHMMAXPGS*NBPG) 1063ab1adc5SJoerg Wunsch #endif 1073ab1adc5SJoerg Wunsch #ifndef SHMMIN 108df8bae1dSRodney W. Grimes #define SHMMIN 1 1093ab1adc5SJoerg Wunsch #endif 1103ab1adc5SJoerg Wunsch #ifndef SHMMNI 111df8bae1dSRodney W. Grimes #define SHMMNI 32 /* <= SHMMMNI in shm.h */ 1123ab1adc5SJoerg Wunsch #endif 1133ab1adc5SJoerg Wunsch #ifndef SHMSEG 114df8bae1dSRodney W. Grimes #define SHMSEG 8 1153ab1adc5SJoerg Wunsch #endif 1163ab1adc5SJoerg Wunsch #ifndef SHMALL 117df8bae1dSRodney W. Grimes #define SHMALL (SHMMAXPGS/CLSIZE) 1183ab1adc5SJoerg Wunsch #endif 119df8bae1dSRodney W. Grimes 120df8bae1dSRodney W. Grimes struct shminfo shminfo = { 121df8bae1dSRodney W. Grimes SHMMAX, 122df8bae1dSRodney W. Grimes SHMMIN, 123df8bae1dSRodney W. Grimes SHMMNI, 124df8bae1dSRodney W. Grimes SHMSEG, 125df8bae1dSRodney W. Grimes SHMALL 126df8bae1dSRodney W. Grimes }; 127df8bae1dSRodney W. Grimes #endif 128df8bae1dSRodney W. Grimes 129df8bae1dSRodney W. Grimes /* 1303d903220SDoug Rabson * Values in support of System V compatible semaphores. 1313d903220SDoug Rabson */ 1323d903220SDoug Rabson 1333d903220SDoug Rabson #ifdef SYSVSEM 1343d903220SDoug Rabson 1353d903220SDoug Rabson struct seminfo seminfo = { 1363d903220SDoug Rabson SEMMAP, /* # of entries in semaphore map */ 1373d903220SDoug Rabson SEMMNI, /* # of semaphore identifiers */ 1383d903220SDoug Rabson SEMMNS, /* # of semaphores in system */ 1393d903220SDoug Rabson SEMMNU, /* # of undo structures in system */ 1403d903220SDoug Rabson SEMMSL, /* max # of semaphores per id */ 1413d903220SDoug Rabson SEMOPM, /* max # of operations per semop call */ 1423d903220SDoug Rabson SEMUME, /* max # of undo entries per process */ 1433d903220SDoug Rabson SEMUSZ, /* size in bytes of undo structure */ 1443d903220SDoug Rabson SEMVMX, /* semaphore maximum value */ 1453d903220SDoug Rabson SEMAEM /* adjust on exit max value */ 1463d903220SDoug Rabson }; 1473d903220SDoug Rabson #endif 1483d903220SDoug Rabson 1493d903220SDoug Rabson /* 1503d903220SDoug Rabson * Values in support of System V compatible messages. 1513d903220SDoug Rabson */ 1523d903220SDoug Rabson 1533d903220SDoug Rabson #ifdef SYSVMSG 1543d903220SDoug Rabson 1553d903220SDoug Rabson struct msginfo msginfo = { 1563d903220SDoug Rabson MSGMAX, /* max chars in a message */ 1573d903220SDoug Rabson MSGMNI, /* # of message queue identifiers */ 1583d903220SDoug Rabson MSGMNB, /* max chars in a queue */ 1593d903220SDoug Rabson MSGTQL, /* max messages in system */ 1603d903220SDoug Rabson MSGSSZ, /* size of a message segment */ 1613d903220SDoug Rabson /* (must be small power of 2 greater than 4) */ 1623d903220SDoug Rabson MSGSEG /* number of message segments */ 1633d903220SDoug Rabson }; 1643d903220SDoug Rabson #endif 1653d903220SDoug Rabson 1663d903220SDoug Rabson /* 16728f8db14SBruce Evans * These may be set to nonzero here or by patching. 16828f8db14SBruce Evans * If they are nonzero at bootstrap time then they are 16928f8db14SBruce Evans * initialized to values dependent on the memory size. 170df8bae1dSRodney W. Grimes */ 17128f8db14SBruce Evans #ifdef NBUF 17228f8db14SBruce Evans int nbuf = NBUF; 17328f8db14SBruce Evans #else 17428f8db14SBruce Evans int nbuf = 0; 17528f8db14SBruce Evans #endif 17628f8db14SBruce Evans int nswbuf = 0; 177df8bae1dSRodney W. Grimes 178df8bae1dSRodney W. Grimes /* 179df8bae1dSRodney W. Grimes * These have to be allocated somewhere; allocating 180df8bae1dSRodney W. Grimes * them here forces loader errors if this file is omitted 181df8bae1dSRodney W. Grimes * (if they've been externed everywhere else; hah!). 182df8bae1dSRodney W. Grimes */ 18328f8db14SBruce Evans struct buf *swbuf; 184df8bae1dSRodney W. Grimes 185df8bae1dSRodney W. Grimes /* 186df8bae1dSRodney W. Grimes * Proc/pgrp hashing. 187df8bae1dSRodney W. Grimes * Here so that hash table sizes can depend on MAXUSERS/NPROC. 188df8bae1dSRodney W. Grimes * Hash size must be a power of two. 189df8bae1dSRodney W. Grimes * NOW omission of this file will cause loader errors! 190df8bae1dSRodney W. Grimes */ 191df8bae1dSRodney W. Grimes 192df8bae1dSRodney W. Grimes #if NPROC > 1024 193df8bae1dSRodney W. Grimes #define PIDHSZ 512 194df8bae1dSRodney W. Grimes #else 195df8bae1dSRodney W. Grimes #if NPROC > 512 196df8bae1dSRodney W. Grimes #define PIDHSZ 256 197df8bae1dSRodney W. Grimes #else 198df8bae1dSRodney W. Grimes #if NPROC > 256 199df8bae1dSRodney W. Grimes #define PIDHSZ 128 200df8bae1dSRodney W. Grimes #else 201df8bae1dSRodney W. Grimes #define PIDHSZ 64 202df8bae1dSRodney W. Grimes #endif 203df8bae1dSRodney W. Grimes #endif 204df8bae1dSRodney W. Grimes #endif 205df8bae1dSRodney W. Grimes 206df8bae1dSRodney W. Grimes struct proc *pidhash[PIDHSZ]; 207df8bae1dSRodney W. Grimes struct pgrp *pgrphash[PIDHSZ]; 208df8bae1dSRodney W. Grimes int pidhashmask = PIDHSZ - 1; 209