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