home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / u386mon-2.0 / part03 < prev    next >
Encoding:
Text File  |  1990-07-15  |  48.2 KB  |  1,742 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v14i003: u386mon 2.0 part 03/04
  3. From: wht@n4hgf.UUCP (Warren Tucker)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 3
  7. Submitted-by: wht@n4hgf.UUCP (Warren Tucker)
  8. Archive-name: u386mon-2.0/part03
  9.  
  10. #!/bin/sh
  11. # This is part 03 of u386mon.2.0
  12. if touch 2>&1 | fgrep 'amc' > /dev/null
  13.  then TOUCH=touch
  14.  else TOUCH=true
  15. fi
  16. # ============= proc.c ==============
  17. echo "x - extracting proc.c (Text)"
  18. sed 's/^X//' << 'SHAR_EOF' > proc.c &&
  19. X/* CHK=0x9B13 */
  20. X/*+-------------------------------------------------------------------------
  21. X    proc.c - u386mon proc table functions
  22. X
  23. X  Defined functions:
  24. X    display_proc(win,y,x)
  25. X    grok_proc()
  26. X    pstat_text(pstat)
  27. X
  28. X--------------------------------------------------------------------------*/
  29. X/*+:EDITS:*/
  30. X/*:07-11-1990-03:45-root@n4hgf-faster proc table manipulation */
  31. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  32. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  33. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  34. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  35. X/*:06-17-1990-16:46-wht-creation */
  36. X
  37. X#define M_TERMINFO
  38. X
  39. X#include <curses.h>
  40. X#include <panel.h>
  41. X#include <sys/types.h>
  42. X#undef NGROUPS_MAX
  43. X#undef NULL
  44. X#include <sys/param.h>
  45. X#include <sys/immu.h>
  46. X#include <sys/region.h>
  47. X#include <sys/proc.h>
  48. X#include <sys/var.h>
  49. X#include <nlist.h>
  50. X#include "nlsym.h"
  51. X#include "libkmem.h"
  52. X#include "libnlsym.h"
  53. X#include "u386mon.h"
  54. X
  55. Xextern struct var v;
  56. X
  57. Xstruct proc *procs = (struct proc *)0;
  58. Xstruct proc *oldprocs = (struct proc *)0;
  59. Xstruct proc **pprocs = (struct proc **)0;
  60. Xstruct proc **poldprocs = (struct proc **)0;
  61. X
  62. Xint procs_per_pstat[SXBRK + 1];
  63. Xint procs_in_core;
  64. Xint procs_alive;
  65. X
  66. X/*+-------------------------------------------------------------------------
  67. X    pstat_text(pstat)
  68. X--------------------------------------------------------------------------*/
  69. Xchar *
  70. Xpstat_text(pstat)
  71. Xchar pstat;
  72. X{
  73. Xstatic char errant[10];
  74. X
  75. X    switch(pstat)
  76. X    {
  77. X        case SSLEEP:   return("sleep ");
  78. X        case SRUN:     return("run   ");
  79. X        case SZOMB:    return("zombie");
  80. X        case SSTOP:    return("stop  ");
  81. X        case SIDL:     return("idle  ");
  82. X        case SONPROC:  return("onproc");
  83. X        case SXBRK:    return("xbrk  ");
  84. X    }
  85. X    (void)sprintf(errant,"%06u?",(unsigned char)pstat);
  86. X    return(errant);
  87. X
  88. X}    /* end of pstat_text */
  89. X
  90. X/*+-------------------------------------------------------------------------
  91. X    grok_proc() - read and examine kernel process table
  92. X--------------------------------------------------------------------------*/
  93. Xvoid
  94. Xgrok_proc()
  95. X{
  96. Xregister iproc;
  97. Xregister struct proc *tproc;
  98. Xstatic char *memfail = "cannot alloc memory for proc table";
  99. X
  100. X    if(!procs)
  101. X    {
  102. X        if(!(procs = (struct proc *)malloc(sizeof(struct proc) * v.v_proc)))
  103. X            leave_text(memfail,1);
  104. X        if(!(oldprocs = (struct proc *)malloc(sizeof(struct proc) * v.v_proc)))
  105. X            leave_text(memfail,1);
  106. X        if(!(pprocs = (struct proc **)malloc(sizeof(struct proc *) * v.v_proc)))
  107. X            leave_text(memfail,1);
  108. X        if(!(poldprocs=(struct proc **)malloc(sizeof(struct proc *)*v.v_proc)))
  109. X            leave_text(memfail,1);
  110. X    }
  111. X    kread((caddr_t)procs,procaddr,sizeof(struct proc) * v.v_proc);
  112. X    for(iproc = 0; iproc < SXBRK + 1; iproc++)
  113. X        procs_per_pstat[iproc] = 0;
  114. X    procs_in_core = 0;
  115. X    procs_alive = 0;
  116. X
  117. X    for(iproc = 0; iproc < v.v_proc; iproc++)
  118. X    {
  119. X        tproc = pprocs[iproc] = (procs + iproc);
  120. X
  121. X        if(tproc->p_stat)
  122. X            procs_alive++;
  123. X
  124. X        procs_per_pstat[tproc->p_stat]++;    /* count # procs in each state */
  125. X
  126. X        if(tproc->p_flag & SLOAD)            /* count # procs in memory */
  127. X            procs_in_core++;
  128. X    }
  129. X
  130. X}    /* end of grok_proc */
  131. X
  132. X/*+-------------------------------------------------------------------------
  133. X    display_proc(win,y,x)
  134. X--------------------------------------------------------------------------*/
  135. Xvoid
  136. Xdisplay_proc(win,y,x)
  137. XWINDOW *win;
  138. Xint y;
  139. Xint x;
  140. X{
  141. Xregister istat;
  142. X
  143. X    grok_proc();
  144. X
  145. X    use_cp(win,cpBANNER);
  146. X    wmove(win,y++,x);
  147. X    waddstr(win,"-- Proc ---");
  148. X    for(istat = SSLEEP; istat <= SXBRK; istat++)
  149. X    {
  150. X        wmove(win,y++,x);
  151. X        disp_info_int(win,pstat_text(istat),"  %3d",procs_per_pstat[istat]);
  152. X    }
  153. X    wmove(win,y++,x);
  154. X    disp_info_int(win,"total ","  %3d",procs_alive);
  155. X    wmove(win,y++,x);
  156. X    disp_info_int(win,"in mem","  %3d",procs_in_core);
  157. X}    /* end of display_proc */
  158. X
  159. X/* vi: set tabstop=4 shiftwidth=4: */
  160. X/* end of proc.c */
  161. SHAR_EOF
  162. $TOUCH -am 0715025190 proc.c &&
  163. chmod 0644 proc.c ||
  164. echo "restore of proc.c failed"
  165. set `wc -c proc.c`;Wc_c=$1
  166. if test "$Wc_c" != "3815"; then
  167.     echo original size 3815, current size $Wc_c
  168. fi
  169. # ============= tune.c ==============
  170. echo "x - extracting tune.c (Text)"
  171. sed 's/^X//' << 'SHAR_EOF' > tune.c &&
  172. X/* CHK=0xECB8 */
  173. X/*+-------------------------------------------------------------------------
  174. X    tune.c - u386mon tune struct display
  175. X
  176. X  Defined functions:
  177. X    display_tune(win,y,x)
  178. X
  179. X--------------------------------------------------------------------------*/
  180. X/*+:EDITS:*/
  181. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  182. X/*:06-25-1990-17:33-wht@n4hgf-alpha sort identifiers */
  183. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  184. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  185. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  186. X/*:06-17-1990-14:59-wht-creation */
  187. X
  188. X#define M_TERMINFO
  189. X
  190. X#include <curses.h>
  191. X#include <panel.h>
  192. X#include <sys/types.h>
  193. X#include <sys/tuneable.h>
  194. X#include "u386mon.h"
  195. X
  196. X/*+-------------------------------------------------------------------------
  197. X    display_tune(win,y,x)
  198. X--------------------------------------------------------------------------*/
  199. Xvoid
  200. Xdisplay_tune(win,y,x)
  201. XWINDOW *win;
  202. Xint y;
  203. Xint x;
  204. X{
  205. X
  206. X    use_cp(win,cpBANNER);
  207. X    wmove(win,y++,x);
  208. X    waddstr(win,"-- Tune ---------");
  209. X    wmove(win,y++,x);
  210. X    disp_static_int(win,"t_ageintvl  ","%5d",tune.t_ageinterval);
  211. X    wmove(win,y++,x);
  212. X    disp_static_int(win,"t_bdflushr  ","%5d",tune.t_bdflushr);
  213. X    wmove(win,y++,x);
  214. X    disp_static_int(win,"t_gpgshi    ","%5d",tune.t_gpgshi);
  215. X    wmove(win,y++,x);
  216. X    disp_static_int(win,"t_gpgslo    ","%5d",tune.t_gpgslo);
  217. X    wmove(win,y++,x);
  218. X    disp_static_int(win,"t_gpgsmsk   ","0x%03lx",tune.t_gpgsmsk);
  219. X    wmove(win,y++,x);
  220. X    disp_static_int(win,"t_maxfc     ","%5d",tune.t_maxfc);
  221. X    wmove(win,y++,x);
  222. X    disp_static_int(win,"t_maxsc     ","%5d",tune.t_maxsc);
  223. X    wmove(win,y++,x);
  224. X    disp_static_int(win,"t_maxumem   ","%5d",tune.t_maxumem);
  225. X    wmove(win,y++,x);
  226. X    disp_static_int(win,"t_minarmem  ","%5d",tune.t_minarmem);
  227. X    wmove(win,y++,x);
  228. X    disp_static_int(win,"t_minasmem  ","%5d",tune.t_minasmem);
  229. X
  230. X}    /* end of display_tune */
  231. X
  232. X/* vi: set tabstop=4 shiftwidth=4: */
  233. X/* end of tune.c */
  234. SHAR_EOF
  235. $TOUCH -am 0715025190 tune.c &&
  236. chmod 0644 tune.c ||
  237. echo "restore of tune.c failed"
  238. set `wc -c tune.c`;Wc_c=$1
  239. if test "$Wc_c" != "1956"; then
  240.     echo original size 1956, current size $Wc_c
  241. fi
  242. # ============= u386mon.c ==============
  243. echo "x - extracting u386mon.c (Text)"
  244. sed 's/^X//' << 'SHAR_EOF' > u386mon.c &&
  245. X/* CHK=0x0852 */
  246. Xchar *revision = "2.00";
  247. X/*+-------------------------------------------------------------------------
  248. X    u386mon.c - UNIX 386 system monitor
  249. X
  250. X  Defined functions:
  251. X    adb_trap()
  252. X    calc_cpu_avg(per_state)
  253. X    calc_wait_avg(per_state)
  254. X    caught_signal(sig)
  255. X    draw_cpuscale_literals(win,y,x)
  256. X    draw_per_sec_literals(win,y,x)
  257. X    draw_waitscale_literals(win,y,x)
  258. X    extra_info_stuff()
  259. X    extra_static_stuff()
  260. X    get_cpu_avg(cpu_ticks,period)
  261. X    get_elapsed_time(elapsed_seconds)
  262. X    get_wait_avg(wait_ticks,period)
  263. X    leave(exit_code)
  264. X    leave_text(text,exit_code)
  265. X    leaving(exit_code)
  266. X    main(argc,argv,envp)
  267. X    update_cpuscale(win,y,x,width,per_state)
  268. X    update_waitscale(win,y,x,width,per_state,total_ticks)
  269. X
  270. X00000000001111111111222222222233333333334444444444555555555566666666667777777777
  271. X01234567890123456789012345678901234567890123456789012345678901234567890123456789
  272. X u386mon xxx.xxx                       PLOCK     INVALID      hh:mm:ss wht@n4hgf
  273. X
  274. X---- CPU --- tot usr ker brk ---------------------------------------------------
  275. X Instant %   ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  276. X 5 Sec Avg % ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  277. X10 Sec Avg % ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  278. X---- Wait -- tot  io pio swp ---------------------------------------------------
  279. X Instant %   ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  280. X 5 Sec Avg % ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  281. X10 Sec Avg % ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  282. X
  283. X--------------------------------------------------------------------------*/
  284. X/*+:EDITS:*/
  285. X/*:07-11-1990-03:45-root@n4hgf-faster proc table manipulation */
  286. X/*:07-10-1990-19:06-root@n4hgf-redesign attributes/color pairs */
  287. X/*:07-10-1990-18:33-root@n4hgf-move pio wait to medium alert */
  288. X/*:07-10-1990-18:01-root@n4hgf-"improvement" didnt do much, but leave for now */
  289. X/*:07-10-1990-13:54-root@n4hgf-improve nap heuristics and catch signals */
  290. X/*:07-08-1990-20:31-root@n4hgf-make room for phread/phwrite */
  291. X/*:07-03-1990-02:48-root@n4hgf-more accurate timing using ftime calculations */
  292. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  293. X/*:06-27-1990-01:07-wht@n4hgf-add ^R and ^L refresh */
  294. X/*:06-25-1990-17:34-wht@n4hgf-add detail extra for 25 line tubes */
  295. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  296. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  297. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  298. X/*:06-15-1990-18:32-wht@n4hgf-creation */
  299. X
  300. X#define M_TERMINFO
  301. X
  302. X#include <curses.h>
  303. X#undef timeout /* conflict in curses.h and bootinfo.h per trb@ima.ima.isc.com */
  304. X#include <panel.h>
  305. X#include <signal.h>
  306. X#include <string.h>
  307. X#include <fcntl.h>
  308. X#include <nlist.h>
  309. X#include <errno.h>
  310. X#include <time.h>
  311. X#include <sys/types.h>
  312. X#include <sys/timeb.h>
  313. X#include <sys/lock.h>
  314. X#include <sys/utsname.h>
  315. X#include <sys/stat.h>
  316. X#include <sys/ascii.h>
  317. X#undef NGROUPS_MAX
  318. X#undef NULL
  319. X#include <sys/param.h>
  320. X#include <sys/bootinfo.h>
  321. X#include <sys/tuneable.h>
  322. X#include <sys/sysinfo.h>
  323. X#include <sys/sysmacros.h>
  324. X#include <sys/immu.h>
  325. X#include <sys/region.h>
  326. X#include <sys/proc.h>
  327. X#include <sys/var.h>
  328. X#include "nlsym.h"
  329. X#include "libkmem.h"
  330. X#include "libmem.h"
  331. X#include "libswap.h"
  332. X#include "libnlsym.h"
  333. X#include "u386mon.h"
  334. X
  335. Xlong nap();
  336. XPANEL *mkpanel();
  337. X
  338. X#define delta_msec(t,t0) ((( t.time * 1000L) +  t.millitm) - \
  339. X                          ((t0.time * 1000L) + t0.millitm))
  340. X
  341. Xstruct sysinfo sysinfo;
  342. Xstruct sysinfo sysinfo_last;
  343. X#define sysidelta(x) (sysinfo.x - sysinfo_last.x)
  344. X
  345. Xstruct minfo minfo;
  346. Xstruct minfo minfo_last;
  347. X#define midelta(x) (minfo.x - minfo_last.x)
  348. X
  349. Xstruct bootinfo bootinfo;
  350. Xstruct tune tune;
  351. Xstruct utsname utsname;
  352. Xstruct var v;
  353. Xstruct timeb timeb_cycle_start;
  354. Xstruct timeb timeb_cycle_end;
  355. Xstruct timeb timeb_info_read;
  356. Xstruct timeb timeb_last_info_read;
  357. Xint hz;
  358. Xint nswap;
  359. Xint maxmem;
  360. Xint freemem;
  361. Xdaddr_t myreadcnt = 0L;
  362. Xint stat_period_msec_y = -1;
  363. Xint stat_period_msec_x = -1;
  364. Xint color_avail;
  365. X
  366. XPANEL *pscr;
  367. XWINDOW *wscr;
  368. Xextern WINDOW *wdet;
  369. X
  370. X#define CPU_AVG_MAX        10
  371. Xint cpu_avg_init = 0;
  372. Xtime_t *cpu_avg[CPU_AVG_MAX];
  373. Xtime_t cpu_ticks[5];
  374. X
  375. X#define WAIT_AVG_MAX    10
  376. Xint wait_avg_init = 0;
  377. Xtime_t *wait_avg[WAIT_AVG_MAX];
  378. Xtime_t wait_ticks[5];
  379. X
  380. X/*+-------------------------------------------------------------------------
  381. X    leaving() - perform leave() basic processing and return
  382. X--------------------------------------------------------------------------*/
  383. Xvoid
  384. Xleaving()
  385. X{
  386. X    wmove(wscr,CMD_TLY,0);
  387. X    use_cp(wscr,cpLIT);
  388. X    wclrtoeol(wscr);
  389. X    pflush();
  390. X    endwin();
  391. X}    /* end of leaving */
  392. X
  393. X/*+-------------------------------------------------------------------------
  394. X    leave(exit_code) - leave program with exit code
  395. X--------------------------------------------------------------------------*/
  396. Xvoid
  397. Xleave(exit_code)
  398. Xint exit_code;
  399. X{
  400. X    leaving();
  401. X    exit(exit_code);
  402. X}    /* end of leave */
  403. X
  404. X/*+-------------------------------------------------------------------------
  405. X    leave_text(text,exit_code) - leave program with message and exit code
  406. XIf exit_code == 255, do wperror
  407. X--------------------------------------------------------------------------*/
  408. Xvoid
  409. Xleave_text(text,exit_code)
  410. Xchar *text;
  411. Xint exit_code;
  412. X{
  413. X    if(exit_code == 255)
  414. X    {
  415. X    int y;
  416. X    register x;
  417. X    extern int errno;
  418. X    extern int sys_nerr;
  419. X    extern char *sys_errlist[];
  420. X
  421. X        top_panel(pscr);
  422. X        wmove(wscr,MSG_TLY - 2,0);
  423. X        use_cp(wscr,cpHIGH);
  424. X        x = 0;
  425. X        while(x++ < COLS)
  426. X            waddch(wscr,(chtype)' ');
  427. X        wmove(wscr,MSG_TLY - 1,0);
  428. X        wprintw(wscr,"errno %d",errno);
  429. X        if(errno < sys_nerr)
  430. X            wprintw(wscr,": %s",sys_errlist[errno]);
  431. X        getyx(wscr,y,x);
  432. X        while(x++ < COLS)
  433. X            waddch(wscr,(chtype)' ');
  434. X    }
  435. X    disp_msg(cpHIGH,text);
  436. X    leave(exit_code);
  437. X}    /* end of leave_text */
  438. X
  439. X/*+-------------------------------------------------------------------------
  440. X    adb_trap() - convenient trap for catching abort
  441. X--------------------------------------------------------------------------*/
  442. X#ifdef DEBUG
  443. Xvoid
  444. Xadb_trap()
  445. X{
  446. X    printf("too bad .... goodbye\n");
  447. X}    /* end of adb_trap */
  448. X#endif
  449. X
  450. X/*+-------------------------------------------------------------------------
  451. X    caught_signal(sig) - SIGHUP thru SIGSYS: leave with possible abort
  452. X--------------------------------------------------------------------------*/
  453. Xvoid
  454. Xcaught_signal(sig)
  455. Xint sig;
  456. X{
  457. X    leaving();
  458. X    switch(sig)
  459. X    {
  460. X        case SIGQUIT:
  461. X        case SIGILL:
  462. X        case SIGTRAP:
  463. X        case SIGIOT:
  464. X        case SIGEMT:
  465. X        case SIGFPE:
  466. X        case SIGBUS:
  467. X        case SIGSEGV:
  468. X        case SIGSYS:
  469. X#ifdef DEBUG
  470. X            adb_trap();    /* if debugging, stop at convenient breakpoint */
  471. X#endif
  472. X            abort();
  473. X    }
  474. X    exit(200);
  475. X}    /* end of caught_signal */
  476. X
  477. X/*+-----------------------------------------------------------------------
  478. X    char *get_elapsed_time(elapsed_seconds) - "ddd+hh:mm:ss" returned
  479. X  static string address is returned
  480. X------------------------------------------------------------------------*/
  481. Xchar *
  482. Xget_elapsed_time(elapsed_seconds)
  483. Xtime_t elapsed_seconds;
  484. X{
  485. Xstatic char elapsed_time_str[32];
  486. Xtime_t dd,hh,mm,ss;
  487. X
  488. X    dd = 0;
  489. X    hh = elapsed_seconds / 3600;
  490. X    if(hh > 24)
  491. X    {
  492. X        dd = hh / 24;
  493. X        elapsed_seconds -= dd * 3600 * 24;
  494. X        hh %= 24;
  495. X    }
  496. X    elapsed_seconds -= hh * 3600;
  497. X    mm = elapsed_seconds / 60L;
  498. X    elapsed_seconds -= mm * 60L;
  499. X    ss = elapsed_seconds;
  500. X
  501. X    if(dd)
  502. X        (void)sprintf(elapsed_time_str,"%3ld+%02ld:%02ld:%02ld",dd,hh,mm,ss);
  503. X    else
  504. X        (void)sprintf(elapsed_time_str,"    %2ld:%02ld:%02ld",hh,mm,ss);
  505. X    return(elapsed_time_str);
  506. X}    /* end of get_elapsed_time */
  507. X
  508. X/*+-------------------------------------------------------------------------
  509. X    draw_cpuscale_literals(win)
  510. X--------------------------------------------------------------------------*/
  511. Xvoid
  512. Xdraw_cpuscale_literals(win,y,x)
  513. XWINDOW *win;
  514. Xint y;
  515. Xint x;
  516. X{
  517. Xint x2 = x;
  518. X
  519. X    wmove(win,y,x);
  520. X    use_cp(wscr,cpBANNER);
  521. X    waddstr(win,"---- CPU --- tot usr ker brk ");
  522. X    getyx(win,y,x2);
  523. X    while(x2 < COLS)
  524. X        waddch(win,(chtype)'-'),x2++;
  525. X    use_cp(wscr,cpLIT);
  526. X    wmove(win,y + 1,x);
  527. X      waddstr(win," Instant %  ");
  528. X    wmove(win,y + 2,x);
  529. X      waddstr(win," 5 Sec Avg %");
  530. X    wmove(win,y + 3,x);
  531. X    waddstr(win,"10 Sec Avg %");
  532. X
  533. X}    /* end of draw_cpuscale_literals */
  534. X
  535. X/*+-------------------------------------------------------------------------
  536. X    update_cpuscale(win,y,width,per_state)
  537. X
  538. X000000000011111111112222222222333333333344444444445555555555666666
  539. X012345678901234567890123456789012345678901234567890123456789012345
  540. Xtot usr ker misc 
  541. X### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  542. X--------------------------------------------------------------------------*/
  543. X#define _CPUSCALE_TX    0
  544. X#define _CPUSCALE_UX    4
  545. X#define _CPUSCALE_KX    8
  546. X#define _CPUSCALE_BX    12
  547. X#define _CPUSCALE_SX    16
  548. X
  549. Xtime_t
  550. Xupdate_cpuscale(win,y,x,width,per_state)
  551. XWINDOW *win;
  552. Xint y;
  553. Xint x;
  554. Xregister width;
  555. Xtime_t *per_state;
  556. X{
  557. Xregister itmp;
  558. Xint accum = 0;
  559. Xtime_t idle = per_state[CPU_IDLE] + per_state[CPU_WAIT];
  560. Xtime_t cpu_ticks_total = idle + per_state[CPU_SXBRK] + 
  561. X    per_state[CPU_IDLE] + per_state[CPU_KERNEL] + per_state[CPU_USER];
  562. Xtime_t percent_user    = (per_state[CPU_USER]   * 100) / cpu_ticks_total;
  563. Xtime_t percent_kernel  = (per_state[CPU_KERNEL] * 100) / cpu_ticks_total;
  564. Xtime_t percent_break   = (per_state[CPU_SXBRK]  * 100) / cpu_ticks_total;
  565. Xtime_t percent_busy    = percent_user + percent_kernel + percent_break;
  566. X
  567. X    if(!idle)            /* take care of integer div truncation */
  568. X        percent_busy = 100;
  569. X
  570. X    wmove(win,y, x + _CPUSCALE_TX);
  571. X    if(percent_busy < 70)
  572. X        use_cp(wscr,cpLOW);
  573. X    else if(percent_busy < 90)
  574. X        use_cp(wscr,cpMED);
  575. X    else
  576. X        use_cp(wscr,cpHIGH);
  577. X    wprintw(win,"%3ld",percent_busy);
  578. X
  579. X    wmove(win,y, x + _CPUSCALE_UX);
  580. X    use_cp(wscr,cpINFO);
  581. X    wprintw(win,"%3ld",percent_user);
  582. X    
  583. X    wmove(win,y, x + _CPUSCALE_KX);
  584. X    wprintw(win,"%3ld",percent_kernel);
  585. X    
  586. X    wmove(win,y, x + _CPUSCALE_BX);
  587. X    wprintw(win,"%3ld",percent_break);
  588. X    
  589. X    wmove(win,y, x + _CPUSCALE_SX);
  590. X
  591. X    use_cp(wscr,cpLOW);
  592. X    itmp = (width * percent_user) / 100;
  593. X    accum += itmp;
  594. X    while(itmp--)
  595. X        waddch(win,(chtype)'u');
  596. X
  597. X    use_cp(wscr,cpMED);
  598. X    itmp = (width * percent_kernel) / 100;
  599. X    accum += itmp;
  600. X    while(itmp--)
  601. X        waddch(win,(chtype)'k');
  602. X
  603. X    use_cp(wscr,cpHIGH);
  604. X    itmp = (width * percent_break) / 100;
  605. X    accum += itmp;
  606. X    while(itmp--)
  607. X        waddch(win,(chtype)'b');
  608. X
  609. X    if((percent_busy > 98) && ((width - accum) > 0))
  610. X    {
  611. X        waddch(win,(chtype)'*');
  612. X        accum++;
  613. X    }
  614. X
  615. X    if((itmp = (width - accum)) > 0)
  616. X    {
  617. X        while(itmp--)
  618. X            waddch(win,(chtype)' ');
  619. X    }
  620. X    return(cpu_ticks_total);
  621. X}    /* end of update_cpuscale */
  622. X
  623. X/*+-------------------------------------------------------------------------
  624. X    calc_cpu_avg(per_state) - add per_state array to avg array
  625. X--------------------------------------------------------------------------*/
  626. Xvoid
  627. Xcalc_cpu_avg(per_state)
  628. Xtime_t per_state[];
  629. X{
  630. Xregister itmp;
  631. X
  632. X    if(!cpu_avg_init)
  633. X    {
  634. X        for(itmp = 0; itmp < CPU_AVG_MAX; itmp++)
  635. X            (void)memcpy(cpu_avg[itmp],per_state,sizeof(time_t) * 5);
  636. X        cpu_avg_init = 1;
  637. X    }
  638. X    else
  639. X    {
  640. X        for(itmp = 0; itmp < CPU_AVG_MAX - 1; itmp++)
  641. X            (void)memcpy(cpu_avg[itmp],cpu_avg[itmp + 1],sizeof(time_t) * 5);
  642. X        (void)memcpy(cpu_avg[itmp],per_state,sizeof(time_t) * 5);
  643. X    }
  644. X
  645. X}    /* end of calc_cpu_avg */
  646. X
  647. X/*+-------------------------------------------------------------------------
  648. X    get_cpu_avg(cpu_ticks,period)
  649. X--------------------------------------------------------------------------*/
  650. Xget_cpu_avg(cpu_ticks,period)
  651. Xtime_t cpu_ticks[];
  652. Xint period;
  653. X{
  654. Xregister iperiod = CPU_AVG_MAX;
  655. Xregister istate;
  656. Xregister count = period;
  657. X
  658. X    for(istate = 0; istate < 5; istate++)
  659. X        cpu_ticks[istate] = 0;
  660. X
  661. X    while(count--)
  662. X    {
  663. X        iperiod--;
  664. X        for(istate = 0; istate < 5; istate++)
  665. X        {
  666. X            cpu_ticks[istate] += (cpu_avg[iperiod])[istate];
  667. X        }
  668. X    }
  669. X
  670. X    for(istate = 0; istate < 5; istate++)
  671. X        cpu_ticks[istate] /= period;
  672. X
  673. X}    /* end of get_cpu_avg */
  674. X
  675. X/*+-------------------------------------------------------------------------
  676. X    draw_waitscale_literals(win)
  677. X--------------------------------------------------------------------------*/
  678. Xvoid
  679. Xdraw_waitscale_literals(win,y,x)
  680. XWINDOW *win;
  681. Xint y;
  682. Xint x;
  683. X{
  684. Xint x2 = x;
  685. X
  686. X    wmove(win,y,x);
  687. X    use_cp(wscr,cpBANNER);
  688. X    waddstr(win,"---- Wait -- tot  io pio swp -- (% of real time) ");
  689. X    getyx(win,y,x2);
  690. X    while(x2 < COLS)
  691. X        waddch(win,(chtype)'-'),x2++;
  692. X    use_cp(wscr,cpLIT);
  693. X    wmove(win,y + 1,x);
  694. X      waddstr(win," Instant %  ");
  695. X    wmove(win,y + 2,x);
  696. X      waddstr(win," 5 Sec Avg %");
  697. X    wmove(win,y + 3,x);
  698. X    waddstr(win,"10 Sec Avg %");
  699. X
  700. X}    /* end of draw_waitscale_literals */
  701. X
  702. X/*+-------------------------------------------------------------------------
  703. X    draw_per_sec_literals(win)
  704. X--------------------------------------------------------------------------*/
  705. Xvoid
  706. Xdraw_per_sec_literals(win,y,x)
  707. XWINDOW *win;
  708. Xint y;
  709. Xint x;
  710. X{
  711. X
  712. X    wmove(win,y,x);
  713. X    use_cp(wscr,cpBANNER);
  714. X    waddstr(win,"---- Sysinfo/Minfo --- (last ");
  715. X    getyx(win,stat_period_msec_y,stat_period_msec_x);
  716. X     waddstr(win," 1000 msec activity) ");
  717. X    getyx(win,y,x);
  718. X    while(x < getmaxx(win))
  719. X        waddch(win,(chtype)'-'),x++;
  720. X
  721. X}    /* end of draw_per_sec_literals */
  722. X
  723. X/*+-------------------------------------------------------------------------
  724. X    update_waitscale(win,y,width,per_state)
  725. X
  726. X000000000011111111112222222222333333333344444444445555555555666666
  727. X012345678901234567890123456789012345678901234567890123456789012345
  728. Xtot  io pio swp  
  729. X### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  730. X--------------------------------------------------------------------------*/
  731. X#define _WAITSCALE_TX    0
  732. X#define _WAITSCALE_IX    4
  733. X#define _WAITSCALE_PX    8
  734. X#define _WAITSCALE_WX    12
  735. X#define _WAITSCALE_SX    16
  736. X
  737. Xtime_t
  738. Xupdate_waitscale(win,y,x,width,per_state,total_ticks)
  739. XWINDOW *win;
  740. Xint y;
  741. Xint x;
  742. Xregister width;
  743. Xtime_t *per_state;
  744. Xtime_t total_ticks;
  745. X{
  746. Xregister itmp;
  747. Xint accum = 0;
  748. Xtime_t percent_io = 0L;
  749. Xtime_t percent_swap = 0L;
  750. Xtime_t percent_pio = 0L;
  751. Xtime_t percent_total_wait;
  752. Xtime_t total_wait;
  753. X
  754. X/* crock: because of latency, total_ticks < all wait ticks sometimes */
  755. X    total_wait = per_state[W_IO] + per_state[W_SWAP] + per_state[W_PIO];
  756. X    if(total_ticks < total_wait)
  757. X        total_ticks = total_wait;
  758. X
  759. X    if(total_ticks)
  760. X    {
  761. X        percent_io    = (per_state[W_IO]   * 100) / total_ticks;
  762. X        percent_pio   = (per_state[W_PIO]  * 100) / total_ticks;
  763. X        percent_swap  = (per_state[W_SWAP] * 100) / total_ticks;
  764. X    }
  765. X
  766. X    percent_total_wait = percent_io + percent_swap + percent_pio;
  767. X    wmove(win,y, x + _WAITSCALE_TX);
  768. X    if(percent_total_wait < 30)
  769. X        use_cp(wscr,cpLOW);
  770. X    else if(percent_total_wait < 50)
  771. X        use_cp(wscr,cpMED);
  772. X    else
  773. X        use_cp(wscr,cpHIGH);
  774. X    wprintw(win,"%3ld",percent_total_wait);
  775. X
  776. X    use_cp(wscr,cpINFO);
  777. X    wmove(win,y, x + _WAITSCALE_IX);
  778. X    wprintw(win,"%3ld",percent_io);
  779. X    
  780. X    wmove(win,y, x + _WAITSCALE_PX);
  781. X    wprintw(win,"%3ld",percent_pio);
  782. X    
  783. X    wmove(win,y, x + _WAITSCALE_WX);
  784. X    wprintw(win,"%3ld",percent_swap);
  785. X    
  786. X    wmove(win,y, x + _WAITSCALE_SX);
  787. X
  788. X    use_cp(wscr,cpLOW);
  789. X    itmp = (width * percent_io) / 100;
  790. X    accum += itmp;
  791. X    while(itmp--)
  792. X        waddch(win,(chtype)'i');
  793. X
  794. X    use_cp(wscr,cpMED);
  795. X    itmp = (width * percent_pio) / 100;
  796. X    accum += itmp;
  797. X    while(itmp--)
  798. X        waddch(win,(chtype)'p');
  799. X
  800. X    use_cp(wscr,cpHIGH);
  801. X    itmp = (width * percent_swap) / 100;
  802. X    accum += itmp;
  803. X    while(itmp--)
  804. X        waddch(win,(chtype)'s');
  805. X
  806. X    if((itmp = (width - accum)) > 0)
  807. X    {
  808. X        while(itmp--)
  809. X            waddch(win,(chtype)' ');
  810. X    }
  811. X
  812. X}    /* end of update_waitscale */
  813. X
  814. X/*+-------------------------------------------------------------------------
  815. X    calc_wait_avg(per_state) - add per_state array to avg array
  816. X--------------------------------------------------------------------------*/
  817. Xvoid
  818. Xcalc_wait_avg(per_state)
  819. Xtime_t per_state[];
  820. X{
  821. Xregister itmp;
  822. X
  823. X    if(!wait_avg_init)
  824. X    {
  825. X        for(itmp = 0; itmp < WAIT_AVG_MAX; itmp++)
  826. X            (void)memcpy(wait_avg[itmp],per_state,sizeof(time_t) * 3);
  827. X        wait_avg_init = 1;
  828. X    }
  829. X    else
  830. X    {
  831. X        for(itmp = 0; itmp < WAIT_AVG_MAX - 1; itmp++)
  832. X            (void)memcpy(wait_avg[itmp],wait_avg[itmp + 1],sizeof(time_t) * 3);
  833. X        (void)memcpy(wait_avg[itmp],per_state,sizeof(time_t) * 3);
  834. X    }
  835. X
  836. X}    /* end of calc_wait_avg */
  837. X
  838. X/*+-------------------------------------------------------------------------
  839. X    get_wait_avg(wait_ticks,period)
  840. X--------------------------------------------------------------------------*/
  841. Xget_wait_avg(wait_ticks,period)
  842. Xtime_t wait_ticks[];
  843. Xint period;
  844. X{
  845. Xregister iperiod = WAIT_AVG_MAX;
  846. Xregister istate;
  847. Xregister count = period;
  848. X
  849. X    for(istate = 0; istate < 3; istate++)
  850. X        wait_ticks[istate] = 0;
  851. X
  852. X    while(count--)
  853. X    {
  854. X        iperiod--;
  855. X        for(istate = 0; istate < 3; istate++)
  856. X        {
  857. X            wait_ticks[istate] += (wait_avg[iperiod])[istate];
  858. X        }
  859. X    }
  860. X
  861. X    for(istate = 0; istate < 3; istate++)
  862. X        wait_ticks[istate] /= period;
  863. X
  864. X}    /* end of get_wait_avg */
  865. X
  866. X/*+-------------------------------------------------------------------------
  867. X    extra_static_stuff()/extra_info_stuff() - for 43 line display
  868. X--------------------------------------------------------------------------*/
  869. Xvoid
  870. Xextra_static_stuff()
  871. X{
  872. X    display_var(wscr,EXTRA_TLY,EXTRA1_TLX);
  873. X    display_bootinfo(wscr,EXTRA_TLY,EXTRA2_TLX);
  874. X    display_tune(wscr,EXTRA_TLY,EXTRA3_TLX);
  875. X}    /* end of extra_static_stuff */
  876. Xvoid
  877. Xextra_info_stuff()
  878. X{
  879. X    display_proc(wscr,EXTRA_TLY,EXTRA4_TLX);
  880. X}    /* end of extra_info_stuff */
  881. X
  882. X/*+-------------------------------------------------------------------------
  883. X    read_sysinfo_and_minfo()
  884. X--------------------------------------------------------------------------*/
  885. Xvoid
  886. Xread_sysinfo_and_minfo()
  887. X{
  888. X    timeb_last_info_read = timeb_info_read;
  889. X    (void)ftime(&timeb_info_read);
  890. X    kread((caddr_t)&sysinfo,sysinfoaddr,sizeof(sysinfo));
  891. X    kread((caddr_t)&minfo,minfoaddr,sizeof(minfo));
  892. X}    /* end of read_sysinfo_and_minfo */
  893. X
  894. X/*+-------------------------------------------------------------------------
  895. X    main(argc,argv,envp)
  896. X--------------------------------------------------------------------------*/
  897. X/*ARGSUSED*/
  898. Xmain(argc,argv,envp)
  899. Xint argc;
  900. Xchar **argv;
  901. Xchar **envp;
  902. X{
  903. Xregister itmp;
  904. Xregister char *cptr;
  905. Xregister chtype cmd;
  906. Xregister chtype initial_cmd = 0;
  907. Xint errflg = 0;
  908. Xint plock_indicator = 0;
  909. Xtime_t total_ticks;
  910. Xlong stat_period_msec;
  911. Xlong nap_msec;
  912. Xint y,x;
  913. Xint invalidity = 0;
  914. Xlong ltmp;
  915. Xstruct tm *lt;
  916. Xstatic char stdoutbuf[2048];
  917. Xchar s80[80];
  918. Xextern char *optarg;
  919. Xextern int optind;
  920. X
  921. X/*
  922. X * curses works better if standard output is fully buffered
  923. X */
  924. X    (void)setvbuf(stdout,stdoutbuf,_IOFBF,sizeof(stdoutbuf));
  925. X
  926. X/*
  927. X * check out command line
  928. X */
  929. X    while((itmp = getopt(argc,argv,"lPps")) != -1)
  930. X    {
  931. X        switch(itmp)
  932. X        {
  933. X            case 'P':
  934. X            case 'p':
  935. X#ifdef M_UNIX
  936. X            case 's':
  937. X#endif
  938. X                initial_cmd = (chtype) itmp;
  939. X                break;
  940. X            case 'l':
  941. X                plock_indicator = 1;
  942. X                break;
  943. X            case '?':
  944. X                errflg++;
  945. X        }
  946. X    }
  947. X    if(errflg || (optind != argc))
  948. X    {
  949. X        static char *usage_str[]=
  950. X        {
  951. X            "usage: u386mon [-l] [-p | -P]",
  952. X            "-l lock process into memory (if root)",
  953. X            "-p begin with short ps display",
  954. X            "-P begin with long ps display (if 43 line screen)",
  955. X            (char *)0
  956. X        };
  957. X        char **cpptr = usage_str;
  958. X        while(*cpptr)
  959. X            (void)fprintf(stderr,"%s\n",*(cpptr++));
  960. X        exit(1);
  961. X    }
  962. X
  963. X/*
  964. X * if man wants to plock() try it; fail silently if non-root
  965. X */
  966. X    if(plock_indicator && plock(PROCLOCK))
  967. X    {
  968. X        nice(-5);
  969. X        plock_indicator = 0;
  970. X    }
  971. X
  972. X/*
  973. X * Real(tm) performance monitor users will have done a kernel link
  974. X * and won't need to rely on /etc/systemid
  975. X */
  976. X    if(uname(&utsname))
  977. X    {
  978. X        leave_text("uname failed",255);
  979. X        exit(1);
  980. X    }
  981. X
  982. X/*
  983. X * allocate memory for cpu time array averaging buckets
  984. X */
  985. X    for(itmp = 0; itmp < CPU_AVG_MAX; itmp++)
  986. X    {
  987. X        if(!(cpu_avg[itmp] = (time_t *)malloc(sizeof(time_t) * 5)))
  988. X            leave_text("cannot alloc memory for cpu avg arrays",1);
  989. X    }
  990. X
  991. X/*
  992. X * allocate memory for wait time array averaging buckets
  993. X */
  994. X    for(itmp = 0; itmp < WAIT_AVG_MAX; itmp++)
  995. X    {
  996. X        if(!(wait_avg[itmp] = (time_t *)malloc(sizeof(time_t) * 3)))
  997. X            leave_text("cannot alloc memory for wait avg arrays",1);
  998. X    }
  999. X
  1000. X/*
  1001. X * initialize curses environment
  1002. X */
  1003. X    if(!initscr())
  1004. X    {
  1005. X        (void)printf("curses init failed\n");
  1006. X        exit(1);
  1007. X    }
  1008. X    color_avail = has_colors();
  1009. X    clear();
  1010. X    refresh();
  1011. X
  1012. X    if((LINES < 24) || (COLS < 80))
  1013. X    {
  1014. X        waddstr(stdscr,"\n\n\nNeed at least 80x24 screen\n\n");
  1015. X        refresh();
  1016. X        endwin();
  1017. X        exit(1);
  1018. X    }
  1019. X
  1020. X    noecho();
  1021. X    keypad(stdscr,1);
  1022. X    typeahead(-1);
  1023. X
  1024. X/*
  1025. X * see u386mon.h cXXX definitons for A_BOLD requirements for bright colors
  1026. X */
  1027. X    if(color_avail)
  1028. X    {
  1029. X        start_color();
  1030. X        init_pair(cpLIT,cBLU,cBLK);
  1031. X        init_pair(cpINFO,cGRN,cBLK);
  1032. X        init_pair(cpLOW,cLTG,cBLK);
  1033. X        init_pair(cpMED,cYEL,cBLK);
  1034. X        init_pair(cpHIGH,cRED,cBLK);
  1035. X        init_pair(cpBANNER,cBLK,cWHT);
  1036. X        init_pair(cpREVERSE,cRED,cWHT);
  1037. X        init_pair(cpBANWARN,cBLU,cWHT);
  1038. X    }
  1039. X
  1040. X    /* a hack for now -- assuming AT char set */
  1041. X#ifdef HI_BIT_CAN_BE_SET
  1042. X    acs_map['l'] = A_ALTCHARSET | sTL;    
  1043. X    acs_map['m'] = A_ALTCHARSET | sTR;    
  1044. X    acs_map['j'] = A_ALTCHARSET | sBL;    
  1045. X    acs_map['k'] = A_ALTCHARSET | sBR;    
  1046. X    acs_map['x'] = A_ALTCHARSET | sVR;        /* vertical rule */
  1047. X    acs_map['q'] = A_ALTCHARSET | sHR;        /* horizontal rule */
  1048. X    acs_map['t'] = A_ALTCHARSET | sLT;        /* left hand T */
  1049. X    acs_map['u'] = A_ALTCHARSET | sRT;        /* right hand T */
  1050. X#endif
  1051. X
  1052. X    if(!(pscr = mkpanel(LINES,COLS,0,0)))
  1053. X    {
  1054. X        addstr("cannot make screen panel");
  1055. X        refresh();
  1056. X        endwin();
  1057. X        exit(1);
  1058. X    }
  1059. X    wscr = panel_window(pscr);
  1060. X    top_panel(pscr);
  1061. X
  1062. X/*
  1063. X * catch signals that can leave our tty in disarray
  1064. X */
  1065. X    for(itmp = SIGHUP; itmp < SIGSYS; itmp++)
  1066. X        signal(itmp,caught_signal);
  1067. X
  1068. X/*
  1069. X * read nlist symbols, open /dev/kmem, /dev/mem, /dev/swap,
  1070. X * initialize detail environment
  1071. X * (all of these must occur after curses init)
  1072. X * drop euid and egid (after opening privileged mem/devices)
  1073. X * initialize process status uid->name hasher
  1074. X */
  1075. X    nlsym_read();
  1076. X    kinit(0);    /* /dev/kmem, read access only */
  1077. X    minit(0);    /* /dev/mem,  read access only */
  1078. X    sinit();    /* /dev/swap, only read access available */
  1079. X    (void)setuid(getuid());    /* some people run us setuid, so clen that up */
  1080. X    (void)setgid(getgid());    /* now that we have the fds open, drop egid */
  1081. X    kread((caddr_t)&v,vaddr,sizeof(v));
  1082. X    detail_init();
  1083. X
  1084. X/*
  1085. X * start fireworks
  1086. X */
  1087. X    wmove(wscr,0,0);
  1088. X    use_cp(wscr,cpBANNER);
  1089. X    wprintw(wscr," u386mon %s  ",revision);
  1090. X#ifdef M_UNIX
  1091. X    cptr = "SCO";
  1092. X#else
  1093. X    cptr = "ISC";
  1094. X#endif
  1095. X    wprintw(wscr,"%s - %s %s ",utsname.nodename,
  1096. X        cptr,utsname.release);
  1097. X    getyx(wscr,y,x);
  1098. X    while(x < getmaxx(wscr))
  1099. X        waddch(wscr,(chtype)' '),x++;
  1100. X    wmove(wscr,0,71);
  1101. X    waddstr(wscr,"wht@n4hgf");
  1102. X    if(plock_indicator)
  1103. X    {
  1104. X        wmove(wscr,0,38);
  1105. X        use_cp(wscr,cpMED);
  1106. X        waddstr(wscr," PLOCK ");
  1107. X        use_cp(wscr,cpBANNER);
  1108. X    }
  1109. X    wmove(wscr,CMD_TLY,0);
  1110. X    if(LINES >= 43)
  1111. X        waddstr(wscr," ESC=quit  P=long ps  p=short ps  m=main ");
  1112. X    else
  1113. X        waddstr(wscr," ESC=quit  p=ps  e=extra  m=main ");
  1114. X#ifdef M_UNIX
  1115. X    waddstr(wscr," s=sio ");
  1116. X#endif
  1117. X    if(getuid() == 0)    /* root can launch fireworks very predictably */
  1118. X        waddstr(wscr," l=plock on  u=plock off ");
  1119. X    getyx(wscr,y,x);
  1120. X    while(x < getmaxx(wscr))
  1121. X        waddch(wscr,(chtype)' '),x++;
  1122. X    use_cp(wscr,cpLIT);
  1123. X
  1124. X/*
  1125. X * make initial kmem readings
  1126. X */
  1127. X    hz = (cptr = getenv("HZ")) ? atoi(cptr) : HZ;
  1128. X    kread((caddr_t)&maxmem,maxmemaddr,sizeof(maxmem));
  1129. X    kread((caddr_t)&nswap,nswapaddr,sizeof(nswap));
  1130. X    kread((caddr_t)&tune,tuneaddr,sizeof(tune));
  1131. X    kread((caddr_t)&bootinfo,bootinfoaddr,sizeof(bootinfo));
  1132. X    read_sysinfo_and_minfo();
  1133. X    sysinfo_last = sysinfo;
  1134. X    minfo_last = minfo;
  1135. X    timeb_last_info_read = timeb_info_read;
  1136. X
  1137. X/*
  1138. X * initialize static display (literals)
  1139. X */
  1140. X    draw_cpuscale_literals(wscr,CPUSCALE_TLY,0);
  1141. X    draw_waitscale_literals(wscr,WAITSCALE_TLY,0);
  1142. X    draw_per_sec_literals(wscr,PER_SEC_TLY,0);
  1143. X
  1144. X    if(LINES >= 43)
  1145. X        extra_static_stuff();
  1146. X
  1147. X/*
  1148. X * while(user_not_bored) entertain_and_inform_user();
  1149. X */
  1150. X    while(1)
  1151. X    {
  1152. X        ftime(&timeb_cycle_start);
  1153. X        stat_period_msec = delta_msec(timeb_info_read,timeb_last_info_read);
  1154. X        (void)time(<mp);
  1155. X        lt = localtime(<mp);
  1156. X        wmove(wscr,0,62);
  1157. X        use_cp(wscr,cpBANNER);
  1158. X        wprintw(wscr,"%02d:%02d:%02d",lt->tm_hour,lt->tm_min,lt->tm_sec);
  1159. X
  1160. X        /* heuristic validity determination */
  1161. X        wmove(wscr,0,48);
  1162. X        if((itmp = stat_period_msec > 4000L) || (invalidity > 5))
  1163. X        {
  1164. X            use_cp(wscr,cpHIGH);
  1165. X            waddstr(wscr," INVALID ");
  1166. X            if(itmp)
  1167. X            {
  1168. X                invalidity += (stat_period_msec >= 8000L)
  1169. X                        ? 8
  1170. X                        : ((stat_period_msec / 1000) - 2);
  1171. X            }
  1172. X        }
  1173. X        else if((itmp = (stat_period_msec > 2500L)) || (invalidity > 2))
  1174. X        {
  1175. X            use_cp(wscr,cpMED);
  1176. X            waddstr(wscr," INEXACT ");
  1177. X            if(itmp)
  1178. X                invalidity += 2;
  1179. X        }
  1180. X        if(invalidity && !(--invalidity))
  1181. X        {
  1182. X            use_cp(wscr,cpBANNER);
  1183. X            waddstr(wscr,"         ");
  1184. X        }
  1185. X        if(stat_period_msec > 2000L)
  1186. X            use_cp(wscr,cpREVERSE);
  1187. X        else if(stat_period_msec > 1500L)
  1188. X            use_cp(wscr,cpBANWARN);
  1189. X        else
  1190. X            use_cp(wscr,cpBANNER);
  1191. X        wmove(wscr,stat_period_msec_y,stat_period_msec_x);
  1192. X        wprintw(wscr,"%5ld",stat_period_msec);
  1193. X
  1194. X        kread((caddr_t)&freemem,freememaddr,sizeof(freemem));
  1195. X        read_sysinfo_and_minfo();
  1196. X
  1197. X#ifdef FIRST_TRY /* going this way seems to get cpu+wait ticks > real time */
  1198. X        for (itmp = 0; itmp < 5; itmp++)
  1199. X            cpu_ticks[itmp] = sysidelta(cpu[itmp]);
  1200. X        for (itmp = 0; itmp < 3; itmp++)
  1201. X            wait_ticks[itmp] = sysidelta(wait[itmp]);
  1202. X#else
  1203. X        for (itmp = 0; itmp < 5; itmp++)
  1204. X        {
  1205. X            if(itmp != CPU_WAIT)
  1206. X                cpu_ticks[itmp] = sysidelta(cpu[itmp]);
  1207. X        }
  1208. X        cpu_ticks[CPU_WAIT] = 0;
  1209. X        for (itmp = 0; itmp < 3; itmp++)
  1210. X            cpu_ticks[CPU_WAIT] += (wait_ticks[itmp] = sysidelta(wait[itmp]));
  1211. X#endif
  1212. X
  1213. X        total_ticks = update_cpuscale(wscr,CPUSCALE_TLY + 1,CPUSCALE_SX,
  1214. X            CPUSCALE_WIDTH,cpu_ticks);
  1215. X
  1216. X        update_waitscale(wscr,WAITSCALE_TLY + 1,WAITSCALE_SX,
  1217. X            WAITSCALE_WIDTH,wait_ticks,total_ticks);
  1218. X
  1219. X        calc_cpu_avg(cpu_ticks);
  1220. X        calc_wait_avg(wait_ticks);
  1221. X
  1222. X        get_cpu_avg(cpu_ticks,5);
  1223. X        total_ticks = update_cpuscale(wscr,CPUSCALE_TLY + 2,CPUSCALE_SX,
  1224. X            CPUSCALE_WIDTH,cpu_ticks);
  1225. X
  1226. X        get_wait_avg(wait_ticks,5);
  1227. X        update_waitscale(wscr,WAITSCALE_TLY + 2,WAITSCALE_SX,
  1228. X            WAITSCALE_WIDTH,wait_ticks,total_ticks);
  1229. X
  1230. X        get_cpu_avg(cpu_ticks,10);
  1231. X        total_ticks = update_cpuscale(wscr,CPUSCALE_TLY + 3,CPUSCALE_SX,
  1232. X            CPUSCALE_WIDTH,cpu_ticks);
  1233. X
  1234. X        get_wait_avg(wait_ticks,10);
  1235. X        update_waitscale(wscr,WAITSCALE_TLY + 3,WAITSCALE_SX,
  1236. X            WAITSCALE_WIDTH,wait_ticks,total_ticks);
  1237. X
  1238. X
  1239. X        use_cp(wscr,cpINFO);
  1240. X        y = PER_SEC_TLY + 1;
  1241. X        wmove(wscr,y++,PER_SEC1_TLX);
  1242. X        disp_info_long(wscr,"bread    ","%7ld",sysidelta(bread));
  1243. X        wmove(wscr,y++,PER_SEC1_TLX);
  1244. X        disp_info_long(wscr,"bwrite   ","%7ld",sysidelta(bwrite));
  1245. X        wmove(wscr,y++,PER_SEC1_TLX);
  1246. X        disp_info_long(wscr,"lread    ","%7ld",sysidelta(lread));
  1247. X        wmove(wscr,y++,PER_SEC1_TLX);
  1248. X        disp_info_long(wscr,"lwrite   ","%7ld",sysidelta(lwrite));
  1249. X        wmove(wscr,y++,PER_SEC1_TLX);
  1250. X        disp_info_long(wscr,"phread   ","%7ld",sysidelta(phread));
  1251. X        wmove(wscr,y++,PER_SEC1_TLX);
  1252. X        disp_info_long(wscr,"phwrite  ","%7ld",sysidelta(phwrite));
  1253. X        wmove(wscr,y++,PER_SEC1_TLX);
  1254. X        disp_info_long(wscr,"swapin   ","%7ld",sysidelta(swapin));
  1255. X        wmove(wscr,y++,PER_SEC1_TLX);
  1256. X        disp_info_long(wscr,"swapout  ","%7ld",sysidelta(swapout));
  1257. X        wmove(wscr,y++,PER_SEC1_TLX);
  1258. X        disp_info_long(wscr,"bswapin  ","%7ld",sysidelta(bswapin));
  1259. X        wmove(wscr,y++,PER_SEC1_TLX);
  1260. X        disp_info_long(wscr,"bswapout ","%7ld",sysidelta(bswapout));
  1261. X        wmove(wscr,y++,PER_SEC1_TLX);
  1262. X        disp_info_long(wscr,"iget     ","%7ld",sysidelta(iget));
  1263. X        wmove(wscr,y++,PER_SEC1_TLX);
  1264. X        disp_info_long(wscr,"namei    ","%7ld",sysidelta(namei));
  1265. X        wmove(wscr,y++,PER_SEC1_TLX);
  1266. X        disp_info_long(wscr,"dirblk   ","%7ld",sysidelta(dirblk));
  1267. X
  1268. X        y = PER_SEC_TLY + 1;
  1269. X        wmove(wscr,y++,PER_SEC2_TLX);
  1270. X        if((ltmp = sysidelta(readch) - myreadcnt) < 0)
  1271. X            ltmp = 0;
  1272. X        disp_info_long(wscr,"readch  ","%7ld",ltmp);
  1273. X        myreadcnt = 0;    /* reset /dev/{mem,kmem,swap} read count */
  1274. X
  1275. X        wmove(wscr,y++,PER_SEC2_TLX);
  1276. X        disp_info_long(wscr,"writch  ","%7ld",sysidelta(writech));
  1277. X
  1278. X        wmove(wscr,y++,PER_SEC2_TLX);
  1279. X        disp_info_long(wscr,"rawch   ","%7ld",sysidelta(rawch));
  1280. X        wmove(wscr,y++,PER_SEC2_TLX);
  1281. X        disp_info_long(wscr,"canch   ","%7ld",sysidelta(canch));
  1282. X        wmove(wscr,y++,PER_SEC2_TLX);
  1283. X        disp_info_long(wscr,"outch   ","%7ld",sysidelta(outch));
  1284. X
  1285. X        wmove(wscr,y++,PER_SEC2_TLX);
  1286. X        disp_info_long(wscr,"msg     ","%7ld",sysidelta(msg));
  1287. X        wmove(wscr,y++,PER_SEC2_TLX);
  1288. X        disp_info_long(wscr,"sema    ","%7ld",sysidelta(sema));
  1289. X
  1290. X        wmove(wscr,y++,PER_SEC2_TLX);
  1291. X        disp_static_long(wscr, "maxmem  ","%6ldk",(long)maxmem * NBPP / 1024);
  1292. X        wmove(wscr,y++,PER_SEC2_TLX);
  1293. X        disp_info_long(wscr,   "frmem   ","%6ldk",(long)freemem * NBPP / 1024);
  1294. X        wmove(wscr,y++,PER_SEC2_TLX);
  1295. X        disp_info_int (wscr,   "mem used","%6d%%",
  1296. X            100 - (int)((freemem * 100) / maxmem));
  1297. X
  1298. X        wmove(wscr,y++,PER_SEC2_TLX);
  1299. X        disp_static_int(wscr, "nswap   ","%6ldk",nswap/2);
  1300. X        wmove(wscr,y++,PER_SEC2_TLX);
  1301. X        disp_info_long(wscr,  "frswp   ","%6ldk",minfo.freeswap/2);
  1302. X        wmove(wscr,y++,PER_SEC2_TLX);
  1303. X        disp_info_int(wscr,   "swp used","%6d%%",
  1304. X            100 - (int)((minfo.freeswap * 100) / nswap));
  1305. X
  1306. X        y = PER_SEC_TLY + 1;
  1307. X        wmove(wscr,y++,PER_SEC3_TLX);
  1308. X        disp_info_long(wscr,"pswitch ","%5ld",sysidelta(pswitch));
  1309. X        wmove(wscr,y++,PER_SEC3_TLX);
  1310. X        disp_info_long(wscr,"syscall ","%5ld",sysidelta(syscall));
  1311. X        wmove(wscr,y++,PER_SEC3_TLX);
  1312. X        disp_info_long(wscr,"sysread ","%5ld",sysidelta(sysread));
  1313. X        wmove(wscr,y++,PER_SEC3_TLX);
  1314. X        disp_info_long(wscr,"syswrit ","%5ld",sysidelta(syswrite));
  1315. X        wmove(wscr,y++,PER_SEC3_TLX);
  1316. X        disp_info_long(wscr,"sysfork ","%5ld",sysidelta(sysfork));
  1317. X        wmove(wscr,y++,PER_SEC3_TLX);
  1318. X        disp_info_long(wscr,"sysexec ","%5ld",sysidelta(sysexec));
  1319. X
  1320. X        y++;
  1321. X        wmove(wscr,y++,PER_SEC3_TLX);
  1322. X        disp_info_long(wscr,"runque  ","%5ld",sysidelta(runque));
  1323. X        wmove(wscr,y++,PER_SEC3_TLX);
  1324. X        disp_info_long(wscr,"runocc  ","%5ld",sysidelta(runocc));
  1325. X        wmove(wscr,y++,PER_SEC3_TLX);
  1326. X        disp_info_long(wscr,"swpque  ","%5ld",sysidelta(swpque));
  1327. X        wmove(wscr,y++,PER_SEC3_TLX);
  1328. X        disp_info_long(wscr,"swpocc  ","%5ld",sysidelta(swpocc));
  1329. X
  1330. X        y = PER_SEC_TLY + 1;
  1331. X        wmove(wscr,y++,PER_SEC4_TLX);
  1332. X        disp_info_long(wscr,"vfault  ","%3ld",midelta(vfault));
  1333. X        wmove(wscr,y++,PER_SEC4_TLX);
  1334. X        disp_info_long(wscr,"demand  ","%3ld",midelta(demand));
  1335. X        wmove(wscr,y++,PER_SEC4_TLX);
  1336. X        disp_info_long(wscr,"pfault  ","%3ld",midelta(pfault));
  1337. X        wmove(wscr,y++,PER_SEC4_TLX);
  1338. X        disp_info_long(wscr,"cw      ","%3ld",midelta(cw));
  1339. X        wmove(wscr,y++,PER_SEC4_TLX);
  1340. X        disp_info_long(wscr,"steal   ","%3ld",midelta(steal));
  1341. X        wmove(wscr,y++,PER_SEC4_TLX);
  1342. X        disp_info_long(wscr,"frdpgs  ","%3ld",midelta(freedpgs));
  1343. X        wmove(wscr,y++,PER_SEC4_TLX);
  1344. X        disp_info_long(wscr,"vfpg    ","%3ld",midelta(vfpg));
  1345. X        wmove(wscr,y++,PER_SEC4_TLX);
  1346. X        disp_info_long(wscr,"sfpg    ","%3ld",midelta(sfpg));
  1347. X        wmove(wscr,y++,PER_SEC4_TLX);
  1348. X        disp_info_long(wscr,"vspg    ","%3ld",midelta(vspg));
  1349. X        wmove(wscr,y++,PER_SEC4_TLX);
  1350. X        disp_info_long(wscr,"sspg    ","%3ld",midelta(sspg));
  1351. X        wmove(wscr,y++,PER_SEC4_TLX);
  1352. X        disp_info_long(wscr,"pnpfault","%3ld",sysidelta(pnpfault));
  1353. X        wmove(wscr,y++,PER_SEC4_TLX);
  1354. X        disp_info_long(wscr,"wrtfault","%3ld",sysidelta(wrtfault));
  1355. X
  1356. X        y = PER_SEC_TLY + 1;
  1357. X        wmove(wscr,y++,PER_SEC5_TLX);
  1358. X        disp_info_long(wscr,"unmodsw ","%3ld",midelta(unmodsw));
  1359. X        wmove(wscr,y++,PER_SEC5_TLX);
  1360. X        disp_info_long(wscr,"unmodfl ","%3ld",midelta(unmodfl));
  1361. X        wmove(wscr,y++,PER_SEC5_TLX);
  1362. X        disp_info_long(wscr,"psoutok ","%3ld",midelta(psoutok));
  1363. X        wmove(wscr,y++,PER_SEC5_TLX);
  1364. X        disp_info_long(wscr,"psinfai ","%3ld",midelta(psinfail));
  1365. X        wmove(wscr,y++,PER_SEC5_TLX);
  1366. X        disp_info_long(wscr,"psinok  ","%3ld",midelta(psinok));
  1367. X        wmove(wscr,y++,PER_SEC5_TLX);
  1368. X        disp_info_long(wscr,"rsout   ","%3ld",midelta(rsout));
  1369. X        wmove(wscr,y++,PER_SEC5_TLX);
  1370. X        disp_info_long(wscr,"rsin    ","%3ld",midelta(rsin));
  1371. X
  1372. X        y++;
  1373. X        wmove(wscr,y++,PER_SEC5_TLX);
  1374. X        use_cp(wscr,cpLIT);
  1375. X        waddstr(wscr,"pages on   ");
  1376. X        wmove(wscr,y++,PER_SEC5_TLX);
  1377. X        disp_info_long(wscr,"swap  ","%5ld",midelta(swap));
  1378. X        wmove(wscr,y++,PER_SEC5_TLX);
  1379. X        disp_info_long(wscr,"cache ","%5ld",midelta(cache));
  1380. X        wmove(wscr,y++,PER_SEC5_TLX);
  1381. X        disp_info_long(wscr,"file  ","%5ld",midelta(file));
  1382. X
  1383. X        if(LINES >= 43)
  1384. X            extra_info_stuff();
  1385. X
  1386. X
  1387. X        detail_panel_update();
  1388. X
  1389. X        if(initial_cmd)
  1390. X        {
  1391. X            detail_panel_cmd(initial_cmd);
  1392. X            initial_cmd = 0;
  1393. X        }
  1394. X
  1395. X        pflush();
  1396. X
  1397. X        if(rdchk(0))
  1398. X        {
  1399. X            switch(cmd = wgetch(wscr))
  1400. X            {
  1401. X                case 'L' & 0x1F:        /* ^L */
  1402. X                case 'R' & 0x1F:        /* ^R */
  1403. X                    touchwin(wscr);
  1404. X                    wrefresh(wscr);
  1405. X                    if(wdet)
  1406. X                    {
  1407. X                        touchwin(wdet);
  1408. X                        wrefresh(wscr);
  1409. X                    }
  1410. X                    break;
  1411. X
  1412. X                case 'q':
  1413. X                case A_ESC:
  1414. X                    goto GOOD_BYE;
  1415. X#ifdef M_UNIX
  1416. X                case 'b':
  1417. X                    if(bootinfo.bootstrlen > 79)
  1418. X                        itmp = 79;
  1419. X                    else
  1420. X                        itmp = bootinfo.bootstrlen;
  1421. X                    kread(s80,bootinfoaddr +
  1422. X                        (bootinfo.bootstr - (caddr_t)&bootinfo),itmp);
  1423. X                    s80[itmp] = 0;
  1424. X                    disp_msg(cpMED,s80);
  1425. X                    break;
  1426. X#endif
  1427. X                case 'e':
  1428. X                case 'P':
  1429. X                case 'p':
  1430. X                case 'm':
  1431. X#ifdef M_UNIX
  1432. X                case 's':
  1433. X#endif
  1434. X                    detail_panel_cmd(cmd);
  1435. X                    break;
  1436. X                case 'l':
  1437. X                    if(!plock_indicator)
  1438. X                    {
  1439. X                        if(!plock(PROCLOCK))
  1440. X                        {
  1441. X                            plock_indicator = 1;
  1442. X                            wmove(wscr,0,38);
  1443. X                            use_cp(wscr,cpMED);
  1444. X                            waddstr(wscr," PLOCK ");
  1445. X                            nice(-5);
  1446. X                        }
  1447. X                    }
  1448. X                    break;
  1449. X                case 'u':
  1450. X                    if(plock_indicator)
  1451. X                    {
  1452. X                        if(!plock(UNLOCK))
  1453. X                        {
  1454. X                            plock_indicator = 0;
  1455. X                            wmove(wscr,0,38);
  1456. X                            use_cp(wscr,cpBANNER);
  1457. X                            waddstr(wscr,"       ");
  1458. X                            nice(5);
  1459. X                        }
  1460. X                    }
  1461. X                    break;
  1462. X            }
  1463. X        }
  1464. X
  1465. X        /* remember previous statistics for next delta */
  1466. X        sysinfo_last = sysinfo;
  1467. X        minfo_last = minfo;
  1468. X
  1469. X        /* ex-lax: all in the name of regularity */
  1470. X        ftime(&timeb_cycle_end);
  1471. X        nap_msec = 1000L - delta_msec(timeb_cycle_end,timeb_cycle_start);
  1472. X        if(nap_msec < 700L)
  1473. X            nap_msec = 700L;
  1474. X        (void)nap(nap_msec);
  1475. X    }
  1476. X
  1477. XGOOD_BYE:
  1478. X    leave_text("",0);
  1479. X    /*NOTREACHED*/
  1480. X}    /* end of main */
  1481. X
  1482. X/* vi: set tabstop=4 shiftwidth=4: */
  1483. X/* end of u386mon.c */
  1484. SHAR_EOF
  1485. $TOUCH -am 0715025290 u386mon.c &&
  1486. chmod 0644 u386mon.c ||
  1487. echo "restore of u386mon.c failed"
  1488. set `wc -c u386mon.c`;Wc_c=$1
  1489. if test "$Wc_c" != "33152"; then
  1490.     echo original size 33152, current size $Wc_c
  1491. fi
  1492. # ============= var.c ==============
  1493. echo "x - extracting var.c (Text)"
  1494. sed 's/^X//' << 'SHAR_EOF' > var.c &&
  1495. X/* CHK=0xE896 */
  1496. X/*+-------------------------------------------------------------------------
  1497. X    var.c - u386mon var struct display
  1498. X
  1499. X  Defined functions:
  1500. X    display_var(win,y,x)
  1501. X
  1502. X--------------------------------------------------------------------------*/
  1503. X/*+:EDITS:*/
  1504. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  1505. X/*:06-25-1990-17:33-wht@n4hgf-alpha sort identifiers */
  1506. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  1507. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  1508. X/*:06-21-1990-14:27-r@n4hgf-version x0.12 seems bug free */
  1509. X/*:06-17-1990-14:59-wht-creation */
  1510. X
  1511. X#define M_TERMINFO
  1512. X
  1513. X#include <curses.h>
  1514. X#include <panel.h>
  1515. X#include <sys/types.h>
  1516. X#include <sys/var.h>
  1517. X#include "u386mon.h"
  1518. X
  1519. X/*+-------------------------------------------------------------------------
  1520. X    display_var(win,y,x)
  1521. X--------------------------------------------------------------------------*/
  1522. Xvoid
  1523. Xdisplay_var(win,y,x)
  1524. XWINDOW *win;
  1525. Xint y;
  1526. Xint x;
  1527. X{
  1528. X    use_cp(win,cpBANNER);
  1529. X    wmove(win,y++,x);
  1530. X    waddstr(win,"-- Var ---------");
  1531. X    wmove(win,y++,x);
  1532. X    disp_static_int(win,"v_autoup   ","%5d",v.v_autoup);
  1533. X    wmove(win,y++,x);
  1534. X    disp_static_int(win,"v_buf      ","%5d",v.v_buf);
  1535. X    wmove(win,y++,x);
  1536. X    disp_static_int(win,"v_clist    ","%5d",v.v_clist);
  1537. X    wmove(win,y++,x);
  1538. X    disp_static_int(win,"v_file     ","%5d",v.v_file);
  1539. X    wmove(win,y++,x);
  1540. X    disp_static_int(win,"v_hbuf     ","%5d",v.v_hbuf);
  1541. X    wmove(win,y++,x);
  1542. X    disp_static_int(win,"v_inode    ","%5d",v.v_inode);
  1543. X    wmove(win,y++,x);
  1544. X    disp_static_int(win,"v_maxpmem  ","%5d",v.v_maxpmem);
  1545. X    wmove(win,y++,x);
  1546. X    disp_static_int(win,"v_maxup    ","%5d",v.v_maxup);
  1547. X    wmove(win,y++,x);
  1548. X    disp_static_int(win,"v_mount    ","%5d",v.v_mount);
  1549. X    wmove(win,y++,x);
  1550. X    disp_static_int(win,"v_pbuf     ","%5d",v.v_pbuf);
  1551. X    wmove(win,y++,x);
  1552. X    disp_static_int(win,"v_proc     ","%5d",v.v_proc);
  1553. X    wmove(win,y++,x);
  1554. X    disp_static_int(win,"v_region   ","%5d",v.v_region);
  1555. X    wmove(win,y++,x);
  1556. X    disp_static_int(win,"v_vhndfrac ","%5d",v.v_vhndfrac);
  1557. X
  1558. X}    /* end of display_var */
  1559. X
  1560. X/* vi: set tabstop=4 shiftwidth=4: */
  1561. X/* end of var.c */
  1562. SHAR_EOF
  1563. $TOUCH -am 0715025190 var.c &&
  1564. chmod 0644 var.c ||
  1565. echo "restore of var.c failed"
  1566. set `wc -c var.c`;Wc_c=$1
  1567. if test "$Wc_c" != "2094"; then
  1568.     echo original size 2094, current size $Wc_c
  1569. fi
  1570. # ============= libkmem.h ==============
  1571. echo "x - extracting libkmem.h (Text)"
  1572. sed 's/^X//' << 'SHAR_EOF' > libkmem.h &&
  1573. X/* CHK=0x635C */
  1574. X/*+-----------------------------------------------------------------------
  1575. X    libkmem.h
  1576. X    ...!emory!n4hgf!wht
  1577. X------------------------------------------------------------------------*/
  1578. X/*+:EDITS:*/
  1579. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  1580. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  1581. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  1582. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  1583. X/*:10-28-1988-14:46-afterlint-creation */
  1584. X
  1585. X#ifndef BUILDING_LINT_ARGS
  1586. X#ifdef LINT_ARGS
  1587. X
  1588. X/* libkmem.c */
  1589. Xvoid kinit(int );
  1590. Xvoid kread(char  *,long ,int );
  1591. Xvoid kwrite(long ,char  *,int );
  1592. X
  1593. X#else        /* compiler doesn't know about prototyping */
  1594. X
  1595. X/* libkmem.c */
  1596. Xvoid kinit();
  1597. Xvoid kread();
  1598. Xvoid kwrite();
  1599. X
  1600. X#endif /* LINT_ARGS */
  1601. X#endif /* BUILDING_LINT_ARGS */
  1602. X
  1603. X/* end of libkmem.h */
  1604. SHAR_EOF
  1605. $TOUCH -am 0715025090 libkmem.h &&
  1606. chmod 0644 libkmem.h ||
  1607. echo "restore of libkmem.h failed"
  1608. set `wc -c libkmem.h`;Wc_c=$1
  1609. if test "$Wc_c" != "874"; then
  1610.     echo original size 874, current size $Wc_c
  1611. fi
  1612. # ============= libmem.h ==============
  1613. echo "x - extracting libmem.h (Text)"
  1614. sed 's/^X//' << 'SHAR_EOF' > libmem.h &&
  1615. X/* CHK=0xDACD */
  1616. X/*+-----------------------------------------------------------------------
  1617. X    libmem.h
  1618. X    ...!emory!n4hgf!wht
  1619. X------------------------------------------------------------------------*/
  1620. X/*+:EDITS:*/
  1621. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  1622. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  1623. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  1624. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  1625. X/*:10-28-1988-14:46-afterlint-creation */
  1626. X
  1627. X#ifndef BUILDING_LINT_ARGS
  1628. X#ifdef LINT_ARGS
  1629. X
  1630. X/* libmem.c */
  1631. Xvoid minit(int );
  1632. Xvoid mread(char  *,long ,int );
  1633. Xvoid mwrite(long ,char  *,int );
  1634. X
  1635. X#else        /* compiler doesn't mnow about prototyping */
  1636. X
  1637. X/* libmem.c */
  1638. Xvoid minit();
  1639. Xvoid mread();
  1640. Xvoid mwrite();
  1641. X
  1642. X#endif /* LINT_ARGS */
  1643. X#endif /* BUILDING_LINT_ARGS */
  1644. X
  1645. X/* end of libmem.h */
  1646. SHAR_EOF
  1647. $TOUCH -am 0715025090 libmem.h &&
  1648. chmod 0644 libmem.h ||
  1649. echo "restore of libmem.h failed"
  1650. set `wc -c libmem.h`;Wc_c=$1
  1651. if test "$Wc_c" != "870"; then
  1652.     echo original size 870, current size $Wc_c
  1653. fi
  1654. # ============= libswap.h ==============
  1655. echo "x - extracting libswap.h (Text)"
  1656. sed 's/^X//' << 'SHAR_EOF' > libswap.h &&
  1657. X/* CHK=0xF21C */
  1658. X/*+-----------------------------------------------------------------------
  1659. X    libswap.h
  1660. X    ...!emory!n4hgf!wht
  1661. X------------------------------------------------------------------------*/
  1662. X/*+:EDITS:*/
  1663. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  1664. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  1665. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  1666. X/*:06-22-1990-02:03-root@n4hgf-creation from libmem */
  1667. X
  1668. X#ifndef BUILDING_LINT_ARGS
  1669. X#ifdef LINT_ARGS
  1670. X
  1671. X/* libswap.c */
  1672. Xvoid sinit(void );
  1673. Xvoid sread(char  *,long ,int );
  1674. X
  1675. X#else        /* compiler doesn't mnow about prototyping */
  1676. X
  1677. X/* libswap.c */
  1678. Xvoid sinit();
  1679. Xvoid sread();
  1680. Xvoid swrite();
  1681. X
  1682. X#endif /* LINT_ARGS */
  1683. X#endif /* BUILDING_LINT_ARGS */
  1684. X
  1685. X/* end of libswap.h */
  1686. SHAR_EOF
  1687. $TOUCH -am 0715025190 libswap.h &&
  1688. chmod 0644 libswap.h ||
  1689. echo "restore of libswap.h failed"
  1690. set `wc -c libswap.h`;Wc_c=$1
  1691. if test "$Wc_c" != "795"; then
  1692.     echo original size 795, current size $Wc_c
  1693. fi
  1694. # ============= libnlsym.h ==============
  1695. echo "x - extracting libnlsym.h (Text)"
  1696. sed 's/^X//' << 'SHAR_EOF' > libnlsym.h &&
  1697. X/* CHK=0x6491 */
  1698. X/*+-----------------------------------------------------------------------
  1699. X    libnlsym.h
  1700. X    ...!emory!n4hgf!wht
  1701. X------------------------------------------------------------------------*/
  1702. X/*+:EDITS:*/
  1703. X/*:06-27-1990-01:57-wht@n4hgf-1.10-incorporate suggestions from alpha testers */
  1704. X/*:06-25-1990-04:14-wht@n4hgf-1.02-better error handling */
  1705. X/*:06-24-1990-20:53-wht@n4hgf-v1.01-add ISC support thanks to peter@radig.de */
  1706. X/*:06-21-1990-14:26-r@n4hgf-version x0.12 seems bug free */
  1707. X/*:10-28-1988-14:47-afterlint-creation */
  1708. X
  1709. X#ifndef BUILDING_LINT_ARGS
  1710. X#ifdef LINT_ARGS
  1711. X
  1712. X/* libnlsym.c */
  1713. Xvoid nlsym_error(char * );
  1714. Xvoid nlsym_read(void);
  1715. X
  1716. X#else        /* compiler doesn't know about prototyping */
  1717. X
  1718. X/* libnlsym.c */
  1719. Xvoid nlsym_error();
  1720. Xvoid nlsym_read();
  1721. X
  1722. X#endif /* LINT_ARGS */
  1723. X#endif /* BUILDING_LINT_ARGS */
  1724. X
  1725. X/* end of libnlsym.h */
  1726. SHAR_EOF
  1727. $TOUCH -am 0715025190 libnlsym.h &&
  1728. chmod 0644 libnlsym.h ||
  1729. echo "restore of libnlsym.h failed"
  1730. set `wc -c libnlsym.h`;Wc_c=$1
  1731. if test "$Wc_c" != "841"; then
  1732.     echo original size 841, current size $Wc_c
  1733. fi
  1734. echo "End of part 3, continue with part 4"
  1735. exit 0
  1736.  
  1737. --------------------------------------------------------------------
  1738. Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
  1739. Sforzando (It., sfohr-tsahn'-doh).   A direction to perform the tone
  1740. or chord with special stress, or marked and sudden emphasis.
  1741.  
  1742.