* [PATCH 2/2]xl: Add "xl top" command
@ 2010-05-12 2:53 Yang Hongyang
2010-05-21 10:29 ` Ian Jackson
0 siblings, 1 reply; 2+ messages in thread
From: Yang Hongyang @ 2010-05-12 2:53 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
Add "xl top" command, a clone of "xm top".
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
diff -r feb1b75800d6 -r 0efa1c583fb0 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Wed May 12 18:35:58 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.c Wed May 12 18:47:12 2010 +0800
@@ -3098,3 +3098,23 @@
exit(0);
}
+
+int main_top(int argc, char **argv)
+{
+ int opt;
+
+ while ((opt = getopt(argc, argv, "h")) != -1) {
+ switch (opt) {
+ case 'h':
+ help("top");
+ exit(0);
+ default:
+ fprintf(stderr, "option `%c' not supported.\n", opt);
+ break;
+ }
+ }
+
+ system("xentop");
+
+ exit(0);
+}
diff -r feb1b75800d6 -r 0efa1c583fb0 tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h Wed May 12 18:35:58 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.h Wed May 12 18:47:12 2010 +0800
@@ -40,5 +40,6 @@
int main_rename(int argc, char **argv);
int main_trigger(int argc, char **argv);
int main_sysrq(int argc, char **argv);
+int main_top(int argc, char **argv);
void help(char *command);
diff -r feb1b75800d6 -r 0efa1c583fb0 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Wed May 12 18:35:58 2010 +0800
+++ b/tools/libxl/xl_cmdtable.c Wed May 12 18:47:12 2010 +0800
@@ -177,6 +177,11 @@
"Send a sysrq to a domain",
"<Domain> <letter>",
},
+ { "top",
+ &main_top,
+ "Monitor a host and the domains in real time",
+ "",
+ },
};
int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);
--
Regards
Yang Hongyang
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2]xl: Add "xl top" command
2010-05-12 2:53 [PATCH 2/2]xl: Add "xl top" command Yang Hongyang
@ 2010-05-21 10:29 ` Ian Jackson
0 siblings, 0 replies; 2+ messages in thread
From: Ian Jackson @ 2010-05-21 10:29 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
Yang Hongyang writes ("[Xen-devel] [PATCH 2/2]xl: Add "xl top" command"):
> Add "xl top" command, a clone of "xm top".
>
> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
This is mostly OK, but:
> + system("xentop");
1. You should probably use execlp rather than system.
2. You do not check the return value. This is a serious mistake.
Ian.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-21 10:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 2:53 [PATCH 2/2]xl: Add "xl top" command Yang Hongyang
2010-05-21 10:29 ` Ian Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.