#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"
* 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;
rcu_read_lock();
uevent = trace_ust_find_event(uchan->events, event->name, filter,
- event->loglevel_type, event->loglevel, exclusion);
+ (enum lttng_ust_loglevel_type) event->loglevel_type,
+ event->loglevel, exclusion);
if (!uevent) {
ret = trace_ust_create_event(event, filter_expression,
filter, exclusion, internal_event, &uevent);
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 */
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,
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;
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;
}
* 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;