[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 8/9 v2] xl : Improve return and exit codes debugging, special keys and triggering related functions.



button_press(), main_trigger(), main_sysrq(), main_debug_keys()
and main_dmesg() are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
---
v2: Add main_sysrq(), main_debug_keys(), main_dmesg()
    Remove xvasprintf(), main_remus()
---
 tools/libxl/xl_cmdimpl.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index f0b5efc..4b2ae68 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5231,7 +5231,7 @@ static void button_press(uint32_t domid, const char *b)
         trigger = LIBXL_TRIGGER_SLEEP;
     } else {
         fprintf(stderr, "%s is an invalid button identifier\n", b);
-        exit(2);
+        exit(EXIT_FAILURE);
     }
 
     libxl_send_trigger(ctx, domid, trigger, 0);
@@ -6413,7 +6413,7 @@ int main_trigger(int argc, char **argv)
     trigger_name = argv[optind++];
     if (libxl_trigger_from_string(trigger_name, &trigger)) {
         fprintf(stderr, "Invalid trigger \"%s\"\n", trigger_name);
-        return -1;
+        return EXIT_FAILURE;
     }
 
     if (argv[optind]) {
@@ -6425,7 +6425,7 @@ int main_trigger(int argc, char **argv)
 
     libxl_send_trigger(ctx, domid, trigger, vcpuid);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 
@@ -6446,12 +6446,12 @@ int main_sysrq(int argc, char **argv)
     if (sysrq[1] != '\0') {
         fprintf(stderr, "Invalid sysrq.\n\n");
         help("sysrq");
-        return 1;
+        return EXIT_FAILURE;
     }
 
     libxl_send_sysrq(ctx, domid, sysrq[0]);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_debug_keys(int argc, char **argv)
@@ -6467,10 +6467,10 @@ int main_debug_keys(int argc, char **argv)
 
     if (libxl_send_debug_keys(ctx, keys)) {
         fprintf(stderr, "cannot send debug keys: %s\n", keys);
-        return 1;
+        return EXIT_FAILURE;
     }
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_dmesg(int argc, char **argv)
@@ -6496,7 +6496,7 @@ int main_dmesg(int argc, char **argv)
 finish:
     if (cr)
         libxl_xen_console_read_finish(ctx, cr);
-    return ret;
+    return ret ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 int main_top(int argc, char **argv)
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.