- ERR("UST registry create event add unique failed for event: %s, "
- "sig: %s, id: %u, chan_objd: %u, sess_objd: %u", event->name,
- event->signature, event->id, event->channel_objd,
- event->session_objd);
- ret = -EINVAL;
- goto error_unlock;
+ if (buffer_type == LTTNG_BUFFER_PER_UID) {
+ /*
+ * This is normal, we just have to send the event id of the
+ * returned node and make sure we destroy the previously allocated
+ * event object.
+ */
+ destroy_event(event);
+ event = caa_container_of(nptr, struct ust_registry_event,
+ node.node);
+ assert(event);
+ event_id = event->id;
+ } else {
+ ERR("UST registry create event add unique failed for event: %s, "
+ "sig: %s, id: %u, chan_objd: %u, sess_objd: %u",
+ event->name, event->signature, event->id,
+ event->channel_objd, event->session_objd);
+ ret = -EINVAL;
+ goto error_unlock;
+ }
+ } else {
+ /* Request next event id if the node was successfully added. */
+ event_id = event->id = ust_registry_get_next_event_id(chan);