summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorvangyzen <vangyzen@FreeBSD.org>2016-12-15 16:51:33 +0000
committervangyzen <vangyzen@FreeBSD.org>2016-12-15 16:51:33 +0000
commit653ae73f31334ec5c36eeeb24dea9d71684ace94 (patch)
tree63af6a029256dd04da26ef31f83235ccd5720428 /bin/ps
parent9446d722c784ce1e8da272e72e909e634f5ac02a (diff)
downloadFreeBSD-src-653ae73f31334ec5c36eeeb24dea9d71684ace94.zip
FreeBSD-src-653ae73f31334ec5c36eeeb24dea9d71684ace94.tar.gz
MFC r309676
Export the whole thread name in kinfo_proc kinfo_proc::ki_tdname is three characters shorter than thread::td_name. Add a ki_moretdname field for these three extra characters. Add the new field to kinfo_proc32, as well. Update all in-tree consumers to read the new field and assemble the full name, except for lldb's HostThreadFreeBSD.cpp, which I will handle separately. Bump __FreeBSD_version. Sponsored by: Dell EMC
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/print.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 1cbcf62..d8823ed 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -120,11 +120,12 @@ command(KINFO *k, VARENT *ve)
if (cflag) {
/* If it is the last field, then don't pad */
if (STAILQ_NEXT(ve, next_ve) == NULL) {
- asprintf(&str, "%s%s%s%s",
+ asprintf(&str, "%s%s%s%s%s",
k->ki_d.prefix ? k->ki_d.prefix : "",
k->ki_p->ki_comm,
(showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "",
- (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "");
+ (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "",
+ (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_moretdname : "");
} else
str = strdup(k->ki_p->ki_comm);
@@ -172,14 +173,16 @@ ucomm(KINFO *k, VARENT *ve)
char *str;
if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */
- asprintf(&str, "%s%s%s%s",
+ asprintf(&str, "%s%s%s%s%s",
k->ki_d.prefix ? k->ki_d.prefix : "",
k->ki_p->ki_comm,
(showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "",
- (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "");
+ (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : "",
+ (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_moretdname : "");
} else {
if (showthreads && k->ki_p->ki_numthreads > 1)
- asprintf(&str, "%s/%s", k->ki_p->ki_comm, k->ki_p->ki_tdname);
+ asprintf(&str, "%s/%s%s", k->ki_p->ki_comm,
+ k->ki_p->ki_tdname, k->ki_p->ki_moretdname);
else
str = strdup(k->ki_p->ki_comm);
}
@@ -192,7 +195,8 @@ tdnam(KINFO *k, VARENT *ve __unused)
char *str;
if (showthreads && k->ki_p->ki_numthreads > 1)
- str = strdup(k->ki_p->ki_tdname);
+ asprintf(&str, "%s%s", k->ki_p->ki_tdname,
+ k->ki_p->ki_moretdname);
else
str = strdup(" ");
OpenPOWER on IntegriCloud