bin/65803: ps enhancements (posix syntax, and more)

Cyrille Lefevre clefevre-lists at 9online.fr
Fri Apr 30 15:30:19 PDT 2004


The following reply was made to PR bin/65803; it has been noted by GNATS.

From: "Cyrille Lefevre" <clefevre-lists at 9online.fr>
To: "gnats-submit @FreeBSD.org" <FreeBSD-gnats-submit at freebsd.org>
Cc:  
Subject: bin/65803: ps enhancements (posix syntax, and more)
Date: Sat, 1 May 2004 00:29:27 +0200

 f...ing rbl...
 
 feature changed :
 sz changed from vsz (alias) to dsiz + ssiz (calculated).
 kernel bug fix :
 uses timeradd for childtime.
 sysctl_kern_proc(), KERN_PROC_ALL added -> no filtering,
 default -> EINVAL.
 
 diff -u orig/extern.h ./extern.h
 --- orig/extern.h Fri Apr 30 22:11:40 2004
 +++ ./extern.h Fri Apr 30 22:43:33 2004
 @@ -94,6 +94,7 @@
  #if defined(COMPAT_TRU64)
  void systime(KINFO *, VARENT *);
  #endif
 +void sz(KINFO *, VARENT *);
  void tdev(KINFO *, VARENT *);
  void tname(KINFO *, VARENT *);
  void ucomm(KINFO *, VARENT *);
 diff -u orig/keyword.c ./keyword.c
 --- orig/keyword.c Fri Apr 30 22:11:40 2004
 +++ ./keyword.c Fri Apr 30 22:43:08 2004
 @@ -369,7 +369,7 @@
  #if defined(COMPAT_TRU64)
  /*-         t*/ SIZE("systime", "SYSTIME", USER, systime, s_time, TIME),
  #endif
 -/*_     xh  t*/ ALIAS("sz", "SZ", "vsz"),
 +/*_     xh  t*/ CALL("sz", "SZ",  0, sz, LSZ),
  #if defined(WITH_NOP_ALIASES)
  /*#        s */ CALL("taskid", "TASKID", 0, nop, PID),
  #endif
 diff -u orig/print.c ./print.c
 --- orig/print.c Fri Apr 30 22:11:40 2004
 +++ ./print.c Fri Apr 30 22:48:16 2004
 @@ -705,6 +705,16 @@
   printsize("%*lu", v->width, (u_long)(k->ki_p->ki_size / 1024));
  }
  
 +void
 +sz(KINFO *k, VARENT *ve)
 +{
 + VAR *v;
 +
 + v = ve->var;
 + printsize("%*lu", v->width, ps_pgtok((u_long)k->ki_p->ki_dsize) +
 +     ps_pgtok((u_long)k->ki_p->ki_ssize));
 +}
 +
  static void
  printtime(time_t secs, time_t psecs, short width, int _etime)
  {
 
 --- src/sys/kern/kern_proc.c.old Fri Apr 30 23:07:36 2004
 +++ src/sys/kern/kern_proc.c Fri Apr 30 23:02:02 2004
 @@ -708,10 +708,9 @@
   kp->ki_childstime = p->p_stats->p_cru.ru_stime;
   kp->ki_childutime = p->p_stats->p_cru.ru_utime;
  #else
 - kp->ki_childtime.tv_sec = p->p_stats->p_cru.ru_utime.tv_sec +
 -     p->p_stats->p_cru.ru_stime.tv_sec;
 - kp->ki_childtime.tv_usec = p->p_stats->p_cru.ru_utime.tv_usec +
 -     p->p_stats->p_cru.ru_stime.tv_usec;
 + timeradd(&p->p_stats->p_cru.ru_utime,
 + &p->p_stats->p_cru.ru_stime,
 + &kp->ki_childtime);
  #endif
   }
   if (p->p_state != PRS_ZOMBIE) {
 @@ -1093,8 +1092,14 @@
  #endif
   break;
  
 - default:
 + case KERN_PROC_ALL:
 + /* no filtering */
   break;
 +
 + default:
 + PROC_UNLOCK(p);
 + sx_sunlock(&allproc_lock);
 + return(EINVAL);
  
   }
   error = sysctl_out_proc(p, req, flags | doingzomb);
 
 Cyrille Lefevre
 -- 
 mailto:cyrille.lefevre at laposte.net
 


More information about the freebsd-bugs mailing list