xref: /openbsd/sys/conf/param.c (revision f43037e0)
1 /*	$OpenBSD: param.c,v 1.26 2007/05/26 20:26:51 pedro 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/socket.h>
43 #include <sys/proc.h>
44 #include <sys/vnode.h>
45 #include <sys/file.h>
46 #include <sys/timeout.h>
47 #include <sys/mbuf.h>
48 #include <ufs/ufs/quota.h>
49 #include <sys/kernel.h>
50 #include <sys/utsname.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 int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
88 int	nmbclust = NMBCLUSTERS;
89 
90 #ifndef MBLOWAT
91 #define MBLOWAT		16
92 #endif
93 int	mblowat = MBLOWAT;
94 
95 #ifndef MCLLOWAT
96 #define MCLLOWAT	8
97 #endif
98 int	mcllowat = MCLLOWAT;
99 
100 
101 int	fscale = FSCALE;	/* kernel uses `FSCALE', user uses `fscale' */
102 
103 int	shmseg = 8;
104 int	shmmaxpgs = SHMMAXPGS;
105 /*
106  * Values in support of System V compatible shared memory.	XXX
107  */
108 #ifdef SYSVSHM
109 #define	SHMMAX	SHMMAXPGS	/* shminit() performs a `*= PAGE_SIZE' */
110 #define	SHMMIN	1
111 #define	SHMMNI	128		/* <64k, see IPCID_TO_IX in ipc.h */
112 #define	SHMSEG	128
113 #define	SHMALL	(SHMMAXPGS)
114 
115 struct	shminfo shminfo = {
116 	SHMMAX,
117 	SHMMIN,
118 	SHMMNI,
119 	SHMSEG,
120 	SHMALL
121 };
122 #endif
123 
124 /*
125  * Values in support of System V compatible semaphores.
126  */
127 #ifdef SYSVSEM
128 struct	seminfo seminfo = {
129 	SEMMNI,		/* # of semaphore identifiers */
130 	SEMMNS,		/* # of semaphores in system */
131 	SEMMNU,		/* # of undo structures in system */
132 	SEMMSL,		/* max # of semaphores per id */
133 	SEMOPM,		/* max # of operations per semop call */
134 	SEMUME,		/* max # of undo entries per process */
135 	SEMUSZ,		/* size in bytes of undo structure */
136 	SEMVMX,		/* semaphore maximum value */
137 	SEMAEM		/* adjust on exit max value */
138 };
139 #endif
140 
141 /*
142  * Values in support of System V compatible messages.
143  */
144 #ifdef SYSVMSG
145 struct	msginfo msginfo = {
146 	MSGMAX,		/* max chars in a message */
147 	MSGMNI,		/* # of message queue identifiers */
148 	MSGMNB,		/* max chars in a queue */
149 	MSGTQL,		/* max messages in system */
150 	MSGSSZ,		/* size of a message segment */
151 			/* (must be small power of 2 greater than 4) */
152 	MSGSEG		/* number of message segments */
153 };
154 #endif
155 
156 /*
157  * This has to be allocated somewhere; allocating
158  * them here forces loader errors if this file is omitted
159  * (if they've been externed everywhere else; hah!).
160  */
161 struct	utsname utsname;
162