tprintf - for device drivers
[unix-history] / usr / src / sys / conf / param.c
CommitLineData
b1078c35 1/*
da83315a
KM
2 * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
3 * All rights reserved.
86cbc46c 4 *
da83315a
KM
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
50686e99 17 * @(#)param.c 7.13 (Berkeley) %G%
b1078c35
KM
18 */
19
20#ifndef lint
21char copyright[] =
da83315a 22"@(#) Copyright (c) 1980, 1986, 1989 Regents of the University of California.\n\
b1078c35
KM
23 All rights reserved.\n";
24#endif not lint
ec6f91b0 25
2f44f7b7
KM
26#include "../sys/param.h"
27#include "../sys/systm.h"
28#include "../sys/socket.h"
2f44f7b7
KM
29#include "../sys/user.h"
30#include "../sys/proc.h"
31#include "../sys/text.h"
da83315a 32#include "../sys/vnode.h"
2f44f7b7
KM
33#include "../sys/file.h"
34#include "../sys/callout.h"
35#include "../sys/clist.h"
36#include "../sys/cmap.h"
37#include "../sys/mbuf.h"
38#include "../ufs/quota.h"
39#include "../sys/kernel.h"
7d08bbf1
KM
40#ifdef SYSVSHM
41#include "machine/vmparam.h"
42#include "../sys/shm.h"
43#endif
44
ec6f91b0
BJ
45/*
46 * System parameter formulae.
47 *
48 * This file is copied into each directory where we compile
49 * the kernel; it should be modified there to suit local taste
50 * if necessary.
51 *
52 * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
53 */
54
46a9a1d7 55#ifndef HZ
bf75e5ce 56#define HZ 100
46a9a1d7 57#endif
ec6f91b0 58int hz = HZ;
bf75e5ce 59int tick = 1000000 / HZ;
6f33ca1e 60int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */
bf75e5ce 61struct timezone tz = { TIMEZONE, DST };
ec6f91b0
BJ
62#define NPROC (20 + 8 * MAXUSERS)
63int nproc = NPROC;
7d08bbf1
KM
64#define NTEXT (36 + MAXUSERS)
65int ntext = NTEXT;
66#define NVNODE (NPROC + NTEXT + 300)
50686e99 67long desiredvnodes = NVNODE;
b025a45a 68int nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 32;
2067e85f 69int ncallout = 16 + NPROC;
e31e5017 70int nclist = 60 + 12 * MAXUSERS;
5b3fa994 71int nmbclusters = NMBCLUSTERS;
80b6b780 72int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
ec6f91b0 73
7d08bbf1
KM
74/*
75 * Values in support of System V compatible shared memory.
76 */
77#ifdef SYSVSHM
78#define SHMMAX (SHMMAXPGS*NBPG)
79#define SHMMIN 1
80#define SHMMNI 32 /* <= SHMMMNI in shm.h */
81#define SHMSEG 8
82#define SHMALL (SHMMAXPGS/CLSIZE)
83
84struct shminfo shminfo = {
85 SHMMAX,
86 SHMMIN,
87 SHMMNI,
88 SHMSEG,
89 SHMALL
90};
91#endif
92
ec6f91b0
BJ
93/*
94 * These are initialized at bootstrap time
95 * to values dependent on memory size
96 */
97int nbuf, nswbuf;
98
99/*
100 * These have to be allocated somewhere; allocating
6f33ca1e
MK
101 * them here forces loader errors if this file is omitted
102 * (if they've been externed everywhere else; hah!).
ec6f91b0
BJ
103 */
104struct proc *proc, *procNPROC;
105struct text *text, *textNTEXT;
ec6f91b0
BJ
106struct file *file, *fileNFILE;
107struct callout *callout;
108struct cblock *cfree;
ec6f91b0 109struct buf *buf, *swbuf;
ec6f91b0
BJ
110char *buffers;
111struct cmap *cmap, *ecmap;
76a26bea
MK
112
113/*
114 * Proc/pgrp hashing.
115 * Here so that hash table sizes can depend on MAXUSERS/NPROC.
116 * Hash size must be a power of two.
117 * NOW omission of this file will cause loader errors!
118 */
119
120#if NPROC > 1024
121#define PIDHSZ 512
122#else
123#if NPROC > 512
124#define PIDHSZ 256
125#else
126#if NPROC > 256
127#define PIDHSZ 128
128#else
129#define PIDHSZ 64
130#endif
131#endif
132#endif
133
134struct proc *pidhash[PIDHSZ];
135struct pgrp *pgrphash[PIDHSZ];
136int pidhashmask = PIDHSZ - 1;