diff options
author | vangyzen <vangyzen@FreeBSD.org> | 2016-12-15 16:51:33 +0000 |
---|---|---|
committer | vangyzen <vangyzen@FreeBSD.org> | 2016-12-15 16:51:33 +0000 |
commit | 653ae73f31334ec5c36eeeb24dea9d71684ace94 (patch) | |
tree | 63af6a029256dd04da26ef31f83235ccd5720428 /sys | |
parent | 9446d722c784ce1e8da272e72e909e634f5ac02a (diff) | |
download | FreeBSD-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 'sys')
-rw-r--r-- | sys/compat/freebsd32/freebsd32.h | 3 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 10 | ||||
-rw-r--r-- | sys/sys/param.h | 2 | ||||
-rw-r--r-- | sys/sys/user.h | 3 |
4 files changed, 14 insertions, 4 deletions
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 982b44e..39213ae 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -315,7 +315,8 @@ struct kinfo_proc32 { char ki_comm[COMMLEN+1]; char ki_emul[KI_EMULNAMELEN+1]; char ki_loginclass[LOGINCLASSLEN+1]; - char ki_sparestrings[50]; + char ki_moretdname[MAXCOMLEN-TDNAMLEN+1]; + char ki_sparestrings[46]; int ki_spareints[KI_NSPARE_INT]; int ki_oncpu; int ki_lastcpu; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 892b23a..1f7deb5 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1034,7 +1034,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, @@ -1279,6 +1286,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_tracer); CP(*ki, *ki32, ki_flag2); CP(*ki, *ki32, ki_fibnum); diff --git a/sys/sys/param.h b/sys/sys/param.h index 9308ac3..e139ca2 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/user.h b/sys/sys/user.h index 6049e80..5115b79 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -180,12 +180,13 @@ struct kinfo_proc { char ki_comm[COMMLEN+1]; /* command name */ char ki_emul[KI_EMULNAMELEN+1]; /* emulation name */ char ki_loginclass[LOGINCLASSLEN+1]; /* login class */ + char ki_moretdname[MAXCOMLEN-TDNAMLEN+1]; /* more thread name */ /* * When adding new variables, take space for char-strings from the * front of ki_sparestrings, and ints from the end of ki_spareints. * That way the spare room from both arrays will remain contiguous. */ - char ki_sparestrings[50]; /* spare string space */ + char ki_sparestrings[46]; /* spare string space */ int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ int ki_oncpu; /* Which cpu we are on */ int ki_lastcpu; /* Last cpu we were on */ |