X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fevent.c;h=9369c526afdb801c58b550bf298c4bf8a871d5f6;hb=b77e9a3d093ea10ac62d7aac4921f0508825dffc;hp=f4b976f3b7ec27dfefa45bed373c5d01fbf10736;hpb=466fafb8de65985d15e67f0348b1623112f33c69;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index f4b976f3b..9369c526a 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -31,7 +31,8 @@ #include "event.h" #include "kernel.h" #include "lttng-sessiond.h" -#include "ust-ctl.h" +#include "lttng-ust-ctl.h" +#include "lttng-ust-error.h" #include "ust-app.h" #include "trace-kernel.h" #include "trace-ust.h" @@ -69,7 +70,7 @@ static void add_unique_ust_event(struct lttng_ht *ht, * If event_name is NULL all events of the specified type are disabled. */ int event_kernel_disable_event(struct ltt_kernel_channel *kchan, - char *event_name, enum lttng_event_type type) + const char *event_name, enum lttng_event_type type) { int ret, error = 0, found = 0; struct ltt_kernel_event *kevent; @@ -182,7 +183,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, filter = NULL; exclusion = NULL; if (ret != LTTNG_OK) { - goto error; + goto end; } /* Valid to set it after the goto error since uevent is still NULL */ @@ -217,11 +218,10 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, if (ret < 0) { if (ret == -LTTNG_UST_ERR_EXIST) { ret = LTTNG_ERR_UST_EVENT_EXIST; - goto end; } else { ret = LTTNG_ERR_UST_ENABLE_FAIL; - goto error; } + goto end; } DBG("Event UST %s %s in channel %s", uevent->attr.name, @@ -235,31 +235,13 @@ end: free(filter); free(exclusion); return ret; - -error: - /* - * Only destroy event on creation time (not enabling time) because if the - * event is found in the channel (to_create == 0), it means that at some - * point the enable_event worked and it's thus valid to keep it alive. - * Destroying it also implies that we also destroy it's shadow copy to sync - * everyone up. - */ - if (to_create) { - /* In this code path, the uevent was not added to the hash table */ - trace_ust_destroy_event(uevent); - } - rcu_read_unlock(); - free(filter_expression); - free(filter); - free(exclusion); - return ret; } /* * Disable UST tracepoint of a channel from a UST session. */ int event_ust_disable_tracepoint(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan, char *event_name) + struct ltt_ust_channel *uchan, const char *event_name) { int ret; struct ltt_ust_event *uevent; @@ -511,10 +493,12 @@ int event_agent_enable(struct ltt_ust_session *usess, filter = NULL; filter_expression = NULL; created = 1; + assert(!aevent->enabled); } - if (created && filter) { - ret = add_filter_app_ctx(filter, filter_expression, agt); + if (created && aevent->filter) { + ret = add_filter_app_ctx( + aevent->filter, aevent->filter_expression, agt); if (ret != LTTNG_OK) { goto error; } @@ -672,7 +656,7 @@ error: * Return LTTNG_OK on success or else a LTTNG_ERR* code. */ int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, - char *event_name) + const char *event_name) { int ret = LTTNG_OK; struct agent_event *aevent;