.instrumentation = LTTNG_KERNEL_TRACEPOINTS,
.name = "lttng_metadata",
};
- char *event_name = "lttng_metadata";
struct ltt_event *event;
int ret;
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
- event = ltt_event_create(channel, event_name, &metadata_params, NULL);
+ event = ltt_event_create(channel, &metadata_params, NULL);
if (!event) {
goto create_error;
ret = -EEXIST;
{
struct ltt_channel *channel = channel_file->private_data;
struct ltt_event *event;
- char *event_name;
struct lttng_kernel_event event_param;
int event_fd, ret;
struct file *event_file;
if (copy_from_user(&event_param, uevent_param, sizeof(event_param)))
return -EFAULT;
- event_name = kmalloc(PATH_MAX, GFP_KERNEL);
- if (!event_name)
- return -ENOMEM;
- if (strncpy_from_user(event_name, uevent_param->name, PATH_MAX) < 0) {
- ret = -EFAULT;
- goto name_error;
- }
- event_name[PATH_MAX - 1] = '\0';
+ event_param.name[LTTNG_SYM_NAME_LEN - 1] = '\0';
switch (event_param.instrumentation) {
case LTTNG_KERNEL_KPROBES:
event_param.u.kprobe.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0';
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
- event = ltt_event_create(channel, event_name, &event_param, NULL);
+ event = ltt_event_create(channel, &event_param, NULL);
if (!event) {
ret = -EEXIST;
goto event_error;
fd_install(event_fd, event_file);
/* The event holds a reference on the channel */
atomic_long_inc(&channel_file->f_count);
- kfree(event_name);
return event_fd;
event_error:
file_error:
put_unused_fd(event_fd);
fd_error:
-name_error:
- kfree(event_name);
return ret;
}
/*
* Supports event creation while tracing session is active.
*/
-struct ltt_event *ltt_event_create(struct ltt_channel *chan, char *name,
+struct ltt_event *ltt_event_create(struct ltt_channel *chan,
struct lttng_kernel_event *event_param,
void *filter)
{
* creation). Might require a hash if we have lots of events.
*/
list_for_each_entry(event, &chan->session->events, list)
- if (!strcmp(event->desc->name, name))
+ if (!strcmp(event->desc->name, event_param->name))
goto exist;
event = kmem_cache_zalloc(event_cache, GFP_KERNEL);
if (!event)
smp_wmb();
switch (event_param->instrumentation) {
case LTTNG_KERNEL_TRACEPOINTS:
- event->desc = ltt_event_get(name);
+ event->desc = ltt_event_get(event_param->name);
if (!event->desc)
goto register_error;
- ret = tracepoint_probe_register(name,
+ ret = tracepoint_probe_register(event_param->name,
event->desc->probe_callback,
event);
if (ret)
goto register_error;
break;
case LTTNG_KERNEL_KPROBES:
- ret = lttng_kprobes_register(name,
+ ret = lttng_kprobes_register(event_param->name,
event_param->u.kprobe.symbol_name,
event_param->u.kprobe.offset,
event_param->u.kprobe.addr,
goto register_error;
break;
case LTTNG_KERNEL_FUNCTION_TRACER:
- ret = lttng_ftrace_register(name,
+ ret = lttng_ftrace_register(event_param->name,
event_param->u.ftrace.symbol_name,
event);
if (ret)
return event;
statedump_error:
- WARN_ON_ONCE(tracepoint_probe_unregister(name,
+ WARN_ON_ONCE(tracepoint_probe_unregister(event_param->name,
event->desc->probe_callback,
event));
ltt_event_put(event->desc);
static
int _ltt_session_metadata_statedump(struct ltt_session *session)
{
- char uuid_s[37];
+ unsigned char *uuid_c = session->uuid.b;
+ unsigned char uuid_s[37];
struct ltt_channel *chan;
struct ltt_event *event;
int ret = 0;
}
snprintf(uuid_s, sizeof(uuid_s),
- "%x%x%x%x-%x%x-%x%x-%x%x-%x%x%x%x%x%x",
- uuid_s[0], uuid_s[1], uuid_s[2], uuid_s[3],
- uuid_s[4], uuid_s[5], uuid_s[6], uuid_s[7],
- uuid_s[8], uuid_s[9], uuid_s[10], uuid_s[11],
- uuid_s[12], uuid_s[13], uuid_s[14], uuid_s[15]);
+ "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ uuid_c[0], uuid_c[1], uuid_c[2], uuid_c[3],
+ uuid_c[4], uuid_c[5], uuid_c[6], uuid_c[7],
+ uuid_c[8], uuid_c[9], uuid_c[10], uuid_c[11],
+ uuid_c[12], uuid_c[13], uuid_c[14], uuid_c[15]);
ret = lttng_metadata_printf(session,
"typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n"
"trace {\n"
" major = %u;\n"
" minor = %u;\n"
- " uuid = %s;\n"
+ " uuid = \"%s\";\n"
" byte_order = %s;\n"
" packet.header := struct {\n"
" uint32_t magic;\n"