centralize sessiond config option handling
[lttng-tools.git] / src / bin / lttng-sessiond / save.c
index 1a98515fa0c73f0272c82b346aa102ff5f5117f8..3c6b5b8a01931540cbd050a9600f969e0076b471 100644 (file)
@@ -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;
 }
@@ -232,6 +273,18 @@ const char *get_kernel_context_type_string(
        case LTTNG_KERNEL_CONTEXT_HOSTNAME:
                context_type_string = config_event_context_hostname;
                break;
+       case LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE:
+               context_type_string = config_event_context_interruptible;
+               break;
+       case LTTNG_KERNEL_CONTEXT_PREEMPTIBLE:
+               context_type_string = config_event_context_preemptible;
+               break;
+       case LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE:
+               context_type_string = config_event_context_need_reschedule;
+               break;
+       case LTTNG_KERNEL_CONTEXT_MIGRATABLE:
+               context_type_string = config_event_context_migratable;
+               break;
        default:
                context_type_string = NULL;
        }
@@ -696,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;
@@ -2037,6 +2094,13 @@ end:
                }
        }
 
+       if (file_opened) {
+               ret = close(fd);
+               if (ret) {
+                       PERROR("Closing XML session configuration");
+               }
+       }
+
        return ret;
 }
 
This page took 0.025504 seconds and 5 git commands to generate.