#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"
{
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:
return ret;
}
+int kernctl_tracer_abi_version(int fd,
+ struct lttng_kernel_tracer_abi_version *v)
+{
+ return ioctl(fd, LTTNG_KERNEL_TRACER_ABI_VERSION, v);
+}
+
int kernctl_wait_quiescent(int fd)
{
return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_WAIT_QUIESCENT,
int kernctl_tracepoint_list(int fd);
int kernctl_syscall_list(int fd);
int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v);
+int kernctl_tracer_abi_version(int fd, struct lttng_kernel_tracer_abi_version *v);
int kernctl_wait_quiescent(int fd);
int kernctl_calibrate(int fd, struct lttng_kernel_calibrate *calibrate);
#ifndef _LTT_KERNEL_IOCTL_H
#define _LTT_KERNEL_IOCTL_H
+#define LTTNG_MODULES_ABI_MAJOR_VERSION 1
+#define LTTNG_MODULES_ABI_MINOR_VERSION 0
+
/* Get a snapshot of the current ring buffer producer and consumer positions */
#define RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)
/* Get the consumer position (iteration start) */
#define LTTNG_KERNEL_CALIBRATE \
_IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A)
+#define LTTNG_KERNEL_TRACER_ABI_VERSION \
+ _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version)
/* Session FD ioctl */
#define LTTNG_KERNEL_METADATA \