diff mbox series

[v2,03/15] libtracefs: Fix stream example

Message ID 20211217055041.19559-4-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit 3e6ae03047f9b142e6e5bfdcb35fd14b439c8cef
Headers show
Series libtracefs: Updates to the Makefile | expand

Commit Message

Steven Rostedt Dec. 17, 2021, 5:50 a.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The sample in libtracefs-stream.txt references SPLICE_F_NONBLOCK but that
requires including "fcntl.h" and defining _GNU_SOURCE. Without that, the
sample fails to compile. Adding $(CFLAGS) to the build adds the
_GNU_SOURCE define.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Documentation/libtracefs-stream.txt | 1 +
 samples/Makefile                    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Documentation/libtracefs-stream.txt b/Documentation/libtracefs-stream.txt
index 7d723c5e5673..68ec8c3649ba 100644
--- a/Documentation/libtracefs-stream.txt
+++ b/Documentation/libtracefs-stream.txt
@@ -51,6 +51,7 @@  EXAMPLE
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
+#include <fcntl.h>
 
 #include <tracefs.h>
 
diff --git a/samples/Makefile b/samples/Makefile
index 6ee57fecacbd..4ccd28dcebaa 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -63,7 +63,7 @@  $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
 #	$(CC) -g -Wall -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
 $(bdir)/%.o: %.c
-	$(CC) -g -Wall -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
+	$(CC) -g -Wall -c $(CFLAGS) -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
 clean:
 	$(RM) $(bdir)/*