aboutsummaryrefslogtreecommitdiff
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorEric van Gyzen <vangyzen@FreeBSD.org>2016-12-07 15:04:22 +0000
committerEric van Gyzen <vangyzen@FreeBSD.org>2016-12-07 15:04:22 +0000
commit3d32d4a7c97401beb9eb1aaafbcb0389e50d9109 (patch)
tree43441ee7e43e93c264c40098bc6a268fa2fab93b /bin/ps/print.c
parent75747c209ced3c7e244c7249e8ecb667f6900ffb (diff)
downloadsrc-3d32d4a7c97401beb9eb1aaafbcb0389e50d9109.tar.gz
src-3d32d4a7c97401beb9eb1aaafbcb0389e50d9109.zip
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. Reviewed by: kib MFC after: 1 week Relnotes: yes Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D8722
Notes
Notes: svn path=/head/; revision=309676
Diffstat (limited to 'bin/ps/print.c')
-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 1cbcf628d382..d8823ed35720 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(" ");