related: fix inconsistencies in result type references
This patch is a response to errors found in those type references now that our library allows for validation. In two cases, former assignments to a result structure could no longer employ that VAL macro if validation is active. Thus, direct reference to some stack was used. For the record, those instances were to be found here: . ps - uses PIDS_extra to store the cooked pcpu values . top - uses PIDS_extra to store the forest view level Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
e3270d463d
commit
105058ae2d
@ -267,7 +267,8 @@ static void value_this_proc_pcpu(proc_t *buf){
|
|||||||
seconds = rSv(TIME_ELAPSED, ull_int, buf);
|
seconds = rSv(TIME_ELAPSED, ull_int, buf);
|
||||||
if(seconds) pcpu = (used_jiffies * 1000ULL / Hertz) / seconds;
|
if(seconds) pcpu = (used_jiffies * 1000ULL / Hertz) / seconds;
|
||||||
|
|
||||||
rSv(extra, ul_int, buf) = pcpu;
|
// if xtra-procps-debug.h active, can't use PIDS_VAL as base due to assignment
|
||||||
|
buf->head[rel_extra].result.ul_int = pcpu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +546,6 @@ static void finalize_stacks (void)
|
|||||||
chkREL(ID_SUID)
|
chkREL(ID_SUID)
|
||||||
chkREL(ID_TGID)
|
chkREL(ID_TGID)
|
||||||
chkREL(STATE)
|
chkREL(STATE)
|
||||||
chkREL(TIME_START)
|
|
||||||
chkREL(TTY)
|
chkREL(TTY)
|
||||||
// needed to creata an enhanced 'stat/state'
|
// needed to creata an enhanced 'stat/state'
|
||||||
chkREL(ID_PGRP)
|
chkREL(ID_PGRP)
|
||||||
@ -561,8 +561,11 @@ static void finalize_stacks (void)
|
|||||||
chkREL(SIGNALS)
|
chkREL(SIGNALS)
|
||||||
chkREL(SIGPENDING)
|
chkREL(SIGPENDING)
|
||||||
// needed with loss of defunct 'cook_time' macros
|
// needed with loss of defunct 'cook_time' macros
|
||||||
|
chkREL(TICS_ALL)
|
||||||
|
chkREL(TICS_ALL_C)
|
||||||
chkREL(TIME_ALL)
|
chkREL(TIME_ALL)
|
||||||
chkREL(TIME_ELAPSED)
|
chkREL(TIME_ELAPSED)
|
||||||
|
chkREL(TIME_START)
|
||||||
// special items with 'extra' used as former pcpu
|
// special items with 'extra' used as former pcpu
|
||||||
chkREL(extra)
|
chkREL(extra)
|
||||||
chkREL(noop)
|
chkREL(noop)
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
#include "top.h"
|
#include "top.h"
|
||||||
#include "top_nls.h"
|
#include "top_nls.h"
|
||||||
|
|
||||||
|
|
||||||
/*###### Miscellaneous global stuff ####################################*/
|
/*###### Miscellaneous global stuff ####################################*/
|
||||||
|
|
||||||
/* The original and new terminal definitions
|
/* The original and new terminal definitions
|
||||||
@ -4447,10 +4446,11 @@ static int Tree_idx; // frame_make resets to zero
|
|||||||
* This little recursive guy is the real forest view workhorse.
|
* This little recursive guy is the real forest view workhorse.
|
||||||
* He fills in the Tree_ppt array and also sets the child indent
|
* He fills in the Tree_ppt array and also sets the child indent
|
||||||
* level which is stored in an 'extra' result struct as a u_int. */
|
* level which is stored in an 'extra' result struct as a u_int. */
|
||||||
static void forest_adds (const int self, int level) {
|
static void forest_adds (const int self, unsigned level) {
|
||||||
// tailored 'results stack value' extractor macros
|
// tailored 'results stack value' extractor macros
|
||||||
#define rSv(E,X) PID_VAL(E, s_int, Seed_ppt[X])
|
#define rSv(E,X) PID_VAL(E, s_int, Seed_ppt[X])
|
||||||
#define rLevel PID_VAL(eu_XTRA, u_int, Tree_ppt[Tree_idx])
|
// if xtra-procps-debug.h active, can't use PID_VAL as base due to assignment
|
||||||
|
#define rLevel Tree_ppt[Tree_idx]->head[Fieldstab[eu_XTRA].erel].result.u_int
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (Tree_idx < PIDSmaxt) { // immunize against insanity
|
if (Tree_idx < PIDSmaxt) { // immunize against insanity
|
||||||
@ -4965,7 +4965,7 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
|
|||||||
break;
|
break;
|
||||||
/* ul_int, scale_pcnt */
|
/* ul_int, scale_pcnt */
|
||||||
case EU_MEM:
|
case EU_MEM:
|
||||||
cp = scale_pcnt((float)rSv(EU_RES, ul_int) * 100 / MEM_VAL(mem_TOT), W, Jn);
|
cp = scale_pcnt((float)rSv(EU_MEM, ul_int) * 100 / MEM_VAL(mem_TOT), W, Jn);
|
||||||
break;
|
break;
|
||||||
/* ul_int, make_str with special handling */
|
/* ul_int, make_str with special handling */
|
||||||
case EU_FLG:
|
case EU_FLG:
|
||||||
|
8
vmstat.c
8
vmstat.c
@ -632,8 +632,8 @@ static void diskformat(void)
|
|||||||
time_t the_time;
|
time_t the_time;
|
||||||
struct tm *tm_ptr;
|
struct tm *tm_ptr;
|
||||||
char timebuf[32];
|
char timebuf[32];
|
||||||
const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6lu %6lu";
|
const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6d %6lu";
|
||||||
const char wide_format[] = "%-5s %9lu %9lu %11lu %11lu %9lu %9lu %11lu %11lu %7lu %7lu";
|
const char wide_format[] = "%-5s %9lu %9lu %11lu %11lu %9lu %9lu %11lu %11lu %7d %7lu";
|
||||||
|
|
||||||
if (procps_diskstats_new(&disk_stat) < 0)
|
if (procps_diskstats_new(&disk_stat) < 0)
|
||||||
xerrx(EXIT_FAILURE, _("Unable to create diskstat structure"));
|
xerrx(EXIT_FAILURE, _("Unable to create diskstat structure"));
|
||||||
@ -664,7 +664,7 @@ static void diskformat(void)
|
|||||||
diskVAL(disk_WRITE_MERGE, ul_int),
|
diskVAL(disk_WRITE_MERGE, ul_int),
|
||||||
diskVAL(disk_WRITE_SECT, ul_int),
|
diskVAL(disk_WRITE_SECT, ul_int),
|
||||||
diskVAL(disk_WRITE_TIME, ul_int),
|
diskVAL(disk_WRITE_TIME, ul_int),
|
||||||
diskVAL(disk_IO, ul_int) / 1000,
|
diskVAL(disk_IO, s_int) / 1000,
|
||||||
diskVAL(disk_IO_TIME, ul_int) / 1000);
|
diskVAL(disk_IO_TIME, ul_int) / 1000);
|
||||||
if (t_option)
|
if (t_option)
|
||||||
printf(" %s\n", timebuf);
|
printf(" %s\n", timebuf);
|
||||||
@ -775,7 +775,7 @@ static void disksum_format(void)
|
|||||||
merged_writes += diskVAL(disk_WRITE_MERGE, ul_int);
|
merged_writes += diskVAL(disk_WRITE_MERGE, ul_int);
|
||||||
written_sectors += diskVAL(disk_WRITE_SECT, ul_int);
|
written_sectors += diskVAL(disk_WRITE_SECT, ul_int);
|
||||||
milli_writing += diskVAL(disk_WRITE_TIME, ul_int);
|
milli_writing += diskVAL(disk_WRITE_TIME, ul_int);
|
||||||
inprogress_IO += diskVAL(disk_IO, ul_int) / 1000;
|
inprogress_IO += diskVAL(disk_IO, s_int) / 1000;
|
||||||
milli_spent_IO += diskVAL(disk_IO_TIME, ul_int) / 1000;
|
milli_spent_IO += diskVAL(disk_IO_TIME, ul_int) / 1000;
|
||||||
weighted_milli_spent_IO += diskVAL(disk_IO_WTIME, ul_int) / 1000;
|
weighted_milli_spent_IO += diskVAL(disk_IO_WTIME, ul_int) / 1000;
|
||||||
}
|
}
|
||||||
|
6
w.c
6
w.c
@ -344,6 +344,7 @@ static int find_best_proc(
|
|||||||
char *cmdline)
|
char *cmdline)
|
||||||
{
|
{
|
||||||
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i], info)
|
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i], info)
|
||||||
|
#define PIDS_GETUNT(e) PIDS_VAL(EU_ ## e, u_int, reap->stacks[i], info)
|
||||||
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, reap->stacks[i], info)
|
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, reap->stacks[i], info)
|
||||||
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i], info)
|
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i], info)
|
||||||
unsigned uid = ~0U;
|
unsigned uid = ~0U;
|
||||||
@ -413,8 +414,8 @@ static int find_best_proc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(!ignoreuser && uid != PIDS_GETINT(EUID)
|
(!ignoreuser && uid != PIDS_GETUNT(EUID)
|
||||||
&& uid != PIDS_GETINT(RUID))
|
&& uid != PIDS_GETUNT(RUID))
|
||||||
|| (PIDS_GETINT(PGRP) != PIDS_GETINT(TPGID))
|
|| (PIDS_GETINT(PGRP) != PIDS_GETINT(TPGID))
|
||||||
|| (PIDS_GETULL(START) <= best_time)
|
|| (PIDS_GETULL(START) <= best_time)
|
||||||
)
|
)
|
||||||
@ -426,6 +427,7 @@ static int find_best_proc(
|
|||||||
procps_pids_unref(&info);
|
procps_pids_unref(&info);
|
||||||
return found_utpid;
|
return found_utpid;
|
||||||
#undef PIDS_GETINT
|
#undef PIDS_GETINT
|
||||||
|
#undef PIDS_GETUNT
|
||||||
#undef PIDS_GETULL
|
#undef PIDS_GETULL
|
||||||
#undef PIDS_GETSTR
|
#undef PIDS_GETSTR
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user