From patchwork Wed Feb 24 12:53:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harmandeep Kaur X-Patchwork-Id: 8405971 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 DA1A8C0553 for ; Wed, 24 Feb 2016 12:56:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F059F20165 for ; Wed, 24 Feb 2016 12:56:57 +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 042ED20274 for ; Wed, 24 Feb 2016 12:56:57 +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 1aYYxl-0008HC-Ol; Wed, 24 Feb 2016 12:54:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYYxk-0008FL-M9 for xen-devel@lists.xenproject.org; Wed, 24 Feb 2016 12:54:40 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id FE/58-04060-F08ADC65; Wed, 24 Feb 2016 12:54:39 +0000 X-Env-Sender: write.harmandeep@gmail.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1456318477!24839220!1 X-Originating-IP: [209.85.192.194] 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 14109 invoked from network); 24 Feb 2016 12:54:38 -0000 Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Feb 2016 12:54:38 -0000 Received: by mail-pf0-f194.google.com with SMTP id e127so915139pfe.3 for ; Wed, 24 Feb 2016 04:54:38 -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=vQdHd3WSivsNLKA91SIgDN5e49t+ZaXg8M1ZR30m/Og=; b=EJLxkqKogQpwORQ9BNolXoiGtotfW4cJwODWDGphvUg9T9xYjA0og0jEigBDPQ3VU3 NGtswmyKYcwGjQYrLVCsJiy9F8L6znV9S/bJBsE1QA5dW0TF74sE80Y+Uv9HJ/f10jXH OqxBzatOGYnBWglTs8nzhKy8reJJ+azThC8kexc6VpI8Rsaycs08C71TpqA7YPnSu4Hm jjO/sE+85wNIf7TfsuQbq2E52Q/Rpvsot1Wm8pi2tZ8pPBbqDtIg7bupa0ce8k6Nv8QP +wBBW6W/NRN9r9rQWgCWfHit8InRdfBQEIQqh+IjeOEGlSw3eg24WYLcKhUSOZLHyMaA 5isg== 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=vQdHd3WSivsNLKA91SIgDN5e49t+ZaXg8M1ZR30m/Og=; b=WNjtMXS9ZVIHFo7H3VVaXYTss9tVIuw7PFTExNCVhMLYpMx7bWBYRF9I0+pfMrG6Ll 7Rz9ayp142F8nYgwrLE2XToyJ6cjJi/6dM0S4UelyP2fUdImEWYiqD9//Y6XArtBePme UR2itq6asj4DQjtBksb+dRtJZG6v5JF00lQS8DnL1JHVeuZMhE/svfvozLgZasw7Mh7g FY3KZllCHY6Izzwwm6zKj1+53fOjp7+p2huif2BRjzZldxCNrEyNBeiyMum7Q214m02/ JUGKUDTsTr8tZ8NjP42Cr62nowB4wPZQJ9uG5FSr+TSdSjXDH/cfa/vjib60sgHLYQZK aN7g== X-Gm-Message-State: AG10YORR/E+r1W5OOPVfTtyVRhhEz+Qbs+Mk2hE9Nt6hOgnKjH6RejRk1dQB2QzhEz3EZQ== X-Received: by 10.98.87.80 with SMTP id l77mr54425999pfb.101.1456318477459; Wed, 24 Feb 2016 04:54:37 -0800 (PST) Received: from localhost.localdomain ([124.253.62.0]) by smtp.googlemail.com with ESMTPSA id t87sm5027294pfa.14.2016.02.24.04.54.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 04:54:37 -0800 (PST) From: Harmandeep Kaur To: xen-devel@lists.xenproject.org Date: Wed, 24 Feb 2016 18:23:26 +0530 Message-Id: <1456318407-3635-9-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 8/9] xl: Improve return and exit codes main_button_press(), main_trigger(), main_remus() and 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index f7f7d7f..9e0a467 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -374,7 +374,7 @@ static void xvasprintf(char **strp, const char *fmt, va_list ap) int r = vasprintf(strp, fmt, ap); if (r == -1) { perror("asprintf failed"); - exit(-ERROR_FAIL); + exit(EXIT_FAILURE); } } @@ -5216,7 +5216,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); @@ -6398,7 +6398,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]) { @@ -6410,7 +6410,7 @@ int main_trigger(int argc, char **argv) libxl_send_trigger(ctx, domid, trigger, vcpuid); - return 0; + return EXIT_SUCCESS; } @@ -8064,7 +8064,7 @@ int main_remus(int argc, char **argv) send_fd = open("/dev/null", O_RDWR, 0644); if (send_fd < 0) { perror("failed to open /dev/null"); - exit(-1); + exit(EXIT_FAILURE); } } else { @@ -8081,7 +8081,7 @@ int main_remus(int argc, char **argv) if (!config_len) { fprintf(stderr, "No config file stored for running domain and " "none supplied - cannot start remus.\n"); - exit(1); + exit(EXIT_FAILURE); } child = create_migration_child(rune, &send_fd, &recv_fd); @@ -8102,7 +8102,7 @@ int main_remus(int argc, char **argv) if (libxl_domain_info(ctx, 0, domid)) { fprintf(stderr, "Remus: Primary domain has been destroyed.\n"); close(send_fd); - return 0; + return EXIT_SUCCESS; } /* If we are here, it means remus setup/domain suspend/backup has @@ -8117,7 +8117,7 @@ int main_remus(int argc, char **argv) } close(send_fd); - return -ERROR_FAIL; + return EXIT_FAILURE; } #endif