aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2020-12-08 16:54:05 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-12-09 17:44:45 -0500
commit090c71b5896b9b58c9f62ca0fe8f0aecb964d4b5 (patch)
treeccce91506e08fb938607defb4362999540fffd6e /scripts
parent2c25dc804b99e487438e59b22ea9cc18c1226bfc (diff)
downloadlibtracefs-090c71b5896b9b58c9f62ca0fe8f0aecb964d4b5.tar.gz
libtracefs: Move features.mk into scripts directory
In order to clean up the directory structure, move the features.mk into the scripts directory. That's where the helper files for the Makefile should live anyway. Link: https://lore.kernel.org/linux-trace-devel/20201208215504.294115386@goodmis.org Acked-by: Tzvetomir (VMware) Stoyanov <tz.stoyanov@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/features.mk36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/features.mk b/scripts/features.mk
new file mode 100644
index 0000000..cb2e8bd
--- /dev/null
+++ b/scripts/features.mk
@@ -0,0 +1,36 @@
+
+# taken from perf which was based on Linux Kbuild
+# try-cc
+# Usage: option = $(call try-cc, source-to-build, cc-options)
+try-cc = $(shell sh -c \
+ 'TMP="$(BUILD_OUTPUT)$(TMPOUT).$$$$"; \
+ echo "$(1)" | \
+ $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
+ rm -f "$$TMP"')
+
+define SOURCE_PTRACE
+#include <stdio.h>
+#include <sys/ptrace.h>
+
+int main (void)
+{
+ int ret;
+ ret = ptrace(PTRACE_ATTACH, 0, NULL, 0);
+ ptrace(PTRACE_TRACEME, 0, NULL, 0);
+ ptrace(PTRACE_GETSIGINFO, 0, NULL, NULL);
+ ptrace(PTRACE_GETEVENTMSG, 0, NULL, NULL);
+ ptrace(PTRACE_SETOPTIONS, NULL, NULL,
+ PTRACE_O_TRACEFORK |
+ PTRACE_O_TRACEVFORK |
+ PTRACE_O_TRACECLONE |
+ PTRACE_O_TRACEEXIT);
+ ptrace(PTRACE_CONT, NULL, NULL, 0);
+ ptrace(PTRACE_DETACH, 0, NULL, NULL);
+ ptrace(PTRACE_SETOPTIONS, 0, NULL,
+ PTRACE_O_TRACEFORK |
+ PTRACE_O_TRACEVFORK |
+ PTRACE_O_TRACECLONE |
+ PTRACE_O_TRACEEXIT);
+ return ret;
+}
+endef