1 /**	$MirOS: src/sys/conf/param.c,v 1.4 2008/10/20 19:09:52 tg Exp $ */
2 /*	$OpenBSD: param.c,v 1.23 2004/01/01 20:17:34 millert Exp $	*/
3 /*	$NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $	*/
4 
5 /*
6  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
7  * All rights reserved.
8  * (c) UNIX System Laboratories, Inc.
9  * All or some portions of this file are derived from material licensed
10  * to the University of California by American Telephone and Telegraph
11  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
12  * the permission of UNIX System Laboratories, Inc.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  * 3. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  *	@(#)param.c	7.20 (Berkeley) 6/27/91
39  */
40 
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/socket.h>
44 #include <sys/proc.h>
45 #include <sys/vnode.h>
46 #include <sys/file.h>
47 #include <sys/timeout.h>
48 #include <sys/mbuf.h>
49 #include <ufs/ufs/quota.h>
50 #include <sys/kernel.h>
51 #ifdef SYSVSHM
52 #include <machine/vmparam.h>
53 #include <sys/shm.h>
54 #endif
55 #ifdef SYSVSEM
56 #include <sys/sem.h>
57 #endif
58 #ifdef SYSVMSG
59 #include <sys/msg.h>
60 #endif
61 
62 /*
63  * System parameter formulae.
64  *
65  * This file is copied into each directory where we compile
66  * the kernel; it should be modified there to suit local taste
67  * if necessary.
68  *
69  * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
70  */
71 
72 #ifndef TIMEZONE
73 # define TIMEZONE 0
74 #endif
75 #ifndef DST
76 # define DST 0
77 #endif
78 #ifndef HZ
79 #define	HZ 100
80 #endif
81 int	hz = HZ;
82 int	tick = 1000000 / HZ;
83 int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
84 struct	timezone tz = { TIMEZONE, DST };
85 #define	NPROC (20 + 16 * MAXUSERS)
86 int	maxproc = NPROC;
87 #define	NTEXT (80 + NPROC / 8)	/* actually the object cache */
88 #ifndef NVNODE
89 #define	NVNODE (NPROC * 2 + NTEXT + 100)
90 #endif
91 int	desiredvnodes = NVNODE;
92 int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
93 int	nmbclust = NMBCLUSTERS;
94 
95 #ifndef MBLOWAT
96 #define MBLOWAT		16
97 #endif
98 int	mblowat = MBLOWAT;
99 
100 #ifndef MCLLOWAT
101 #define MCLLOWAT	8
102 #endif
103 int	mcllowat = MCLLOWAT;
104 
105 
106 int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
107 
108 int	shmseg = 8;
109 int	shmmaxpgs = SHMMAXPGS;
110 /*
111  * Values in support of System V compatible shared memory.	XXX
112  */
113 #ifdef SYSVSHM
114 #define	SHMMAX	SHMMAXPGS	/* shminit() performs a `*= PAGE_SIZE' */
115 #define	SHMMIN	1
116 #define	SHMMNI	128		/* <64k, see IPCID_TO_IX in ipc.h */
117 #define	SHMSEG	128
118 #define	SHMALL	(SHMMAXPGS)
119 
120 struct	shminfo shminfo = {
121 	SHMMAX,
122 	SHMMIN,
123 	SHMMNI,
124 	SHMSEG,
125 	SHMALL
126 };
127 #endif
128 
129 /*
130  * Values in support of System V compatible semaphores.
131  */
132 #ifdef SYSVSEM
133 struct	seminfo seminfo = {
134 	SEMMNI,		/* # of semaphore identifiers */
135 	SEMMNS,		/* # of semaphores in system */
136 	SEMMNU,		/* # of undo structures in system */
137 	SEMMSL,		/* max # of semaphores per id */
138 	SEMOPM,		/* max # of operations per semop call */
139 	SEMUME,		/* max # of undo entries per process */
140 	SEMUSZ,		/* size in bytes of undo structure */
141 	SEMVMX,		/* semaphore maximum value */
142 	SEMAEM		/* adjust on exit max value */
143 };
144 #endif
145 
146 /*
147  * Values in support of System V compatible messages.
148  */
149 #ifdef SYSVMSG
150 struct	msginfo msginfo = {
151 	MSGMAX,		/* max chars in a message */
152 	MSGMNI,		/* # of message queue identifiers */
153 	MSGMNB,		/* max chars in a queue */
154 	MSGTQL,		/* max messages in system */
155 	MSGSSZ,		/* size of a message segment */
156 			/* (must be small power of 2 greater than 4) */
157 	MSGSEG		/* number of message segments */
158 };
159 #endif
160 
161 /*
162  * These have to be allocated somewhere; allocating
163  * them here forces loader errors if this file is omitted
164  * (if they've been externed everywhere else; hah!).
165  */
166 struct	buf *buf;
167 char	*buffers;
168 
169 int	rootdev_override = 0;
170