Return the thread name in the kinfo_proc structure.

Also correct the comment describing what the value is.
This commit is contained in:
Julian Elischer 2006-01-18 20:27:43 +00:00
parent e1189b25d4
commit 11f4763dd4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154535
2 changed files with 9 additions and 2 deletions

View File

@ -737,6 +737,11 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp)
kp->ki_tdev = NODEV;
if (p->p_comm[0] != '\0') {
strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm));
/*
* Temporarily give the thread a default name of the process
* as it's erroneously used in the snmp code.
* Remove this when that is fixed. (soon I'm told)
*/
strlcpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm));
}
if (p->p_sysent && p->p_sysent->sv_name != NULL &&
@ -766,6 +771,8 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp)
strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
else
bzero(kp->ki_wmesg, sizeof(kp->ki_wmesg));
if (td->td_name[0] != '\0')
strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm));
if (TD_ON_LOCK(td)) {
kp->ki_kiflag |= KI_LOCKBLOCK;
strlcpy(kp->ki_lockname, td->td_lockname,

View File

@ -109,7 +109,7 @@
#define WMESGLEN 8 /* size of returned wchan message */
#define LOCKNAMELEN 8 /* size of returned lock name */
#define OCOMMLEN 16 /* size of returned ki_ocomm name */
#define OCOMMLEN 16 /* size of returned thread name */
#define COMMLEN 19 /* size of returned ki_comm name */
#define KI_EMULNAMELEN 16 /* size of returned ki_emul */
#define KI_NGROUPS 16 /* number of groups in ki_groups */
@ -172,7 +172,7 @@ struct kinfo_proc {
char ki_rqindex; /* Run queue index */
u_char ki_oncpu; /* Which cpu we are on */
u_char ki_lastcpu; /* Last cpu we were on */
char ki_ocomm[OCOMMLEN+1]; /* command name */
char ki_ocomm[OCOMMLEN+1]; /* thread name */
char ki_wmesg[WMESGLEN+1]; /* wchan message */
char ki_login[LOGNAMELEN+1]; /* setlogin name */
char ki_lockname[LOCKNAMELEN+1]; /* lock name */