From patchwork Mon Mar 2 18:03:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 11415949 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4C6E92A for ; Mon, 2 Mar 2020 18:03:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC1F024673 for ; Mon, 2 Mar 2020 18:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgCBSDi (ORCPT ); Mon, 2 Mar 2020 13:03:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:41124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgCBSDi (ORCPT ); Mon, 2 Mar 2020 13:03:38 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB8A621D56 for ; Mon, 2 Mar 2020 18:03:37 +0000 (UTC) Date: Mon, 2 Mar 2020 13:03:36 -0500 From: Steven Rostedt To: Linux Trace Devel Subject: [PATCH] trace-cmd: Have trace-cmd record -c set function-fork option if exists Message-ID: <20200302130336.4b6c63e5@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: "Steven Rostedt (VMware)" If the function-fork option exists on the machine, then it should be set if '-c' is added to trace-cmd record. Othrewise the function tracers will not trace the children of the process it is recording. Signed-off-by: Steven Rostedt (VMware) --- tracecmd/trace-record.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 0a3851ad..2866b776 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -128,6 +128,7 @@ static int len_filter_pids; static int have_set_event_pid; static int have_event_fork; +static int have_func_fork; struct opt_list { struct opt_list *next; @@ -354,6 +355,14 @@ static void test_set_event_pid(void) } tracefs_put_tracing_file(path); + path = tracefs_get_tracing_file("options/function-fork"); + ret = stat(path, &st); + if (!ret) { + have_func_fork = 1; + reset_save_file(path, RESET_DEFAULT_PRIO); + } + tracefs_put_tracing_file(path); + tested = 1; } @@ -5595,6 +5604,8 @@ static void parse_record_options(int argc, save_option("event-fork"); ctx->do_child = 1; } + if (have_func_fork) + save_option("function-fork"); break; case 'C': ctx->instance->clock = optarg;