param.c revision 1.40 1 1.40 atatat /* $NetBSD: param.c,v 1.40 2001/12/17 15:40:43 atatat Exp $ */
2 1.11 cgd
3 1.7 cgd /*
4 1.7 cgd * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
5 1.7 cgd * All rights reserved.
6 1.7 cgd * (c) UNIX System Laboratories, Inc.
7 1.7 cgd * All or some portions of this file are derived from material licensed
8 1.7 cgd * to the University of California by American Telephone and Telegraph
9 1.7 cgd * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 1.7 cgd * the permission of UNIX System Laboratories, Inc.
11 1.7 cgd *
12 1.7 cgd * Redistribution and use in source and binary forms, with or without
13 1.7 cgd * modification, are permitted provided that the following conditions
14 1.7 cgd * are met:
15 1.7 cgd * 1. Redistributions of source code must retain the above copyright
16 1.7 cgd * notice, this list of conditions and the following disclaimer.
17 1.7 cgd * 2. Redistributions in binary form must reproduce the above copyright
18 1.7 cgd * notice, this list of conditions and the following disclaimer in the
19 1.7 cgd * documentation and/or other materials provided with the distribution.
20 1.7 cgd * 3. All advertising materials mentioning features or use of this software
21 1.7 cgd * must display the following acknowledgement:
22 1.7 cgd * This product includes software developed by the University of
23 1.7 cgd * California, Berkeley and its contributors.
24 1.7 cgd * 4. Neither the name of the University nor the names of its contributors
25 1.7 cgd * may be used to endorse or promote products derived from this software
26 1.7 cgd * without specific prior written permission.
27 1.7 cgd *
28 1.7 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.7 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.7 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.7 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.7 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.7 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.7 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.7 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.7 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.7 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.7 cgd * SUCH DAMAGE.
39 1.7 cgd *
40 1.10 cgd * @(#)param.c 7.20 (Berkeley) 6/27/91
41 1.7 cgd */
42 1.39 lukem
43 1.39 lukem #include <sys/cdefs.h>
44 1.40 atatat __KERNEL_RCSID(0, "$NetBSD: param.c,v 1.40 2001/12/17 15:40:43 atatat Exp $");
45 1.22 enami
46 1.22 enami #include "opt_rtc_offset.h"
47 1.26 simonb #include "opt_sb_max.h"
48 1.24 tron #include "opt_sysv.h"
49 1.36 jdolecek #include "opt_sysvparam.h"
50 1.7 cgd
51 1.7 cgd #include <sys/param.h>
52 1.7 cgd #include <sys/systm.h>
53 1.7 cgd #include <sys/socket.h>
54 1.26 simonb #include <sys/socketvar.h>
55 1.7 cgd #include <sys/proc.h>
56 1.7 cgd #include <sys/vnode.h>
57 1.7 cgd #include <sys/file.h>
58 1.7 cgd #include <sys/callout.h>
59 1.7 cgd #include <sys/mbuf.h>
60 1.9 mycroft #include <ufs/ufs/quota.h>
61 1.7 cgd #include <sys/kernel.h>
62 1.7 cgd #include <sys/utsname.h>
63 1.7 cgd #ifdef SYSVSHM
64 1.7 cgd #include <machine/vmparam.h>
65 1.7 cgd #include <sys/shm.h>
66 1.7 cgd #endif
67 1.7 cgd #ifdef SYSVSEM
68 1.7 cgd #include <sys/sem.h>
69 1.7 cgd #endif
70 1.7 cgd #ifdef SYSVMSG
71 1.7 cgd #include <sys/msg.h>
72 1.7 cgd #endif
73 1.40 atatat
74 1.40 atatat #define CONFIG_FILE
75 1.40 atatat #include "config_file.h"
76 1.7 cgd
77 1.7 cgd /*
78 1.7 cgd * System parameter formulae.
79 1.7 cgd *
80 1.7 cgd * This file is copied into each directory where we compile
81 1.7 cgd * the kernel; it should be modified there to suit local taste
82 1.7 cgd * if necessary.
83 1.7 cgd *
84 1.19 perry * Compiled with -DHZ=xx -DRTC_OFFSET=x -DMAXUSERS=xx
85 1.7 cgd */
86 1.7 cgd
87 1.19 perry #ifdef TIMEZONE
88 1.19 perry #error TIMEZONE is an obsolete kernel option.
89 1.16 mrg #endif
90 1.33 thorpej
91 1.19 perry #ifdef DST
92 1.19 perry #error DST is an obsolete kernel option.
93 1.19 perry #endif
94 1.33 thorpej
95 1.19 perry #ifndef RTC_OFFSET
96 1.19 perry #define RTC_OFFSET 0
97 1.16 mrg #endif
98 1.33 thorpej
99 1.7 cgd #ifndef HZ
100 1.7 cgd #define HZ 100
101 1.7 cgd #endif
102 1.33 thorpej
103 1.33 thorpej #ifndef MAXFILES
104 1.33 thorpej #define MAXFILES (3 * (NPROC + MAXUSERS) + 80)
105 1.33 thorpej #endif
106 1.33 thorpej
107 1.7 cgd int hz = HZ;
108 1.7 cgd int tick = 1000000 / HZ;
109 1.7 cgd int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */
110 1.19 perry int rtc_offset = RTC_OFFSET;
111 1.7 cgd int maxproc = NPROC;
112 1.9 mycroft int desiredvnodes = NVNODE;
113 1.33 thorpej int maxfiles = MAXFILES;
114 1.33 thorpej int ncallout = 16 + NPROC; /* size of callwheel (rounded to ^2) */
115 1.26 simonb u_long sb_max = SB_MAX; /* maximum socket buffer size */
116 1.7 cgd int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
117 1.29 thorpej
118 1.29 thorpej /*
119 1.29 thorpej * Various mbuf-related parameters. These can also be changed at run-time
120 1.29 thorpej * with sysctl.
121 1.29 thorpej */
122 1.29 thorpej int nmbclusters = NMBCLUSTERS;
123 1.29 thorpej
124 1.29 thorpej #ifndef MBLOWAT
125 1.29 thorpej #define MBLOWAT 16
126 1.29 thorpej #endif
127 1.29 thorpej int mblowat = MBLOWAT;
128 1.29 thorpej
129 1.29 thorpej #ifndef MCLLOWAT
130 1.29 thorpej #define MCLLOWAT 8
131 1.29 thorpej #endif
132 1.29 thorpej int mcllowat = MCLLOWAT;
133 1.7 cgd
134 1.7 cgd /*
135 1.7 cgd * Values in support of System V compatible shared memory. XXX
136 1.7 cgd */
137 1.7 cgd #ifdef SYSVSHM
138 1.38 mrg #ifndef SHMMAX
139 1.12 deraadt #define SHMMAX SHMMAXPGS /* shminit() performs a `*= NBPG' */
140 1.38 mrg #endif
141 1.38 mrg #ifndef SHMMIN
142 1.7 cgd #define SHMMIN 1
143 1.38 mrg #endif
144 1.38 mrg #ifndef SHMMNI
145 1.23 mrg #define SHMMNI 128 /* <= SHMMMNI in shm.h */
146 1.38 mrg #endif
147 1.38 mrg #ifndef SHMSEG
148 1.37 mycroft #define SHMSEG 128
149 1.38 mrg #endif
150 1.32 ragge #define SHMALL SHMMAXPGS
151 1.7 cgd
152 1.7 cgd struct shminfo shminfo = {
153 1.7 cgd SHMMAX,
154 1.7 cgd SHMMIN,
155 1.7 cgd SHMMNI,
156 1.7 cgd SHMSEG,
157 1.7 cgd SHMALL
158 1.7 cgd };
159 1.7 cgd #endif
160 1.7 cgd
161 1.7 cgd /*
162 1.7 cgd * Values in support of System V compatible semaphores.
163 1.7 cgd */
164 1.7 cgd #ifdef SYSVSEM
165 1.14 mycroft struct seminfo seminfo = {
166 1.14 mycroft SEMMAP, /* # of entries in semaphore map */
167 1.14 mycroft SEMMNI, /* # of semaphore identifiers */
168 1.14 mycroft SEMMNS, /* # of semaphores in system */
169 1.14 mycroft SEMMNU, /* # of undo structures in system */
170 1.14 mycroft SEMMSL, /* max # of semaphores per id */
171 1.14 mycroft SEMOPM, /* max # of operations per semop call */
172 1.14 mycroft SEMUME, /* max # of undo entries per process */
173 1.14 mycroft SEMUSZ, /* size in bytes of undo structure */
174 1.14 mycroft SEMVMX, /* semaphore maximum value */
175 1.14 mycroft SEMAEM /* adjust on exit max value */
176 1.7 cgd };
177 1.7 cgd #endif
178 1.7 cgd
179 1.7 cgd /*
180 1.7 cgd * Values in support of System V compatible messages.
181 1.7 cgd */
182 1.7 cgd #ifdef SYSVMSG
183 1.14 mycroft struct msginfo msginfo = {
184 1.14 mycroft MSGMAX, /* max chars in a message */
185 1.14 mycroft MSGMNI, /* # of message queue identifiers */
186 1.14 mycroft MSGMNB, /* max chars in a queue */
187 1.14 mycroft MSGTQL, /* max messages in system */
188 1.14 mycroft MSGSSZ, /* size of a message segment */
189 1.14 mycroft /* (must be small power of 2 greater than 4) */
190 1.14 mycroft MSGSEG /* number of message segments */
191 1.7 cgd };
192 1.7 cgd #endif
193 1.7 cgd
194 1.7 cgd /*
195 1.7 cgd * These have to be allocated somewhere; allocating
196 1.7 cgd * them here forces loader errors if this file is omitted
197 1.7 cgd * (if they've been externed everywhere else; hah!).
198 1.7 cgd */
199 1.30 cgd struct buf *buf;
200 1.7 cgd char *buffers;
201 1.17 explorer
202 1.17 explorer /*
203 1.17 explorer * These control when and to what priority a process gets after a certain
204 1.17 explorer * amount of CPU time expires. AUTONICETIME is in seconds.
205 1.18 ws * AUTONICEVAL is NOT offset by NZERO, i.e. it's between PRIO_MIN and PRIO_MAX.
206 1.17 explorer */
207 1.31 lukem #ifndef AUTONICETIME
208 1.31 lukem #define AUTONICETIME (60 * 10) /* 10 minutes */
209 1.31 lukem #endif
210 1.31 lukem
211 1.31 lukem #ifndef AUTONICEVAL
212 1.31 lukem #define AUTONICEVAL 4 /* default + 4 */
213 1.17 explorer #endif
214 1.17 explorer
215 1.31 lukem int autonicetime = AUTONICETIME;
216 1.17 explorer int autoniceval = AUTONICEVAL;
217 1.17 explorer
218 1.21 jonathan /*
219 1.21 jonathan * Actual network mbuf sizes (read-only), for netstat.
220 1.21 jonathan */
221 1.28 simonb const int msize = MSIZE;
222 1.28 simonb const int mclbytes = MCLBYTES;
223