Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2012 06:02:21 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231337 - stable/8/usr.bin/top
Message-ID:  <201202100602.q1A62L8X056376@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Fri Feb 10 06:02:21 2012
New Revision: 231337
URL: http://svn.freebsd.org/changeset/base/231337

Log:
  MFC r224202:
  
   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

Modified:
  stable/8/usr.bin/top/machine.c
Directory Properties:
  stable/8/usr.bin/top/   (props changed)

Modified: stable/8/usr.bin/top/machine.c
==============================================================================
--- stable/8/usr.bin/top/machine.c	Fri Feb 10 05:05:42 2012	(r231336)
+++ stable/8/usr.bin/top/machine.c	Fri Feb 10 06:02:21 2012	(r231337)
@@ -831,7 +831,8 @@ format_next_process(caddr_t handle, char
 	if (!(flags & FMT_SHOWARGS)) {
 		if (ps.thread && pp->ki_flag & P_HADTHREADS &&
 		    pp->ki_ocomm[0]) {
-			snprintf(cmdbuf, cmdlengthdelta, "{%s}", pp->ki_ocomm);
+			snprintf(cmdbuf, cmdlengthdelta, "%s{%s}", pp->ki_comm,
+			    pp->ki_ocomm);
 		} else {
 			snprintf(cmdbuf, cmdlengthdelta, "%s", pp->ki_comm);
 		}
@@ -843,7 +844,7 @@ format_next_process(caddr_t handle, char
 			if (ps.thread && pp->ki_flag & P_HADTHREADS &&
 		    	    pp->ki_ocomm[0]) {
 				snprintf(cmdbuf, cmdlengthdelta,
-				    "{%s}", pp->ki_ocomm);
+				    "[%s{%s}]", pp->ki_comm, pp->ki_ocomm);
 			} else {
 				snprintf(cmdbuf, cmdlengthdelta,
 				    "[%s]", pp->ki_comm);
@@ -887,12 +888,23 @@ format_next_process(caddr_t handle, char
 				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_ocomm[0])
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s (%s){%s}", argbuf, pp->ki_comm,
+					    pp->ki_ocomm);
+				else
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s (%s)", argbuf, pp->ki_comm);
+			} else {
+				if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+				    pp->ki_ocomm[0])
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s{%s}", argbuf, pp->ki_ocomm);
+				else
+					strlcpy(cmdbuf, argbuf, cmdlengthdelta);
+			}
 			free(argbuf);
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202100602.q1A62L8X056376>