ftp.nice.ch/pub/next/unix/admin/top.0.5.NI.b.tar.gz#/top-v0.5

Changes
 
Configure
 
DISCLAIMER
 
FAQ
 
INSTALL
 
Make.desc
 
Make.desc.X
 
Makefile
 
Makefile.X
 
NoteBook.rtf
[View NoteBook.rtf] 
Porting
 
README
 
SYNOPSIS
 
boolean.h
[View boolean.h] 
commands.c
[View commands.c] 
display.c
[View display.c] 
display.h
[View display.h] 
getans
 
getopt.c
[View getopt.c] 
install
 
layout.h
[View layout.h] 
loadavg.h
[View loadavg.h] 
m-template
 
machine/
 
machine.c → machine/m_next32.c
[Download]
machine.h
[View machine.h] 
metatop
 
os.h
[View os.h] 
patchlevel.h
[View patchlevel.h] 
prime
 
prime.c
[View prime.c] 
profile
 
screen.c
[View screen.c] 
screen.h
[View screen.h] 
sigconv.awk
 
sigdesc.h
[View sigdesc.h] 
top
 
top.1
 
top.X
 
top.c
[View top.c] 
top.h
[View top.h] 
top.local.H
 
top.local.h
[View top.local.h] 
username.c
[View username.c] 
utils.c
[View utils.c] 
utils.h
[View utils.h] 
version.c
[View version.c] 

README

                             TOP v3.3
                   Version 0.5 for NEXTSTEP

Unix utility to monitor process usage and system statistics in a terminal window.

Warning:  For general use, top must have suid status for the file's owner, root, which could be a security problem for some sites.

KNOWN PROBLEMS AND FIXES:

NEXTSTEP - v0.5  11/26/96 tpugh
1) Fixed missing command name for every process when running top on OPENSTEP 4.1 Black hardware.  Problem occurred due to a kernal task data structure change.

NEXTSTEP - v0.4   2/29/96 tpugh
1) Second attempt to eliminated the text artifact in the command column.
2) When quiting the program, a message "nobody" was printed and the cursor was not placed at the bottom of the screen.  The hash_table was corrupting memory when hashit(uid=-2) = -2 or any negative number.
3) Fixed incorrect load average display.  Incorrect scaling of the kernel load average fixed-point values.


NEXTSTEP - v0.3  2/15/96 tpugh
This release fixes the problems in release v0.2.
1)  Command name not showing in the display.  This problem occurs for hppa and sparc machines, and NS4.0 alpha machines.  NeXT changed the task structure, so top could not find utask structure which contains the command name.  <mach/task.h> is not shipped with any NEXTSTEP systems.
2) Removed all C++ style comments from machine.c to be ANSI C compatible.
3) Removed the %WCPU field, no support for it.
4) Reduced line length to less than 80 columns.  Some commands are long and will extend beyond 80 colums.
5) Fixed "top -U" fails with bus error.  In special cases where only a specific user is displayed, the process index variable was being improperly advanced, resulting in zero process address values and bus errors.
6) Eliminated the text artifact in the command column.


NEXTSTEP - v0.2  9/1/95 tpugh 
This release fixes two problems.
1) new processes were not showing up in the display.
2) compiling problems.  The compiler flags are now correctly inserted into the makefile without user action.  Continue to use the Configure script to setup and install the software.  When it asks for compiler flags, use the defaults listed.


NEXTSTEP - v0.1  8/2/95 tpugh
This is the first release for NEXTSTEP, so beware.  It's working nicely on my NeXTstation Turbo Color running NEXTSTEP v3.2.

Please let me know of any problem so we can fix them.  Let me know if it works.

	Tim Pugh
	Oregon State University
	tpugh@oce.orst.edu


COMPATIBILITY - next32
This is the machine-dependent module for NEXTSTEP v3.x
Reported to work for NEXTSTEP v3.0, v3.2, and v3.3 Mach OS:
	NEXTSTEP v3.0 on Motorola machines.
	NEXTSTEP v3.2 on Intel and Motorola machines.
	NEXTSTEP v3.3 on Intel and Motorola machines.
Problem with command column for (Choose next40 for fix):
	NEXTSTEP v3.2 on HP machines.
	NEXTSTEP v3.3 on HP and Sparc machines.
Has not been tested for NEXTSTEP v2.x machines, although it should work.
Has not been tested for NEXTSTEP v3.1 machines, although it should work.

COMPATIBILITY - next33
This is the machine-dependent module for NEXTSTEP v3.x
Reported to work for:
	NEXTSTEP v3.2 on HP machines.
	NEXTSTEP v3.3 on HP and Sparc machines.


COMPATIBILITY  -  next40
This is the machine-dependent module for NEXTSTEP v4.x
Reported to work for NEXTSTEP v4.x Mach OS:
	NEXTSTEP v4.0 on NeXTstation machines.
	NEXTSTEP v4.1 on NeXTstation machines.
Has not been tested for NEXTSTEP v4.x Intel or SPARC machines.


FREQUENTLY ASKED QUESTIONS
 #1:   top 3.3 (after configuring for next32 with all defaults) on my i386 running NEXTSTEP 3.3, I get:  Error calling task_by_unix_pid(): failure(5)

The call is failing because you do not have permission.  You must be the superuser, root, or the program must have root privledges to work properly.  It's been reported that setting the group sticky bit for kmem does not work, and the fix is to set the user sticky bit for root.  So install "top" with the permissions 4755.

As root, do the following:
tsunami# chown root.kmem top
tsunami# chmod 4755 top
tsunami# ls -lg top
-rwsr-xr-x  1 root     kmem      121408 Sep  1 10:14 top*

With the kmem group sticky bit set, we can read kernal memory without problems, but to communicate with the Mach kernal for task and thread info, it requires root privileges.


#2:  How to compile top to create a multiple binary file or FAT?

Add the -arch <machine> flags to line 64 of the Makefile.  i.e.
CFLAGS = -DSHOW_UTT -arch m68k -arch i386 -arch hppa -arch sparc $(CDEFS)

Add $(CFLAGS) to line 79 of the Makefile. i.e.
	$(CC) $(CFLAGS) -o top $(OBJS) -ltermcap -lm $(LIBS)


#3:  I installed 'top' chmod 4711, chown root.kmem, but cannot use the '-q' 
flag unless I am logged in as 'root'

"top: warning: `-q' option can only be used by root"

This seems to indicate that the setuid to root isn't being recognized 
correctly.

In order to run top with the "-q" command, top currently requires the user to be logged in a root because top checks the uid of the user logged in, not the effective uid of the file. Why?  To not allow a regular users to swamp the system with a high-priority process. Imagine what a regular user could do with "top -q -s0 all"!



===============================================================================


                             TOP
                         Version 3.3

                       William LeFebvre
		             and a cast of dozens


If you do not want to read this entire file, then at least read
the section at the end entitled "KNOWN PROBLEMS".

"top" is a program that will give continual reports about the state of
the system, including a list of the top cpu using processes.  Version 3
of "top" has three primary design goals: provide an accurate snapshot of
the system and process state, not be one of the top processes itself, be
as portable as possible.

Version 3 has many bug fixes from version 2.5, and it has also been
reorganized in a major way to make it easy to port to other platforms.
All system dependent code is now contained in one file.

Top now includes a configuration script called "Configure".  It helps
the installer choose the correct parameters for this particular
installation.  This script MUST be run before attempting to compile top.

Top 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.
In addition, on those Unix variants that support the proc filesystem
(such as SVR4 and Solaris 2), top requires read access to all the files
in /proc: typically dictating that top be installed setuid to root.

CAVEAT: version 3 of top has internal commands that kill and renice
processes.  Although I have taken steps to insure that top makes
appropriate checks with these commands, I cannot guarantee that these
internal commands are totally secure.  IF YOU INSTALL top as a SETUID
program, you do so AT YOUR OWN RISK!  I realize that some operating
systems will require top to run setuid, and I will do everything I can
to make sure that top is a secure setuid program.

Configure will ask you to input values for certain parameters.  Before
each parameter, Configure will display a description of what the
parameter does.  Read the description and choose an appropriate value.
Sometimes a default will appear in brackets.  Typing just return will
choose the default.

System support now takes the form of "modules".  Adding support for
a different architecture requires only adding a module.  Configure
asks which module to use when it is configuring top.  See the file
"Porting" for a description of how to write your own module.

To compile and install "top", read the file "INSTALL" and follow the
directions and advice contained therein.

Once you have created a binary for one particular type of machine, you
can reconfigure for another type with "./Configure modulename" where
"modulename" is replaced with the appropriate module name.  All other
parameter values are kept the same.  Note that in some cases this may
not be appropriate.

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.

Be sure to read the FAQ enclosed with the distrubution.  It contains
answers to the most commonly asked questions about the configuration,
installation, and operation of top.

AVAILABILITY

The latest version of "top" is always available via anonymous FTP from
the host "eecs.nwu.edu" in the directory "/pub/top".  Additional modules
will be made available in the directory "/pub/top/m".

KNOWN PROBLEMS:

DECOSF/1 V3.0

There is a bug either in the module, in utils.c, or in DEC's optimizer that
is tickled by the decosf1 module when compiled under V3.0 (and perhaps
earlier versions).  Top compiled using DEC's compiler with optimization
will consistently produce a segmentation fault (in format_next_process
while calling sprintf).  To work around this problem, either compile top
with gcc or turn off optimization (compile without -O).  Hopefully someone
out there will be able to tell me why this is happening.

Gnu CC

See the file "FAQ":  question #11.


System V R 4.2

Load average and memory displays do not work.  The problem has been
traced down to a potential bug in the "mem" driver.  The author
of the svr42 module is working on a fix.


		William LeFebvre
		Decision and Information Sciences
		Argonne National Laboratory
		lefebvre@dis.anl.gov


		U.S. Mail address:
		    William LeFebvre
		    9700 South Cass Avenue
		    DIS/900
		    Argonne, IL  60439

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.