diff mbox series

[1/6,v2] trace-cmd: Move add_event_pid() out of #ifndef NO_PTRACE

Message ID 20201216232145.010165486@goodmis.org (mailing list archive)
State Accepted
Commit 2f55ded528cfd8ef468bdd1f8bb82dcf1cfae04a
Headers show
Series trace-cmd/kernelshark: Fixed build, cleanups and fix kernelshark | expand

Commit Message

Steven Rostedt Dec. 16, 2020, 11:19 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

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;