xref: /openbsd/sys/conf/param.c (revision bcb7fb27)
1 /*	$OpenBSD: param.c,v 1.14 2001/07/05 10:12:22 art 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. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgement:
23  *	This product includes software developed by the University of
24  *	California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *	@(#)param.c	7.20 (Berkeley) 6/27/91
42  */
43 
44 #include <sys/param.h>
45 #include <sys/systm.h>
46 #include <sys/socket.h>
47 #include <sys/proc.h>
48 #include <sys/vnode.h>
49 #include <sys/file.h>
50 #include <sys/timeout.h>
51 #include <sys/mbuf.h>
52 #include <ufs/ufs/quota.h>
53 #include <sys/kernel.h>
54 #include <sys/utsname.h>
55 #ifdef SYSVSHM
56 #include <machine/vmparam.h>
57 #include <sys/shm.h>
58 #endif
59 #ifdef SYSVSEM
60 #include <sys/sem.h>
61 #endif
62 #ifdef SYSVMSG
63 #include <sys/msg.h>
64 #endif
65 
66 /*
67  * System parameter formulae.
68  *
69  * This file is copied into each directory where we compile
70  * the kernel; it should be modified there to suit local taste
71  * if necessary.
72  *
73  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
74  */
75 
76 #ifndef TIMEZONE
77 # define TIMEZONE 0
78 #endif
79 #ifndef DST
80 # define DST 0
81 #endif
82 #ifndef HZ
83 #define	HZ 100
84 #endif
85 int	hz = HZ;
86 int	tick = 1000000 / HZ;
87 int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
88 struct	timezone tz = { TIMEZONE, DST };
89 #define	NPROC (20 + 16 * MAXUSERS)
90 int	maxproc = NPROC;
91 #define	NTEXT (80 + NPROC / 8)	/* actually the object cache */
92 #define	NVNODE (NPROC * 2 + NTEXT + 100)
93 int	desiredvnodes = NVNODE;
94 int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
95 int	ntimeout = (16 + NPROC) * 2;
96 int	nmbclusters = NMBCLUSTERS;
97 
98 #ifndef MBLOWAT
99 #define MBLOWAT		16
100 #endif
101 int	mblowat = MBLOWAT;
102 
103 #ifndef MCLLOWAT
104 #define MCLLOWAT	8
105 #endif
106 int	mcllowat = MCLLOWAT;
107 
108 
109 int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
110 
111 /*
112  * Values in support of System V compatible shared memory.	XXX
113  */
114 #ifdef SYSVSHM
115 #define	SHMMAX	SHMMAXPGS	/* shminit() performs a `*= PAGE_SIZE' */
116 #define	SHMMIN	1
117 #define	SHMMNI	32			/* <= SHMMMNI in shm.h */
118 #define	SHMSEG	8
119 #define	SHMALL	(SHMMAXPGS)
120 
121 struct	shminfo shminfo = {
122 	SHMMAX,
123 	SHMMIN,
124 	SHMMNI,
125 	SHMSEG,
126 	SHMALL
127 };
128 #endif
129 
130 /*
131  * Values in support of System V compatible semaphores.
132  */
133 #ifdef SYSVSEM
134 struct	seminfo seminfo = {
135 	SEMMAP,		/* # of entries in semaphore map */
136 	SEMMNI,		/* # of semaphore identifiers */
137 	SEMMNS,		/* # of semaphores in system */
138 	SEMMNU,		/* # of undo structures in system */
139 	SEMMSL,		/* max # of semaphores per id */
140 	SEMOPM,		/* max # of operations per semop call */
141 	SEMUME,		/* max # of undo entries per process */
142 	SEMUSZ,		/* size in bytes of undo structure */
143 	SEMVMX,		/* semaphore maximum value */
144 	SEMAEM		/* adjust on exit max value */
145 };
146 #endif
147 
148 /*
149  * Values in support of System V compatible messages.
150  */
151 #ifdef SYSVMSG
152 struct	msginfo msginfo = {
153 	MSGMAX,		/* max chars in a message */
154 	MSGMNI,		/* # of message queue identifiers */
155 	MSGMNB,		/* max chars in a queue */
156 	MSGTQL,		/* max messages in system */
157 	MSGSSZ,		/* size of a message segment */
158 			/* (must be small power of 2 greater than 4) */
159 	MSGSEG		/* number of message segments */
160 };
161 #endif
162 
163 /*
164  * These are initialized at bootstrap time
165  * to values dependent on memory size
166  */
167 int	nbuf, nswbuf;
168 
169 /*
170  * These have to be allocated somewhere; allocating
171  * them here forces loader errors if this file is omitted
172  * (if they've been externed everywhere else; hah!).
173  */
174 struct 	timeout *timeouts;
175 struct	buf *buf, *swbuf;
176 char	*buffers;
177 
178 struct	utsname utsname;
179