summaryrefslogtreecommitdiffstats
path: root/contrib/top
diff options
context:
space:
mode:
authorrafan <rafan@FreeBSD.org>2007-04-17 03:12:39 +0000
committerrafan <rafan@FreeBSD.org>2007-04-17 03:12:39 +0000
commit3306a8a299e3b5170060a4f3551d52d929086ff2 (patch)
tree4e535601ecfa94915c8c4ffddd1c949ea023e3c7 /contrib/top
parentee0894c663d96e1c56d3709ca4bcc97931f9c57c (diff)
downloadFreeBSD-src-3306a8a299e3b5170060a4f3551d52d929086ff2.zip
FreeBSD-src-3306a8a299e3b5170060a4f3551d52d929086ff2.tar.gz
- Add a new 'j' switch and runtime option to toggle display jail id for
each process. - While I'm here, keep help message sorted by keys PR: 98489, 98975 Submitted by: clsung Approved by: delphij (mentor) MFC after: 2 weeks
Diffstat (limited to 'contrib/top')
-rw-r--r--contrib/top/commands.c3
-rw-r--r--contrib/top/machine.h1
-rw-r--r--contrib/top/top.X19
-rw-r--r--contrib/top/top.c23
4 files changed, 38 insertions, 8 deletions
diff --git a/contrib/top/commands.c b/contrib/top/commands.c
index 200f0cc..58e00fb 100644
--- a/contrib/top/commands.c
+++ b/contrib/top/commands.c
@@ -71,8 +71,9 @@ sophisticated enough to handle those commands gracefully.\n\n", stdout);
C - toggle the displaying of weighted CPU percentage\n\
d - change number of displays to show\n\
e - list errors generated by last \"kill\" or \"renice\" command\n\
-i or I - toggle the displaying of idle processes\n\
H - toggle the displaying of threads\n\
+i or I - toggle the displaying of idle processes\n\
+j - toggle the displaying of jail id\n\
k - kill processes; send a signal to a list of processes\n\
m - toggle the display between 'cpu' and 'io' modes\n\
n or # - change number of processes to display\n", stdout);
diff --git a/contrib/top/machine.h b/contrib/top/machine.h
index 17e48cd..822c9d6 100644
--- a/contrib/top/machine.h
+++ b/contrib/top/machine.h
@@ -62,6 +62,7 @@ struct process_select
int thread; /* show threads */
int uid; /* only this uid (unless uid == -1) */
int wcpu; /* show weighted cpu */
+ int jail; /* show jail id */
char *command; /* only this command (unless == NULL) */
};
diff --git a/contrib/top/top.X b/contrib/top/top.X
index 304ee91..49b6c20 100644
--- a/contrib/top/top.X
+++ b/contrib/top/top.X
@@ -10,7 +10,7 @@ top \- display and update information about the top cpu processes
.SH SYNOPSIS
.B top
[
-.B \-abCHIinqStuv
+.B \-abCHIijnqStuv
] [
.BI \-d count
] [
@@ -102,6 +102,11 @@ intelligent terminal.
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
@@ -283,6 +288,11 @@ command.
.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
@@ -308,8 +318,11 @@ It also includes information about physical and virtual memory allocation.
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,
diff --git a/contrib/top/top.c b/contrib/top/top.c
index 970d143..fbadb69 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -195,9 +195,9 @@ char *argv[];
fd_set readfds;
#ifdef ORDER
- static char command_chars[] = "\f qh?en#sdkriIutHmSCao";
+ static char command_chars[] = "\f qh?en#sdkriIutHmSCajo";
#else
- static char command_chars[] = "\f qh?en#sdkriIutHmSCa";
+ 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
@@ -222,8 +222,9 @@ char *argv[];
#define CMD_viewsys 18
#define CMD_wcputog 19
#define CMD_showargs 20
+#define CMD_jidtog 21
#ifdef ORDER
-#define CMD_order 21
+#define CMD_order 22
#endif
/* set the buffer for stdout */
@@ -255,6 +256,7 @@ char *argv[];
ps.uid = -1;
ps.thread = No;
ps.wcpu = 1;
+ ps.jail = No;
ps.command = NULL;
/* get preset options from the environment */
@@ -280,7 +282,7 @@ char *argv[];
optind = 1;
}
- while ((i = getopt(ac, av, "CSIHabinquvs:d:U:m:o:t")) != EOF)
+ while ((i = getopt(ac, av, "CSIHabijnquvs:d:U:m:o:t")) != EOF)
{
switch(i)
{
@@ -401,6 +403,10 @@ char *argv[];
ps.thread = !ps.thread;
break;
+ case 'j':
+ ps.jail = !ps.jail;
+ break;
+
default:
fprintf(stderr,
"Top version %s\n"
@@ -1055,6 +1061,15 @@ restart:
}
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!");
OpenPOWER on IntegriCloud