*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <common/common.h>
#include <common/kernel-ctl/kernel-ctl.h>
+#include <common/kernel-ctl/kernel-ioctl.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include "consumer.h"
#include "kernel.h"
#include "kernel-consumer.h"
#include "kern-modules.h"
+#include "utils.h"
/*
* Add context on a kernel channel.
/*
* Create a kernel event, enable it to the kernel tracer and add it to the
* channel event list of the kernel session.
+ * We own filter_expression and filter.
*/
int kernel_create_event(struct lttng_event *ev,
struct ltt_kernel_channel *channel)
return ret;
}
+int kernel_enable_syscall(const char *syscall_name,
+ struct ltt_kernel_channel *channel)
+{
+ return kernctl_enable_syscall(channel->fd, syscall_name);
+}
+
+int kernel_disable_syscall(const char *syscall_name,
+ struct ltt_kernel_channel *channel)
+{
+ return kernctl_disable_syscall(channel->fd, syscall_name);
+}
+
/*
* Create kernel metadata, open from the kernel tracer and add it to the
* kernel session.
{
int ret;
struct lttng_kernel_tracer_version version;
+ struct lttng_kernel_tracer_abi_version abi_version;
ret = kernctl_tracer_version(tracer_fd, &version);
if (ret < 0) {
}
/* Validate version */
- if (version.major != KERN_MODULES_PRE_MAJOR
- && version.major != KERN_MODULES_MAJOR) {
+ if (version.major != VERSION_MAJOR) {
+ ERR("Kernel tracer major version (%d) is not compatible with lttng-tools major version (%d)",
+ version.major, VERSION_MAJOR);
goto error_version;
}
-
- DBG2("Kernel tracer version validated (major version %d)", version.major);
+ ret = kernctl_tracer_abi_version(tracer_fd, &abi_version);
+ if (ret < 0) {
+ ERR("Failed at getting lttng-modules ABI version");
+ goto error;
+ }
+ if (abi_version.major != LTTNG_MODULES_ABI_MAJOR_VERSION) {
+ ERR("Kernel tracer ABI version (%d.%d) is not compatible with expected ABI major version (%d.*)",
+ abi_version.major, abi_version.minor,
+ LTTNG_MODULES_ABI_MAJOR_VERSION);
+ goto error;
+ }
+ DBG2("Kernel tracer version validated (%d.%d, ABI %d.%d)",
+ version.major, version.minor,
+ abi_version.major, abi_version.minor);
return 0;
error_version:
- ERR("Kernel major version %d is not compatible (supporting <= %d)",
- version.major, KERN_MODULES_MAJOR)
ret = -1;
error:
rcu_read_unlock();
return ret;
}
+
+/*
+ * Get the syscall mask array from the kernel tracer.
+ *
+ * Return 0 on success else a negative value. In both case, syscall_mask should
+ * be freed.
+ */
+int kernel_syscall_mask(int chan_fd, char **syscall_mask, uint32_t *nr_bits)
+{
+ assert(syscall_mask);
+ assert(nr_bits);
+
+ return kernctl_syscall_mask(chan_fd, syscall_mask, nr_bits);
+}