diff options
author | vangyzen <vangyzen@FreeBSD.org> | 2016-12-15 16:52:17 +0000 |
---|---|---|
committer | vangyzen <vangyzen@FreeBSD.org> | 2016-12-15 16:52:17 +0000 |
commit | 399f89a3ce97d7f6e1132b3be50338558b1614f8 (patch) | |
tree | 81721e570f87d5d3b950a30f2b523fbd38b1b2a4 /sys/kern | |
parent | 73c340e2e01a313d166cab93907156dac5bb4463 (diff) | |
download | FreeBSD-src-399f89a3ce97d7f6e1132b3be50338558b1614f8.zip FreeBSD-src-399f89a3ce97d7f6e1132b3be50338558b1614f8.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 'sys/kern')
-rw-r--r-- | sys/kern/kern_proc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 0f60553..475895c 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -959,7 +959,14 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread) strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg)); else bzero(kp->ki_wmesg, sizeof(kp->ki_wmesg)); - strlcpy(kp->ki_tdname, td->td_name, sizeof(kp->ki_tdname)); + if (strlcpy(kp->ki_tdname, td->td_name, sizeof(kp->ki_tdname)) >= + sizeof(kp->ki_tdname)) { + strlcpy(kp->ki_moretdname, + td->td_name + sizeof(kp->ki_tdname) - 1, + sizeof(kp->ki_moretdname)); + } else { + bzero(kp->ki_moretdname, sizeof(kp->ki_moretdname)); + } if (TD_ON_LOCK(td)) { kp->ki_kiflag |= KI_LOCKBLOCK; strlcpy(kp->ki_lockname, td->td_lockname, @@ -1180,6 +1187,7 @@ freebsd32_kinfo_proc_out(const struct kinfo_proc *ki, struct kinfo_proc32 *ki32) bcopy(ki->ki_comm, ki32->ki_comm, COMMLEN + 1); bcopy(ki->ki_emul, ki32->ki_emul, KI_EMULNAMELEN + 1); bcopy(ki->ki_loginclass, ki32->ki_loginclass, LOGINCLASSLEN + 1); + bcopy(ki->ki_moretdname, ki32->ki_moretdname, MAXCOMLEN - TDNAMLEN + 1); CP(*ki, *ki32, ki_flag2); CP(*ki, *ki32, ki_fibnum); CP(*ki, *ki32, ki_cr_flags); |