Protocol bump from 9 to 10
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 Nov 2021 19:06:08 +0000 (14:06 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Jul 2024 15:39:52 +0000 (11:39 -0400)
Bump LTTNG_UST_ABI_MAJOR_VERSION from 9 to 10, but keep backward
compatibility unchanged (oldest compatible 8) for applications linked
against older liblttng-ust.

With this protocol bump, we can send a 64-bit "id" in the event
registration reply. We keep the 32-bit event id field for now, until we
can proceed to bump the oldest compatible major number.

The 64-bit id field is useful for events within "counter" channels, but
there is no point in keeping a 32-bit value solely for the ring buffer
channel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd3da4c8156886a6d2f6555462526bb717c451dd

include/lttng/ust-ctl.h
src/common/ustcomm.c
src/common/ustcomm.h
src/lib/lttng-ust-ctl/ustctl.c
src/lib/lttng-ust/lttng-events.c

index 07f08ca79ca5fd6d7e0ad4f9b72a2e0db651b832..3c197394c3d49c2c5164ba6c6d1cc144aa605095 100644 (file)
@@ -543,8 +543,7 @@ int lttng_ust_ctl_recv_register_event(int sock,
  * Returns 0 on success, negative error value on error.
  */
 int lttng_ust_ctl_reply_register_event(int sock,
-       uint32_t event_id,              /* event id (input) */
-       uint64_t counter_index,         /* counter index (input) */
+       uint64_t id,                    /* id (input) */
        int ret_code);                  /* return code. 0 ok, negative error */
 
 /*
index 2435e380712f508c203faf858310fee874fc0e0d..1cf368b8fdfbebd7a39d5abb918e9e0f421d10b0 100644 (file)
@@ -1370,8 +1370,7 @@ int ustcomm_register_event(int sock,
        const struct lttng_ust_event_field * const *lttng_fields,
        const char *model_emf_uri,
        uint64_t user_token,
-       uint32_t *event_id,             /* event id (output) */
-       uint64_t *counter_index)        /* counter index (output) */
+       uint64_t *id)                   /* event id (output) */
 {
        ssize_t len;
        struct {
@@ -1478,12 +1477,9 @@ int ustcomm_register_event(int sock,
                        return -EINVAL;
                if (reply.r.ret_code < 0)
                        return reply.r.ret_code;
-               if (event_id)
-                       *event_id = reply.r.event_id;
-               if (counter_index)
-                       *counter_index = reply.r.counter_index;
-               DBG("Sent register event notification for name \"%s\": ret_code %d, event_id %u, counter_index %" PRIu64 "\n",
-                       event_name, reply.r.ret_code, reply.r.event_id, reply.r.counter_index);
+               *id = reply.r.id;
+               DBG("Sent register event notification for name \"%s\": ret_code %d, id %" PRIu64 "\n",
+                       event_name, reply.r.ret_code, reply.r.id);
                return 0;
        default:
                if (len < 0) {
index ce8a6ce734fd3bf20e7ffc70f3cfd1f8a125ff05..6b5553919fb1132d662ca24ae20555a81fc87974 100644 (file)
@@ -147,8 +147,10 @@ struct ustcomm_notify_event_msg {
 #define USTCOMM_NOTIFY_EVENT_REPLY_PADDING     24
 struct ustcomm_notify_event_reply {
        int32_t ret_code;       /* 0: ok, negative: error code */
-       uint32_t event_id;      /* for ring buffer channel events */
-       uint64_t counter_index; /* for counter channel events */
+
+       /* 32-bit (lower bits) event id for backward compatibility with ABI major < 10 */
+       uint32_t old_event_id;  /* TODO: remove field on future protocol compatibility break. */
+       uint64_t id;            /* 64-bit event id.  */
        char padding[USTCOMM_NOTIFY_EVENT_REPLY_PADDING];
 } __attribute__((packed));
 
@@ -290,8 +292,7 @@ int ustcomm_register_event(int sock,
        const struct lttng_ust_event_field * const *fields,
        const char *model_emf_uri,
        uint64_t user_token,
-       uint32_t *id,                   /* event id (output) */
-       uint64_t *counter_index)        /* counter index (output) */
+       uint64_t *id)                   /* (output) */
        __attribute__((visibility("hidden")));
 
 /*
index ba4edbb4c717f32e0befeb0d3cd86553ada144ef..bf8c137386621ad11338ce4cbaa52cdd24b65057 100644 (file)
@@ -2681,8 +2681,7 @@ signature_error:
  * Returns 0 on success, negative error value on error.
  */
 int lttng_ust_ctl_reply_register_event(int sock,
-       uint32_t event_id,
-       uint64_t counter_index,
+       uint64_t id,
        int ret_code)
 {
        ssize_t len;
@@ -2694,8 +2693,8 @@ int lttng_ust_ctl_reply_register_event(int sock,
        memset(&reply, 0, sizeof(reply));
        reply.header.notify_cmd = LTTNG_UST_CTL_NOTIFY_CMD_EVENT;
        reply.r.ret_code = ret_code;
-       reply.r.event_id = event_id;
-       reply.r.counter_index = counter_index;
+       reply.r.old_event_id = (uint32_t) id;   /* For backward compatibility */
+       reply.r.id = id;
        len = ustcomm_send_unix_sock(sock, &reply, sizeof(reply));
        if (len > 0 && len != sizeof(reply))
                return -EIO;
index 65d02ed56523ee3c17a85f1aab78e749c84ed29e..cbc887d03846647ed28399bcbbff3a5157bbce71 100644 (file)
@@ -965,13 +965,15 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                struct lttng_ust_event_recorder_private *event_recorder_priv =
                        caa_container_of(event->priv, struct lttng_ust_event_recorder_private, parent.parent);
                struct lttng_ust_session *session = event_recorder_enabler->chan->parent->session;
+               uint64_t id;
+               int ret;
 
                notify_socket = lttng_get_notify_socket(session->priv->owner);
                if (notify_socket < 0)
                        return notify_socket;
 
                /* Fetch event ID from sessiond */
-               return ustcomm_register_event(notify_socket,
+               ret = ustcomm_register_event(notify_socket,
                        session,
                        session->priv->objd,
                        event_recorder_enabler->chan->priv->parent.objd,
@@ -982,8 +984,11 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                        desc->tp_class->fields,
                        uri,
                        0,
-                       &event_recorder_priv->id,
-                       NULL);
+                       &id);
+               if (ret)
+                       return ret;
+               event_recorder_priv->id = id;
+               return 0;
        }
 
        case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
@@ -1013,7 +1018,6 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                        desc->tp_class->fields,
                        uri,
                        event_counter_enabler->parent.parent.user_token,
-                       NULL,
                        &event_counter_priv->counter_index);
        }
        default:
This page took 0.028407 seconds and 4 git commands to generate.