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