| 1 | /* |
| 2 | * Copyright (c) 1980, 1986, 1989 Regents of the University of California. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. All advertising materials mentioning features or use of this software |
| 14 | * must display the following acknowledgement: |
| 15 | * This product includes software developed by the University of |
| 16 | * California, Berkeley and its contributors. |
| 17 | * 4. Neither the name of the University nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this software |
| 19 | * without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | * SUCH DAMAGE. |
| 32 | * |
| 33 | * @(#)param.c 7.20 (Berkeley) 6/27/91 |
| 34 | */ |
| 35 | |
| 36 | #include "sys/param.h" |
| 37 | #include "sys/systm.h" |
| 38 | #include "sys/socket.h" |
| 39 | #include "sys/proc.h" |
| 40 | #include "sys/vnode.h" |
| 41 | #include "sys/file.h" |
| 42 | #include "sys/callout.h" |
| 43 | #include "sys/clist.h" |
| 44 | #include "sys/mbuf.h" |
| 45 | #include "ufs/quota.h" |
| 46 | #include "sys/kernel.h" |
| 47 | #ifdef SYSVSHM |
| 48 | #include "machine/vmparam.h" |
| 49 | #include "sys/shm.h" |
| 50 | #endif |
| 51 | |
| 52 | /* |
| 53 | * System parameter formulae. |
| 54 | * |
| 55 | * This file is copied into each directory where we compile |
| 56 | * the kernel; it should be modified there to suit local taste |
| 57 | * if necessary. |
| 58 | * |
| 59 | * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx |
| 60 | */ |
| 61 | |
| 62 | #ifndef HZ |
| 63 | #define HZ 100 |
| 64 | #endif |
| 65 | int hz = HZ; |
| 66 | int tick = 1000000 / HZ; |
| 67 | int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */ |
| 68 | struct timezone tz = { TIMEZONE, DST }; |
| 69 | #define NPROC (20 + 16 * MAXUSERS) |
| 70 | int maxproc = NPROC; |
| 71 | #define NTEXT (80 + NPROC / 8) /* actually the object cache */ |
| 72 | #define NVNODE (NPROC + NTEXT + 100) |
| 73 | long desiredvnodes = NVNODE; |
| 74 | int maxfiles = 3 * (NPROC + MAXUSERS) + 80; |
| 75 | int ncallout = 16 + NPROC; |
| 76 | int nclist = 60 + 12 * MAXUSERS; |
| 77 | int nmbclusters = NMBCLUSTERS; |
| 78 | int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ |
| 79 | |
| 80 | /* |
| 81 | * Values in support of System V compatible shared memory. XXX |
| 82 | */ |
| 83 | #ifdef SYSVSHM |
| 84 | #define SHMMAX (SHMMAXPGS*NBPG) |
| 85 | #define SHMMIN 1 |
| 86 | #define SHMMNI 32 /* <= SHMMMNI in shm.h */ |
| 87 | #define SHMSEG 8 |
| 88 | #define SHMALL (SHMMAXPGS/CLSIZE) |
| 89 | |
| 90 | struct shminfo shminfo = { |
| 91 | SHMMAX, |
| 92 | SHMMIN, |
| 93 | SHMMNI, |
| 94 | SHMSEG, |
| 95 | SHMALL |
| 96 | }; |
| 97 | #endif |
| 98 | |
| 99 | /* |
| 100 | * These are initialized at bootstrap time |
| 101 | * to values dependent on memory size |
| 102 | */ |
| 103 | int nbuf, nswbuf; |
| 104 | |
| 105 | /* |
| 106 | * These have to be allocated somewhere; allocating |
| 107 | * them here forces loader errors if this file is omitted |
| 108 | * (if they've been externed everywhere else; hah!). |
| 109 | */ |
| 110 | struct callout *callout; |
| 111 | struct cblock *cfree; |
| 112 | struct buf *buf, *swbuf; |
| 113 | char *buffers; |
| 114 | |
| 115 | /* |
| 116 | * Proc/pgrp hashing. |
| 117 | * Here so that hash table sizes can depend on MAXUSERS/NPROC. |
| 118 | * Hash size must be a power of two. |
| 119 | * NOW omission of this file will cause loader errors! |
| 120 | */ |
| 121 | |
| 122 | #if NPROC > 1024 |
| 123 | #define PIDHSZ 512 |
| 124 | #else |
| 125 | #if NPROC > 512 |
| 126 | #define PIDHSZ 256 |
| 127 | #else |
| 128 | #if NPROC > 256 |
| 129 | #define PIDHSZ 128 |
| 130 | #else |
| 131 | #define PIDHSZ 64 |
| 132 | #endif |
| 133 | #endif |
| 134 | #endif |
| 135 | |
| 136 | struct proc *pidhash[PIDHSZ]; |
| 137 | struct pgrp *pgrphash[PIDHSZ]; |
| 138 | int pidhashmask = PIDHSZ - 1; |