Constantly print the command name and if set include the thread

name in per-thread mode.

Discussed with:	jhb
Obtained from:	Ed Maste at Sandvine Incorporated
Sponsored by:	Sandvine Incorporated
MFC after:	1 week
Approved by:	re (kib)
This commit is contained in:
Bjoern A. Zeeb 2011-07-18 20:57:43 +00:00
parent 8bd9dc088e
commit c618a5222e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224202

View File

@ -834,7 +834,8 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
if (!(flags & FMT_SHOWARGS)) {
if (ps.thread && pp->ki_flag & P_HADTHREADS &&
pp->ki_tdname[0]) {
snprintf(cmdbuf, cmdlengthdelta, "{%s}", pp->ki_tdname);
snprintf(cmdbuf, cmdlengthdelta, "%s{%s}", pp->ki_comm,
pp->ki_tdname);
} else {
snprintf(cmdbuf, cmdlengthdelta, "%s", pp->ki_comm);
}
@ -846,7 +847,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
if (ps.thread && pp->ki_flag & P_HADTHREADS &&
pp->ki_tdname[0]) {
snprintf(cmdbuf, cmdlengthdelta,
"{%s}", pp->ki_tdname);
"[%s{%s}]", pp->ki_comm, pp->ki_tdname);
} else {
snprintf(cmdbuf, cmdlengthdelta,
"[%s]", pp->ki_comm);
@ -890,12 +891,23 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
dst--;
*dst = '\0';
if (strcmp(cmd, pp->ki_comm) != 0 )
snprintf(cmdbuf, cmdlengthdelta,
"%s (%s)",argbuf, pp->ki_comm);
else
strlcpy(cmdbuf, argbuf, cmdlengthdelta);
if (strcmp(cmd, pp->ki_comm) != 0 ) {
if (ps.thread && pp->ki_flag & P_HADTHREADS &&
pp->ki_tdname[0])
snprintf(cmdbuf, cmdlengthdelta,
"%s (%s){%s}", argbuf, pp->ki_comm,
pp->ki_tdname);
else
snprintf(cmdbuf, cmdlengthdelta,
"%s (%s)", argbuf, pp->ki_comm);
} else {
if (ps.thread && pp->ki_flag & P_HADTHREADS &&
pp->ki_tdname[0])
snprintf(cmdbuf, cmdlengthdelta,
"%s{%s}", argbuf, pp->ki_tdname);
else
strlcpy(cmdbuf, argbuf, cmdlengthdelta);
}
free(argbuf);
}
}