home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2774 < prev    next >
Internet Message Format  |  1991-02-16  |  48KB

  1. From: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  2. Newsgroups: alt.sources
  3. Subject: X386MON part 05/06
  4. Message-ID: <325@n4hgf.Mt-Park.GA.US>
  5. Date: 16 Feb 91 19:35:54 GMT
  6.  
  7. Submitted-by: wht@n4hgf
  8. Archive-name: x386monx100/part05
  9.  
  10. #!/bin/sh
  11. # This is part 05 of x386monx100
  12. # ============= x386mon/tune.c ==============
  13. if test ! -d 'x386mon'; then
  14.     echo 'x - creating directory x386mon'
  15.     mkdir 'x386mon'
  16. fi
  17. if test -f 'x386mon/tune.c' -a X"$1" != X"-c"; then
  18.     echo 'x - skipping x386mon/tune.c (File already exists)'
  19. else
  20. echo 'x - extracting x386mon/tune.c (Text)'
  21. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/tune.c' &&
  22. X/*+-------------------------------------------------------------------------
  23. X    tune.c - X386MON tune struct display
  24. X    wht@n4hgf.Mt-Park.GA.US
  25. X
  26. X  Defined functions:
  27. X    draw_Tune(x,y)
  28. X
  29. X--------------------------------------------------------------------------*/
  30. X/*+:EDITS:*/
  31. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  32. X
  33. X#include "unixincs.h"
  34. X#if defined(mips)
  35. X#define t_gpgsmsk  t_gpgslmsk
  36. X#endif
  37. X#define WANT_MON_EXTERNS
  38. X#include "x386mon.h"
  39. X#include "buttons.h"
  40. X#include "utoa.h"
  41. X#include "disp_info.h"
  42. X
  43. Xstatic int line_style = LineSolid;
  44. Xstatic int cap_style = CapButt;
  45. Xstatic int join_style = JoinMiter;
  46. X
  47. X/*+-------------------------------------------------------------------------
  48. X    draw_Tune(x,y)
  49. X--------------------------------------------------------------------------*/
  50. Xvoid
  51. Xdraw_Tune(x,y)
  52. Xint x;
  53. Xint y;
  54. X{
  55. Xregister itmp;
  56. Xchar *cptr;
  57. Xchar s32[32];
  58. Xint fwidth = FWIDTH;
  59. Xint fheight = FHEIGHT;
  60. Xint len;
  61. Xint x2 = x;
  62. Xint yl1 = y + (FASCENT / 2);
  63. Xint yl2 = y + (fheight / 2) - 1;
  64. Xint ys  = y + FASCENT;
  65. X
  66. X    switch(current_display_mode)
  67. X    {
  68. X        case BUTTON_main:
  69. X            break;
  70. X        default:
  71. X            return;
  72. X    }
  73. X
  74. X    if(DrawAreaXYWH.height < (y + (fheight * 2)))
  75. X        return;
  76. X
  77. X    cptr = "---Tune----------";
  78. X    len = strlen(cptr);
  79. X    /* the "background" bar */
  80. X    XSetForeground(display,gc,colorSlate.pixel);
  81. X    XSetLineAttributes(display,gc,fheight,line_style,cap_style,join_style);
  82. X    XDrawLine(display,window,gc, x,yl1, x + (len * fwidth),yl1);
  83. X
  84. X    /* draw the black line before "Tune" */
  85. X    XSetForeground(display,gc,foreground);
  86. X    XSetLineAttributes(display,gc,FASCENT / 2,line_style,cap_style,join_style);
  87. X    XDrawLine(display,window,gc,
  88. X        x2,yl1,
  89. X        x2 + (len = (fwidth * 3)) - FGAP,yl1);
  90. X    x2 += len;
  91. X
  92. X    /* draw "Tune" */
  93. X    cptr = "Tune";
  94. X    XDrawString(display,window,gc, x2,  ys, cptr,len = strlen(cptr));
  95. X    XDrawString(display,window,gc, x2+1,ys, cptr,len);
  96. X    x2 += fwidth * len;
  97. X
  98. X    /* draw the black line after "Tune" */
  99. X    XDrawLine(display,window,gc,
  100. X        x2 + FGAP + 1,yl1,
  101. X        x2 + (len = (fwidth * 10)),yl1);
  102. X    y += fheight;
  103. X
  104. X#ifdef    SVR32
  105. X    disp_static_int(x,y,"t_ageintvl  ",5,tune.t_ageinterval);
  106. X    y += fheight;
  107. X#endif
  108. X    disp_static_int(x,y,"t_bdflushr  ",5,tune.t_bdflushr);
  109. X    y += fheight;
  110. X    disp_static_int(x,y,"t_gpgshi    ",5,tune.t_gpgshi);
  111. X    y += fheight;
  112. X    disp_static_int(x,y,"t_gpgslo    ",5,tune.t_gpgslo);
  113. X    y += fheight;
  114. X    strcpy(s32,"t_gpgsmsk   0x");
  115. X    ultoxa(s32 + strlen(s32),3,tune.t_gpgsmsk);
  116. X    disp_static_text(x,y,s32);
  117. X    y += fheight;
  118. X    disp_static_int(x,y,"t_maxfc     ",5,tune.t_maxfc);
  119. X    y += fheight;
  120. X    disp_static_int(x,y,"t_maxsc     ",5,tune.t_maxsc);
  121. X    y += fheight;
  122. X    disp_static_int(x,y,"t_maxumem   ",5,tune.t_maxumem);
  123. X    y += fheight;
  124. X    disp_static_int(x,y,"t_minarmem  ",5,tune.t_minarmem);
  125. X    y += fheight;
  126. X    disp_static_int(x,y,"t_minasmem  ",5,tune.t_minasmem);
  127. X    y += fheight;
  128. X
  129. X}    /* end of draw_Tune */
  130. X
  131. X/* vi: set tabstop=4 shiftwidth=4: */
  132. X/* end of tune.c */
  133. SHAR_EOF
  134. chmod 0644 x386mon/tune.c ||
  135. echo 'restore of x386mon/tune.c failed'
  136. Wc_c="`wc -c < 'x386mon/tune.c'`"
  137. test 2851 -eq "$Wc_c" ||
  138.     echo 'x386mon/tune.c: original size 2851, current size' "$Wc_c"
  139. fi
  140. # ============= x386mon/unixincs.h ==============
  141. if test -f 'x386mon/unixincs.h' -a X"$1" != X"-c"; then
  142.     echo 'x - skipping x386mon/unixincs.h (File already exists)'
  143. else
  144. echo 'x - extracting x386mon/unixincs.h (Text)'
  145. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/unixincs.h' &&
  146. X
  147. X/*+-------------------------------------------------------------------------
  148. X    unixincs.h
  149. X    wht@n4hgf.Mt-Park.GA.US
  150. X--------------------------------------------------------------------------*/
  151. X/*+:EDITS:*/
  152. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  153. X
  154. X#include <stdio.h>
  155. X#include <ctype.h>
  156. X#include <signal.h>
  157. X#include <string.h>
  158. X#include <malloc.h>
  159. X#include <fcntl.h>
  160. X#include <nlist.h>
  161. X#include <time.h>
  162. X#include <sys/errno.h>
  163. X#include <sys/types.h>
  164. X#include <sys/timeb.h>
  165. X#include <sys/lock.h>
  166. X#include <sys/utsname.h>
  167. X#include <sys/stat.h>
  168. X#include <sys/ascii.h>
  169. X#undef NGROUPS_MAX
  170. X#undef NULL
  171. X#include <sys/param.h>
  172. X#include <sys/bootinfo.h>
  173. X#include <sys/tuneable.h>
  174. X#include <sys/sysinfo.h>
  175. X#include <sys/sysmacros.h>
  176. X#include <sys/immu.h>
  177. X#include <sys/region.h>
  178. X#include <sys/proc.h>
  179. X#include <sys/var.h>
  180. X#include <sys/sysi86.h>
  181. X#include <sys/swap.h>
  182. X#include <sys/trap.h>
  183. X
  184. X/* vi: set tabstop=4 shiftwidth=4: */
  185. X/* end of unixincs.h */
  186. SHAR_EOF
  187. chmod 0644 x386mon/unixincs.h ||
  188. echo 'restore of x386mon/unixincs.h failed'
  189. Wc_c="`wc -c < 'x386mon/unixincs.h'`"
  190. test 961 -eq "$Wc_c" ||
  191.     echo 'x386mon/unixincs.h: original size 961, current size' "$Wc_c"
  192. fi
  193. # ============= x386mon/util.c ==============
  194. if test -f 'x386mon/util.c' -a X"$1" != X"-c"; then
  195.     echo 'x - skipping x386mon/util.c (File already exists)'
  196. else
  197. echo 'x - extracting x386mon/util.c (Text)'
  198. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/util.c' &&
  199. X/*+-------------------------------------------------------------------------
  200. X    util.c - X386MON utility functions
  201. X    wht@n4hgf.Mt-Park.GA.US
  202. X
  203. X  Defined functions:
  204. X    basename(fullname)
  205. X    get_elapsed_time(elapsed_seconds)
  206. X
  207. X--------------------------------------------------------------------------*/
  208. X/*+:EDITS:*/
  209. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  210. X
  211. X#include <sys/types.h>
  212. X
  213. X/*+-------------------------------------------------------------------------
  214. X    basename(fullname) - strip directory name from filename
  215. X
  216. Xreturns address of static string
  217. X--------------------------------------------------------------------------*/
  218. Xchar *
  219. Xbasename(fullname)
  220. Xchar *fullname;
  221. X{
  222. Xregister char *start;
  223. Xstatic char outstr[256];
  224. Xchar *strrchr();
  225. X
  226. X    start = strrchr(fullname,'/'); /* find last slash */
  227. X    if(!start)
  228. X        return(fullname);
  229. X    start++;
  230. X    strcpy(outstr,start);
  231. X    return(outstr);
  232. X}    /* end of basename */
  233. X
  234. X/*+-----------------------------------------------------------------------
  235. X    char *get_elapsed_time(elapsed_seconds) - "ddd+hh:mm:ss" returned
  236. X  static string address is returned
  237. X------------------------------------------------------------------------*/
  238. Xchar *
  239. Xget_elapsed_time(elapsed_seconds)
  240. Xtime_t elapsed_seconds;
  241. X{
  242. Xstatic char elapsed_time_str[32];
  243. Xtime_t dd,hh,mm,ss;
  244. X
  245. X    dd = 0;
  246. X    hh = elapsed_seconds / 3600;
  247. X    if(hh > 24)
  248. X    {
  249. X        dd = hh / 24;
  250. X        elapsed_seconds -= dd * 3600 * 24;
  251. X        hh %= 24;
  252. X    }
  253. X    elapsed_seconds -= hh * 3600;
  254. X    mm = elapsed_seconds / 60L;
  255. X    elapsed_seconds -= mm * 60L;
  256. X    ss = elapsed_seconds;
  257. X
  258. X    if(dd)
  259. X        (void)sprintf(elapsed_time_str,"%3ld+%02ld:%02ld:%02ld",dd,hh,mm,ss);
  260. X    else
  261. X        (void)sprintf(elapsed_time_str,"    %2ld:%02ld:%02ld",hh,mm,ss);
  262. X    return(elapsed_time_str);
  263. X}    /* end of get_elapsed_time */
  264. X
  265. X/* vi: set tabstop=4 shiftwidth=4: */
  266. X/* end of util.c */
  267. SHAR_EOF
  268. chmod 0644 x386mon/util.c ||
  269. echo 'restore of x386mon/util.c failed'
  270. Wc_c="`wc -c < 'x386mon/util.c'`"
  271. test 1791 -eq "$Wc_c" ||
  272.     echo 'x386mon/util.c: original size 1791, current size' "$Wc_c"
  273. fi
  274. # ============= x386mon/utoa.c ==============
  275. if test -f 'x386mon/utoa.c' -a X"$1" != X"-c"; then
  276.     echo 'x - skipping x386mon/utoa.c (File already exists)'
  277. else
  278. echo 'x - extracting x386mon/utoa.c (Text)'
  279. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/utoa.c' &&
  280. X/* CHK=0xDD15 */
  281. X/*+-------------------------------------------------------------------------
  282. X    utoa.c - fast substitutes for most sprintf needs
  283. X    wht@n4hgf.Mt-Park.GA.US
  284. X
  285. X  Defined functions:
  286. X    utoda_common(buf,width,n,leading)
  287. X    utoxa_common(buf,width,n,leading)
  288. X
  289. X--------------------------------------------------------------------------*/
  290. X/*+:EDITS:*/
  291. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  292. X
  293. X#include "utoa.h"
  294. X
  295. X/*+-------------------------------------------------------------------------
  296. X    utoda_common(buf,width,n,leading) unsigned to decimal ascii
  297. X--------------------------------------------------------------------------*/
  298. Xvoid
  299. Xutoda_common(buf,width,n,leading)
  300. Xchar *buf;
  301. Xint width;
  302. Xunsigned long n;
  303. Xchar leading;
  304. X{
  305. X    register unsigned div;
  306. X    register char *ep = &buf[width];
  307. X
  308. X    *ep = '\0';
  309. X    if(n == 0)
  310. X        *--ep = '0';
  311. X    while(ep-- > buf)
  312. X    {
  313. X        if(n <= 0)
  314. X            *ep = leading;
  315. X        else
  316. X        {
  317. X            div = n / 10;
  318. X            *ep = n - 10*div + '0';
  319. X            n = div;
  320. X        }
  321. X    }
  322. X}    /* end of utoda_common */
  323. X
  324. X/*+-------------------------------------------------------------------------
  325. X    utoxa_common(buf,width,n,leading) unsigned to octal ascii
  326. X--------------------------------------------------------------------------*/
  327. Xvoid
  328. Xutoxa_common(buf,width,n,leading)
  329. Xchar *buf;
  330. Xint width;
  331. Xunsigned long n;
  332. Xchar leading;
  333. X{
  334. Xregister unsigned div;
  335. Xregister char *ep = &buf[width];
  336. Xstatic char hexchars[] = "0123456789ABCDEF";
  337. X
  338. X    *ep = '\0';
  339. X    if(n == 0)
  340. X        *--ep = '0';
  341. X    while(ep-- > buf)
  342. X    {
  343. X        if(n <= 0)
  344. X            *ep = leading;
  345. X        else
  346. X        {
  347. X            div = n >> 4;
  348. X            *ep = hexchars[n - (div << 4)];
  349. X            n = div;
  350. X        }
  351. X    }
  352. X}    /* end of utoxa_common */
  353. X
  354. X/* vi: set tabstop=4 shiftwidth=4: */
  355. X/* end of utoa.c */
  356. SHAR_EOF
  357. chmod 0644 x386mon/utoa.c ||
  358. echo 'restore of x386mon/utoa.c failed'
  359. Wc_c="`wc -c < 'x386mon/utoa.c'`"
  360. test 1669 -eq "$Wc_c" ||
  361.     echo 'x386mon/utoa.c: original size 1669, current size' "$Wc_c"
  362. fi
  363. # ============= x386mon/utoa.h ==============
  364. if test -f 'x386mon/utoa.h' -a X"$1" != X"-c"; then
  365.     echo 'x - skipping x386mon/utoa.h (File already exists)'
  366. else
  367. echo 'x - extracting x386mon/utoa.h (Text)'
  368. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/utoa.h' &&
  369. X/* CHK=0x3B34 */
  370. X/*+-----------------------------------------------------------------------
  371. X    utoa.h
  372. X    wht@n4hgf.Mt-Park.GA.US
  373. X------------------------------------------------------------------------*/
  374. X/*+:EDITS:*/
  375. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  376. X
  377. X/* unsigned to decimal ascii w/ leading spaces */
  378. X#define utoda(b,w,n) utoda_common((b),(w),(unsigned long)(n),' ')
  379. X#define ultoda(b,w,n)  utoda_common((b),(w),n,' ')
  380. X
  381. X/* unsigned to decimal ascii w/leading zeroes */
  382. X#define utoda_lz(b,w,n)  utoda_common((b),(w),(unsigned long)(n),'0')
  383. X#define ultoda_lz(b,w,n)  utoda_common((b),(w),(n),'0')
  384. X
  385. X/* unsigned to hexadecimal ascii w/ leading spaces */
  386. X#define utoxa(b,w,n)  utoxa_common((b),(w),(unsigned long)(n),' ')
  387. X#define ultoxa(b,w,n)  utoxa_common((b),(w),(n),' ')
  388. X
  389. X/* unsigned to hexadecimal ascii w/leading zeroes */
  390. X#define utoxa_lz(b,w,n)  utoxa_common((b),(w),(unsigned long)(n),'0')
  391. X#define ultoxa_lz(b,w,n)  utoxa_common((b),(w),(n),'0')
  392. X
  393. X#ifndef BUILDING_PROTOTYPES
  394. X#ifdef __STDC__
  395. X/* utoa.c */
  396. Xvoid utoda_common(char *,int ,unsigned long ,char );
  397. Xvoid utoxa_common(char *,int ,unsigned long ,char );
  398. X#else        /* compiler doesn't know about prototyping */
  399. X/* utoa.c */
  400. Xvoid utoda_common();
  401. Xvoid utoxa_common();
  402. X#endif /* __STDC__ */
  403. X#endif /* BUILDING_PROTOTYPES */
  404. X
  405. X/* end of utoa.h */
  406. SHAR_EOF
  407. chmod 0644 x386mon/utoa.h ||
  408. echo 'restore of x386mon/utoa.h failed'
  409. Wc_c="`wc -c < 'x386mon/utoa.h'`"
  410. test 1322 -eq "$Wc_c" ||
  411.     echo 'x386mon/utoa.h: original size 1322, current size' "$Wc_c"
  412. fi
  413. # ============= x386mon/var.c ==============
  414. if test -f 'x386mon/var.c' -a X"$1" != X"-c"; then
  415.     echo 'x - skipping x386mon/var.c (File already exists)'
  416. else
  417. echo 'x - extracting x386mon/var.c (Text)'
  418. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/var.c' &&
  419. X/*+-------------------------------------------------------------------------
  420. X    var.c - X386MON var struct handler
  421. X    wht@n4hgf.Mt-Park.GA.US
  422. X
  423. X  Defined functions:
  424. X    draw_Var(x,y)
  425. X
  426. X--------------------------------------------------------------------------*/
  427. X/*+:EDITS:*/
  428. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  429. X
  430. X#include "unixincs.h"
  431. X#define WANT_MON_EXTERNS
  432. X#include "x386mon.h"
  433. X#include "buttons.h"
  434. X#include "disp_info.h"
  435. X
  436. Xstatic int line_style = LineSolid;
  437. Xstatic int cap_style = CapButt;
  438. Xstatic int join_style = JoinMiter;
  439. X
  440. X/*+-------------------------------------------------------------------------
  441. X    draw_Var(x,y)
  442. X--------------------------------------------------------------------------*/
  443. Xvoid
  444. Xdraw_Var(x,y)
  445. Xint y;
  446. Xint x;
  447. X{
  448. Xregister itmp;
  449. Xchar *cptr;
  450. Xchar s80[80];
  451. Xint fwidth = FWIDTH;
  452. Xint fheight = FHEIGHT;
  453. Xint len;
  454. Xint x2 = x;
  455. Xint yl1 = y + (FASCENT / 2);
  456. Xint yl2 = y + (FHEIGHT / 2) - 1;
  457. Xint ys  = y + FASCENT;
  458. X
  459. X    switch(current_display_mode)
  460. X    {
  461. X        case BUTTON_main:
  462. X            break;
  463. X        default:
  464. X            return;
  465. X    }
  466. X
  467. X    if(DrawAreaXYWH.height < (y + (fheight * 2)))
  468. X        return;
  469. X
  470. X    cptr = "---Var----------";
  471. X    len = strlen(cptr);
  472. X    /* the "background" bar */
  473. X    XSetForeground(display,gc,colorSlate.pixel);
  474. X    XSetLineAttributes(display,gc,fheight,line_style,cap_style,join_style);
  475. X    XDrawLine(display,window,gc, x,yl1, x + (len * fwidth),yl1);
  476. X
  477. X    /* draw the black line before "Var" */
  478. X    XSetForeground(display,gc,foreground);
  479. X    XSetLineAttributes(display,gc,FASCENT / 2,line_style,cap_style,join_style);
  480. X    XDrawLine(display,window,gc,
  481. X        x2,yl1,
  482. X        x2 + (len = (fwidth * 3)) - FGAP,yl1);
  483. X    x2 += len;
  484. X
  485. X    /* draw "Var" */
  486. X    cptr = "Var";
  487. X    XDrawString(display,window,gc, x2,  ys, cptr,len = strlen(cptr));
  488. X    XDrawString(display,window,gc, x2+1,ys, cptr,len = strlen(cptr));
  489. X    x2 += fwidth * len;
  490. X
  491. X    /* draw the black line after "Var" */
  492. X    XDrawLine(display,window,gc,
  493. X        x2 + FGAP + 1,yl1,
  494. X        x2 + (len = (fwidth * 10)),yl1);
  495. X    y += fheight;
  496. X
  497. X    disp_static_int(x,y,"v_autoup   ",5,v.v_autoup);
  498. X    y += fheight;
  499. X    disp_static_int(x,y,"v_buf      ",5,v.v_buf);
  500. X    y += fheight;
  501. X    disp_static_int(x,y,"v_clist    ",5,v.v_clist);
  502. X    y += fheight;
  503. X    disp_static_int(x,y,"v_file     ",5,v.v_file);
  504. X    y += fheight;
  505. X    disp_static_int(x,y,"v_hbuf     ",5,v.v_hbuf);
  506. X    y += fheight;
  507. X    disp_static_int(x,y,"v_inode    ",5,v.v_inode);
  508. X    y += fheight;
  509. X    disp_static_int(x,y,"v_maxpmem  ",5,v.v_maxpmem);
  510. X    y += fheight;
  511. X    disp_static_int(x,y,"v_maxup    ",5,v.v_maxup);
  512. X    y += fheight;
  513. X    disp_static_int(x,y,"v_mount    ",5,v.v_mount);
  514. X    y += fheight;
  515. X    disp_static_int(x,y,"v_pbuf     ",5,v.v_pbuf);
  516. X    y += fheight;
  517. X    disp_static_int(x,y,"v_proc     ",5,v.v_proc);
  518. X    y += fheight;
  519. X    disp_static_int(x,y,"v_region   ",5,v.v_region);
  520. X    y += fheight;
  521. X    disp_static_int(x,y,"v_vhndfrac ",5,v.v_vhndfrac);
  522. X
  523. X}    /* end of draw_Var */
  524. X
  525. X/* vi: set tabstop=4 shiftwidth=4: */
  526. X/* end of var.c */
  527. SHAR_EOF
  528. chmod 0644 x386mon/var.c ||
  529. echo 'restore of x386mon/var.c failed'
  530. Wc_c="`wc -c < 'x386mon/var.c'`"
  531. test 2829 -eq "$Wc_c" ||
  532.     echo 'x386mon/var.c: original size 2829, current size' "$Wc_c"
  533. fi
  534. # ============= x386mon/x386mon.c ==============
  535. if test -f 'x386mon/x386mon.c' -a X"$1" != X"-c"; then
  536.     echo 'x - skipping x386mon/x386mon.c (File already exists)'
  537. else
  538. echo 'x - extracting x386mon/x386mon.c (Text)'
  539. sed 's/^X//' << 'SHAR_EOF' > 'x386mon/x386mon.c' &&
  540. Xchar *revision = "x1.00";
  541. X/*+-------------------------------------------------------------------------
  542. X    x386mon.c - SCO ODT (UNIX 386) system watcher
  543. X    wht@n4hgf.Mt-Park.GA.US
  544. X
  545. X  Defined functions:
  546. X    calc_cpu_avg(per_state)
  547. X    calc_wait_avg(per_state)
  548. X    delta_StatCycle(delta_msec)
  549. X    draw_display()
  550. X    draw_lower_main_statics()
  551. X    entry_callback(widget,client_data,call_data)
  552. X    expose_callback(widget,client_data,call_data)
  553. X    get_cpu_avg(cpu_ticks,period)
  554. X    get_wait_avg(wait_ticks,period)
  555. X    input_callback(widget,client_data,call_data)
  556. X    input_callback_key_event(widget,client_data,call_data)
  557. X    main(argc,argv)
  558. X    quit_now()
  559. X    read_sysinfo_and_minfo()
  560. X    resize_callback(widget,client_data,call_data)
  561. X    set_display_mode(new_mode)
  562. X    set_update_timer()
  563. X    update_StatCycle()
  564. X    update_StatPeriod()
  565. X    update_Tod()
  566. X    update_display(read_new_kernel_data)
  567. X    update_timer_proc(client_data)
  568. X
  569. XAll of the Motif dependencies appear in this module; the rest of
  570. Xthe code is Xlib or {private widget,conservative use of Xt} only
  571. XSome hacking will be necessary on the Button widget to un-Motifize
  572. Xit, like changing 'Primitive' to 'Simple' or the like
  573. X
  574. X--------------------------------------------------------------------------*/
  575. X/*+:EDITS:*/
  576. X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  577. X
  578. X#include "unixincs.h"
  579. X#define WANT_MON_EXTERNS
  580. X#include "x386mon.h"
  581. X#include <X11/StringDefs.h>
  582. X#include <X11/Shell.h>
  583. X#include <Xm/DrawingA.h>
  584. X#include "nlsym.h"
  585. X#include "libkmem.h"
  586. X#include "libmem.h"
  587. X#include "libswap.h"
  588. X#include "libnlsym.h"
  589. X#include "scales.h"
  590. X#include "buttons.h"
  591. X#include "utoa.h"
  592. X
  593. Xchar *basename();
  594. Xvoid quit_now();
  595. X
  596. Xextern XtWorkProcId ps_WorkProc_ID;
  597. X
  598. XXtAppContext appcon;
  599. XWidget AppShellW;
  600. XWidget DrawAreaW;
  601. XXWindowAttributes DrawAreaXYWH;
  602. XDisplay *display;
  603. XWindow window = 0;
  604. Xint screen;
  605. Xint display_width;
  606. Xint display_height;
  607. XGC gc;
  608. XColormap cmap;
  609. Xint redrawing_entire_DrawArea = 1;
  610. Xchar DrawArea_title[128];
  611. XXtIntervalId update_timer_ID = (XtIntervalId)0;
  612. Xchar *make_taller_to_restore_Ps = "make taller to restore PS";
  613. Xchar *make_taller_for_Ps        = "make taller for PS display";
  614. X
  615. XMyResources res;
  616. X
  617. Xchar preferred_geom[64] = "";
  618. X
  619. X#define offset(field) XtOffset(MyResources *, field)
  620. Xstatic XtResource appResources[] = 
  621. X{
  622. X  {"geometry",         "Geometry",              XtRString,    sizeof(char *),
  623. X                       offset(geometry),        XtRString,    preferred_geom },
  624. X
  625. X  {"font",             "Font",                  XtRString,    sizeof(char *),
  626. X                       offset(font),            XtRString,    "6x10" },
  627. X
  628. X  {"background",       "Background",            XtRString,    sizeof(char *),
  629. X                       offset(background),      XtRString,    "black" },
  630. X
  631. X  {"foreground",       "Foreground",            XtRString,    sizeof(char *),
  632. X                       offset(foreground),      XtRString,    "black" },
  633. X
  634. X  {"busyWarningThreshhold","WarningThreshhold", XtRInt,       sizeof(int),
  635. X              offset(busyWarningThreshhold),    XtRString,    "70" },
  636. X
  637. X  {"busyAlarmThreshhold","AlarmThreshhold",     XtRInt,       sizeof(int),
  638. X              offset(busyAlarmThreshhold),      XtRString,    "90" },
  639. X
  640. X  {"breakWarningThreshhold","WarningThreshhold",XtRInt,       sizeof(int),
  641. X              offset(breakWarningThreshhold),   XtRString,    "2" },
  642. X
  643. X  {"breakAlarmThreshhold","AlarmThreshhold",    XtRInt,       sizeof(int),
  644. X              offset(breakAlarmThreshhold),     XtRString,    "5" },
  645. X
  646. X  {"waitWarningThreshhold","WarningThreshhold", XtRInt,       sizeof(int),
  647. X              offset(waitWarningThreshhold),    XtRString,    "20" },
  648. X
  649. X  {"waitAlarmThreshhold","AlarmThreshhold",     XtRInt,       sizeof(int),
  650. X              offset(waitAlarmThreshhold),      XtRString,    "50" },
  651. X
  652. X  {"swapWarningThreshhold","WarningThreshhold", XtRInt,       sizeof(int),
  653. X               offset(swapWarningThreshhold),   XtRString,    "10" },
  654. X
  655. X  {"swapAlarmThreshhold","AlarmThreshhold",     XtRInt,       sizeof(int),
  656. X               offset(swapAlarmThreshhold),     XtRString,    "20" },
  657. X
  658. X};
  659. X#undef offset
  660. X
  661. Xstatic XrmOptionDescRec optionDescList[] = 
  662. X{
  663. X/* geometry must be first record */
  664. X  {"-geometry", "*geometry",               XrmoptionSepArg,  (caddr_t)0},
  665. X  {"-fg",       "*foreground",             XrmoptionSepArg,  (caddr_t)0},
  666. X  {"-bg",       "*background",             XrmoptionSepArg,  (caddr_t)0},
  667. X  {"-fn",       "*font",                   XrmoptionSepArg,  (caddr_t)0},
  668. X  {"-ms",       "*pointerColor",           XrmoptionSepArg,  (caddr_t)0},
  669. X  {"-bwt",      "*busyWarningThreshhold",  XrmoptionSepArg,  (caddr_t)0},
  670. X  {"-bat",      "*busyAlarmThreshhold",    XrmoptionSepArg,  (caddr_t)0},
  671. X  {"-Bwt",      "*breakWarningThreshhold", XrmoptionSepArg,  (caddr_t)0},
  672. X  {"-Bat",      "*breakAlarmThreshhold",   XrmoptionSepArg,  (caddr_t)0},
  673. X  {"-wwt",      "*waitWarningThreshhold",  XrmoptionSepArg,  (caddr_t)0},
  674. X  {"-wat",      "*waitAlarmThreshhold",    XrmoptionSepArg,  (caddr_t)0},
  675. X  {"-swt",      "*swapWarningThreshhold",  XrmoptionSepArg,  (caddr_t)0},
  676. X  {"-sat",      "*swapAlarmThreshhold",    XrmoptionSepArg,  (caddr_t)0},
  677. X};
  678. X
  679. Xtypedef struct myusagelist
  680. X{
  681. X  char *opt;
  682. X  char *desc;
  683. X} MyUsageList;
  684. X
  685. Xstatic MyUsageList usage_list[] =
  686. X{
  687. X  { "-help",                 "print out this message" },
  688. X  { "-display displayname",  "X server to contact" },
  689. X  { "-geometry geom",        "size (in characters) and position" },
  690. X  { "-bg color",             "background color" },
  691. X  { "-fg color",             "foreground color" },
  692. X  { "-iconic",               "start iconic" },
  693. X  { "-bd color",             "border color" },
  694. X  { "-bw number",            "border width in pixels" },
  695. X  { "-fn fontname",          "normal text font" },
  696. X  { "-uc color",             "user CPU percentage scale color" },
  697. X  { "-kc color",             "kernel CPU percentage scale color" },
  698. X  { "-bc color",             "break CPU percentage scale color" },
  699. X  { "-ic color",             "(block) I/O wait percentage scale color" },
  700. X  { "-pc color",             "physical I/O wait percentage scale color" },
  701. X  { "-sc color",             "swap I/O wait percentage scale color" },
  702. X  { (char *)0, (char *)0 }
  703. X};
  704. X/* "our" stuff */
  705. X
  706. X#define delta_msec(t,t0) ((( t.time * 1000L) +  t.millitm) - \
  707. X                          ((t0.time * 1000L) + t0.millitm))
  708. X
  709. X#define StatCycle_msecDef 2000L
  710. X#define StatCycle_msecMin 1000L
  711. X#define StatCycle_msecMax 4000L
  712. X
  713. Xunsigned long StatCycle_msec = StatCycle_msecDef;
  714. X
  715. Xstruct sysinfo sysinfo;
  716. Xstruct sysinfo sysinfo_last;
  717. X
  718. Xstruct minfo minfo;
  719. Xstruct minfo minfo_last;
  720. X
  721. X#if defined(HAS_BOOTINFO)
  722. Xstruct bootinfo bootinfo;
  723. X#endif
  724. X
  725. Xswpt_t swaptab [MSFILES];
  726. Xswpi_t swapint = {SI_LIST, (char *)swaptab};
  727. Xstruct tune tune;
  728. Xstruct utsname utsname;
  729. Xstruct var v;
  730. X
  731. Xstruct timeb timeb_cycle_start;
  732. Xstruct timeb timeb_cycle_end;
  733. Xstruct timeb timeb_info_read;
  734. Xstruct timeb timeb_last_info_read;
  735. X
  736. Xint hz;
  737. Xint nswap;    /* seems to be in units of NBPSCTR bytes */
  738. Xint maxmem;
  739. Xint freemem;
  740. Xdaddr_t myreadlen = 0L;
  741. Xint myreadcnt = 0;
  742. Xlong StatPeriod_msec;
  743. Xint current_display_mode = -1;
  744. X
  745. Xint cpu_avg_init = 0;
  746. Xtime_t *cpu_avg[CPU_AVG_MAX];
  747. Xtime_t cpu_ticks[5];
  748. X
  749. Xint wait_avg_init = 0;
  750. Xtime_t *wait_avg[WAIT_AVG_MAX];
  751. Xtime_t wait_ticks[5];
  752. Xint ps_procs_to_display = 0;
  753. X#define PS_X_TOO_BIG  99999
  754. Xint ps_x,ps_y;
  755. Xint fresh_Ps_paint = 1;
  756. X
  757. Xvoid caught_signal();
  758. X
  759. X/*+-------------------------------------------------------------------------
  760. X    update_Tod() - show current time
  761. X--------------------------------------------------------------------------*/
  762. Xvoid
  763. Xupdate_Tod()
  764. X{
  765. Xtime_t now;
  766. Xstruct tm *lt;
  767. Xchar tod[12];
  768. Xchar *cptr = tod;
  769. X
  770. X    if(DrawAreaXYWH.width < (DispMsg_tlx + Tod_WIDTH + (FWIDTH * 2)))
  771. X        return;
  772. X
  773. X    (void)time(&now);
  774. X    lt = localtime(&now);
  775. X    utoda_lz(cptr,2,lt->tm_hour);
  776. X    cptr += 2;
  777. X    *cptr++ = ':';
  778. X    utoda_lz(cptr,2,lt->tm_min);
  779. X    cptr += 2;
  780. X    *cptr++ = ':';
  781. X    utoda_lz(cptr,2,lt->tm_sec);
  782. X    cptr += 2;
  783. X    *cptr = 0;
  784. X    XClearArea(display,window,Tod_TLX,Tod_TLY,FWIDTH * 8,FHEIGHT,0);
  785. X    XSetForeground(display,gc,colorCyan.pixel);
  786. X    XDrawString(display,window,gc,Tod_TLX,Tod_TLY + FASCENT,tod,8);
  787. X
  788. X}    /* end of update_Tod */
  789. X
  790. X/*+-------------------------------------------------------------------------
  791. X    update_StatPeriod() - show time since last update
  792. X--------------------------------------------------------------------------*/
  793. Xvoid
  794. Xupdate_StatPeriod()
  795. X{
  796. Xunsigned long pixel = colorGreen.pixel;
  797. Xchar msecstr[32];
  798. Xint pct = (StatPeriod_msec * 100) / StatCycle_msec;
  799. X
  800. X    if(DrawAreaXYWH.width <
  801. X        (DispMsg_tlx + StatPeriod_WIDTH + Tod_WIDTH + (FWIDTH * 2)))
  802. X    {
  803. X        return;
  804. X    }
  805. X
  806. X    if(StatPeriod_msec < 50)
  807. X        strcpy(msecstr,"--------");
  808. X    else
  809. X    {
  810. X        ultoda(msecstr,7,StatPeriod_msec);
  811. X        strcat(msecstr,"ms");
  812. X    }
  813. X
  814. X    XClearArea(display,window,
  815. X        StatPeriod_TLX,StatPeriod_TLY,FWIDTH * 8,FHEIGHT,0);
  816. X    if(pct < 20)
  817. X        pixel = colorSlate.pixel;
  818. X    else if(pct < 80)
  819. X        pixel = colorOrange.pixel;
  820. X    else if((pct > 200) || ((StatPeriod_msec - StatCycle_msec) > 3000L))
  821. X        pixel = colorRed.pixel;
  822. X    else if((pct > 150) || ((StatPeriod_msec - StatCycle_msec) > 2000L))
  823. X        pixel = colorYellow.pixel;
  824. X    XSetForeground(display,gc,pixel);
  825. X    XDrawString(display,window,gc,
  826. X        StatPeriod_TLX,StatPeriod_TLY + FASCENT,msecstr,strlen(msecstr));
  827. X
  828. X}    /* end of update_StatPeriod */
  829. X
  830. X/*+-------------------------------------------------------------------------
  831. X    update_StatCycle() - show planned time between updates
  832. X--------------------------------------------------------------------------*/
  833. Xvoid
  834. Xupdate_StatCycle()
  835. X{
  836. Xchar msecstr[32];
  837. Xint pct = (StatCycle_msec * 100) / StatCycle_msec;
  838. X
  839. X    if(DrawAreaXYWH.width <
  840. X        (DispMsg_tlx + StatCycle_WIDTH + StatPeriod_WIDTH +
  841. X         Tod_WIDTH + (FWIDTH * 4)))
  842. X    {
  843. X        return;
  844. X    }
  845. X
  846. X    ultoda(msecstr,6,StatCycle_msec);
  847. X    strcat(msecstr,"ms");
  848. X    XClearArea(display,window,
  849. X        StatCycle_TLX,StatCycle_TLY,FWIDTH * 8,FHEIGHT,0);
  850. X    XSetForeground(display,gc,colorBlue.pixel);
  851. X    XDrawString(display,window,gc,
  852. X        StatCycle_TLX,StatCycle_TLY + FASCENT,msecstr,strlen(msecstr));
  853. X
  854. X}    /* end of update_StatCycle */
  855. X
  856. X/*+-------------------------------------------------------------------------
  857. X    calc_cpu_avg(per_state) - add per_state array to avg array
  858. X--------------------------------------------------------------------------*/
  859. Xvoid
  860. Xcalc_cpu_avg(per_state)
  861. Xtime_t per_state[];
  862. X{
  863. Xregister itmp;
  864. X
  865. X    if(!cpu_avg_init)
  866. X    {
  867. X        for(itmp = 0; itmp < CPU_AVG_MAX; itmp++)
  868. X            (void)memcpy(cpu_avg[itmp],per_state,sizeof(time_t) * 5);
  869. X        cpu_avg_init = 1;
  870. X    }
  871. X    else
  872. X    {
  873. X        for(itmp = 0; itmp < CPU_AVG_MAX - 1; itmp++)
  874. X            (void)memcpy(cpu_avg[itmp],cpu_avg[itmp + 1],sizeof(time_t) * 5);
  875. X        (void)memcpy(cpu_avg[itmp],per_state,sizeof(time_t) * 5);
  876. X    }
  877. X
  878. X}    /* end of calc_cpu_avg */
  879. X
  880. X/*+-------------------------------------------------------------------------
  881. X    get_cpu_avg(cpu_ticks,period)
  882. X--------------------------------------------------------------------------*/
  883. Xget_cpu_avg(cpu_ticks,period)
  884. Xtime_t cpu_ticks[];
  885. Xint period;
  886. X{
  887. Xregister iperiod = CPU_AVG_MAX;
  888. Xregister istate;
  889. Xregister count = period;
  890. X
  891. X    for(istate = 0; istate < 5; istate++)
  892. X        cpu_ticks[istate] = 0;
  893. X
  894. X    while(count--)
  895. X    {
  896. X        iperiod--;
  897. X        for(istate = 0; istate < 5; istate++)
  898. X            cpu_ticks[istate] += (cpu_avg[iperiod])[istate];
  899. X    }
  900. X
  901. X    for(istate = 0; istate < 5; istate++)
  902. X        cpu_ticks[istate] /= period;
  903. X
  904. X}    /* end of get_cpu_avg */
  905. X
  906. X/*+-------------------------------------------------------------------------
  907. X    calc_wait_avg(per_state) - add per_state array to avg array
  908. X--------------------------------------------------------------------------*/
  909. Xvoid
  910. Xcalc_wait_avg(per_state)
  911. Xtime_t per_state[];
  912. X{
  913. Xregister itmp;
  914. X
  915. X    if(!wait_avg_init)
  916. X    {
  917. X        for(itmp = 0; itmp < WAIT_AVG_MAX; itmp++)
  918. X            (void)memcpy(wait_avg[itmp],per_state,sizeof(time_t) * 3);
  919. X        wait_avg_init = 1;
  920. X    }
  921. X    else
  922. X    {
  923. X        for(itmp = 0; itmp < WAIT_AVG_MAX - 1; itmp++)
  924. X            (void)memcpy(wait_avg[itmp],wait_avg[itmp + 1],sizeof(time_t) * 3);
  925. X        (void)memcpy(wait_avg[itmp],per_state,sizeof(time_t) * 3);
  926. X    }
  927. X
  928. X}    /* end of calc_wait_avg */
  929. X
  930. X/*+-------------------------------------------------------------------------
  931. X    get_wait_avg(wait_ticks,period)
  932. X--------------------------------------------------------------------------*/
  933. Xget_wait_avg(wait_ticks,period)
  934. Xtime_t wait_ticks[];
  935. Xint period;
  936. X{
  937. Xregister iperiod = WAIT_AVG_MAX;
  938. Xregister istate;
  939. Xregister count = period;
  940. X
  941. X    for(istate = 0; istate < 3; istate++)
  942. X        wait_ticks[istate] = 0;
  943. X
  944. X    while(count--)
  945. X    {
  946. X        iperiod--;
  947. X        for(istate = 0; istate < 3; istate++)
  948. X        {
  949. X            wait_ticks[istate] += (wait_avg[iperiod])[istate];
  950. X        }
  951. X    }
  952. X
  953. X    for(istate = 0; istate < 3; istate++)
  954. X        wait_ticks[istate] /= period;
  955. X
  956. X}    /* end of get_wait_avg */
  957. X
  958. X/*+-------------------------------------------------------------------------
  959. X    draw_lower_main_statics() - draw lower main static portion
  960. X--------------------------------------------------------------------------*/
  961. Xvoid
  962. Xdraw_lower_main_statics()
  963. X{
  964. X
  965. X    draw_Var(Var_TLX,Var_TLY);
  966. X#if defined(HAS_BOOTINFO)
  967. X    draw_Bootinfo(Bootinfo_TLX,Bootinfo_TLY);
  968. X#endif
  969. X    draw_Tune(Tune_TLX,Tune_TLY);
  970. X}    /* end of draw_lower_main_statics */
  971. X
  972. X/*+-------------------------------------------------------------------------
  973. X    read_sysinfo_and_minfo() - rattle kmem for sysinfo/minfo data
  974. X--------------------------------------------------------------------------*/
  975. Xvoid
  976. Xread_sysinfo_and_minfo()
  977. X{
  978. X    timeb_last_info_read = timeb_info_read;
  979. X    (void)ftime(&timeb_info_read);
  980. X    kread((caddr_t)&sysinfo,sysinfoaddr,sizeof(sysinfo));
  981. X    kread((caddr_t)&minfo,minfoaddr,sizeof(minfo));
  982. X}    /* end of read_sysinfo_and_minfo */
  983. X
  984. X/*+-------------------------------------------------------------------------
  985. X    update_display(read_new_kernel_data) - update dynamic display
  986. X--------------------------------------------------------------------------*/
  987. Xvoid
  988. Xupdate_display(read_new_kernel_data)
  989. Xint read_new_kernel_data;
  990. X{
  991. Xint itmp;
  992. Xtime_t total_ticks;
  993. X
  994. X    update_Tod();
  995. X
  996. X    if(read_new_kernel_data)
  997. X    {
  998. X        ftime(&timeb_cycle_start);
  999. X        StatPeriod_msec = delta_msec(timeb_info_read,timeb_last_info_read);
  1000. X        kread((caddr_t)&freemem,freememaddr,sizeof(freemem));
  1001. X        read_sysinfo_and_minfo();
  1002. X
  1003. X        for (itmp = 0; itmp < 5; itmp++)
  1004. X        {
  1005. X            if(itmp != CPU_WAIT)
  1006. X                cpu_ticks[itmp] = sysidelta(cpu[itmp]);
  1007. X        }
  1008. X        cpu_ticks[CPU_WAIT] = 0;
  1009. X        for (itmp = 0; itmp < 3; itmp++)
  1010. X            cpu_ticks[CPU_WAIT] += (wait_ticks[itmp] = sysidelta(wait[itmp]));
  1011. X    }
  1012. X
  1013. X    update_StatPeriod();
  1014. X    update_StatCycle();
  1015. X
  1016. X    total_ticks = update_CpuScale(CpuScale_TLX,
  1017. X        CpuScale_TLY + (FHEIGHT * 1),cpu_ticks);
  1018. X    update_WaitScale(WaitScale_TLX,
  1019. X        WaitScale_TLY + (FHEIGHT * 1),wait_ticks,total_ticks);
  1020. X
  1021. X    if(read_new_kernel_data)
  1022. X    {
  1023. X        calc_cpu_avg(cpu_ticks);
  1024. X        calc_wait_avg(wait_ticks);
  1025. X    }
  1026. X
  1027. X    get_cpu_avg(cpu_ticks,5);
  1028. X    total_ticks = update_CpuScale(CpuScale_TLX,
  1029. X        CpuScale_TLY + (FHEIGHT * 2),cpu_ticks);
  1030. X    get_wait_avg(wait_ticks,5);
  1031. X    update_WaitScale(WaitScale_TLX,
  1032. X        WaitScale_TLY + (FHEIGHT * 2),wait_ticks,total_ticks);
  1033. X
  1034. X    get_cpu_avg(cpu_ticks,10);
  1035. X    total_ticks = update_CpuScale(CpuScale_TLX,
  1036. X        CpuScale_TLY + (FHEIGHT * 3),cpu_ticks);
  1037. X    get_wait_avg(wait_ticks,10);
  1038. X    update_WaitScale(WaitScale_TLX,
  1039. X        WaitScale_TLY + (FHEIGHT * 3),wait_ticks,total_ticks);
  1040. X
  1041. X    switch(current_display_mode)
  1042. X    {
  1043. X        case BUTTON_main:
  1044. X            update_Sysinfo();
  1045. X            draw_Proc(Proc_TLX,Proc_TLY,redrawing_entire_DrawArea);
  1046. X            break;
  1047. X
  1048. X        case BUTTON_ps:
  1049. X            update_Sysinfo();
  1050. X            /* fall through */
  1051. X
  1052. X        case BUTTON_Ps:
  1053. X            if(DrawAreaXYWH.height < (ps_y + (FHEIGHT * 2)))
  1054. X            {
  1055. X                if(ps_y != PS_X_TOO_BIG)
  1056. X                {
  1057. X                    turn_on_MyButton(current_display_mode,colorYellow.pixel);
  1058. X                    disp_msg(colorOrange.pixel,make_taller_to_restore_Ps);
  1059. X                    ps_y = PS_X_TOO_BIG;
  1060. X                }
  1061. X                fresh_Ps_paint = 1;
  1062. X                break;
  1063. X            }
  1064. X            if(fresh_Ps_paint)
  1065. X                turn_on_MyButton(current_display_mode,colorCyan.pixel);
  1066. X            draw_Ps(ps_x,ps_y,ps_procs_to_display,fresh_Ps_paint);
  1067. X            fresh_Ps_paint = 0;
  1068. X            break;
  1069. X    }
  1070. X    redrawing_entire_DrawArea = 0;
  1071. X
  1072. X    sysinfo_last = sysinfo;
  1073. X    minfo_last = minfo;
  1074. X
  1075. X}    /* end of update_display */
  1076. X
  1077. X/*+-------------------------------------------------------------------------
  1078. X    set_display_mode(new_mode) - select main/ps/Ps
  1079. XThis krock betrays the Kludgosity of Affairs
  1080. X--------------------------------------------------------------------------*/
  1081. Xvoid
  1082. Xset_display_mode(new_mode)
  1083. Xint new_mode;
  1084. X{
  1085. Xvoid expose_callback();
  1086. Xint old_display_mode = current_display_mode;
  1087. Xint clear_y = -1;
  1088. X
  1089. X    if(new_mode == BUTTON_quit)
  1090. X        quit_now();
  1091. X
  1092. X    if(current_display_mode == new_mode)
  1093. X        return;
  1094. X
  1095. X    switch(old_display_mode)
  1096. X    {
  1097. X        case BUTTON_main:
  1098. X            ps_procs_to_display = 0;
  1099. X            switch(new_mode)
  1100. X            {
  1101. X                case BUTTON_ps:
  1102. X                    draw_Ps_stop_work_proc();
  1103. X                    clear_y = ps_y = EXTRA_TLY;
  1104. X                    break;
  1105. X                case BUTTON_Ps:
  1106. X                    draw_Ps_stop_work_proc();
  1107. X                    clear_y = Sysinfo_TLY;
  1108. X                    break;
  1109. X            }
  1110. X            if(DrawAreaXYWH.height < (clear_y + (FHEIGHT * 3)))
  1111. X            {
  1112. X                disp_msg(colorRed.pixel,make_taller_for_Ps);
  1113. X                return;
  1114. X            }
  1115. X            ps_y = clear_y;
  1116. X            ps_x = 0;
  1117. X            ps_procs_to_display = (DrawAreaXYWH.height - ps_y) / FHEIGHT;
  1118. X            fresh_Ps_paint = 1;
  1119. X            break;
  1120. X
  1121. X        case BUTTON_ps:
  1122. X            draw_Ps_stop_work_proc();
  1123. X            switch(new_mode)
  1124. X            {
  1125. X                case BUTTON_main:
  1126. X                    clear_y = EXTRA_TLY;
  1127. X                    break;
  1128. X                case BUTTON_Ps:
  1129. X                    clear_y = Sysinfo_TLY;
  1130. X                    ps_y = clear_y;
  1131. X                    fresh_Ps_paint = 1;
  1132. X                    if(DrawAreaXYWH.height < (ps_y + (FHEIGHT * 2)))
  1133. X                    {
  1134. X                        current_display_mode = new_mode;
  1135. X                        turn_off_MyButton(old_display_mode);
  1136. X                        turn_on_MyButton(current_display_mode,
  1137. X                            colorOrange.pixel);
  1138. X                        disp_msg(colorOrange.pixel,make_taller_to_restore_Ps);
  1139. X                        ps_y = PS_X_TOO_BIG;
  1140. X                        return;
  1141. X                    }
  1142. X                    break;
  1143. X            }
  1144. X            break;
  1145. X
  1146. X        case BUTTON_Ps:
  1147. X            draw_Ps_stop_work_proc();
  1148. X            clear_y = Sysinfo_TLY;
  1149. X            switch(new_mode)
  1150. X            {
  1151. X                case BUTTON_main:
  1152. X                    clear_y = Sysinfo_TLY;
  1153. X                    break;
  1154. X                case BUTTON_ps:
  1155. X                    ps_y = EXTRA_TLY;
  1156. X                    fresh_Ps_paint = 1;
  1157. X                    if(DrawAreaXYWH.height < (ps_y + (FHEIGHT * 2)))
  1158. X                    {
  1159. X                        current_display_mode = new_mode;
  1160. X                        turn_off_MyButton(old_display_mode);
  1161. X                        turn_on_MyButton(current_display_mode,
  1162. X                            colorOrange.pixel);
  1163. X                        disp_msg(colorOrange.pixel,make_taller_to_restore_Ps);
  1164. X                        ps_y = PS_X_TOO_BIG;
  1165. X                        if(clear_y < DrawAreaXYWH.height)
  1166. X                        {
  1167. X                            XClearArea(display,window,0,clear_y,
  1168. X                                DrawAreaXYWH.width,
  1169. X                                DrawAreaXYWH.height - clear_y,0);
  1170. X                            draw_Sysinfo_literals(Sysinfo_TLX,Sysinfo_TLY);
  1171. X                            redrawing_entire_DrawArea = 1;
  1172. X                        }
  1173. X                        return;
  1174. X                    }
  1175. X                    break;
  1176. X            }
  1177. X            break;
  1178. X    }
  1179. X
  1180. X    current_display_mode = new_mode;
  1181. X    disp_msg(background,"");
  1182. X    if((clear_y > 0) && (clear_y < DrawAreaXYWH.height))
  1183. X    {
  1184. X        XClearArea(display,window,0,clear_y,
  1185. X            DrawAreaXYWH.width,DrawAreaXYWH.height - clear_y,0);
  1186. X        expose_callback(DrawAreaW,(caddr_t)0,(caddr_t)0);
  1187. X    }
  1188. X    else
  1189. X    {
  1190. X        turn_off_MyButton(old_display_mode);
  1191. X        turn_on_MyButton(current_display_mode,colorCyan.pixel);
  1192. X    }
  1193. X
  1194. X}    /* end of set_display_mode */
  1195. X
  1196. X/*+-------------------------------------------------------------------------
  1197. X    draw_display() - draw display literals
  1198. X--------------------------------------------------------------------------*/
  1199. Xvoid
  1200. Xdraw_display()
  1201. X{
  1202. Xchar *cptr;
  1203. X
  1204. X    place_MyButtons_all_off();
  1205. X    turn_on_MyButton(current_display_mode,colorCyan.pixel);
  1206. X    disp_msg(colorBlack.pixel,"");
  1207. X
  1208. X    XClearArea(display,window,
  1209. X        DispMsg_tlx,0,DrawAreaXYWH.width - DispMsg_tlx,FHEIGHT,0);
  1210. X#ifdef LABELLED_STAT_TIMES
  1211. X    cptr = "sleep:";
  1212. X    XSetForeground(display,gc,colorBlue.pixel);
  1213. X    XDrawString(display,window,gc,
  1214. X        StatCycleL_TLX,StatCycleL_TLY + FASCENT,cptr,strlen(cptr));
  1215. X    cptr = "last:";
  1216. X    XDrawString(display,window,gc,
  1217. X        StatPeriodL_TLX,StatPeriodL_TLY + FASCENT,cptr,strlen(cptr));
  1218. X#endif
  1219. X
  1220. X    draw_CpuScale_literals(CpuScale_TLX,CpuScale_TLY);
  1221. X    draw_WaitScale_literals(WaitScale_TLX,WaitScale_TLY);
  1222. X
  1223. X    ps_y = PS_X_TOO_BIG;    /* shud be MAXPOS or something */
  1224. X    ps_procs_to_display = 0;
  1225. X
  1226. X    switch(current_display_mode)
  1227. X    {
  1228. X        case BUTTON_main:
  1229. X            draw_Sysinfo_literals(Sysinfo_TLX,Sysinfo_TLY);
  1230. X            draw_lower_main_statics();
  1231. X            break;
  1232. X
  1233. X        case BUTTON_ps:
  1234. X            draw_Sysinfo_literals(Sysinfo_TLX,Sysinfo_TLY);
  1235. X            ps_y = EXTRA_TLY;
  1236. X            ps_x = 0;
  1237. X            fresh_Ps_paint = 1;
  1238. X            break;
  1239. X
  1240. X        case BUTTON_Ps:
  1241. X            ps_y = Sysinfo_TLY;
  1242. X            ps_x = 0;
  1243. X            fresh_Ps_paint = 1;
  1244. X            break;
  1245. X    }
  1246. X
  1247. X    if(DrawAreaXYWH.height > (ps_y + (FHEIGHT * 2)))
  1248. X    {
  1249. X        ps_procs_to_display = (DrawAreaXYWH.height - ps_y) / FHEIGHT;
  1250. X        draw_Ps(ps_x,ps_y,ps_procs_to_display,fresh_Ps_paint);
  1251. X        fresh_Ps_paint = 0;
  1252. X    }
  1253. X
  1254. X}    /* end of draw_display */
  1255. X
  1256. X/*+-------------------------------------------------------------------------
  1257. X    update_timer_proc(client_data) - "callback" for application timeout
  1258. X--------------------------------------------------------------------------*/
  1259. Xvoid
  1260. Xupdate_timer_proc(client_data)
  1261. Xcaddr_t client_data;
  1262. X{
  1263. Xvoid set_update_timer();
  1264. X
  1265. X    update_timer_ID = (XtIntervalId)0;
  1266. X    if(!ps_WorkProc_ID)
  1267. X    {
  1268. X        update_display(1);
  1269. X        if(!ps_WorkProc_ID)
  1270. X            set_update_timer();
  1271. X    }
  1272. X
  1273. X}    /* end of update_timer_proc */
  1274. X
  1275. X/*+-------------------------------------------------------------------------
  1276. X    set_update_timer() - start application timeout for display cycle
  1277. X--------------------------------------------------------------------------*/
  1278. Xvoid
  1279. Xset_update_timer()
  1280. X{
  1281. X    update_timer_ID = XtAddTimeOut(StatCycle_msec,update_timer_proc,
  1282. X        (caddr_t)0);
  1283. X}    /* end of set_update_timer */
  1284. X
  1285. X/*+-------------------------------------------------------------------------
  1286. X    expose_callback(widget,client_data,call_data)
  1287. X--------------------------------------------------------------------------*/
  1288. Xvoid
  1289. Xexpose_callback(widget,client_data,call_data)
  1290. XWidget widget;
  1291. Xcaddr_t client_data;
  1292. XXmDrawingAreaCallbackStruct *call_data;
  1293. X{
  1294. XXExposeEvent *event = (XExposeEvent *)0;
  1295. Xstatic int first_expose = 1;
  1296. X
  1297. X    if(!XtIsRealized(widget))
  1298. X        return;
  1299. X    if(call_data)
  1300. X        event = (XExposeEvent *)call_data->event;
  1301. X    if(event && (event->count != 0))
  1302. X        return;
  1303. X
  1304. X    XGetWindowAttributes(display,window,&DrawAreaXYWH);
  1305. X
  1306. X    choose_MyFont();
  1307. X
  1308. X    draw_Ps_stop_work_proc();
  1309. X    redrawing_entire_DrawArea = 1;
  1310. X    draw_display();
  1311. X    update_display(1);
  1312. X    redrawing_entire_DrawArea = 0;
  1313. X    if(first_expose)
  1314. X        set_update_timer();
  1315. X    first_expose = 0;
  1316. X
  1317. X}    /* end of expose_callback */
  1318. X
  1319. X/*+-------------------------------------------------------------------------
  1320. X    resize_callback(widget,client_data,call_data)
  1321. X--------------------------------------------------------------------------*/
  1322. Xvoid
  1323. Xresize_callback(widget,client_data,call_data)
  1324. XWidget widget;
  1325. Xcaddr_t client_data;
  1326. XXmDrawingAreaCallbackStruct *call_data;
  1327. X{
  1328. X
  1329. X    XGetWindowAttributes(display,window,&DrawAreaXYWH);
  1330. X    invalidate_last_DispMsg();
  1331. X
  1332. X}    /* end of resize_callback */
  1333. X
  1334. X/*+-------------------------------------------------------------------------
  1335. X    quit_now() - good bye
  1336. X--------------------------------------------------------------------------*/
  1337. Xvoid
  1338. Xquit_now()
  1339. X{
  1340. X    turn_off_all_MyButtons();
  1341. X    turn_on_MyButton(BUTTON_quit,colorRed.pixel);
  1342. X    XSync(display,False);
  1343. X    sleep(1);
  1344. X    leave(0);
  1345. X}    /* end of quit_now */
  1346. X
  1347. X/*+-------------------------------------------------------------------------
  1348. X    delta_StatCycle(delta_msec) - user has changed display cycle period
  1349. X--------------------------------------------------------------------------*/
  1350. Xvoid
  1351. Xdelta_StatCycle(delta_msec)
  1352. Xunsigned long delta_msec;
  1353. X{
  1354. Xunsigned long new_msec = StatCycle_msec + delta_msec;
  1355. X
  1356. X    if((new_msec < StatCycle_msecMin) || (new_msec > StatCycle_msecMax))
  1357. X    {
  1358. X        fputc(7,stderr);
  1359. X        return;
  1360. X    }
  1361. X    StatCycle_msec = new_msec;
  1362. X    update_StatCycle();
  1363. X    draw_CpuScale_literals(CpuScale_TLX,CpuScale_TLY);
  1364. X    draw_WaitScale_literals(WaitScale_TLX,WaitScale_TLY);
  1365. X
  1366. X}    /* end of delta_StatCycle */
  1367. X
  1368. X/*+-------------------------------------------------------------------------
  1369. X    input_callback_key_event(widget,client_data,call_data)
  1370. X--------------------------------------------------------------------------*/
  1371. Xvoid
  1372. Xinput_callback_key_event(widget,client_data,call_data)
  1373. XWidget widget;
  1374. Xcaddr_t client_data;
  1375. XXmDrawingAreaCallbackStruct *call_data;
  1376. X{
  1377. XXKeyEvent *event = (XKeyEvent *)(call_data->event);
  1378. Xint numkeys;
  1379. XKeySym keysym;
  1380. Xunsigned char kbuf[8];
  1381. X
  1382. X    numkeys = XLookupString(event,kbuf,sizeof(kbuf),
  1383. X        &keysym,(XComposeStatus *)0);
  1384. X
  1385. X    if((event->type == KeyPress) && (numkeys == 1))
  1386. X    {
  1387. X        switch(kbuf[0])
  1388. X        {
  1389. X            case 'm': set_display_mode(BUTTON_main); break;
  1390. X            case 'p': set_display_mode(BUTTON_ps); break;
  1391. X            case 'P': set_display_mode(BUTTON_Ps); break;
  1392. X            case '+': delta_StatCycle(+1000L); break;
  1393. X            case '-': delta_StatCycle(-1000L); break;
  1394. X            case 'q': quit_now();
  1395. X                /*NOTREACHED*/
  1396. X            default: fputs("\7",stderr);    /* Ackkkkk -- lazy */
  1397. X        }
  1398. X    }
  1399. X
  1400. X}    /* end of input_callback_key_event */
  1401. X
  1402. X/*+-------------------------------------------------------------------------
  1403. X    input_callback(widget,client_data,call_data)
  1404. X--------------------------------------------------------------------------*/
  1405. Xvoid
  1406. Xinput_callback(widget,client_data,call_data)
  1407. XWidget widget;
  1408. Xcaddr_t client_data;
  1409. XXmDrawingAreaCallbackStruct *call_data;
  1410. X{
  1411. X
  1412. X    switch (call_data->event->type)
  1413. X    {
  1414. X        case KeyPress:
  1415. X        case KeyRelease:
  1416. X            input_callback_key_event(widget,client_data,call_data);
  1417. X            break;
  1418. X    }
  1419. X
  1420. X}  /* end of input_callback */
  1421. X
  1422. X/*+-------------------------------------------------------------------------
  1423. X    entry_callback(widget,client_data,call_data)
  1424. X--------------------------------------------------------------------------*/
  1425. Xvoid
  1426. Xentry_callback(widget,client_data,call_data)
  1427. XWidget widget;
  1428. Xcaddr_t client_data;
  1429. XXmDrawingAreaCallbackStruct *call_data;
  1430. X{
  1431. X
  1432. X/*
  1433. X    switch(call_data->event->type)
  1434. X    {
  1435. X    default:
  1436. X        return;
  1437. X    }
  1438. X*/
  1439. Xprintf("entry callback evtype=%d\n",call_data->event->type);
  1440. X
  1441. X}  /* end of entry_callback */
  1442. X
  1443. X/*+-------------------------------------------------------------------------
  1444. X    main(argc,argv)
  1445. X--------------------------------------------------------------------------*/
  1446. Xmain(argc,argv)
  1447. Xint argc;
  1448. Xchar **argv;
  1449. X{
  1450. Xint itmp;
  1451. Xchar *cptr;
  1452. Xint plock_indicator = 0;
  1453. XArg args[32];
  1454. Xint argcount;
  1455. XPosition x = 0;
  1456. XPosition y = 0;
  1457. XDimension width = DrawArea_DEFAULT_WIDTH;
  1458. XDimension height = DrawArea_DEFAULT_HEIGHT;
  1459. Xchar *progname = strdup(basename(argv[0]));
  1460. Xchar *basename();
  1461. X
  1462. X/*
  1463. X * set default geometry
  1464. X */
  1465. X    sprintf(preferred_geom,"%dx%d-0-0",width,height);
  1466. X
  1467. X/*
  1468. X * if man wants to plock() try it; fail silently if non-root
  1469. X */
  1470. X    if(plock_indicator && plock(PROCLOCK))
  1471. X    {
  1472. X        nice(-5);
  1473. X        plock_indicator = 0;
  1474. X    }
  1475. X
  1476. X/*
  1477. X * Real(tm) performance watcher users will have done a kernel link
  1478. X * and won't need to rely on /etc/systemid
  1479. X */
  1480. X    if(uname(&utsname))
  1481. X    {
  1482. X        leave_text("uname failed",255);
  1483. X        exit(1);
  1484. X    }
  1485. X
  1486. X/*
  1487. X * allocate memory for cpu time array averaging buckets
  1488. X */
  1489. X    for(itmp = 0; itmp < CPU_AVG_MAX; itmp++)
  1490. X    {
  1491. X        if(!(cpu_avg[itmp] = (time_t *)malloc(sizeof(time_t) * 5)))
  1492. X            leave_text("cannot alloc memory for cpu avg arrays",1);
  1493. X    }
  1494. X
  1495. X/*
  1496. X * allocate memory for wait time array averaging buckets
  1497. X */
  1498. X    for(itmp = 0; itmp < WAIT_AVG_MAX; itmp++)
  1499. X    {
  1500. X        if(!(wait_avg[itmp] = (time_t *)malloc(sizeof(time_t) * 3)))
  1501. X            leave_text("cannot alloc memory for wait avg arrays",1);
  1502. X    }
  1503. X
  1504. X/*
  1505. X * read nlist symbols, open /dev/kmem, /dev/mem, /dev/swap,
  1506. X * initialize detail environment
  1507. X * drop euid and egid (after opening privileged mem/devices)
  1508. X * initialize process status uid->name hasher
  1509. X */
  1510. X    nlsym_read();
  1511. X    kinit(0);    /* /dev/kmem, read access only */
  1512. X    minit(0);    /* /dev/mem,  read access only */
  1513. X    sinit();    /* /dev/swap, only read access available */
  1514. X    (void)setuid(getuid());    /* some people run us setuid, so clen that up */
  1515. X    (void)setgid(getgid());    /* now that we have the fds open, drop egid */
  1516. X
  1517. X/*
  1518. X * make initial kmem readings
  1519. X */
  1520. X    hz = (cptr = getenv("HZ")) ? atoi(cptr) : HZ;
  1521. X    kread((caddr_t)&maxmem,maxmemaddr,sizeof(maxmem));
  1522. X    kread((caddr_t)&tune,tuneaddr,sizeof(tune));
  1523. X    kread((caddr_t)&v,vaddr,sizeof(v));
  1524. X
  1525. X    kread((caddr_t)&nswap,nswapaddr,sizeof(nswap));
  1526. X    itmp = -1;
  1527. X#if defined(S3BSWPI)    /* 68000 handled here, not AT&T 3B */
  1528. X    itmp = _sysm68k (S3BSWPI,&swapint);    /* per nba@sysware.sysware.dk */
  1529. X#endif
  1530. X#if defined(SI86SWPI)
  1531. X    itmp = sysi86(SI86SWPI,&swapint);
  1532. X#endif
  1533. X#if defined(SMIPSSWPI)
  1534. X    itmp = sysmips(SMIPSSWPI,&swapint);
  1535. X#endif
  1536. X    if(!itmp)
  1537. X    {
  1538. X        nswap = 0;
  1539. X        for (itmp = 0; itmp < MSFILES; itmp++)
  1540. X            nswap += swaptab[itmp].st_npgs * NBPP / NBPSCTR;
  1541. X    }
  1542. X
  1543. X#if defined(HAS_BOOTINFO)
  1544. X    kread((caddr_t)&bootinfo,bootinfoaddr,sizeof(bootinfo));
  1545. X#endif
  1546. X    read_sysinfo_and_minfo();
  1547. X    sysinfo_last = sysinfo;
  1548. X    minfo_last = minfo;
  1549. X    timeb_last_info_read = timeb_info_read;
  1550. X
  1551. X/*
  1552. X * XForeplay
  1553. X */
  1554. X
  1555. X    /*
  1556. X     * initialize
  1557. X     */
  1558. X    AppShellW = XtInitialize("x386mon","X386mon",
  1559. X        optionDescList, XtNumber(optionDescList), &argc, argv);
  1560. X
  1561. X    XtGetApplicationResources(AppShellW,&res,
  1562. X        appResources,XtNumber(appResources),NULL,0);
  1563. X
  1564. X    appcon = XtWidgetToApplicationContext(AppShellW);
  1565. X    display = XtDisplay(AppShellW);
  1566. X    screen = DefaultScreen(display);
  1567. X    cmap = DefaultColormap(display,screen);
  1568. X    gc = DefaultGC(display,screen);
  1569. X    display_width  = XDisplayWidth(display,screen);
  1570. X    display_height = XDisplayHeight(display,screen);
  1571. X
  1572. X    itmp = XParseGeometry(res.geometry,
  1573. X        &x,&y,&width,&height);
  1574. X   /*
  1575. X    * Adjust user request to limits
  1576. X    */
  1577. X
  1578. X    if(width < DrawArea_MIN_WIDTH)
  1579. X        width = DrawArea_MIN_WIDTH;
  1580. X    else if (width > display_width)
  1581. X        width = display_width;
  1582. X
  1583. X    if(height < DrawArea_MIN_HEIGHT)
  1584. X        height = DrawArea_MIN_HEIGHT;
  1585. X    else if (height > display_height)
  1586. X        height = display_height;
  1587. X
  1588. X   /*
  1589. X    * Create the drawing area widget (DrawAreaW)
  1590. X    */
  1591. X
  1592. X    init_MyFonts();
  1593. X    init_color();
  1594. X
  1595. X    argcount = 0;
  1596. X    XtSetArg(args[argcount],XmNforeground,(XtArgVal)foreground);
  1597. X    argcount++;
  1598. X    XtSetArg(args[argcount],XmNbackground,(XtArgVal)background);
  1599. X    argcount++;
  1600. X    XtSetArg(args[argcount],XmNwidth,(XtArgVal)width);
  1601. X    argcount++;
  1602. X    XtSetArg(args[argcount],XmNheight,(XtArgVal)height);
  1603. X    argcount++;
  1604. X    XtSetArg(args[argcount],XmNmarginWidth,(XtArgVal)0);
  1605. X    argcount++;
  1606. X    XtSetArg(args[argcount],XmNmarginHeight,(XtArgVal)0);
  1607. X    argcount++;
  1608. X    XtSetArg(args[argcount],XmNresizePolicy,(XtArgVal)XmRESIZE_NONE);
  1609. X    argcount++;
  1610. X
  1611. X    DrawAreaW = XmCreateDrawingArea(AppShellW,"x386mon-draw",
  1612. X        args,(Cardinal)argcount);
  1613. X    XtManageChild(DrawAreaW);
  1614. X
  1615. X   /*
  1616. X    * Toolkit phone home
  1617. X    */
  1618. X
  1619. X    XtAddCallback(DrawAreaW,XmNexposeCallback,expose_callback,(caddr_t)0);
  1620. X    XtAddCallback(DrawAreaW,XmNresizeCallback,resize_callback,(caddr_t)1);
  1621. X    XtAddCallback(DrawAreaW,XmNinputCallback,input_callback,(caddr_t)0);
  1622. X
  1623. X   /*
  1624. X    * set title 
  1625. X    */
  1626. X
  1627. X    sprintf(DrawArea_title,
  1628. X        "x386mon   %s   (%s)  '+'/'-' change interval  wht@n4hgf",
  1629. X        revision,utsname.nodename);
  1630. X    XtSetArg(args[0],XtNtitle,DrawArea_title);
  1631. X    XtSetValues(AppShellW,args,1);
  1632. X
  1633. X    /*
  1634. X     * BlapBlit - disturb display
  1635. X     */
  1636. X
  1637. X    XtRealizeWidget(AppShellW);
  1638. X
  1639. X    /*
  1640. X     * set up for simple XLib calls for the duration
  1641. X     */
  1642. X
  1643. X    window = XtWindow(DrawAreaW);
  1644. X    XGetWindowAttributes(display,window,&DrawAreaXYWH);
  1645. X
  1646. X/*
  1647. X * nlsym read, first sysinfo/minfo/other-structs read
  1648. X * and X started:  init Proc and Ps "objects"
  1649. X */
  1650. X    initialize_Proc();
  1651. X    initialize_Ps();
  1652. X
  1653. X/*
  1654. X * main loop
  1655. X */
  1656. X    XSynchronize(display,0);  /* <<<<<<<============== */
  1657. X    current_display_mode = BUTTON_main;
  1658. X
  1659. X    XtMainLoop();
  1660. X    /*NOTREACHED*/
  1661. X
  1662. X} /* end of main */
  1663. X
  1664. X/* vi: set tabstop=4 shiftwidth=4: */
  1665. X/* end of x386mon.c */
  1666. SHAR_EOF
  1667. chmod 0644 x386mon/x386mon.c ||
  1668. echo 'restore of x386mon/x386mon.c failed'
  1669. Wc_c="`wc -c < 'x386mon/x386mon.c'`"
  1670. test 30634 -eq "$Wc_c" ||
  1671.     echo 'x386mon/x386mon.c: original size 30634, current size' "$Wc_c"
  1672. fi
  1673. true || echo 'restore of x386mon/x386mon.h failed'
  1674. echo End of part 5, continue with part 6
  1675. exit 0
  1676.  
  1677. -----------------------------------------------------------------------
  1678. Warren Tucker, TuckerWare   gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
  1679. Many [Nobel physics] prizes  have been given  to people for  telling us
  1680. the universe is not as simple as we thought it was. -Stephen Hawking in
  1681. A Brief History of Time     In computing, there are no such prizes. -me
  1682.