assert(event);
free(event->filter);
+ free(event->filter_expression);
free(event);
}
struct lttng_ht_node_str node;
/* Bytecode filter associated with the event . NULL if none. */
+ char *filter_expression;
struct lttng_filter_bytecode *filter;
};
{
struct lttng_filter_bytecode *filter_copy = NULL;
+ char *filter_expression_copy = NULL;
if (filter) {
filter_copy = zmalloc(
}
memcpy(filter_copy, filter,
- sizeof(struct lttng_filter_bytecode)
- + filter->len);
+ sizeof(struct lttng_filter_bytecode)
+ + filter->len);
+ }
+
+ if (filter_expression) {
+ filter_expression_copy =
+ strdup(filter_expression);
+ if (!filter_expression) {
+ ret = LTTNG_ERR_NOMEM;
+ goto error_free_copy;
+ }
}
ret = cmd_enable_event(session, &tmp_dom,
(char *) default_chan_name,
- &uevent, filter_expression, filter_copy,
- NULL, wpipe);
- /* We have passed ownership */
- filter_expression = NULL;
+ &uevent, filter_expression_copy,
+ filter_copy, NULL, wpipe);
+ filter_copy = NULL;
+ filter_expression_copy = NULL;
+error_free_copy:
+ free(filter_copy);
+ free(filter_expression_copy);
}
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
/* The wild card * means that everything should be enabled. */
if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
- ret = event_agent_enable_all(usess, agt, event, filter);
+ ret = event_agent_enable_all(usess, agt, event, filter,
+ filter_expression);
filter = NULL;
} else {
- ret = event_agent_enable(usess, agt, event, filter);
+ ret = event_agent_enable(usess, agt, event, filter,
+ filter_expression);
filter = NULL;
}
if (ret != LTTNG_OK) {
*/
int event_agent_enable_all(struct ltt_ust_session *usess,
struct agent *agt, struct lttng_event *event,
- struct lttng_filter_bytecode *filter)
+ struct lttng_filter_bytecode *filter,
+ char *filter_expression)
{
int ret;
struct agent_event *aevent;
DBG("Event agent enabling ALL events for session %" PRIu64, usess->id);
/* Enable event on agent application through TCP socket. */
- ret = event_agent_enable(usess, agt, event, filter);
+ ret = event_agent_enable(usess, agt, event, filter, filter_expression);
if (ret != LTTNG_OK) {
goto error;
}
*/
int event_agent_enable(struct ltt_ust_session *usess,
struct agent *agt, struct lttng_event *event,
- struct lttng_filter_bytecode *filter)
+ struct lttng_filter_bytecode *filter,
+ char *filter_expression)
{
int ret, created = 0;
struct agent_event *aevent;
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);
+ struct lttng_event *event, struct lttng_filter_bytecode *filter,
+ char *filter_expression);
int event_agent_enable_all(struct ltt_ust_session *usess, struct agent *agt,
- struct lttng_event *event, struct lttng_filter_bytecode *filter);
+ struct lttng_event *event, struct lttng_filter_bytecode *filter,
+ char *filter_expression);
int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
char *event_name);