X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-commands.c;h=89eb37bb1ae82beba6be84eb765b996b171e2609;hb=0efb2ad7fc448283184e43d6fb0915febae45384;hp=44bee3d3ba6f634e4fe14db72db3e612ead6a5d6;hpb=b9a8d78fefbc856370939d9eb553d6e9c1fcc86a;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/notification-thread-commands.c b/src/bin/lttng-sessiond/notification-thread-commands.c index 44bee3d3b..89eb37bb1 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.c +++ b/src/bin/lttng-sessiond/notification-thread-commands.c @@ -111,7 +111,8 @@ error: enum lttng_error_code notification_thread_command_register_trigger( struct notification_thread_handle *handle, - struct lttng_trigger *trigger) + struct lttng_trigger *trigger, + bool is_trigger_anonymous) { int ret; enum lttng_error_code ret_code; @@ -123,6 +124,8 @@ enum lttng_error_code notification_thread_command_register_trigger( cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER; lttng_trigger_get(trigger); cmd.parameters.register_trigger.trigger = trigger; + cmd.parameters.register_trigger.is_trigger_anonymous = + is_trigger_anonymous; ret = run_command_wait(handle, &cmd); if (ret) { @@ -382,17 +385,48 @@ int notification_thread_client_communication_update( return run_command_no_wait(handle, &cmd); } +enum lttng_error_code notification_thread_command_get_trigger( + struct notification_thread_handle *handle, + const struct lttng_trigger *trigger, + struct lttng_trigger **real_trigger) +{ + int ret; + enum lttng_error_code ret_code; + struct notification_thread_command cmd = {}; + + init_notification_thread_command(&cmd); + + cmd.type = NOTIFICATION_COMMAND_TYPE_GET_TRIGGER; + cmd.parameters.get_trigger.trigger = trigger; + ret = run_command_wait(handle, &cmd); + if (ret) { + ret_code = LTTNG_ERR_UNK; + goto end; + } + + ret_code = cmd.reply_code; + *real_trigger = cmd.reply.get_trigger.trigger; + +end: + return ret_code; +} + +/* + * 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 +434,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 +449,6 @@ void lttng_event_notifier_notification_destroy( return; } + free(notification->capture_buffer); free(notification); }