misc: adapt others to changes in interface, <PIDS> api
I've got nothing to add to the commit message but that doesn't mean I won't produce perfectly justified text. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -142,7 +142,7 @@ makEXT(TTY)
|
||||
makEXT(TTY_NAME)
|
||||
makEXT(TTY_NUMBER)
|
||||
makEXT(VM_DATA)
|
||||
makEXT(VM_LOCK)
|
||||
makEXT(VM_RSS_LOCKED)
|
||||
makEXT(VM_RSS)
|
||||
makEXT(VM_SIZE)
|
||||
makEXT(VM_STACK)
|
||||
|
56
ps/display.c
56
ps/display.c
@ -273,7 +273,7 @@ static void value_this_proc_pcpu(proc_t *buf){
|
||||
|
||||
/***** just display */
|
||||
static void simple_spew(void){
|
||||
struct pids_reap *pidreap;
|
||||
struct pids_fetch *pidread;
|
||||
proc_t *buf;
|
||||
int i;
|
||||
|
||||
@ -282,48 +282,48 @@ static void simple_spew(void){
|
||||
unsigned *pidlist = xcalloc(selection_list->n, sizeof(unsigned));
|
||||
for (i = 0; i < selection_list->n; i++)
|
||||
pidlist[i] = selection_list->u[selection_list->n-i-1].pid;
|
||||
pidreap = procps_pids_select(Pids_info, pidlist, selection_list->n, PROCPS_SELECT_PID);
|
||||
pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PROCPS_SELECT_PID);
|
||||
free(pidlist);
|
||||
} else {
|
||||
enum pids_reap_type which;
|
||||
enum pids_fetch_type which;
|
||||
which = (thread_flags & (TF_loose_tasks|TF_show_task))
|
||||
? PROCPS_REAP_THREADS_TOO : PROCPS_REAP_TASKS_ONLY;
|
||||
pidreap = procps_pids_reap(Pids_info, which);
|
||||
? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY;
|
||||
pidread = procps_pids_reap(Pids_info, which);
|
||||
}
|
||||
if (!pidreap) {
|
||||
if (!pidread) {
|
||||
fprintf(stderr, _("fatal library error, reap\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
switch(thread_flags & (TF_show_proc|TF_loose_tasks|TF_show_task)){
|
||||
case TF_show_proc: // normal non-thread output
|
||||
for (i = 0; i < pidreap->counts.total; i++) {
|
||||
buf = pidreap->stacks[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);
|
||||
}
|
||||
break;
|
||||
case TF_show_task: // -L and -T options
|
||||
case TF_show_proc|TF_loose_tasks: // H option
|
||||
for (i = 0; i < pidreap->counts.total; i++) {
|
||||
buf = pidreap->stacks[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);
|
||||
}
|
||||
break;
|
||||
case TF_show_proc|TF_show_task: // m and -m options
|
||||
procps_pids_sort(Pids_info, pidreap->stacks
|
||||
, pidreap->counts.total, PROCPS_PIDS_TIME_START, PROCPS_SORT_ASCEND);
|
||||
procps_pids_sort(Pids_info, pidreap->stacks
|
||||
, pidreap->counts.total, PROCPS_PIDS_ID_TGID, PROCPS_SORT_ASCEND);
|
||||
for (i = 0; i < pidreap->counts.total; i++) {
|
||||
buf = pidreap->stacks[i];
|
||||
procps_pids_sort(Pids_info, pidread->stacks
|
||||
, pidread->counts.total, PROCPS_PIDS_TIME_START, PROCPS_SORT_ASCEND);
|
||||
procps_pids_sort(Pids_info, pidread->stacks
|
||||
, pidread->counts.total, PROCPS_PIDS_ID_TGID, PROCPS_SORT_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 < pidreap->counts.total; i++) {
|
||||
buf = pidreap->stacks[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);
|
||||
}
|
||||
@ -439,22 +439,22 @@ static int want_this_proc_nop(proc_t *dummy){
|
||||
|
||||
/***** sorted or forest */
|
||||
static void fancy_spew(void){
|
||||
struct pids_reap *pidreap;
|
||||
enum pids_reap_type which;
|
||||
struct pids_fetch *pidread;
|
||||
enum pids_fetch_type which;
|
||||
proc_t *buf;
|
||||
int i, n = 0;
|
||||
|
||||
which = (thread_flags & TF_loose_tasks)
|
||||
? PROCPS_REAP_THREADS_TOO : PROCPS_REAP_TASKS_ONLY;
|
||||
? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY;
|
||||
|
||||
pidreap = procps_pids_reap(Pids_info, which);
|
||||
if (!pidreap || !pidreap->counts.total) {
|
||||
pidread = procps_pids_reap(Pids_info, which);
|
||||
if (!pidread || !pidread->counts.total) {
|
||||
fprintf(stderr, _("fatal library error, reap\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
processes = xcalloc(pidreap->counts.total, sizeof(void*));
|
||||
for (i = 0; i < pidreap->counts.total; i++) {
|
||||
buf = pidreap->stacks[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))
|
||||
processes[n++] = buf;
|
||||
@ -553,7 +553,7 @@ static void finalize_stacks (void)
|
||||
chkREL(NICE)
|
||||
chkREL(NLWP)
|
||||
chkREL(RSS)
|
||||
chkREL(VM_LOCK)
|
||||
chkREL(VM_RSS_LOCKED)
|
||||
// needed with 's' switch, previously assured
|
||||
chkREL(SIGBLOCKED)
|
||||
chkREL(SIGCATCH)
|
||||
@ -579,7 +579,7 @@ static void finalize_stacks (void)
|
||||
s_node = s_node->next;
|
||||
}
|
||||
|
||||
procps_pids_reset(Pids_info, Pids_index, Pids_items);
|
||||
procps_pids_reset(Pids_info, Pids_items, Pids_index);
|
||||
}
|
||||
|
||||
/***** no comment */
|
||||
|
@ -131,7 +131,7 @@ makREL(TTY)
|
||||
makREL(TTY_NAME)
|
||||
makREL(TTY_NUMBER)
|
||||
makREL(VM_DATA)
|
||||
makREL(VM_LOCK)
|
||||
makREL(VM_RSS_LOCKED)
|
||||
makREL(VM_RSS)
|
||||
makREL(VM_SIZE)
|
||||
makREL(VM_STACK)
|
||||
@ -467,14 +467,14 @@ void reset_global(void){
|
||||
Pids_items[i] = PROCPS_PIDS_noop;
|
||||
|
||||
if (!Pids_info) {
|
||||
if (procps_pids_new(&Pids_info, i, Pids_items)) {
|
||||
if (procps_pids_new(&Pids_info, Pids_items, i)) {
|
||||
fprintf(stderr, _("fatal library error, context\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
Pids_items[0] = PROCPS_PIDS_TTY;
|
||||
procps_pids_reset(Pids_info, 1, Pids_items);
|
||||
procps_pids_reset(Pids_info, Pids_items, 1);
|
||||
if (!(p = fatal_proc_unmounted(Pids_info, 1))) {
|
||||
fprintf(stderr, _("fatal library error, lookup self\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -688,7 +688,7 @@ static int pr_stat(char *restrict const outbuf, const proc_t *restrict const pp)
|
||||
if (!outbuf) {
|
||||
chkREL(STATE)
|
||||
chkREL(NICE)
|
||||
chkREL(VM_LOCK)
|
||||
chkREL(VM_RSS_LOCKED)
|
||||
chkREL(ID_SESSION)
|
||||
chkREL(ID_TGID)
|
||||
chkREL(NLWP)
|
||||
@ -706,7 +706,7 @@ static int pr_stat(char *restrict const outbuf, const proc_t *restrict const pp)
|
||||
// exiting 'E' (not printed for zombies)
|
||||
// vforked 'V'
|
||||
// system 'K' (and do not print 'L' too)
|
||||
if(rSv(VM_LOCK, ul_int, pp)) outbuf[end++] = 'L';
|
||||
if(rSv(VM_RSS_LOCKED, sl_int, pp)) outbuf[end++] = 'L';
|
||||
if(rSv(ID_SESSION, s_int, pp) == rSv(ID_TGID, s_int, pp)) outbuf[end++] = 's'; // session leader
|
||||
if(rSv(NLWP, s_int, pp) > 1) outbuf[end++] = 'l'; // multi-threaded
|
||||
if(rSv(ID_PGRP, s_int, pp) == rSv(ID_TPGID, s_int, pp)) outbuf[end++] = '+'; // in foreground process group
|
||||
@ -1618,7 +1618,7 @@ static const format_struct format_array[] = { /*
|
||||
{"vm_data", "DATA", pr_nop, PROCPS_PIDS_VM_DATA, 5, LNx, PO|RIGHT},
|
||||
{"vm_exe", "EXE", pr_nop, PROCPS_PIDS_VM_EXE, 5, LNx, PO|RIGHT},
|
||||
{"vm_lib", "LIB", pr_nop, PROCPS_PIDS_VM_LIB, 5, LNx, PO|RIGHT},
|
||||
{"vm_lock", "LCK", pr_nop, PROCPS_PIDS_VM_LOCK, 3, LNx, PO|RIGHT},
|
||||
{"vm_lock", "LCK", pr_nop, PROCPS_PIDS_VM_RSS_LOCKED, 3, LNx, PO|RIGHT},
|
||||
{"vm_stack", "STACK", pr_nop, PROCPS_PIDS_VM_STACK, 5, LNx, PO|RIGHT},
|
||||
{"vsize", "VSZ", pr_vsz, PROCPS_PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/
|
||||
{"vsz", "VSZ", pr_vsz, PROCPS_PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/
|
||||
|
Reference in New Issue
Block a user