1*02502a24Smrg /* $NetBSD: param.c,v 1.70 2022/07/23 19:15:29 mrg Exp $ */ 2cf92afd6Scgd 3725ed31eScgd /* 4725ed31eScgd * Copyright (c) 1980, 1986, 1989 Regents of the University of California. 5725ed31eScgd * All rights reserved. 6725ed31eScgd * (c) UNIX System Laboratories, Inc. 7725ed31eScgd * All or some portions of this file are derived from material licensed 8725ed31eScgd * to the University of California by American Telephone and Telegraph 9725ed31eScgd * Co. or Unix System Laboratories, Inc. and are reproduced herein with 10725ed31eScgd * the permission of UNIX System Laboratories, Inc. 11725ed31eScgd * 12725ed31eScgd * Redistribution and use in source and binary forms, with or without 13725ed31eScgd * modification, are permitted provided that the following conditions 14725ed31eScgd * are met: 15725ed31eScgd * 1. Redistributions of source code must retain the above copyright 16725ed31eScgd * notice, this list of conditions and the following disclaimer. 17725ed31eScgd * 2. Redistributions in binary form must reproduce the above copyright 18725ed31eScgd * notice, this list of conditions and the following disclaimer in the 19725ed31eScgd * documentation and/or other materials provided with the distribution. 20aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 21725ed31eScgd * may be used to endorse or promote products derived from this software 22725ed31eScgd * without specific prior written permission. 23725ed31eScgd * 24725ed31eScgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25725ed31eScgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26725ed31eScgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27725ed31eScgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28725ed31eScgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29725ed31eScgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30725ed31eScgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31725ed31eScgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32725ed31eScgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33725ed31eScgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34725ed31eScgd * SUCH DAMAGE. 35725ed31eScgd * 3689e331dcScgd * @(#)param.c 7.20 (Berkeley) 6/27/91 37725ed31eScgd */ 38725ed31eScgd 3927cc5a5dSlukem #include <sys/cdefs.h> 40*02502a24Smrg __KERNEL_RCSID(0, "$NetBSD: param.c,v 1.70 2022/07/23 19:15:29 mrg Exp $"); 4127cc5a5dSlukem 42d8e04c90Spooka #ifdef _KERNEL_OPT 433998262dSyamt #include "opt_hz.h" 448a455210Senami #include "opt_rtc_offset.h" 4539876df9Stron #include "opt_sysv.h" 465c369e46Sjdolecek #include "opt_sysvparam.h" 473bd2b6fbSad #include "opt_multiprocessor.h" 48*02502a24Smrg #include "opt_maxlwp.h" 49d8e04c90Spooka #endif 508a455210Senami 51725ed31eScgd #include <sys/param.h> 52725ed31eScgd #include <sys/systm.h> 53725ed31eScgd #include <sys/socket.h> 548ce41be7Ssimonb #include <sys/socketvar.h> 55725ed31eScgd #include <sys/proc.h> 56725ed31eScgd #include <sys/vnode.h> 57725ed31eScgd #include <sys/file.h> 58725ed31eScgd #include <sys/callout.h> 59725ed31eScgd #include <sys/mbuf.h> 6036d501bfSmycroft #include <ufs/ufs/quota.h> 61725ed31eScgd #include <sys/kernel.h> 62725ed31eScgd #include <sys/utsname.h> 6304610895Schristos #include <sys/lwp.h> 64725ed31eScgd #ifdef SYSVSHM 65725ed31eScgd #include <machine/vmparam.h> 66725ed31eScgd #include <sys/shm.h> 67725ed31eScgd #endif 68725ed31eScgd #ifdef SYSVSEM 69725ed31eScgd #include <sys/sem.h> 70725ed31eScgd #endif 71725ed31eScgd #ifdef SYSVMSG 72725ed31eScgd #include <sys/msg.h> 73725ed31eScgd #endif 74725ed31eScgd 75fb80c8cdSgmcgarry /* 76fb80c8cdSgmcgarry * PCC cannot handle the 80KB string literal. 77fb80c8cdSgmcgarry */ 78fb80c8cdSgmcgarry #if !defined(__PCC__) 795ba43873Satatat #define CONFIG_FILE 805ba43873Satatat #include "config_file.h" 81fb80c8cdSgmcgarry #endif 825ba43873Satatat 83725ed31eScgd /* 84725ed31eScgd * System parameter formulae. 85725ed31eScgd * 86725ed31eScgd * This file is copied into each directory where we compile 87725ed31eScgd * the kernel; it should be modified there to suit local taste 88725ed31eScgd * if necessary. 89725ed31eScgd * 90b89a3425Sperry * Compiled with -DHZ=xx -DRTC_OFFSET=x -DMAXUSERS=xx 91725ed31eScgd */ 92725ed31eScgd 93b89a3425Sperry #ifdef TIMEZONE 94b89a3425Sperry #error TIMEZONE is an obsolete kernel option. 95a8554128Smrg #endif 967b918b40Sthorpej 97b89a3425Sperry #ifdef DST 98b89a3425Sperry #error DST is an obsolete kernel option. 99b89a3425Sperry #endif 1007b918b40Sthorpej 101b89a3425Sperry #ifndef RTC_OFFSET 102b89a3425Sperry #define RTC_OFFSET 0 103a8554128Smrg #endif 1047b918b40Sthorpej 105725ed31eScgd #ifndef HZ 106725ed31eScgd #define HZ 100 107725ed31eScgd #endif 1087b918b40Sthorpej 109b94f79f0Sad #ifndef MAXEXEC 110b94f79f0Sad #define MAXEXEC 16 111b94f79f0Sad #endif 112b94f79f0Sad 113725ed31eScgd int hz = HZ; 114725ed31eScgd int tick = 1000000 / HZ; 11534ed9bd3Syamt /* can adjust 240ms in 60s */ 11634ed9bd3Syamt int tickadj = (240000 / (60 * HZ)) ? (240000 / (60 * HZ)) : 1; 117b89a3425Sperry int rtc_offset = RTC_OFFSET; 118725ed31eScgd int maxproc = NPROC; 11904610895Schristos int maxlwp = MAXLWP; 12036d501bfSmycroft int desiredvnodes = NVNODE; 121ea3f10f7Sad u_int maxfiles = MAXFILES; 122725ed31eScgd int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ 123b94f79f0Sad int maxexec = MAXEXEC; /* max number of concurrent exec() calls */ 1240f33676cSad 1253bd2b6fbSad #ifdef MULTIPROCESSOR 1263bd2b6fbSad u_int maxcpus = MAXCPUS; 1270f33676cSad size_t coherency_unit = COHERENCY_UNIT; 1283bd2b6fbSad #else 1293bd2b6fbSad u_int maxcpus = 1; 130f280ebaeSad size_t coherency_unit = ALIGNBYTES + 1; 1313bd2b6fbSad #endif 132725ed31eScgd 133725ed31eScgd /* 134c92294acSthorpej * Various mbuf-related parameters. These can also be changed at run-time 135c92294acSthorpej * with sysctl. 136c92294acSthorpej */ 137d621e29eSjoerg int nmbclusters = 0; 138c92294acSthorpej 139c92294acSthorpej #ifndef MBLOWAT 140c92294acSthorpej #define MBLOWAT 16 141c92294acSthorpej #endif 142c92294acSthorpej int mblowat = MBLOWAT; 143c92294acSthorpej 144c92294acSthorpej #ifndef MCLLOWAT 145c92294acSthorpej #define MCLLOWAT 8 146c92294acSthorpej #endif 147c92294acSthorpej int mcllowat = MCLLOWAT; 148c92294acSthorpej 149725ed31eScgd /* 150f0f7e532Sjonathan * Actual network mbuf sizes (read-only), for netstat. 151f0f7e532Sjonathan */ 1521a2458f4Ssimonb const int msize = MSIZE; 1531a2458f4Ssimonb const int mclbytes = MCLBYTES; 154