X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-commands.c;h=b1b33343ba5da6ec663a981d944e70f9256861c6;hp=44bee3d3ba6f634e4fe14db72db3e612ead6a5d6;hb=82b3cbf431e12b5c5f65eaa474d0328fb86ece87;hpb=3d1384a4add389c38f8554130e8dec2e2d06009d diff --git a/src/bin/lttng-sessiond/notification-thread-commands.c b/src/bin/lttng-sessiond/notification-thread-commands.c index 44bee3d3b..b1b33343b 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.c +++ b/src/bin/lttng-sessiond/notification-thread-commands.c @@ -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); }