}
/*
- * Add context to event and/or channel.
- * If event_name is NULL, the context is applied to all events of the channel.
- * If channel_name is NULL, a lookup of the event's channel is done.
- * If both are NULL, the context is applied to all events of all channels.
+ * Add context to a channel.
+ *
+ * If the given channel is NULL, add the contexts to all channels.
+ * The event_name param is ignored.
*
* Returns the size of the returned payload data or a negative error code.
*/
/* Copy channel name */
copy_string(lsm.u.context.channel_name, channel_name,
sizeof(lsm.u.context.channel_name));
- /* Copy event name */
- copy_string(lsm.u.context.event_name, event_name,
- sizeof(lsm.u.context.event_name));
copy_lttng_domain(&lsm.domain, &handle->domain);
}
/*
- * set filter for an event
+ * Set filter for an event
+ *
* Return negative error value on error.
* Return size of returned session payload data if OK.
*/
-
int lttng_set_event_filter(struct lttng_handle *handle,
- const char *event_name, const char *channel_name,
+ struct lttng_event *event, const char *channel_name,
const char *filter_expression)
{
struct lttcomm_session_msg lsm;
copy_string(lsm.u.filter.channel_name, channel_name,
sizeof(lsm.u.filter.channel_name));
/* Copy event name */
- copy_string(lsm.u.filter.event_name, event_name,
- sizeof(lsm.u.filter.event_name));
+ if (event) {
+ memcpy(&lsm.u.enable.event, event, sizeof(lsm.u.enable.event));
+ }
+
lsm.u.filter.bytecode_len = sizeof(ctx->bytecode->b)
+ bytecode_get_len(&ctx->bytecode->b);