#include "kernel.h"
#include "save.h"
#include "session.h"
-#include "syscall.h"
+#include "lttng-syscall.h"
#include "trace-ust.h"
#include "agent.h"
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;
}
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,
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;
}
static
int save_agent_events(struct config_writer *writer,
- struct ltt_ust_channel *chan,
struct agent *agent)
{
int ret;
* the "agent" events associated with this channel and serialize
* them.
*/
- ret = save_agent_events(writer, ust_chan, agent);
+ ret = save_agent_events(writer, agent);
if (ret) {
goto end;
}
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;
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;
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) {
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);
}
}
+ if (file_opened) {
+ ret = close(fd);
+ if (ret) {
+ PERROR("Closing XML session configuration");
+ }
+ }
+
return ret;
}