CVS commit: src/external/bsd/top/dist/machine

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 13:02:47 UTC 2021

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
go back to right-aligning the titles for CPU and WCPU.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.24 src/external/bsd/top/dist/machine/m_netbsd.c:1.25
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.24	Sat Apr  3 15:25:38 2021
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Fri Apr 16 09:02:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $
+ * $Id: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $");
 #endif
 
 #include 
@@ -103,14 +103,14 @@ struct handle {
  */
 
 static char Proc_header[] =
-  "  PID XPRI NICE   SIZE   RES STATE   TIME  WCPU   CPU   COMMAND";
+  "  PID XPRI NICE   SIZE   RES STATE   TIME   WCPUCPU COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
 	"%5d %-8.8s %3d %4d%7s %5s %-9.9s%7s %5.*f%% %5.*f%% %s"
 
 static char Thread_header[] =
-  "  PID   LID XPRI STATE   TIME  WCPU   CPU   NAME  COMMAND";
+  "  PID   LID XPRI STATE   TIME   WCPUCPU NAME  COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \



CVS commit: src/external/bsd/top/dist/machine

2021-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  3 19:25:38 UTC 2021

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
- Bump field width for state to accommodate > 9 CPUs
- When star formatting to adjust the width, count the trailing number of
  digits starting backwards instead of using strcspn because the lwp name
  might contain other digits like wm0TxRx/10.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.23 src/external/bsd/top/dist/machine/m_netbsd.c:1.24
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.23	Sat Apr 27 10:10:01 2019
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Sat Apr  3 15:25:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $
+ * $Id: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $");
 #endif
 
 #include 
@@ -57,6 +57,7 @@ __RCSID("$NetBSD: m_netbsd.c,v 1.23 2019
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,18 +103,18 @@ struct handle {
  */
 
 static char Proc_header[] =
-  "  PID XPRI NICE   SIZE   RES STATE  TIME   WCPUCPU COMMAND";
+  "  PID XPRI NICE   SIZE   RES STATE   TIME  WCPU   CPU   COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-	"%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %s"
+	"%5d %-8.8s %3d %4d%7s %5s %-9.9s%7s %5.*f%% %5.*f%% %s"
 
 static char Thread_header[] =
-  "  PID   LID XPRI STATE  TIME   WCPUCPU NAME  COMMAND";
+  "  PID   LID XPRI STATE   TIME  WCPU   CPU   NAME  COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \
-"%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-9.9s %s"
+"%5d %5d %-8.8s %3d %-9.9s%7s %5.2f%% %5.2f%% %-9.9s %s"
 
 /* 
  * Process state names for the "STATE" column of the display.
@@ -879,19 +880,25 @@ format_next_proc(caddr_t handle, char *(
 }
 
 static char *
-countable(char *p, size_t l)
+countable(char *p, size_t width)
 {
-	static const char digits[] = "0123456789";
-	size_t first = strcspn(p, digits);		// non digits
-	size_t last = strspn(p + first, digits);	// trailing digits
-	size_t len = first + last;			
-	if (p[len] || last == 0)	// should be total and must have digits
+	size_t len = strlen(p);
+	if (len < width) {		// shorter than width, ok
 		return p;
-	if (len < l)			// if shorter, done
+	}
+	size_t first, last = len - 1;
+	for (first = len - 1; isdigit((unsigned char)p[first]); first--) {
+		continue;
+	}
+	if (first == len - 1) {		// no digits, ok
 		return p;
-	if (l < last + 1)		// if not enough for digits, done
+	}
+	first++;
+	last = len - first;
+	if (width < last + 1) {		// if not enough for digits, done
 		return p;
-	size_t start = l - last - 1;	// compute starting point
+	}
+	size_t start = width - last - 1;	// compute starting point
 	p[start] = '*';			// put a star
 	memmove(p + start + 1, p + first, last + 1);	// move digits and NUL
 	return p;



CVS commit: src/external/bsd/top/dist/machine

2019-04-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 27 14:10:01 UTC 2019

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
simplify and explain


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.22 src/external/bsd/top/dist/machine/m_netbsd.c:1.23
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.22	Fri Apr 26 15:39:19 2019
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Sat Apr 27 10:10:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $
+ * $Id: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.23 2019/04/27 14:10:01 christos Exp $");
 #endif
 
 #include 
@@ -882,19 +882,18 @@ static char *
 countable(char *p, size_t l)
 {
 	static const char digits[] = "0123456789";
-	size_t first = strcspn(p, digits);
-	size_t last = strspn(p + first, digits);
-	size_t len = first + last;
-	if (p[len] || last == 0)
+	size_t first = strcspn(p, digits);		// non digits
+	size_t last = strspn(p + first, digits);	// trailing digits
+	size_t len = first + last;			
+	if (p[len] || last == 0)	// should be total and must have digits
 		return p;
-	if (len < l)
+	if (len < l)			// if shorter, done
 		return p;
-	if (l < last + 1)
+	if (l < last + 1)		// if not enough for digits, done
 		return p;
-	size_t start = l - last - 1;
-	p[start] = '*';
-	memmove(p + start + 1, p + first, len - first);
-	p[l] = '\0';
+	size_t start = l - last - 1;	// compute starting point
+	p[start] = '*';			// put a star
+	memmove(p + start + 1, p + first, last + 1);	// move digits and NUL
 	return p;
 }
 



CVS commit: src/external/bsd/top/dist/machine

2019-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 26 19:39:19 UTC 2019

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
for "countable" lwp names, try to display name* instead of truncating.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.21 src/external/bsd/top/dist/machine/m_netbsd.c:1.22
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.21	Tue Oct 30 17:15:09 2018
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Fri Apr 26 15:39:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.21 2018/10/30 21:15:09 kre Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.21 2018/10/30 21:15:09 kre Exp $
+ * $Id: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.21 2018/10/30 21:15:09 kre Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.22 2019/04/26 19:39:19 christos Exp $");
 #endif
 
 #include 
@@ -879,6 +879,26 @@ format_next_proc(caddr_t handle, char *(
 }
 
 static char *
+countable(char *p, size_t l)
+{
+	static const char digits[] = "0123456789";
+	size_t first = strcspn(p, digits);
+	size_t last = strspn(p + first, digits);
+	size_t len = first + last;
+	if (p[len] || last == 0)
+		return p;
+	if (len < l)
+		return p;
+	if (l < last + 1)
+		return p;
+	size_t start = l - last - 1;
+	p[start] = '*';
+	memmove(p + start + 1, p + first, len - first);
+	p[l] = '\0';
+	return p;
+}
+
+static char *
 format_next_lwp(caddr_t handle, char *(*get_userid)(int))
 {
 	struct kinfo_proc2 *pp;
@@ -946,7 +966,7 @@ format_next_lwp(caddr_t handle, char *(*
 	format_time(cputime),
 	100.0 * weighted_cpu(l_, pct, pl),
 	100.0 * pct,
-	printable(pl->l_name),
+	countable(printable(pl->l_name), 9),
 	get_command(hp->sel, pp));
 
 	/* return the result */



CVS commit: src/external/bsd/top/dist

2018-11-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Nov  5 17:44:09 UTC 2018

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
Fix typo s/fron/from/

>From dfive on freenode, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.11 src/external/bsd/top/dist/top.1.in:1.12
--- src/external/bsd/top/dist/top.1.in:1.11	Sun Aug 26 21:31:34 2018
+++ src/external/bsd/top/dist/top.1.in	Mon Nov  5 17:44:09 2018
@@ -4,7 +4,7 @@
 .nr D @DEFAULT_DELAY@
 .nr L @HAVE_GETOPT_LONG@
 .nr K @ENABLE_KILL@
-.TH TOP 1 "August 26, 2018"
+.TH TOP 1 "November 5, 2018"
 .UC 4
 .SH NAME
 top \- display and update information about the top cpu processes
@@ -294,7 +294,7 @@ Change the number of processes to displa
 .TP
 .B o
 Change the order in which the display is sorted.  This command is not
-available on all systems.  The sort key names vary fron system to system
+available on all systems.  The sort key names vary from system to system
 but usually include:  \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq,
 \*(lqtime\*(rq.  The default is cpu.
 .TP



CVS commit: src/external/bsd/top/dist

2018-08-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Aug 26 21:31:34 UTC 2018

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
Document the WCPU field.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.10 src/external/bsd/top/dist/top.1.in:1.11
--- src/external/bsd/top/dist/top.1.in:1.10	Thu Jan 12 18:37:09 2017
+++ src/external/bsd/top/dist/top.1.in	Sun Aug 26 21:31:34 2018
@@ -4,7 +4,7 @@
 .nr D @DEFAULT_DELAY@
 .nr L @HAVE_GETOPT_LONG@
 .nr K @ENABLE_KILL@
-.TH TOP 1 "December 28, 2016"
+.TH TOP 1 "August 26, 2018"
 .UC 4
 .SH NAME
 top \- display and update information about the top cpu processes
@@ -399,6 +399,9 @@ Current state (typically one of \*(lqsle
 .B TIME
 Number of system and user cpu seconds that the process has used.
 .TP
+.B WCPU
+Weighted percentage of available cpu time used by this process.
+.TP
 .B CPU
 Percentage of available cpu time used by this process.
 .TP



CVS commit: src/external/bsd/top/dist

2018-06-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jun  6 02:12:47 UTC 2018

Modified Files:
src/external/bsd/top/dist: commands.c

Log Message:
rats in my attic, mice in my top.  i've had enough of these damn rodents.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/top/dist/commands.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/commands.c
diff -u src/external/bsd/top/dist/commands.c:1.7 src/external/bsd/top/dist/commands.c:1.8
--- src/external/bsd/top/dist/commands.c:1.7	Fri Mar 23 14:46:05 2012
+++ src/external/bsd/top/dist/commands.c	Wed Jun  6 02:12:47 2018
@@ -508,7 +508,7 @@ renice_procs(char *str)
 /* move to the first process number */
 if ((str = next_field(str)) == NULL)
 {
-	message_error(" remice: no processes specified");
+	message_error(" renice: no processes specified");
 	return;
 }
 



CVS commit: src/external/bsd/top/dist

2018-06-02 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Sun Jun  3 05:29:27 UTC 2018

Modified Files:
src/external/bsd/top/dist: top.c

Log Message:
top(1): revert 1.11

This change breaks the expectations of users that would like a coredump
of top(1). Other similar applications such as vmstat(1) don't do this.
Since the change was just a courtesy, revert.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/top/dist/top.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.c
diff -u src/external/bsd/top/dist/top.c:1.11 src/external/bsd/top/dist/top.c:1.12
--- src/external/bsd/top/dist/top.c:1.11	Sat Jun  2 22:30:19 2018
+++ src/external/bsd/top/dist/top.c	Sun Jun  3 05:29:27 2018
@@ -119,6 +119,7 @@ quit(int status)
 
 {
 screen_end();
+chdir("/tmp");
 exit(status);
 /* NOTREACHED */
 }
@@ -725,16 +726,6 @@ main(int argc, char *argv[])
 struct statics statics;
 globalstate *gstate;
 
-/*
- * Since top(1) is often long running and
- * doesn't typically care about where its running from
- * chdir to the root to allow unmounting of its
- * original wd. Failure is alright as this is
- * just a courtesy for users.
- */
-chdir("/");
-
-
 /* get our name */
 if (argc > 0)
 {



CVS commit: src/external/bsd/top/dist

2018-06-02 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Sat Jun  2 22:30:20 UTC 2018

Modified Files:
src/external/bsd/top/dist: top.c

Log Message:
top(1): chdir to / at init

This allows us to unmount whatever directory we happen to be in when we
started top(1).

ok phone


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/top/dist/top.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.c
diff -u src/external/bsd/top/dist/top.c:1.10 src/external/bsd/top/dist/top.c:1.11
--- src/external/bsd/top/dist/top.c:1.10	Thu May 31 09:20:05 2018
+++ src/external/bsd/top/dist/top.c	Sat Jun  2 22:30:19 2018
@@ -119,7 +119,6 @@ quit(int status)
 
 {
 screen_end();
-chdir("/tmp");
 exit(status);
 /* NOTREACHED */
 }
@@ -726,6 +725,16 @@ main(int argc, char *argv[])
 struct statics statics;
 globalstate *gstate;
 
+/*
+ * Since top(1) is often long running and
+ * doesn't typically care about where its running from
+ * chdir to the root to allow unmounting of its
+ * original wd. Failure is alright as this is
+ * just a courtesy for users.
+ */
+chdir("/");
+
+
 /* get our name */
 if (argc > 0)
 {



CVS commit: src/external/bsd/top/dist/machine

2018-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu May 31 10:14:21 UTC 2018

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Fix read of unitialized array elements in top(1)

The cp_old array is allocated with malloc(3) and its pointer is passed to
percentages64().

In this function there happens a calculation of total_change, which value
depends on the value inside the unitialized cp_old[] array.

==26662==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x268a2c in percentages64 
/usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6
#1 0x26748b in get_system_info 
/usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:478:6
#2 0x25518e in do_display /usr/src/external/bsd/top/bin/../dist/top.c:507:5
#3 0x253038 in main /usr/src/external/bsd/top/bin/../dist/top.c:975:2
#4 0x21cad1 in ___start (/usr/bin/top+0x1cad1)
SUMMARY: MemorySanitizer: use-of-uninitialized-value 
/usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6 in percentages64
Exiting

Fix this issue by changling malloc(3) with calloc(3).

Detected with Memory Sanitizer during the integration of sanitizers with
the NetBSD basesystem.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.19 src/external/bsd/top/dist/machine/m_netbsd.c:1.20
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.19	Mon Dec 26 12:46:31 2016
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Thu May 31 10:14:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.20 2018/05/31 10:14:21 kamil Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $
+ * $Id: m_netbsd.c,v 1.20 2018/05/31 10:14:21 kamil Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.20 2018/05/31 10:14:21 kamil Exp $");
 #endif
 
 #include 
@@ -335,7 +335,7 @@ machine_init(statics)
 		ncpu = 1;
 
 	cpu_states = malloc(sizeof(cpu_states[0]) * CPUSTATES * ncpu);
-	cp_old = malloc(sizeof(cp_old[0]) * CPUSTATES * ncpu);
+	cp_old = calloc(CPUSTATES * ncpu, sizeof(cp_old[0]));
 	cp_diff = malloc(sizeof(cp_diff[0]) * CPUSTATES * ncpu);
 	if (cpu_states == NULL || cp_time == NULL || cp_old == NULL ||
 	cp_diff == NULL) {



CVS commit: src/external/bsd/top/dist

2018-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu May 31 09:20:05 UTC 2018

Modified Files:
src/external/bsd/top/dist: top.c

Log Message:
Fix unitialized signal mask passed to sigaction(2) in top(1)

Detected with Memory Sanitizer during the integration of sanitizers with
the NetBSD basesystem.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/top/dist/top.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.c
diff -u src/external/bsd/top/dist/top.c:1.9 src/external/bsd/top/dist/top.c:1.10
--- src/external/bsd/top/dist/top.c:1.9	Fri Mar 23 14:46:05 2012
+++ src/external/bsd/top/dist/top.c	Thu May 31 09:20:05 2018
@@ -135,6 +135,7 @@ set_signal(int sig, RETSIGTYPE (*handler
 #ifdef HAVE_SIGACTION
 struct sigaction action;
 
+sigemptyset(_mask);
 action.sa_handler = handler;
 action.sa_flags = 0;
 (void) sigaction(sig, , NULL);



CVS commit: src/external/bsd/top/dist

2017-01-12 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu Jan 12 18:37:10 UTC 2017

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
Fix couple of typos:
s/summay/summary
s/highligting/highlighting


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.9 src/external/bsd/top/dist/top.1.in:1.10
--- src/external/bsd/top/dist/top.1.in:1.9	Wed Dec 28 18:16:30 2016
+++ src/external/bsd/top/dist/top.1.in	Thu Jan 12 18:37:09 2017
@@ -409,7 +409,7 @@ Top supports the use of ANSI color in it
 available but not used.  The environment variable
 .B TOPCOLORS
 specifies colors to use and conditions for which they should be used.
-At the present time, only numbers in the summay display area can be 
+At the present time, only numbers in the summary display area can be 
 colored. In a future version it will be possible to highlight numbers
 in the process display area as well.  The environment variable is the
 only way to specify color: there is no equivalent command line option.
@@ -454,7 +454,7 @@ You can see a list of color codes recogn
 with the
 .B \-T
 option.  This will also show the current set of tests used for
-color highligting, as specified in the environment.
+color highlighting, as specified in the environment.
 .SH AUTHOR
 William LeFebvre
 .SH ENVIRONMENT



CVS commit: src/external/bsd/top/dist

2016-12-28 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Wed Dec 28 18:16:30 UTC 2016

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
Document the `p' command in "interactive mode" that filters processes by pid.
While here add date to the `.TH' macro 3rd argument.

Reviewed by and thanks to 


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.8 src/external/bsd/top/dist/top.1.in:1.9
--- src/external/bsd/top/dist/top.1.in:1.8	Sat Jan 23 22:10:44 2016
+++ src/external/bsd/top/dist/top.1.in	Wed Dec 28 18:16:30 2016
@@ -4,7 +4,7 @@
 .nr D @DEFAULT_DELAY@
 .nr L @HAVE_GETOPT_LONG@
 .nr K @ENABLE_KILL@
-.TH TOP 1 Local
+.TH TOP 1 "December 28, 2016"
 .UC 4
 .SH NAME
 top \- display and update information about the top cpu processes
@@ -301,6 +301,11 @@ but usually include:  \*(lqcpu\*(rq, \*(
 .B P
 Sort by CPU usage.  Shorthand for \*(lqo cpu\*(rq.
 .TP
+.B p
+Display only process with the specified pid (prompt for process id).
+If the pid specified is simply \*(lq-1\*(rq, then all processes are
+displayed.
+.TP
 .B q
 Quit
 .IR top.



CVS commit: src/external/bsd/top/dist/machine

2016-12-26 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Mon Dec 26 12:46:32 UTC 2016

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Implement the `c' command in "interactive mode" that displays only commands
that match a specified string.

Reviewed by and thanks to 


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.18 src/external/bsd/top/dist/machine/m_netbsd.c:1.19
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.18	Sun Oct 20 03:02:27 2013
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Mon Dec 26 12:46:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $
+ * $Id: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $");
 #endif
 
 #include 
@@ -587,6 +587,7 @@ get_proc_info(struct system_info *si, st
 	int show_idle;
 	int show_system;
 	int show_uid;
+	char *show_command;
 
 	static struct handle handle;
 
@@ -626,6 +627,7 @@ get_proc_info(struct system_info *si, st
 	show_idle = sel->idle;
 	show_system = sel->system;
 	show_uid = sel->uid != -1;
+	show_command = sel->command;
 
 	/* count up process states and get pointers to interesting procs */
 	total_procs = 0;
@@ -646,9 +648,12 @@ get_proc_info(struct system_info *si, st
 			if (pp->p_stat != LSZOMB &&
 			(show_idle || (pp->p_pctcpu != 0) || 
 			(pp->p_stat == LSRUN || pp->p_stat == LSONPROC)) &&
-			(!show_uid || pp->p_ruid == (uid_t)sel->uid)) {
-*prefp++ = pp;
-active_procs++;
+			(!show_uid || pp->p_ruid == (uid_t)sel->uid) &&
+			(!show_command ||
+			 strstr(get_command(sel, pp),
+ show_command) != NULL)) {
+	*prefp++ = pp;
+	active_procs++;
 			}
 		}
 	}
@@ -685,6 +690,7 @@ get_lwp_info(struct system_info *si, str
 	int show_idle;
 	int show_system;
 	int show_uid;
+	char *show_command;
 
 	static struct handle handle;
 
@@ -736,6 +742,7 @@ get_lwp_info(struct system_info *si, str
 	show_idle = sel->idle;
 	show_system = sel->system;
 	show_uid = sel->uid != -1;
+	show_command = sel->command;
 
 	/* count up thread states and get pointers to interesting threads */
 	total_lwps = 0;
@@ -758,9 +765,12 @@ get_lwp_info(struct system_info *si, str
 			if (lp->l_stat != LSZOMB &&
 			(show_idle || (lp->l_pctcpu != 0) || 
 			(lp->l_stat == LSRUN || lp->l_stat == LSONPROC)) &&
-			(!show_uid || uid_from_thread(lp) == sel->uid)) {
-*lrefp++ = lp;
-active_lwps++;
+			(!show_uid || uid_from_thread(lp) == sel->uid) &&
+			(!show_command ||
+			 strstr(get_command(sel, proc_from_thread(lp)),
+ show_command) != NULL)) {
+	*lrefp++ = lp;
+	active_lwps++;
 			}
 		}
 	}



CVS commit: src/external/bsd/top/dist

2016-08-27 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 27 18:48:30 UTC 2016

Modified Files:
src/external/bsd/top/dist: utils.c

Log Message:
Be more careful/explicit with FP rounding when converting floating time
to timeval. Also, don't truncate the seconds part to int for y2038.

I've had this patch sitting around since 2010 and I completely forget
what motivated it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/top/dist/utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/utils.c
diff -u src/external/bsd/top/dist/utils.c:1.4 src/external/bsd/top/dist/utils.c:1.5
--- src/external/bsd/top/dist/utils.c:1.4	Tue May  5 18:51:22 2009
+++ src/external/bsd/top/dist/utils.c	Sat Aug 27 18:48:30 2016
@@ -41,6 +41,7 @@
 
 #include "os.h"
 #include 
+#include 
 #ifdef HAVE_STDARG_H
 #include 
 #else
@@ -711,8 +712,11 @@ diff_per_second(unsigned int x, unsigned
 void
 double2tv(struct timeval *tv, double d)
 {
-tv->tv_sec = (int)d;
-tv->tv_usec = (d - tv->tv_sec) * 100;
+double di;
+
+di = floor(d);
+tv->tv_sec = (time_t)di;
+tv->tv_usec = (int)ceil((d - di) * 100.0);
 }
 
 static int debug_on = 0;



CVS commit: src/external/bsd/top/dist

2016-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 23 22:10:44 UTC 2016

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
PR/5068: Ingo Schwarze: Don't use the .af (alter format) request to display
a named register.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.7 src/external/bsd/top/dist/top.1.in:1.8
--- src/external/bsd/top/dist/top.1.in:1.7	Thu Jan 22 21:58:40 2015
+++ src/external/bsd/top/dist/top.1.in	Sat Jan 23 17:10:44 2016
@@ -166,9 +166,7 @@ Only display the specified pid.
 .B "\-s \fItime\fP, \-\-delay=\fItime\fP"
 Set the delay between screen updates to
 .I time
-seconds.  The default delay between updates is
-.af D 1 
-seconds.
+seconds.  The default delay between updates is \nD seconds.
 .TP
 .B "\-U \fIusername\fP, \-\-user=\fIusername\fP"
 Show only those processes owned by



CVS commit: src/external/bsd/top/dist

2015-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 23 02:58:40 UTC 2015

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
use more markup


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.6 src/external/bsd/top/dist/top.1.in:1.7
--- src/external/bsd/top/dist/top.1.in:1.6	Wed Mar 20 21:39:04 2013
+++ src/external/bsd/top/dist/top.1.in	Thu Jan 22 21:58:40 2015
@@ -166,7 +166,9 @@ Only display the specified pid.
 .B \-s \fItime\fP, \-\-delay=\fItime\fP
 Set the delay between screen updates to
 .I time
-seconds.  The default delay between updates is \nD seconds.
+seconds.  The default delay between updates is
+.af D 1 
+seconds.
 .TP
 .B \-U \fIusername\fP, \-\-user=\fIusername\fP
 Show only those processes owned by



CVS commit: src/external/bsd/top/dist

2014-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 13 20:06:41 UTC 2014

Modified Files:
src/external/bsd/top/dist: display.c

Log Message:
Don't die if we resize to smaller than Y_LINES. The display could do better,
but it recovers if we grow.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/top/dist/display.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/display.c
diff -u src/external/bsd/top/dist/display.c:1.9 src/external/bsd/top/dist/display.c:1.10
--- src/external/bsd/top/dist/display.c:1.9	Sat Jul  3 09:18:57 2010
+++ src/external/bsd/top/dist/display.c	Tue May 13 16:06:41 2014
@@ -723,8 +723,9 @@ display_resize()
 
 /* adjust total lines on screen to lines available for procs */
 if (top_lines  y_procs)
-	return -1;
-top_lines -= y_procs;
+	top_lines = 0;
+else
+	top_lines -= y_procs;
 
 /* return number of lines available */
 return top_lines;



CVS commit: src/external/bsd/top/dist

2013-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 20 03:02:27 UTC 2013

Modified Files:
src/external/bsd/top/dist: hash.c
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/top/dist/hash.c
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/hash.c
diff -u src/external/bsd/top/dist/hash.c:1.3 src/external/bsd/top/dist/hash.c:1.4
--- src/external/bsd/top/dist/hash.c:1.3	Tue May  5 14:51:21 2009
+++ src/external/bsd/top/dist/hash.c	Sat Oct 19 23:02:26 2013
@@ -579,7 +579,6 @@ hash_remove_pos_uint(hash_pos *pos)
 llistitem *li;
 void *ans;
 hash_item_uint *hi;
-unsigned int key;
 
 /* sanity checks */
 if (pos == NULL || pos-ll_last == pos-ll_item)
@@ -597,9 +596,6 @@ hash_remove_pos_uint(hash_pos *pos)
 hi = (hash_item_uint *)li-datum;
 ans = hi-value;
 
-/* free up the space */
-key = hi-key;
-;
 ll_freeitem(li);
 
 /* back up to previous item */
@@ -917,7 +913,6 @@ hash_remove_pos_pid(hash_pos *pos)
 llistitem *li;
 void *ans;
 hash_item_pid *hi;
-pid_t key;
 
 /* sanity checks */
 if (pos == NULL || pos-ll_last == pos-ll_item)
@@ -936,8 +931,6 @@ hash_remove_pos_pid(hash_pos *pos)
 ans = hi-value;
 
 /* free up the space */
-key = hi-key;
-;
 ll_freeitem(li);
 
 /* back up to previous item */
@@ -1593,7 +1586,6 @@ hash_remove_pos_pidthr(hash_pos *pos)
 llistitem *li;
 void *ans;
 hash_item_pidthr *hi;
-pidthr_t key;
 
 /* sanity checks */
 if (pos == NULL || pos-ll_last == pos-ll_item)
@@ -1612,8 +1604,6 @@ hash_remove_pos_pidthr(hash_pos *pos)
 ans = hi-value;
 
 /* free up the space */
-key = hi-key;
-;
 ll_freeitem(li);
 
 /* back up to previous item */
@@ -1932,7 +1922,6 @@ hash_remove_pos_lwpid(hash_pos *pos)
 llistitem *li;
 void *ans;
 hash_item_lwpid *hi;
-lwpid_t key;
 
 /* sanity checks */
 if (pos == NULL || pos-ll_last == pos-ll_item)
@@ -1951,8 +1940,6 @@ hash_remove_pos_lwpid(hash_pos *pos)
 ans = hi-value;
 
 /* free up the space */
-key = hi-key;
-;
 ll_freeitem(li);
 
 /* back up to previous item */

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.17 src/external/bsd/top/dist/machine/m_netbsd.c:1.18
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.17	Thu Jan  3 05:12:36 2013
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Sat Oct 19 23:02:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $
+ * $Id: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -587,7 +587,6 @@ get_proc_info(struct system_info *si, st
 	int show_idle;
 	int show_system;
 	int show_uid;
-	int show_command;
 
 	static struct handle handle;
 
@@ -627,7 +626,6 @@ get_proc_info(struct system_info *si, st
 	show_idle = sel-idle;
 	show_system = sel-system;
 	show_uid = sel-uid != -1;
-	show_command = sel-command != NULL;
 
 	/* count up process states and get pointers to interesting procs */
 	total_procs = 0;
@@ -687,7 +685,6 @@ get_lwp_info(struct system_info *si, str
 	int show_idle;
 	int show_system;
 	int show_uid;
-	int show_command;
 
 	static struct handle handle;
 
@@ -739,7 +736,6 @@ get_lwp_info(struct system_info *si, str
 	show_idle = sel-idle;
 	show_system = sel-system;
 	show_uid = sel-uid != -1;
-	show_command = sel-command != NULL;
 
 	/* count up thread states and get pointers to interesting threads */
 	total_lwps = 0;



CVS commit: src/external/bsd/top/dist

2013-10-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Oct  1 11:39:38 UTC 2013

Modified Files:
src/external/bsd/top/dist: screen.c

Log Message:
Allow interactive displays if the termcap entry does not have the `li'
setting but we can calculate the lines from ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/top/dist/screen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/screen.c
diff -u src/external/bsd/top/dist/screen.c:1.4 src/external/bsd/top/dist/screen.c:1.5
--- src/external/bsd/top/dist/screen.c:1.4	Sat Dec 24 22:29:48 2011
+++ src/external/bsd/top/dist/screen.c	Tue Oct  1 11:39:37 2013
@@ -273,8 +273,7 @@ screen_readtermcap(int interactive)
 /* set up common terminal capabilities */
 if ((screen_length = tgetnum(li)) = 0)
 {
-	screen_length = smart_terminal = 0;
-	return No;
+	screen_length = 0;
 }
 
 /* screen_width is a little different */
@@ -329,6 +328,13 @@ screen_readtermcap(int interactive)
sets lower_left. */
 screen_getsize();
 
+/* If screen_length is 0 from both termcap and ioctl then we are dumb */
+if (screen_length == 0)
+{
+smart_terminal = No;
+return No;
+}
+
 /* if stdout is not a terminal, pretend we are a dumb terminal */
 #ifdef USE_SGTTY
 if (ioctl(STDOUT, TIOCGETP, old_settings) == -1)



CVS commit: src/external/bsd/top/dist

2013-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 21 00:27:44 UTC 2013

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
PR/47675: Nick Hudson: top(1) man page missing default number of seconds


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.4 src/external/bsd/top/dist/top.1.in:1.5
--- src/external/bsd/top/dist/top.1.in:1.4	Fri Mar 23 09:32:51 2012
+++ src/external/bsd/top/dist/top.1.in	Wed Mar 20 20:27:44 2013
@@ -166,7 +166,7 @@ Only display the specified pid.
 .B \-s \fItime\fP, \-\-delay=\fItime\fP
 Set the delay between screen updates to
 .I time
-seconds.  The default delay between updates is \nD seconds.
+seconds.  The default delay between updates is 5 seconds.
 .TP
 .B \-U \fIusername\fP, \-\-user=\fIusername\fP
 Show only those processes owned by



CVS commit: src/external/bsd/top/dist

2013-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 21 01:39:04 UTC 2013

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
revert previous, this is a mandoc issue (does not handle .if and .nr)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.5 src/external/bsd/top/dist/top.1.in:1.6
--- src/external/bsd/top/dist/top.1.in:1.5	Wed Mar 20 20:27:44 2013
+++ src/external/bsd/top/dist/top.1.in	Wed Mar 20 21:39:04 2013
@@ -166,7 +166,7 @@ Only display the specified pid.
 .B \-s \fItime\fP, \-\-delay=\fItime\fP
 Set the delay between screen updates to
 .I time
-seconds.  The default delay between updates is 5 seconds.
+seconds.  The default delay between updates is \nD seconds.
 .TP
 .B \-U \fIusername\fP, \-\-user=\fIusername\fP
 Show only those processes owned by



CVS commit: src/external/bsd/top/dist/machine

2013-01-03 Thread Lars Heidieker
Module Name:src
Committed By:   para
Date:   Thu Jan  3 10:12:36 UTC 2013

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
explicitly include sys/resource.h


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.16 src/external/bsd/top/dist/machine/m_netbsd.c:1.17
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.16	Sat Oct  8 08:45:37 2011
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Thu Jan  3 10:12:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,15 +37,16 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $
+ * $Id: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $);
 #endif
 
 #include sys/param.h
+#include sys/resource.h
 #include sys/sysctl.h
 #include sys/sched.h
 #include sys/swap.h



CVS commit: src/external/bsd/top/dist

2012-03-23 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Mar 23 13:32:51 UTC 2012

Modified Files:
src/external/bsd/top/dist: top.1.in

Log Message:
Mention that 1 can be used as an interactive command.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/top/dist/top.1.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.1.in
diff -u src/external/bsd/top/dist/top.1.in:1.3 src/external/bsd/top/dist/top.1.in:1.4
--- src/external/bsd/top/dist/top.1.in:1.3	Sun Jul 20 18:52:06 2008
+++ src/external/bsd/top/dist/top.1.in	Fri Mar 23 13:32:51 2012
@@ -237,6 +237,9 @@ These commands are currently recognized:
 Display a summary of the commands (help screen).  Version information
 is included in this display.
 .TP
+.B 1
+Toggle the display of per-cpu states.
+.TP
 .B C
 Toggle the use of color in the display.
 .TP



CVS commit: src/external/bsd/top/dist

2012-03-23 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Mar 23 14:46:05 UTC 2012

Modified Files:
src/external/bsd/top/dist: commands.c top.c

Log Message:
Switch off per-cpu states by default (i.e. display a single CPU line with a
mean average). Program behaviour now tallies with the man page, but more
importantly, the default behaviour is now sensible for modern multi-core
machines.

If you want the previous behaviour, please set TOP=-1 in your environment.

Fix multiple 1 options not toggling and thus allow settings in TOP
environmental variable to be reversed by a command line option.

Tweak description of 1  command in interactive mode.

OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/top/dist/commands.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/top/dist/top.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/commands.c
diff -u src/external/bsd/top/dist/commands.c:1.6 src/external/bsd/top/dist/commands.c:1.7
--- src/external/bsd/top/dist/commands.c:1.6	Tue May  5 18:51:21 2009
+++ src/external/bsd/top/dist/commands.c	Fri Mar 23 14:46:05 2012
@@ -943,7 +943,7 @@ command command_table[] = {
 { ' ', cmd_update, update screen },
 { '?', cmd_help, help; show this text },
 { 'h', cmd_help, NULL },
-{ '1', cmd_percpustates, toggle the detail per cpu of cpustates },
+{ '1', cmd_percpustates, toggle the display of cpu states per cpu },
 { 'C', cmd_color, toggle the use of color },
 { 'H', cmd_threads, toggle the display of individual threads },
 { 't', cmd_threads, NULL },

Index: src/external/bsd/top/dist/top.c
diff -u src/external/bsd/top/dist/top.c:1.8 src/external/bsd/top/dist/top.c:1.9
--- src/external/bsd/top/dist/top.c:1.8	Tue May  5 18:51:22 2009
+++ src/external/bsd/top/dist/top.c	Fri Mar 23 14:46:05 2012
@@ -345,8 +345,6 @@ do_arguments(globalstate *gstate, int ac
 	{
 	case '1':
 	gstate-percpustates = !gstate-percpustates;
-	gstate-fulldraw = Yes;
-	gstate-max_topn += display_setmulti(gstate-percpustates);
 	break;
 #ifdef ENABLE_COLOR
 	case 'C':
@@ -771,7 +769,7 @@ main(int argc, char *argv[])
 gstate-fulldraw = Yes;
 gstate-use_color = Yes;
 gstate-interactive = Maybe;
-gstate-percpustates = Yes;
+gstate-percpustates = No;
 
 /* preset defaults for process selection */
 gstate-pselect.idle = Yes;



CVS commit: src/external/bsd/top/dist

2011-12-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 24 22:29:48 UTC 2011

Modified Files:
src/external/bsd/top/dist: screen.c

Log Message:
PR/45739: Moritz Wilhelmy: top(1) segfaults on WINCH with unknown terminal


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/top/dist/screen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/screen.c
diff -u src/external/bsd/top/dist/screen.c:1.3 src/external/bsd/top/dist/screen.c:1.4
--- src/external/bsd/top/dist/screen.c:1.3	Tue May  5 14:51:21 2009
+++ src/external/bsd/top/dist/screen.c	Sat Dec 24 17:29:48 2011
@@ -167,7 +167,7 @@ void
 screen_getsize()
 
 {
-
+char *go;
 #ifdef TIOCGWINSZ
 
 struct winsize ws;
@@ -204,7 +204,10 @@ screen_getsize()
 #endif /* TIOCGSIZE */
 #endif /* TIOCGWINSZ */
 
-(void) strcpy(lower_left, tgoto(tc_cursor_motion, 0, screen_length - 1));
+if ((go = tgoto(tc_cursor_motion, 0, screen_length - 1)) != NULL)
+	(void) strcpy(lower_left, go);
+else
+	lower_left[0] = '\0';
 }
 
 int
@@ -214,6 +217,7 @@ screen_readtermcap(int interactive)
 char *bufptr;
 char *PCptr;
 char *term_name;
+char *go;
 int status;
 
 /* set defaults in case we aren't smart */
@@ -314,7 +318,10 @@ screen_readtermcap(int interactive)
 PC = (PCptr = tgetstr(pc, bufptr)) ? *PCptr : 0;
 
 /* set convenience strings */
-(void) strcpy(home, tgoto(tc_cursor_motion, 0, 0));
+if ((go = tgoto(tc_cursor_motion, 0, 0)) != NULL)
+	(void) strcpy(home, go);
+else
+	home[0] = '\0';
 /* (lower_left is set in screen_getsize) */
 
 /* get the actual screen size with an ioctl, if needed */
@@ -502,7 +509,9 @@ void
 screen_move(int x, int y)
 
 {
-tputs(tgoto(tc_cursor_motion, x, y), 1, putstdout);
+char *go = tgoto(tc_cursor_motion, x, y);
+if (go)
+	tputs(go, 1, putstdout);
 }
 
 void



CVS commit: src/external/bsd/top/dist/machine

2011-10-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sat Oct  8 08:45:37 UTC 2011

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Adjust UID header position, to be aligned with the datas.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.15 src/external/bsd/top/dist/machine/m_netbsd.c:1.16
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.15	Fri Apr 15 02:05:53 2011
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Sat Oct  8 08:45:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $
+ * $Id: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $);
 #endif
 
 #include sys/param.h
@@ -413,7 +413,7 @@ format_process_header(struct process_sel
 {
 	char *header;
 	char *ptr;
-	const char *uname_field = sel-usernames ? USERNAME :UID  ;
+	const char *uname_field = sel-usernames ? USERNAME : UID ;
 
 	if (sel-threads) {
 		header = Thread_header;



CVS commit: src/external/bsd/top/dist/machine

2011-04-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 15 02:05:53 UTC 2011

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Swap the command and the thread name in the thread view and let the command
be as long as it wants. (Vladimir Kirillov)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.14 src/external/bsd/top/dist/machine/m_netbsd.c:1.15
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.14	Mon May 31 14:14:59 2010
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Thu Apr 14 22:05:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $
+ * $Id: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -105,14 +105,14 @@
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %.12s
+	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %s
 
 static char Thread_header[] =
-PID   LID XPRI STATE  TIME   WCPUCPU COMMAND  NAME;
+PID   LID XPRI STATE  TIME   WCPUCPU NAME  COMMAND;
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \
-%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-12.12s %.12s
+%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-9.9s %s
 
 /* 
  * Process state names for the STATE column of the display.
@@ -939,8 +939,8 @@
 	format_time(cputime),
 	100.0 * weighted_cpu(l_, pct, pl),
 	100.0 * pct,
-	get_command(hp-sel, pp),
-	printable(pl-l_name));
+	printable(pl-l_name),
+	get_command(hp-sel, pp));
 
 	/* return the result */
 	return(fmt);



CVS commit: src/external/bsd/top/dist

2010-07-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul  3 13:18:57 UTC 2010

Modified Files:
src/external/bsd/top/dist: display.c

Log Message:
PR/43562: Witold Jan Wnuk: top: CPU percentages overlap labels


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/top/dist/display.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/display.c
diff -u src/external/bsd/top/dist/display.c:1.8 src/external/bsd/top/dist/display.c:1.9
--- src/external/bsd/top/dist/display.c:1.8	Wed Jun 30 07:08:12 2010
+++ src/external/bsd/top/dist/display.c	Sat Jul  3 09:18:57 2010
@@ -854,10 +854,10 @@
 	*ip++ = cpustate_total_length;
 	if ((i = strlen(*pp++))  0)
 	{
-		cpustate_total_length += i + 7;
-		/* strlen( 100% ) is 6, strlen( 99.9% ) is 7. Never 8. */
+		cpustate_total_length += i + 8;
 	}
 	}
+	cpustate_total_length -= 2;
 }
 
 #ifdef ENABLE_COLOR
@@ -1155,11 +1155,11 @@
 
 static char fmttag[100];
 
-const char *short_tag = !multi || ncpu = 1 ? CPU:  : CPU%0*d;
+const char *short_tag = !multi || ncpu = 1 ? CPU:  : CPU%0*d: ;
 const char *long_tag = !multi || ncpu = 1 ?
 	CPU states:  : CPU%0*d states: ;
 
-for (width=0, u=ncpu; u0; u /= 10) {
+for (width = 0, u = ncpu - 1; u  0; u /= 10) {
 	++width;
 }
 /* if length + strlen(long_tag)  screen_width, then we have to



CVS commit: src/external/bsd/top/dist/machine

2010-05-31 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon May 31 18:14:59 UTC 2010

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Fix previous, so it builds on some ports.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.13 src/external/bsd/top/dist/machine/m_netbsd.c:1.14
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.13	Mon May 31 03:18:33 2010
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Mon May 31 18:14:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $
+ * $Id: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $);
 #endif
 
 #include sys/param.h
@@ -842,8 +842,8 @@
 		case LSRUN:
 		case LSSLEEP:
 		case LSIDL:
-			(void)snprintf(state, sizeof(state), %.6s/%lu, 
-			 statep, pp-p_cpuid);
+			(void)snprintf(state, sizeof(state), %.6s/%u, 
+			 statep, (unsigned int)pp-p_cpuid);
 			statep = state;
 			break;
 		}
@@ -915,8 +915,8 @@
 		case LSRUN:
 		case LSSLEEP:			
 		case LSIDL:
-			(void)snprintf(state, sizeof(state), %.6s/%lu, 
-			 statep, pl-l_cpuid);
+			(void)snprintf(state, sizeof(state), %.6s/%u, 
+			 statep, (unsigned int)pl-l_cpuid);
 			statep = state;
 			break;
 		}



CVS commit: src/external/bsd/top/dist/machine

2010-05-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 12 22:09:36 UTC 2010

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
implement fullcmd mode. Now we need to modernize the machine specific code
to handle displays  80 columns to make this work effectively.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.11 src/external/bsd/top/dist/machine/m_netbsd.c:1.12
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.11	Wed Oct 21 17:11:57 2009
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Wed May 12 18:09:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.12 2010/05/12 22:09:36 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $
+ * $Id: m_netbsd.c,v 1.12 2010/05/12 22:09:36 christos Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.11 2009/10/21 21:11:57 rmind Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.12 2010/05/12 22:09:36 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -70,14 +70,15 @@
 #include loadavg.h
 #include username.h
 
-static void percentages64 __P((int, int *, u_int64_t *, u_int64_t *,
-u_int64_t *));
-static int get_cpunum __P((u_int64_t));
+static void percentages64(int, int *, u_int64_t *, u_int64_t *,
+u_int64_t *);
+static int get_cpunum(u_int64_t);
 
 
 /* get_process_info passes back a handle.  This is what it looks like: */
 
 struct handle {
+	struct process_select *sel;
 	struct kinfo_proc2 **next_proc;	/* points to next valid proc pointer */
 	int remaining;		/* number of pointers remaining */
 };
@@ -188,17 +189,17 @@
 };
 
 /* forward definitions for comparison functions */
-static int compare_cpu __P((struct proc **, struct proc **));
-static int compare_prio __P((struct proc **, struct proc **));
-static int compare_res __P((struct proc **, struct proc **));
-static int compare_size __P((struct proc **, struct proc **));
-static int compare_state __P((struct proc **, struct proc **));
-static int compare_time __P((struct proc **, struct proc **));
-static int compare_pid __P((struct proc **, struct proc **));
-static int compare_command __P((struct proc **, struct proc **));
-static int compare_username __P((struct proc **, struct proc **));
+static int compare_cpu(struct proc **, struct proc **);
+static int compare_prio(struct proc **, struct proc **);
+static int compare_res(struct proc **, struct proc **);
+static int compare_size(struct proc **, struct proc **);
+static int compare_state(struct proc **, struct proc **);
+static int compare_time(struct proc **, struct proc **);
+static int compare_pid(struct proc **, struct proc **);
+static int compare_command(struct proc **, struct proc **);
+static int compare_username(struct proc **, struct proc **);
 
-int (*proc_compares[]) __P((struct proc **, struct proc **)) = {
+int (*proc_compares[])(struct proc **, struct proc **) = {
 	compare_cpu,
 	compare_prio,
 	compare_res,
@@ -248,6 +249,57 @@
 
 #define pagetok(size) ((size)  pageshift)
 
+/*
+ * Print swapped processes as pname and
+ * system processes as [pname]
+ */
+static const char *
+get_pretty(const struct kinfo_proc2 *pp)
+{
+	if ((pp-p_flag  P_SYSTEM) != 0)
+		return [];
+	if ((pp-p_flag  P_INMEM) == 0)
+		return ;
+	return ;
+}
+
+static const char *
+get_command(const struct process_select *sel, struct kinfo_proc2 *pp)
+{
+	static char cmdbuf[128];
+	const char *pretty;
+	char **argv;
+	if (pp == NULL)
+		return gone;
+	pretty = get_pretty(pp);
+
+	if (sel-fullcmd == 0 || kd == NULL || (argv = kvm_getargv2(kd, pp,
+	sizeof(cmdbuf))) == NULL) {
+		if (pretty[0] != '\0'  pp-p_comm[0] != pretty[0])
+			snprintf(cmdbuf, sizeof(cmdbuf), %c%s%c, pretty[0],
+			printable(pp-p_comm), pretty[1]);
+		else
+			strlcpy(cmdbuf, printable(pp-p_comm), sizeof(cmdbuf));
+	} else {
+		char *d = cmdbuf;
+		if (pretty[0] != '\0'  argv[0][0] != pretty[0]) 
+			*d++ = pretty[0];
+		while (*argv) {
+			const char *s = printable(*argv++);
+			while (d  cmdbuf + sizeof(cmdbuf) - 2 
+			(*d++ = *s++) != '\0')
+continue;
+			if (d  cmdbuf  d  cmdbuf + sizeof(cmdbuf) - 2 
+			d[-1] == '\0')
+d[-1] = ' ';
+		}
+		if (pretty[0] != '\0'  pretty[0] == cmdbuf[0])
+			*d++ = pretty[1];
+		*d++ = '\0';
+	}
+	return cmdbuf;
+}
+
 static int
 get_cpunum(id)
 	u_int64_t id;
@@ -364,6 +416,7 @@
 	statics-swap_names = swapnames;
 	statics-order_names = ordernames;
 	statics-flags.threads = 1;
+	statics-flags.fullcmds = 1;
 
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_BOOTTIME;
@@ -637,6 +690,7 @@
 	/* 

CVS commit: src/external/bsd/top/dist/machine

2009-07-27 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Jul 27 16:26:48 UTC 2009

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Make process CPU value drop the decimal part when reaching 100%, like
WCPU.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/top/dist/machine/m_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.9 src/external/bsd/top/dist/machine/m_netbsd.c:1.10
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.9	Tue May  5 18:51:22 2009
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Mon Jul 27 16:26:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.9 2009/05/05 18:51:22 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.9 2009/05/05 18:51:22 christos Exp $
+ * $Id: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.9 2009/05/05 18:51:22 christos Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.10 2009/07/27 16:26:48 njoly Exp $);
 #endif
 
 #include sys/param.h
@@ -106,7 +106,7 @@
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.2f%% %.12s
+	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %.12s
 
 static char Thread_header[] =
 PID   LID XPRI STATE  TIME   WCPUCPU COMMAND  NAME;
@@ -770,7 +770,7 @@
 {
 	struct kinfo_proc2 *pp;
 	long cputime;
-	double pct, wcpu;
+	double pct, wcpu, cpu;
 	struct handle *hp;
 	const char *statep;
 #ifdef KI_NOCPU
@@ -839,6 +839,7 @@
 	}
 #endif
 	wcpu = 100.0 * weighted_cpu(p_, pct, pp);
+	cpu = 100.0 * pct;
 
 	/* format this entry */
 	sprintf(fmt,
@@ -852,7 +853,7 @@
 	statep,
 	format_time(cputime),
 	(wcpu = 100.0) ? 0 : 2, wcpu,
-	100.0 * pct,
+	(cpu = 100.0) ? 0 : 2, cpu,
 	printable(pp-p_comm));
 
 	/* return the result */



CVS commit: src/external/bsd/top/dist

2009-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May  5 18:52:13 UTC 2009

Modified Files:
src/external/bsd/top/dist: display.c

Log Message:
PR/41358: YAMAMOTO Takashi: top -n is broken, don't return -1 early if
!smartterminal


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/top/dist/display.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/display.c
diff -u src/external/bsd/top/dist/display.c:1.6 src/external/bsd/top/dist/display.c:1.7
--- src/external/bsd/top/dist/display.c:1.6	Tue May  5 14:51:21 2009
+++ src/external/bsd/top/dist/display.c	Tue May  5 14:52:13 2009
@@ -717,14 +717,17 @@
 	memzero(colorbuf, bufsize);
 }
 
+/* for dumb terminals, pretend like we can show any amount */
+if (!smart_terminal)
+	return Largest;
+
 /* adjust total lines on screen to lines available for procs */
 if (top_lines  y_procs)
 	return -1;
 top_lines -= y_procs;
 
 /* return number of lines available */
-/* for dumb terminals, pretend like we can show any amount */
-return(smart_terminal ? top_lines : Largest);
+return top_lines;
 }
 
 int