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

This is NoteBook.rtf in view mode; [Download] [Up]

Thing To Do
· Allow the sorting to change priorites by  %CPU  , %MEM,  PRI,  etc.
· Reduce the %CPU for running top.

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 NeXTstation machines.
	NEXTSTEP v3.2 on Intel and NeXTstation machines.
 	NEXTSTEP v3.3 on Intel and NeXTstation 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.



HISTORY
· 9/1/95 tpugh.  Fixed problem with new processes were not showing up in the display.
· 9/1/95 tpugh.  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.
· 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 developer system, so top will break every time NeXT make changes to the task structure.
· 2/14/96 tpugh.  Installation instructions are in m_next32.c.
· 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.  Modified getu() to use the strcpy() function, not the bcopy() function and write blanks for the rest of the string (MAXCOMLENGTH) i.e.
	9067 root     R      10    0    1 5264K  376K   1.15   1.10   0:01 topquentIn
· 2/22/96 tpugh. Fixed problem with quitting 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.
· 11/26/96 tpugh.  Fixed problem with command name missing from output for top running under OPENSTEP 4.1.  NeXT changed the internal task data structure in task.h, thus changing the location of utask data structure which contains the command name for the task.

FAQ
 #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 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?

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).  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.

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"!

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