xl: Add "xl top" command
PATCH 2/2 xl: Add "xl top" command
Add "xl top" command, a clone of "xm top".
Signed-off-by Yang Hongyang <[email protected]>
tools/libxl/xl_cmdimpl.c +20 -0
@@ -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 ); +}
tools/libxl/xl_cmdimpl.h +1 -0
@@ -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);
tools/libxl/xl_cmdtable.c +5 -0
@@ -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 );
Signature · 2 lines
Regards Yang Hongyang
Yang Hongyang writes ("[Xen-devel] [PATCH 2/2]xl: Add "xl top" command"):
Quoted 3 lines
Add "xl top" command, a clone of "xm top".
Signed-off-by Yang Hongyang <[email protected]>
This is mostly OK, but:
Quoted 1 line
+
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.