From patchwork Fri Apr 8 02:23:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8779701 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 8405DC0553 for ; Fri, 8 Apr 2016 02:25:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B59FF20263 for ; Fri, 8 Apr 2016 02:25:50 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D046A2025B for ; Fri, 8 Apr 2016 02:25:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoM5e-0005Bi-4l; Fri, 08 Apr 2016 02:24:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoM5c-0005B8-CB for xen-devel@lists.xenproject.org; Fri, 08 Apr 2016 02:24:04 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id AA/0B-04050-34617075; Fri, 08 Apr 2016 02:24:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRWlGSWpSXmKPExsXiVRvkouskxh5 u8HChocX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrHwUhtjwW2hirttO5gbGC/zdTFycQgJTGWU WNG9jxnEYRFYwyrRN/M8I4gjIXCJVWLS9RWsXYycQE6MxNLFzVB2qcSc7R9YQGwhARWJm9tXM UGMWsgk8ebqEkaQhLCAnsSRoz/YIWwviVPHJ4I1sAkYSLzZsRdskIiAksS9VZOZQGxmgUqJ9Y 1/wepZBFQl1t2fCVbPK2AncfPZbDYQm1PAXuL633tAp3IALbOTuPpADiQsKiAnsfJyCytEuaD EyZlPWEBKmAU0Jdbv0oeYLi+x/e0c5gmMIrOQVM1CqJqFpGoBI/MqRvXi1KKy1CJdC72kosz0 jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMDgZwCCHYwX2p0PMUpyMCmJ8vrwsYcL8SXlp 1RmJBZnxBeV5qQWH2KU4eBQkuDNFQXKCRalpqdWpGXmAOMQJi3BwaMkwusPkuYtLkjMLc5Mh0 idYtTl2DL13lomIZa8/LxUKXFecZAiAZCijNI8uBGwlHCJUVZKmJcR6CghnoLUotzMElT5V4z iHIxKwrymIFN4MvNK4Da9AjqCCeiIC/xsIEeUJCKkpBoYg6//XpfLfzLHNiq7u9tNUqIliiXy 4NJiPQHp849lUl/G9CRVHVINOMt0+GTDrHC1M99qL67+teO0xd2lp57aSF5hPn+fd/0usV/7P 9l9ElSefcOIVX7Kv1cJC+4rpE45vfpunJkmI1PF4wsC7H/km7a2LeG/ss+wJHpFQYxobf+N8l VMzzx9lViKMxINtZiLihMB32El9QQDAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1460082242!7416006!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64630 invoked from network); 8 Apr 2016 02:24:02 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 8 Apr 2016 02:24:02 -0000 Received: by mail-wm0-f68.google.com with SMTP id n3so958020wmn.1 for ; Thu, 07 Apr 2016 19:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=A4wbHaLJDgfqcgNvYHU69m6jTdWNoS8SQYkmxxPJHk4=; b=w97Ns5CMggVHzIdJyDC3rEbl4J2GS75x6sBY4mmG57PgfMtkn6Ss1+lvju2jLEvs7M 8RrrFEl+lOdkIm9NNQNzY3ZkN4HAP9hdZGwPe5zAd6wi1ibp2xD39u+WpgsLB7viutEq jR710CA8ElHTPDd+GzN5klZfF8f1onbbbOYyJ567XascbSdxrWOTl9EF8rbW7NhRrec8 QMFp71vuPnEWBnJ7uTxsq2Amca8BrYQY+zq+MnJER+8tLaUngQRmaNAV467rgDtm82CJ kWDKGt1u/FvBKmhC6ugxw/VksAmkgmxfjwcftg2FzHV/7Rk8TWLHezzI9suD8574s3l0 q8Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=A4wbHaLJDgfqcgNvYHU69m6jTdWNoS8SQYkmxxPJHk4=; b=FwxYeleBSv9NKmxstpbTGrKhHQnZqjdw6YCxjY05zpnbhU8mSnHN0IxRSfG3X3xdyK 3paMcAP98F8QeJBCMmybdFPXfb7ollPv8zLW5pQxL2UrGmI9j8ZSc5I47d4fAEf5yd39 FqatjDXwNztQbE7q2GuUCMhPuUk3fcGV5cpDUeOtca45PYC7psZm69h1zM1CPA5u0adB GqYuialoePNRgWMCsKhsSm0Wu3s/64gmFbm1NdzHypvfkE+Io0Kl8MQ7wGT6dIPauU2Q 33hW3If7uAsRgx/moZKrGfsw75jDarDVNA6B434H52Qt2L6WWxPklgB1TUxlgu8a/MnA w2+w== X-Gm-Message-State: AD7BkJKYM2S/0Vv7U+8mW1dKadwaam37NG6qyipwqQqiNlOvFe5b2eux+eLKyADOB1Y7Fw== X-Received: by 10.28.125.8 with SMTP id y8mr787015wmc.87.1460082242520; Thu, 07 Apr 2016 19:24:02 -0700 (PDT) Received: from Solace.fritz.box (net-37-116-155-252.cust.vodafonedsl.it. [37.116.155.252]) by smtp.gmail.com with ESMTPSA id y3sm690068wmy.17.2016.04.07.19.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Apr 2016 19:24:01 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 08 Apr 2016 04:23:59 +0200 Message-ID: <20160408022359.9058.49742.stgit@Solace.fritz.box> In-Reply-To: <20160408022241.9058.86808.stgit@Solace.fritz.box> References: <20160408022241.9058.86808.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , Ian Jackson , Harmandeep Kaur Subject: [Xen-devel] [PATCH v3 4/6] xl : improve exit codes of debug related functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 From: Harmandeep Kaur by making them more consistent with other examples in xl. Signed-off-by: Harmandeep Kaur Signed-off-by: Dario Faggioli Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu --- v3: Shorten changelog. 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 4a560d7..823cb46 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5561,7 +5561,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); @@ -7058,7 +7058,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]) { @@ -7070,7 +7070,7 @@ int main_trigger(int argc, char **argv) libxl_send_trigger(ctx, domid, trigger, vcpuid); - return 0; + return EXIT_SUCCESS; } @@ -7091,12 +7091,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) @@ -7112,10 +7112,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) @@ -7141,7 +7141,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)