sob@soma.UUCP (Stan Barber) (09/30/86)
Recently, my friend, Bill, released the latest version of his "top" program to display the most active processes on a Vax, Pyramid or Sun computer. I attempted to make it work on a Masscomp. Here is the results of that work. Please let me know about any fixes. I will forward them to Bill as well. Have fun. Stan Barber #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # boolean.h # layout.h # screen.h # top.h # top.local.h # masscomp.h # bzero.c # This archive created: Mon Sep 29 16:14:10 1986 export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'boolean.h'" '(125 characters)' if test -f 'boolean.h' then echo shar: "will not over-write existing file 'boolean.h'" else cat << \SHAR_EOF > 'boolean.h' /* My favorite names for boolean values */ #define No 0 #define Yes 1 #define Maybe 2 /* tri-state boolean, actually */ SHAR_EOF fi echo shar: "extracting 'layout.h'" '(845 characters)' if test -f 'layout.h' then echo shar: "will not over-write existing file 'layout.h'" else cat << \SHAR_EOF > 'layout.h' /* * Top - a top users display for Berkeley Unix * * This file defines the locations on tne screen for various parts of the * display. These definitions are used by the routines in "display.c" for * cursor addressing. */ #define x_lastpid 10 #define y_lastpid 0 #define x_loadave 33 #define y_loadave 0 #define x_procstate 0 #define y_procstate 1 #define x_brkdn 14 #define y_brkdn 1 #define x_realmem 8 #define x_virtmem 28 #define x_free 53 #define y_mem 3 #define x_header 0 #define y_header 5 #define x_idlecursor 0 #define y_idlecursor 4 #define y_procs 6 #define x_p_pid 0 #define x_p_user 6 #define x_p_pri 15 #define x_p_nice 20 #define x_p_size 25 #define x_p_res 31 #define x_p_state 37 #define x_p_time 43 #define x_p_wcpu 50 #define x_p_cpu 57 #define x_p_command 64 #define y_cpustates 2 SHAR_EOF fi echo shar: "extracting 'screen.h'" '(874 characters)' if test -f 'screen.h' then echo shar: "will not over-write existing file 'screen.h'" else cat << \SHAR_EOF > 'screen.h' /* * top - a top users display for Unix 4.2 * * This file contains all the definitions necessary to use the hand-written * screen package in "screen.c" */ #define TCputs(str) tputs(str, 1, putstdout) #define putcap(str) ((str) != NULL ? TCputs(str) : 0) #define Move_to(x, y) TCputs(tgoto(cursor_motion, x, y)) extern char ch_erase; /* set to the user's erase character */ extern char ch_kill; /* set to the user's kill character */ extern char smart_terminal; /* set if the terminal has sufficient termcap capabilities for normal operation */ /* These aresome termcap strings for use outside of "screen.c" */ extern char *cursor_motion; extern char *clear_line; /* rows and columns on the screen according to termcap */ extern int screen_length; extern int screen_width; /* a function that puts a single character on stdout */ int putstdout(); SHAR_EOF fi echo shar: "extracting 'top.h'" '(794 characters)' if test -f 'top.h' then echo shar: "will not over-write existing file 'top.h'" else cat << \SHAR_EOF > 'top.h' /* * Top - a top users display for Berkeley Unix * * General (global) definitions */ /* Number of lines of header information on the standard screen */ #define Header_lines 6 /* Number of columns needed for display */ #define Display_width 80 /* Log base 2 of 1024 is 10 (2^10 == 1024) */ #define LOG1024 10 /* Convert clicks (kernel pages) to kbytes ... */ /* If there is no PGSHIFT defined, assume it is 11 */ /* Is this needed for compatability with some old flavor of 4.2 or 4.1? */ #ifndef PGSHIFT #define pagetok(size) ((size) << 1) #else #if PGSHIFT>10 #define pagetok(size) ((size) << (PGSHIFT - LOG1024)) #else #define pagetok(size) ((size) >> (LOG1024 - PGSHIFT)) #endif #endif extern double logcpu; double log(); double exp(); extern char (* screenbuf)[Display_width]; SHAR_EOF fi echo shar: "extracting 'top.local.h'" '(1261 characters)' if test -f 'top.local.h' then echo shar: "will not over-write existing file 'top.local.h'" else cat << \SHAR_EOF > 'top.local.h' /* * Top - a top users display for Berkeley Unix * * Definitions for things that might vary between installations. */ /* * "Table_size" defines the size of the hash tables used to map uid to * username. The number of users in /etc/passwd CANNOT be greater than * this number. If the error message "table overflow: too many users" * is printed by top, then "Table_size" needs to be increased. Things will * work best if the number is a prime number that is about twice the number * of lines in /etc/passwd. */ #ifndef Table_size #define Table_size 421 #endif /* * "Nominal_TOPN" is used as the default TOPN when Default_TOPN is Infinity * and the output is a dumb terminal. If we didn't do this, then * installations who use a default TOPN of Infinity will get every * process in the system when running top on a dumb terminal (or redirected * to a file). Note that Nominal_TOPN is a default: it can still be * overridden on the command line, even with the value "infinity". */ #ifndef Nominal_TOPN #define Nominal_TOPN 18 #endif /* * File name for the system image and the memory devices. */ #ifdef MASSCOMP #define VMUNIX "/unix" #else #define VMUNIX "/vmunix" #endif #define KMEM "/dev/kmem" #define MEM "/dev/mem" SHAR_EOF fi echo shar: "extracting 'masscomp.h'" '(407 characters)' if test -f 'masscomp.h' then echo shar: "will not over-write existing file 'masscomp.h'" else cat << \SHAR_EOF > 'masscomp.h' /* include file to define a MASSCOMP */ /* by Stan Barber, Baylor College of Medicine */ #if defined(mc300) || defined(mc500) || defined(mc700) #define MASSCOMP #undef DIRSIZ #define DIRSIZ 14 #define CPUSTATES 4 #define MAX_PROC 300 /* jack this up if you run more than 300 processes */ #include <sys/minmax.h> #include <sys/pte.h> #include <sys/cmap.h> #include <sys/text.h> #include <sys/cinfo.h> #endif SHAR_EOF fi echo shar: "extracting 'bzero.c'" '(789 characters)' if test -f 'bzero.c' then echo shar: "will not over-write existing file 'bzero.c'" else cat << \SHAR_EOF > 'bzero.c' /* * Fast, sleazy, and ugly zero function. * * Note that this will only work on a VAX, but it is real easy to write a * similar function for whatever machine you may need. If nothing else, * just a simple loop in C will suffice. * * Dave Johnson, Rice University. * * Enhanced by William LeFebvre of Rice University to handle zeroing more * than 64K. */ # define K 1024 /* * bzero(memory, amount) - set "amount" bytes starting at "memory" to the * value 0. */ bzero(memory, amount) char *memory; int amount; { while (amount >= 64*K) { _bzero64(memory, 64*K-1); memory += 64*K-1; amount -= 64*K-1; } _bzero64(memory, amount); } _bzero64(memory, amount) char *memory; int amount; { asm(" movc5 $0, (sp), $0, 8(ap), *4(ap)"); } SHAR_EOF fi exit 0 # End of shell archive