This file contains a few comments about "top", version 2.0

"top" is a program that will give continual reports about the state of the
system, including a list of the top cpu using processes.  It requires read
access to the memory files "/dev/kmem" and "/dev/mem" as well as the system
image "/vmunix".  Some installations have these files protected from general
access.  These sites would have to install this program in the same way that
programs such as "ps" are installed.

CAVEAT:  version 2.0 of top has internal commands that kill and renice
processes.  DO NOT INSTALL TOP AS A SETUID PROGRAM, or you will open up a
big security hole since top makes no process ownership checks on its own.
Note that it is still safe to install top as a set group-id program, since
group-id has no bearing on who can renice or send signals to what processes.

There are a few things that need to be checked before compiling the program:

The most important item is the internal hash table size.  This size is
defined in the program with the preprocessor variable "Table_size".  This
constant MUST be larger than the number of lines in the file /etc/passwd.
It is advisable that this number be about twice the number of lines, and
that it be a prime number (since it dictates the size of the hash table).
Make sure this is checked before compilation.  Its definition exists in
the file "top.local.h", but it is also settable in the Makefile.

Several other things are set in "top.local.h", including the file names
used for certain system files ("/vmunix", "/dev/kmem", etc.).  Although I
don't expect those to vary much, they are put there for convenience.
Another parameter in this file is "Nominal_TOPN".  This will be discussed
in the next paragraph.

There are two preprocessor variables that are defined at compile time by
the makefile.  These are "Default_TOPN" and "Default_DELAY".  Their values
are the defaults used for the top number of processes to be displayed and
the number of seconds to delay between displays, respectively.  They are
set by the Makefile variables "TOPN" and "DELAY", respectively.  These
constants are preset as follows:  TOPN=10, DELAY=5.  These can be
overridden by either changing the Makefile or by specifying the change on
the make command line (with something like "make TOPN=15").  Version 2 of
top understands an "infinite" value for the number of processes to
display.  Such a value indicates that top should display as much as will
fill the screen.  To specify a Default_TOPN of infinity, set TOPN equal
to -1.  Version 2 also understands the difference between an intelligent
terminal and a dumb terminal (such as a hardcopy device or a file).
Typically, a default of infinity would not be desirable on a dumb
terminal, so the value of "Nominal_TOPN" is used when (1) Default_TOPN is
infinity and (2) the output device is a dumb terminal or a file.  The
value for this preprocessor variable is set in "top.local.h" and can also
be set from the "make" command line.  In the distribution, it is set to 18.

By default, the makefile will make a "top" for one of the following
systems:  Berkeley 4.2, Sun Unix (version 1.1 and higher), and Pyramid
Unix.  Previous versions of top fully supported Berkeley 4.1 Unix.  This
support has waned in version 2, and is not guaranteed to even work.  If
you really must give it a try, you can change the makefile variable
"CFLAGS" to make a 4.1 "top".  Instructions for doing this can be found in
"Makefile".

The file "bzero.c" contains a function that will zero a block of memory on
a VAX.  This is only needed for Berkeley 4.1, since 4.2 has a bzero
defined in the C run time library.  If you are strange enough to be
running 4.1 on something besides a VAX, you will have to replace this
routine with one that will work on your machine.  If you don't know a
quick way to do it, then writing a simple loop will suffice.  "Bzero"
takes two arguments:  a pointer to the buffer to zero, and the number of
bytes to zero.

There are also several parameters in the makefile that control
installation.  These should be altered to suit the desires and needs of
individual sites.

Version 2.0 still only supports standard 4.2 and Sun and Pyramid
architectures.  I attempted to add sufficient changes to make top work on
a Masscomp, but found the number of required changes to be overwhelming.
Feel free to alter top to make it run on whatever funny architecture you
have.  I also encourage you to send those changes back to me at the
address below.  But, if the number of changes is high, I will be reluctant
to include the changes in the next version of top.  As an example, there
were only 10 modifications required for the Sun version (and all changes
were trivial), and just 4 changes were needed for the Pyramid.

If you make any kind of change to "top" that you feel would be beneficial
to others who use this program, or if you find and fix a bug, please send
me the change.

Enjoy!

                                William LeFebvre
				Department of Computer Science
				Rice University
                                ARPANet address: <phil@Rice.edu>

				U.S. Mail address:
				    William LeFebvre
				    P.O. Box 1892
				    Department of Computer Science
				    Houston, TX  77251
