home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1506 < prev    next >
Internet Message Format  |  1990-12-28  |  50KB

  1. From: wht@n4hgf.uucp (Warren Tucker)
  2. Newsgroups: alt.sources
  3. Subject: u386mon 1.0, UNIX 386 system monitor, part 01/02
  4. Message-ID: <119@n4hgf.uucp>
  5. Date: 24 Jun 90 20:14:49 GMT
  6.  
  7. Submitted-by: wht@n4hgf
  8. Archive-name: u386mon.1.00/part01
  9.  
  10. This is u386mon, a "performance" monitor for SCO UNIX V/386.  It may
  11. work with other UNIX systems with a little work.  It requires terminfo
  12. style curses and will use color if you have it.  It works best with
  13. a 43 line (or greater) screen, but will work with a 25 line screen
  14. with some limitations.  It has been tested with 25 and 43 line screens
  15. on the multiscreen console and on a Wyse 60 (using terminfo wy60,
  16. yielding interesting "color" mappings).
  17.  
  18. #!/bin/sh
  19. # This is u386mon.1.00, a shell archive (shar 3.30)
  20. # made 06/24/1990 20:11 UTC by wht@n4hgf
  21. # Source directory /u1/src/u386mon
  22. #
  23. # existing files WILL be overwritten
  24. #
  25. # This shar contains:
  26. # length  mode       name
  27. # ------ ---------- ------------------------------------------
  28. #  10903 -rw-r--r-- README
  29. #   6843 -rw-r--r-- Makefile
  30. #   2456 -rw-r--r-- bootinfo.c
  31. #   4232 -rw-r--r-- detail.c
  32. #  15535 -rw-r--r-- det_proc.c
  33. #   4713 -rw-r--r-- disputil.c
  34. #   2441 -rw-r--r-- libkmem.c
  35. #   2443 -rw-r--r-- libmem.c
  36. #   1658 -rw-r--r-- libswap.c
  37. #   2312 -rw-r--r-- libnlsym.c
  38. #   2525 -rw-r--r-- nlsym.c
  39. #   3188 -rw-r--r-- proc.c
  40. #   1662 -rw-r--r-- tune.c
  41. #  26771 -rw-r--r-- u386mon.c
  42. #   1513 -rw-r--r-- var.c
  43. #    636 -rw-r--r-- libkmem.h
  44. #    632 -rw-r--r-- libmem.h
  45. #    557 -rw-r--r-- libswap.h
  46. #    603 -rw-r--r-- libnlsym.h
  47. #   5906 -rw-r--r-- lint_args.h
  48. #   4921 -rw-r--r-- nlsym.h
  49. #   2852 -rw-r--r-- u386mon.h
  50. #
  51. if touch 2>&1 | fgrep 'mmdd' > /dev/null
  52.  then TOUCH=touch
  53.  else TOUCH=true
  54. fi
  55. # ============= README ==============
  56. echo "x - extracting README (Text)"
  57. sed 's/^X//' << 'SHAR_EOF' > README &&
  58. Xu386mon README - last updated Fri Jun 22 19:31:50 EDT 1990
  59. X
  60. XThis is u386mon, a "performance" monitor for SCO UNIX V/386.  It may
  61. Xwork with other UNIX systems with a little work.  It requires terminfo
  62. Xstyle curses and will use color if you have it.  It works best with
  63. Xa 43 line (or greater) screen, but will work with a 25 line screen
  64. Xwith some limitations.  It has been tested with 25 and 43 line screens
  65. Xon the multiscreen console and on a Wyse 60 (using terminfo wy60,
  66. Xyielding interesting "color" mappings).
  67. X
  68. XThis little light show has already helped me diagnose the traditional
  69. X"stop-the-world-and-beat-disk-continually-for-15-seconds" problem as
  70. Xmemory exhaustion.  It has also been a good learning experience.
  71. X
  72. XRead through this and you will finally reach "How to get going" below.
  73. X
  74. XSample output
  75. X=============
  76. X(with 43-line screen; a 25 line screen will be missing Var/Bootinfo/Tune/Proc)
  77. X
  78. X u386mon xxxxx  n4hgf - i386 3.2                              03:12:48 wht@n4hgf
  79. X---- CPU --- tot usr ker brk ---------------------------------------------------
  80. X Instant %    17   4  13   0 uukkkkkk
  81. X 5 Sec Avg %  71  48  23   0 uuuuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkk
  82. X10 Sec Avg %  82  66  16   0 uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuukkkkkkkk
  83. X---- Wait -- tot  io swp pio -- (% of real time) -------------------------------
  84. X Instant %     0   0   0   0
  85. X 5 Sec Avg %   2   2   0   0 i
  86. X10 Sec Avg %   1   1   0   0
  87. X---- Sysinfo/Minfo --- (last 1 second activity) --------------------------------
  88. Xbread       0  rawch      0     pswitch    8    vfault    0    unmodfl   0
  89. Xbwrite      7  canch      0     syscall   16    demand    0    psoutok   0
  90. Xlread       0  outch   3076     sysread    4    pfault    0    psinfai   0
  91. Xlwrite      7                   syswrit    5    cw        0    psinok    0
  92. Xphread      0  msg        0     sysfork    0    steal     0    rsout     0
  93. Xphwrit      0  sema       0     sysexec    0    frdpgs    0    rsin      0
  94. Xiget        0                                   vfpg      0
  95. Xnamei       0  maxmem    5716k  runque     1    sfpg      0    pages on
  96. Xdirblk      0  frmem     3036k  runocc     1    vspg      0    swap      0
  97. Xreadch  34680  mem used    47%  swpque     0    sspg      0    cache     0
  98. Xwritch   3076  nswap    10000k  swpocc     0    unmodsw   0    file      0
  99. X               frswp    10000k
  100. X               swp used     0%
  101. X
  102. X
  103. X
  104. X-- Var ---------  -- Bootinfo ----------  -- Tune ---------  -- Proc ---
  105. Xv_buf        600  basemem    655360       t_gpgslo       25  sleep    23
  106. Xv_inode      200  extmem    6291456       t_gpgshi       40  run       0
  107. Xv_file       200  bflags   00000000       t_gpgsmsk   0x420  zombie    0
  108. Xv_mount        5  memory avail            t_ageintvl      9  stop      0
  109. Xv_proc       100  00000000 000a0000       t_maxsc         1  idle      0
  110. Xv_clist      200  00100000 00600000       t_maxfc         1  onproc    1
  111. Xv_sptmap      50  00f40000 00060000 NODM  t_maxumem    2560  xbrk      0
  112. Xv_vhndfrac    16  memory used             t_bdflushr      1  total    24
  113. Xv_maxpmem      0  00000000 00004000 RSVD  t_minarmem     25  in mem   24
  114. X                  006b9000 00038000 KBSS  t_minasmem     25
  115. X                  006f1000 0000f000 KDTA
  116. X                  00fa5000 0005b000 KTXT
  117. X
  118. X
  119. XThe main display
  120. X================
  121. X
  122. XA brief description of reported information:
  123. X
  124. X1.  The CPU utilization is shown with smoothing of 1 ("instant"),
  125. X    5 and 10 seconds.  Total CPU usage is shown, with user, kernel
  126. X    and "break" subdivided.  Most performance utilities (vmstat)
  127. X    lump kernel (CPU_KERNEL) and wait (CPU_WAIT) times together
  128. X    as kernel time.  u386mon considers CPU_WAIT time as idle (the
  129. X    CPU could have been doing something if an otherwise ready process
  130. X    wasn't waited).
  131. X
  132. X    On a color display, total cpu utilization is displayed in
  133. X    green if the cpu utilization is below 70%, yellow if utilization
  134. X    is between 70% and 89% and red if 90% or above.
  135. X
  136. X2.  The Wait display shows the 1 ("instant"), 5 and 10 second smoothed
  137. X    percentages of real time no process could be run because otherwise
  138. X    ready to run processes were waiting on logical, swap or physical I/O.
  139. X
  140. X    On a color display, total wait time is displayed in green if it is
  141. X    below 30%, yellow if utilization is between 30% and 49% and red if
  142. X    50% or above.
  143. X
  144. X3.  Sysinfo/Minfo display shows, generally, the number of events for a
  145. X    measured value since the last display update.  For example, runque
  146. X    shows the number of times a process was placed on the run queue.
  147. X    An exception is the memory and swap space fields:  These numbers
  148. X    reflect absolute current utilization.
  149. X
  150. X4.  If you run u386mon on a 43 line display, extra information is displayed
  151. X    on the bottom of the screen (from the struct var v, bootinfo
  152. X    and proc kernel databases).
  153. X
  154. X5.  On a color display, static numeric values, such as maxmem appear
  155. X    in blue (the same color as screen literals/labels).  Dynamic
  156. X    numeric values are displayed in green, with the exception of
  157. X    total cpu and wait percentages, which appear in light green,
  158. X    red or yellow.
  159. X
  160. X6.  An "INEXACT" indication on the top line means that u386mon was
  161. X    not scheduled quickly enough to capture accurate 1 second
  162. X    values.  Continued INEXACT indication suggests the 5 and 10
  163. X    second smoothed values are also wrong.
  164. X
  165. X    An "INVALID" indication means u386mon was not scheduled for 4
  166. X    seconds or more; all dynamic values are suspect.
  167. X    IN GENERAL, if you see any red characters on the display,
  168. X    immediately take grain of salt. If you have no color screen
  169. X    and still see red, add tequila to salt.
  170. X
  171. X7.  If you are running as root, you may use the -l switch or the
  172. X    'l' command to lock u386mon into memory.  If you do this, PLOCK
  173. X    will appear at the top of the screen to remind you of this hoggy
  174. X    behavior.  The u386mon process will not be listed in a process
  175. X    status display since SSYS (locked, resident) processes are not
  176. X    shown.
  177. X
  178. XProcess Status Display
  179. X======================
  180. X
  181. X1.  Pressing 'p' causes a process status display of sorts to be
  182. X    shown, overlaying Sysinfo/Minfo on a 25 line screen or
  183. X    Var/Bootinfo/Tune/Proc on a 43 line screen.  On a 43 line screen, 'P'
  184. X    causes a larger ps display to be shown, overlaying Sysinfo/Minfo and
  185. X    Var/Bootinfo/Tune/Proc.
  186. X
  187. X    Sample output:
  188. X
  189. XS     USER   PID  CPU PRI NI  UCPU   SCPU  SIZE TTY CMD
  190. Xs     root    148   0  26 20   0:00   0:05  108  ?? /etc/cron
  191. Xs      wht  14946   2  39 20   0:02   0:11  224  05 TMR 01000a12
  192. Xs      wht  14947   2  39 20   0:02   0:11  220  05 TMR 01011101
  193. Xs      wht  14950   0  27 20   0:00   0:02  228  05 IP 01000a12
  194. Xs      wht  14951   1  27 20   0:00   0:02  224  05 IP 01011101
  195. Xs      wht  14952   0  27 20   0:01   0:02  228  05 TP4 01000a12
  196. Xs      wht  14953   1  27 20   0:01   0:03  224  05 TP4 01011101
  197. Xs      wht  14957   0  27 20   0:00   0:04  200  05 smpad.x
  198. Xs      wht  14960   1  27 20   0:00   0:04  204  05 mmpad.x
  199. Xs     root  15044   0  28 20   0:01   0:01  296  12 vi README
  200. Xs     uucp  15053   0  30 26   0:00   0:00  696  ?? /usr/lib/uucp/uusched
  201. Xs     uucp  15055   0  30 26   0:00   0:00  748  ?? UUCICO -r1 -sgatech
  202. Xs     uucp  15060   0  28 26   0:00   0:00  768  ?? dialTBIT tty2E 8944201UC 192
  203. X
  204. X    NOTES
  205. X    a.   S - two character status
  206. X            1st character - process status
  207. X               s - sleeping
  208. X               R - ready to run (might be running if u386mon were not)
  209. X               z - zombie
  210. X               d - stopped by debugger
  211. X               i - idle (in creation?)
  212. X               p - running on processor (on single CPU systems, only u386mon
  213. X                   will show this)
  214. X               x - XBREAK - process growing or shrinking
  215. X            2nd character - process swap status
  216. X               S - process is swapped
  217. X               blank - process is in memory
  218. X
  219. X    b.  If the process is running with setuid, a '#' appears to
  220. X        the right of the username.
  221. X
  222. X    c.  On color systems, processes ready to run are shown in yellow
  223. X        unless they are ready, but swapped out, in which case they
  224. X        are shown in red.
  225. X
  226. X3.  Since a limited space is available for displaying process
  227. X    status, particularly on a 25-line screen, a selective elimination
  228. X    algorithm is used to whittle the list when insufficient room
  229. X    is available.  init (pid 1) and system/resident (SSYS)
  230. X    processes are never displayed.  When a display cycle is to begin
  231. X    and there is not room for all of the processes to be shown,
  232. X    processes are eliminated in the following order:
  233. X
  234. X    a. 'getty', 'uugetty', 'sh', 'csh', and 'ksh'
  235. X    b. swapped and zombie processes
  236. X    c. sleeping processes
  237. X
  238. X    If there is still insufficient room, an indication to the effect
  239. X    is displayed (tough cookies).
  240. X
  241. X
  242. XA $0.0002 tour: why nlsym and /unix.nlsym?
  243. X==========================================
  244. X
  245. XAccess to kernel (/dev/kmem) and physical (/dev/mem) memory and
  246. Xswap (/dev/swap) is required for u386mon to do its thing.
  247. XTo find kmem addresses of interest, an nlist(S) call must be made
  248. Xagainst /unix.  This can be quite expensive.
  249. X
  250. XThe 'nlist' procedure is performed by a separate program (nlsym)
  251. Xand the resulting nlist structure array is stored in /unix.nlsym.
  252. Xu386mon thus may obtain nlist information rapidly without nlist(S) each
  253. Xtime it is executed.  Also stored in /unix.nlsym is a stat structure of
  254. X/unix at the time of nlsym execution.  A unique word is stored at the
  255. Xend of the file in case /unix.nlsym's nlist structure is expanded for
  256. Xother applications.  The u386mon program reads /unix.nlsym by means
  257. Xof facilities in libnlsym.c.  If the stat structure in /unix.nlsym
  258. Xdoes not match a dynamic stat of /unix or if the unique word does
  259. Xnot match, the nlist information is not trusted and u386mon prompts
  260. Xthe user to run (or have run) the nlsym program to update /unix.nlsym.
  261. X
  262. XMany symbols are nlist'ed by nlsym which are not used by u386mon.
  263. XYou may find other uses for libnlsym/libkmem which makle use of them.
  264. X
  265. XHow to get going
  266. X================
  267. X
  268. X1.  you must run the make as root since u386mon must be setuid to
  269. X    'mem' and nlsym must produce /unix.nlsym.
  270. X
  271. X2.  nlsym must be run by root (the Makefile will do this the first time)
  272. X
  273. X3.  making against Makefile as root will
  274. X    a. make nlsym
  275. X    b. make u386mon and set-gid to group 'mem'
  276. X    c. run nlsym to produce /unix.nlsym
  277. X
  278. X4.  Sources are in 4-spaced tab format (please don't flame :-)).
  279. X
  280. X5.  You may have to chgrp mem /dev/swap; I did.  For some reason,
  281. X    I found the group name for /dev/swap on my system to be 'network'.
  282. X    I guess something may have been broken by my changing the group,
  283. X    but it hasn't bit me yet.
  284. X
  285. X6.  usage: u386mon [-l] [-p | -P]
  286. X    -l lock process into memory (if root)
  287. X    -p begin with short ps display
  288. X    -P begin with long ps display (if 43 line screen)
  289. X
  290. XComments are appreciated.
  291. XWarren Tucker N4HGF
  292. Xemory!n4hgf!wht -or- wht%n4hgf.uucp@emory.mathcs.emory.edu
  293. X
  294. SHAR_EOF
  295. $TOUCH -am 0624152190 README &&
  296. chmod 0644 README ||
  297. echo "restore of README failed"
  298. set `wc -c README`;Wc_c=$1
  299. if test "$Wc_c" != "10903"; then
  300.     echo original size 10903, current size $Wc_c
  301. fi
  302. # ============= Makefile ==============
  303. echo "x - extracting Makefile (Text)"
  304. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  305. X#+--------------------------------------------------------------
  306. X#  Makefile for nlsym utilities for SCO UNIX V/386
  307. X#  ...!emory!n4hgf!wht
  308. X#---------------------------------------------------------------
  309. X#+:EDITS:*/
  310. X#:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free
  311. X#:06-19-1990-21:37-wht@n4hgf-get ready for 0.08 release
  312. X
  313. XVERSION = 1.00
  314. X
  315. X#handle Sys V make "feature" of using SHELL
  316. XSHELL = /bin/sh
  317. X
  318. XCFLAGS = -c -Octl -DLINT_ARGS
  319. X
  320. XLIB = -lpanel -lcurses -lx
  321. X#FCRC = fcrc -u $*.c ;
  322. X
  323. X.c.o:;    $(FCRC) cc $(CFLAGS) $*.c 
  324. X
  325. XSRC = \
  326. X    bootinfo.c\
  327. X    detail.c\
  328. X    det_proc.c\
  329. X    disputil.c\
  330. X    libkmem.c\
  331. X    libmem.c\
  332. X    libswap.c\
  333. X    libnlsym.c\
  334. X    nlsym.c\
  335. X    proc.c\
  336. X    tune.c\
  337. X    u386mon.c\
  338. X    var.c
  339. X
  340. XHDR = \
  341. X    libkmem.h\
  342. X    libmem.h\
  343. X    libswap.h\
  344. X    libnlsym.h\
  345. X    lint_args.h\
  346. X    nlsym.h\
  347. X    u386mon.h
  348. X
  349. XNLSYM_OBJ =\
  350. X    nlsym.o
  351. X
  352. XU386MON_OBJ =\
  353. X    u386mon.o\
  354. X    detail.o\
  355. X    det_proc.o\
  356. X    bootinfo.o\
  357. X    proc.o\
  358. X    tune.o\
  359. X    var.o\
  360. X    disputil.o\
  361. X    libkmem.o\
  362. X    libmem.o\
  363. X    libswap.o\
  364. X    libnlsym.o
  365. X
  366. Xall: nlsym u386mon /unix.nlsym
  367. X
  368. Xnlsym: $(NLSYM_OBJ)
  369. X    cc -o $@ $(NLSYM_OBJ) $(LIB)
  370. X
  371. Xu386mon: $(U386MON_OBJ)
  372. X    cc -o $@ $(U386MON_OBJ) $(LIB)
  373. X    chmod 2711 u386mon
  374. X    chgrp mem u386mon
  375. X
  376. X/unix.nlsym: nlsym /unix
  377. X    nlsym
  378. X    chmod 644 /unix.nlsym
  379. X
  380. X#not delivered
  381. Xsrc.fls: $(SRC) Makefile
  382. X    ls $(SRC) > src.fls
  383. X
  384. Xlint_args: src.fls
  385. X    echo ' ' > lint_args.h
  386. X    csh zgcc src.fls lint_args.h $(CFLAGS)
  387. X
  388. Xclean:
  389. X    rm -f $(U386MON_OBJ) $(NLSYM_OBJ) \
  390. X        core u386mon.lint Makefile.bak src.fls mkdep.*
  391. X
  392. Xclobber: clean
  393. X    rm -f nlsym u386mon
  394. X
  395. Xlint:
  396. X    lint -ux *.c > u386mon.lint
  397. X
  398. X#for shar 3.27 or later
  399. Xshar:
  400. X    shar -a -n u386mon.$(VERSION) -l 50 -o $(VERSION).sh \
  401. X        README Makefile $(SRC) $(HDR)
  402. X
  403. X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
  404. X#
  405. Xdepend:
  406. X        rm -f mkdep.rule.tmp
  407. X        if test '$(SRC)' ;\
  408. X        then (grep '^#include' $(SRC) \
  409. X        | sed    -e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
  410. X            -e 's?:[^"]*"\([^"]*\)".*?: \1?'\
  411. X            -e 's?\(.*\)\.c?\1.o?'\
  412. X         >> mkdep.rule.tmp) ;\
  413. X        fi
  414. X
  415. X        echo '/^# DO NOT DELETE THIS LINE' >mkdep.ex.tmp
  416. X        echo '.+1,$$d' >>mkdep.ex.tmp
  417. X        echo 'r mkdep.rule.tmp' >> mkdep.ex.tmp
  418. X        echo 'w' >> mkdep.ex.tmp
  419. X        cp Makefile Makefile.new
  420. X        ex Makefile.new < mkdep.ex.tmp
  421. X        rm mkdep.ex.tmp mkdep.rule.tmp
  422. X        echo '#    DEPENDENCIES MUST END AT END OF    FILE' >>Makefile.new
  423. X        echo '#    IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
  424. X        echo '#    see make depend    above'>>Makefile.new
  425. X        mv Makefile Makefile.bak
  426. X        mv Makefile.new Makefile
  427. X
  428. X# DO NOT DELETE THIS LINE
  429. Xbootinfo.o: /usr/include/curses.h
  430. Xbootinfo.o: /usr/include/panel.h
  431. Xbootinfo.o: /usr/include/sys/types.h
  432. Xbootinfo.o: /usr/include/sys/bootinfo.h
  433. Xbootinfo.o: u386mon.h
  434. Xdetail.o: /usr/include/curses.h
  435. Xdetail.o: /usr/include/panel.h
  436. Xdetail.o: /usr/include/signal.h
  437. Xdetail.o: /usr/include/string.h
  438. Xdetail.o: /usr/include/fcntl.h
  439. Xdetail.o: /usr/include/nlist.h
  440. Xdetail.o: /usr/include/errno.h
  441. Xdetail.o: /usr/include/time.h
  442. Xdetail.o: /usr/include/pwd.h
  443. Xdetail.o: /usr/include/utmp.h
  444. Xdetail.o: /usr/include/sys/types.h
  445. Xdetail.o: /usr/include/sys/utsname.h
  446. Xdetail.o: /usr/include/sys/stat.h
  447. Xdetail.o: /usr/include/sys/ascii.h
  448. Xdetail.o: /usr/include/sys/param.h
  449. Xdetail.o: /usr/include/sys/bootinfo.h
  450. Xdetail.o: /usr/include/sys/tuneable.h
  451. Xdetail.o: /usr/include/sys/sysinfo.h
  452. Xdetail.o: /usr/include/sys/sysmacros.h
  453. Xdetail.o: /usr/include/sys/immu.h
  454. Xdetail.o: /usr/include/sys/region.h
  455. Xdetail.o: /usr/include/sys/proc.h
  456. Xdetail.o: /usr/include/sys/var.h
  457. Xdetail.o: nlsym.h
  458. Xdetail.o: libkmem.h
  459. Xdetail.o: libnlsym.h
  460. Xdetail.o: u386mon.h
  461. Xdet_proc.o: /usr/include/curses.h
  462. Xdet_proc.o: /usr/include/panel.h
  463. Xdet_proc.o: /usr/include/signal.h
  464. Xdet_proc.o: /usr/include/string.h
  465. Xdet_proc.o: /usr/include/fcntl.h
  466. Xdet_proc.o: /usr/include/nlist.h
  467. Xdet_proc.o: /usr/include/errno.h
  468. Xdet_proc.o: /usr/include/time.h
  469. Xdet_proc.o: /usr/include/pwd.h
  470. Xdet_proc.o: /usr/include/utmp.h
  471. Xdet_proc.o: /usr/include/sys/types.h
  472. Xdet_proc.o: /usr/include/sys/stat.h
  473. Xdet_proc.o: /usr/include/sys/ascii.h
  474. Xdet_proc.o: /usr/include/sys/param.h
  475. Xdet_proc.o: /usr/include/sys/bootinfo.h
  476. Xdet_proc.o: /usr/include/sys/tuneable.h
  477. Xdet_proc.o: /usr/include/sys/sysinfo.h
  478. Xdet_proc.o: /usr/include/sys/sysmacros.h
  479. Xdet_proc.o: /usr/include/sys/immu.h
  480. Xdet_proc.o: /usr/include/sys/region.h
  481. Xdet_proc.o: /usr/include/sys/proc.h
  482. Xdet_proc.o: /usr/include/sys/fs/s5dir.h
  483. Xdet_proc.o: /usr/include/sys/user.h
  484. Xdet_proc.o: /usr/include/sys/var.h
  485. Xdet_proc.o: nlsym.h
  486. Xdet_proc.o: libkmem.h
  487. Xdet_proc.o: libmem.h
  488. Xdet_proc.o: libswap.h
  489. Xdet_proc.o: libnlsym.h
  490. Xdet_proc.o: u386mon.h
  491. Xdisputil.o: /usr/include/curses.h
  492. Xdisputil.o: /usr/include/panel.h
  493. Xdisputil.o: /usr/include/sys/types.h
  494. Xdisputil.o: u386mon.h
  495. Xlibkmem.o: /usr/include/sys/types.h
  496. Xlibkmem.o: /usr/include/fcntl.h
  497. Xlibkmem.o: libkmem.h
  498. Xlibmem.o: /usr/include/sys/types.h
  499. Xlibmem.o: /usr/include/fcntl.h
  500. Xlibmem.o: libmem.h
  501. Xlibswap.o: /usr/include/sys/types.h
  502. Xlibswap.o: /usr/include/fcntl.h
  503. Xlibswap.o: libswap.h
  504. Xlibnlsym.o: /usr/include/stdio.h
  505. Xlibnlsym.o: /usr/include/sys/types.h
  506. Xlibnlsym.o: /usr/include/sys/stat.h
  507. Xlibnlsym.o: /usr/include/fcntl.h
  508. Xlibnlsym.o: /usr/include/nlist.h
  509. Xlibnlsym.o: nlsym.h
  510. Xlibnlsym.o: libnlsym.h
  511. Xnlsym.o: /usr/include/stdio.h
  512. Xnlsym.o: /usr/include/sys/types.h
  513. Xnlsym.o: /usr/include/sys/stat.h
  514. Xnlsym.o: /usr/include/fcntl.h
  515. Xnlsym.o: /usr/include/nlist.h
  516. Xnlsym.o: nlsym.h
  517. Xproc.o: /usr/include/curses.h
  518. Xproc.o: /usr/include/panel.h
  519. Xproc.o: /usr/include/sys/types.h
  520. Xproc.o: /usr/include/sys/param.h
  521. Xproc.o: /usr/include/sys/immu.h
  522. Xproc.o: /usr/include/sys/region.h
  523. Xproc.o: /usr/include/sys/proc.h
  524. Xproc.o: /usr/include/sys/var.h
  525. Xproc.o: /usr/include/nlist.h
  526. Xproc.o: nlsym.h
  527. Xproc.o: libkmem.h
  528. Xproc.o: libnlsym.h
  529. Xproc.o: u386mon.h
  530. Xtune.o: /usr/include/curses.h
  531. Xtune.o: /usr/include/panel.h
  532. Xtune.o: /usr/include/sys/types.h
  533. Xtune.o: /usr/include/sys/tuneable.h
  534. Xtune.o: u386mon.h
  535. Xu386mon.o: /usr/include/curses.h
  536. Xu386mon.o: /usr/include/panel.h
  537. Xu386mon.o: /usr/include/signal.h
  538. Xu386mon.o: /usr/include/string.h
  539. Xu386mon.o: /usr/include/fcntl.h
  540. Xu386mon.o: /usr/include/nlist.h
  541. Xu386mon.o: /usr/include/errno.h
  542. Xu386mon.o: /usr/include/time.h
  543. Xu386mon.o: /usr/include/sys/types.h
  544. Xu386mon.o: /usr/include/sys/lock.h
  545. Xu386mon.o: /usr/include/sys/utsname.h
  546. Xu386mon.o: /usr/include/sys/stat.h
  547. Xu386mon.o: /usr/include/sys/ascii.h
  548. Xu386mon.o: /usr/include/sys/param.h
  549. Xu386mon.o: /usr/include/sys/bootinfo.h
  550. Xu386mon.o: /usr/include/sys/tuneable.h
  551. Xu386mon.o: /usr/include/sys/sysinfo.h
  552. Xu386mon.o: /usr/include/sys/sysmacros.h
  553. Xu386mon.o: /usr/include/sys/immu.h
  554. Xu386mon.o: /usr/include/sys/region.h
  555. Xu386mon.o: /usr/include/sys/proc.h
  556. Xu386mon.o: /usr/include/sys/var.h
  557. Xu386mon.o: nlsym.h
  558. Xu386mon.o: libkmem.h
  559. Xu386mon.o: libmem.h
  560. Xu386mon.o: libswap.h
  561. Xu386mon.o: libnlsym.h
  562. Xu386mon.o: u386mon.h
  563. Xvar.o: /usr/include/curses.h
  564. Xvar.o: /usr/include/panel.h
  565. Xvar.o: /usr/include/sys/types.h
  566. Xvar.o: /usr/include/sys/var.h
  567. Xvar.o: u386mon.h
  568. X#    DEPENDENCIES MUST END AT END OF    FILE
  569. X#    IF YOU PUT STUFF HERE IT WILL GO AWAY
  570. X#    see make depend    above
  571. SHAR_EOF
  572. $TOUCH -am 0624152590 Makefile &&
  573. chmod 0644 Makefile ||
  574. echo "restore of Makefile failed"
  575. set `wc -c Makefile`;Wc_c=$1
  576. if test "$Wc_c" != "6843"; then
  577.     echo original size 6843, current size $Wc_c
  578. fi
  579. # ============= bootinfo.c ==============
  580. echo "x - extracting bootinfo.c (Text)"
  581. sed 's/^X//' << 'SHAR_EOF' > bootinfo.c &&
  582. X/*+-------------------------------------------------------------------------
  583. X    bootinfo.c - u386mon bootinfo struct display
  584. X
  585. X  Defined functions:
  586. X    bmemf_text(flags)
  587. X    display_bootinfo(win,y,x)
  588. X
  589. X--------------------------------------------------------------------------*/
  590. X/*+:EDITS:*/
  591. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  592. X/*:06-17-1990-14:59-wht-creation */
  593. X
  594. X#define M_TERMINFO
  595. X
  596. X#include <curses.h>
  597. X#include <panel.h>
  598. X#include <sys/types.h>
  599. X#include <sys/bootinfo.h>
  600. X#include "u386mon.h"
  601. X
  602. X/*+-------------------------------------------------------------------------
  603. X    bmemf_text(flags)
  604. X--------------------------------------------------------------------------*/
  605. Xchar *
  606. Xbmemf_text(flags)
  607. Xulong flags;
  608. X{
  609. X    flags &= ~B_MEM_DOWN;
  610. X    if(!flags)
  611. X        return("    ");
  612. X    switch(flags)
  613. X    {
  614. X        case B_MEM_RSRVD: return("RSVD");
  615. X        case B_MEM_KTEXT: return("KTXT");
  616. X        case B_MEM_KDATA: return("KDTA");
  617. X        case B_MEM_KBSS:  return("KBSS");
  618. X        case B_MEM_NODMA: return("NODM");
  619. X    }
  620. X    return("????");
  621. X}    /* end of bmemf_text */
  622. X
  623. X/*+-------------------------------------------------------------------------
  624. X    display_bootinfo(win,y,x)
  625. X--------------------------------------------------------------------------*/
  626. Xvoid
  627. Xdisplay_bootinfo(win,y,x)
  628. XWINDOW *win;
  629. Xint y;
  630. Xint x;
  631. X{
  632. Xregister itmp;
  633. Xregister struct bootmem *bmem;
  634. X
  635. X    use_cp(win,cpBANNER);
  636. X    wmove(win,y++,x);
  637. X    waddstr(win,"-- Bootinfo ----------");
  638. X    wmove(win,y++,x);
  639. X    disp_static_long(win,"basemem  ","%7ldk     ",bootinfo.basemem);
  640. X    wmove(win,y++,x);
  641. X    disp_static_long(win,"extmem   ","%7ldk     ",bootinfo.extmem);
  642. X    wmove(win,y++,x);
  643. X    disp_static_long(win,"bflags   ","%08lx     ",bootinfo.bootflags);
  644. X
  645. X    wmove(win,y++,x); waddstr(win,"memory available      ");
  646. X    for(itmp = 0; itmp < bootinfo.memavailcnt; itmp++)
  647. X    {
  648. X        bmem = &bootinfo.memavail[itmp];
  649. X        if(bmem->flags & B_MEM_DOWN)
  650. X        {
  651. X            bmem->base -= bmem->extent;
  652. X            bmem->flags &= ~B_MEM_DOWN;
  653. X        }
  654. X        wmove(win,y++,x);
  655. X        wprintw(win,"%08lx %08lx %s",bmem->base,bmem->extent,
  656. X            bmemf_text(bmem->flags));
  657. X    }
  658. X
  659. X    wmove(win,y++,x); waddstr(win,"memory used           ");
  660. X    for(itmp = 0; itmp < bootinfo.memusedcnt; itmp++)
  661. X    {
  662. X        bmem = &bootinfo.memused[itmp];
  663. X        if(bmem->flags & B_MEM_DOWN)
  664. X        {
  665. X            bmem->base -= bmem->extent;
  666. X            bmem->flags &= ~B_MEM_DOWN;
  667. X        }
  668. X        wmove(win,y++,x);
  669. X        wprintw(win,"%08lx %08lx %s",bmem->base,bmem->extent,
  670. X            bmemf_text(bmem->flags));
  671. X    }
  672. X
  673. X}    /* end of display_bootinfo */
  674. X
  675. X/* vi: set tabstop=4 shiftwidth=4: */
  676. X/* end of bootinfo.c */
  677. SHAR_EOF
  678. $TOUCH -am 0624151990 bootinfo.c &&
  679. chmod 0644 bootinfo.c ||
  680. echo "restore of bootinfo.c failed"
  681. set `wc -c bootinfo.c`;Wc_c=$1
  682. if test "$Wc_c" != "2456"; then
  683.     echo original size 2456, current size $Wc_c
  684. fi
  685. # ============= detail.c ==============
  686. echo "x - extracting detail.c (Text)"
  687. sed 's/^X//' << 'SHAR_EOF' > detail.c &&
  688. X/*+-------------------------------------------------------------------------
  689. X    detail.c - UNIX 386 system monitor detail window
  690. X--------------------------------------------------------------------------*/
  691. X/*+:EDITS:*/
  692. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  693. X/*:06-15-1990-18:32-wht@n4hgf-creation */
  694. X
  695. X#define M_TERMINFO
  696. X
  697. X#include <curses.h>
  698. X#include <panel.h>
  699. X#include <signal.h>
  700. X#include <string.h>
  701. X#include <fcntl.h>
  702. X#include <nlist.h>
  703. X#include <errno.h>
  704. X#include <time.h>
  705. X#include <pwd.h>
  706. X#include <utmp.h>
  707. X#include <sys/types.h>
  708. X#include <sys/utsname.h>
  709. X#include <sys/stat.h>
  710. X#include <sys/ascii.h>
  711. X#undef NGROUPS_MAX
  712. X#undef NULL
  713. X#include <sys/param.h>
  714. X#include <sys/bootinfo.h>
  715. X#include <sys/tuneable.h>
  716. X#include <sys/sysinfo.h>
  717. X#include <sys/sysmacros.h>
  718. X#include <sys/immu.h>
  719. X#include <sys/region.h>
  720. X#include <sys/proc.h>
  721. X#include <sys/var.h>
  722. X
  723. X#include "nlsym.h"
  724. X#include "libkmem.h"
  725. X#include "libnlsym.h"
  726. X#include "u386mon.h"
  727. X
  728. X#define DPT_NONE            0
  729. X#define DPT_PROC_STATUS        1
  730. X#define DPT_PROC_STATUS43    2
  731. X
  732. XPANEL *mkpanel();
  733. X
  734. Xextern PANEL *pscr;
  735. Xextern WINDOW *wscr;
  736. X
  737. XPANEL *pdet;
  738. XWINDOW *wdet;
  739. Xu_char detail_panel_type = DPT_NONE;
  740. Xint detail_panel_length;
  741. Xint detail_panel_cols;
  742. X
  743. X/*+-------------------------------------------------------------------------
  744. X    detail_panel_proc_status_init(full43)
  745. X--------------------------------------------------------------------------*/
  746. Xvoid
  747. Xdetail_panel_proc_status_init(full43)
  748. Xint full43;
  749. X{
  750. X/*
  751. X#define DETAIL_PROC_STATUS_COLS ((LINES >= 43) ? EXTRA4_TLX - 1 : PER_SEC4_TLX)
  752. Xdetail_panel_cols = DETAIL_PROC_STATUS_COLS;
  753. X*/
  754. X
  755. X#define DETAIL_TLY ((LINES >= 43) ? ((full43)?PER_SEC_TLY:PER_SEC_TLY+14)\
  756. X                                  : PER_SEC_TLY)
  757. X
  758. X#define DETAIL_LENGTH        (MSG_TLY - DETAIL_TLY)
  759. X
  760. X    detail_panel_length = DETAIL_LENGTH;
  761. X    detail_panel_cols = COLS;
  762. X    if(!(pdet = mkpanel(detail_panel_length,detail_panel_cols,DETAIL_TLY,0)))
  763. X    {
  764. X        leave_text("cannot make detail panel",0);
  765. X    }
  766. X    show_panel(pdet);
  767. X    top_panel(pdet);
  768. X    wdet = panel_window(pdet);
  769. X    display_proc_stats(wdet,1);
  770. X
  771. X}    /* end of detail_panel_proc_status_init */
  772. X
  773. X/*+-------------------------------------------------------------------------
  774. X    detail_panel_proc_status_update()
  775. X--------------------------------------------------------------------------*/
  776. Xvoid
  777. Xdetail_panel_proc_status_update()
  778. X{
  779. X    display_proc_stats(wdet,0);
  780. X}    /* end of detail_panel_proc_status_update */
  781. X
  782. X/*+-------------------------------------------------------------------------
  783. X    detail_destroy()
  784. X--------------------------------------------------------------------------*/
  785. Xvoid
  786. Xdetail_destroy()
  787. X{
  788. X    hide_panel(pdet);
  789. X    delwin(wdet);
  790. X    del_panel(pdet);
  791. X    top_panel(pscr);
  792. X    disp_msg(cpINFO,"");
  793. X    detail_panel_type = DPT_NONE;
  794. X}    /* end of detail_destroy */
  795. X
  796. X/*+-------------------------------------------------------------------------
  797. X    detail_panel_cmd(cmd)
  798. X
  799. X  command: m main screen
  800. X           p proc status
  801. X--------------------------------------------------------------------------*/
  802. Xvoid
  803. Xdetail_panel_cmd(cmd)
  804. Xchtype cmd;
  805. X{
  806. X    switch(cmd)
  807. X    {
  808. X        case 'm':
  809. X            if(detail_panel_type != DPT_NONE)
  810. X                detail_destroy();
  811. X            break;
  812. X
  813. X        case 'P':
  814. X            if(detail_panel_type == DPT_PROC_STATUS43)
  815. X                break;
  816. X            if(detail_panel_type != DPT_NONE)
  817. X                detail_destroy();
  818. X            detail_panel_proc_status_init(1);
  819. X            detail_panel_type = DPT_PROC_STATUS43;
  820. X            break;
  821. X
  822. X        case 'p':
  823. X            if(detail_panel_type == DPT_PROC_STATUS)
  824. X                break;
  825. X            if(detail_panel_type != DPT_NONE)
  826. X                detail_destroy();
  827. X            detail_panel_proc_status_init(0);
  828. X            detail_panel_type = DPT_PROC_STATUS;
  829. X            break;
  830. X    }
  831. X}    /* end of detail_panel_cmd */
  832. X
  833. X/*+-------------------------------------------------------------------------
  834. X    detail_panel_update()
  835. X--------------------------------------------------------------------------*/
  836. Xvoid
  837. Xdetail_panel_update()
  838. X{
  839. X    switch(detail_panel_type)
  840. X    {
  841. X        case DPT_PROC_STATUS:
  842. X        case DPT_PROC_STATUS43:
  843. X            detail_panel_proc_status_update();
  844. X            break;
  845. X    }
  846. X}    /* end of detail_panel_update */
  847. X
  848. X/*+-------------------------------------------------------------------------
  849. X    detail_init()
  850. X--------------------------------------------------------------------------*/
  851. Xvoid
  852. Xdetail_init()
  853. X{
  854. X}    /* end of detail_init */
  855. X
  856. X/* vi: set tabstop=4 shiftwidth=4: */
  857. X/* end of detail.c */
  858. SHAR_EOF
  859. $TOUCH -am 0624151990 detail.c &&
  860. chmod 0644 detail.c ||
  861. echo "restore of detail.c failed"
  862. set `wc -c detail.c`;Wc_c=$1
  863. if test "$Wc_c" != "4232"; then
  864.     echo original size 4232, current size $Wc_c
  865. fi
  866. # ============= det_proc.c ==============
  867. echo "x - extracting det_proc.c (Text)"
  868. sed 's/^X//' << 'SHAR_EOF' > det_proc.c &&
  869. X/* CHK=0xC5D1 */
  870. X/*+-------------------------------------------------------------------------
  871. X    det_proc.c - UNIX V/386 system monitor proc status detail
  872. X    ...!emory!n4hgf!wht
  873. X--------------------------------------------------------------------------*/
  874. X/*+:EDITS:*/
  875. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  876. X/*:01-05-1989-13:27-wht-creation */
  877. X
  878. X#define M_TERMINFO
  879. X
  880. X#include <curses.h>
  881. X#include <panel.h>
  882. X#include <signal.h>
  883. X#include <string.h>
  884. X#include <fcntl.h>
  885. X#include <nlist.h>
  886. X#include <errno.h>
  887. X#include <time.h>
  888. X#include <pwd.h>
  889. X#include <utmp.h>
  890. X#include <sys/types.h>
  891. X#include <sys/stat.h>
  892. X#include <sys/ascii.h>
  893. X#undef NGROUPS_MAX
  894. X#undef NULL
  895. X#include <sys/param.h>
  896. X#include <sys/bootinfo.h>
  897. X#include <sys/tuneable.h>
  898. X#include <sys/sysinfo.h>
  899. X#include <sys/sysmacros.h>
  900. X#include <sys/immu.h>
  901. X#include <sys/region.h>
  902. X#include <sys/proc.h>
  903. X#include <sys/fs/s5dir.h>
  904. X#include <sys/user.h>
  905. X#include <sys/var.h>
  906. X
  907. X#include "nlsym.h"
  908. X#include "libkmem.h"
  909. X#include "libmem.h"
  910. X#include "libswap.h"
  911. X#include "libnlsym.h"
  912. X#include "u386mon.h"
  913. X
  914. Xextern int errno;
  915. X
  916. Xextern int nprocs;
  917. Xextern struct var v;
  918. Xextern struct proc *procs;
  919. Xextern struct proc *oldprocs;
  920. X
  921. Xint mypid;
  922. Xint noldprocs = 0;
  923. Xint nprocs = 0;
  924. Xint max_procs_to_display;
  925. X
  926. Xstruct user user;
  927. X
  928. X#define min(a,b) (((a) > (b)) ? (b) : (a))
  929. X
  930. X#define p_slotnum    p_sigflags[0]    /* reuse a field we dont look at */
  931. X
  932. X#define MAX_UTMP 32
  933. Xint nutmps = 0;
  934. Xstruct utmp utmps[MAX_UTMP];
  935. X
  936. X/*+-------------------------------------------------------------------------
  937. X    proc_pid_compare(p1,p2)
  938. X--------------------------------------------------------------------------*/
  939. Xproc_pid_compare(p1,p2)
  940. Xstruct proc *p1;
  941. Xstruct proc *p2;
  942. X{
  943. X    return(p1->p_pid - p2->p_pid);
  944. X}    /* end of proc_pid_compare */
  945. X
  946. X/*+-------------------------------------------------------------------------
  947. X    read_and_sort_procs(initial)
  948. X--------------------------------------------------------------------------*/
  949. Xvoid
  950. Xread_and_sort_procs(initial)
  951. Xint initial;
  952. X{
  953. Xregister int iproc;
  954. Xregister char *cptr;
  955. Xstruct proc *tproc;
  956. X
  957. X    disp_msg(cpINFO,"");
  958. X    if(!initial)
  959. X    {
  960. X        (void)memcpy((char *)oldprocs,(char *)procs,v.v_proc * sizeof(struct proc));
  961. X        noldprocs = nprocs;
  962. X    }
  963. X
  964. X/* read current procs */
  965. X    grok_proc();
  966. X
  967. X/* if slot not in use, force to end when sorting */
  968. X    nprocs = 0;
  969. X    for(iproc = 0; iproc < v.v_proc; iproc++)
  970. X    {
  971. X        tproc = procs + iproc;
  972. X        tproc->p_slotnum = iproc;        /* save slot number */
  973. X        if(    (tproc->p_stat == 0) ||        /* if slot not in use, ... */
  974. X            (tproc->p_pid == 1)  ||        /* ... or proc is init, ... */
  975. X            (tproc->p_flag & SSYS))        /* ... or proc is system process */
  976. X        {                            /* eliminate from consideration */
  977. X            tproc->p_pid = 32767;    /* force below selected procs in qsort */
  978. X            continue;
  979. X        }
  980. X        nprocs++;
  981. X    }
  982. X
  983. X/* if too many procs, whittle down */
  984. X    if(nprocs > max_procs_to_display)
  985. X    {
  986. X        nprocs = 0;
  987. X        for(iproc = 0; iproc < v.v_proc; iproc++)
  988. X        {
  989. X            tproc = procs + iproc;
  990. X            if(tproc->p_pid == 32767)    /* previously eliminated? */
  991. X                continue;
  992. X            else if(get_user(tproc,&user))
  993. X            {
  994. X                if( !strcmp(cptr = user.u_comm,"csh") ||
  995. X                    !strcmp(cptr,"sh")        ||
  996. X                    !strcmp(cptr,"ksh")        ||
  997. X                    !strcmp(cptr,"getty")    ||
  998. X                    !strcmp(cptr,"uugetty")        )
  999. X                {
  1000. X                    tproc->p_pid = 32767;
  1001. X                    continue;
  1002. X                }
  1003. X            }
  1004. X            nprocs++;
  1005. X        }
  1006. X        disp_msg(cpLIT,"shells and gettys not displayed");
  1007. X    }
  1008. X
  1009. X/* if still too many procs, whittle swapped */
  1010. X    if(nprocs > max_procs_to_display)
  1011. X    {
  1012. X        nprocs = 0;
  1013. X        for(iproc = 0; iproc < v.v_proc; iproc++)
  1014. X        {
  1015. X            tproc = procs + iproc;
  1016. X            if(tproc->p_pid == 32767)    /* previously eliminated? */
  1017. X                continue;
  1018. X            else if((!(tproc->p_flag & SLOAD) && (tproc->p_stat != SRUN)) ||
  1019. X                (tproc->p_stat == SZOMB))
  1020. X            {
  1021. X                tproc->p_pid = 32767;
  1022. X                continue;
  1023. X            }
  1024. X            nprocs++;
  1025. X        }
  1026. X        disp_msg(cpLIT,"shells, gettys and swapped/zombie procs not displayed");
  1027. X    }
  1028. X/* if still too many procs, whittle hard */
  1029. X    if(nprocs > max_procs_to_display)
  1030. X    {
  1031. X        nprocs = 0;
  1032. X        for(iproc = 0; iproc < v.v_proc; iproc++)
  1033. X        {
  1034. X            tproc = procs + iproc;
  1035. X            if(tproc->p_pid == 32767)    /* previously eliminated? */
  1036. X                continue;
  1037. X            else if(tproc->p_stat == SSLEEP)
  1038. X            {
  1039. X                tproc->p_pid = 32767;
  1040. X                continue;
  1041. X            }
  1042. X            nprocs++;
  1043. X        }
  1044. X        disp_msg(cpLIT,
  1045. X            "shells, gettys and swapped/zombie/sleeping procs not displayed");
  1046. X    }
  1047. X
  1048. X    if(nprocs > max_procs_to_display)
  1049. X        disp_msg(cpMED,"display size too small for all processes");
  1050. X
  1051. X/* sort new procs array */
  1052. X    (void)qsort((char *)procs,(unsigned)v.v_proc,
  1053. X        sizeof(struct proc),proc_pid_compare);
  1054. X
  1055. X    if(initial)
  1056. X    {
  1057. X        (void)memcpy((char *)oldprocs,(char *)procs,
  1058. X            v.v_proc * sizeof(struct proc));
  1059. X        noldprocs = nprocs;
  1060. X    }
  1061. X
  1062. X}    /* end of read_and_sort_procs */
  1063. X
  1064. X/*+-------------------------------------------------------------------------
  1065. X    read_utmp()
  1066. X--------------------------------------------------------------------------*/
  1067. Xvoid
  1068. Xread_utmp()
  1069. X{
  1070. Xint utmpfd;
  1071. Xregister struct utmp *tutmp = utmps;
  1072. X
  1073. X    nutmps = 0;
  1074. X    if((utmpfd = open("/etc/utmp",O_RDONLY,755)) < 0)
  1075. X        leave_text("/etc/utmp open error",errno);
  1076. X
  1077. X    while(read(utmpfd,(char *)(tutmp++),sizeof(struct utmp)) > 0)
  1078. X    {
  1079. X        if(++nutmps == MAX_UTMP)
  1080. X            leave_text("too many utmp entries for me to handle",1);
  1081. X    }
  1082. X    (void)close(utmpfd);
  1083. X}    /* end of read_utmp */
  1084. X
  1085. X/*+-------------------------------------------------------------------------
  1086. X    find_utmp_for_pgrp(pgrp)
  1087. X--------------------------------------------------------------------------*/
  1088. Xstruct utmp *
  1089. Xfind_utmp_for_pgrp(pgrp)
  1090. Xint pgrp;
  1091. X{
  1092. Xstruct utmp *tutmp = utmps;
  1093. Xregister int count = nutmps;
  1094. X
  1095. X    while(count--)
  1096. X    {
  1097. X        if(tutmp->ut_pid == pgrp)
  1098. X            return(tutmp);
  1099. X        tutmp++;
  1100. X    }
  1101. X    return((struct utmp *)0);
  1102. X}    /* end of find_utmp_for_pgrp */
  1103. X
  1104. X/*+-------------------------------------------------------------------------
  1105. X    pgrp_to_ttyname(pgrp)
  1106. X--------------------------------------------------------------------------*/
  1107. Xchar *
  1108. Xpgrp_to_ttyname(pgrp)
  1109. Xint pgrp;
  1110. X{
  1111. Xregister itmp;
  1112. Xstruct utmp *tutmp;
  1113. X
  1114. X    if(!(tutmp = find_utmp_for_pgrp(pgrp)))
  1115. X    {
  1116. X        read_utmp();
  1117. X        tutmp = find_utmp_for_pgrp(pgrp);
  1118. X    }
  1119. X    if(!tutmp)
  1120. X        return("??");
  1121. X    else
  1122. X    {
  1123. X        itmp = strlen(tutmp->ut_id);
  1124. X        return(&tutmp->ut_id[(itmp >= 2) ? (itmp - 2) : 0]);
  1125. X    }
  1126. X}    /* end of pgrp_to_ttyname */
  1127. X
  1128. X/*+-------------------------------------------------------------------------
  1129. X    get_user(tproc,tuser)
  1130. X--------------------------------------------------------------------------*/
  1131. Xget_user(tproc,tuser)
  1132. Xstruct proc *tproc;
  1133. Xstruct user *tuser;
  1134. X{
  1135. X    register caddr_t uptr = (caddr_t)tuser;
  1136. X    register int ubrdcount = sizeof(struct user);
  1137. X    int ipde;
  1138. X    paddr_t mptr;
  1139. X
  1140. X    if(tproc->p_flag & SULOAD)
  1141. X    {
  1142. X        for(ipde = 0; ipde < tproc->p_usize; ipde++)
  1143. X        {
  1144. X            if(!tproc->p_ubptbl[ipde].pgm.pg_pres)    /* if not resident */
  1145. X                return(0);
  1146. X            mptr = tproc->p_ubptbl[ipde].pgm.pg_pfn * NBPP;
  1147. X            mread(uptr,(daddr_t)mptr,min(ubrdcount,NBPP));
  1148. X            uptr += NBPP;
  1149. X            if((ubrdcount -= NBPP) <= 0)
  1150. X                break;
  1151. X        }
  1152. X    }
  1153. X    else
  1154. X    {
  1155. X        mptr = tproc->p_ubdbd.dbd_blkno * NBPSCTR;
  1156. X        sread(uptr,mptr,ubrdcount);
  1157. X    }
  1158. X    /*
  1159. X     * we can get crap from swap if things change after we get
  1160. X     * an address to read from, so validate user as best we can
  1161. X     */
  1162. X    return(tuser->u_ruid == tproc->p_uid); /* validate it */
  1163. X
  1164. X}    /* end of get_user */
  1165. X
  1166. X/*+-------------------------------------------------------------------------
  1167. Xuid to username conversion; thanks for the idea to William LeFebvre
  1168. X--------------------------------------------------------------------------*/
  1169. X#define UID_NAME_HASH_SIZE    127    /* prime */
  1170. X#define HASH_EMPTY            -1
  1171. X#define HASHIT(i)            ((i) % UID_NAME_HASH_SIZE)
  1172. X
  1173. Xstruct uid_name_hash_entry {
  1174. X    int  uid;
  1175. X    char name[10];
  1176. X};
  1177. X
  1178. Xstruct uid_name_hash_entry uid_name_table[UID_NAME_HASH_SIZE];
  1179. Xint uid_count = 0;
  1180. X
  1181. X/*+-------------------------------------------------------------------------
  1182. X    init_uid_name_hash()
  1183. X--------------------------------------------------------------------------*/
  1184. Xvoid
  1185. Xinit_uid_name_hash()
  1186. X{
  1187. Xregister int ihash = 0;
  1188. Xregister struct uid_name_hash_entry *hashent = uid_name_table;
  1189. X
  1190. X    while(ihash++ < UID_NAME_HASH_SIZE)
  1191. X    {
  1192. X        hashent->uid = HASH_EMPTY;
  1193. X        hashent++;
  1194. X    }
  1195. X}    /* end of init_uid_name_hash */
  1196. X
  1197. X/*+-------------------------------------------------------------------------
  1198. X    uid_name_enter(uid,name)
  1199. X--------------------------------------------------------------------------*/
  1200. Xint
  1201. Xuid_name_enter(uid,name)
  1202. Xregister int uid;
  1203. Xregister char *name;
  1204. X{
  1205. Xregister int table_uid;
  1206. Xregister int hashval;
  1207. X
  1208. X    if(++uid_count >= UID_NAME_HASH_SIZE)
  1209. X        leave_text("too many user names",1);
  1210. X
  1211. X    hashval = HASHIT(uid);
  1212. X    while((table_uid = uid_name_table[hashval].uid) != HASH_EMPTY)
  1213. X    {
  1214. X        if(table_uid == uid)
  1215. X            return(hashval);
  1216. X        hashval = (hashval + 1) % UID_NAME_HASH_SIZE;
  1217. X    }
  1218. X
  1219. X    uid_name_table[hashval].uid = uid;
  1220. X    (void)strncpy(uid_name_table[hashval].name,name,
  1221. X        sizeof(uid_name_table[0].name));
  1222. X
  1223. X    return(hashval);
  1224. X
  1225. X}    /* end of uid_name_enter */
  1226. X
  1227. X/*+-------------------------------------------------------------------------
  1228. X    getpwent_and_enter(uid)
  1229. X--------------------------------------------------------------------------*/
  1230. Xgetpwent_and_enter(uid)
  1231. Xregister int uid;
  1232. X{
  1233. Xregister int hashval;
  1234. Xregister struct passwd *pwd;
  1235. Xchar errant[10];
  1236. Xstruct passwd *getpwuid();
  1237. X
  1238. X    pwd = getpwuid(uid);
  1239. X    endpwent();
  1240. X    if(pwd)
  1241. X    {
  1242. X        hashval = uid_name_enter(pwd->pw_uid,pwd->pw_name);
  1243. X        return(hashval);
  1244. X    }
  1245. X    (void)sprintf(errant,"%d",uid);
  1246. X    return(uid_name_enter(uid,errant));
  1247. X}    /* end of getpwent_and_enter */
  1248. X
  1249. X/*+-------------------------------------------------------------------------
  1250. X    uid_to_name(uid)
  1251. X--------------------------------------------------------------------------*/
  1252. Xchar *
  1253. Xuid_to_name(uid)
  1254. Xregister int uid;
  1255. X{
  1256. Xregister int uid_hash;
  1257. Xregister int table_uid;
  1258. X
  1259. X    uid_hash = HASHIT(uid);
  1260. X    while((table_uid = uid_name_table[uid_hash].uid) != uid)
  1261. X    {
  1262. X        if(table_uid == HASH_EMPTY)
  1263. X        {
  1264. X            /* not in hash table */
  1265. X            uid_hash = getpwent_and_enter(uid);
  1266. X            break;        /* out of while */
  1267. X        }
  1268. X        uid_hash = (uid_hash + 1) % UID_NAME_HASH_SIZE;
  1269. X    }
  1270. X    return(uid_name_table[uid_hash].name);
  1271. X}    /* end of char *uid_to_name */
  1272. X
  1273. X/*+-----------------------------------------------------------------------
  1274. X    char *get_cpu_time_str(ticks)
  1275. X  6-char static string address is returned
  1276. X------------------------------------------------------------------------*/
  1277. Xchar *get_cpu_time_str(ticks)
  1278. Xtime_t ticks;
  1279. X{
  1280. Xstatic char timestr[10];
  1281. Xtime_t mm,ss;
  1282. Xextern int hz;
  1283. X
  1284. X    ticks /= hz;
  1285. X    mm = ticks / 60L;
  1286. X    ticks -= mm * 60L;
  1287. X    ss = ticks;
  1288. X
  1289. X    if(mm > 999)
  1290. X        (void)sprintf(timestr,"%5ldm",mm);
  1291. X    else
  1292. X        (void)sprintf(timestr,"%3lu:%02lu",mm,ss);
  1293. X    return(timestr);
  1294. X}    /* end of get_cpu_time_str */
  1295. X
  1296. X#define PROC_Y        1
  1297. X#define PROC_X        0
  1298. X#define UID_X        2
  1299. X#define PID_X        12
  1300. X#define CPU_X        18
  1301. X#define PRI_X        22
  1302. X#define NICE_X        26
  1303. X#define UTIME_X        29
  1304. X#define STIME_X        36
  1305. X#define SIZE_X        43
  1306. X#define TTY_X        48
  1307. X#define CMD_X        52
  1308. X
  1309. X/*+-------------------------------------------------------------------------
  1310. X    display_proc_stat(win,iproc,initial)
  1311. X00000000001111111111222222222233333333334444444444555555555566666666667777777777
  1312. X01234567890123456789012345678901234567890123456789012345678901234567890123456789
  1313. XS     USER   PID  CPU PRI NI  UCPU   SCPU  SIZE TTY CMD
  1314. X#!########X ##### ### ### ## ###### ###### #### ### ########
  1315. X--------------------------------------------------------------------------*/
  1316. Xvoid
  1317. Xdisplay_proc_stat(win,iproc,initial)
  1318. XWINDOW *win;
  1319. Xregister int iproc;
  1320. Xregister int initial;
  1321. X{
  1322. Xregister int positioned = 0;
  1323. Xregister struct proc *tproc = procs + iproc;
  1324. Xstruct proc *oproc = oldprocs + iproc;
  1325. Xint got_user;
  1326. Xstatic char *p_stat_str = " sRzdipx";    /* dependent on values of SSLEEP etc */
  1327. Xchar buf[20];
  1328. X
  1329. X    use_cp(win,cpINFO);
  1330. X    if((tproc->p_stat == SRUN) && !(tproc->p_flag & SLOAD))
  1331. X        use_cp(win,cpHIGH);
  1332. X    else if((tproc->p_stat == SRUN) || (oproc->p_stat == SRUN))
  1333. X        use_cp(win,cpMED);
  1334. X    if(tproc->p_pid != tproc->p_pid)
  1335. X        initial = 1;
  1336. X
  1337. X    wmove(win,PROC_Y + iproc,PROC_X);
  1338. X    waddch(win,(chtype)p_stat_str[tproc->p_stat]);
  1339. X    waddch(win,(tproc->p_flag & SLOAD) ? (chtype)' ' : (chtype)'S');
  1340. X    positioned = 1;
  1341. X
  1342. X    if(initial)
  1343. X    {
  1344. X        if(!positioned)
  1345. X            wmove(win,PROC_Y + iproc,PROC_X + UID_X);
  1346. X        (void)sprintf(buf,"%8s",uid_to_name(tproc->p_uid));
  1347. X        waddstr(win,buf);
  1348. X        waddch(win,(tproc->p_uid != tproc->p_suid) ? '#' : ' ');
  1349. X        waddch(win,' ');
  1350. X        positioned = 1;
  1351. X    }
  1352. X    else
  1353. X        positioned = 0;
  1354. X
  1355. X    if(initial)
  1356. X    {
  1357. X        if(!positioned)
  1358. X            wmove(win,PROC_Y + iproc,PROC_X + PID_X);
  1359. X        (void)sprintf(buf,"%5d ",tproc->p_pid);
  1360. X        waddstr(win,buf);
  1361. X        positioned = 1;
  1362. X    }
  1363. X    else
  1364. X        positioned = 0;
  1365. X
  1366. X    if(initial || (tproc->p_cpu != oproc->p_cpu))
  1367. X    {
  1368. X        if(!positioned)
  1369. X            wmove(win,PROC_Y + iproc,PROC_X + CPU_X);
  1370. X        (void)sprintf(buf,"%3u ",tproc->p_cpu);
  1371. X        waddstr(win,buf);
  1372. X        positioned = 1;
  1373. X    }
  1374. X    else
  1375. X        positioned = 0;
  1376. X
  1377. X    if(initial || (tproc->p_pri != oproc->p_pri))
  1378. X    {
  1379. X        if(!positioned)
  1380. X            wmove(win,PROC_Y + iproc,PROC_X + PRI_X);
  1381. X        (void)sprintf(buf,"%3u ",tproc->p_pri);
  1382. X        waddstr(win,buf);
  1383. X        positioned = 1;
  1384. X    }
  1385. X    else
  1386. X        positioned = 0;
  1387. X
  1388. X    if(initial || (tproc->p_nice != oproc->p_nice))
  1389. X    {
  1390. X        if(!positioned)
  1391. X            wmove(win,PROC_Y + iproc,PROC_X + NICE_X);
  1392. X        (void)sprintf(buf,"%2d ",tproc->p_nice);
  1393. X        waddstr(win,buf);
  1394. X        positioned = 1;
  1395. X    }
  1396. X    else
  1397. X        positioned = 0;
  1398. X
  1399. X/* since not saving user area, always update fields from it */
  1400. X    if(!positioned)
  1401. X        wmove(win,PROC_Y + iproc,PROC_X + UTIME_X);
  1402. X    if(got_user = get_user(tproc,&user))
  1403. X    {
  1404. X        waddstr(win,get_cpu_time_str(user.u_utime));
  1405. X        waddch(win,' ');
  1406. X        waddstr(win,get_cpu_time_str(user.u_stime));
  1407. X        waddch(win,' ');
  1408. X/*
  1409. X * process size:
  1410. X *
  1411. X * There are ways that seem right to a man, but the end of them is death.
  1412. X * u_tsize and friends are not clicks, but in bytes.
  1413. X * I thought this would have been:
  1414. X *        (ctob((u_long)user.u_tsize + user.u_dsize + user.u_ssize)) / 1024);
  1415. X * At least this makes numbers agree with /bin/ps, although I cannot
  1416. X * figure out why there is one extra page charged by ps (user is 2 pages).
  1417. X */
  1418. X        (void)sprintf(buf,"%4lu ",
  1419. X            (((u_long)user.u_tsize + 511) / 1024) +
  1420. X            (((u_long)user.u_dsize + 511) / 1024) +
  1421. X            (((u_long)user.u_ssize + 511) / 1024) +
  1422. X            (((u_long)((user.u_tsize)?1:0) * NBPP) / 1024));
  1423. X        waddstr(win,buf);
  1424. X    }
  1425. X    else
  1426. X        waddstr(win,"------ ------ ---- ");
  1427. X
  1428. X/*
  1429. X    positioned = 1;
  1430. X    if(!positioned)
  1431. X        wmove(win,PROC_Y + iproc,PROC_X + TTY_X);
  1432. X*/
  1433. X    (void)sprintf(buf,"%3.3s ",pgrp_to_ttyname(tproc->p_pgrp));
  1434. X    waddstr(win,buf);
  1435. X    positioned = 1;
  1436. X
  1437. X/*
  1438. X    if(!positioned)
  1439. X        wmove(win,PROC_Y + iproc,PROC_X + CMD_X);
  1440. X*/
  1441. X    if(got_user)
  1442. X    {
  1443. X    register char *cptr = user.u_psargs;
  1444. X    int y,x,maxx = getmaxx(win);
  1445. X        getyx(win,y,x);
  1446. X        while(*cptr && (x < maxx))
  1447. X        {
  1448. X            *cptr &= 0x7F;
  1449. X            if(*cptr < 0x20)
  1450. X                *cptr = 0x20;
  1451. X            waddch(win,*cptr);
  1452. X            cptr++,x++;
  1453. X        }
  1454. X    }
  1455. X    else
  1456. X    {
  1457. X        switch(tproc->p_stat)
  1458. X        {
  1459. X            case SZOMB:
  1460. X                waddstr(win,"<zombie>");
  1461. X                break;
  1462. X            case SXBRK:
  1463. X                waddstr(win,"<xbreak>");
  1464. X                break;
  1465. X            default:
  1466. X                waddstr(win,"<swapped>");
  1467. X        }
  1468. X    }
  1469. X
  1470. X    wclrtoeol(win);
  1471. X
  1472. X}    /* end of display_proc_stat */
  1473. X
  1474. X/*+-------------------------------------------------------------------------
  1475. X    display_proc_stats(win,initial)
  1476. X--------------------------------------------------------------------------*/
  1477. Xvoid
  1478. Xdisplay_proc_stats(win,initial)
  1479. XWINDOW *win;
  1480. Xint initial;
  1481. X{
  1482. Xregister int iproc;
  1483. Xint y,x;
  1484. X
  1485. X    if(initial)
  1486. X    {
  1487. X        use_cp(win,cpBANNER);
  1488. X        wmove(win,0,0);
  1489. X        waddstr(win,
  1490. X            "S     USER   PID  CPU PRI NI  UCPU   SCPU  SIZE TTY CMD");
  1491. X        getyx(win,y,x);
  1492. X        while(x < getmaxx(win))
  1493. X            waddch(win,(chtype)' '),x++;
  1494. X    }
  1495. X    mypid = getpid();
  1496. X    max_procs_to_display = getmaxy(win) - PROC_Y;
  1497. X    read_and_sort_procs(initial);
  1498. X    max_procs_to_display = min(nprocs,max_procs_to_display);
  1499. X    for(iproc = 0; iproc < max_procs_to_display; iproc++)
  1500. X        display_proc_stat(win,iproc,1);
  1501. X    wclrtobot(win);
  1502. X}    /* end of display_proc_stats */
  1503. X
  1504. X/* vi: set tabstop=4 shiftwidth=4: */
  1505. X/* end of det_proc.c */
  1506. SHAR_EOF
  1507. $TOUCH -am 0624151990 det_proc.c &&
  1508. chmod 0644 det_proc.c ||
  1509. echo "restore of det_proc.c failed"
  1510. set `wc -c det_proc.c`;Wc_c=$1
  1511. if test "$Wc_c" != "15535"; then
  1512.     echo original size 15535, current size $Wc_c
  1513. fi
  1514. # ============= disputil.c ==============
  1515. echo "x - extracting disputil.c (Text)"
  1516. sed 's/^X//' << 'SHAR_EOF' > disputil.c &&
  1517. X/*+-------------------------------------------------------------------------
  1518. X    disputil.c - u386mon display utilities
  1519. X
  1520. X  Defined functions:
  1521. X    clear_area(win,y,x,len)
  1522. X    clear_area_char(win,y,x,len,fillchar)
  1523. X    disp_info_int(win,label,fmt,value)
  1524. X    disp_info_long(win,label,fmt,value)
  1525. X    disp_static_int(win,label,fmt,value)
  1526. X    disp_static_long(win,label,fmt,value)
  1527. X    mkpanel(rows,cols,tly,tlx)
  1528. X    pflush()
  1529. X    wperror(win,desc)
  1530. X
  1531. X--------------------------------------------------------------------------*/
  1532. X/*+:EDITS:*/
  1533. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  1534. X/*:06-17-1990-15:15-wht-creation */
  1535. X
  1536. X#define M_TERMINFO
  1537. X
  1538. X#include <curses.h>
  1539. X#include <panel.h>
  1540. X#include <sys/types.h>
  1541. X#include "u386mon.h"
  1542. X
  1543. X/*+-------------------------------------------------------------------------
  1544. X    clear_area_char(win,y,x,len,fillchar)
  1545. X--------------------------------------------------------------------------*/
  1546. Xvoid
  1547. Xclear_area_char(win,y,x,len,fillchar)
  1548. XWINDOW *win;
  1549. Xint y;
  1550. Xint x;
  1551. Xint len;
  1552. Xu_char fillchar;
  1553. X{
  1554. X    wmove(win,y,x);
  1555. X    while(len-- > 0)
  1556. X        waddch(win,(chtype)fillchar);
  1557. X    wmove(win,y,x);
  1558. X
  1559. X}    /* end of clear_area_char */
  1560. X
  1561. X/*+-------------------------------------------------------------------------
  1562. X    clear_area(win,y,x,len)
  1563. X--------------------------------------------------------------------------*/
  1564. Xvoid
  1565. Xclear_area(win,y,x,len)
  1566. XWINDOW *win;
  1567. Xint y;
  1568. Xint x;
  1569. Xint len;
  1570. X{
  1571. X    clear_area_char(win,y,x,len,' ');
  1572. X}    /* end of clear_area_char */
  1573. X
  1574. X/*+-------------------------------------------------------------------------
  1575. X    pflush() - do update_panels() and doupdate()
  1576. X--------------------------------------------------------------------------*/
  1577. Xvoid
  1578. Xpflush()
  1579. X{
  1580. X    update_panels();
  1581. X    curs_set(0);
  1582. X    doupdate();
  1583. X    curs_set(1);
  1584. X}    /* end of pflush */
  1585. X
  1586. X/*+-------------------------------------------------------------------------
  1587. X    wperror(win,desc)
  1588. X--------------------------------------------------------------------------*/
  1589. Xvoid
  1590. Xwperror(win,desc)
  1591. XWINDOW *win;
  1592. Xchar *desc;
  1593. X{
  1594. Xextern int errno;
  1595. Xextern int sys_nerr;
  1596. Xextern char *sys_errlist[];
  1597. X
  1598. X    waddstr(win,desc);
  1599. X    waddstr(win,": ");
  1600. X    if(errno < sys_nerr)
  1601. X        waddstr(win,sys_errlist[errno]);
  1602. X    else
  1603. X        wprintw(win,"error %u",errno);
  1604. X
  1605. X}    /* end of wperror */
  1606. X
  1607. X/*+-------------------------------------------------------------------------
  1608. X    mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them
  1609. X--------------------------------------------------------------------------*/
  1610. XPANEL *
  1611. Xmkpanel(rows,cols,tly,tlx)
  1612. Xint rows;
  1613. Xint cols;
  1614. Xint tly;
  1615. Xint tlx;
  1616. X{
  1617. XWINDOW *win = newwin(rows,cols,tly,tlx);
  1618. XPANEL *pan;
  1619. X
  1620. X    if(!win)
  1621. X        return((PANEL *)0);
  1622. X    if(pan = new_panel(win))
  1623. X        return(pan);
  1624. X    delwin(win);
  1625. X    return((PANEL *)0);
  1626. X}    /* end of mkpanel */
  1627. X
  1628. X/*+-------------------------------------------------------------------------
  1629. X    disp_info_long(win,label,fmt,value)
  1630. X--------------------------------------------------------------------------*/
  1631. Xvoid
  1632. Xdisp_info_long(win,label,fmt,value)
  1633. XWINDOW *win;
  1634. Xchar *label;
  1635. Xchar *fmt;
  1636. Xlong value;
  1637. X{
  1638. X    use_cp(win,cpLIT);
  1639. X    waddstr(win,label);
  1640. X    use_cp(win,cpINFO);
  1641. X    wprintw(win,fmt,value);
  1642. X}    /* end of disp_info_long */
  1643. X
  1644. X/*+-------------------------------------------------------------------------
  1645. X    disp_info_int(win,label,fmt,value)
  1646. X--------------------------------------------------------------------------*/
  1647. Xvoid
  1648. Xdisp_info_int(win,label,fmt,value)
  1649. XWINDOW *win;
  1650. Xchar *label;
  1651. Xchar *fmt;
  1652. Xint value;
  1653. X{
  1654. X    use_cp(win,cpLIT);
  1655. X    waddstr(win,label);
  1656. X    use_cp(win,cpINFO);
  1657. X    wprintw(win,fmt,value);
  1658. X}    /* end of disp_info_int */
  1659. X
  1660. X/*+-------------------------------------------------------------------------
  1661. X    disp_static_long(win,label,fmt,value)
  1662. X--------------------------------------------------------------------------*/
  1663. Xvoid
  1664. Xdisp_static_long(win,label,fmt,value)
  1665. XWINDOW *win;
  1666. Xchar *label;
  1667. Xchar *fmt;
  1668. Xlong value;
  1669. X{
  1670. X    use_cp(win,cpLIT);
  1671. X    waddstr(win,label);
  1672. X    wprintw(win,fmt,value);
  1673. X}    /* end of disp_static_long */
  1674. X
  1675. X/*+-------------------------------------------------------------------------
  1676. X    disp_static_int(win,label,fmt,value)
  1677. X--------------------------------------------------------------------------*/
  1678. Xvoid
  1679. Xdisp_static_int(win,label,fmt,value)
  1680. XWINDOW *win;
  1681. Xchar *label;
  1682. Xchar *fmt;
  1683. Xint value;
  1684. X{
  1685. X    use_cp(win,cpLIT);
  1686. X    waddstr(win,label);
  1687. X    wprintw(win,fmt,value);
  1688. X}    /* end of disp_static_int */
  1689. X
  1690. X/*+-------------------------------------------------------------------------
  1691. X    disp_msg(cp,msg)
  1692. X--------------------------------------------------------------------------*/
  1693. Xvoid
  1694. Xdisp_msg(cp,msg)
  1695. Xchtype cp;
  1696. Xchar *msg;
  1697. X{
  1698. Xextern WINDOW *wscr;
  1699. Xint y;
  1700. Xregister int x;
  1701. X
  1702. X    wmove(wscr,MSG_TLY,0);
  1703. X    use_cp(wscr,cp);
  1704. X    waddstr(wscr,msg);
  1705. X    getyx(wscr,y,x);
  1706. X    while(x < getmaxx(wscr))
  1707. X        waddch(wscr,(chtype)' '),x++;
  1708. X}    /* end of disp_msg */
  1709. X
  1710. X/* vi: set tabstop=4 shiftwidth=4: */
  1711. X/* end of disputil.c */
  1712. SHAR_EOF
  1713. $TOUCH -am 0624151990 disputil.c &&
  1714. chmod 0644 disputil.c ||
  1715. echo "restore of disputil.c failed"
  1716. set `wc -c disputil.c`;Wc_c=$1
  1717. if test "$Wc_c" != "4713"; then
  1718.     echo original size 4713, current size $Wc_c
  1719. fi
  1720. echo "End of part 1, continue with part 2"
  1721. exit 0
  1722.  
  1723.  
  1724.  
  1725. ---------------------------------------------------------------------
  1726. Warren Tucker, TuckerWare    gatech!n4hgf!wht or wht%n4hgf@gatech.edu
  1727. Ker-au'-lo-phon.   An  8-foot  partial  flue-stop, having metal pipes
  1728. surmounted by adjustable rings, and with a hole bored near the top of
  1729. each pipe.  Tone soft and "reedy".
  1730.