Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3242342lqo; Tue, 21 May 2024 10:40:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUR+LbL9BPNmhn3qyumjELYswW+84JkhaS3GdCbBm2bDKe3Hlmv/VcVGmiZj2JrYOOsjwmuuGXN9uOd/4ymMMU9udHz/g8iC6BARwnlVQ== X-Google-Smtp-Source: AGHT+IFuQEB0F+xOmLj0On/gvaTfiFyYFSkZieh8WzRYJ0rd9lxK8Zmy3s+8UicJpSnAXmkqQE9o X-Received: by 2002:a05:6870:328b:b0:24c:58c6:d2b5 with SMTP id 586e51a60fabf-24c58c6dc9bmr1700869fac.53.1716313213831; Tue, 21 May 2024 10:40:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716313213; cv=pass; d=google.com; s=arc-20160816; b=WAiOrVhtNhbyvrjK3NpuXHpTkM6y2BQfKSam0/2v1ew0XLTGT4GR7k88SNhGWpe8Am 94Yza6bLqqHihhiJNnH+Ey7ELZLhEb5+sR7qBchZNjkxNj+3Z2890pkKQuES9mmEYAPi PIiK0agJHp+yF6Ftj1DHBOOJifTJupzBSjEiPzGLbb7GKCiM+YnXjrDWpNxzseJ+Q4d5 0XjTDPmVDJdEZIF0VCi0Yzx3402ENUsnP+V52xjP6olseQ4qq7YXCtPfglaW9SmciI3A pePqN7k5kqt50aqzTCY5HdyWI+JT1w4t85JkCwJBzkMTVCd8Q2FDW530tpwkpSbAH1rB JJcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CeA60BJ3paOLSQXsCzhwVeE+HsKiaCs1hpOFzR7cqCs=; fh=7D8bWqELNqJM6KF7zbibUOya8038rGAdDMFXsJMRu8c=; b=kpZSeAknhUrbIyflbC5LLYBOKzOGqHNocOe7mAeqwBmOmAZmVTEsShx6qIRZwkst+0 MLTZKe0JXXobJA/uzWfGV6mw/SAGcqrDz9OSi7dAJfBdUX1Mx2yzozaOkWoLDr0iha8N 5KrzEGi6VKT5CqT2wFhprMuADHGXUkVX65HVFcjzK9WLhB7PS8SjHDniKMnX6WdUcf+h VdZKDX37bdDyfsQeAV8OgLF2fTLIcOORwPpJu3hqPwd5eYfk1NFIeLXFZeQ1NhAvYJW+ 5aAe+FLPw5XUdKKl0npRzy6niopGQ86LTU0WkPJjE6pXP8ew4zerZ239Rb7pTGBruqYj ugtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XBIN5fdu; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-185281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df549f6d7si74540341cf.143.2024.05.21.10.40.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 10:40:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XBIN5fdu; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-185281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8AA321C21499 for ; Tue, 21 May 2024 17:40:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E22AF14884F; Tue, 21 May 2024 17:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XBIN5fdu" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F0F11482FD; Tue, 21 May 2024 17:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716313200; cv=none; b=OX3i1jkVgnZ8YPxP2qIWy5BUDp5kbMyod8mN03GUDG/du1NXjShRPTqq/98n5XSf6qPAkAi7ki1DjbSYupNSCdPRua2j0wspVhhP1e0WG+EZvjOG0N6P1jhzYsGja10RtzB9QqjNZuIzqm6HIJOYbh6iAlex72PjUUihhwcYD/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716313200; c=relaxed/simple; bh=7qISfX8pQXnp5VsCsVfGRRlPI2rRCjiR3HDByhARypk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jFwmJRtlE6fzw6wn9yaxu76hU2Qn3nmlSuW6ndyWrCCMrvZyjC2XXcTFqkc8bKix/iHX0DbrsTlFfWO5nAANSUFj9vtJkbA1gvSiKQa05hoXwljrc6jl+i7jJkHmYgnbjAEdgry0EMbhK7XKl5s0Jh+UNV/CS9MgZJnKrKokLhM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XBIN5fdu; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716313199; x=1747849199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7qISfX8pQXnp5VsCsVfGRRlPI2rRCjiR3HDByhARypk=; b=XBIN5fdu2obJ0CcMru1NdpEypALFDXqaiVDxQYMibl3GXtv2vwGD5+pD w+HQ3/kbg0YlQ8IIIejdZmUT816oecbaeC5YZnwdf29gPUK8Ay+3Skuhh aawJbcKOyMhMiAuGFC2weMkR2og+spkVFsB3I6WaHbr06aNRntNQk0i51 MCHSIcW9ME3BP6TF/96FUOfMwX/QcrgXk1UX/O0YNnxr8c8b+BuNHTCGD 0d/MuefrrXuOSM2niUnrrdXehNQoWTiEphHjy87YSnjl2CR9SvUiK6HWN btavXXswT/u5Q90Vz2/PUjIuOMVz8MCS4F84Spzl52ZXLqQCEizkG6Eab w==; X-CSE-ConnectionGUID: FtyMIl8GTyiz9cP2dXWDjw== X-CSE-MsgGUID: mhcpHtjiQ0e8FLtW5GGXwg== X-IronPort-AV: E=McAfee;i="6600,9927,11079"; a="12317651" X-IronPort-AV: E=Sophos;i="6.08,178,1712646000"; d="scan'208";a="12317651" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 10:39:57 -0700 X-CSE-ConnectionGUID: /8yrsMx0QWK5yArBIM8nDw== X-CSE-MsgGUID: teC3IRU4RwemBZuybC0lMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,178,1712646000"; d="scan'208";a="32924951" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by fmviesa007.fm.intel.com with ESMTP; 21 May 2024 10:39:57 -0700 From: weilin.wang@intel.com To: weilin.wang@intel.com, Namhyung Kim , Ian Rogers , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers Subject: [RFC PATCH v9 2/7] perf data: Allow to use given fd in data->file.fd Date: Tue, 21 May 2024 13:39:30 -0400 Message-ID: <20240521173952.3397644-3-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240521173952.3397644-1-weilin.wang@intel.com> References: <20240521173952.3397644-1-weilin.wang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Weilin Wang When in PIPE mode, allow to use fd dynamically opened and asigned to data->file.fd instead of STDIN_FILENO or STDOUT_FILENO. Signed-off-by: Weilin Wang Reviewed-by: Ian Rogers --- tools/perf/util/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 08c4bfbd817f..98661ede2a73 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -204,7 +204,12 @@ static bool check_pipe(struct perf_data *data) data->file.fd = fd; data->use_stdio = false; } - } else { + + /* + * When is_pipe and data->file.fd is given, use given fd + * instead of STDIN_FILENO or STDOUT_FILENO + */ + } else if (data->file.fd <= 0) { data->file.fd = fd; } } -- 2.43.0