misc: adapt others to struct layout change, <PIDS> api
With the change to struct pids_fetch, we'll just trade some dot ('.') code for some pointer to ('->') syntax. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
380253ff7f
commit
a2c79b6237
2
pmap.c
2
pmap.c
@ -1164,7 +1164,7 @@ int main(int argc, char **argv)
|
||||
if (!(pids_fetch = procps_pids_select(info, pidlist, user_count, PROCPS_SELECT_PID)))
|
||||
xerrx(EXIT_FAILURE, _("library failed pids statistics"));
|
||||
|
||||
for (reap_count = 0; reap_count < pids_fetch->counts.total; reap_count++) {
|
||||
for (reap_count = 0; reap_count < pids_fetch->counts->total; reap_count++) {
|
||||
ret |= one_proc(pids_fetch->stacks[reap_count]);
|
||||
}
|
||||
|
||||
|
18
ps/display.c
18
ps/display.c
@ -297,7 +297,7 @@ static void simple_spew(void){
|
||||
|
||||
switch(thread_flags & (TF_show_proc|TF_loose_tasks|TF_show_task)){
|
||||
case TF_show_proc: // normal non-thread output
|
||||
for (i = 0; i < pidread->counts.total; i++) {
|
||||
for (i = 0; i < pidread->counts->total; i++) {
|
||||
buf = pidread->stacks[i];
|
||||
if (want_this_proc(buf))
|
||||
show_one_proc(buf, proc_format_list);
|
||||
@ -305,7 +305,7 @@ static void simple_spew(void){
|
||||
break;
|
||||
case TF_show_task: // -L and -T options
|
||||
case TF_show_proc|TF_loose_tasks: // H option
|
||||
for (i = 0; i < pidread->counts.total; i++) {
|
||||
for (i = 0; i < pidread->counts->total; i++) {
|
||||
buf = pidread->stacks[i];
|
||||
if (want_this_proc(buf))
|
||||
show_one_proc(buf, task_format_list);
|
||||
@ -313,16 +313,16 @@ static void simple_spew(void){
|
||||
break;
|
||||
case TF_show_proc|TF_show_task: // m and -m options
|
||||
procps_pids_sort(Pids_info, pidread->stacks
|
||||
, pidread->counts.total, PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND);
|
||||
, pidread->counts->total, PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND);
|
||||
procps_pids_sort(Pids_info, pidread->stacks
|
||||
, pidread->counts.total, PROCPS_PIDS_ID_TGID, PROCPS_PIDS_ASCEND);
|
||||
for (i = 0; i < pidread->counts.total; i++) {
|
||||
, pidread->counts->total, PROCPS_PIDS_ID_TGID, PROCPS_PIDS_ASCEND);
|
||||
for (i = 0; i < pidread->counts->total; i++) {
|
||||
buf = pidread->stacks[i];
|
||||
next_proc:
|
||||
if (want_this_proc(buf)) {
|
||||
int self = rSv(ID_PID, s_int, buf);
|
||||
show_one_proc(buf, proc_format_list);
|
||||
for (; i < pidread->counts.total; i++) {
|
||||
for (; i < pidread->counts->total; i++) {
|
||||
buf = pidread->stacks[i];
|
||||
if (rSv(ID_TGID, s_int, buf) != self) goto next_proc;
|
||||
show_one_proc(buf, task_format_list);
|
||||
@ -448,12 +448,12 @@ static void fancy_spew(void){
|
||||
? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY;
|
||||
|
||||
pidread = procps_pids_reap(Pids_info, which);
|
||||
if (!pidread || !pidread->counts.total) {
|
||||
if (!pidread || !pidread->counts->total) {
|
||||
fprintf(stderr, _("fatal library error, reap\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
processes = xcalloc(pidread->counts.total, sizeof(void*));
|
||||
for (i = 0; i < pidread->counts.total; i++) {
|
||||
processes = xcalloc(pidread->counts->total, sizeof(void*));
|
||||
for (i = 0; i < pidread->counts->total; i++) {
|
||||
buf = pidread->stacks[i];
|
||||
value_this_proc_pcpu(buf);
|
||||
if (want_this_proc(buf))
|
||||
|
@ -214,7 +214,7 @@ static struct procps_pidsinfo *Pids_ctx;
|
||||
static int Pids_itms_cur; // 'current' max (<= Fieldstab)
|
||||
static enum pids_item *Pids_itms; // allocated as MAXTBL(Fieldstab)
|
||||
static struct pids_fetch *Pids_reap; // for reap or select
|
||||
#define PIDSmaxt Pids_reap->counts.total // just a little less wordy
|
||||
#define PIDSmaxt Pids_reap->counts->total // just a little less wordy
|
||||
// pid stack results extractor macro, where e=our EU enum, t=type, s=stack
|
||||
// ( we'll exploit that <proc/pids.h> provided macro as much as possible )
|
||||
// ( but many functions use their own unique tailored version for access )
|
||||
@ -2190,7 +2190,7 @@ static void cpus_refresh (void) {
|
||||
static void procs_refresh (void) {
|
||||
#define nALIGN(n,m) (((n + m - 1) / m) * m) // unconditionally align
|
||||
#define nALGN2(n,m) ((n + m - 1) & ~(m - 1)) // with power of 2 align
|
||||
#define n_reap Pids_reap->counts.total
|
||||
#define n_reap Pids_reap->counts->total
|
||||
static double uptime_sav;
|
||||
static int n_alloc = -1; // size of windows stacks arrays
|
||||
double uptime_cur;
|
||||
@ -4681,8 +4681,8 @@ static void summary_show (void) {
|
||||
if (isROOM(View_STATES, 2)) {
|
||||
show_special(0, fmtmk(N_unq(STATE_line_1_fmt)
|
||||
, Thread_mode ? N_txt(WORD_threads_txt) : N_txt(WORD_process_txt)
|
||||
, PIDSmaxt, Pids_reap->counts.running, Pids_reap->counts.sleeping
|
||||
, Pids_reap->counts.stopped, Pids_reap->counts.zombied));
|
||||
, PIDSmaxt, Pids_reap->counts->running, Pids_reap->counts->sleeping
|
||||
, Pids_reap->counts->stopped, Pids_reap->counts->zombied));
|
||||
Msg_row += 1;
|
||||
|
||||
cpus_refresh();
|
||||
|
2
w.c
2
w.c
@ -389,7 +389,7 @@ static int find_best_proc(
|
||||
if ((reap = procps_pids_reap(info, PROCPS_FETCH_TASKS_ONLY)) == NULL)
|
||||
xerrx(EXIT_FAILURE,
|
||||
_("Unable to load process information"));
|
||||
total_procs = reap->counts.total;
|
||||
total_procs = reap->counts->total;
|
||||
|
||||
for (i=0; i < total_procs; i++) {
|
||||
/* is this the login process? */
|
||||
|
Loading…
Reference in New Issue
Block a user