From patchwork Wed Feb 24 12:53:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harmandeep Kaur X-Patchwork-Id: 8405941 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1C068C0553 for ; Wed, 24 Feb 2016 12:56:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2248F20165 for ; Wed, 24 Feb 2016 12:56:52 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BB2A2011D for ; Wed, 24 Feb 2016 12:56:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYYxb-00087k-KN; Wed, 24 Feb 2016 12:54:31 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYYxZ-00086O-Dh for xen-devel@lists.xenproject.org; Wed, 24 Feb 2016 12:54:29 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id CC/15-02983-408ADC65; Wed, 24 Feb 2016 12:54:28 +0000 X-Env-Sender: write.harmandeep@gmail.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1456318466!24678889!1 X-Originating-IP: [209.85.220.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57805 invoked from network); 24 Feb 2016 12:54:27 -0000 Received: from mail-pa0-f68.google.com (HELO mail-pa0-f68.google.com) (209.85.220.68) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Feb 2016 12:54:27 -0000 Received: by mail-pa0-f68.google.com with SMTP id y7so876509paa.0 for ; Wed, 24 Feb 2016 04:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ueZHVu3fBLOQyn1FVs0OLiKHUgY003t9KoeWMV2vyLw=; b=akeH5ON+9meFr0bjGDf8UzLJZVrAQcWTOdtf6IJiEmwo2bjeOnChTfdhwZgHdenj8l Sx15v7AXurC0wnouLUD0KffWSlVnhXHpHVrABUoiPRD8GnaRsd/D/OMThKtG8fDCvZ3g B7cLjzHtywU1j/osspQEsOcexvD00DuQMwSHXoiuMR1WXlT/1QhReLwax2Vjdvdcm83J zmkwWMO53B6TQA7n+9BK4nToOLJxYyV/2/b7705C3t8Jz5HbtOoRuVUGvGR1UDL2rFaX w64ucDgmhNyg75vBQ6rzSQlyxplfbRO3j9CXmcD27nzfOVFZx/NDDRtuj/7Bc8e4BBJA 5tGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ueZHVu3fBLOQyn1FVs0OLiKHUgY003t9KoeWMV2vyLw=; b=ZRQ4zHnvi0ktI92QSIVuhBlRlXZLWZjVEuMg9SNXflYZrRJ1+3xa3wwAKJV27893D5 88pqvQNZlFMRZcQDul69qKXb7oNWKGnYi8/RTvhzFYYuxpdNcHvVdO0EO0dxNaVmxCCK poKOHtcFYa0y571lCR6PFFlx4+bNZyoimzBhJb/VOSmJRxhjx+WbSBtSBJXKnFW8BsEF fls5oHqgpNL9tjzL/bs8QFovlF5TNNZfghCsklAqk7vW62PYNZQK90VyHRD03xaxCEhr YisRROeSY8ZNq40M0NiXaHp/FN+ABCzOpgEPlX7hlo6WUwUTleTTFM0UmcmSF5CjokAU qY9A== X-Gm-Message-State: AG10YOTIf4mg2hutPx4oaxLbZPXl2Mff7JTHePAYQDn1zWvpkPun1Wtov0X/+agr9GqWzA== X-Received: by 10.66.218.196 with SMTP id pi4mr54292400pac.147.1456318466491; Wed, 24 Feb 2016 04:54:26 -0800 (PST) Received: from localhost.localdomain ([124.253.62.0]) by smtp.googlemail.com with ESMTPSA id t87sm5027294pfa.14.2016.02.24.04.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 04:54:26 -0800 (PST) From: Harmandeep Kaur To: xen-devel@lists.xenproject.org Date: Wed, 24 Feb 2016 18:23:23 +0530 Message-Id: <1456318407-3635-6-git-send-email-write.harmandeep@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456318407-3635-1-git-send-email-write.harmandeep@gmail.com> References: <1456318407-3635-1-git-send-email-write.harmandeep@gmail.com> Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, Harmandeep Kaur Subject: [Xen-devel] [PATCH 5/9] xl: Improve return and exit codes of main_pause(), main_unpause(), main_destroy() and main_shutdown_or_reboot() related functions. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Harmandeep Kaur --- 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 e1b4286..b4920ff 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3696,10 +3696,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) @@ -3711,7 +3711,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) { @@ -3756,14 +3756,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); } } } @@ -3787,14 +3787,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); } } } @@ -4787,7 +4787,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) @@ -4800,7 +4800,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) @@ -4815,7 +4815,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) @@ -4847,7 +4847,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) { @@ -4855,7 +4855,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) @@ -4886,7 +4886,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)