Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2345631lqz; Tue, 2 Apr 2024 14:46:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0Ddva+p6wEHkFFV9s+Ji2CDhWungtjM63Gwtor0Wqas52O81nCiqhA7PBHP6Mei7WXJeYtj+5iRouJOQZ9JaDreBNfzxIct8zhfeMrw== X-Google-Smtp-Source: AGHT+IHLG/HxtZgGDcrBBoVlg3C8Lvf3S4ysIWVea98IEK7IuzDwZSg6YGgJXdZTjXCtGyQ2VPcR X-Received: by 2002:a05:6402:2806:b0:566:4a85:ceba with SMTP id h6-20020a056402280600b005664a85cebamr9778042ede.1.1712094375897; Tue, 02 Apr 2024 14:46:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712094375; cv=pass; d=google.com; s=arc-20160816; b=dU+8TNifuZyNQCj87OY/zWRN96dp55A1pNstbOfv0TPktqx/uTwZcA67PhkfvBM1vx phyokGl+aDUS8U6dhUAvNbK3EN8EdvhWirbAp9W5/H6b+e/l0nVJ3GSbn/DJ44PED/Vj I4ue25YEJiXL5BE8JUEe6ijDwA7PpfIT4oZemPrsBsScYyuQG4tZrt99s/5mYTUiqhHq Hv6CGuv7QDJ5KydWZSb+HpcvSUqgZJ7MfLqKy2gGcQ+Aqga1A//JvUp0nUl5DvMX8Es2 SEmJVbxHzX6naUp4HPK6kwEfrn2tPzSGYC6C62YFFI5IB0AZX/SeDM8lei4jnAoGXN2M iYtg== 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=vjEiZYhgZ6RtSrR7Gw/Ksdhv/lv2gtufTR/6sJ0JnJ7rRnqA45etT03Itx6sMq2LmK NrN4zj82op2wn29o4/l7CvjaryoX2bXkTu1oCL9M44Df/pH6GOoeeqLQtiE6JzSBnVI0 +ZM6Le3w2v5vXPB8WdI2m5HDPIOzk7Ex+tQeDhEmOF/EBM1rAjt2Ps+U7DulSe1hIBns +0SC955l6WE1/aJmd1wImtnc6FoRUrgGxCC5qPJdH36OPecE4C7p3pxciPaga9WAJX23 FIjY6ym2AFDzecf6ZdEq4Ouv0lO9E5oY4+xJASBGBLtECghFWzPBB0vrp4iMDq/du6hj F8EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A+MAAN2D; 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-128744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128744-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v3-20020a056402348300b0056e03e52983si158974edc.10.2024.04.02.14.46.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A+MAAN2D; 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-128744-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128744-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A0F2D1F240A2 for ; Tue, 2 Apr 2024 21:46:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0591D15E81E; Tue, 2 Apr 2024 21:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="A+MAAN2D" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 988F615E5DC; Tue, 2 Apr 2024 21:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712094360; cv=none; b=R7GyxDO/zI8P88xT/oOfXfnI7r/RFuXHVJVBgQE8y0OWAxEvOzKC0gsa+NONnbUUezVh2pJBo34tSkO5eNU8h5/9n/W5re+OSTI/VU87IOzm1xJvmamPeNZw+WFT0G0VOYuQvJZxRHfzM17B6/d87r1Iiw2gSGJ6KgtHOb7cIus= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712094360; c=relaxed/simple; bh=El3YDeqjczhekPR1W+uyDSK2dsNIh5KkIWwOCQU6c88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ekkpNGpGhmXNtn92Y2I/QZ1XfpPPy1/jqHNtseXyhQ5BPkiKsWbmmRCaPRkKBBztine08lW/BODoov9lRwYtVkuNYEdRi1xL0KxkeavT4DpFiV1GJiYwX9WYC6t99MZzHnLCA9CyFV7PIw5NzM7AzMixgiYsu0YCl+bYFXFTQAY= 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=A+MAAN2D; arc=none smtp.client-ip=192.198.163.9 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=1712094358; x=1743630358; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=El3YDeqjczhekPR1W+uyDSK2dsNIh5KkIWwOCQU6c88=; b=A+MAAN2DczFen6ll4k8166sNPwT69In0OQuUrP7us64/735NtNXdnyEZ 5YI+nnWveIuOCY3XwGB+NPV5ZfBjhOeP8m2nmHP02TPLiCsyVX+XhmA8C dhAGX/PzIbITi116ad71q1ITbx88yhG+Zcgsg0s4erQDroSKD06OkAegG 7QkNgmJBOAfroth9a4+WQK0GbnY5nB9wJLIgqk/zzLIF40bJWVt07Iec4 Zej66kgiIWjAy3ZqRXs/e9k0QM6VNQSj+xJOO0YDpKam/66s6e4KHDra0 ISazi5tmtuf7IkgQEZjvg2Lr15FkLvx5O7txrOpn242SMLGRUgvyYG4Lf w==; X-CSE-ConnectionGUID: 3T9yNCSnTWi6/sFTZgqEWw== X-CSE-MsgGUID: /i6HwwxoSNGrjJbIyuSNQw== X-IronPort-AV: E=McAfee;i="6600,9927,11032"; a="18020008" X-IronPort-AV: E=Sophos;i="6.07,176,1708416000"; d="scan'208";a="18020008" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 14:45:05 -0700 X-CSE-ConnectionGUID: OXYJXYhrSS6eAJGF95FUyQ== X-CSE-MsgGUID: oJF2vaD9TDOWQZfwq61Jsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,176,1708416000"; d="scan'208";a="22849070" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by fmviesa004.fm.intel.com with ESMTP; 02 Apr 2024 14:45:03 -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 v7 2/6] perf data: Allow to use given fd in data->file.fd Date: Tue, 2 Apr 2024 17:44:32 -0400 Message-ID: <20240402214436.1409476-3-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402214436.1409476-1-weilin.wang@intel.com> References: <20240402214436.1409476-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