notification: fetch capture payload on notification reception
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.c
index 44bee3d3ba6f634e4fe14db72db3e612ead6a5d6..b1b33343ba5da6ec663a981d944e70f9256861c6 100644 (file)
@@ -382,17 +382,22 @@ int notification_thread_client_communication_update(
        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)
+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));
+       notification = zmalloc(sizeof(struct lttng_event_notifier_notification));
        if (notification == NULL) {
                ERR("[notification-thread] Error allocating notification");
                goto end;
@@ -400,6 +405,8 @@ lttng_event_notifier_notification_create(uint64_t tracer_token,
 
        notification->tracer_token = tracer_token;
        notification->type = domain;
+       notification->capture_buffer = payload;
+       notification->capture_buf_size = payload_size;
 
 end:
        return notification;
@@ -413,5 +420,6 @@ void lttng_event_notifier_notification_destroy(
                return;
        }
 
+       free(notification->capture_buffer);
        free(notification);
 }
This page took 0.023422 seconds and 4 git commands to generate.