summaryrefslogtreecommitdiff
path: root/tools/perf/config/feature-checks/test-on-exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/config/feature-checks/test-on-exit.c')
-rw-r--r--tools/perf/config/feature-checks/test-on-exit.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/config/feature-checks/test-on-exit.c b/tools/perf/config/feature-checks/test-on-exit.c
new file mode 100644
index 000000000000..8e88b16e6ded
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-on-exit.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+static void exit_fn(int status, void *__data)
+{
+ printf("exit status: %d, data: %d\n", status, *(int *)__data);
+}
+
+static int data = 123;
+
+int main(void)
+{
+ on_exit(exit_fn, &data);
+
+ return 321;
+}