diff options
Diffstat (limited to 'sesman/thread.c')
-rw-r--r-- | sesman/thread.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sesman/thread.c b/sesman/thread.c index 082e1d6b..632c546f 100644 --- a/sesman/thread.c +++ b/sesman/thread.c @@ -31,6 +31,8 @@ #include <signal.h> #include <pthread.h> +extern struct config_sesman g_cfg; + static pthread_t thread_sighandler; //static pthread_t thread_updater; @@ -60,14 +62,14 @@ thread_sighandler_start(void) sigaddset(&waitmask, SIGFPE); pthread_sigmask(SIG_UNBLOCK, &waitmask, NULL); - log_message(LOG_LEVEL_INFO,"starting signal handling thread..."); + log_message(&(g_cfg.log), LOG_LEVEL_INFO,"starting signal handling thread..."); ret = pthread_create(&thread_sighandler, NULL, sig_handler_thread, ""); pthread_detach(thread_sighandler); if (ret == 0) { - log_message(LOG_LEVEL_INFO, "signal handler thread started successfully"); + log_message(&(g_cfg.log), LOG_LEVEL_INFO, "signal handler thread started successfully"); return 0; } @@ -75,16 +77,16 @@ thread_sighandler_start(void) switch (ret) { case EINVAL: - log_message(LOG_LEVEL_ERROR, "invalid attributes for signal handling thread (creation returned EINVAL)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for signal handling thread (creation returned EINVAL)"); break; case EAGAIN: - log_message(LOG_LEVEL_ERROR, "not enough resources to start signal handling thread (creation returned EAGAIN)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start signal handling thread (creation returned EAGAIN)"); break; case EPERM: - log_message(LOG_LEVEL_ERROR, "invalid permissions for signal handling thread (creation returned EPERM)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for signal handling thread (creation returned EPERM)"); break; default: - log_message(LOG_LEVEL_ERROR, "unknown error starting signal handling thread"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting signal handling thread"); } return 1; @@ -106,7 +108,7 @@ thread_session_update_start(void) if (ret==0) { - log_message(LOG_LEVEL_INFO, "session update thread started successfully"); + log_message(&(g_cfg.log), LOG_LEVEL_INFO, "session update thread started successfully"); return 0; } @@ -114,16 +116,16 @@ thread_session_update_start(void) switch (ret) { case EINVAL: - log_message(LOG_LEVEL_ERROR, "invalid attributes for session update thread (creation returned EINVAL)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for session update thread (creation returned EINVAL)"); break; case EAGAIN: - log_message(LOG_LEVEL_ERROR, "not enough resources to start session update thread (creation returned EAGAIN)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start session update thread (creation returned EAGAIN)"); break; case EPERM: - log_message(LOG_LEVEL_ERROR, "invalid permissions for session update thread (creation returned EPERM)"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for session update thread (creation returned EPERM)"); break; default: - log_message(LOG_LEVEL_ERROR, "unknown error starting session update thread"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting session update thread"); } return 1; @@ -148,7 +150,7 @@ thread_scp_start(int skt) if (ret == 0) { - log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); + log_message(&(g_cfg.log), LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); return 0; } @@ -156,16 +158,16 @@ thread_scp_start(int skt) switch (ret) { case EINVAL: - log_message(LOG_LEVEL_ERROR, "invalid attributes for scp thread on sck %d (creation returned EINVAL)", skt); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for scp thread on sck %d (creation returned EINVAL)", skt); break; case EAGAIN: - log_message(LOG_LEVEL_ERROR, "not enough resources to start scp thread on sck %d (creation returned EAGAIN)", skt); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start scp thread on sck %d (creation returned EAGAIN)", skt); break; case EPERM: - log_message(LOG_LEVEL_ERROR, "invalid permissions for scp thread on sck %d (creation returned EPERM)", skt); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for scp thread on sck %d (creation returned EPERM)", skt); break; default: - log_message(LOG_LEVEL_ERROR, "unknown error starting scp thread on sck %d"); + log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting scp thread on sck %d"); } return 1; |