diff --git a/proc/pids.c b/proc/pids.c index ff66cede..091c2c18 100644 --- a/proc/pids.c +++ b/proc/pids.c @@ -38,8 +38,9 @@ #include #include "procps-private.h" -#include "readproc.h" // and two headers for bridged -#include "wchan.h" // support (temporary include) +#include "devname.h" // and a few headers for our +#include "readproc.h" // bridged libprocps support +#include "wchan.h" // ( maybe just temporary? ) //#define UNREF_RPTHASH // report on hashing, at uref time //#define FPRINT_STACKS // enable validate_stacks output @@ -210,6 +211,7 @@ REG_set(TICS_USER, ull_int, utime) REG_set(TICS_USER_C, ull_int, cutime) REG_set(TIME_START, ull_int, start_time) REG_set(TTY, s_int, tty) +setDECL(TTY_NAME) { char buf[64]; (void)I; dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV); R->result.str = strdup(buf); } REG_set(VM_DATA, ul_int, vm_data) REG_set(VM_EXE, ul_int, vm_exe) REG_set(VM_LIB, ul_int, vm_lib) @@ -297,6 +299,13 @@ static int srtNAME(strv) ( return P->order * strcoll((*b->result.strv), (*a->result.strv)); } +static int srtNAME(strvers) ( + const struct pids_stack **A, const struct pids_stack **B, struct sort_parms *P) { + const struct pids_result *a = (*A)->head + P->offset; + const struct pids_result *b = (*B)->head + P->offset; + return P->order * strverscmp(b->result.str, a->result.str); +} + static int srtNAME(noop) ( const struct pids_stack **A, const struct pids_stack **B, enum pids_item *O) { (void)A; (void)B; (void)O; @@ -450,6 +459,7 @@ static struct { { RS(TICS_USER_C), f_stat, NULL, QS(ull_int), 0 }, { RS(TIME_START), f_stat, NULL, QS(ull_int), 0 }, { RS(TTY), f_stat, NULL, QS(s_int), 0 }, + { RS(TTY_NAME), f_stat, FF(str), QS(strvers), 0 }, { RS(VM_DATA), f_status, NULL, QS(ul_int), 0 }, { RS(VM_EXE), f_status, NULL, QS(ul_int), 0 }, { RS(VM_LIB), f_status, NULL, QS(ul_int), 0 }, diff --git a/proc/pids.h b/proc/pids.h index 68d9ddcd..6b5fa76d 100644 --- a/proc/pids.h +++ b/proc/pids.h @@ -122,6 +122,7 @@ enum pids_item { PROCPS_PIDS_TICS_USER_C, // ull_int PROCPS_PIDS_TIME_START, // ull_int PROCPS_PIDS_TTY, // s_int + PROCPS_PIDS_TTY_NAME, // str PROCPS_PIDS_VM_DATA, // ul_int PROCPS_PIDS_VM_EXE, // ul_int PROCPS_PIDS_VM_LIB, // ul_int