1 /* $OpenBSD: param.c,v 1.50 2024/05/05 06:14:37 jsg 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 * 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 -DMAXUSERS=xx 60 */ 61 62 int hz = HZ; 63 int tick = 1000000 / HZ; 64 int tick_nsec = 1000000000 / HZ; 65 int utc_offset = 0; 66 #define NPROCESS (30 + 16 * MAXUSERS) 67 #define NTEXT (80 + NPROCESS / 8) /* actually the object cache */ 68 #define NVNODE (NPROCESS * 2 + NTEXT + 100) 69 int initialvnodes = NVNODE; 70 int maxprocess = NPROCESS; 71 int maxthread = 2 * NPROCESS; 72 int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; 73 long nmbclust = NMBCLUSTERS; 74 75 #ifndef BUFCACHEPERCENT 76 #define BUFCACHEPERCENT 20 77 #endif 78 int bufcachepercent = BUFCACHEPERCENT; 79 80 #ifndef BUFPAGES 81 #define BUFPAGES 0 82 #endif 83 long bufpages = BUFPAGES; 84 85 int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ 86 87 /* 88 * Values in support of System V compatible shared memory. XXX 89 */ 90 #ifdef SYSVSHM 91 #define SHMMAX SHMMAXPGS /* shminit() performs a `*= PAGE_SIZE' */ 92 #define SHMMIN 1 93 #define SHMMNI 128 /* <64k, see IPCID_TO_IX in ipc.h */ 94 #define SHMSEG 128 95 #define SHMALL (SHMMAXPGS) 96 97 struct shminfo shminfo = { 98 SHMMAX, 99 SHMMIN, 100 SHMMNI, 101 SHMSEG, 102 SHMALL 103 }; 104 #endif 105 106 /* 107 * Values in support of System V compatible semaphores. 108 */ 109 #ifdef SYSVSEM 110 struct seminfo seminfo = { 111 SEMMNI, /* # of semaphore identifiers */ 112 SEMMNS, /* # of semaphores in system */ 113 SEMMNU, /* # of undo structures in system */ 114 SEMMSL, /* max # of semaphores per id */ 115 SEMOPM, /* max # of operations per semop call */ 116 SEMUME, /* max # of undo entries per process */ 117 SEMUSZ, /* size in bytes of undo structure */ 118 SEMVMX, /* semaphore maximum value */ 119 SEMAEM /* adjust on exit max value */ 120 }; 121 #endif 122 123 /* 124 * This has to be allocated somewhere; allocating 125 * them here forces loader errors if this file is omitted 126 * (if they've been externed everywhere else; hah!). 127 */ 128 struct utsname utsname; 129