common: Add index allocator for error counters
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.c
index 7d47b77459d3aa4f149e2df52e5b4aa81c6ceb07..b1b33343ba5da6ec663a981d944e70f9256861c6 100644 (file)
@@ -122,7 +122,7 @@ enum lttng_error_code notification_thread_command_register_trigger(
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER;
        lttng_trigger_get(trigger);
-       cmd.parameters.trigger = trigger;
+       cmd.parameters.register_trigger.trigger = trigger;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -136,7 +136,7 @@ end:
 
 enum lttng_error_code notification_thread_command_unregister_trigger(
                struct notification_thread_handle *handle,
-               struct lttng_trigger *trigger)
+               const struct lttng_trigger *trigger)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -145,7 +145,7 @@ enum lttng_error_code notification_thread_command_unregister_trigger(
        init_notification_thread_command(&cmd);
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER;
-       cmd.parameters.trigger = trigger;
+       cmd.parameters.unregister_trigger.trigger = trigger;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -381,3 +381,45 @@ int notification_thread_client_communication_update(
        cmd.parameters.client_communication_update.status = transmission_status;
        return run_command_no_wait(handle, &cmd);
 }
+
+/*
+ * Takes ownership of the payload if present.
+ */
+LTTNG_HIDDEN
+struct lttng_event_notifier_notification *lttng_event_notifier_notification_create(
+               uint64_t tracer_token,
+               enum lttng_domain_type domain,
+               char *payload,
+               size_t payload_size)
+{
+       struct lttng_event_notifier_notification *notification = NULL;
+
+       assert(domain != LTTNG_DOMAIN_NONE);
+       assert((payload && payload_size) || (!payload && !payload_size));
+
+       notification = zmalloc(sizeof(struct lttng_event_notifier_notification));
+       if (notification == NULL) {
+               ERR("[notification-thread] Error allocating notification");
+               goto end;
+       }
+
+       notification->tracer_token = tracer_token;
+       notification->type = domain;
+       notification->capture_buffer = payload;
+       notification->capture_buf_size = payload_size;
+
+end:
+       return notification;
+}
+
+LTTNG_HIDDEN
+void lttng_event_notifier_notification_destroy(
+               struct lttng_event_notifier_notification *notification)
+{
+       if (!notification) {
+               return;
+       }
+
+       free(notification->capture_buffer);
+       free(notification);
+}
This page took 0.024602 seconds and 4 git commands to generate.