diff options
-rw-r--r-- | sys/kern/kern_proc.c | 7 | ||||
-rw-r--r-- | sys/sys/user.h | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d2bcf0f..59d257b 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -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, diff --git a/sys/sys/user.h b/sys/sys/user.h index 5c84837..1acf346 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -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 */ |