.TH "kernel variables" "" "" "Technical Information"
.PC "Variables set within \*(CO kernel"
.PP
The following lists most of the variables that you can ``hot patch''
within the kernel.
.PP
For a complete list of tunable variables, see the file
.BR /etc/conf/mtune .
Note, however, that this file does not name the variables themselves;
rather, it uses the variable's enumeration constant initialized; e.g.,
.B mtune
identifies variable
.B ALLSIZE
as
.BR ALLSIZE_SPEC .
.PP
The clock rate is defined as the manifest constant \fBHZ\fR
(hertz), which is set in header file
.BR kernel/const.h .
Normally, this value is set to 100, which translates into 100 ticks
per second, or approximately 10 milliseconds per tick.
.PP
By using command \fB/conf/patch\fR to reset one or more of these variables,
you can change the behavior of the kernel.
Note that it is possible to reset these variables in such a way that
the kernel is unusable, memory is destroyed, or other undesirable
consequences occur.
\fIIf you do not know \fRexactly\fI what you are doing, you are well advised
to leave these variables alone!\fR
.II ALLSIZE
.IP "\fBALLSIZE\fR \(em Size of kernel memory allocation pool"
.DM
	int ALLSIZE;
.DE
.IP
.B ALLSIZE
gives the number of bytes in the kernel's memory allocation pool.
This pool is manipulated by the functions \fBkalloc\fR and \fBkfree\fR.
.B ALLSIZE
is ``auto sized'' unless patched to a non-zero value.
.II ISTSIZE
.IP "\fBISTSIZE\fR \(em Initial stack size"
.DM
	int ISTSIZE = 4096;
.DE
.IP
.B ISTSIZE
specifies the size of the user stack, in bytes.
This affects all processes.
It can be increased if required.
Reducing the size of the user's stack
may cause programs to crash due to stack overflow.
The kernel stack associated with a process will not change.
.II KBBOOT
.IP "\fBKBBOOT\fR \(em Toggle MS-DOS-style booting"
.DM
	int KBBOOT = 1;
.DE
.IP
.B KBBOOT
flags whether your system can be rebooted MS-DOS fashion, i.e., by
typing \fB<ctrl><alt><del>\fR.
When set to a non-zero value, it enables MS-DOS rebooting; this is the
default.
You can use \fBpatch\fR to reset this variable to zero, as follows:
.DM
	/conf/patch /coherent KBBOOT=0
.DE
.IP
Thereafter, typing \fB<ctrl><alt><del>\fR displays the value of
function key 0 rather than rebooting.
Function key 0 defaults to the phrase ``reboot'',
as a reminder that this key normally reboots your system.
However, this never actually prints since the system normally reboots.
You can set the value of function key 0 to anything you want,
either via the command
.B fnkey
or directly in the keyboard tables located in directory
.BR /conf/kbd .
.II NBUF
.IP "\fBNBUF\fR \(em Number of blocks in buffer cache"
.B NBUF
specifies the number of blocks in the buffer cache.
It is auto-sized unless you patch it to a non-zero value.
.II NCLIST
.IP "\fBNCLIST\fR \(em Number of clists"
.DM
	int NCLIST = 64;
.DE
.IP
.B NCLIST
specifies the number of clists in kernel memory.
clists are used by the canonical tty routines to store input/output data.
.II NINODE
.IP "\fBNINODE\fR \(em Number of in-memory i-nodes"
.DM
	int NINODE = 128;
.DE
.IP
.B NINODE
specifies the maximum number of i-nodes that can be open simultaneously.
.II NMSC
.IP "\fBNMSC\fR \(em Number of characters per message"
.DM
	int NMSC = 640;
.DE
.IP
\fBNMSC\fR gives the maximum number of characters per message.
.II NMSG
.IP "\fBNMSG\fR \(em Number of message buffers"
.DM
	int NMSG = 10;
.DE
.IP
\fBNMSG\fR gives the number of message buffers allocated.
.II NMSQB
.IP "\fBNMSQB\fR \(em Maximum characters per message queue"
.DM
	int NMSQB = 2048;
.DE
.IP
\fBNMSQB\fR gives the default maximum number of bytes of messages
on any one message queue.
.II NMSQID
.IP "\fBNMSQID\fR \(em Maximum number of message queues"
.DM
	int NMSQID = 9;
.DE
.IP
\fBNMSQID\fR specifies the maximum number of message queues in the system.
.II NPOLL
.IP "\fBNPOLL\fR \(em Number of simultaneous pending polls"
.DM
	int NPOLL = 0;
.DE
.IP
.B NPOLL
specifies the maximum number of polls that can be pending simultaneously.
If it is zero, dynamic allocation will occur, in groups of 32 pending polls.
You increase variable
.B ALLSIZE
by eight bytes per pending poll.
.II PHYS_MEM
.IP "\fBPHYS_MEM\fR \(em Amount of memory reserved for drivers"
This variable is an
.BR int .
Its value is the number of bytes
needed in the block of physically contiguous memory reserved for
special-purpose device drivers.
.II RLOCKS
.IP "\fBRLOCKS\fR \(em Number of available locks"
This variable is an
.BR int .
By default, it is set to 100.
.II SHMMAX
.IP "\fBSHMMAX\fR \(em Maximum size of a shared-memory segment"
This variable gives the maximum size of a shared-memory segment.
By default, it is set to 0x10000.
.II SHMMNI
.IP "\fBSHMMNI\fR \(em Maximum number of shared-memory segments"
This gives the maximum number of shared-memory segments that can
exist at any one time.
By default, it is set to 100.
.II VIDSLOW
.IP "\fBVIDSLOW\fR \(em Slow (no snow) video updates"
.DM
	int VIDSLOW = 0;
.DE
.IP
Set
.B VIDSLOW
to non-zero to enable video memory updates only during vertical retrace.
This reduces snow on the display with some older video controller cards.
.II condev
.IP "\fBcondev\fR \(em Console device"
.DM
	dev_t condev = makedev(2,0);
.DE
.IP
.B condev
specifies the console device that the kernel's 
.B printf
or
.B putchar
routines write to.
This normally is the memory-mapped video driver, but it can be mapped to
any terminal driver that recognizes data written from the kernel's data segment.
The drivers for the
.B console
and
.B serial
devices are currently supported as the kernel's console devices.
.II cprocp
.IP "\fBcprocp\fR \(em Pointer to current process"
.DM
	PROC *cprocp;
.DE
.IP
.B cprocp
points to the
.B proc
structure that is associated with the user process that is currently executing.
.IP "\fBdrvl\fR \(em Device driver list"
.II drvl
.DM
	#include <sys/con.h>
	#include <kernel/param.h>
	DRV drvl[drvn];
.DE
.IP
.B drvl
is an array that references device drivers.
Field \fBd_conp\fR points to a table of driver access routines, or is NULL.
Field \fBd_time\fR is non-zero if the driver timed routine is to
be invoked once per second.
.IP "\fBdrvn\fR \(em Number of device drivers"
.II drvn
.DM
	int \fBdrvn\fR;
.DE
.IP
.B drvn
gives the maximum number of device drivers available to the kernel.
.IP "\fBlbolt\fR \(em Clock ticks since system startup (lightning bolt)"
.II lbolt
.DM
	time_t lbolt;
.DE
.IP
.B lbolt
is the number of clock ticks since system startup.
A clock tick normally occurs
.B HZ
times per second.
.IP "\fBpipedev\fR \(em File system used for pipes"
.II pipedev
.DM
	dev_t pipedev;
.DE
.IP
.B pipedev
gives the file system to be used for pipes.
It is normally the same as
.B rootdev
(the root device).
.IP "\fBronflag\fR \(em Root file system is read-only"
.II ronflag
.DM
	int ronflag;
.DE
.IP
If
.B ronflag
is set to non-zero, the root file system has read-only access.
.IP "\fBrootdev\fR \(em File system used for root device"
.II rootdev
.DM
	dev_t rootdev;
.DE
.IP
.B rootdev
specifies the root file system's device.
.SH "See Also"
.B
technical information
.R
.SH Notes
You can modify most kernel variables by modifying file
.BR /etc/conf/stune .
If a variable is not named in that file, you can modify it with the debugger
.B db
using the command line:
.DM
	db -a \fIkernel\fP.sym \fIkernel
.DE
.PP
where
.I kernel
and
.I kernel.sym
name, respectively,
the kernel to be patched and its symbol-table file.
Once you have invoked the debugger, type the name of the variable;
.B db
will display its address and current value.
If the value is other than what you want, type the command
.DM
	\fIvarname\fP=\fIvalue
.DE
.PP
which patches variable
.I varname
to
.IR value .
Then type the command
.B :q
to exit from
.BR db .
This approach works, but has the disadvantage that you must repeat it
each time you link a new kernel.
