Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp81222lqr; Tue, 4 Jun 2024 22:22:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWyDAG/CXCpgXVE850S1e2sWBIYKcTSlQr+puoz239Pl+6Imr75qBtQH6gAT2XM+wxw5VYhS0hTfpaRd36Y8unE4V4Hf0eBtBx6f5FhRA== X-Google-Smtp-Source: AGHT+IEdElpFB7N6cxQh5r+G7TkF0JnSGzM36Y5YuHgySIWnPtglUyKBf2dSAA31+M4CbZAEURAX X-Received: by 2002:a81:8d0d:0:b0:627:cf27:114f with SMTP id 00721157ae682-62cbb2fbb98mr17592757b3.0.1717564959027; Tue, 04 Jun 2024 22:22:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717564959; cv=pass; d=google.com; s=arc-20160816; b=jrnU7mtGuv/sJhbz3tkdZ97F37ACE3HCw6GcihpCCVpSDXP2WKVq8qXLp1J3I6EYDf cSIc/JijPPOEh2oO84gRg6D4X6bmivMKuoLpVVbuOQxIeaPf/TyVAoTX/rvtVW7X1OAy y9EqZLFJuf+XIYAbdI2TLYPZjj2WFmn8D4EzvhIfwTyrbclNVoPmIdWhhTvgU/MK+mjF SSF73ygOltYNPo8uXWu6Oap0lbPZdNNGDh2GMkZY8Gw8i5R1Ff4mKDK7spjLmGhV/mKj X6B7rzbT0QSMfR7bwIfseGYIdSSGgPFnqJon8YyGmo/dwCK+I/HRxXfG77/gTYc9BhNr mpgQ== 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=hfkROd5Bw1AFUt4MEnz47XASvZq08V6Z3/FB1WWOTAg=; fh=7D8bWqELNqJM6KF7zbibUOya8038rGAdDMFXsJMRu8c=; b=SeZQpO0P5uW4dp24dXIZJYz9XI4gkzg3ha9x1H04WmoWweEsS6oeO+qn+Slau+XCDf ORDe292qA5m0GG0kMawRz0kRZsQY+mqx8E1APEbDGCMBhKyybRA7+8yMQ/inEgPicHJX y3NdG84MI1yfDgRv+3CO+yUknJfgEG2fdBvxxl7Jo8Q6Ln1AuGBCbS1aEaGYOA9yZCLo Qw/U8TsyVKfIR8GyYGwy+mG4IdtG0cML76kaW2mO1VogT4cb4PYQOLtW5uWeKrudXMdD n64Zilmojqaxvp19erq2YH5RToS/KlKNczhQzhuX5PbJBCmJnsri16xXSxWNNIFCNJdx u9JA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WE73wZcT; 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-201766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201766-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 af79cd13be357-79518009fb1si280459385a.253.2024.06.04.22.22.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 22:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201766-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=WE73wZcT; 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-201766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201766-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 BDA201C23DAC for ; Wed, 5 Jun 2024 05:22:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 258A413B5A4; Wed, 5 Jun 2024 05:22:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WE73wZcT" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 BE48113AD0A; Wed, 5 Jun 2024 05:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717564935; cv=none; b=u4XKqHFHZ8rvIo3jXW7qkrlmFNIPKyjLaxTNInPE1d285WjEfuFH/YTU1NdPm8UFy+rpKcMjkAX02OD6x2M2RqF5mCOCMWO9/BtZM+qbJbXjcOaQMRIr73YjeNe3JZIaptABkcNZxXY/uyZFPAGH/Z8jh7gZLbseE4dSnfJqGz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717564935; c=relaxed/simple; bh=El3YDeqjczhekPR1W+uyDSK2dsNIh5KkIWwOCQU6c88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZQvxPqJ5YApb/6wDkn2uwyhuog9IkkCmZQ62GL7O3Sv1HAPpq3z8MmPWu/DA6AU0OLbXvrQc99/bUgKx0tVz+DmjGUU6MFTP571u/FMwISwD0IwT0ZXxq1INRi/Hj/HMX1J60fJFppkViZT9acaJe0rjHp4G88+TQKqJ9GCHnQI= 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=WE73wZcT; arc=none smtp.client-ip=198.175.65.13 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=1717564934; x=1749100934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=El3YDeqjczhekPR1W+uyDSK2dsNIh5KkIWwOCQU6c88=; b=WE73wZcTyYiKoSJ75CNrqTlWdht1hd9fitNQV+Zlc+rUo6yxPub3kAGO iYa080SN6BZA4hvNQpE7464kKuemo8zaSQyoVDz8Nlc2I7WD3yqVFviEc pOCPXDuEecpML4bEW37K/LjWZct9E64b/Frh0MW+svlVR0K730Cpi306A Iu1S0/0eLv5BmV3zc+gABJPCj9bOH/pDQgSuaKpJZ2jT1PnVeAq4H5Ly7 C6DdA9yAb/jP11QWDp/QS7elSjVCB6E8U+8aTYmLdtauVX7XwS3vva0J5 DslRw0V/lJw1U8+Q+34VT6sQx2fRcw9KPns3zCfbCtC1tsXnJdwb2xE5p A==; X-CSE-ConnectionGUID: lyaRyq+/RduShXdz3sZB4A== X-CSE-MsgGUID: +Dex+yYBSXGeSoIPWYKD/Q== X-IronPort-AV: E=McAfee;i="6600,9927,11093"; a="25258794" X-IronPort-AV: E=Sophos;i="6.08,215,1712646000"; d="scan'208";a="25258794" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 22:22:11 -0700 X-CSE-ConnectionGUID: SNp05dP1Q+aaNtUzrvNe9w== X-CSE-MsgGUID: kqMQYeOnR+yDmtfaysABew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,215,1712646000"; d="scan'208";a="37525731" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by orviesa009.jf.intel.com with ESMTP; 04 Jun 2024 22:22:11 -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 v11 2/8] perf data: Allow to use given fd in data->file.fd Date: Wed, 5 Jun 2024 01:21:43 -0400 Message-ID: <20240605052200.4143205-3-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605052200.4143205-1-weilin.wang@intel.com> References: <20240605052200.4143205-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 --- 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