From patchwork Wed Mar 1 05:27:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 9597739 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D00A604DC for ; Wed, 1 Mar 2017 07:31:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F61D28405 for ; Wed, 1 Mar 2017 07:31:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32ABC28174; Wed, 1 Mar 2017 07:31:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C245F28174 for ; Wed, 1 Mar 2017 07:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751009AbdCAHbl (ORCPT ); Wed, 1 Mar 2017 02:31:41 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:35514 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbdCAHbi (ORCPT ); Wed, 1 Mar 2017 02:31:38 -0500 Received: by mail-qk0-f194.google.com with SMTP id n127so8659235qkf.2 for ; Tue, 28 Feb 2017 23:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references:reply-to:organization; bh=QkBuifa2vVou1Q8FHp8yXkoStFK0SQ4YWDxsv8m+elU=; b=d3q8ig9S+lsrXUakxt2Rpm53KtMdB29S+ByhLNDe73btXtdp6kdOAjJtSwV3U7A3Wn d/Rll5LzzXTXk4FkWHoWSf79M6n7V4lvmpE/cxNAcadfKExzUWoJUlALTr6KjLJV5NC2 ja2TAKt4Zix0R6zXoDWWT6QznhEK5/yaj5dnk1E+AtWFgv5Cwt+BEvC/ZzQ60KyGckJF yCCV3R6dl6aV04MQ7SY3zgm04uIolmwIvvnAaf1UsjhOaJV8S4Pr0TDGQOsOpDlxvQ7Y HiAhEl0etPmvLbbufH/H5jh2ZV9RiPQVSO2L3r3B+fZyzNRIBpEJDsNxcVanvBECh2/g Nl7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:reply-to:organization; bh=QkBuifa2vVou1Q8FHp8yXkoStFK0SQ4YWDxsv8m+elU=; b=UvTpNAzAt0Ji8bCcfn/9NgN2nJLiDVew36dxmahXoB3yJXlXEaBRFX/TTg124C+euz e1ZAnMZjvmgjagur0rPa7LVeXXpAoJWAgzw+kfLTfo1PGafOzaXOXRpm9xZehPjqMMqk EJzM5UKwcY1NsWvgdoLUPw8EoRfu5vxLHYbwEOXgOojLFGREJCaLfqL6Zcp9qv5FKSZ9 3QuFlPS8PBV5zHS6OM/8EXk6WkWAjZyqylwhC3ZkigEZ47BEMVTcbSkLHDDhbxtDERTb 2ZQ0fg5GBgKb+YPv9w8IhHtlKjOBqsi7idGlig0VnBXDmNrM+sNFngdf0+448BZZ5Hv0 QS2Q== X-Gm-Message-State: AMke39mzJ/8AfpOHwORrTQQV5bwhCyxzmK4eZ5x/paZwmw+Z2qlb243VMUayDhzcKbFYpA== X-Received: by 10.55.43.213 with SMTP id r82mr7809299qkr.196.1488346131567; Tue, 28 Feb 2017 21:28:51 -0800 (PST) Received: from z87.localdomain (pool-96-230-116-151.bstnma.fios.verizon.net. [96.230.116.151]) by smtp.gmail.com with ESMTPSA id c141sm2530517qkb.10.2017.02.28.21.28.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 21:28:51 -0800 (PST) From: Len Brown To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH 42/44] tools/power turbostat: show error on exec Date: Wed, 1 Mar 2017 00:27:46 -0500 Message-Id: <0815a3d09baf2cd330f75020bdaad0f1adac0ecb.1488345270.git.len.brown@intel.com> X-Mailer: git-send-email 2.11.0.161.g6610af872 In-Reply-To: <20170301052748.27810-1-lenb@kernel.org> References: <20170301052748.27810-1-lenb@kernel.org> In-Reply-To: <678a3bd1b3de6d2ebf604e7d708bc8150bb667e9.1488345270.git.len.brown@intel.com> References: <678a3bd1b3de6d2ebf604e7d708bc8150bb667e9.1488345270.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Len Brown When turbostat is run in one-shot command mode, the parent takes the 'before' counter snapshot, fork/exec/wait for the child to exit, takes the 'after' counter snapshot, and prints the results. however, if the child fails to exec the command, it immediately returns, without indicating that anythign was wrong. Add an error message showing that exec failed: sudo turbostat sleeeep 4 ... turbostat: exec sleeeep: No such file or directory ... Note that the parent will still print out the statistics, because it can't tell the difference between the failed exec and a command that is purposefully returning the same status. Unfortunately, this may obscure the error message. However, if the --out parameter is used, the error message is evident on stderr. Reported-by: Wendy Wang Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 7af5f42a9792..2d758abecd56 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4525,6 +4525,7 @@ int fork_it(char **argv) if (!child_pid) { /* child */ execvp(argv[0], argv); + err(errno, "exec %s", argv[0]); } else { /* parent */