X386MON x1.00 patch 1 (part 01/01)

Warren Tucker wht at n4hgf.Mt-Park.GA.US
Thu Feb 21 16:29:55 AEST 1991


Submitted-by: wht at n4hgf.Mt-Park.GA.US
Archive-name: x386monx100/patch01

#-------------------------------------------------------------
# X386MON x1.00 PATCH 1 - makes x1.10
#
# This patch fixes the ps display where if all processes
# would fit the panel, then they all showed up as swapped
#
# patch < this.article
#-------------------------------------------------------------

*** x1.00/ps.c	Wed Feb 20 23:49:29 1991
--- ps.c	Thu Feb 21 00:21:28 1991
***************
*** 3,8
  	wht at n4hgf.Mt-Park.GA.US
  
    Defined functions:
  	display_proc_stat(x,y,iproc,initial)
  	draw_Ps(x,y,ps_procs_to_disp,initial)
  	draw_Ps_work_proc(client_data)

--- 3,9 -----
  	wht at n4hgf.Mt-Park.GA.US
  
    Defined functions:
+ 	copy_user_to_proc(tproc,user)
  	display_proc_stat(x,y,iproc,initial)
  	draw_Ps(x,y,ps_procs_to_disp,initial)
  	draw_Ps_work_proc(client_data)
***************
*** 39,44
  and cron shown as the same size....).
  --------------------------------------------------------------------------*/
  /*+:EDITS:*/
  /*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
  
  #include <sys/types.h>

--- 40,46 -----
  and cron shown as the same size....).
  --------------------------------------------------------------------------*/
  /*+:EDITS:*/
+ /*:02-20-1991-23:59-wht at n4hgf-get_user optimization caused not to get always */
  /*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
  
  #include <sys/types.h>
***************
*** 155,160
  }	/* end of ppproc_pid_compare */
  
  /*+-------------------------------------------------------------------------
  	read_and_sort_procs(initial)
  --------------------------------------------------------------------------*/
  void

--- 157,189 -----
  }	/* end of ppproc_pid_compare */
  
  /*+-------------------------------------------------------------------------
+ 	copy_user_to_proc(tproc,user)
+ --------------------------------------------------------------------------*/
+ void
+ copy_user_to_proc(tproc,user)
+ register struct proc *tproc;
+ register struct user *user;
+ {
+ 	/* save stuff out of user in unimportant proc areas */
+ 	tproc->p_U_UTIME = user->u_utime;
+ 	tproc->p_U_STIME = user->u_stime;
+ 	strncpy((char *)tproc->p_U_PSARGS,user->u_psargs,U_PSARGS_MAX);
+ 	*((char *)tproc->p_U_PSARGS + U_PSARGS_MAX - 1) = 0;
+ #if defined(M_UNIX) 			/* SCO */
+ #if defined(SCO_USIZE_BROKEN)	/* SCO UNIX 3.2.0 */
+ 	tproc->p_size = 
+ 		(((u_long)user->u_tsize + 511) / 1024) +
+ 		(((u_long)user->u_dsize + 511) / 1024) +
+ 		(((u_long)user->u_ssize + 511) / 1024) +
+ 		(((u_long)((user->u_tsize)?1:0) * NBPP) / 1024);
+ #else							/* SCO UNIX 3.2.1 and presumably later */
+ 	tproc->p_size = 
+ 		(ctob((u_long)user->u_tsize + user->u_dsize + user->u_ssize)) / 1024;
+ #endif
+ #endif /* SCO */
+ }	/* end of copy_user_to_proc */
+ 
+ /*+-------------------------------------------------------------------------
  	read_and_sort_procs(initial)
  --------------------------------------------------------------------------*/
  void
***************
*** 277,300
  					omitted_one = 1;
  					continue;
  				}
! 				/* save stuff out of user in unimportant proc areas */
! 				tproc->p_U_UTIME = user.u_utime;
! 				tproc->p_U_STIME = user.u_stime;
! 				strncpy((char *)tproc->p_U_PSARGS,user.u_psargs,U_PSARGS_MAX);
! 				*((char *)tproc->p_U_PSARGS + U_PSARGS_MAX - 1) = 0;
! #if defined(M_UNIX) 			/* SCO */
! #if defined(SCO_USIZE_BROKEN)	/* SCO UNIX 3.2.0 */
! 				tproc->p_size = 
! 					(((u_long)user.u_tsize + 511) / 1024) +
! 					(((u_long)user.u_dsize + 511) / 1024) +
! 					(((u_long)user.u_ssize + 511) / 1024) +
! 					(((u_long)((user.u_tsize)?1:0) * NBPP) / 1024);
! #else							/* SCO UNIX 3.2.1 and presumably later */
! 				tproc->p_size = 
! 					(ctob((u_long)user.u_tsize + user.u_dsize + user.u_ssize))
! 					/ 1024;
! #endif
! #endif /* SCO */
  			}
  			nprocs++;
  		}

--- 306,312 -----
  					omitted_one = 1;
  					continue;
  				}
! 				copy_user_to_proc(tproc,&user);
  			}
  			nprocs++;
  		}
***************
*** 776,781
  		s80[2] = ' ';
  		s80[3] = 0;
  		disp_info_text(x + (NICE_X * fwidth),y,pixel,s80);
  	}
  
  	if(tproc->p_GOT_USER)

--- 788,799 -----
  		s80[2] = ' ';
  		s80[3] = 0;
  		disp_info_text(x + (NICE_X * fwidth),y,pixel,s80);
+ 	}
+ 
+ 	if(!tproc->p_GOT_USER)
+ 	{
+ 		if(tproc->p_GOT_USER = get_user(tproc,&user))
+ 			copy_user_to_proc(tproc,&user);
  	}
  
  	if(tproc->p_GOT_USER)
*** x1.00/x386mon.c	Wed Feb 20 23:49:39 1991
--- x386mon.c	Thu Feb 21 00:00:41 1991
***************
*** 1,4
! char *revision = "x1.00";
  /*+-------------------------------------------------------------------------
  	x386mon.c - SCO ODT (UNIX 386) system watcher
  	wht at n4hgf.Mt-Park.GA.US

--- 1,4 -----
! char *revision = "x1.10";
  /*+-------------------------------------------------------------------------
  	x386mon.c - SCO ODT (UNIX 386) system watcher
  	wht at n4hgf.Mt-Park.GA.US
***************
*** 34,39
  
  --------------------------------------------------------------------------*/
  /*+:EDITS:*/
  /*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
  
  #include "unixincs.h"

--- 34,40 -----
  
  --------------------------------------------------------------------------*/
  /*+:EDITS:*/
+ /*:02-21-1991-00:00-wht at n4hgf-change rev number - fixed ps bug */
  /*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
  
  #include "unixincs.h"
 
-----------------------------------------------------------------------
Warren Tucker, TuckerWare   gatech!n4hgf!wht or wht at n4hgf.Mt-Park.GA.US
Many [Nobel physics] prizes  have been given  to people for  telling us
the universe is not as simple as we thought it was. -Stephen Hawking in
A Brief History of Time     In computing, there are no such prizes. -me



More information about the Alt.sources mailing list