From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752583AbdFTJJC (ORCPT ); Tue, 20 Jun 2017 05:09:02 -0400 Received: from terminus.zytor.com ([65.50.211.136]:52253 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbdFTJI7 (ORCPT ); Tue, 20 Jun 2017 05:08:59 -0400 Date: Tue, 20 Jun 2017 02:05:18 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, peterz@infradead.org, mhiramat@kernel.org, namhyung@kernel.org, mingo@kernel.org, acme@redhat.com, hpa@zytor.com, tglx@linutronix.de, jolsa@kernel.org Reply-To: acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, mhiramat@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, rostedt@goodmis.org, mingo@kernel.org, namhyung@kernel.org In-Reply-To: <20170618142302.25390-1-namhyung@kernel.org> References: <20170618142302.25390-1-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf ftrace: Show error message when fails to set ftrace files Git-Commit-ID: e7bd9ba20a9ec7024a0566a93c22b9571a48939a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e7bd9ba20a9ec7024a0566a93c22b9571a48939a Gitweb: http://git.kernel.org/tip/e7bd9ba20a9ec7024a0566a93c22b9571a48939a Author: Namhyung Kim AuthorDate: Sun, 18 Jun 2017 23:22:59 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 19 Jun 2017 22:05:51 -0300 perf ftrace: Show error message when fails to set ftrace files It'd be better for debugging to show an error message when it fails to setup ftrace for some reason. Signed-off-by: Namhyung Kim Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Peter Zijlstra Cc: Steven Rostedt Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170618142302.25390-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-ftrace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 9e0b35c..966a94f 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -61,6 +61,7 @@ static int __write_tracing_file(const char *name, const char *val, bool append) int fd, ret = -1; ssize_t size = strlen(val); int flags = O_WRONLY; + char errbuf[512]; file = get_tracing_file(name); if (!file) { @@ -75,14 +76,16 @@ static int __write_tracing_file(const char *name, const char *val, bool append) fd = open(file, flags); if (fd < 0) { - pr_debug("cannot open tracing file: %s\n", name); + pr_debug("cannot open tracing file: %s: %s\n", + name, str_error_r(errno, errbuf, sizeof(errbuf))); goto out; } if (write(fd, val, size) == size) ret = 0; else - pr_debug("write '%s' to tracing/%s failed\n", val, name); + pr_debug("write '%s' to tracing/%s failed: %s\n", + val, name, str_error_r(errno, errbuf, sizeof(errbuf))); close(fd); out: