enhanced libproc cgroup/cmdline support, exploited by top
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>
This commit is contained in:
@@ -224,6 +224,7 @@ static unsigned task_format_needs;
|
||||
#define needs_for_format (proc_format_needs|task_format_needs)
|
||||
|
||||
#define PROC_ONLY_FLAGS (PROC_FILLENV|PROC_FILLARG|PROC_FILLCOM|PROC_FILLMEM|PROC_FILLCGROUP)
|
||||
|
||||
/***** munge lists and determine openproc() flags */
|
||||
static void lists_and_needs(void){
|
||||
check_headers();
|
||||
@@ -283,11 +284,12 @@ static void lists_and_needs(void){
|
||||
}
|
||||
if(!unix_f_option){
|
||||
proc_format_needs &= ~PROC_FILLCOM;
|
||||
proc_format_needs |= PROC_EDITCMDLCVT;
|
||||
needs_for_sort &= ~PROC_FILLCOM;
|
||||
}
|
||||
// convert ARG to COM as a standard
|
||||
if(proc_format_needs & PROC_FILLARG){
|
||||
proc_format_needs |= PROC_FILLCOM;
|
||||
proc_format_needs |= (PROC_FILLCOM | PROC_EDITCMDLCVT);
|
||||
proc_format_needs &= ~PROC_FILLARG;
|
||||
}
|
||||
if(bsd_e_option){
|
||||
|
Reference in New Issue
Block a user