This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / conf / param.c
CommitLineData
15637ed4
RG
1/*
2 * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
be581a37 33 * from: @(#)param.c 7.20 (Berkeley) 6/27/91
8b1f8702 34 * $Id: param.c,v 1.8 1994/01/31 04:18:08 davidg Exp $
15637ed4
RG
35 */
36
37#include "sys/param.h"
38#include "sys/systm.h"
39#include "sys/socket.h"
40#include "sys/proc.h"
41#include "sys/vnode.h"
42#include "sys/file.h"
43#include "sys/callout.h"
44#include "sys/clist.h"
45#include "sys/mbuf.h"
46#include "ufs/quota.h"
47#include "sys/kernel.h"
48#ifdef SYSVSHM
49#include "machine/vmparam.h"
50#include "sys/shm.h"
51#endif
24fd64ab
DG
52#ifdef SYSVSEM
53#include "sys/sem.h"
54#endif
55#ifdef SYSVMSG
56#include "sys/msg.h"
57#endif
15637ed4
RG
58
59/*
60 * System parameter formulae.
61 *
62 * This file is copied into each directory where we compile
63 * the kernel; it should be modified there to suit local taste
64 * if necessary.
65 *
d7f27d01 66 * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx -DMAXFDESCS=xx
15637ed4
RG
67 */
68
69#ifndef HZ
70#define HZ 100
71#endif
72int hz = HZ;
73int tick = 1000000 / HZ;
e957266e 74#ifndef TICKADJ
15637ed4 75int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */
e957266e 76#else
8b1f8702 77int tickadj = TICKADJ; /* NTP users may prefer a smaller value */
e957266e 78#endif
15637ed4
RG
79struct timezone tz = { TIMEZONE, DST };
80#define NPROC (20 + 16 * MAXUSERS)
81int maxproc = NPROC;
a200ca2b
DG
82#define NTEXT NPROC /* actually the object cache */
83int vm_cache_max = NTEXT / 2 + 16;
84#define NVNODE (NPROC + NTEXT + 100 + 16)
15637ed4 85long desiredvnodes = NVNODE;
d7f27d01 86int maxfdescs = MAXFDESCS;
15637ed4
RG
87int maxfiles = 3 * (NPROC + MAXUSERS) + 80;
88int ncallout = 16 + NPROC;
89int nclist = 60 + 12 * MAXUSERS;
90int nmbclusters = NMBCLUSTERS;
91int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
92
93/*
94 * Values in support of System V compatible shared memory. XXX
95 */
96#ifdef SYSVSHM
97#define SHMMAX (SHMMAXPGS*NBPG)
98#define SHMMIN 1
99#define SHMMNI 32 /* <= SHMMMNI in shm.h */
100#define SHMSEG 8
101#define SHMALL (SHMMAXPGS/CLSIZE)
102
103struct shminfo shminfo = {
104 SHMMAX,
105 SHMMIN,
106 SHMMNI,
107 SHMSEG,
108 SHMALL
109};
110#endif
111
24fd64ab
DG
112/*
113 * Values in support of System V compatible semaphores.
114 */
115
116#ifdef SYSVSEM
117
118struct seminfo seminfo = {
119 SEMMAP, /* # of entries in semaphore map */
120 SEMMNI, /* # of semaphore identifiers */
121 SEMMNS, /* # of semaphores in system */
122 SEMMNU, /* # of undo structures in system */
123 SEMMSL, /* max # of semaphores per id */
124 SEMOPM, /* max # of operations per semop call */
125 SEMUME, /* max # of undo entries per process */
126 SEMUSZ, /* size in bytes of undo structure */
127 SEMVMX, /* semaphore maximum value */
128 SEMAEM /* adjust on exit max value */
129};
130#endif
131
132/*
133 * Values in support of System V compatible messages.
134 */
135
136#ifdef SYSVMSG
137
138struct msginfo msginfo = {
139 MSGMAX, /* max chars in a message */
140 MSGMNI, /* # of message queue identifiers */
141 MSGMNB, /* max chars in a queue */
142 MSGTQL, /* max messages in system */
143 MSGSSZ, /* size of a message segment */
144 /* (must be small power of 2 greater than 4) */
145 MSGSEG /* number of message segments */
146};
147#endif
148
15637ed4
RG
149/*
150 * These are initialized at bootstrap time
151 * to values dependent on memory size
152 */
153int nbuf, nswbuf;
154
155/*
156 * These have to be allocated somewhere; allocating
157 * them here forces loader errors if this file is omitted
158 * (if they've been externed everywhere else; hah!).
159 */
160struct callout *callout;
161struct cblock *cfree;
162struct buf *buf, *swbuf;
163char *buffers;
164
165/*
166 * Proc/pgrp hashing.
167 * Here so that hash table sizes can depend on MAXUSERS/NPROC.
168 * Hash size must be a power of two.
169 * NOW omission of this file will cause loader errors!
170 */
171
172#if NPROC > 1024
173#define PIDHSZ 512
174#else
175#if NPROC > 512
176#define PIDHSZ 256
177#else
178#if NPROC > 256
179#define PIDHSZ 128
180#else
181#define PIDHSZ 64
182#endif
183#endif
184#endif
185
186struct proc *pidhash[PIDHSZ];
187struct pgrp *pgrphash[PIDHSZ];
188int pidhashmask = PIDHSZ - 1;
e957266e
GW
189
190/* From kernel.h: */
191long hostid;
192char hostname[MAXHOSTNAMELEN];
193int hostnamelen;
194char domainname[MAXHOSTNAMELEN];
195int domainnamelen;
196
197struct timeval boottime;
198struct timeval time;
199
200int phz;
201int lbolt;
202
203fixpt_t avenrunnable[3];
204#if defined(COMPAT_43) && (defined(vax) || defined(tahoe))
205double avenrun[3];
206#endif /* COMPAT_43 */
207
208#ifdef GPROF
209u_long s_textsize;
210int profiling;
211u_short *kcount;
212char *s_lowpc;
213#endif