Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4296194pxb; Mon, 8 Feb 2021 12:44:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqjKLxfxFYrTwGfdC+WZT8C/Qo+l09wMZ4sWxjaUsi1n+C2f1noTnSBp2vew6fO4KACfHT X-Received: by 2002:a17:906:6095:: with SMTP id t21mr18672250ejj.384.1612817078655; Mon, 08 Feb 2021 12:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612817078; cv=none; d=google.com; s=arc-20160816; b=JMEMbyn1OJwpiz1kfvFIORbsCByCkP5Sb+sjDZpZQS+9Sz9DAYwzo57zhbCAy629TW YxFkcY25VFzJchO+rOaBTdnHCJq+nBXV9k61NHddnKyxZL9ZxCCgBiPksBEupKzqPYyz 9Ur4f9wfcpv5/5QduDzwMqYY60kuSAmAqeMzPb+GiwWcnNBEd/PSxPWuWHJpjSBT01jy 9VNIX5QCXIZloqjVbNj9GYlvPlkFoV+XIzoiE9en68xvSxduHIHJSCS4ZeY3ll4bOtJD fZDDhjIdexY7hwAJJuRagQUqQj9kmSNo3vxA6SGgnlccZb7aa368lSP8a7oCj5gk4wre l6mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lkIN42+3rMOS2pZmi3jp8vwb4hEunJcbnkYRSe6Dt18=; b=xEmsy3CSWjZVeJdlcshu3HAPVt7jChGvipQTpvZS+rXfY2N+GoCU/oq9W1Yic82hMm odgHdQDc0e8d1LyUXYAvzg1c00IlG+VGIlEc3Pthvx6IAekmPbPaN6PRqRVe0XE10W9R uA3wk1QuKmGtc9o1xq2LzA1Lo8l07dMZgXfORzBrQSEZ0ZpyrYZ33j8bUwCSgY+o7D6h OVeWEmtX4jRsjRdspKy3bEvqohfJ6p+0PKajvN8DvmwjU1Idkk86KHtOfwTeYbJYUqqX DYyvettoLzjevtswnmvi0hqrzqqsXfPJOBRnDGwPf9WOwRABSP/etHzLklIUXo4+XT/S blqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aUW6F0qp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h28si2474592edj.309.2021.02.08.12.44.13; Mon, 08 Feb 2021 12:44:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aUW6F0qp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbhBHUm3 (ORCPT + 99 others); Mon, 8 Feb 2021 15:42:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:40344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236327AbhBHT3q (ORCPT ); Mon, 8 Feb 2021 14:29:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5511E64E8F; Mon, 8 Feb 2021 19:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612812544; bh=Cvo5fk94tAJuS0PSMjlJnRizZOjsCEwXtSadq5Inv48=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aUW6F0qpJgWDvCfAbGdDG72EDh45tJqA4GHIAMUm4I6MVAg3gRtMzHynpPcXHHHTP sG9MMkz4Ilt4FL/qZScOdi4hDvpihUjfWv3ZayW4JpDJ3IY7Vsx5Ox1Q3Tl/jUsU9c /qkUG7Ua49SHofwPrJvwK+UVRGmZLUiVwOwK/ZkSV1G4U8Uuw33EXo14405TXvWdya iSJjAuVggf0pQ+1ttS72bXHFDEr1b0xshVig3dEtRzyV6lYY7er5eTgFHJ7dKbsemD /Hd8DS8owl/bMw0Yck4NGLGOB0mquyo1H344tnuVu3ahAXD4ig6sv/KjZy+UU4RgMZ 4Nzv/RIXFewng== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 284CF40513; Mon, 8 Feb 2021 16:29:02 -0300 (-03) Date: Mon, 8 Feb 2021 16:29:02 -0300 From: Arnaldo Carvalho de Melo To: Paul Cercueil Cc: Jiri Olsa , Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , Namhyung Kim , od@zcrc.me, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] perf stat: Use nftw() instead of ftw() Message-ID: <20210208192902.GR920417@kernel.org> References: <20210208181157.1324550-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210208181157.1324550-1-paul@crapouillou.net> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > > 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