X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsave.c;h=b7d0cc80a40d4d9fb47d4b17aaaa9e683c7e2776;hp=489446d6311dc4d8048f5f525cf91fcab1e7eaa9;hb=1fc1b7c8ac91a5d3a468ee64a862f4df9592b1c5;hpb=1ae5e83e58569f50b38fde0afe3f2aa08010f354 diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index 489446d63..b7d0cc80a 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -32,7 +32,7 @@ #include "kernel.h" #include "save.h" #include "session.h" -#include "syscall.h" +#include "lttng-syscall.h" #include "trace-ust.h" #include "agent.h" @@ -104,6 +104,26 @@ int save_kernel_channel_attributes(struct config_writer *writer, if (ret) { goto end; } + + if (attr->extended.ptr) { + struct lttng_channel_extended *ext = NULL; + + ext = (struct lttng_channel_extended *) attr->extended.ptr; + ret = config_writer_write_element_unsigned_int(writer, + config_element_monitor_timer_interval, + ext->monitor_timer_interval); + if (ret) { + goto end; + } + + ret = config_writer_write_element_signed_int(writer, + config_element_blocking_timeout, + ext->blocking_timeout); + if (ret) { + goto end; + } + } + end: return ret ? LTTNG_ERR_SAVE_IO_FAIL : 0; } @@ -113,6 +133,7 @@ int save_ust_channel_attributes(struct config_writer *writer, struct lttng_ust_channel_attr *attr) { int ret; + struct ltt_ust_channel *channel = NULL; ret = config_writer_write_element_string(writer, config_element_overwrite_mode, @@ -156,6 +177,26 @@ int save_ust_channel_attributes(struct config_writer *writer, if (ret) { goto end; } + + ret = config_writer_write_element_signed_int(writer, + config_element_blocking_timeout, + attr->u.s.blocking_timeout); + if (ret) { + goto end; + } + + /* + * Fetch the monitor timer which is located in the parent of + * lttng_ust_channel_attr + */ + channel = caa_container_of(attr, struct ltt_ust_channel, attr); + ret = config_writer_write_element_unsigned_int(writer, + config_element_monitor_timer_interval, + channel->monitor_timer_interval); + if (ret) { + goto end; + } + end: return ret ? LTTNG_ERR_SAVE_IO_FAIL : 0; } @@ -708,7 +749,11 @@ int init_ust_event_from_agent_event(struct ltt_ust_event *ust_event, ust_event->enabled = agent_event->enabled; ust_event->attr.instrumentation = LTTNG_UST_TRACEPOINT; - strncpy(ust_event->attr.name, agent_event->name, LTTNG_SYMBOL_NAME_LEN); + if (lttng_strncpy(ust_event->attr.name, agent_event->name, + LTTNG_SYMBOL_NAME_LEN)) { + ret = -1; + goto end; + } switch (agent_event->loglevel_type) { case LTTNG_EVENT_LOGLEVEL_ALL: ust_loglevel_type = LTTNG_UST_LOGLEVEL_ALL; @@ -1628,7 +1673,7 @@ int save_consumer_output(struct config_writer *writer, switch (output->type) { case CONSUMER_DST_LOCAL: ret = config_writer_write_element_string(writer, - config_element_path, output->dst.trace_path); + config_element_path, output->dst.session_root_path); if (ret) { ret = LTTNG_ERR_SAVE_IO_FAIL; goto end; @@ -1988,7 +2033,8 @@ int save_session(struct ltt_session *session, goto end; } - if (session->snapshot_mode || session->live_timer) { + if (session->snapshot_mode || session->live_timer || + session->rotate_timer_period || session->rotate_size) { ret = config_writer_open_element(writer, config_element_attributes); if (ret) { ret = LTTNG_ERR_SAVE_IO_FAIL; @@ -2002,7 +2048,7 @@ int save_session(struct ltt_session *session, ret = LTTNG_ERR_SAVE_IO_FAIL; goto end; } - } else { + } else if (session->live_timer) { ret = config_writer_write_element_unsigned_int(writer, config_element_live_timer_interval, session->live_timer); if (ret) { @@ -2010,6 +2056,25 @@ int save_session(struct ltt_session *session, goto end; } } + if (session->rotate_timer_period) { + ret = config_writer_write_element_unsigned_int(writer, + config_element_rotation_timer_interval, + session->rotate_timer_period); + if (ret) { + ret = LTTNG_ERR_SAVE_IO_FAIL; + goto end; + } + } + + if (session->rotate_size) { + ret = config_writer_write_element_unsigned_int(writer, + config_element_rotation_size, + session->rotate_size); + if (ret) { + ret = LTTNG_ERR_SAVE_IO_FAIL; + goto end; + } + } /* /attributes */ ret = config_writer_close_element(writer); @@ -2049,6 +2114,13 @@ end: } } + if (file_opened) { + ret = close(fd); + if (ret) { + PERROR("Closing XML session configuration"); + } + } + return ret; }