summaryrefslogtreecommitdiffstats
path: root/contrib/top/top.c
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/top.c
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/top.c')
-rw-r--r--contrib/top/top.c23
1 files changed, 19 insertions, 4 deletions
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