*
* kernel -- kernel tunable parameters and data structures
*
*	Because of the included header files, this file should be
*	first in the %INCLUDE section of the system file.
*

%PARAM

**********************************************************************
* The following entries form the tunable parameter table.
*
* (See the System Administrator's Guide, Part 2, Section 6 for details.)

* Kernel parameters
NBUF		1000		# number of buffers in disk cache
NCALL		60		# size of callout table (for in-kernel timers)
NINODE		175		# size of generic i-node table
NS5INODE	(NINODE+1)	# size of Sys 5 i-node table
NFILE		175		# system max number of simultaneously open files
NMOUNT		12		# size of disk mount table
NPROC		150		# size of process table
NREGION		(NPROC*7/2+8)	# size of region table
NCLIST		10		# size of clist table for tty I/O
MAXUP		25		# max number of processes per user
SFNOLIM		64		# soft limit, open files per process
HFNOLIM		64		# hard limit, open files per process
NHBUF		512		# disk cache hash table (must be a power of 2)
NHINO		256		# inode cache hash table (must be a power of 2)
NPBUF		4		# number of buf_t for physical I/O
NAUTOUP		30		# bdflush updates buffers NAUTOUP seconds old
BDFLUSHR	3		# run bdflush every BDFLUSHR seconds
BDIRTYPCT	10		# percentage of dirty buffers which triggers
				# flushing
BASYNCHI	64		# number flushed per invocation
BASYNCLO	(BASYNCHI/3)
S54KBDIRTYPCT	10		# percentage of dirty buffers which triggers
				# flushing
S54KBASYNCHI	64		# number flushed per invocation
S54KBASYNCLO	(S54KBASYNCHI/3)
SHLBMAX		2		# max number of shared libraries per process
FLCKREC		20		# max number of simultaneous Sys5 locks
NFLOCKS		30		# size of the old-style file lock table
QUANTUMSIZE	50		# number of ticks per process time slice
MAXHARDSLICE	(50*HZ)		# default max number of ticks allowed per proc
MAXHARDPRI	127		# (NUM_PRIORITIES - 1)
MAXHARDUSRPRI	127		# (NUM_PRIORITIES - 1)
MAXHARDCPU	255
MAXPRIADJ	(NZERO)
NGROUPS_MAX	16		# number of supplementary group IDs per process
				# (presently 16 is the maximum)

* Paging Parameters
VHNDFRAC	65		# VHANDL = max(maxpages/VHNDFRAC,GPGSHI)
VHANDL		GPGSHI		# start vhand if freepages <= VHANDL
VHANDR		1		# vhand runs every VHANDR seconds if memory low
GPGSLO		40		# vhand starts stealing pages at GPGSLO
GPGSHI		160		# vhand will steal until it has GPGSHI pages
GPGSMSK		0x00001100	# vhand pde aging mask (not supported in S3000)
MAXSC		64		# maximum pages to swap at one time
MAXFC		64		# maximum pages to free at one time
MAXUMEM		(512*1024)	# maximum number of pages per process
MINARMEM	25		# number of real pages to avoid deadlock
MINASMEM	25		# number of swap pages to avoid deadlock

* Misc. Parameters
SPTMAP		128		# size of the system page table memory map
* CDLIMIT_CONF specifies the default maximum user file size in 512 byte blocks.
* See ulimit(2).  A value of 4096 sets the maximum file size to 2Mbytes.
CDLIMIT_CONF	4096		# maximum user file size (in 512 byte blocks)
NUM_SWAPBUF	16		# number of buf_t for swapping I/O
ILOGSIZE	40		# (debug only) # of inode logging structures
NODE		"syst"		# system's node name on networks
ISYN_FLAG	1		# fast vs. reliable flag

%CONFIG					# code added to conf.c

#include	"sys/param.h"
#include	"sys/types.h"
#include	"sys/sysmacros.h"
#include	"sys/signal.h"
#include	"sys/fs/s5dir.h"
#include	"sys/user.h"
#include	"sys/stream.h"
#include	"sys/conf.h"
#include	"sys/errno.h"
#include	"sys/acct.h"
#include	"sys/tty.h"
#include	"sys/termio.h"
#include	"sys/buf.h"
#include	"sys/file.h"
#include	"sys/inode.h"
#include	"sys/region.h"
#include	"sys/proc.h"
#include	"sys/map.h"
#include	"sys/callo.h"
#include	"sys/mount.h"
#include	"sys/elog.h"
#include	"sys/err.h"
#include	"sys/iobuf.h"
#include	"sys/utsname.h"
#include	"sys/opt.h"
#include	"sys/var.h"
#include	"sys/fcntl.h"
#include	"sys/fstyp.h"
#include	"sys/flock.h"
#include	"sys/message.h"
#include	"sys/tuneable.h"
#include	"sys/fs/s5inode.h"
#include	"sys/nami.h"
#include	"sys/sysinfo.h"
#include	"sys/open.h"
#include	"sys/resource.h"


struct	buf	bfreelist;		/* head of the free list of buffers */
struct	buf	bdirtylist;		/* head of the list of dirty buffers */
struct	pfree	pfreelist;		/* Head of physio header pool */
struct	buf	pbuf[NPBUF];		/* Physical io header pool */
struct  buf 	bufhdrs[NBUF];		/* buffer headers */
struct	hbuf	hbuf[NHBUF];		/* buffer hash table */
char		*buffers;		/* buffer data */

struct	file	file[NFILE];		/* file table */

struct	inode	inode[NINODE];		/* inode table */
struct	s5inode	s5inode[NS5INODE];	/* s5inode table */
struct hinode	hinode[NHINO];		/* The inode hash table	*/
int		hinodemask = NHINO - 1;	/* its mask for hashing	*/
uint		isyn_flag = ISYN_FLAG;
uint		isyn;
struct	locklist locklist[NFLOCKS];	/* lock table */
struct flckinfo	flckinfo = {		/* lockf accounting */
	FLCKREC, 0, 0, 0 
};
struct filock	flox[FLCKREC];		/* lockf table */

int	fips = 1; 			/* fips compatability flag */

#ifdef INODE_DEBUG
/* inode logging */
struct ilog {
	struct inode	*il_addr;
	struct inode	*il_forw;
	struct inode	*il_back;
	struct inode	*il_avforw;
	struct inode	*il_avback;
	int		*il_fsptr;
	long		il_number;
	struct rcvd	*il_rcvd;
	short		il_fstyp;
	dev_t		il_dev;
	cnt_t		il_count;
	short		il_op;
	int		*il_caller;
};

struct ilog	ilogs[ILOGSIZE];
int		ilogsize = sizeof(ilogs) / sizeof(*ilogs);
#endif /* INODE_DEBUG */

struct	proc	proc[NPROC];		/* process table */
struct  region	region[NREGION];	/* region descriptor table */
struct	auth  	ua[NPROC];		/* usr authorization stuff */


struct	callo	callout[NCALL], *callfree, calltodo;
struct	map	sptmap[SPTMAP];

struct	mount	mount[NMOUNT];

struct shlbinfo shlbinfo = {
		SHLBMAX,
		0,
		0
};

/* printf internal buffer not used (naw 10/20)
char	putbuf[PUTBUFSZ];
int	putbufsz;
 */

struct sysinfo	sysinfo;
struct syserr	syserr;

tune_t	tune = {
		GPGSLO,
		GPGSHI,
		GPGSMSK,
		VHANDR,
		VHANDL,
		MAXSC,
		MAXFC,
		MAXUMEM,
		BDFLUSHR,
		BDFLUSHR,
		MINARMEM,
		MINASMEM,
		BDIRTYPCT,
		BASYNCHI,
		BASYNCLO,
 		S54KBDIRTYPCT,
 		S54KBASYNCHI,
 		S54KBASYNCLO
};

int	quantum_size	 = QUANTUMSIZE;
int	max_quantum_size = MAXHARDSLICE;
int	max_slice_clamp	 = MAXHARDSLICE;
int	max_pri_clamp	 = MAXHARDPRI;
int	max_usrpri_clamp = MAXHARDUSRPRI;
int	max_cpu_clamp	 = MAXHARDCPU;
int	max_pri_adj	 = MAXPRIADJ;

struct	cblock	cfree[NCLIST];

#ifdef TRACE_0
#	include	"sys/trace.h"
	struct	trace	trace[TRACE_0 * TRACE_0_PHYS];
#endif

struct	var	v = {
	NBUF,
	NCALL,
	NINODE,
	(char *)(&inode[NINODE]),
	NFILE,
	(char *)(&file[NFILE]),
	NMOUNT,
	(char *)(&mount[NMOUNT]),
	NPROC,
	(char *)(&proc[1]),
	NREGION,
	NCLIST,
	MAXUP,
	NHBUF,
	NHBUF-1,
	NPBUF,
	SPTMAP,
	VHNDFRAC,
	0,
	NAUTOUP,
	NAUTOUP * HZ,
	SFNOLIM,

	NQUEUE,
	NSTREAM,
	NBLK4096,
	NBLK2048,
	NBLK1024,
	NBLK512,
	NBLK256,
	NBLK128,
	NBLK64,
	NBLK16,
	NBLK4,
	CDLIMIT_CONF,
	NS5INODE,
	NFLOCKS,
	NGROUPS_MAX
};


short   ipid[NINODE];

#if !defined(NUM_SWAPBUF) || NUM_SWAPBUF <= 0
#define NUM_SWAPBUF	4
#endif
/* buf structures for use by the swap function */
buf_t	swap_bufs[NUM_SWAPBUF];
buf_t	swapfreelist;
int	numswap_bufs = sizeof(swap_bufs) / sizeof(*swap_bufs);

dev_t	rootdev, pipedev, swapdev;		/* set at kernel boot */

extern	nodev(), nulldev();

#ifdef VT_VT100
extern  vt100input(), vt100output(), vt100ioctl();
#endif
#ifdef VT_HP45
extern  hp45input(), hp45output(), hp45ioctl();
#endif
struct termsw termsw[] = {
	nulldev, nulldev, nulldev, /* tty */
#ifdef VT_VT100
	vt100input, vt100output, vt100ioctl, /* VT100 */
#else
	nulldev, nulldev, nulldev,
#endif
#ifdef VT_HP45
	hp45input, hp45output, hp45ioctl, /* HP45 */
#else
	nulldev, nulldev, nulldev,
#endif
};
int	termcnt = sizeof(termsw) / sizeof(struct termsw);

/* misc. */
int	hz = HZ;

extern int	cinit(), binit(), iinit(), inoinit();
extern int	fsinit();
extern int	finit(), flckinit();
extern int 	strinit();
extern int	errinit();
extern int	msginit();
extern int	seminit();
extern int	shminit();
extern int	errinit();
extern int	initswapbufs();
extern int	coninit();
extern int	spm2kerninit();
extern int	disable_interrupts_init();

/*	Array containing the addresses of the various initializing	*/
/*	routines executed by "main" at boot time.			*/

int (*init_tbl[])() = {
	cinit,
	inoinit,
	fsinit,
	finit,
	binit,
	iinit,
	flckinit,
	strinit,
	msginit,
	seminit,
	shminit,
	errinit,
	initswapbufs,
	coninit,
	spm2kerninit,
	disable_interrupts_init,
	(int (*)())0
};

struct utsname utsname = {
	"ARIX_OS",			/* system name			*/
	NODE,				/* node name on networks	*/
	"2:3.3-06",			/* release (CPU:product-kernel)	*/
	VERSION,			/* version: supplied by make	*/
	"System90",			/* machine (hardware ID)	*/
};

#ifndef NSRMOUNT
struct srmnt	srmount[1];
#endif

rlimit_t	default_rlimits[] = {
	/* 0 */	0, 0,		
	/* 1 */	0, 0,
	/* 2 */	0, 0,
	/* 3 */	0, 0,
	/* 4 */	0, 0,
	/* 5 */	SFNOLIM, HFNOLIM,
	/* 6 */	0, 0 
};

