#include "lttng-share.h"
+#define LTTNG_SYM_NAME_LEN 128
+
+enum lttng_kernel_instrumentation {
+ LTTNG_KERNEL_TRACEPOINTS,
+ LTTNG_KERNEL_KPROBES,
+ LTTNG_KERNEL_FUNCTION_TRACER,
+};
+
/*
* LTTng DebugFS ABI structures.
*/
-enum lttng_instrum_type {
- INSTRUM_TRACEPOINTS,
+
+struct lttng_kernel_channel {
+ int overwrite; /* 1: overwrite, 0: discard */
+ uint64_t subbuf_size; /* in bytes */
+ uint64_t num_subbuf;
+ unsigned int switch_timer_interval; /* usecs */
+ unsigned int read_timer_interval; /* usecs */
+};
+
+struct lttng_kernel_tracepoint {
+};
+
+/*
+ * Either addr is used, or symbol_name and offset.
+ */
+struct lttng_kernel_kprobe {
+ uint64_t addr;
+
+ uint64_t offset;
+ char symbol_name[LTTNG_SYM_NAME_LEN];
+};
+
+struct lttng_kernel_function_tracer {
+ char symbol_name[LTTNG_SYM_NAME_LEN];
};
-struct lttng_channel {
- int overwrite; /* 1: overwrite, 0: discard */
- u64 subbuf_size;
- u64 num_subbuf;
- unsigned int switch_timer_interval;
- unsigned int read_timer_interval;
+struct lttng_kernel_event {
+ char name[LTTNG_SYM_NAME_LEN]; /* event name */
+ enum lttng_kernel_instrumentation instrumentation;
+ /* Per instrumentation type configuration */
+ union {
+ struct lttng_kernel_tracepoint tracepoint;
+ struct lttng_kernel_kprobe kprobe;
+ struct lttng_kernel_function_tracer ftrace;
+ } u;
};
-struct lttng_event {
- enum lttng_instrum_type itype;
- char name[];
+struct lttng_kernel_tracer_version {
+ uint32_t version;
+ uint32_t patchlevel;
+ uint32_t sublevel;
};
#endif /* _LTTNG_KERNEL_H */
/* returns the offset of the subbuffer belonging to the mmap reader. */
#define RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long)
-/* Create session LTTNG_SESSION */
-#define KERNEL_CREATE_SESSION _IO(0xF6, 0x40)
-#define KERNEL_SESSION_START _IO(0xF6, 0x41)
-#define KERNEL_SESSION_STOP _IO(0xF6, 0x42)
-
-/* Create channel LTTNG_CHANNEL */
-#define KERNEL_CREATE_CHANNEL _IOW(0xF6, 0x43, struct lttng_channel)
-#define KERNEL_CREATE_STREAM _IO(0xF6, 0x44)
-#define KERNEL_CREATE_EVENT _IOW(0xF6, 0x45, struct lttng_event)
-
-#define KERNEL_OPEN_METADATA _IOW(0xF6, 0x46, struct lttng_channel)
+#define LTTNG_KERNEL_SESSION _IO(0xF6, 0x40)
+#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x41)
+#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x42)
+#define LTTNG_KERNEL_CHANNEL \
+ _IOW(0xF6, 0x43, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x44)
+#define LTTNG_KERNEL_EVENT \
+ _IOW(0xF6, 0x45, struct lttng_kernel_event)
+#define LTTNG_KERNEL_METADATA \
+ _IOW(0xF6, 0x46, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_KPROBE \
+ _IOW(0xF6, 0x47, struct lttng_kernel_kprobe)
+#define LTTNG_KERNEL_TRACER_VERSION \
+ _IOR(0xF6, 0x48, struct lttng_kernel_tracer_version)
#endif /* _LTT_KERNEL_IOCTL_H */
#include "libkernelctl.h"
#include "lttngerr.h"
-int kernctl_create_channel(int fd, struct lttng_channel *chops)
+int kernctl_create_channel(int fd, struct lttng_kernel_channel *chops)
{
- return ioctl(fd, KERNEL_CREATE_CHANNEL, chops);
+ return ioctl(fd, LTTNG_KERNEL_CHANNEL, chops);
}
-int kernctl_create_event(int fd, struct lttng_event *ev)
+int kernctl_create_event(int fd, struct lttng_kernel_event *ev)
{
- return ioctl(fd, KERNEL_CREATE_EVENT, ev);
+ return ioctl(fd, LTTNG_KERNEL_EVENT, ev);
}
int kernctl_create_session(int fd)
{
- return ioctl(fd, KERNEL_CREATE_SESSION);
+ return ioctl(fd, LTTNG_KERNEL_SESSION);
}
int kernctl_create_stream(int fd)
{
- return ioctl(fd, KERNEL_CREATE_STREAM);
+ return ioctl(fd, LTTNG_KERNEL_STREAM);
}
/* returns the maximum size for sub-buffers. */
}
/* open the metadata global channel */
-int kernctl_open_metadata(int fd, struct lttng_channel *chops)
+int kernctl_open_metadata(int fd, struct lttng_kernel_channel *chops)
{
- return ioctl(fd, KERNEL_OPEN_METADATA, chops);
+ return ioctl(fd, LTTNG_KERNEL_METADATA, chops);
}
/* Release exclusive sub-buffer access, move consumer forward. */
int kernctl_start_session(int fd)
{
- return ioctl(fd, KERNEL_SESSION_START);
+ return ioctl(fd, LTTNG_KERNEL_SESSION_START);
}
int kernctl_stop_session(int fd)
{
- return ioctl(fd, KERNEL_SESSION_STOP);
+ return ioctl(fd, LTTNG_KERNEL_SESSION_STOP);
}
#include "lttng-kernel.h"
-int kernctl_create_channel(int fd, struct lttng_channel *chops);
-int kernctl_create_event(int fd, struct lttng_event *ev);
+int kernctl_create_channel(int fd, struct lttng_kernel_channel *chops);
+int kernctl_create_event(int fd, struct lttng_kernel_event *ev);
int kernctl_create_session(int fd);
int kernctl_create_stream(int fd);
int kernctl_get_max_subbuf_size(int fd, unsigned long *len);
int kernctl_get_padded_subbuf_size(int fd, unsigned long *len);
int kernctl_get_subbuf(int fd, unsigned long *len);
int kernctl_get_subbuf_size(int fd, unsigned long *len);
-int kernctl_open_metadata(int fd, struct lttng_channel *chops);
+int kernctl_open_metadata(int fd, struct lttng_kernel_channel *chops);
int kernctl_put_next_subbuf(int fd);
int kernctl_put_subbuf(int fd);
int kernctl_snapshot(int fd);
{
int ret;
struct ltt_kernel_channel *lkc;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel *chan;
lkc = malloc(sizeof(struct ltt_kernel_channel));
- chan = malloc(sizeof(struct lttng_channel));
+ chan = malloc(sizeof(struct lttng_kernel_channel));
if (lkc == NULL || chan == NULL) {
perror("kernel channel malloc");
/* Kernel channel */
struct ltt_kernel_channel {
int fd;
- struct lttng_channel *channel;
+ struct lttng_kernel_channel *channel;
struct ltt_kernel_event_list events_list;
};