Fix: lttng-ust 2.13 should not try to use notifiers from 2.12 or prior probes
[lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index 650e7290db331d62b75d8fe5a7b567502e7f8563..07267aed122ff469591b3062f628d5ecbfbbe89a 100644 (file)
@@ -562,6 +562,7 @@ int ustctl_create_event_notifier(int sock, struct lttng_ust_event_notifier *even
        struct ustcomm_ust_msg lum;
        struct ustcomm_ust_reply lur;
        struct lttng_ust_object_data *event_notifier_data;
+       ssize_t len;
        int ret;
 
        if (!event_notifier_group || !_event_notifier_data)
@@ -576,18 +577,21 @@ int ustctl_create_event_notifier(int sock, struct lttng_ust_event_notifier *even
        memset(&lum, 0, sizeof(lum));
        lum.handle = event_notifier_group->handle;
        lum.cmd = LTTNG_UST_EVENT_NOTIFIER_CREATE;
+       lum.u.event_notifier.len = sizeof(*event_notifier);
 
-       strncpy(lum.u.event_notifier.event.name, event_notifier->event.name,
-               LTTNG_UST_SYM_NAME_LEN);
-       lum.u.event_notifier.event.instrumentation = event_notifier->event.instrumentation;
-       lum.u.event_notifier.event.loglevel_type = event_notifier->event.loglevel_type;
-       lum.u.event_notifier.event.loglevel = event_notifier->event.loglevel;
-       lum.u.event_notifier.event.token = event_notifier->event.token;
        ret = ustcomm_send_app_cmd(sock, &lum, &lur);
        if (ret) {
                free(event_notifier_data);
                return ret;
        }
+       /* Send struct lttng_ust_event_notifier */
+       len = ustcomm_send_unix_sock(sock, event_notifier, sizeof(*event_notifier));
+       if (len != sizeof(*event_notifier)) {
+               if (len < 0)
+                       return len;
+               else
+                       return -EIO;
+       }
        event_notifier_data->handle = lur.ret_val;
        DBG("received event_notifier handle %u", event_notifier_data->handle);
        *_event_notifier_data = event_notifier_data;
@@ -2562,7 +2566,7 @@ int ustctl_create_counter_data(struct ustctl_daemon_counter *counter,
                struct lttng_ust_object_data **_counter_data)
 {
        struct lttng_ust_object_data *counter_data;
-       struct lttng_ust_counter_conf counter_conf;
+       struct lttng_ust_counter_conf counter_conf = {0};
        size_t i;
        int ret;
 
@@ -2578,10 +2582,10 @@ int ustctl_create_counter_data(struct ustctl_daemon_counter *counter,
        }
        switch (counter->attr->bitness) {
        case USTCTL_COUNTER_BITNESS_32:
-               counter_conf.bitness = LTTNG_UST_COUNTER_BITNESS_32BITS;
+               counter_conf.bitness = LTTNG_UST_COUNTER_BITNESS_32;
                break;
        case USTCTL_COUNTER_BITNESS_64:
-               counter_conf.bitness = LTTNG_UST_COUNTER_BITNESS_64BITS;
+               counter_conf.bitness = LTTNG_UST_COUNTER_BITNESS_64;
                break;
        default:
                return -EINVAL;
This page took 0.025906 seconds and 4 git commands to generate.