[lttng-dev] [PATCH lttng-tools 1/3] Bring back event_ust_disable_all_tracepoints
Jérémie Galarneau
jeremie.galarneau at efficios.com
Wed Sep 16 16:31:59 EDT 2015
On Thu, Sep 10, 2015 at 4:10 PM, Jonathan Rajotte
<jonathan.rajotte-julien at efficios.com> wrote:
> Revert part of be42c96885c522f857f146fa6f7ae53856e3bed2
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/bin/lttng-sessiond/event.c | 54 ++++++++++++++++++++++++++++++++++++++++++
> src/bin/lttng-sessiond/event.h | 3 +++
> 2 files changed, 57 insertions(+)
>
> diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c
> index 8cca213..b5087a2 100644
> --- a/src/bin/lttng-sessiond/event.c
> +++ b/src/bin/lttng-sessiond/event.c
> @@ -354,6 +354,60 @@ error:
> }
>
> /*
> + * Disable all UST tracepoints for a channel from a UST session.
> + */
> +int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
> + struct ltt_ust_channel *uchan)
> +{
> + int ret, i, size;
> + struct lttng_ht_iter iter;
> + struct ltt_ust_event *uevent = NULL;
> + struct lttng_event *events = NULL;
> +
> + assert(usess);
> + assert(uchan);
> +
> + rcu_read_lock();
> +
> + /* Disabling existing events */
> + cds_lfht_for_each_entry(uchan->events->ht, &iter.iter, uevent,
> + node.node) {
> + if (uevent->enabled == 1) {
> + ret = event_ust_disable_tracepoint(usess, uchan,
> + uevent->attr.name);
> + if (ret < 0) {
> + continue;
> + }
> + }
> + }
> +
> + /* Get all UST available events */
> + size = ust_app_list_events(&events);
> + if (size < 0) {
> + ret = LTTNG_ERR_UST_LIST_FAIL;
> + goto error;
> + }
> +
> + for (i = 0; i < size; i++) {
> + ret = event_ust_disable_tracepoint(usess, uchan,
> + events[i].name);
> + if (ret != LTTNG_OK) {
> + /* Continue to disable the rest... */
> + continue;
> + }
> + }
> + free(events);
> +
> + rcu_read_unlock();
> + return LTTNG_OK;
> +
> +error:
> + free(events);
> + rcu_read_unlock();
Merged with a minor change to have a single return path which
simplifies the free + unlock.
Thanks!
Jérémie
> + return ret;
> +}
> +
> +/*
> * Enable all agent event for a given UST session.
> *
> * Return LTTNG_OK on success or else a LTTNG_ERR* code.
> diff --git a/src/bin/lttng-sessiond/event.h b/src/bin/lttng-sessiond/event.h
> index 2cf0d5e..7c5231d 100644
> --- a/src/bin/lttng-sessiond/event.h
> +++ b/src/bin/lttng-sessiond/event.h
> @@ -41,6 +41,9 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
> int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
> struct ltt_ust_channel *uchan, char *event_name);
>
> +int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
> + struct ltt_ust_channel *uchan);
> +
> int event_agent_enable(struct ltt_ust_session *usess, struct agent *agt,
> struct lttng_event *event, struct lttng_filter_bytecode *filter,
> char *filter_expression);
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list