<div dir="ltr">Merged with a memory leak fix, read on.<div><br></div><div>Thanks!</div><div>Jérémie</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 17, 2015 at 5:26 PM, Jonathan Rajotte <span dir="ltr"><<a href="mailto:jonathan.rajotte-julien@efficios.com" target="_blank">jonathan.rajotte-julien@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Signed-off-by: Jonathan Rajotte <<a href="mailto:jonathan.rajotte-julien@efficios.com" target="_blank">jonathan.rajotte-julien@efficios.com</a>><br>
---<br>
 src/bin/lttng-sessiond/save.c          | 10 ++++++++++<br>
 src/common/config/config-session-abi.h |  1 +<br>
 src/common/config/config.c             | 19 +++++++++++++++++++<br>
 src/common/config/session.xsd          |  1 +<br>
 4 files changed, 31 insertions(+)<br>
<br>
diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c<br>
index 0c6894b..d6316ef 100644<br>
--- a/src/bin/lttng-sessiond/save.c<br>
+++ b/src/bin/lttng-sessiond/save.c<br>
@@ -1663,6 +1663,16 @@ int save_session(struct ltt_session *session,<br>
                goto end;<br>
        }<br>
<br>
+       if(session->shm_path[0] != '\0') {<br>
+               ret = config_writer_write_element_string(writer,<br>
+                               config_element_shared_memory_path,<br>
+                               session->shm_path);<br>
+               if (ret) {<br>
+                       ret = LTTNG_ERR_SAVE_IO_FAIL;<br>
+                       goto end;<br>
+               }<br>
+       }<br>
+<br>
        ret = save_domains(writer, session);<br>
        if (ret) {<br>
                goto end;<br>
diff --git a/src/common/config/config-session-abi.h b/src/common/config/config-session-abi.h<br>
index 8cbff25..8ac5cb0 100644<br>
--- a/src/common/config/config-session-abi.h<br>
+++ b/src/common/config/config-session-abi.h<br>
@@ -67,6 +67,7 @@ const char * const config_element_data_uri;<br>
 const char * const config_element_max_size;<br>
 const char * const config_element_pid;<br>
 const char * const config_element_pids;<br>
+const char * const config_element_shared_memory_path;<br>
<br>
 const char * const config_domain_type_kernel;<br>
 const char * const config_domain_type_ust;<br>
diff --git a/src/common/config/config.c b/src/common/config/config.c<br>
index d84e38b..bc4f0c0 100644<br>
--- a/src/common/config/config.c<br>
+++ b/src/common/config/config.c<br>
@@ -117,6 +117,7 @@ const char * const config_element_data_uri = "data_uri";<br>
 const char * const config_element_max_size = "max_size";<br>
 const char * const config_element_pid = "pid";<br>
 const char * const config_element_pids = "pids";<br>
+const char * const config_element_shared_memory_path = "shared_memory_path";<br>
<br>
 const char * const config_domain_type_kernel = "KERNEL";<br>
 const char * const config_domain_type_ust = "UST";<br>
@@ -2172,6 +2173,7 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,<br>
        int ret, started = -1, snapshot_mode = -1;<br>
        uint64_t live_timer_interval = UINT64_MAX;<br>
        char *name = NULL;<br>
+       char *shm_path = NULL;<br>
        xmlNodePtr domains_node = NULL;<br>
        xmlNodePtr output_node = NULL;<br>
        xmlNodePtr node;<br>
@@ -2216,6 +2218,16 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,<br>
                        config_element_output)) {<br>
                        /* output */<br>
                        output_node = node;<br>
+               } else if (!shm_path && !strcmp((const char *) node->name,<br>
+                                       config_element_shared_memory_path)) {<br>
+                       /* shared memory path */<br>
+                       xmlChar *node_content = xmlNodeGetContent(node);<br></blockquote><div><br></div><div>As per the libxml docs[1]:<br></div><div><br></div><div>xmlNodeGetContent():<br></div><div><div>Returns:<span style="white-space:pre-wrap"> </span>a new #xmlChar * or NULL if no content is available. It's up to the caller to free the memory with xmlFree().</div></div><div><br></div><div>I have added an xmlFree() call to the teardown.</div><div><br></div><div>[1] <a href="http://xmlsoft.org/html/libxml-tree.html#xmlNodeGetContent" target="_blank">http://xmlsoft.org/html/libxml-tree.html#xmlNodeGetContent</a><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+                       if (!node_content) {<br>
+                               ret = -LTTNG_ERR_NOMEM;<br>
+                               goto error;<br>
+                       }<br>
+<br>
+                       shm_path = (char *) node_content;<br>
                } else {<br>
                        /* attributes, snapshot_mode or live_timer_interval */<br>
                        xmlNodePtr attributes_child =<br>
@@ -2356,6 +2368,13 @@ domain_init_error:<br>
                goto error;<br>
        }<br>
<br>
+       if (shm_path) {<br>
+               ret = lttng_set_session_shm_path(name, shm_path);<br>
+               if (ret) {<br>
+                       goto error;<br>
+               }<br>
+       }<br>
+<br>
        for (node = xmlFirstElementChild(domains_node); node;<br>
                node = xmlNextElementSibling(node)) {<br>
                ret = process_domain_node(node, name);<br>
diff --git a/src/common/config/session.xsd b/src/common/config/session.xsd<br>
index 6d74e85..0a7458d 100644<br>
--- a/src/common/config/session.xsd<br>
+++ b/src/common/config/session.xsd<br>
@@ -279,6 +279,7 @@ elementFormDefault="qualified" version="2.5"><br>
 <xs:complexType name="session_type"><br>
        <xs:all><br>
                <xs:element name="name" type="name_type"/><br>
+               <xs:element name="shared_memory_path" type="xs:string" minOccurs="0"/><br>
                <xs:element name="domains" type="domain_list_type" minOccurs="0"/><br>
                <xs:element name="started" type="xs:boolean" default="0" minOccurs="0"/><br>
                <xs:element name="attributes" type="session_attributes_type" minOccurs="0"/><br>
<span><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div>
</div></div>