<div dir="ltr">Looks good thanks</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 5, 2015 at 4:26 PM, Jérémie Galarneau <span dir="ltr"><<a href="mailto:jeremie.galarneau@efficios.com" target="_blank">jeremie.galarneau@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Sep 4, 2015 at 6:02 PM, Jonathan Rajotte<br>
<<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>> wrote:<br>
> v2: Include change to xsd. Looks like I forgot to squash it. I'll have to make<br>
> an offering to the git reflog god on this one.<br>
<br>
</span>Haha, I'm probably due for one too ;-)<br>
<br>
Merged, although I have removed the now-unused types process_type and<br>
processes_type.<br>
We'll add them back when we decide to make the clean-up.<br>
<br>
Also, there was a missing symbol, mi_lttng_element_pid_id, which I added back.<br>
<br>
Have a look at the merged version and let me know if I missed anything.<br>
<br>
commit bf239d4cf83c083459c7672ac8a1965108bacca6<br>
Author: Jonathan Rajotte <<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>><br>
Date: Fri Sep 4 18:02:48 2015 -0400<br>
<br>
Fix: use pid element instead of process element<br>
<span class=""><br>
v2: Include change to xsd. Looks like I forgot to squash it. I'll<br>
have to make<br>
an offering to the git reflog god on this one.<br>
<br>
For stable 2.7<br>
<br>
This revert part of changes introduced by [1] and [2].<br>
<br>
The use of process element break the existing MI xml api.<br>
<br>
[1] 46ef4d0715faeef52cd2242b5b895c74507e223a<br>
[2] a585578f837d992f00eba4f090c8ba251d9de94e<br>
<br>
Signed-off-by: Jonathan Rajotte <<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>><br>
</span> Signed-off-by: Jérémie Galarneau <<a href="mailto:jeremie.galarneau@efficios.com">jeremie.galarneau@efficios.com</a>><br>
<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888">Jérémie<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> For stable 2.7<br>
><br>
> This revert part of changes introduced by [1] and [2].<br>
><br>
> The use of process element break the existing MI xml api.<br>
><br>
> [1] 46ef4d0715faeef52cd2242b5b895c74507e223a<br>
> [2] a585578f837d992f00eba4f090c8ba251d9de94e<br>
><br>
> Signed-off-by: Jonathan Rajotte <<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>><br>
> ---<br>
> src/bin/lttng/commands/list.c | 18 ++++++++---------<br>
> src/common/mi-lttng.c | 41 +++++++++++++++++++++++++++++++++++++++<br>
> src/common/mi-lttng.h | 19 ++++++++++++++++++<br>
> src/common/mi_lttng.xsd | 15 +++++++++++---<br>
> tests/regression/tools/mi/test_mi | 2 +-<br>
> 5 files changed, 82 insertions(+), 13 deletions(-)<br>
><br>
> diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c<br>
> index f7f3852..3198eca 100644<br>
> --- a/src/bin/lttng/commands/list.c<br>
> +++ b/src/bin/lttng/commands/list.c<br>
> @@ -340,8 +340,8 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,<br>
> goto end;<br>
> }<br>
><br>
> - /* Open processes element */<br>
> - ret = mi_lttng_processes_open(writer);<br>
> + /* Open pids element element */<br>
> + ret = mi_lttng_pids_open(writer);<br>
> if (ret) {<br>
> goto end;<br>
> }<br>
> @@ -366,7 +366,7 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,<br>
><br>
> if (!pid_element_open) {<br>
> /* Open and write a pid element */<br>
> - ret = mi_lttng_process(writer, cur_pid, cmdline, 1);<br>
> + ret = mi_lttng_pid(writer, cur_pid, cmdline, 1);<br>
> if (ret) {<br>
> goto error;<br>
> }<br>
> @@ -389,7 +389,7 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,<br>
> }<br>
> }<br>
><br>
> - /* Close processes */<br>
> + /* Close pids */<br>
> ret = mi_lttng_writer_close_element(writer);<br>
> if (ret) {<br>
> goto end;<br>
> @@ -577,8 +577,8 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,<br>
> goto end;<br>
> }<br>
><br>
> - /* Open processes element */<br>
> - ret = mi_lttng_processes_open(writer);<br>
> + /* Open pids element */<br>
> + ret = mi_lttng_pids_open(writer);<br>
> if (ret) {<br>
> goto end;<br>
> }<br>
> @@ -606,8 +606,8 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,<br>
> cur_pid = fields[i].event.pid;<br>
> cmdline = get_cmdline_by_pid(cur_pid);<br>
> if (!pid_element_open) {<br>
> - /* Open and write a process element */<br>
> - ret = mi_lttng_process(writer, cur_pid, cmdline, 1);<br>
> + /* Open and write a pid element */<br>
> + ret = mi_lttng_pid(writer, cur_pid, cmdline, 1);<br>
> if (ret) {<br>
> goto error;<br>
> }<br>
> @@ -661,7 +661,7 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,<br>
> }<br>
> }<br>
><br>
> - /* Close processes, domain, domains */<br>
> + /* Close pid, domain, domains */<br>
> ret = mi_lttng_close_multi_element(writer, 3);<br>
> end:<br>
> return ret;<br>
> diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c<br>
> index 9d6500b..8fbd064 100644<br>
> --- a/src/common/mi-lttng.c<br>
> +++ b/src/common/mi-lttng.c<br>
> @@ -1199,6 +1199,47 @@ end:<br>
> return ret;<br>
> }<br>
><br>
> +/*<br>
> + * TODO: move the listing of pid for user agent to process semantic on<br>
> + * mi api bump. The use of process element break the mi api.<br>
> + */<br>
> +LTTNG_HIDDEN<br>
> +int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,<br>
> + int is_open)<br>
> +{<br>
> + int ret;<br>
> +<br>
> + /* Open pid process */<br>
> + ret = mi_lttng_writer_open_element(writer, config_element_pid);<br>
> + if (ret) {<br>
> + goto end;<br>
> + }<br>
> +<br>
> + /* Writing pid number */<br>
> + ret = mi_lttng_writer_write_element_signed_int(writer,<br>
> + mi_lttng_element_pid_id, (int)pid);<br>
> + if (ret) {<br>
> + goto end;<br>
> + }<br>
> +<br>
> + /* Writing name of the process */<br>
> + if (name) {<br>
> + ret = mi_lttng_writer_write_element_string(writer, config_element_name,<br>
> + name);<br>
> + if (ret) {<br>
> + goto end;<br>
> + }<br>
> + }<br>
> +<br>
> + if (!is_open) {<br>
> + /* Closing Pid */<br>
> + ret = mi_lttng_writer_close_element(writer);<br>
> + }<br>
> +<br>
> +end:<br>
> + return ret;<br>
> +}<br>
> +<br>
> LTTNG_HIDDEN<br>
> int mi_lttng_targets_open(struct mi_writer *writer)<br>
> {<br>
> diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h<br>
> index 23b7810..5344a23 100644<br>
> --- a/src/common/mi-lttng.h<br>
> +++ b/src/common/mi-lttng.h<br>
> @@ -619,6 +619,25 @@ int mi_lttng_processes_open(struct mi_writer *writer);<br>
> */<br>
> int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,<br>
> int is_open);<br>
> +<br>
> +/*<br>
> + * TODO: move pid of lttng list -u to process semantic on mi api bump<br>
> + * Machine interface of a Process.<br>
> + *<br>
> + * writer An instance of a machine interface writer.<br>
> + * pid A PID.<br>
> + *<br>
> + * is_open Defines whether or not the session element shall be closed.<br>
> + * This should be used carefully and the client<br>
> + * must close the pid element.<br>
> + * Use case: nested addition information on a domain<br>
> + * ex: channel event.<br>
> + *<br>
> + * Returns zero if the element's value could be written.<br>
> + * Negative values indicate an error.<br>
> + */<br>
> +int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,<br>
> + int is_open);<br>
> /*<br>
> * Machine interface: open a targets element.<br>
> *<br>
> diff --git a/src/common/mi_lttng.xsd b/src/common/mi_lttng.xsd<br>
> index 11d60d0..24978e4 100644<br>
> --- a/src/common/mi_lttng.xsd<br>
> +++ b/src/common/mi_lttng.xsd<br>
> @@ -273,10 +273,19 @@ THE SOFTWARE.<br>
> </xs:all><br>
> </xs:complexType><br>
><br>
> - <!-- Maps to an array of pid --><br>
> + <!-- map to a pid --><br>
> + <xs:complexType name="pid_type"><br>
> + <xs:all><br>
> + <xs:element name="id" type="xs:int" /><br>
> + <xs:element name="name" type="name_type" /><br>
> + <xs:element name="events" type="event_list_type" minOccurs="0" /><br>
> + </xs:all><br>
> + </xs:complexType><br>
> +<br>
> + <!-- maps to an array of pid --><br>
> <xs:complexType name="pids_type"><br>
> <xs:sequence><br>
> - <xs:element name="pid" type="xs:int" minOccurs="0" maxOccurs="unbounded" /><br>
> + <xs:element name="pid" type="pid_type" minOccurs="0" maxOccurs="unbounded" /><br>
> </xs:sequence><br>
> </xs:complexType><br>
><br>
> @@ -339,7 +348,7 @@ THE SOFTWARE.<br>
> <xs:all><br>
> <xs:element name="type" type="domain_type_type" /><br>
> <xs:element name="buffer_type" type="domain_buffer_type" /><br>
> - <xs:element name="processes" type="processes_type" minOccurs="0" /><br>
> + <xs:element name="pids" type="pids_type" minOccurs="0" /><br>
> <xs:element name="channels" type="channels_type" minOccurs="0" /><br>
> <xs:element name="events" type="event_list_type" minOccurs="0" /><br>
> <xs:element name="trackers" type="trackers_type" minOccurs="0" /><br>
> diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi<br>
> index 7f22ee1..47ec1b1 100755<br>
> --- a/tests/regression/tools/mi/test_mi<br>
> +++ b/tests/regression/tools/mi/test_mi<br>
> @@ -48,7 +48,7 @@ XPATH_ENABLE_EVENT_SUCCESS="$XPATH_CMD_OUTPUT/events/event/success/text()"<br>
> XPATH_DISABLE_EVENT_SUCCESS="$XPATH_CMD_OUTPUT/channel/events/event/success/text()"<br>
> XPATH_LIST_DOMAIN="$XPATH_CMD_OUTPUT/sessions/session/domains/domain"<br>
> XPATH_LIST_CHANNEL="$XPATH_CMD_OUTPUT/sessions/session/domains/domain/channels/channel"<br>
> -XPATH_LIST_UST_EVENT="$XPATH_CMD_OUTPUT/domains/domain[./type ='UST']/processes/process/events/event"<br>
> +XPATH_LIST_UST_EVENT="$XPATH_CMD_OUTPUT/domains/domain[./type ='UST']/pids/pid/events/event"<br>
> XPATH_SNAPSHOT_ADD_SNAPSHOT="$XPATH_CMD_OUTPUT/snapshot_action[./name = 'add-output']/output"<br>
> XPATH_SNAPSHOT_LIST="$XPATH_CMD_OUTPUT/snapshot_action[./name = 'list-output']/output"<br>
> XPATH_SNAPSHOT_DEL="$XPATH_CMD_OUTPUT/snapshot_action[./name = 'del-output']/output"<br>
> --<br>
> 2.1.4<br>
><br>
<br>
<br>
<br>
</div></div><span class="im HOEnZb">--<br>
Jérémie Galarneau<br>
EfficiOS Inc.<br>
<a href="http://www.efficios.com" rel="noreferrer" target="_blank">http://www.efficios.com</a><br>
<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
lttng-dev mailing list<br>
<a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
<a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" rel="noreferrer" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Jonathan Rajotte Julien<div><br></div></div></div></div></div>
</div>