From: Julien Desfossez Date: Tue, 24 May 2011 14:20:42 +0000 (-0400) Subject: Sync ioctl headers with kernel X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=9cb983500508a95363a09a5a65d2f67774c38b69;p=lttng-tools.git Sync ioctl headers with kernel Signed-off-by: Julien Desfossez --- diff --git a/include/lttng-kernel.h b/include/lttng-kernel.h index 142de0706..1ce9fc5e4 100644 --- a/include/lttng-kernel.h +++ b/include/lttng-kernel.h @@ -23,24 +23,58 @@ #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 */ diff --git a/libkernelctl/kernel-ioctl.h b/libkernelctl/kernel-ioctl.h index 9aa0407b4..5e2358c8d 100644 --- a/libkernelctl/kernel-ioctl.h +++ b/libkernelctl/kernel-ioctl.h @@ -46,16 +46,19 @@ /* 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 */ diff --git a/libkernelctl/libkernelctl.c b/libkernelctl/libkernelctl.c index e15dd8da6..c06f57969 100644 --- a/libkernelctl/libkernelctl.c +++ b/libkernelctl/libkernelctl.c @@ -23,24 +23,24 @@ #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. */ @@ -86,9 +86,9 @@ int kernctl_get_subbuf_size(int fd, unsigned long *len) } /* 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. */ @@ -123,11 +123,11 @@ int kernctl_snapshot_get_produced(int fd, unsigned long *pos) 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); } diff --git a/libkernelctl/libkernelctl.h b/libkernelctl/libkernelctl.h index eb0c7800e..34be7a5d3 100644 --- a/libkernelctl/libkernelctl.h +++ b/libkernelctl/libkernelctl.h @@ -22,8 +22,8 @@ #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); @@ -33,7 +33,7 @@ int kernctl_get_next_subbuf(int fd); 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); diff --git a/ltt-sessiond/kernel-ctl.c b/ltt-sessiond/kernel-ctl.c index 12a00eb1f..5d70296ea 100644 --- a/ltt-sessiond/kernel-ctl.c +++ b/ltt-sessiond/kernel-ctl.c @@ -68,10 +68,10 @@ int kernel_create_channel(struct command_ctx *cmd_ctx) { 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"); diff --git a/ltt-sessiond/trace.h b/ltt-sessiond/trace.h index 6e86915b6..9cfbd84ab 100644 --- a/ltt-sessiond/trace.h +++ b/ltt-sessiond/trace.h @@ -38,7 +38,7 @@ struct ltt_kernel_event { /* Kernel channel */ struct ltt_kernel_channel { int fd; - struct lttng_channel *channel; + struct lttng_kernel_channel *channel; struct ltt_kernel_event_list events_list; };