#include "lttng-sessiond.h"
#include "health-sessiond.h"
#include "thread.h"
+#include "testpoint.h"
#include "kernel.h"
#include <common/kernel-ctl/kernel-ctl.h>
#include <urcu/list.h>
#include <urcu/rculfhash.h>
+
+int notifier_consumption_paused;
/*
* Destroy the thread data previously created by the init function.
*/
if (getuid() == 0) {
gid_t gid;
- ret = utils_get_group_id(config.tracing_group_name.value, true,
- &gid);
+ ret = utils_get_group_id(the_config.tracing_group_name.value,
+ true, &gid);
if (ret) {
/* Default to root group. */
gid = 0;
if (!state->executor) {
goto error;
}
+
+ state->restart_poll = false;
+
mark_thread_as_ready(handle);
end:
return 0;
goto end;
}
+ if (testpoint(sessiond_handle_notifier_event_pipe)) {
+ ret = 0;
+ goto end;
+ }
+
+ if (caa_unlikely(notifier_consumption_paused)) {
+ DBG("Event notifier notification consumption paused, sleeping...");
+ sleep(1);
+ goto end;
+ }
+
ret = handle_notification_thread_event_notification(
state, event_source_fd, domain);
if (ret) {
ret = -1;
goto end;
}
+
end:
return ret;
}
DBG("[notification-thread] Started notification thread");
- health_register(health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION);
+ health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION);
rcu_register_thread();
rcu_thread_online();
goto end;
}
+ if (testpoint(sessiond_thread_notification)) {
+ goto end;
+ }
+
while (true) {
int fd_count, i;
goto error;
}
+ /*
+ * Reset restart_poll flag so that calls below might turn it
+ * on.
+ */
+ state.restart_poll = false;
+
fd_count = ret;
for (i = 0; i < fd_count; i++) {
int fd = LTTNG_POLL_GETFD(&state.events, i);
}
}
}
+
+ /*
+ * Calls above might have changed the state of the
+ * FDs in `state.events`. Call _poll_wait() again to
+ * ensure we have a consistent state.
+ */
+ if (state.restart_poll) {
+ break;
+ }
}
}
exit:
end:
rcu_thread_offline();
rcu_unregister_thread();
- health_unregister(health_sessiond);
+ health_unregister(the_health_sessiond);
return NULL;
}