From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12039 invoked by alias); 23 Dec 2013 10:46:27 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 12019 invoked by uid 89); 23 Dec 2013 10:46:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail9.hitachi.co.jp Received: from mail9.hitachi.co.jp (HELO mail9.hitachi.co.jp) (133.145.228.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Dec 2013 10:46:25 +0000 Received: from mlsv7.hitachi.co.jp (unknown [133.144.234.166]) by mail9.hitachi.co.jp (Postfix) with ESMTP id B7C3237C84; Mon, 23 Dec 2013 19:46:22 +0900 (JST) Received: from mfilter03.hitachi.co.jp by mlsv7.hitachi.co.jp (8.13.1/8.13.1) id rBNAkMoE004202; Mon, 23 Dec 2013 19:46:22 +0900 Received: from vshuts02.hitachi.co.jp (vshuts02.hitachi.co.jp [10.201.6.84]) by mfilter03.hitachi.co.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id rBNAkLWv016841; Mon, 23 Dec 2013 19:46:22 +0900 Received: from gxml20a.ad.clb.hitachi.co.jp (unknown [158.213.157.160]) by vshuts02.hitachi.co.jp (Postfix) with ESMTP id 1EEFF490041; Mon, 23 Dec 2013 19:46:21 +0900 (JST) Received: from [10.198.194.57] by gxml20a.ad.clb.hitachi.co.jp (Switch-3.1.10/Switch-3.1.9) id 5BNA2AK8I0000DDB4; Mon, 23 Dec 2013 19:46:20 +0900 Message-ID: <52B81479.7070607@hitachi.com> Date: Mon, 23 Dec 2013 10:46:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (Windows NT 5.2; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Namhyung Kim Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Srikar Dronamraju , David Ahern , lkml , "Steven Rostedt (Red Hat)" , Oleg Nesterov , "David A. Long" , systemtap@sourceware.org, yrl.pp-manager.tt@hitachi.com Subject: Re: [PATCH -tip 1/3] [CLEANUP] perf-probe: Expand given path to absolute path References: <20131220100255.7169.19384.stgit@kbuild-fedora.novalocal> <20131220100257.7169.60537.stgit@kbuild-fedora.novalocal> <871u14drbf.fsf@sejong.aot.lge.com> In-Reply-To: <871u14drbf.fsf@sejong.aot.lge.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-q4/txt/msg00486.txt.bz2 (2013/12/23 15:17), Namhyung Kim wrote: > Hi Masami, > > On Fri, 20 Dec 2013 10:02:57 +0000, Masami Hiramatsu wrote: >> Expand given path to absolute path in option parser, >> except for a module name. Instead of expanding it later, >> this get the absolute path in early stage. >> >> Signed-off-by: Masami Hiramatsu >> --- >> tools/perf/builtin-probe.c | 9 +++++++++ >> tools/perf/util/probe-event.c | 11 ++--------- >> 2 files changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c >> index 6ea9e85..b40d064 100644 >> --- a/tools/perf/builtin-probe.c >> +++ b/tools/perf/builtin-probe.c >> @@ -180,6 +180,15 @@ static int opt_set_target(const struct option *opt, const char *str, >> else >> return ret; >> >> + /* Expand given path to absolute path, except for modulename */ >> + if (params.uprobes || strchr(str, '/')) { >> + str = realpath(str, NULL); >> + if (!str) { >> + pr_warning("Failed to find the path of %s.\n", >> + str); > > It won't print the path since the str already was overwritten to NULL. Oops ... >> + return ret; >> + } >> + } >> params.target = str; > > It now points either a dynamically allocated string or not.. Ah, right. OK, I'll use strdup for such case. Thank you! -- Masami HIRAMATSU IT Management Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com