NEXTSTEP DIFFERENCES
NEXTSTEP v.0.4 of TOP - 2/22/1996 tpugh
The NEXTSTEP port includes reports on the number of threads per process which appears under the heading "THR".

The field "%WCPU" has been removed until we can figure out how to calculate the weighted CPU time with the given process information.

Memory statistics show the total RAM for the system, and the number of active, inactive, wired, and free Mach virtual memory pages (in bytes). Also shown is the number of bytes moving into and out of virtual memory.

The NEXTSTEP port was written by Tim Pugh <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 - next40
This is the machine-dependent module for NEXTSTEP v3.x/4.x
Reported to work for:
    NEXTSTEP v3.2 on HP machines.
    NEXTSTEP v3.3 on HP and Sparc machines.
Has not been tested for NEXTSTEP v4.0 machines, although it should work.

HISTORY
* 9/8/95 tpugh. Removed the %WCPU field, no support for it.
* 9/8/95 tpugh. Removed all C++ style comments from machine.c to be ANSI C compatible.
* 2/13/96 tpugh. Fixed command name display problem for hppa and sparc machines,and NS4.0 alpha machines. NeXT changed the task structure, so top could not find utask structure. <mach/task.h> is not shipped with any NEXTSTEP system.
* 2/14/96 tpugh. Reduced line length to less than 80 columns. Some commands are long and will extend beyond 80 colums.
* 2/14/96 tpugh. 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 invalid process addresses and bus errors.
* 2/14/96 tpugh. Eliminated the text artifact in the command column.
* 2/22/96 tpugh. Fixed problem with quiting the program. 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.
* 2/22/96 tpugh. Fixed incorrect load average display. Incorrect scaling of the kernel load average fixed-point values.

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)

Answer:
The call is failing due to TOP file permission problems. The user must be the superuser, root, or the program must have root privileges to work properly. So install "top" with the permissions 4755. Setting the group sticky bit for kmem does not work, because TOP needs to communicate with the Mach kernal for task and thread info, which requires root privileges.

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

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

Answer:
Add the -arch flags to the Makefile. Due to the task.h file differences between (m68k,Intel) and (sparc,hppa) NEXTSTEP 3.x operating systems, a single binary file can not be generated.
Change line 61 to:
    CDEFS = -O -arch m68k -arch i386 -arch hppa -arch sparc

Add $(CFLAGS) to link command. Change line 79 to:
    $(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.

Answer:
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 regular users to swamp the system with a high-priority process. Imagine what a regular user could do with "top -q -s0 all"!