- ret = handle_notification_thread_command_remove_tracer_event_source(
- state, tracer_event_source_fd, &cmd_result);
- (void) cmd_result;
+ return ret;
+}
+
+static
+int handle_notification_thread_command_remove_tracer_event_source(
+ struct notification_thread_state *state,
+ int tracer_event_source_fd,
+ enum lttng_error_code *_cmd_result)
+{
+ int ret = 0;
+ enum lttng_error_code cmd_result = LTTNG_OK;
+ struct notification_event_tracer_event_source_element *source_element = NULL;
+
+ source_element = find_tracer_event_source_element(state,
+ tracer_event_source_fd);
+
+ assert(source_element);
+
+ /* Remove the tracer source from the list. */
+ cds_list_del(&source_element->node);
+
+ if (!source_element->is_fd_in_poll_set) {
+ /* Skip the poll set removal. */
+ goto end;
+ }
+
+ ret = remove_tracer_event_source_from_pollset(state, source_element);
+ if (ret) {
+ ERR("Failed to remove tracer event source from poll set");
+ cmd_result = LTTNG_ERR_FATAL;
+ }
+
+end:
+ free(source_element);
+ *_cmd_result = cmd_result;