Change the UST event hash table match function
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index bbe7cb4180dda914676714496fe31c56d09bf56e..c9fb293be1ed74411d20238ec7f94663a613041e 100644 (file)
@@ -749,10 +749,10 @@ int lttng_stop_tracing_no_wait(const char *session_name)
 }
 
 /*
- * 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.
  */
@@ -774,9 +774,6 @@ int lttng_add_context(struct lttng_handle *handle,
        /* 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);
 
@@ -830,13 +827,13 @@ int lttng_enable_event(struct lttng_handle *handle,
 }
 
 /*
- * 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;
@@ -930,8 +927,10 @@ int lttng_set_event_filter(struct lttng_handle *handle,
        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);
 
@@ -1344,7 +1343,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain,
                attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
                attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
 
-               attr->subbuf_size = DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE;
+               attr->subbuf_size = default_get_kernel_channel_subbuf_size();
                attr->num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
                attr->output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
                break;
@@ -1358,7 +1357,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain,
                attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
                attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
 
-               attr->subbuf_size = DEFAULT_UST_CHANNEL_SUBBUF_SIZE;
+               attr->subbuf_size = default_get_ust_channel_subbuf_size();
                attr->num_subbuf = DEFAULT_UST_CHANNEL_SUBBUF_NUM;
                attr->output = DEFAULT_UST_CHANNEL_OUTPUT;
                break;
@@ -1606,17 +1605,7 @@ int _lttng_create_session_ext(const char *name, const char *url,
        memset(&lsm, 0, sizeof(lsm));
 
        lsm.cmd_type = LTTNG_CREATE_SESSION;
-       if (!strncmp(name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME))
-                       && strlen(name) == strlen(DEFAULT_SESSION_NAME)) {
-               ret = snprintf(lsm.session.name, sizeof(lsm.session.name), "%s-%s",
-                               name, datetime);
-               if (ret < 0) {
-                       PERROR("snprintf session name datetime");
-                       return -LTTNG_ERR_FATAL;
-               }
-       } else {
-               copy_string(lsm.session.name, name, sizeof(lsm.session.name));
-       }
+       copy_string(lsm.session.name, name, sizeof(lsm.session.name));
 
        /* There should never be a data URL */
        size = parse_str_urls_to_uri(url, NULL, &uris);
This page took 0.024145 seconds and 4 git commands to generate.