+++ /dev/null
-# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
-
-ccflags-y += -DLTTNG_LINUX_MAJOR=$(VERSION)
-ccflags-y += -DLTTNG_LINUX_MINOR=$(PATCHLEVEL)
-ccflags-y += -DLTTNG_LINUX_PATCH=$(SUBLEVEL)
-
-# Work-around for distro-specific public modules ABI breakages.
-# Some distributions break the public module instrumentation ABI
-# compared to upstream stable kernels without providing other mean than
-# the kernel EXTRAVERSION to figure it out. Translate this information
-# into a define visible from the C preprocessor.
-
-DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
-
-ifneq ($(DEB_API_VERSION), 0)
- ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
-endif
-
-RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
-
-ifneq ($(RHEL_API_VERSION), 0)
- ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
-endif
-
-SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
-
-ifneq ($(SLE_API_VERSION), 0)
- ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
-endif
-
-FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
-
-ifneq ($(FEDORA_REVISION_VERSION), 0)
- ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
-endif
-
-RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
-
-ifneq ($(RT_PATCH_VERSION), 0)
- ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
-endif
-
-EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
-
-ifneq ($(EXTRA_VERSION_NAME), 0)
- ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
-endif
-
-EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
-
-ifneq ($(EXTRA_VERSION_GIT), 0)
- ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
-endif
-
-EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
-
-mnt_ns_dep = $(srctree)/fs/mount.h
-ifeq ($(wildcard $(mnt_ns_dep)),)
- ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER
-endif
-
-# vim:syntax=make
+++ /dev/null
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-config LTTNG
- tristate "LTTng support"
- select TRACING
- help
- LTTng is an open source tracing framework for Linux.
-
- See https://lttng.org/
-
- To compile as a set of modules, choose M here. To compile into
- the Linux kernel image, choose Y.
-
- If unsure, say N.
-
-source "lttng/tests/Kconfig"
ifneq ($(KERNELRELEASE),)
- # This part of the Makefile is used when called by the kernel build system
- # and defines the modules to be built.
-
- ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
- ifeq ($(CONFIG_TRACEPOINTS),)
- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
- endif # CONFIG_TRACEPOINTS
- endif # ifdef CONFIG_LOCALVERSION
-
- TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))
-
- lttng_check_linux_version = $(shell pwd)/include/linux/version.h
- lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
-
- #
- # Check for stale version.h, which can be a leftover from an old Linux
- # kernel tree moved to a newer kernel version, only pruned by make
- # distclean.
- #
- ifneq ($(wildcard $(lttng_check_linux_version)),)
- ifneq ($(wildcard $(lttng_check_generated_linux_version)),)
- $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file)
- endif
- endif
-
- obj-$(CONFIG_LTTNG) += src/
- obj-$(CONFIG_LTTNG) += tests/
+# This part of the Makefile is used when called by the kernel build system
+# and defines the modules to be built.
+
+obj-$(CONFIG_LTTNG) += src/
else # KERNELRELEASE
default: modules
modules:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules
+ $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules
modules_install:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install
+ $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install
clean:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+ $(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean
%.i: %.c
- $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@
+ $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@
endif # KERNELRELEASE
# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
+ ifeq ($(CONFIG_TRACEPOINTS),)
+ $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
+ endif # CONFIG_TRACEPOINTS
+endif # ifdef CONFIG_LOCALVERSION
+
TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+lttng_check_linux_version = $(shell pwd)/include/linux/version.h
+lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
+
+#
+# Check for stale version.h, which can be a leftover from an old Linux
+# kernel tree moved to a newer kernel version, only pruned by make
+# distclean.
+#
+ifneq ($(wildcard $(lttng_check_linux_version)),)
+ ifneq ($(wildcard $(lttng_check_generated_linux_version)),)
+ $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file)
+ endif
+endif
+
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
obj-$(CONFIG_LTTNG) += probes/
obj-$(CONFIG_LTTNG) += lib/
+obj-$(CONFIG_LTTNG) += tests/
--- /dev/null
+# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
+
+ccflags-y += -DLTTNG_LINUX_MAJOR=$(VERSION)
+ccflags-y += -DLTTNG_LINUX_MINOR=$(PATCHLEVEL)
+ccflags-y += -DLTTNG_LINUX_PATCH=$(SUBLEVEL)
+
+# Work-around for distro-specific public modules ABI breakages.
+# Some distributions break the public module instrumentation ABI
+# compared to upstream stable kernels without providing other mean than
+# the kernel EXTRAVERSION to figure it out. Translate this information
+# into a define visible from the C preprocessor.
+
+DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
+
+ifneq ($(DEB_API_VERSION), 0)
+ ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
+endif
+
+RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
+
+ifneq ($(RHEL_API_VERSION), 0)
+ ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
+endif
+
+SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
+
+ifneq ($(SLE_API_VERSION), 0)
+ ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
+endif
+
+FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
+
+ifneq ($(FEDORA_REVISION_VERSION), 0)
+ ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
+endif
+
+RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
+
+ifneq ($(RT_PATCH_VERSION), 0)
+ ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
+endif
+
+EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
+
+ifneq ($(EXTRA_VERSION_NAME), 0)
+ ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
+endif
+
+EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
+
+ifneq ($(EXTRA_VERSION_GIT), 0)
+ ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
+endif
+
+EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
+
+mnt_ns_dep = $(srctree)/fs/mount.h
+ifeq ($(wildcard $(mnt_ns_dep)),)
+ ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER
+endif
+
+# vim:syntax=make
--- /dev/null
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+config LTTNG
+ tristate "LTTng support"
+ select TRACING
+ help
+ LTTng is an open source tracing framework for Linux.
+
+ See https://lttng.org/
+
+ To compile as a set of modules, choose M here. To compile into
+ the Linux kernel image, choose Y.
+
+ If unsure, say N.
+
+source "lttng/tests/Kconfig"
TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
--- /dev/null
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../..
+
+include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common
+
+ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
+
+obj-$(CONFIG_LTTNG) += lttng-test.o
+lttng-test-objs := probes/lttng-test.o
+
+obj-$(CONFIG_LTTNG_CLOCK_PLUGIN_TEST) += lttng-clock-plugin-test.o
+lttng-clock-plugin-test-objs := clock-plugin/lttng-clock-plugin-test.o
+
+# vim:syntax=make
--- /dev/null
+# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+
+config LTTNG_CLOCK_PLUGIN_TEST
+ tristate "Use test plugin as trace clock"
+ depends on LTTNG
+ help
+ Use the test clock as trace clock. This plugin freezes the
+ time with 1 KHz for regression test.
+ It's recommended to build this as a module to work with the
+ lttng-tools test suite.
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-clock-plugin-test.c
+ *
+ * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <linux/module.h>
+#include <linux/ktime.h>
+#include <linux/hrtimer.h>
+#include <linux/time.h>
+
+#include <lttng/tracer.h>
+#include <lttng/clock.h> /* From lttng-modules */
+
+static u64 trace_clock_read64_example(void)
+{
+ /* Freeze time. */
+ return 0;
+}
+
+static u64 trace_clock_freq_example(void)
+{
+ return 1000; /* 1KHz */
+}
+
+static int trace_clock_uuid_example(char *uuid)
+{
+ const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
+ memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
+ return 0;
+}
+
+static const char *trace_clock_name_example(void)
+{
+ return "lttng_test_clock_override";
+}
+
+static const char *trace_clock_description_example(void)
+{
+ return "Freeze time with 1KHz for regression test";
+}
+
+static
+struct lttng_trace_clock ltc = {
+ .read64 = trace_clock_read64_example,
+ .freq = trace_clock_freq_example,
+ .uuid = trace_clock_uuid_example,
+ .name = trace_clock_name_example,
+ .description = trace_clock_description_example,
+};
+
+static __init
+int lttng_clock_plugin_init(void)
+{
+ return lttng_clock_register_plugin(<c, THIS_MODULE);
+}
+fs_initcall(lttng_clock_plugin_init);
+
+static __exit
+void lttng_clock_plugin_exit(void)
+{
+ lttng_clock_unregister_plugin(<c, THIS_MODULE);
+}
+module_exit(lttng_clock_plugin_exit);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng Clock Plugin Example");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+ __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+ __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+ LTTNG_MODULES_EXTRAVERSION);
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-test.c
+ *
+ * Linux Trace Toolkit Next Generation Test Module
+ *
+ * Copyright 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/byteorder/generic.h>
+#include <asm/byteorder.h>
+
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <wrapper/tracepoint.h>
+
+#define TP_MODULE_NOAUTOLOAD
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH instrumentation/events
+#define TRACE_INCLUDE_FILE lttng-test
+#define LTTNG_INSTRUMENTATION
+#include <instrumentation/events/lttng-test.h>
+
+LTTNG_DEFINE_TRACE(lttng_test_filter_event,
+ PARAMS(int anint, int netint, long *values,
+ char *text, size_t textlen,
+ char *etext, uint32_t * net_values),
+ PARAMS(anint, netint, values, text, textlen, etext, net_values)
+);
+
+#define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event"
+
+#define LTTNG_WRITE_COUNT_MAX 64
+
+static struct proc_dir_entry *lttng_test_filter_event_dentry;
+
+static
+void trace_test_event(unsigned int nr_iter)
+{
+ int i, netint;
+ long values[] = { 1, 2, 3 };
+ uint32_t net_values[] = { 1, 2, 3 };
+ char text[10] = "test";
+ char escape[10] = "\\*";
+
+ for (i = 0; i < 3; i++) {
+ net_values[i] = htonl(net_values[i]);
+ }
+ for (i = 0; i < nr_iter; i++) {
+ netint = htonl(i);
+ trace_lttng_test_filter_event(i, netint, values, text, strlen(text), escape, net_values);
+ }
+}
+
+/**
+ * lttng_filter_event_write - trigger a lttng_test_filter_event
+ * @file: file pointer
+ * @user_buf: user string
+ * @count: length to copy
+ *
+ * Return -1 on error, with EFAULT errno. Returns count on success.
+ */
+static
+ssize_t lttng_test_filter_event_write(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ unsigned int nr_iter;
+ ssize_t written;
+ int ret;
+
+ /* Get the number of iterations */
+ ret = kstrtouint_from_user(user_buf, count, 10, &nr_iter);
+ if (ret) {
+ written = ret;
+ goto end;
+ }
+ /* Trace the event */
+ trace_test_event(nr_iter);
+ written = count;
+ *ppos += written;
+end:
+ return written;
+}
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
+static const struct proc_ops lttng_test_filter_event_proc_ops = {
+ .proc_write = lttng_test_filter_event_write,
+};
+#else
+static const struct file_operations lttng_test_filter_event_proc_ops = {
+ .write = lttng_test_filter_event_write,
+};
+#endif
+
+static
+int __init lttng_test_init(void)
+{
+ int ret = 0;
+
+ (void) wrapper_lttng_fixup_sig(THIS_MODULE);
+ wrapper_vmalloc_sync_mappings();
+ lttng_test_filter_event_dentry =
+ proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE,
+ S_IRUGO | S_IWUGO, NULL,
+ <tng_test_filter_event_proc_ops, NULL);
+ if (!lttng_test_filter_event_dentry) {
+ printk(KERN_ERR "Error creating LTTng test filter file\n");
+ ret = -ENOMEM;
+ goto error;
+ }
+ ret = __lttng_events_init__lttng_test();
+ if (ret)
+ goto error_events;
+ return ret;
+
+error_events:
+ remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
+error:
+ return ret;
+}
+
+module_init(lttng_test_init);
+
+static
+void __exit lttng_test_exit(void)
+{
+ __lttng_events_exit__lttng_test();
+ if (lttng_test_filter_event_dentry)
+ remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
+}
+
+module_exit(lttng_test_exit);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng Test");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+ __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+ __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+ LTTNG_MODULES_EXTRAVERSION);
+++ /dev/null
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
-
-include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
-
-ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include
-
-obj-$(CONFIG_LTTNG) += lttng-test.o
-lttng-test-objs := probes/lttng-test.o
-
-obj-$(CONFIG_LTTNG_CLOCK_PLUGIN_TEST) += lttng-clock-plugin-test.o
-lttng-clock-plugin-test-objs := clock-plugin/lttng-clock-plugin-test.o
-
-# vim:syntax=make
+++ /dev/null
-# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
-
-config LTTNG_CLOCK_PLUGIN_TEST
- tristate "Use test plugin as trace clock"
- depends on LTTNG
- help
- Use the test clock as trace clock. This plugin freezes the
- time with 1 KHz for regression test.
- It's recommended to build this as a module to work with the
- lttng-tools test suite.
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-clock-plugin-test.c
- *
- * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/module.h>
-#include <linux/ktime.h>
-#include <linux/hrtimer.h>
-#include <linux/time.h>
-
-#include <lttng/tracer.h>
-#include <lttng/clock.h> /* From lttng-modules */
-
-static u64 trace_clock_read64_example(void)
-{
- /* Freeze time. */
- return 0;
-}
-
-static u64 trace_clock_freq_example(void)
-{
- return 1000; /* 1KHz */
-}
-
-static int trace_clock_uuid_example(char *uuid)
-{
- const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
- memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
- return 0;
-}
-
-static const char *trace_clock_name_example(void)
-{
- return "lttng_test_clock_override";
-}
-
-static const char *trace_clock_description_example(void)
-{
- return "Freeze time with 1KHz for regression test";
-}
-
-static
-struct lttng_trace_clock ltc = {
- .read64 = trace_clock_read64_example,
- .freq = trace_clock_freq_example,
- .uuid = trace_clock_uuid_example,
- .name = trace_clock_name_example,
- .description = trace_clock_description_example,
-};
-
-static __init
-int lttng_clock_plugin_init(void)
-{
- return lttng_clock_register_plugin(<c, THIS_MODULE);
-}
-fs_initcall(lttng_clock_plugin_init);
-
-static __exit
-void lttng_clock_plugin_exit(void)
-{
- lttng_clock_unregister_plugin(<c, THIS_MODULE);
-}
-module_exit(lttng_clock_plugin_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
-MODULE_DESCRIPTION("LTTng Clock Plugin Example");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
- __stringify(LTTNG_MODULES_MINOR_VERSION) "."
- __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
- LTTNG_MODULES_EXTRAVERSION);
+++ /dev/null
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * lttng-test.c
- *
- * Linux Trace Toolkit Next Generation Test Module
- *
- * Copyright 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-#include <linux/byteorder/generic.h>
-#include <asm/byteorder.h>
-
-#include <lttng/events.h>
-#include <lttng/tracer.h>
-#include <wrapper/tracepoint.h>
-
-#define TP_MODULE_NOAUTOLOAD
-#define LTTNG_PACKAGE_BUILD
-#define CREATE_TRACE_POINTS
-#define TRACE_INCLUDE_PATH instrumentation/events
-#define TRACE_INCLUDE_FILE lttng-test
-#define LTTNG_INSTRUMENTATION
-#include <instrumentation/events/lttng-test.h>
-
-LTTNG_DEFINE_TRACE(lttng_test_filter_event,
- PARAMS(int anint, int netint, long *values,
- char *text, size_t textlen,
- char *etext, uint32_t * net_values),
- PARAMS(anint, netint, values, text, textlen, etext, net_values)
-);
-
-#define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event"
-
-#define LTTNG_WRITE_COUNT_MAX 64
-
-static struct proc_dir_entry *lttng_test_filter_event_dentry;
-
-static
-void trace_test_event(unsigned int nr_iter)
-{
- int i, netint;
- long values[] = { 1, 2, 3 };
- uint32_t net_values[] = { 1, 2, 3 };
- char text[10] = "test";
- char escape[10] = "\\*";
-
- for (i = 0; i < 3; i++) {
- net_values[i] = htonl(net_values[i]);
- }
- for (i = 0; i < nr_iter; i++) {
- netint = htonl(i);
- trace_lttng_test_filter_event(i, netint, values, text, strlen(text), escape, net_values);
- }
-}
-
-/**
- * lttng_filter_event_write - trigger a lttng_test_filter_event
- * @file: file pointer
- * @user_buf: user string
- * @count: length to copy
- *
- * Return -1 on error, with EFAULT errno. Returns count on success.
- */
-static
-ssize_t lttng_test_filter_event_write(struct file *file, const char __user *user_buf,
- size_t count, loff_t *ppos)
-{
- unsigned int nr_iter;
- ssize_t written;
- int ret;
-
- /* Get the number of iterations */
- ret = kstrtouint_from_user(user_buf, count, 10, &nr_iter);
- if (ret) {
- written = ret;
- goto end;
- }
- /* Trace the event */
- trace_test_event(nr_iter);
- written = count;
- *ppos += written;
-end:
- return written;
-}
-
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
-static const struct proc_ops lttng_test_filter_event_proc_ops = {
- .proc_write = lttng_test_filter_event_write,
-};
-#else
-static const struct file_operations lttng_test_filter_event_proc_ops = {
- .write = lttng_test_filter_event_write,
-};
-#endif
-
-static
-int __init lttng_test_init(void)
-{
- int ret = 0;
-
- (void) wrapper_lttng_fixup_sig(THIS_MODULE);
- wrapper_vmalloc_sync_mappings();
- lttng_test_filter_event_dentry =
- proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE,
- S_IRUGO | S_IWUGO, NULL,
- <tng_test_filter_event_proc_ops, NULL);
- if (!lttng_test_filter_event_dentry) {
- printk(KERN_ERR "Error creating LTTng test filter file\n");
- ret = -ENOMEM;
- goto error;
- }
- ret = __lttng_events_init__lttng_test();
- if (ret)
- goto error_events;
- return ret;
-
-error_events:
- remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
-error:
- return ret;
-}
-
-module_init(lttng_test_init);
-
-static
-void __exit lttng_test_exit(void)
-{
- __lttng_events_exit__lttng_test();
- if (lttng_test_filter_event_dentry)
- remove_proc_entry(LTTNG_TEST_FILTER_EVENT_FILE, NULL);
-}
-
-module_exit(lttng_test_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
-MODULE_DESCRIPTION("LTTng Test");
-MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
- __stringify(LTTNG_MODULES_MINOR_VERSION) "."
- __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
- LTTNG_MODULES_EXTRAVERSION);