From: Paul Cercueil <p...@crapouillou.net>

commit a81fbb8771a3810a58d657763fde610bf2c33286 upstream.

ftw() has been obsolete for about 12 years now.

Committer notes:

Further notes provided by the patch author:

    "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."

I looked at the nftw()/ftw() man page and for the use made with cgroups
in 'perf stat' the end result is equivalent.

Fixes: bb1c15b60b98 ("perf stat: Support regex pattern in --for-each-cgroup")
Signed-off-by: Paul Cercueil <p...@crapouillou.net>
Cc: Alexander Shishkin <alexander.shish...@linux.intel.com>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: o...@zcrc.me
Cc: sta...@vger.kernel.org
Link: http://lore.kernel.org/lkml/20210208181157.1324550-1-p...@crapouillou.net
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 tools/perf/util/cgroup.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -161,7 +161,7 @@ void evlist__set_default_cgroup(struct e
 
 /* 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 (;;) {


Reply via email to