[comp.sources.misc] v14i001: u386mon 2.0 part 01/04

wht@n4hgf.UUCP (Warren Tucker) (07/16/90)

Posting-number: Volume 14, Issue 1
Submitted-by: wht@n4hgf.UUCP (Warren Tucker)
Archive-name: u386mon-2.0/part01

[I got a great number of requests for this, so I am posting it here. -wht]

This is u386mon, a "performance" monitor for SCO UNIX V/386 and
ISC 386/ix.  Also, a renice is included as an example of alternate uses
of the kmem/mem/swap utility objects. A set of uucp utilites, called
uutool, is also bundled in (same reason: libkmem).

U386mon and renice have been tested on SCO 3.2.0 and 3.2.1
and ISC 2.0.1 and 2.0.2.
Uutool surely works on most i386 systems with HDB, but has been tested in
SCO UNIX environments.
These may work with other UNIX systems with a little work.
XENIX systems have greatly different kernel implementations and
use xlist instead of nlist.  These programs will not work there; sorry.

It requires terminfo style curses and will use color if you have it.  It
works best with a 43 line (or greater) screen, but will work with a 25
line screen with some limitations.  It has been tested with 25 and 43
line screens on the multiscreen console and on a Wyse 60 (under SCO,
using terminfo wy60, using interesting "color" mappings). On ISC,
43-line xterms are reported to work nicely.

On a 20Mhz Compaq 386 running SCO UNIX 3.2.0, u386mon on a 43-line VGA
appears to consume 2 to 3% of the cpu when in the "main" display and
about 5 to 7% when displaying process status (NPROC, v.v_proc == 100).

This little light show has already helped me diagnose the traditional
"stop-the-world-and-beat-disk-continually-for-15-seconds" problem as
memory exhaustion.  It has also been a good learning experience.

Thanks to peter@radig.de (Peter Radig), dug@kd4nc (Doug Drye),
jdc@uudell.dell.com (Jeremy Chatfield), andy@rbdc (Andy Pitts),
trb@ima.ima.isc.com (Andrew Tannenbaum)
for the help with ISC 386/ix.

#!/bin/sh
# This is u386mon.2.0, a shell archive (shar 3.32)
# made 07/15/1990 07:04 UTC by wht@n4hgf.Mt-Park.GA.US
# Source directory /u1/src/u386mon
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  14604 -rw-r--r-- README
#   1393 -rw-r--r-- EXPLAIN
#   8264 -rw-r--r-- Makefile.sco
#   7951 -rw-r--r-- Makefile.isc
#   6342 -rw-r--r-- bootinfo.c
#   7352 -rw-r--r-- detail.c
#  18031 -rw-r--r-- det_proc.c
#  12628 -rw-r--r-- det_sio.c
#   5521 -rw-r--r-- disputil.c
#   2795 -rw-r--r-- libkmem.c
#   2793 -rw-r--r-- libmem.c
#   1979 -rw-r--r-- libswap.c
#   2881 -rw-r--r-- libnlsym.c
#   2948 -rw-r--r-- nlsym.c
#   3815 -rw-r--r-- proc.c
#   1956 -rw-r--r-- tune.c
#  33152 -rw-r--r-- u386mon.c
#   2094 -rw-r--r-- var.c
#    874 -rw-r--r-- libkmem.h
#    870 -rw-r--r-- libmem.h
#    795 -rw-r--r-- libswap.h
#    841 -rw-r--r-- libnlsym.h
#   7313 -rw-r--r-- lint_args.h
#   5472 -rw-r--r-- nlsym.h
#   3631 -rw-r--r-- u386mon.h
#   1200 -rw-r--r-- renice/Makefile
#   4399 -rw-r--r-- renice/renice.c
#   2027 -rw-r--r-- uutool/README
#   1344 -rw-r--r-- uutool/Makefile
#   3354 -rw-r--r-- uutool/killpc.c
#  17805 -rw-r--r-- uutool/uutool.c
#   2504 -rw-r--r-- uutool/wstext.c
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= README ==============
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
Xu386mon README - last updated Tue Jul 10 19:14:28 EDT 1990
X
XThis is u386mon, a "performance" monitor for SCO UNIX V/386 and
XISC 386/ix.  Also, a renice is included as an example of alternate uses
Xof the kmem/mem/swap utility objects. A set of uucp utilites, called
Xuutool, is also bundled in (same reason: libkmem).
X
XU386mon and renice have been tested on SCO 3.2.0 and 3.2.1
Xand ISC 2.0.1 and 2.0.2.
XUutool surely works on most i386 systems with HDB, but has been tested in
XSCO UNIX environments.
XThese may work with other UNIX systems with a little work.
XXENIX systems have greatly different kernel implementations and
Xuse xlist instead of nlist.  These programs will not work there; sorry.
X
XIt requires terminfo style curses and will use color if you have it.  It
Xworks best with a 43 line (or greater) screen, but will work with a 25
Xline screen with some limitations.  It has been tested with 25 and 43
Xline screens on the multiscreen console and on a Wyse 60 (under SCO,
Xusing terminfo wy60, using interesting "color" mappings). On ISC,
X43-line xterms are reported to work nicely.
X
XOn a 20Mhz Compaq 386 running SCO UNIX 3.2.0, u386mon on a 43-line VGA
Xappears to consume 2 to 3% of the cpu when in the "main" display and
Xabout 5 to 7% when displaying process status (NPROC, v.v_proc == 100).
X
XThis little light show has already helped me diagnose the traditional
X"stop-the-world-and-beat-disk-continually-for-15-seconds" problem as
Xmemory exhaustion.  It has also been a good learning experience.
X
XThanks to peter@radig.de (Peter Radig), dug@kd4nc (Doug Drye),
Xjdc@uudell.dell.com (Jeremy Chatfield), andy@rbdc (Andy Pitts),
Xtrb@ima.ima.isc.com (Andrew Tannenbaum)
Xfor the help with ISC 386/ix.
X
XRead through this and you will finally reach "How to get going" below.
X
XSample output (somewhat obsolete)
X=================================
X(with 43-line screen; a 25 line screen will be missing Var/Bootinfo/Tune/Proc
Xon the 'main' display)
X
X u386mon x1.152  n4hgf - SCO 3.2                              04:39:36 wht@n4hgf
X---- CPU --- tot usr ker brk ---------------------------------------------------
X Instant %    93  54  39   0 uuuuuuuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkk     
X 5 Sec Avg %  87  26  61   0 uuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkkkkkkkkkk        
X10 Sec Avg %  89  45  44   0 uuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkk       
X---- Wait -- tot  io pio swp -- (% of real time) -------------------------------
X Instant %     5   5   0   0 ii                                                 
X 5 Sec Avg %  12  12   0   0 iiiiii                                             
X10 Sec Avg %   9   9   0   0 iiii                                               
X---- Sysinfo/Minfo --- (last  1000 msec activity) ------------------------------
Xbread          5  readch    60416  pswitch    21   vfault    1    unmodsw   0   
Xbwrite         9  writch     2507  syscall   261   demand    1    unmodfl   0   
Xlread        331  rawch         2  sysread   100   pfault   15    psoutok   0   
Xlwrite        42  canch         0  syswrit     4   cw        0    psinfai   0   
Xphread         0  outch      2508  sysfork     1   steal    15    psinok    0   
Xphwrite        0  msg           0  sysexec     0   frdpgs    0    rsout     0   
Xswapin         0  sema          0                  vfpg      0    rsin      0   
Xswapout        0  maxmem    5724k  runque      0   sfpg      0                  
Xbswapin        0  frmem     3284k  runocc      0   vspg      0    pages on      
Xbswapout       0  mem used    43%  swpque      0   sspg      0    swap      0   
Xiget          72  nswap    10000k  swpocc      0   pnpfault  0    cache     0   
Xnamei         71  frswp    10000k                  wrtfault  0    file      0   
Xdirblk        92  swp used     0%                                               
X                                                                                
X                                                                                
X                                                                                
X-- Var ---------  -- Bootinfo ----------   -- Tune ---------  -- Proc ---       
Xv_autoup      10  basemem      640k        t_ageintvl      9  sleep    22       
Xv_buf        600  extmem      6144k        t_bdflushr      1  run       1       
Xv_clist      200  bflags   00000000        t_gpgshi       40  zombie    0       
Xv_file       200  memory available         t_gpgslo       25  stop      0       
Xv_hbuf        64  00000000 000a0000        t_gpgsmsk   0x420  idle      0       
Xv_inode      200  00100000 00600000        t_maxfc         1  onproc    1       
Xv_maxpmem      0  00f40000 00060000 NODM   t_maxsc         1  xbrk      0       
Xv_maxup       60  memory used              t_maxumem    2560  total    24       
Xv_mount        5  00000000 00004000 RSVD   t_minarmem     25  in mem   24       
Xv_pbuf        20  006bb000 00037000 KBSS   t_minasmem     25                    
Xv_proc       100  006f2000 0000e000 KDTA                                        
Xv_region     210  00fa9000 00057000 KTXT                                        
Xv_vhndfrac    16                                                                
X
XThe main display
X================
X
XA brief description of reported information:
X
X1.  The CPU utilization is shown with smoothing of 1 ("instant"),
X    5 and 10 seconds.  Total CPU usage is shown, with user, kernel
X    and "break" subdivided.  Most performance utilities (vmstat)
X    lump kernel (CPU_KERNEL) and wait (CPU_WAIT) times together
X    as kernel time.  u386mon considers CPU_WAIT time as idle (the
X    CPU could have been doing something if an otherwise ready process
X    wasn't waited).
X
X    On a color display, total cpu utilization is displayed in
X    green if the cpu utilization is below 70%, yellow if utilization
X    is between 70% and 89% and red if 90% or above.
X
X2.  The Wait display shows the 1 ("instant"), 5 and 10 second smoothed
X    percentages of real time no process could be run because otherwise
X    ready to run processes were waiting on logical, swap or physical I/O.
X
X    On a color display, total wait time is displayed in green if it is
X    below 30%, yellow if utilization is between 30% and 49% and red if
X    50% or above.
X
X3.  Sysinfo/Minfo display shows, generally, the number of events for a
X    measured value since the last display update.  For example, runque
X    shows the number of times a process was placed on the run queue.
X    An exception is the memory and swap space fields:  These numbers
X    reflect absolute current utilization over the period shown in
X    the "last XXXXX msec" value in the banner.  Periods of 4000
X    milliseconds are shown in red, 1500 to 3990 milliseconds in
X    blue and less than 1500 milliseconds in the normal banner color.
X
X    My guess as to the meaning of the sysinfo and minfo values
X    is in the file EXPLAIN.  I am not familiar with the meanings
X    of all the items, having looked through the header files, sar
X    man pages and the other UNIX hacker-ganda I could find.  Comments
X    are appreciated.
X
X4.  If you run u386mon on a 43 line display, extra information is displayed
X    on the bottom of the screen (from the struct var v, bootinfo
X    and proc kernel databases).
X
X5.  On a color display, static numeric values, such as maxmem appear
X    in blue (the same color as screen literals/labels).  Dynamic
X    numeric values are displayed in green, with the exception of
X    total cpu and wait percentages, which appear in light green,
X    red or yellow.
X
X6.  An "INEXACT" indication on the top line means that u386mon was
X    not scheduled quickly enough to capture accurate 1 second (nominal)
X    values.  Continued INEXACT indication suggests the 5 and 10
X    second smoothed values are also wrong.
X
X    An "INVALID" indication means u386mon was not scheduled for 4
X    seconds or more; all dynamic values are suspect.
X    IN GENERAL, if you see any red characters on the display,
X    immediately take grain of salt. If you have no color screen
X    and still see red, add tequila to salt.
X
X7.  If you are running as root, you may use the -l switch or the
X    'l' command to lock u386mon into memory.  If you do this, PLOCK
X    will appear at the top of the screen to remind you of this hoggy
X    behavior.  The u386mon process will not be listed in a process
X    status display since SSYS (locked, resident) processes are not
X    shown.
X
X8.  The ISC bootinfo field will have different information due to
X    different porting by ISC and SCO.
X
X9.  The 'e' command accesses the Var/Bootinfo/Tune/Proc display,
X    overlaying the Sysinfo/Minfo display.
X
XProcess Status Display
X======================
X
X1.  Pressing 'p' causes a process status display of sorts to be
X    shown, overlaying Sysinfo/Minfo on a 25 line screen or
X    Var/Bootinfo/Tune/Proc on a 43 line screen.  On a 43 line screen, 'P'
X    causes a larger ps display to be shown, overlaying Sysinfo/Minfo and
X    Var/Bootinfo/Tune/Proc.
X
X    Sample output:
X
XS     USER   PID  CPU PRI NI  UCPU   SCPU  SIZE TTY CMD
Xs     root    148   0  26 20   0:00   0:05  108  ?? /etc/cron
Xs      wht  14946   2  39 20   0:02   0:11  224  05 TMR 01000a12
Xs      wht  14947   2  39 20   0:02   0:11  220  05 TMR 01011101
Xs      wht  14950   0  27 20   0:00   0:02  228  05 IP 01000a12
Xs      wht  14951   1  27 20   0:00   0:02  224  05 IP 01011101
Xs      wht  14952   0  27 20   0:01   0:02  228  05 TP4 01000a12
Xs      wht  14953   1  27 20   0:01   0:03  224  05 TP4 01011101
Xs      wht  14957   0  27 20   0:00   0:04  200  05 smpad.x
Xs      wht  14960   1  27 20   0:00   0:04  204  05 mmpad.x
Xs     root  15044   0  28 20   0:01   0:01  296  12 vi README
Xs     uucp  15053   0  30 26   0:00   0:00  696  ?? /usr/lib/uucp/uusched
Xs     uucp  15055   0  30 26   0:00   0:00  748  ?? UUCICO -r1 -sgatech
Xs     uucp  15060   0  28 26   0:00   0:00  768  ?? dialTBIT tty2E 2222222UC 192
X
X    NOTES
X    a.   S - two character status
X            1st character - process status
X               s - sleeping
X               R - ready to run (might be running if u386mon were not)
X               z - zombie
X               d - stopped by debugger
X               i - idle (in creation?)
X               p - running on processor (on single CPU systems, only u386mon
X                   will show this)
X               x - XBREAK - process growing or shrinking
X            2nd character - process swap status
X               S - process is swapped
X               blank - process is in memory
X
X    b.  If the process is running with setuid, a '#' appears to
X        the right of the username.
X
X    c.  On color systems, processes ready to run are shown in yellow
X        unless they are ready, but swapped out, in which case they
X        are shown in red.
X
X3.  Since a limited space is available for displaying process
X    status, particularly on a 25-line screen, a selective elimination
X    algorithm is used to whittle the list when insufficient room
X    is available.  init (pid 1) and system/resident (SSYS)
X    processes are never displayed.  When a display cycle is to begin
X    and there is not room for all of the processes to be shown,
X    processes are eliminated in the following order:
X
X    a. 'getty', 'uugetty', 'sh', 'csh', and 'ksh'
X    b. swapped and zombie processes
X    c. sleeping processes
X
X    If there is still insufficient room, an indication to the effect
X    is displayed (tough cookies).
X
X
XA $0.0002 tour: why nlsym and /unix.nlsym?
X==========================================
X
XAccess to kernel (/dev/kmem) and physical (/dev/mem) memory and
Xswap (/dev/swap) is required for u386mon to do its thing.
XTo find kmem addresses of interest, an nlist(S) call must be made
Xagainst /unix.  This can be quite expensive.
X
XThe 'nlist' procedure is performed by a separate program (nlsym)
Xand the resulting nlist structure array is stored in /unix.nlsym.
Xu386mon thus may obtain nlist information rapidly without nlist(S) each
Xtime it is executed.  Also stored in /unix.nlsym is a stat structure of
X/unix at the time of nlsym execution.  A unique word is stored at the
Xend of the file in case /unix.nlsym's nlist structure is expanded for
Xother applications.  The u386mon program reads /unix.nlsym by means
Xof facilities in libnlsym.c.  If the stat structure in /unix.nlsym
Xdoes not match a dynamic stat of /unix or if the unique word does
Xnot match, the nlist information is not trusted and u386mon prompts
Xthe user to run (or have run) the nlsym program to update /unix.nlsym.
X
XMany symbols are nlist'ed by nlsym which are not used by u386mon.
XYou may find other uses for libnlsym/libkmem which make use of them.
X
XHow to get going
X================
X
X1.  Copy Makefile.sco or Makefile.isc to Makefile, depending on
X    your system.
X
X2.  Edit Makefile to change BINDIR to match your local requirements.
X    If you have a kernel that knows about MERGE386 as with SCO ODT,
X    add -DMERGE386 to CFLAGS. Likewise, if you have VPIX, add -DVPIX.
X
X3.  make all.
X
X4.  you must run make install as root since u386mon must be setuid to
X    'mem' ('sys' for ISC) and nlsym must produce /unix.nlsym.
X
X5.  Sources are in 4-spaced tab format (please don't flame :-)).
X
X6.  Under SCO, you may have to chgrp mem /dev/swap; I did.  For some reason,
X    I found the group name for /dev/swap on my system to be 'network'.
X    I guess something may have been broken by my changing the group,
X    but it hasn't bit me yet.
X
X    The ISC Makefile unconditionally sets g+r on /dev/swap, since this
X    necessary permission is not ordinarily present.
X
X7.  usage: u386mon [-l] [-p | -P]
X    -l lock process into memory (if root)
X    -p begin with short ps display
X    -P begin with long ps display (if 43 line screen)
X
X8.  If you are getting 4 as the size of most or all processes,
X    try adding -DUTIME_FIXED.  SCO 3.2.0 had this info in the
X    struct user fields u_tsize, u_dsize, u_ssize wrong, IMHO,
X    and fixed it in ODT/3.2.1. See det_proc.c for more detail.
X    Your port may/WILL vary.
X
X9.  The renice program by Ford Ditto, from which the kmem routines
X    came, with this release.
X
X    usage: renice -# pid     decrease nice by #
X           renice +# pid     increase nice by #
X           renice =# pid     set nice to #
X
X    The traditional privileges for root and non-root are supported.
X
XComments are appreciated, especially bug fixes and information
Xhelping to port the program to another 386 S5R3.2 system.
XSomebody was purported to be working on a XENIX/386 lookalike.
X
XNO FSF, LPF, FOO or LSD -- just free.
X
XWarren Tucker N4HGF
X{gatech,emory}!n4hgf!wht -or- wht@n4hgf.Mt-Park.GA.US
SHAR_EOF
$TOUCH -am 0715030490 README &&
chmod 0644 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "14604"; then
	echo original size 14604, current size $Wc_c
fi
# ============= EXPLAIN ==============
echo "x - extracting EXPLAIN (Text)"
sed 's/^X//' << 'SHAR_EOF' > EXPLAIN &&
XThis is a very cursor description of some of the fields as I understand
Xthem.  Corrections/additions appreciated.
X
X---- Sysinfo/Minfo --- (last 1 second activity) --------------------------------
Xbread			actual buffers (disk or tape blocks) read
Xbwrite			actual buffers (disk or tape blocks) written
Xlread			logical buffers (disk or tape blocks) read
Xlwrite			logical buffers (disk or tape blocks) written 
Xswapin			logical blocks swapped in
Xswapout			logical blocks swapped out
Xbswapin			actual blocks swapped in
Xbswapout		actual blocks swapped in
Xiget			get inode
Xnamei			lookup inode for pathname
Xdirblk			directory blocks read
Xreadch			chars read by read() system call
Xwritch			chars written by write() system call
Xrawch			raw tty character read
Xcanch			raw tty character put onto canonical queue
Xoutch			tty characters written
Xmsg				message operations (msgsnd())
Xsema			semaphore operations (semop())
Xpswitch			process context switches
Xsyscall			system calls
Xsysread			read() calls
Xsyswrit			write() calls
Xsysfork			fork() calls
Xsysexec			exec[,l,le,etc.]() calls
Xrunque			number of processes placed on run queue
Xrunocc			number of processes -now- on queue
Xswpque			number of processes placed on swap queue
Xswpocc			number of processes -now- on queue
Xvfault			
Xdemand			
Xpfault			
Xsteal			number of pages stolen
Xfrdpgs			pages freed
Xvfpg			
Xsfpg			
Xvspg			
Xsspg			
Xpnpfault		
Xwrtfault		
SHAR_EOF
$TOUCH -am 0710191890 EXPLAIN &&
chmod 0644 EXPLAIN ||
echo "restore of EXPLAIN failed"
set `wc -c EXPLAIN`;Wc_c=$1
if test "$Wc_c" != "1393"; then
	echo original size 1393, current size $Wc_c
fi
# ============= Makefile.sco ==============
echo "x - extracting Makefile.sco (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile.sco &&
X#  CHK=0x56F7
X#+-------------------------------------------------------------------
X#  Makefile for u386mon for SCO UNIX V/386
X#  ...!emory!n4hgf!wht
X#--------------------------------------------------------------------
X#+:EDITS:*/
X#:06-30-1990-19:06-wht@n4hgf-run nlsym using full pathname
X#:06-27-1990-01:57-wht@n4hgf-1.10 - incorporate suggestions from alpha testers
X#:06-25-1990-04:14-wht@n4hgf-1.03-better error handling
X#:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free
X#:06-19-1990-21:37-wht@n4hgf-get ready for 0.08 release
X
X#------------> CFLAGS 
X# Add -DVPIX if you have VP/ix
X# Add -DMERGE386 if you have Merge/386
XCFLAGS = -c -Octl -DLINT_ARGS
X#CFLAGS = -c -Octl -DVPIX
X#CFLAGS = -c -Octl -DMERGE386
X
X#------------> LIB
XLIB = -lpanel -ltinfo -lx
X#LIB = -lpanel -lcurses -lx
X
X#------------> KMEMGRP
XKMEMGRP = mem
X#KMEMGRP = sys
X
X#------------> BINDIR
XBINDIR = /usr/local/bin
X
XLDFLAGS = -s
X
XVERSION = 2.00
X
X#handle Sys V make "feature" of using SHELL
XSHELL = /bin/sh
X
X#FCRC = fcrc -u $*.c ;
X.c.o:;	$(FCRC) $(CC) $(CFLAGS) $*.c 
X
XSRC = \
X	bootinfo.c\
X	detail.c\
X	det_proc.c\
X	det_sio.c\
X	disputil.c\
X	libkmem.c\
X	libmem.c\
X	libswap.c\
X	libnlsym.c\
X	nlsym.c\
X	proc.c\
X	tune.c\
X	u386mon.c\
X	var.c
X
XHDR = \
X	libkmem.h\
X	libmem.h\
X	libswap.h\
X	libnlsym.h\
X	lint_args.h\
X	nlsym.h\
X	u386mon.h
X
XNLSYM_OBJ =\
X	nlsym.o
X
XU386MON_OBJ =\
X	u386mon.o\
X	detail.o\
X	det_proc.o\
X	det_sio.o\
X	bootinfo.o\
X	proc.o\
X	tune.o\
X	var.o\
X	disputil.o\
X	libkmem.o\
X	libmem.o\
X	libswap.o\
X	libnlsym.o
X
XSHARFLS = \
X	README\
X	EXPLAIN\
X	Makefile.sco\
X	Makefile.isc\
X	$(SRC)\
X	$(HDR)\
X	renice/Makefile\
X	renice/renice.c\
X	uutool/README\
X	uutool/Makefile\
X	uutool/*.c
X
Xall: nlsym u386mon
X
X#must run as root
Xinstall: all
X	cp nlsym $(BINDIR)
X	chown bin $(BINDIR)/nlsym
X	chgrp bin $(BINDIR)/nlsym
X	chmod 711 $(BINDIR)/nlsym
X	mv u386mon $(BINDIR)
X	chown bin $(BINDIR)/u386mon
X	chgrp $(KMEMGRP) $(BINDIR)/u386mon
X	chmod 2711 $(BINDIR)/u386mon
X	$(BINDIR)/nlsym
X	@echo ' ';echo 'csh users rehash before executing'
X
Xnlsym: $(NLSYM_OBJ)
X	$(CC) $(LDFLAGS) -o $@ $(NLSYM_OBJ) $(LIB)
X
Xu386mon: $(U386MON_OBJ)
X	$(CC) $(LDFLAGS) -o $@ $(U386MON_OBJ) $(LIB)
X
X/unix.nlsym: nlsym /unix
X	$(BINDIR)/nlsym
X	chmod 644 /unix.nlsym
X
X#not delivered
Xsrc.fls: $(SRC) Makefile
X	ls $(SRC) > src.fls
Xlint_args: src.fls
X	echo ' ' > lint_args.h
X	csh zgcc src.fls lint_args.h $(CFLAGS)
X
Xclean:
X	rm -f $(U386MON_OBJ) $(NLSYM_OBJ) \
X		core u386mon.lint Makefile.bak src.fls mkdep.*
X
Xclobber: clean
X	rm -f nlsym u386mon
X
Xlint:
X	lint -ux *.c > u386mon.lint
X
X#for shar 3.27 or later
Xshar:
X	shar -a -n u386mon.$(VERSION) -l 55 -o $(VERSION).sh $(SHARFLS)
X
X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
X#
Xdepend:
X		rm -f mkdep.rule.tmp
X		if test '$(SRC)' ;\
X		then (grep '^#include' $(SRC) \
X		| sed	-e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
X			-e 's?:[^"]*"\([^"]*\)".*?: \1?'\
X			-e 's?\(.*\)\.c?\1.o?'\
X		 >> mkdep.rule.tmp) ;\
X		fi
X
X		echo '/^# DO NOT DELETE THIS LINE' >mkdep.ex.tmp
X		echo '.+1,$$d' >>mkdep.ex.tmp
X		echo 'r mkdep.rule.tmp' >> mkdep.ex.tmp
X		echo 'w' >> mkdep.ex.tmp
X		cp Makefile Makefile.new
X		ex Makefile.new < mkdep.ex.tmp
X		rm mkdep.ex.tmp mkdep.rule.tmp
X		echo '#	DEPENDENCIES MUST END AT END OF	FILE' >>Makefile.new
X		echo '#	IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
X		echo '#	see make depend	above'>>Makefile.new
X		mv Makefile Makefile.bak
X		mv Makefile.new Makefile
X
X# DO NOT DELETE THIS LINE
Xbootinfo.o: /usr/include/curses.h
Xbootinfo.o: /usr/include/panel.h
Xbootinfo.o: /usr/include/sys/types.h
Xbootinfo.o: /usr/include/sys/bootinfo.h
Xbootinfo.o: u386mon.h
Xdetail.o: /usr/include/curses.h
Xdetail.o: /usr/include/panel.h
Xdetail.o: /usr/include/signal.h
Xdetail.o: /usr/include/string.h
Xdetail.o: /usr/include/fcntl.h
Xdetail.o: /usr/include/nlist.h
Xdetail.o: /usr/include/errno.h
Xdetail.o: /usr/include/time.h
Xdetail.o: /usr/include/pwd.h
Xdetail.o: /usr/include/sys/types.h
Xdetail.o: /usr/include/utmp.h
Xdetail.o: /usr/include/sys/utsname.h
Xdetail.o: /usr/include/sys/stat.h
Xdetail.o: /usr/include/sys/ascii.h
Xdetail.o: /usr/include/sys/param.h
Xdetail.o: /usr/include/sys/bootinfo.h
Xdetail.o: /usr/include/sys/tuneable.h
Xdetail.o: /usr/include/sys/sysinfo.h
Xdetail.o: /usr/include/sys/sysmacros.h
Xdetail.o: /usr/include/sys/immu.h
Xdetail.o: /usr/include/sys/region.h
Xdetail.o: /usr/include/sys/proc.h
Xdetail.o: /usr/include/sys/var.h
Xdetail.o: nlsym.h
Xdetail.o: libkmem.h
Xdetail.o: libnlsym.h
Xdetail.o: u386mon.h
Xdet_proc.o: /usr/include/curses.h
Xdet_proc.o: /usr/include/panel.h
Xdet_proc.o: /usr/include/signal.h
Xdet_proc.o: /usr/include/string.h
Xdet_proc.o: /usr/include/fcntl.h
Xdet_proc.o: /usr/include/nlist.h
Xdet_proc.o: /usr/include/errno.h
Xdet_proc.o: /usr/include/time.h
Xdet_proc.o: /usr/include/pwd.h
Xdet_proc.o: /usr/include/sys/types.h
Xdet_proc.o: /usr/include/utmp.h
Xdet_proc.o: /usr/include/sys/stat.h
Xdet_proc.o: /usr/include/sys/ascii.h
Xdet_proc.o: /usr/include/sys/param.h
Xdet_proc.o: /usr/include/sys/bootinfo.h
Xdet_proc.o: /usr/include/sys/tuneable.h
Xdet_proc.o: /usr/include/sys/sysinfo.h
Xdet_proc.o: /usr/include/sys/sysmacros.h
Xdet_proc.o: /usr/include/sys/immu.h
Xdet_proc.o: /usr/include/sys/region.h
Xdet_proc.o: /usr/include/sys/proc.h
Xdet_proc.o: /usr/include/sys/fs/s5dir.h
Xdet_proc.o: /usr/include/sys/user.h
Xdet_proc.o: /usr/include/sys/var.h
Xdet_proc.o: nlsym.h
Xdet_proc.o: libkmem.h
Xdet_proc.o: libmem.h
Xdet_proc.o: libswap.h
Xdet_proc.o: libnlsym.h
Xdet_proc.o: u386mon.h
Xdet_sio.o: /usr/include/curses.h
Xdet_sio.o: /usr/include/panel.h
Xdet_sio.o: /usr/include/string.h
Xdet_sio.o: /usr/include/nlist.h
Xdet_sio.o: /usr/include/sys/types.h
Xdet_sio.o: /usr/include/sys/stat.h
Xdet_sio.o: /usr/include/sys/ascii.h
Xdet_sio.o: /usr/include/sys/param.h
Xdet_sio.o: /usr/include/sys/tty.h
Xdet_sio.o: nlsym.h
Xdet_sio.o: libkmem.h
Xdet_sio.o: libmem.h
Xdet_sio.o: libswap.h
Xdet_sio.o: libnlsym.h
Xdet_sio.o: u386mon.h
Xdisputil.o: /usr/include/curses.h
Xdisputil.o: /usr/include/panel.h
Xdisputil.o: /usr/include/sys/types.h
Xdisputil.o: u386mon.h
Xlibkmem.o: /usr/include/sys/types.h
Xlibkmem.o: /usr/include/fcntl.h
Xlibkmem.o: libkmem.h
Xlibmem.o: /usr/include/sys/types.h
Xlibmem.o: /usr/include/fcntl.h
Xlibmem.o: libmem.h
Xlibswap.o: /usr/include/sys/types.h
Xlibswap.o: /usr/include/fcntl.h
Xlibswap.o: libswap.h
Xlibnlsym.o: /usr/include/stdio.h
Xlibnlsym.o: /usr/include/sys/types.h
Xlibnlsym.o: /usr/include/sys/stat.h
Xlibnlsym.o: /usr/include/fcntl.h
Xlibnlsym.o: /usr/include/nlist.h
Xlibnlsym.o: nlsym.h
Xlibnlsym.o: libnlsym.h
Xnlsym.o: /usr/include/stdio.h
Xnlsym.o: /usr/include/sys/types.h
Xnlsym.o: /usr/include/sys/stat.h
Xnlsym.o: /usr/include/fcntl.h
Xnlsym.o: /usr/include/nlist.h
Xnlsym.o: nlsym.h
Xproc.o: /usr/include/curses.h
Xproc.o: /usr/include/panel.h
Xproc.o: /usr/include/sys/types.h
Xproc.o: /usr/include/sys/param.h
Xproc.o: /usr/include/sys/immu.h
Xproc.o: /usr/include/sys/region.h
Xproc.o: /usr/include/sys/proc.h
Xproc.o: /usr/include/sys/var.h
Xproc.o: /usr/include/nlist.h
Xproc.o: nlsym.h
Xproc.o: libkmem.h
Xproc.o: libnlsym.h
Xproc.o: u386mon.h
Xtune.o: /usr/include/curses.h
Xtune.o: /usr/include/panel.h
Xtune.o: /usr/include/sys/types.h
Xtune.o: /usr/include/sys/tuneable.h
Xtune.o: u386mon.h
Xu386mon.o: /usr/include/curses.h
Xu386mon.o: /usr/include/panel.h
Xu386mon.o: /usr/include/signal.h
Xu386mon.o: /usr/include/string.h
Xu386mon.o: /usr/include/fcntl.h
Xu386mon.o: /usr/include/nlist.h
Xu386mon.o: /usr/include/errno.h
Xu386mon.o: /usr/include/time.h
Xu386mon.o: /usr/include/sys/types.h
Xu386mon.o: /usr/include/sys/lock.h
Xu386mon.o: /usr/include/sys/utsname.h
Xu386mon.o: /usr/include/sys/stat.h
Xu386mon.o: /usr/include/sys/ascii.h
Xu386mon.o: /usr/include/sys/param.h
Xu386mon.o: /usr/include/sys/bootinfo.h
Xu386mon.o: /usr/include/sys/tuneable.h
Xu386mon.o: /usr/include/sys/sysinfo.h
Xu386mon.o: /usr/include/sys/sysmacros.h
Xu386mon.o: /usr/include/sys/immu.h
Xu386mon.o: /usr/include/sys/region.h
Xu386mon.o: /usr/include/sys/proc.h
Xu386mon.o: /usr/include/sys/var.h
Xu386mon.o: nlsym.h
Xu386mon.o: libkmem.h
Xu386mon.o: libmem.h
Xu386mon.o: libswap.h
Xu386mon.o: libnlsym.h
Xu386mon.o: u386mon.h
Xvar.o: /usr/include/curses.h
Xvar.o: /usr/include/panel.h
Xvar.o: /usr/include/sys/types.h
Xvar.o: /usr/include/sys/var.h
Xvar.o: u386mon.h
X#	DEPENDENCIES MUST END AT END OF	FILE
X#	IF YOU PUT STUFF HERE IT WILL GO AWAY
X#	see make depend	above
SHAR_EOF
$TOUCH -am 0715025090 Makefile.sco &&
chmod 0644 Makefile.sco ||
echo "restore of Makefile.sco failed"
set `wc -c Makefile.sco`;Wc_c=$1
if test "$Wc_c" != "8264"; then
	echo original size 8264, current size $Wc_c
fi
# ============= Makefile.isc ==============
echo "x - extracting Makefile.isc (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile.isc &&
X#  CHK=0xF36B
X#+-------------------------------------------------------------------
X#  Makefile for u386mon for ISC 386/ix
X#  ...!emory!n4hgf!wht
X#--------------------------------------------------------------------
X#+:EDITS:*/
X#:06-27-1990-01:57-wht@n4hgf-1.10 - incorporate suggestions from alpha testers
X#:06-25-1990-04:14-wht@n4hgf-1.03-better error handling
X#:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de
X#:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free
X#:06-19-1990-21:37-wht@n4hgf-get ready for 0.08 release
X
X#------------> CFLAGS 
X# Add -DVPIX if you have VP/ix
X# Add -DMERGE386 if you have Merge/386
XCFLAGS = -c -O -DISC
X#CFLAGS = -c -O -DVPIX -DISC
X#CFLAGS = -c -O -DMERGE386 -DISC
X
X#------------> LIB
X#LIB = -lpanel -ltinfo -lx
XLIB = -lpanel -lcurses -lx -lmalloc -lc_s
X
X#------------> KMEMGRP
X#KMEMGRP = mem
XKMEMGRP = sys
X
X#------------> BINDIR
XBINDIR = /usr/local/bin
X
XLDFLAGS = -s
X
XVERSION = 2.00
X
X#handle Sys V make "feature" of using SHELL
XSHELL = /bin/sh
X
X#FCRC = fcrc -u $*.c ;
X.c.o:;	$(FCRC) $(CC) $(CFLAGS) $*.c 
X
XSRC = \
X	bootinfo.c\
X	detail.c\
X	det_proc.c\
X	det_sio.c\
X	disputil.c\
X	libkmem.c\
X	libmem.c\
X	libswap.c\
X	libnlsym.c\
X	nlsym.c\
X	proc.c\
X	tune.c\
X	u386mon.c\
X	var.c
X
XHDR = \
X	libkmem.h\
X	libmem.h\
X	libswap.h\
X	libnlsym.h\
X	lint_args.h\
X	nlsym.h\
X	u386mon.h
X
XNLSYM_OBJ =\
X	nlsym.o
X
XU386MON_OBJ =\
X	u386mon.o\
X	detail.o\
X	det_proc.o\
X	bootinfo.o\
X	proc.o\
X	tune.o\
X	var.o\
X	disputil.o\
X	libkmem.o\
X	libmem.o\
X	libswap.o\
X	libnlsym.o
X
XSHARFLS = \
X	README\
X	EXPLAIN\
X	Makefile.sco\
X	Makefile.isc\
X	$(SRC)\
X	$(HDR)\
X	renice/Makefile\
X	renice/renice.c\
X	uutool/README\
X	uutool/Makefile\
X	uutool/*.c
X
Xall: nlsym u386mon
X
X#must run as root
Xinstall: all
X	mv $(BINDIR)/nlsym $(BINDIR)/nlsym.old
X	cp nlsym $(BINDIR)
X	chown bin $(BINDIR)/nlsym
X	chgrp bin $(BINDIR)/nlsym
X	chmod 711 $(BINDIR)/nlsym
X	mv $(BINDIR)/u386mon $(BINDIR)/u386mon.old
X	cp u386mon $(BINDIR)
X	chown bin $(BINDIR)/u386mon
X	chgrp $(KMEMGRP) $(BINDIR)/u386mon
X	chmod 2711 $(BINDIR)/u386mon
X	chmod g+r /dev/swap
X	$(BINDIR)/nlsym
X	@echo ' ';echo 'csh users rehash before executing'
X
Xnlsym: $(NLSYM_OBJ)
X	$(CC) $(LDFLAGS) -o $@ $(NLSYM_OBJ) $(LIB)
X
Xu386mon: $(U386MON_OBJ)
X	$(CC) $(LDFLAGS) -o $@ $(U386MON_OBJ) $(LIB)
X
X/unix.nlsym: nlsym /unix
X	$(BINDIR)/nlsym
X	chmod 644 /unix.nlsym
X
X#not delivered
Xsrc.fls: $(SRC) Makefile
X	ls $(SRC) > src.fls
Xlint_args: src.fls
X	echo ' ' > lint_args.h
X	csh zgcc src.fls lint_args.h $(CFLAGS)
X
Xclean:
X	rm -f $(U386MON_OBJ) $(NLSYM_OBJ) \
X		core u386mon.lint Makefile.bak src.fls mkdep.*
X
Xclobber: clean
X	rm -f nlsym u386mon
X
Xlint:
X	lint -ux *.c > u386mon.lint
X
X#for shar 3.27 or later
Xshar:
X	shar -a -n u386mon.$(VERSION) -l 55 -o $(VERSION).sh $(SHARFLS)
X
X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
X#
Xdepend:
X		rm -f mkdep.rule.tmp
X		if test '$(SRC)' ;\
X		then (grep '^#include' $(SRC) \
X		| sed	-e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
X			-e 's?:[^"]*"\([^"]*\)".*?: \1?'\
X			-e 's?\(.*\)\.c?\1.o?'\
X		 >> mkdep.rule.tmp) ;\
X		fi
X
X		echo '/^# DO NOT DELETE THIS LINE' >mkdep.ex.tmp
X		echo '.+1,$$d' >>mkdep.ex.tmp
X		echo 'r mkdep.rule.tmp' >> mkdep.ex.tmp
X		echo 'w' >> mkdep.ex.tmp
X		cp Makefile Makefile.new
X		ex Makefile.new < mkdep.ex.tmp
X		rm mkdep.ex.tmp mkdep.rule.tmp
X		echo '#	DEPENDENCIES MUST END AT END OF	FILE' >>Makefile.new
X		echo '#	IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
X		echo '#	see make depend	above'>>Makefile.new
X		mv Makefile Makefile.bak
X		mv Makefile.new Makefile
X
X# DO NOT DELETE THIS LINE
Xbootinfo.o: /usr/include/curses.h
Xbootinfo.o: /usr/include/panel.h
Xbootinfo.o: /usr/include/sys/types.h
Xbootinfo.o: /usr/include/sys/bootinfo.h
Xbootinfo.o: u386mon.h
Xdetail.o: /usr/include/curses.h
Xdetail.o: /usr/include/panel.h
Xdetail.o: /usr/include/signal.h
Xdetail.o: /usr/include/string.h
Xdetail.o: /usr/include/fcntl.h
Xdetail.o: /usr/include/nlist.h
Xdetail.o: /usr/include/errno.h
Xdetail.o: /usr/include/time.h
Xdetail.o: /usr/include/pwd.h
Xdetail.o: /usr/include/sys/types.h
Xdetail.o: /usr/include/utmp.h
Xdetail.o: /usr/include/sys/utsname.h
Xdetail.o: /usr/include/sys/stat.h
Xdetail.o: /usr/include/sys/ascii.h
Xdetail.o: /usr/include/sys/param.h
Xdetail.o: /usr/include/sys/bootinfo.h
Xdetail.o: /usr/include/sys/tuneable.h
Xdetail.o: /usr/include/sys/sysinfo.h
Xdetail.o: /usr/include/sys/sysmacros.h
Xdetail.o: /usr/include/sys/immu.h
Xdetail.o: /usr/include/sys/region.h
Xdetail.o: /usr/include/sys/proc.h
Xdetail.o: /usr/include/sys/var.h
Xdetail.o: nlsym.h
Xdetail.o: libkmem.h
Xdetail.o: libnlsym.h
Xdetail.o: u386mon.h
Xdet_proc.o: /usr/include/curses.h
Xdet_proc.o: /usr/include/panel.h
Xdet_proc.o: /usr/include/signal.h
Xdet_proc.o: /usr/include/string.h
Xdet_proc.o: /usr/include/fcntl.h
Xdet_proc.o: /usr/include/nlist.h
Xdet_proc.o: /usr/include/errno.h
Xdet_proc.o: /usr/include/time.h
Xdet_proc.o: /usr/include/pwd.h
Xdet_proc.o: /usr/include/sys/types.h
Xdet_proc.o: /usr/include/utmp.h
Xdet_proc.o: /usr/include/sys/stat.h
Xdet_proc.o: /usr/include/sys/ascii.h
Xdet_proc.o: /usr/include/sys/param.h
Xdet_proc.o: /usr/include/sys/bootinfo.h
Xdet_proc.o: /usr/include/sys/tuneable.h
Xdet_proc.o: /usr/include/sys/sysinfo.h
Xdet_proc.o: /usr/include/sys/sysmacros.h
Xdet_proc.o: /usr/include/sys/immu.h
Xdet_proc.o: /usr/include/sys/region.h
Xdet_proc.o: /usr/include/sys/proc.h
Xdet_proc.o: /usr/include/sys/fs/s5dir.h
Xdet_proc.o: /usr/include/sys/user.h
Xdet_proc.o: /usr/include/sys/var.h
Xdet_proc.o: nlsym.h
Xdet_proc.o: libkmem.h
Xdet_proc.o: libmem.h
Xdet_proc.o: libswap.h
Xdet_proc.o: libnlsym.h
Xdet_proc.o: u386mon.h
Xdisputil.o: /usr/include/curses.h
Xdisputil.o: /usr/include/panel.h
Xdisputil.o: /usr/include/sys/types.h
Xdisputil.o: u386mon.h
Xlibkmem.o: /usr/include/sys/types.h
Xlibkmem.o: /usr/include/fcntl.h
Xlibkmem.o: libkmem.h
Xlibmem.o: /usr/include/sys/types.h
Xlibmem.o: /usr/include/fcntl.h
Xlibmem.o: libmem.h
Xlibswap.o: /usr/include/sys/types.h
Xlibswap.o: /usr/include/fcntl.h
Xlibswap.o: libswap.h
Xlibnlsym.o: /usr/include/stdio.h
Xlibnlsym.o: /usr/include/sys/types.h
Xlibnlsym.o: /usr/include/sys/stat.h
Xlibnlsym.o: /usr/include/fcntl.h
Xlibnlsym.o: /usr/include/nlist.h
Xlibnlsym.o: nlsym.h
Xlibnlsym.o: libnlsym.h
Xnlsym.o: /usr/include/stdio.h
Xnlsym.o: /usr/include/sys/types.h
Xnlsym.o: /usr/include/sys/stat.h
Xnlsym.o: /usr/include/fcntl.h
Xnlsym.o: /usr/include/nlist.h
Xnlsym.o: nlsym.h
Xproc.o: /usr/include/curses.h
Xproc.o: /usr/include/panel.h
Xproc.o: /usr/include/sys/types.h
Xproc.o: /usr/include/sys/param.h
Xproc.o: /usr/include/sys/immu.h
Xproc.o: /usr/include/sys/region.h
Xproc.o: /usr/include/sys/proc.h
Xproc.o: /usr/include/sys/var.h
Xproc.o: /usr/include/nlist.h
Xproc.o: nlsym.h
Xproc.o: libkmem.h
Xproc.o: libnlsym.h
Xproc.o: u386mon.h
Xtune.o: /usr/include/curses.h
Xtune.o: /usr/include/panel.h
Xtune.o: /usr/include/sys/types.h
Xtune.o: /usr/include/sys/tuneable.h
Xtune.o: u386mon.h
Xu386mon.o: /usr/include/curses.h
Xu386mon.o: /usr/include/panel.h
Xu386mon.o: /usr/include/signal.h
Xu386mon.o: /usr/include/string.h
Xu386mon.o: /usr/include/fcntl.h
Xu386mon.o: /usr/include/nlist.h
Xu386mon.o: /usr/include/errno.h
Xu386mon.o: /usr/include/time.h
Xu386mon.o: /usr/include/sys/types.h
Xu386mon.o: /usr/include/sys/lock.h
Xu386mon.o: /usr/include/sys/utsname.h
Xu386mon.o: /usr/include/sys/stat.h
Xu386mon.o: /usr/include/sys/ascii.h
Xu386mon.o: /usr/include/sys/param.h
Xu386mon.o: /usr/include/sys/bootinfo.h
Xu386mon.o: /usr/include/sys/tuneable.h
Xu386mon.o: /usr/include/sys/sysinfo.h
Xu386mon.o: /usr/include/sys/sysmacros.h
Xu386mon.o: /usr/include/sys/immu.h
Xu386mon.o: /usr/include/sys/region.h
Xu386mon.o: /usr/include/sys/proc.h
Xu386mon.o: /usr/include/sys/var.h
Xu386mon.o: nlsym.h
Xu386mon.o: libkmem.h
Xu386mon.o: libmem.h
Xu386mon.o: libswap.h
Xu386mon.o: libnlsym.h
Xu386mon.o: u386mon.h
Xvar.o: /usr/include/curses.h
Xvar.o: /usr/include/panel.h
Xvar.o: /usr/include/sys/types.h
Xvar.o: /usr/include/sys/var.h
Xvar.o: u386mon.h
X#	DEPENDENCIES MUST END AT END OF	FILE
X#	IF YOU PUT STUFF HERE IT WILL GO AWAY
X#	see make depend	above
SHAR_EOF
$TOUCH -am 0715025090 Makefile.isc &&
chmod 0644 Makefile.isc ||
echo "restore of Makefile.isc failed"
set `wc -c Makefile.isc`;Wc_c=$1
if test "$Wc_c" != "7951"; then
	echo original size 7951, current size $Wc_c
fi
# ============= bootinfo.c ==============
echo "x - extracting bootinfo.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > bootinfo.c &&
X/* CHK=0xE205 */
X/*+-------------------------------------------------------------------------
X	bootinfo.c - u386mon bootinfo struct display
X
X  Defined functions:
X	bmemf_text(flags)
X	display_bootinfo(win,y,x)
X
XWe try to be dynamic with memory block counts, but if the sum of
Xmemavailcnt and memusedcnt ever exceeds 7, we will lose in 24 line
Xsessions (8 in 25 line, 9 in 43 line)
X
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-11-1990-17:19-root@n4hgf-more input from trb@ima.ima.isc.com */
X/*:07-04-1990-01:28-root@n4hgf-alan@cms2.lonestar.org reported missing M_ */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-25-1990-03:18-wht@n4hgf-ODT/3.2.1 has B_MEM_CANTDMA not B_MEM_NODMA */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:06-17-1990-14:59-wht-creation */
X
X#define M_TERMINFO
X
X#include <curses.h>
X#undef timeout /* conflict in curses.h and bootinfo.h per trb@ima.ima.isc.com */
X#include <panel.h>
X#include <sys/types.h>
X#include <sys/bootinfo.h>
X#include "u386mon.h"
X
X/*+-------------------------------------------------------------------------
X	bmemf_text(flags)
X--------------------------------------------------------------------------*/
Xchar *
Xbmemf_text(flags)
Xulong flags;
X{
Xstatic char hex_errant[16];
Xulong orig_flags = flags;
X
X#ifdef B_MEM_DOWN		/* SCO only */
X	flags &= ~B_MEM_DOWN;
X#endif
X#ifdef B_MEM_BASE		/* ISC only (or is it S5R3.2.2?) */
X	flags &= ~B_MEM_BASE;
X#endif
X#ifdef B_MEM_EXPANS		/* ISC */
X	flags &= ~B_MEM_EXPANS;
X#endif
X#ifdef B_MEM_SHADOW		/* ISC */
X	flags &= ~B_MEM_SHADOW;
X#endif
X#ifdef B_MEM_TREV		/* ISC */
X	flags &= ~B_MEM_TREV;
X#endif
X
X	if(!flags)
X		return("    ");
X	switch(flags)
X	{
X#ifdef B_MEM_RSRVD
X		case B_MEM_RSRVD: return("RSVD");
X#endif
X#ifdef B_MEM_KBSS
X		case B_MEM_KBSS:  return("KBSS");
X#endif
X#ifdef B_MEM_KTEXT
X		case B_MEM_KTEXT: return("KTXT");
X#endif
X#ifdef B_MEM_KDATA
X		case B_MEM_KDATA: return("KDTA");
X#endif
X#ifdef B_MEM_NODMA
X		case B_MEM_NODMA: return("NODM");
X#endif
X#ifdef B_MEM_CANTDMA
X		case B_MEM_CANTDMA: return("NODM");
X#endif
X	}
X	sprintf(hex_errant,"%04x",(ushort)orig_flags);
X	return(hex_errant);
X}	/* end of bmemf_text */
X
X/*+-------------------------------------------------------------------------
X	ISC_machinetype_text(machine)
X--------------------------------------------------------------------------*/
X#ifdef ME_COMPAQVGA	/* ISC machdep.h */
Xchar *
XISC_machinetype_text(machine)
Xunsigned char machine;
X{
X
X	switch(machine)
X	{
X#ifdef M_UNKNOWN	/* some ISC bootinfo.h do not have these */
X		case M_UNKNOWN:
X			return("");
X			break;
X#endif
X#ifdef M_COMPAQ
X		case M_COMPAQ:
X			return("Compaq");
X			break;
X#endif
X#ifdef M_PS2
X		case M_PS2:
X			return("PS/2");
X			break;
X#endif
X#ifdef M_AT
X		case M_AT:
X			return("Generic 386");
X			break;
X#endif
X#ifdef M_ATT
X		case M_ATT:
X			return("AT&T 6386");
X			break;
X#endif
X#ifdef M_ATT5
X		case M_ATT5:
X			return("AT&T 6386");
X			break;
X#endif
X#ifdef M_M380
X		case M_M380:
X			return("Olivetti M380");
X			break;
X#endif
X#ifdef M_DELL
X		case M_DELL:
X			return("Dell 386");
X			break;
X#endif
X#ifdef M_D325
X		case M_D325:
X			return("Dell 325");
X			break;
X#endif
X#ifdef M_ALR
X		case M_ALR:
X			return("Adv Logic Res");
X			break;
X#endif
X#ifdef M_ZDS
X		case M_ZDS:
X			return("Zenith Data");
X			break;
X#endif
X	}
X	return("i386");
X}	/* end of ISC_machinetype_text */
X#endif
X
X/*+-------------------------------------------------------------------------
X	ISC_displaytype_text(adapter)
X--------------------------------------------------------------------------*/
X#ifdef ME_COMPAQVGA	/* ISC machdep.h */
Xchar *
XISC_displaytype_text(adapter)
Xunsigned char adapter;
X{
X
X	switch(adapter)
X	{
X		case ME_UNKNOWN:
X			return("unknown to sys");
X			break;
X		case ME_EGA:
X			return("EGA");
X			break;
X		case ME_CGA80:
X			return("CGA");
X			break;
X		case ME_MONO:
X			return("MONO");
X			break;
X		case ME_COMPAQHR:
X			return("Compaq mono");
X			break;
X		case ME_Z449:
X			return("Zenith Z449");
X			break;
X		case ME_T5100:
X			return("Toshiba T5100");
X			break;
X		case ME_COMPAQVGA:
X			return("Compaq VGA");
X			break;
X		case ME_OTHERVGA:
X			return("VGA");
X			break;
X#ifdef ME_PVGA1
X		case ME_PVGA1:
X			return("Paradise VGA1");
X			break;
X#endif /*ME_PVGA1*/
X#ifdef ME_V7VGA
X		case ME_V7VGA:
X			return("Video 7 VGA");
X			break;
X#endif /*ME_V7VGA*/
X	}
X	return("???");
X}	/* end of ISC_displaytype_text */
X#endif
X
X/*+-------------------------------------------------------------------------
X	display_bootinfo(win,y,x)
X--------------------------------------------------------------------------*/
Xvoid
Xdisplay_bootinfo(win,y,x)
XWINDOW *win;
Xint y;
Xint x;
X{
Xregister itmp;
Xregister struct bootmem *bmem;
X
X	use_cp(win,cpBANNER);
X	wmove(win,y++,x);
X	waddstr(win,"-- Bootinfo ----------");
X#ifdef M_UNIX	/* ISC doesn't have this in struct */
X	wmove(win,y++,x);
X	disp_static_long(win,"basemem  ","%7ldk     ",bootinfo.basemem / 1024);
X	wmove(win,y++,x);
X	disp_static_long(win,"extmem   ","%7ldk     ",bootinfo.extmem / 1024);
X#endif
X#ifdef ME_COMPAQVGA	/* ISC machdep.h */
X	wmove(win,y++,x);
X	wprintw(win,"machine %14.14s",
X		ISC_machinetype_text(bootinfo.machenv.machine));
X	wmove(win,y++,x);
X	wprintw(win,"disp %17.17s",
X		ISC_displaytype_text(bootinfo.machenv.adapter));
X#endif
X	wmove(win,y++,x);
X	disp_static_long(win,"bflags   ","%08lx     ",bootinfo.bootflags);
X
X	wmove(win,y++,x); waddstr(win,"memory available      ");
X	for(itmp = 0; itmp < bootinfo.memavailcnt; itmp++)
X	{
X		bmem = &bootinfo.memavail[itmp];
X#ifdef B_MEM_DOWN
X		if(bmem->flags & B_MEM_DOWN)
X		{
X			bmem->base -= bmem->extent;
X			bmem->flags &= ~B_MEM_DOWN;
X		}
X#endif
X		wmove(win,y++,x);
X		wprintw(win,"%08lx %08lx %s",bmem->base,bmem->extent,
X			bmemf_text(bmem->flags));
X	}
X
X	wmove(win,y++,x); waddstr(win,"memory used           ");
X	for(itmp = 0; itmp < bootinfo.memusedcnt; itmp++)
X	{
X		bmem = &bootinfo.memused[itmp];
X#ifdef B_MEM_DOWN
X		if(bmem->flags & B_MEM_DOWN)
X		{
X			bmem->base -= bmem->extent;
X			bmem->flags &= ~B_MEM_DOWN;
X		}
X#endif
X		wmove(win,y++,x);
X		wprintw(win,"%08lx %08lx %s",bmem->base,bmem->extent,
X			bmemf_text(bmem->flags));
X	}
X
X}	/* end of display_bootinfo */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of bootinfo.c */
SHAR_EOF
$TOUCH -am 0715025090 bootinfo.c &&
chmod 0644 bootinfo.c ||
echo "restore of bootinfo.c failed"
set `wc -c bootinfo.c`;Wc_c=$1
if test "$Wc_c" != "6342"; then
	echo original size 6342, current size $Wc_c
fi
# ============= detail.c ==============
echo "x - extracting detail.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > detail.c &&
X/* CHK=0xCDFD */
X/*+-------------------------------------------------------------------------
X	detail.c - UNIX 386 system monitor detail window
X
X  Defined functions:
X	detail_init()
X	detail_panel_cmd(cmd)
X	detail_panel_update()
X	detpanel_destroy()
X	detpanel_extra_init()
X	detpanel_extra_update()
X	detpanel_ps_init(full43)
X	detpanel_ps_update()
X	detpanel_sio_init()
X	detpanel_sio_update()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-10-1990-14:53-root@n4hgf-clear msg line on detail cmd - fix 24-line bug */
X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
X/*:06-25-1990-17:34-wht@n4hgf-add detail extra for 25 line tubes */
X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
X/*:06-15-1990-18:32-wht@n4hgf-creation */
X
X#define M_TERMINFO
X
X#include <curses.h>
X#undef timeout /* conflict in curses.h and bootinfo.h per trb@ima.ima.isc.com */
X#include <panel.h>
X#include <signal.h>
X#include <string.h>
X#include <fcntl.h>
X#include <nlist.h>
X#include <errno.h>
X#include <time.h>
X#include <pwd.h>
X#include <sys/types.h>
X#include <utmp.h>
X#include <sys/utsname.h>
X#include <sys/stat.h>
X#include <sys/ascii.h>
X#undef NGROUPS_MAX
X#undef NULL
X#include <sys/param.h>
X#include <sys/bootinfo.h>
X#include <sys/tuneable.h>
X#include <sys/sysinfo.h>
X#include <sys/sysmacros.h>
X#include <sys/immu.h>
X#include <sys/region.h>
X#include <sys/proc.h>
X#include <sys/var.h>
X
X#include "nlsym.h"
X#include "libkmem.h"
X#include "libnlsym.h"
X#include "u386mon.h"
X
X#define DPT_NONE		0
X#define DPT_PS			1
X#define DPT_PS_LONG		2
X#define DPT_EXTRA		3
X#define DPT_SIO			4
X
XPANEL *mkpanel();
X
Xextern PANEL *pscr;
Xextern WINDOW *wscr;
X
XPANEL *pdet;
XWINDOW *wdet = (WINDOW *)0;
Xu_char detpanel_type = DPT_NONE;
Xint detpanel_length;
Xint detpanel_cols;
X
X/*+-------------------------------------------------------------------------
X	detpanel_ps_init(full43)
X--------------------------------------------------------------------------*/
Xvoid
Xdetpanel_ps_init(full43)
Xint full43;
X{
X/*
X#define DETAIL_PS_COLS ((LINES >= 43) ? EXTRA4_TLX - 1 : PER_SEC4_TLX)
Xdetpanel_cols = DETAIL_PS_COLS;
X*/
X
X#define DETAIL_PS_TLY ((LINES >= 43) ? ((full43)?PER_SEC_TLY:PER_SEC_TLY+14)\
X                                     : PER_SEC_TLY)
X
X#define DETAIL_PS_LENGTH		(MSG_TLY - DETAIL_PS_TLY)
X
X	detpanel_length = DETAIL_PS_LENGTH;
X	detpanel_cols = COLS;
X	if(!(pdet = mkpanel(detpanel_length,detpanel_cols,DETAIL_PS_TLY,0)))
X	{
X		leave_text("cannot make detail panel",1);
X	}
X	show_panel(pdet);
X	top_panel(pdet);
X	wdet = panel_window(pdet);
X	display_proc_stats(wdet,1);
X
X}	/* end of detpanel_ps_init */
X
X/*+-------------------------------------------------------------------------
X	detpanel_ps_update()
X--------------------------------------------------------------------------*/
Xvoid
Xdetpanel_ps_update()
X{
X	display_proc_stats(wdet,0);
X}	/* end of detpanel_ps_update */
X
X/*+-------------------------------------------------------------------------
X	detpanel_extra_init()
X--------------------------------------------------------------------------*/
Xvoid
Xdetpanel_extra_init()
X{
X#define DETAIL_EXTRA_TLY		PER_SEC_TLY
X#define DETAIL_EXTRA_LENGTH		(MSG_TLY - DETAIL_EXTRA_TLY)
X
X	detpanel_length = DETAIL_EXTRA_LENGTH;
X	detpanel_cols = COLS;
X	if(!(pdet = mkpanel(detpanel_length,detpanel_cols,DETAIL_EXTRA_TLY,0)))
X	{
X		leave_text("cannot make detail panel",1);
X	}
X	show_panel(pdet);
X	top_panel(pdet);
X	wdet = panel_window(pdet);
X	display_var(wdet,0,EXTRA1_TLX);
X	display_bootinfo(wdet,0,EXTRA2_TLX);
X	display_tune(wdet,0,EXTRA3_TLX);
X	display_proc(wdet,0,EXTRA4_TLX);
X
X}	/* end of detpanel_extra_init */
X
X/*+-------------------------------------------------------------------------
X	detpanel_extra_update()
X--------------------------------------------------------------------------*/
Xvoid
Xdetpanel_extra_update()
X{
X	display_proc(wdet,0,EXTRA4_TLX);
X}	/* end of detpanel_extra_update */
X
X/*+-------------------------------------------------------------------------
X	detpanel_sio_init()
X--------------------------------------------------------------------------*/
X#ifdef M_UNIX
Xvoid
Xdetpanel_sio_init()
X{
X#define DETAIL_SIO_TLY ((LINES >= 43) ? (PER_SEC_TLY+14) : PER_SEC_TLY)
X#define DETAIL_SIO_LENGTH		(CMD_TLY - DETAIL_SIO_TLY)
X
X	detpanel_length = DETAIL_SIO_LENGTH;
X	detpanel_cols = COLS;
X	if(!(pdet = mkpanel(detpanel_length,detpanel_cols,DETAIL_SIO_TLY,0)))
X	{
X		leave_text("cannot make detail panel",1);
X	}
X	show_panel(pdet);
X	top_panel(pdet);
X	wdet = panel_window(pdet);
X	display_sio_summary(wdet,1);
X}	/* end of detpanel_sio_init */
X#endif
X
X/*+-------------------------------------------------------------------------
X	detpanel_sio_update()
X--------------------------------------------------------------------------*/
X#ifdef M_UNIX
Xvoid
Xdetpanel_sio_update()
X{
X	display_sio_summary(wdet,0);
X}	/* end of detpanel_sio_update */
X#endif
X
X/*+-------------------------------------------------------------------------
X	detpanel_destroy()
X--------------------------------------------------------------------------*/
Xvoid
Xdetpanel_destroy()
X{
X	hide_panel(pdet);
X	delwin(wdet);
X	wdet = (WINDOW *)0;
X	del_panel(pdet);
X	top_panel(pscr);
X	disp_msg(cpINFO,"");
X	detpanel_type = DPT_NONE;
X}	/* end of detpanel_destroy */
X
X/*+-------------------------------------------------------------------------
X	detail_panel_cmd(cmd)
X
X  command: m main screen
X           p proc status
X--------------------------------------------------------------------------*/
Xvoid
Xdetail_panel_cmd(cmd)
Xchtype cmd;
X{
X	disp_msg(cpINFO,"");
X	switch(cmd)
X	{
X		case 'm':
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			break;
X
X		case 'P':
X			if(detpanel_type == DPT_PS_LONG)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_ps_init(1);
X			detpanel_type = DPT_PS_LONG;
X			break;
X
X		case 'p':
X			if(detpanel_type == DPT_PS)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_ps_init(0);
X			detpanel_type = DPT_PS;
X			break;
X
X		case 'e':
X			if(LINES >= 43)
X				break;
X			if(detpanel_type == DPT_EXTRA)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_extra_init();
X			detpanel_type = DPT_EXTRA;
X			break;
X
X#ifdef M_UNIX
X		case 's':
X			if(detpanel_type == DPT_SIO)
X				break;
X			if(detpanel_type != DPT_NONE)
X				detpanel_destroy();
X			detpanel_sio_init();
X			detpanel_type = DPT_SIO;
X			break;
X#endif
X
X	}
X}	/* end of detail_panel_cmd */
X
X/*+-------------------------------------------------------------------------
X	detail_panel_update()
X--------------------------------------------------------------------------*/
Xvoid
Xdetail_panel_update()
X{
X	switch(detpanel_type)
X	{
X		case DPT_PS:
X		case DPT_PS_LONG:
X			detpanel_ps_update();
X			break;
X		case DPT_EXTRA:
X			detpanel_extra_update();
X			break;
X#ifdef M_UNIX
X		case DPT_SIO:
X			detpanel_sio_update();
X			break;
X#endif
X	}
X}	/* end of detail_panel_update */
X
X/*+-------------------------------------------------------------------------
X	detail_init()
X--------------------------------------------------------------------------*/
Xvoid
Xdetail_init()
X{
X	det_proc_init();	/* see det_proc.c */
X}	/* end of detail_init */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of detail.c */
SHAR_EOF
$TOUCH -am 0715025090 detail.c &&
chmod 0644 detail.c ||
echo "restore of detail.c failed"
set `wc -c detail.c`;Wc_c=$1
if test "$Wc_c" != "7352"; then
	echo original size 7352, current size $Wc_c
fi
echo "End of part 1, continue with part 2"
exit 0
 
--------------------------------------------------------------------
Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
Sforzando (It., sfohr-tsahn'-doh).   A direction to perform the tone
or chord with special stress, or marked and sudden emphasis.