From: Mathieu Desnoyers Date: Wed, 18 May 2011 23:56:24 +0000 (-0400) Subject: Add read version ABI ioctl X-Git-Tag: v2.0-pre1~144 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=80c16bcf4ae014301d1da2584029bef6f6062a09;p=lttng-modules.git Add read version ABI ioctl Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-debugfs-abi.c b/ltt-debugfs-abi.c index 41b9f8fa..54016466 100644 --- a/ltt-debugfs-abi.c +++ b/ltt-debugfs-abi.c @@ -32,6 +32,7 @@ #include "wrapper/ringbuffer/vfs.h" #include "ltt-debugfs-abi.h" #include "ltt-events.h" +#include "ltt-tracer.h" /* * This is LTTng's own personal way to create a system call as an external @@ -83,6 +84,21 @@ fd_error: return ret; } +static +long lttng_abi_tracer_version(struct file *file, + struct lttng_kernel_tracer_version __user *uversion_param) +{ + struct lttng_kernel_tracer_version v; + + v.version = LTTNG_VERSION; + v.patchlevel = LTTNG_PATCHLEVEL; + v.sublevel = LTTNG_SUBLEVEL; + + if (copy_to_user(uversion_param, &v, sizeof(v))) + return -EFAULT; + return 0; +} + /** * lttng_ioctl - lttng syscall through ioctl * @@ -102,6 +118,9 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (cmd) { case LTTNG_KERNEL_SESSION: return lttng_abi_create_session(); + case LTTNG_KERNEL_TRACER_VERSION: + return lttng_abi_tracer_version(file, + (struct lttng_kernel_tracer_version __user *) arg); default: return -ENOIOCTLCMD; } diff --git a/ltt-debugfs-abi.h b/ltt-debugfs-abi.h index 103e561b..ef2554b8 100644 --- a/ltt-debugfs-abi.h +++ b/ltt-debugfs-abi.h @@ -22,8 +22,8 @@ enum lttng_kernel_instrumentation { struct lttng_kernel_channel { int overwrite; /* 1: overwrite, 0: discard */ - u64 subbuf_size; - u64 num_subbuf; + uint64_t subbuf_size; + uint64_t num_subbuf; unsigned int switch_timer_interval; unsigned int read_timer_interval; }; @@ -37,12 +37,18 @@ struct lttng_kernel_event { * Either addr is used, or symbol_name and offset. */ struct lttng_kernel_kprobe { - u64 addr; + uint64_t addr; - u64 offset; + uint64_t offset; char symbol_name[]; }; +struct lttng_kernel_tracer_version { + uint32_t version; + uint32_t patchlevel; + uint32_t sublevel; +}; + #define LTTNG_KERNEL_SESSION _IO(0xF6, 0x40) #define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x41) #define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x42) @@ -56,6 +62,6 @@ struct lttng_kernel_kprobe { #define LTTNG_KERNEL_KPROBE \ _IOW(0xF6, 0x47, struct lttng_kernel_kprobe) #define LTTNG_KERNEL_TRACER_VERSION \ - _IOW(0xF6, 0x48, struct lttng_kernel_tracer_version) + _IOR(0xF6, 0x48, struct lttng_kernel_tracer_version) #endif /* _LTT_DEBUGFS_ABI_H */ diff --git a/ltt-tracer.h b/ltt-tracer.h index aa9db46a..8c0d12d4 100644 --- a/ltt-tracer.h +++ b/ltt-tracer.h @@ -23,6 +23,10 @@ #include "ltt-tracer-core.h" #include "ltt-events.h" +#define LTTNG_VERSION 0 +#define LTTNG_PATCHLEVEL 9 +#define LTTNG_SUBLEVEL 1 + #ifndef CHAR_BIT #define CHAR_BIT 8 #endif