diff options
author | Jim Warner <james.warner@comcast.net> | 2011-05-18 10:33:44 +0200 |
---|---|---|
committer | Jan Görig <jgorig@redhat.com> | 2011-05-18 10:33:44 +0200 |
commit | 7b0fc19e9d28380dc9790615b93bc3653d6d686e (patch) | |
tree | 844b4136dd63dedda7b1834d64cdd41f0b7a72a6 /top.h | |
parent | 8621387c774df2cac53090f59de6b109d1af9786 (diff) | |
download | procps-ng-newtop.tar.gz |
enhanced libproc cgroup/cmdline support, exploited by topnewtop
Library Changes
. added PROC_EDITCMDLCVT flag
. added an internal (static) fill_cmdline_cvt function:
- reads and "escapes" /proc/#/cmdline
- returns result as a single string in a single vector
- callers are guaranteed a cmdline (no more NULL)
. added vectorize_this_str function, exploited by
fill_cgroup_cvt, fill_cmdline_cvt
. generalized read_cmdline function as read_unvectored, now
exploited by fill_cgroup_cvt, fill_cmdline_cvt, read_cmdline
( cgroup and cmdline no longer need be converted to string )
( vectors before being transformed to final representation )
. fixed bug regarding skipped group numbers (when enabled)
. escape_str made responsible for all single byte translation
with distinction between control chars + other unprintable
. added escaped_copy function for already escaped strings
. reorganized parts of proc_t to restore formatting standards
( displacement changes shouldn't matter with new version # )
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
. added to library.map: escaped_copy; read_cmdline
Top Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. eliminated now obsolete #include "proc/escape.h"
. changed the P_WCH display format if no kernel symbol table
. fixed very old bug in lflgs for out-of-view sort fields
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
Ps Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. exploited the new escaped_copy function
. consolidated pr_args and pr_comm into pr_argcom
Signed-off-by: Jan Görig <jgorig@redhat.com>
Diffstat (limited to 'top.h')
-rw-r--r-- | top.h | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -28,6 +28,7 @@ //#define FIELD_CURSOR /* cursor follows selection w/ fields mgmt */ //#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */ //#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */ +//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions * //#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */ //#define PRETEND4CPUS /* pretend we're smp with 4 ticsers (sic) */ //#define PRETENDNOCAP /* use a terminal without essential caps */ @@ -38,7 +39,6 @@ //#define TERMIOS_ONLY /* just limp along with native input only */ //#define TTYGETENVYES /* environ vars can override tty col/row */ //#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */ -//#define ZAP_SUSEONLY /* enable the SuSE specific modifications */ /*###### Notes, etc. ###################################################*/ @@ -65,7 +65,7 @@ #define STRSORTCMP strcmp #endif -#ifdef ZAP_SUSEONLY +#ifdef OOMEM_ENABLE /* FIXME: perhaps making this a function in the suse version of sysinfo.c was a prelude to hotpluggable updates -- unfortunately, the return value is invariant as currently implemented! */ @@ -139,7 +139,7 @@ enum pflag { P_MEM, P_VRT, P_SWP, P_RES, P_COD, P_DAT, P_SHR, P_FL1, P_FL2, P_DRT, P_STA, P_CMD, P_WCH, P_FLG, P_CGR, -#ifdef ZAP_SUSEONLY +#ifdef OOMEM_ENABLE P_OOA, P_OOM, #endif #ifdef USE_X_COLHDR @@ -375,11 +375,12 @@ typedef struct WIN_t { #define SCB_STRS(f,s) \ static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \ return Frame_srtflg * STRSORTCMP((*Q)->s, (*P)->s); } -#define SCB_STRV(f,s) \ +#define SCB_STRV(f,b,v,s) \ static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \ - if (!(*P)->s || !(*Q)->s) \ - return SORT_eq; \ - return Frame_srtflg * STRSORTCMP((*Q)->s[0], (*P)->s[0]); } + if (b) { \ + if (!(*P)->v || !(*Q)->v) return SORT_eq; \ + return Frame_srtflg * STRSORTCMP((*Q)->v[0], (*P)->v[0]); } \ + return Frame_srtflg * STRSORTCMP((*Q)->s, (*P)->s); } /* * The following two macros are used to 'inline' those portions of the @@ -532,7 +533,7 @@ typedef struct WIN_t { " 'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end! " \ "" -#ifdef ZAP_SUSEONLY +#ifdef OOMEM_ENABLE /* w/ 2 extra lines, no room for additional text on 24x80 terminal */ #define FIELDS_notes NULL #else @@ -634,8 +635,8 @@ typedef struct WIN_t { #if defined(ATEOJ_RPTHSH) && defined(OFF_HST_HASH) # error 'ATEOJ_RPTHSH' conflicts with 'OFF_HST_HASH' #endif -#if defined(PRETEND4CPUS) && defined (ZAP_SUSEONLY) -# error 'PRETEND4CPUS' conflicts with 'ZAP_SUSEONLY' +#if defined(PRETEND4CPUS) && defined (OOMEM_ENABLE) +# error 'PRETEND4CPUS' conflicts with 'OOMEM_ENABLE' #endif |