Ejemplo n.º 1
0
/*
 * The lttng-ctl API does not expose all the information needed to load the
 * session configurations. Thus, we must send a load command to the session
 * daemon which will, in turn, load its current session configuration.
 */
int lttng_load_session(struct lttng_load_session_attr *attr)
{
	int ret;
	const char *url, *session_name;

	if (!attr) {
		ret = -LTTNG_ERR_INVALID;
		goto end;
	}

	url = attr->input_url[0] != '\0' ? attr->input_url : NULL;
	session_name = attr->session_name[0] != '\0' ?
			attr->session_name : NULL;

	ret = config_load_session(url, session_name, attr->overwrite, 0);

end:
	return ret;
}
Ejemplo n.º 2
0
/*
 * This thread loads session configurations once the session daemon is
 * ready to process client messages.
 */
void *thread_load_session(void *data)
{
	int ret;
	struct load_session_thread_data *info = data;

	DBG("[load-session-thread] Load session");

	ret = sem_wait(&info->message_thread_ready);
	if (ret) {
		PERROR("sem_wait message_thread_ready");
		goto end;
	}

	/* Override existing session and autoload also. */
	ret = config_load_session(info->path, NULL, 1, 1, NULL);
	if (ret) {
		ERR("Session load failed: %s", error_get_str(ret));
	}

end:
	sessiond_signal_parents();
	return NULL;
}