[Midnightbsd-cvs] src: contrib/top: merge changes

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Nov 19 17:48:42 EST 2008


Log Message:
-----------
merge changes

Modified Files:
--------------
    src/contrib/top:
        top.X (r1.2 -> r1.3)
        top.c (r1.2 -> r1.3)

-------------- next part --------------
Index: top.c
===================================================================
RCS file: /home/cvs/src/contrib/top/top.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L contrib/top/top.c -L contrib/top/top.c -u -r1.2 -r1.3
--- contrib/top/top.c
+++ contrib/top/top.c
@@ -13,7 +13,7 @@
  *  Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory
  *  Copyright (c) 1996, William LeFebvre, Group sys Consulting
  *
- * $FreeBSD: src/contrib/top/top.c,v 1.19 2006/04/19 12:19:06 ru Exp $
+ * $FreeBSD: src/contrib/top/top.c,v 1.23 2007/05/04 15:42:58 rafan Exp $
  */
 
 /*
@@ -65,6 +65,8 @@
 /* imported from screen.c */
 extern int overstrike;
 
+static int fmt_flags = 0;
+
 /* signal handling routines */
 sigret_t leave();
 sigret_t onalrm();
@@ -193,9 +195,9 @@
     fd_set readfds;
 
 #ifdef ORDER
-    static char command_chars[] = "\f qh?en#sdkriIutHmSCo";
+    static char command_chars[] = "\f qh?en#sdkriIutHmSCajo";
 #else
-    static char command_chars[] = "\f qh?en#sdkriIutHmSC";
+    static char command_chars[] = "\f qh?en#sdkriIutHmSCaj";
 #endif
 /* these defines enumerate the "strchr"s of the commands in command_chars */
 #define CMD_redraw	0
@@ -219,8 +221,10 @@
 #define CMD_viewtog	17
 #define CMD_viewsys	18
 #define	CMD_wcputog	19
+#define	CMD_showargs	20
+#define	CMD_jidtog	21
 #ifdef ORDER
-#define CMD_order       20
+#define CMD_order       22
 #endif
 
     /* set the buffer for stdout */
@@ -252,6 +256,7 @@
     ps.uid     = -1;
     ps.thread  = No;
     ps.wcpu    = 1;
+    ps.jail    = No;
     ps.command = NULL;
 
     /* get preset options from the environment */
@@ -277,7 +282,7 @@
 	    optind = 1;
 	}
 
-	while ((i = getopt(ac, av, "CSIHbinquvs:d:U:m:o:t")) != EOF)
+	while ((i = getopt(ac, av, "CSIHabijnquvs:d:U:m:o:t")) != EOF)
 	{
 	    switch(i)
 	    {
@@ -316,6 +321,10 @@
 		interactive = No;
 		break;
 
+	      case 'a':
+		fmt_flags ^= FMT_SHOWARGS;
+		break;
+
 	      case 'd':			/* number of displays to show */
 		if ((i = atoiwi(optarg)) == Invalid || i == 0)
 		{
@@ -394,10 +403,14 @@
 		ps.thread = !ps.thread;
 		break;
 
+	      case 'j':
+		ps.jail = !ps.jail;
+		break;
+
 	      default:
 		fprintf(stderr,
 "Top version %s\n"
-"Usage: %s [-bCHIinqStuv] [-d count] [-m io | cpu] [-o field] [-s time]\n"
+"Usage: %s [-abCHIijnqStuv] [-d count] [-m io | cpu] [-o field] [-s time]\n"
 "       [-U username] [number]\n",
 			version_string(), myname);
 		exit(1);
@@ -651,7 +664,8 @@
 	    /* now show the top "n" processes. */
 	    for (i = 0; i < active_procs; i++)
 	    {
-		(*d_process)(i, format_next_process(processes, get_userid));
+		(*d_process)(i, format_next_process(processes, get_userid,
+			     fmt_flags));
 	    }
 	}
 	else
@@ -1020,6 +1034,9 @@
 			    case CMD_viewsys:
 				ps.system = !ps.system;
 				break;
+			    case CMD_showargs:
+				fmt_flags ^= FMT_SHOWARGS;
+				break;
 #ifdef ORDER
 			    case CMD_order:
 				new_message(MT_standout,
@@ -1044,6 +1061,15 @@
 				}
 				break;
 #endif
+			    case CMD_jidtog:
+				ps.jail = !ps.jail;
+				new_message(MT_standout | MT_delayed,
+				    " %sisplaying jail ID.",
+				    ps.jail ? "D" : "Not d");
+				header_text = format_header(uname_field);
+				reset_display();
+				putchar('\r');
+				break;
 	    
 			    default:
 				new_message(MT_standout, " BAD CASE IN SWITCH!");
Index: top.X
===================================================================
RCS file: /home/cvs/src/contrib/top/top.X,v
retrieving revision 1.2
retrieving revision 1.3
diff -L contrib/top/top.X -L contrib/top/top.X -u -r1.2 -r1.3
--- contrib/top/top.X
+++ contrib/top/top.X
@@ -1,6 +1,6 @@
 .\" NOTE:  changes to the manual page for "top" should be made in the
 .\"        file "top.X" and NOT in the file "top.1".
-.\" $FreeBSD: src/contrib/top/top.X,v 1.16 2006/05/16 15:27:43 keramida Exp $
+.\" $FreeBSD: src/contrib/top/top.X,v 1.20 2007/05/04 15:42:58 rafan Exp $
 .nr N %topn%
 .nr D %delay%
 .TH TOP 1 Local
@@ -10,7 +10,7 @@
 .SH SYNOPSIS
 .B top
 [
-.B \-bCHIinqStuv
+.B \-abCHIijnqStuv
 ] [
 .BI \-d count
 ] [
@@ -78,6 +78,12 @@
 Show system processes in the display.  Normally, system processes such as
 the pager and the swapper are not shown.  This option makes them visible.
 .TP
+.B \-a
+Display command names derived from the argv[] vector, rather than real
+executable name. It's useful when you want to watch applications, that
+puts their status information there. If the real name differs from argv[0],
+it will be displayed in parenthesis.
+.TP
 .B \-b
 Use \*(lqbatch\*(rq mode.  In this mode, all input from the terminal is
 ignored.  Interrupt characters (such as ^C and ^\e) still have an effect.
@@ -96,6 +102,11 @@
 Do not display idle processes.
 By default, top displays both active and idle processes.
 .TP
+.B \-j
+Display the
+.IR jail (8)
+ID.
+.TP
 .B \-t
 Do not display the
 .I top
@@ -244,6 +255,9 @@
 .B S
 Toggle the display of system processes.
 .TP
+.B a
+Toggle the display of process titles.
+.TP
 .B k
 Send a signal (\*(lqkill\*(rq by default) to a list of processes.  This
 acts similarly to the command
@@ -277,6 +291,11 @@
 .BR I )
 Toggle the display of idle processes.
 .TP
+.B j
+Toggle the display of
+.IR jail (8)
+ID.
+.TP
 .B t
 Toggle the display of the
 .I top
@@ -302,8 +321,11 @@
 The remainder of the screen displays information about individual
 processes.  This display is similar in spirit to
 .IR ps (1)
-but it is not exactly the same.  PID is the process id, USERNAME is the name
-of the process's owner (if
+but it is not exactly the same.  PID is the process id, 
+JID, when displayed, is the 
+.IR jail (8)
+ID corresponding to the process,
+USERNAME is the name of the process's owner (if
 .B \-u
 is specified, a UID column will be substituted for USERNAME),
 PRI is the current priority of the process,


More information about the Midnightbsd-cvs mailing list