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

  1. From: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  2. Newsgroups: alt.sources
  3. Subject: X386MON x1.00 patch 1 (part 01/01)
  4. Message-ID: <329@n4hgf.Mt-Park.GA.US>
  5. Date: 21 Feb 91 05:29:55 GMT
  6.  
  7. Submitted-by: wht@n4hgf.Mt-Park.GA.US
  8. Archive-name: x386monx100/patch01
  9.  
  10. #-------------------------------------------------------------
  11. # X386MON x1.00 PATCH 1 - makes x1.10
  12. #
  13. # This patch fixes the ps display where if all processes
  14. # would fit the panel, then they all showed up as swapped
  15. #
  16. # patch < this.article
  17. #-------------------------------------------------------------
  18.  
  19. *** x1.00/ps.c    Wed Feb 20 23:49:29 1991
  20. --- ps.c    Thu Feb 21 00:21:28 1991
  21. ***************
  22. *** 3,8
  23.       wht@n4hgf.Mt-Park.GA.US
  24.   
  25.     Defined functions:
  26.       display_proc_stat(x,y,iproc,initial)
  27.       draw_Ps(x,y,ps_procs_to_disp,initial)
  28.       draw_Ps_work_proc(client_data)
  29.  
  30. --- 3,9 -----
  31.       wht@n4hgf.Mt-Park.GA.US
  32.   
  33.     Defined functions:
  34. +     copy_user_to_proc(tproc,user)
  35.       display_proc_stat(x,y,iproc,initial)
  36.       draw_Ps(x,y,ps_procs_to_disp,initial)
  37.       draw_Ps_work_proc(client_data)
  38. ***************
  39. *** 39,44
  40.   and cron shown as the same size....).
  41.   --------------------------------------------------------------------------*/
  42.   /*+:EDITS:*/
  43.   /*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  44.   
  45.   #include <sys/types.h>
  46.  
  47. --- 40,46 -----
  48.   and cron shown as the same size....).
  49.   --------------------------------------------------------------------------*/
  50.   /*+:EDITS:*/
  51. + /*:02-20-1991-23:59-wht@n4hgf-get_user optimization caused not to get always */
  52.   /*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  53.   
  54.   #include <sys/types.h>
  55. ***************
  56. *** 155,160
  57.   }    /* end of ppproc_pid_compare */
  58.   
  59.   /*+-------------------------------------------------------------------------
  60.       read_and_sort_procs(initial)
  61.   --------------------------------------------------------------------------*/
  62.   void
  63.  
  64. --- 157,189 -----
  65.   }    /* end of ppproc_pid_compare */
  66.   
  67.   /*+-------------------------------------------------------------------------
  68. +     copy_user_to_proc(tproc,user)
  69. + --------------------------------------------------------------------------*/
  70. + void
  71. + copy_user_to_proc(tproc,user)
  72. + register struct proc *tproc;
  73. + register struct user *user;
  74. + {
  75. +     /* save stuff out of user in unimportant proc areas */
  76. +     tproc->p_U_UTIME = user->u_utime;
  77. +     tproc->p_U_STIME = user->u_stime;
  78. +     strncpy((char *)tproc->p_U_PSARGS,user->u_psargs,U_PSARGS_MAX);
  79. +     *((char *)tproc->p_U_PSARGS + U_PSARGS_MAX - 1) = 0;
  80. + #if defined(M_UNIX)             /* SCO */
  81. + #if defined(SCO_USIZE_BROKEN)    /* SCO UNIX 3.2.0 */
  82. +     tproc->p_size = 
  83. +         (((u_long)user->u_tsize + 511) / 1024) +
  84. +         (((u_long)user->u_dsize + 511) / 1024) +
  85. +         (((u_long)user->u_ssize + 511) / 1024) +
  86. +         (((u_long)((user->u_tsize)?1:0) * NBPP) / 1024);
  87. + #else                            /* SCO UNIX 3.2.1 and presumably later */
  88. +     tproc->p_size = 
  89. +         (ctob((u_long)user->u_tsize + user->u_dsize + user->u_ssize)) / 1024;
  90. + #endif
  91. + #endif /* SCO */
  92. + }    /* end of copy_user_to_proc */
  93. + /*+-------------------------------------------------------------------------
  94.       read_and_sort_procs(initial)
  95.   --------------------------------------------------------------------------*/
  96.   void
  97. ***************
  98. *** 277,300
  99.                       omitted_one = 1;
  100.                       continue;
  101.                   }
  102. !                 /* save stuff out of user in unimportant proc areas */
  103. !                 tproc->p_U_UTIME = user.u_utime;
  104. !                 tproc->p_U_STIME = user.u_stime;
  105. !                 strncpy((char *)tproc->p_U_PSARGS,user.u_psargs,U_PSARGS_MAX);
  106. !                 *((char *)tproc->p_U_PSARGS + U_PSARGS_MAX - 1) = 0;
  107. ! #if defined(M_UNIX)             /* SCO */
  108. ! #if defined(SCO_USIZE_BROKEN)    /* SCO UNIX 3.2.0 */
  109. !                 tproc->p_size = 
  110. !                     (((u_long)user.u_tsize + 511) / 1024) +
  111. !                     (((u_long)user.u_dsize + 511) / 1024) +
  112. !                     (((u_long)user.u_ssize + 511) / 1024) +
  113. !                     (((u_long)((user.u_tsize)?1:0) * NBPP) / 1024);
  114. ! #else                            /* SCO UNIX 3.2.1 and presumably later */
  115. !                 tproc->p_size = 
  116. !                     (ctob((u_long)user.u_tsize + user.u_dsize + user.u_ssize))
  117. !                     / 1024;
  118. ! #endif
  119. ! #endif /* SCO */
  120.               }
  121.               nprocs++;
  122.           }
  123.  
  124. --- 306,312 -----
  125.                       omitted_one = 1;
  126.                       continue;
  127.                   }
  128. !                 copy_user_to_proc(tproc,&user);
  129.               }
  130.               nprocs++;
  131.           }
  132. ***************
  133. *** 776,781
  134.           s80[2] = ' ';
  135.           s80[3] = 0;
  136.           disp_info_text(x + (NICE_X * fwidth),y,pixel,s80);
  137.       }
  138.   
  139.       if(tproc->p_GOT_USER)
  140.  
  141. --- 788,799 -----
  142.           s80[2] = ' ';
  143.           s80[3] = 0;
  144.           disp_info_text(x + (NICE_X * fwidth),y,pixel,s80);
  145. +     }
  146. +     if(!tproc->p_GOT_USER)
  147. +     {
  148. +         if(tproc->p_GOT_USER = get_user(tproc,&user))
  149. +             copy_user_to_proc(tproc,&user);
  150.       }
  151.   
  152.       if(tproc->p_GOT_USER)
  153. *** x1.00/x386mon.c    Wed Feb 20 23:49:39 1991
  154. --- x386mon.c    Thu Feb 21 00:00:41 1991
  155. ***************
  156. *** 1,4
  157. ! char *revision = "x1.00";
  158.   /*+-------------------------------------------------------------------------
  159.       x386mon.c - SCO ODT (UNIX 386) system watcher
  160.       wht@n4hgf.Mt-Park.GA.US
  161.  
  162. --- 1,4 -----
  163. ! char *revision = "x1.10";
  164.   /*+-------------------------------------------------------------------------
  165.       x386mon.c - SCO ODT (UNIX 386) system watcher
  166.       wht@n4hgf.Mt-Park.GA.US
  167. ***************
  168. *** 34,39
  169.   
  170.   --------------------------------------------------------------------------*/
  171.   /*+:EDITS:*/
  172.   /*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  173.   
  174.   #include "unixincs.h"
  175.  
  176. --- 34,40 -----
  177.   
  178.   --------------------------------------------------------------------------*/
  179.   /*+:EDITS:*/
  180. + /*:02-21-1991-00:00-wht@n4hgf-change rev number - fixed ps bug */
  181.   /*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
  182.   
  183.   #include "unixincs.h"
  184.  
  185. -----------------------------------------------------------------------
  186. Warren Tucker, TuckerWare   gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
  187. Many [Nobel physics] prizes  have been given  to people for  telling us
  188. the universe is not as simple as we thought it was. -Stephen Hawking in
  189. A Brief History of Time     In computing, there are no such prizes. -me
  190.