From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
od@zcrc.me, linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] perf stat: Use nftw() instead of ftw()
Date: Mon, 8 Feb 2021 16:29:02 -0300 [thread overview]
Message-ID: <20210208192902.GR920417@kernel.org> (raw)
In-Reply-To: <20210208181157.1324550-1-paul@crapouillou.net>
Em Mon, Feb 08, 2021 at 06:11:57PM +0000, Paul Cercueil escreveu:
> ftw() has been obsolete for about 12 years now.
>
> Fixes: bb1c15b60b98 ("perf stat: Support regex pattern in --for-each-cgroup")
> CC: stable@vger.kernel.org
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>
> Notes:
> NOTE: Not runtime-tested, I have no idea what I need to do in perf
> to test this. But at least it compiles now with my uClibc-based
> toolchain.
Seems safe from reading the nftw() man page, the only typeflag that this
code is using is FTW_D and that is present in both ftw() and nftw().
Applying,
- Arnaldo
> tools/perf/util/cgroup.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
> index 5dff7e489921..f24ab4585553 100644
> --- a/tools/perf/util/cgroup.c
> +++ b/tools/perf/util/cgroup.c
> @@ -161,7 +161,7 @@ void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup)
>
> /* helper function for ftw() in match_cgroups and list_cgroups */
> static int add_cgroup_name(const char *fpath, const struct stat *sb __maybe_unused,
> - int typeflag)
> + int typeflag, struct FTW *ftwbuf __maybe_unused)
> {
> struct cgroup_name *cn;
>
> @@ -209,12 +209,12 @@ static int list_cgroups(const char *str)
> if (!s)
> return -1;
> /* pretend if it's added by ftw() */
> - ret = add_cgroup_name(s, NULL, FTW_D);
> + ret = add_cgroup_name(s, NULL, FTW_D, NULL);
> free(s);
> if (ret)
> return -1;
> } else {
> - if (add_cgroup_name("", NULL, FTW_D) < 0)
> + if (add_cgroup_name("", NULL, FTW_D, NULL) < 0)
> return -1;
> }
>
> @@ -247,7 +247,7 @@ static int match_cgroups(const char *str)
> prefix_len = strlen(mnt);
>
> /* collect all cgroups in the cgroup_list */
> - if (ftw(mnt, add_cgroup_name, 20) < 0)
> + if (nftw(mnt, add_cgroup_name, 20, 0) < 0)
> return -1;
>
> for (;;) {
> --
> 2.30.0
>
--
- Arnal
next prev parent reply other threads:[~2021-02-08 20:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 18:11 [PATCH] perf stat: Use nftw() instead of ftw() Paul Cercueil
2021-02-08 19:29 ` Arnaldo Carvalho de Melo [this message]
2021-02-10 9:14 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210208192902.GR920417@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=od@zcrc.me \
--cc=paul@crapouillou.net \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).