X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-commands.c;h=7cbd5d509a81a5e1167c8ae00250fd45831cceb0;hp=a3b41f989e72d5de6e116af5f5730a03f8f05c33;hb=ac16173e318279dee29504820e3c2ad8ea597712;hpb=ae0a823f9f7e1d3800479488a58efc2f92f27d89 diff --git a/src/bin/lttng-sessiond/notification-thread-commands.c b/src/bin/lttng-sessiond/notification-thread-commands.c index a3b41f989..7cbd5d509 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.c +++ b/src/bin/lttng-sessiond/notification-thread-commands.c @@ -117,10 +117,12 @@ enum lttng_error_code notification_thread_command_register_trigger( enum lttng_error_code ret_code; struct notification_thread_command cmd = {}; + assert(trigger); init_notification_thread_command(&cmd); cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER; - cmd.parameters.trigger = trigger; + lttng_trigger_get(trigger); + cmd.parameters.register_trigger.trigger = trigger; ret = run_command_wait(handle, &cmd); if (ret) { @@ -134,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; @@ -143,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) { @@ -268,6 +270,90 @@ end: return ret_code; } +enum lttng_error_code notification_thread_command_add_tracer_event_source( + struct notification_thread_handle *handle, + int tracer_event_source_fd, + enum lttng_domain_type domain) +{ + int ret; + enum lttng_error_code ret_code; + struct notification_thread_command cmd = {}; + + assert(tracer_event_source_fd >= 0); + + init_notification_thread_command(&cmd); + + cmd.type = NOTIFICATION_COMMAND_TYPE_ADD_TRACER_EVENT_SOURCE; + cmd.parameters.tracer_event_source.tracer_event_source_fd = + tracer_event_source_fd; + cmd.parameters.tracer_event_source.domain = domain; + + ret = run_command_wait(handle, &cmd); + if (ret) { + ret_code = LTTNG_ERR_UNK; + goto end; + } + + ret_code = cmd.reply_code; +end: + return ret_code; +} + +enum lttng_error_code notification_thread_command_remove_tracer_event_source( + struct notification_thread_handle *handle, + int tracer_event_source_fd) +{ + int ret; + enum lttng_error_code ret_code; + struct notification_thread_command cmd = {}; + + init_notification_thread_command(&cmd); + + cmd.type = NOTIFICATION_COMMAND_TYPE_REMOVE_TRACER_EVENT_SOURCE; + cmd.parameters.tracer_event_source.tracer_event_source_fd = + tracer_event_source_fd; + + ret = run_command_wait(handle, &cmd); + if (ret) { + ret_code = LTTNG_ERR_UNK; + goto end; + } + + ret_code = cmd.reply_code; +end: + return ret_code; +} + +enum lttng_error_code notification_thread_command_list_triggers( + struct notification_thread_handle *handle, + uid_t uid, + struct lttng_triggers **triggers) +{ + int ret; + enum lttng_error_code ret_code; + struct notification_thread_command cmd = {}; + + assert(handle); + assert(triggers); + + init_notification_thread_command(&cmd); + + cmd.type = NOTIFICATION_COMMAND_TYPE_LIST_TRIGGERS; + cmd.parameters.list_triggers.uid = uid; + + ret = run_command_wait(handle, &cmd); + if (ret) { + ret_code = LTTNG_ERR_UNK; + goto end; + } + + ret_code = cmd.reply_code; + *triggers = cmd.reply.list_triggers.triggers; + +end: + return ret_code; +} + void notification_thread_command_quit( struct notification_thread_handle *handle) { @@ -280,3 +366,18 @@ void notification_thread_command_quit( ret = run_command_wait(handle, &cmd); assert(!ret && cmd.reply_code == LTTNG_OK); } + +int notification_thread_client_communication_update( + struct notification_thread_handle *handle, + notification_client_id id, + enum client_transmission_status transmission_status) +{ + struct notification_thread_command cmd = {}; + + init_notification_thread_command(&cmd); + + cmd.type = NOTIFICATION_COMMAND_TYPE_CLIENT_COMMUNICATION_UPDATE; + cmd.parameters.client_communication_update.id = id; + cmd.parameters.client_communication_update.status = transmission_status; + return run_command_no_wait(handle, &cmd); +}