[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/9 v2] xl: Improve return and exit codes of pause, destroy and shutdown related functions.
destroy_domain(), wait_for_domain_deaths(), shutdown_domain(), reboot_domain(), main_pause(), main_unpause(), main_destroy() and main_shutdown_or_reboot() are fixed. Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx> --- v2: No changes. --- tools/libxl/xl_cmdimpl.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 5cedfe8..02aec34 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3705,10 +3705,10 @@ static void destroy_domain(uint32_t domid, int force) fprintf(stderr, "Not destroying domain 0; use -f to force.\n" "This can only be done when using a disaggregated " "hardware domain and toolstack.\n\n"); - exit(-1); + exit(EXIT_FAILURE); } rc = libxl_domain_destroy(ctx, domid, 0); - if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); } + if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(EXIT_FAILURE); } } static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr) @@ -3720,7 +3720,7 @@ static void wait_for_domain_deaths(libxl_evgen_domain_death **deathws, int nr) rc = libxl_event_wait(ctx, &event, LIBXL_EVENTMASK_ALL, 0,0); if (rc) { LOG("Failed to get event, quitting (rc=%d)", rc); - exit(-1); + exit(EXIT_FAILURE); } switch (event->type) { @@ -3765,14 +3765,14 @@ static void shutdown_domain(uint32_t domid, } if (rc) { - fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1); + fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(EXIT_FAILURE); } if (deathw) { rc = libxl_evenable_domain_death(ctx, domid, for_user, deathw); if (rc) { fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc); - exit(-1); + exit(EXIT_FAILURE); } } } @@ -3796,14 +3796,14 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw, } } if (rc) { - fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1); + fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(EXIT_FAILURE); } if (deathw) { rc = libxl_evenable_domain_death(ctx, domid, for_user, deathw); if (rc) { fprintf(stderr,"wait for death failed (evgen, rc=%d)\n",rc); - exit(-1); + exit(EXIT_FAILURE); } } } @@ -4802,7 +4802,7 @@ int main_pause(int argc, char **argv) pause_domain(find_domain(argv[optind])); - return 0; + return EXIT_SUCCESS; } int main_unpause(int argc, char **argv) @@ -4815,7 +4815,7 @@ int main_unpause(int argc, char **argv) unpause_domain(find_domain(argv[optind])); - return 0; + return EXIT_SUCCESS; } int main_destroy(int argc, char **argv) @@ -4830,7 +4830,7 @@ int main_destroy(int argc, char **argv) } destroy_domain(find_domain(argv[optind]), force); - return 0; + return EXIT_SUCCESS; } static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) @@ -4862,7 +4862,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) if (!argv[optind] && !all) { fprintf(stderr, "You must specify -a or a domain id.\n\n"); - return opt; + return EXIT_FAILURE; } if (all) { @@ -4870,7 +4870,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) libxl_evgen_domain_death **deathws = NULL; if (!(dominfo = libxl_list_domain(ctx, &nb_domain))) { fprintf(stderr, "libxl_list_domain failed.\n"); - return -1; + return EXIT_FAILURE; } if (wait_for_it) @@ -4901,7 +4901,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) } - return 0; + return EXIT_SUCCESS; } int main_shutdown(int argc, char **argv) -- 2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |