1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)param.c 2.2 (2.11BSD GTE) 1997/2/14
7: */
8:
9: #include "../h/param.h"
10: #include "../h/systm.h"
11: #include "../h/buf.h"
12: #include "../h/time.h"
13: #include "../h/resource.h"
14: #include "../h/proc.h"
15: #include "../h/text.h"
16: #include "../h/file.h"
17: #include "../h/dir.h"
18: #include "../h/inode.h"
19: #include "../h/fs.h"
20: #include "../h/mount.h"
21: #include "../h/callout.h"
22: #include "../h/map.h"
23: #include "../h/clist.h"
24: #include "../machine/seg.h"
25:
26: /*
27: * System parameter formulae.
28: *
29: * This file is copied into each directory where we compile
30: * the kernel; it should be modified there to suit local taste
31: * if necessary.
32: *
33: */
34:
35: #define MAXUSERS %MAXUSERS%
36: #define NBUF %NBUF%
37:
38: int hz = %LINEHZ%;
39: u_short mshz = (1000000L + %LINEHZ% - 1) / %LINEHZ%;
40: struct timezone tz = { %TIMEZONE%, %DST% };
41:
42: #define NPROC (10 + 7 * MAXUSERS)
43: int nproc = NPROC;
44: #define NTEXT (26 + MAXUSERS)
45: int ntext = NTEXT;
46: #define NINODE ((NPROC + 16 + MAXUSERS) + 22)
47: int ninode = NINODE;
48: #define NFILE ((8 * NINODE / 10) + 20)
49: int nfile = NFILE;
50: #define NCALL (16 + MAXUSERS)
51: int ncallout = NCALL;
52: int nbuf = NBUF;
53:
54: #define NCLIST (20 + 8 * MAXUSERS)
55: #if NCLIST > (8192 / 32) /* 8K / sizeof(struct cblock) */
56: #undef NCLIST
57: #define NCLIST (8192 / 32)
58: #endif
59: int nclist = NCLIST;
60:
61: /*
62: * These have to be allocated somewhere; allocating
63: * them here forces loader errors if this file is omitted
64: * (if they've been externed everywhere else; hah!).
65: */
66: struct proc *procNPROC;
67: struct text *textNTEXT;
68: struct inode inode[NINODE], *inodeNINODE;
69: struct file *fileNFILE;
70: struct callout callout[NCALL];
71: struct mount mount[NMOUNT];
72: struct buf buf[NBUF], bfreelist[BQUEUES];
73: struct bufhd bufhash[BUFHSZ];
74:
75: /*
76: * Remove the ifdef/endif to run the kernel in unsecure mode even when in
77: * a multiuser state. Normally 'init' raises the security level to 1
78: * upon transitioning to multiuser. Setting the securelevel to -1 prevents
79: * the secure level from being raised by init.
80: */
81: #ifdef PERMANENTLY_INSECURE
82: int securelevel = -1;
83: #endif
84:
85: #ifdef UCB_CLIST
86: u_int clstdesc = ((((btoc(NCLIST*sizeof(struct cblock)))-1) << 8) | RW);
87: int ucb_clist = 1;
88: #else
89: struct cblock cfree[NCLIST];
90: int ucb_clist = 0;
91: #endif
92:
93: #define CMAPSIZ NPROC /* size of core allocation map */
94: #define SMAPSIZ ((9 * NPROC) / 10) /* size of swap allocation map */
95:
96: struct mapent _coremap[CMAPSIZ];
97: struct map coremap[1] = {
98: _coremap,
99: &_coremap[CMAPSIZ],
100: "coremap",
101: };
102:
103: struct mapent _swapmap[SMAPSIZ];
104: struct map swapmap[1] = {
105: _swapmap,
106: &_swapmap[SMAPSIZ],
107: "swapmap",
108: };
109:
110: #ifdef QUOTA
111: #include "../h/quota.h"
112: struct BigQ {
113: struct quota xquota[NQUOTA]; /* the quotas themselves */
114: struct dquot *ixdquot[NINODE]; /* 2.11 equiv of i_dquot */
115: struct dquot xdquot[NDQUOT]; /* the dquots themselves */
116: struct qhash xqhash[NQHASH];
117: struct dqhead xdqhash[NDQHASH];
118: };
119:
120: QUOini()
121: {
122: extern struct qhash *qhash;
123: extern struct dqhead *dqhead;
124:
125: quota = ((struct BigQ *)SEG5)->xquota;
126: dquot = ((struct BigQ *)SEG5)->xdquot;
127: qhash = ((struct BigQ *)SEG5)->xqhash;
128: dqhead = ((struct BigQ *)SEG5)->xdqhash;
129: ndquot = NDQUOT;
130: nquota = NQUOTA;
131: ix_dquot = ((struct BigQ *)SEG5)->ixdquot;
132: dquotNDQUOT = &dquot[ndquot];
133: quotaNQUOTA = "a[nquota];
134: }
135: #endif
136:
137: /*
138: * Declarations of structures loaded last and allowed to reside in the
139: * 0120000-140000 range (where buffers and clists are mapped). These
140: * structures must be extern everywhere else, and the asm output of cc
141: * is edited to move these structures from comm to bss (which is last)
142: * (see the script :comm-to-bss). They are in capital letters so that
143: * the edit script doesn't find some other occurrence.
144: */
145: struct proc PROC[NPROC];
146: struct file FILE[NFILE];
147: struct text TEXT[NTEXT];
Defined functions
Defined variables
FILE
defined in line
146;
never used
PROC
defined in line
145;
never used
TEXT
defined in line
147;
never used
buf
defined in line
72;
never used
cfree
defined in line
89;
never used
hz
defined in line
38;
never used
inode
defined in line
68;
never used
mount
defined in line
71;
never used
mshz
defined in line
39;
never used
nbuf
defined in line
52;
never used
nfile
defined in line
49;
never used
nproc
defined in line
43;
never used
ntext
defined in line
45;
never used
tz
defined in line
40;
never used
Defined struct's
BigQ
defined in line
112; used 10 times
Defined macros
NBUF
defined in line
36; used 3 times
NCALL
defined in line
50; used 2 times
NFILE
defined in line
48; used 2 times
NPROC
defined in line
42; used 5 times
NTEXT
defined in line
44; used 2 times