1 /* $OpenBSD: param.c,v 1.52 2024/08/20 13:29:25 mvs Exp $ */ 2 /* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */ 3 4 /* 5 * Copyright (c) 1980, 1986, 1989 Regents of the University of California. 6 * All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed 9 * to the University of California by American Telephone and Telegraph 10 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 11 * the permission of UNIX System Laboratories, Inc. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * @(#)param.c 7.20 (Berkeley) 6/27/91 38 */ 39 40 #include <sys/param.h> 41 #include <sys/systm.h> 42 #include <sys/kernel.h> 43 #include <sys/utsname.h> 44 #ifdef SYSVSHM 45 #include <machine/vmparam.h> 46 #include <sys/shm.h> 47 #endif 48 #ifdef SYSVSEM 49 #include <sys/sem.h> 50 #endif 51 52 /* 53 * Locks used to protect data: 54 * a atomic 55 */ 56 57 /* 58 * System parameter formulae. 59 * 60 * This file is copied into each directory where we compile 61 * the kernel; it should be modified there to suit local taste 62 * if necessary. 63 * 64 * Compiled with -DHZ=xx -DMAXUSERS=xx 65 */ 66 67 int hz = HZ; 68 int tick = 1000000 / HZ; 69 int tick_nsec = 1000000000 / HZ; 70 int utc_offset = 0; 71 #define NPROCESS (30 + 16 * MAXUSERS) 72 #define NTEXT (80 + NPROCESS / 8) /* actually the object cache */ 73 #define NVNODE (NPROCESS * 2 + NTEXT + 100) 74 int initialvnodes = NVNODE; 75 int maxprocess = NPROCESS; /* [a] */ 76 int maxthread = 2 * NPROCESS; /* [a] */ 77 int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; /* [a] */ 78 long nmbclust = NMBCLUSTERS; 79 80 #ifndef BUFCACHEPERCENT 81 #define BUFCACHEPERCENT 20 82 #endif 83 int bufcachepercent = BUFCACHEPERCENT; 84 85 #ifndef BUFPAGES 86 #define BUFPAGES 0 87 #endif 88 long bufpages = BUFPAGES; 89 90 int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ 91 92 /* 93 * Values in support of System V compatible shared memory. XXX 94 */ 95 #ifdef SYSVSHM 96 #define SHMMAX SHMMAXPGS /* shminit() performs a `*= PAGE_SIZE' */ 97 #define SHMMIN 1 98 #define SHMMNI 128 /* <64k, see IPCID_TO_IX in ipc.h */ 99 #define SHMSEG 128 100 #define SHMALL (SHMMAXPGS) 101 102 struct shminfo shminfo = { 103 SHMMAX, 104 SHMMIN, 105 SHMMNI, 106 SHMSEG, 107 SHMALL 108 }; 109 #endif 110 111 /* 112 * Values in support of System V compatible semaphores. 113 */ 114 #ifdef SYSVSEM 115 struct seminfo seminfo = { 116 SEMMNI, /* # of semaphore identifiers */ 117 SEMMNS, /* # of semaphores in system */ 118 SEMMNU, /* # of undo structures in system */ 119 SEMMSL, /* max # of semaphores per id */ 120 SEMOPM, /* max # of operations per semop call */ 121 SEMUME, /* max # of undo entries per process */ 122 SEMUSZ, /* size in bytes of undo structure */ 123 SEMVMX, /* semaphore maximum value */ 124 SEMAEM /* adjust on exit max value */ 125 }; 126 #endif 127 128 /* 129 * This has to be allocated somewhere; allocating 130 * them here forces loader errors if this file is omitted 131 * (if they've been externed everywhere else; hah!). 132 */ 133 struct utsname utsname; 134