From patchwork Wed Dec 16 22:00:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 11978647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88461C0018C for ; Wed, 16 Dec 2020 22:02:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CF6B238A0 for ; Wed, 16 Dec 2020 22:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730009AbgLPWBr (ORCPT ); Wed, 16 Dec 2020 17:01:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:43714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730003AbgLPWBp (ORCPT ); Wed, 16 Dec 2020 17:01:45 -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 0DB1B2389E for ; Wed, 16 Dec 2020 22:01:05 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.94) (envelope-from ) id 1kper2-000wjp-1n for linux-trace-devel@vger.kernel.org; Wed, 16 Dec 2020 17:01:04 -0500 Message-ID: <20201216220103.883960678@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 16 Dec 2020 17:00:33 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Subject: [PATCH 1/3] trace-cmd: Move add_event_pid() out of #ifndef NO_PTRACE References: <20201216220032.809666622@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: "Steven Rostedt (VMware)" When NO_PTRACE is defined, add_event_pid() is also not defined, but it is used outside of NO_PTRACE pre processor block. And this causes a "add_event_pid" not defined build failure. Fixes: 0844cff1c ("trace-cmd: Fix "trace-cmd reset" command to restore the default value of set_event_pid") Signed-off-by: Steven Rostedt (VMware) --- tracecmd/trace-record.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index f8baed7dcd47..e2d1cedf05fb 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -1312,8 +1312,13 @@ out: free(pidfds); return ret; } -#ifndef NO_PTRACE +static void add_event_pid(struct buffer_instance *instance, const char *buf) +{ + tracefs_instance_file_write(instance->tracefs, "set_event_pid", buf); +} + +#ifndef NO_PTRACE /** * append_pid_filter - add a new pid to an existing filter * @curr_filter: the filter to append to. If NULL, then allocate one @@ -1369,11 +1374,6 @@ static void update_sched_events(struct buffer_instance *instance, int pid) static int open_instance_fd(struct buffer_instance *instance, const char *file, int flags); -static void add_event_pid(struct buffer_instance *instance, const char *buf) -{ - tracefs_instance_file_write(instance->tracefs, "set_event_pid", buf); -} - static void add_new_filter_child_pid(int pid, int child) { struct buffer_instance *instance; From patchwork Wed Dec 16 22:00:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 11978645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF28C1B0D8 for ; Wed, 16 Dec 2020 22:02:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 361F02389E for ; Wed, 16 Dec 2020 22:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729840AbgLPWBr (ORCPT ); Wed, 16 Dec 2020 17:01:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:43728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730009AbgLPWBq (ORCPT ); Wed, 16 Dec 2020 17:01:46 -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 64143238E2 for ; Wed, 16 Dec 2020 22:01:05 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.94) (envelope-from ) id 1kper2-000wko-E4 for linux-trace-devel@vger.kernel.org; Wed, 16 Dec 2020 17:01:04 -0500 Message-ID: <20201216220104.267856398@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 16 Dec 2020 17:00:35 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Subject: [PATCH 3/3] trace-cmd: Add a make-trace-cmd.sh script to simplify creating a trace-cmd package References: <20201216220032.809666622@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: "Steven Rostedt (VMware)" Add a script "make-trace-cmd.sh" and a help file "PACKAGKING" to describe what it does. The make-trace-cmd.sh will help create a full directory that has libtraceevent, libtracefs, libtracecmd and trace-cmd binary without needing to install them on the host machine. As described in PACKAGING, the steps to do so are: git clone git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git git clone git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git git clone git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git cd libtraceevent INSTALL_PATH=/tmp/install ../trace-cmd/make-trace-cmd.sh install cd ../libtracefs INSTALL_PATH=/tmp/install ../trace-cmd/make-trace-cmd.sh install cd ../trace-cmd INSTALL_PATH=/tmp/install ./make-trace-cmd.sh install install_libs cd /tmp/install tar cvjf /tmp/trace-cmd-files.tar.bz2 . And then the tarball of /tmp/trace-cmd-files.tar.bz2 will can be extracted on another machine at the root directory, and trace-cmd will be installed there. Note, the above process uses the /usr prefix. To have the package be installed in /usr/local, add: PREFIX=/usr/local in front of each of the make-trace-cmd.sh commands. Signed-off-by: Steven Rostedt (VMware) --- PACKAGING | 30 ++++++++++++++++++++++++++++++ make-trace-cmd.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 PACKAGING create mode 100755 make-trace-cmd.sh diff --git a/PACKAGING b/PACKAGING new file mode 100644 index 000000000000..7e7d20653017 --- /dev/null +++ b/PACKAGING @@ -0,0 +1,30 @@ +The libtracefs and libtraceevent packages are required for trace-cmd +and libtracecmd.so + +In order to create a package directory with libtraceevent, libtracefs +and libtracecmd and trace-cmd, you can follow these steps: + + git clone git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git + git clone git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git + git clone git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git + + cd libtraceevent + INSTALL_PATH=/tmp/install ../trace-cmd/make-trace-cmd.sh install + + cd ../libtracefs + INSTALL_PATH=/tmp/install ../trace-cmd/make-trace-cmd.sh install + + cd ../trace-cmd + INSTALL_PATH=/tmp/install ./make-trace-cmd.sh install install_libs + + cd /tmp/install + tar cvjf /tmp/trace-cmd-files.tar.bz2 . + +And then the tarball of /tmp/trace-cmd-files.tar.bz2 will can be extracted +on another machine at the root directory, and trace-cmd will be installed there. + +Note, to define a prefix, add a PREFIX variable before calling make-trace-cmd.sh + + For example: + + PREFIX=/usr/local INSTALL_PATH=/tmp/install ./make-trace-cmd.sh install diff --git a/make-trace-cmd.sh b/make-trace-cmd.sh new file mode 100755 index 000000000000..ddff18146c84 --- /dev/null +++ b/make-trace-cmd.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ -z "$INSTALL_PATH" ]; then + echo + echo 'Error: No $INSTALL_PATH defined' + echo + echo " usage: [PREFIX=prefix][BUILD_PATH=/path/to/build] INSTALL_PATH=/path/to/install make-trace-cmd.sh install|install_libs|clean|uninstall" + echo + echo " Used to create a self contained directory to copy to other machines." + echo + echo " Please read PACKAGING for more information." + echo + exit +fi + +if [ ! -d $INSTALL_PATH ]; then + mkdir $INSTALL_PATH +fi + +if [ ! -z "$BUILD_PATH" ]; then + if [ ! -d $BUILD_PATH ]; then + mkdir $BUILD_PATH + fi + O_PATH="O=$BUILD_PATH" +fi + +if [ -z "$PREFIX" ]; then + PREFIX="/usr" +fi + +PKG_CONFIG="pkg-config --with-path $INSTALL_PATH/usr/lib64/pkgconfig --define-variable=prefix=$INSTALL_PATH/$PREFIX" CFLAGS="-g -Wall -I$INSTALL_PATH/$PREFIX/include" make DESTDIR=$INSTALL_PATH $O_PATH prefix=$PREFIX $@