snapshot.c snapshot.h \
agent.c agent.h \
save.h save.c \
- load-session-thread.h load-session-thread.c \
lttng-syscall.h lttng-syscall.c \
notification-thread.h notification-thread.c \
notification-thread-internal.h \
+++ /dev/null
-/*
- * Copyright (C) 2014 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define _LGPL_SOURCE
-#include <common/error.h>
-#include <common/config/session-config.h>
-
-#include "load-session-thread.h"
-#include "lttng-sessiond.h"
-
-/*
- * Destroy the thread data previously created with the init function.
- */
-void load_session_destroy_data(struct load_session_thread_data *data)
-{
- if (!data) {
- return;
- }
-}
-
-/*
- * Initialize the thread data. This MUST be called before the thread load
- * session is created.
- *
- * Return 0 on success else a negative value. Note that the destroy function
- * can be called with no or partially initialized data.
- */
-int load_session_init_data(struct load_session_thread_data **data)
-{
- struct load_session_thread_data *_data = NULL;
-
- assert(data);
-
- /*
- * Allocate memory here since this function is called from the main thread
- * can die *before* the end of the load session thread.
- */
- _data = zmalloc(sizeof(*_data));
- if (!_data) {
- PERROR("zmalloc load session info");
- goto error;
- }
-
- *data = _data;
- return 0;
-
-error:
- free(_data);
- return -1;
-}
-
-/*
- * 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");
-
- /* 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));
- }
-
- sessiond_signal_parents();
- return NULL;
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LOAD_SESSION_THREAD_H
-#define LOAD_SESSION_THREAD_H
-
-#include <semaphore.h>
-
-/* Data passed to the thread. */
-struct load_session_thread_data {
- /* Path where the sessions are located. */
- const char *path;
-};
-
-void *thread_load_session(void *data);
-
-int load_session_init_data(struct load_session_thread_data **data);
-void load_session_destroy_data(struct load_session_thread_data *data);
-
-#endif /* LOAD_SESSION_THREAD_H */
#include "ust-thread.h"
#include "agent-thread.h"
#include "save.h"
-#include "load-session-thread.h"
#include "notification-thread.h"
#include "notification-thread-commands.h"
#include "rotation-thread.h"
static int apps_cmd_pipe[2] = { -1, -1 };
static int apps_cmd_notify_pipe[2] = { -1, -1 };
-/* Pthread, Mutexes and Semaphores */
-static pthread_t load_session_thread;
-
/*
* UST registration command queue. This queue is tied with a futex and uses a N
* wakers / 1 waiter implemented and detailed in futex.c/.h
static const char *module_proc_lttng = "/proc/lttng";
-/* Load session thread information to operate. */
-static struct load_session_thread_data *load_info;
-
/*
* Section name to look for in the daemon configuration file.
*/
close_consumer_sockets();
- if (load_info) {
- load_session_destroy_data(load_info);
- free(load_info);
- }
-
/*
* We do NOT rmdir rundir because there are other processes
* using it, for instance lttng-relayd, which can start in
int main(int argc, char **argv)
{
int ret = 0, retval = 0;
- void *status;
const char *env_app_timeout;
struct lttng_pipe *ust32_channel_monitor_pipe = NULL,
*ust64_channel_monitor_pipe = NULL,
/* Initialize TCP timeout values */
lttcomm_inet_init();
- if (load_session_init_data(&load_info) < 0) {
- retval = -1;
- goto exit_init_data;
- }
- load_info->path = config.load_session_path.value;
-
/* Create health-check thread. */
if (!launch_health_management_thread()) {
retval = -1;
}
}
- /* Create session loading thread. */
- ret = pthread_create(&load_session_thread, default_pthread_attr(),
- thread_load_session, load_info);
+ /* Load sessions. */
+ ret = config_load_session(config.load_session_path.value,
+ NULL, 1, 1, NULL);
if (ret) {
- errno = ret;
- PERROR("pthread_create load_session_thread");
+ ERR("Session load failed: %s", error_get_str(ret));
retval = -1;
- stop_threads();
goto exit_load_session;
}
+ /* Initialization completed. */
+ sessiond_signal_parents();
+
/*
* This is where we start awaiting program completion (e.g. through
* signal that asks threads to teardown).
*/
- ret = pthread_join(load_session_thread, &status);
- if (ret) {
- errno = ret;
- PERROR("pthread_join load_session_thread");
- retval = -1;
- }
-
/* Initiate teardown once activity occurs on the quit pipe. */
sessiond_wait_for_quit_pipe(-1U);
# Sessiond objects
SESSIOND_OBJS = $(top_builddir)/src/bin/lttng-sessiond/buffer-registry.$(OBJEXT) \
- $(top_builddir)/src/bin/lttng-sessiond/load-session-thread.$(OBJEXT) \
$(top_builddir)/src/bin/lttng-sessiond/cmd.$(OBJEXT) \
$(top_builddir)/src/bin/lttng-sessiond/save.$(OBJEXT) \
$(top_builddir)/src/bin/lttng-sessiond/notification-thread-commands.$(OBJEXT) \