summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-18 10:41:07 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-18 10:41:07 +0000
commita914e3164e5c9522b6ac9a39327ed46628d3e045 (patch)
tree54c679bbfa81a831a68563d979961f4db12db319
parent14df0c7c57ae3f41c56c73c1d17e40783758ec40 (diff)
downloadrsyslog-a914e3164e5c9522b6ac9a39327ed46628d3e045.tar.gz
rsyslog-a914e3164e5c9522b6ac9a39327ed46628d3e045.tar.xz
rsyslog-a914e3164e5c9522b6ac9a39327ed46628d3e045.zip
- removed no longer necessary signal from threads.c
- changed debug output request signal to SIGUSR2 (as originally intented), restored SIGUSR1 semantics
-rw-r--r--debug.c9
-rw-r--r--syslogd.c16
-rw-r--r--threads.c27
3 files changed, 18 insertions, 34 deletions
diff --git a/debug.c b/debug.c
index 74794e7f..5887f5dc 100644
--- a/debug.c
+++ b/debug.c
@@ -988,13 +988,18 @@ static void sigusr2Hdlr(int __attribute__((unused)) signum)
rsRetVal dbgClassInit(void)
{
struct sigaction sigAct;
+ sigset_t sigSet;
(void) pthread_key_create(&keyCallStack, dbgCallStackDestruct); /* MUST be the first action done! */
+
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = sigusr2Hdlr;
- //sigaction(SIGUSR2, &sigAct, NULL);
- sigaction(SIGUSR1, &sigAct, NULL);
+ sigaction(SIGUSR2, &sigAct, NULL);
+
+ sigemptyset(&sigSet);
+ sigaddset(&sigSet, SIGUSR2);
+ pthread_sigmask(SIG_UNBLOCK, &sigSet, NULL);
pszAltDbgFileName = getenv("RSYSLOG_DEBUGLOG");
diff --git a/syslogd.c b/syslogd.c
index 82fd7c74..6923e89b 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2264,8 +2264,13 @@ static void debug_switch()
{
struct sigaction sigAct;
- dbgprintf("Switching debugging_on to %s\n", (debugging_on == 0) ? "true" : "false");
- debugging_on = (debugging_on == 0) ? 1 : 0;
+ if(debugging_on == 0) {
+ debugging_on = 1;
+ dbgprintf("Switching debugging_on to true\n");
+ } else {
+ dbgprintf("Switching debugging_on to false\n");
+ debugging_on = 0;
+ }
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
@@ -4768,8 +4773,8 @@ int realMain(int argc, char **argv)
sigAct.sa_handler = sigsegvHdlr;
sigaction(SIGSEGV, &sigAct, NULL);
-sigAct.sa_handler = sigsegvHdlr;
-sigaction(SIGABRT, &sigAct, NULL);
+ sigAct.sa_handler = sigsegvHdlr;
+ sigaction(SIGABRT, &sigAct, NULL);
sigAct.sa_handler = doDie;
sigaction(SIGTERM, &sigAct, NULL);
sigAct.sa_handler = Debug ? doDie : SIG_IGN;
@@ -4778,8 +4783,7 @@ sigaction(SIGABRT, &sigAct, NULL);
sigAct.sa_handler = reapchild;
sigaction(SIGCHLD, &sigAct, NULL);
sigAct.sa_handler = Debug ? debug_switch : SIG_IGN;
- /* TODO: use signal 2 */
- /*sigaction(SIGUSR1, &sigAct, NULL);*/
+ sigaction(SIGUSR1, &sigAct, NULL);
sigAct.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sigAct, NULL);
sigaction(SIGXFSZ, &sigAct, NULL); /* do not abort if 2gig file limit is hit */
diff --git a/threads.c b/threads.c
index c7b5f4e4..5933d3e5 100644
--- a/threads.c
+++ b/threads.c
@@ -1,7 +1,3 @@
-/* TODO: we should guard the individual thread actions with a mutex. Else, we may
- * run into race conditions on thread termination.
- */
-
/* threads.c
*
* This file implements threading support helpers (and maybe the thread object)
@@ -128,13 +124,10 @@ static void* thrdStarter(void *arg)
assert(pThis != NULL);
assert(pThis->pUsrThrdMain != NULL);
- /* block all signals except the one we need for graceful termination */
+ /* block all signalsi */
sigset_t sigSet;
sigfillset(&sigSet);
pthread_sigmask(SIG_BLOCK, &sigSet, NULL);
- sigemptyset(&sigSet);
- sigaddset(&sigSet, SIGUSR2);
- pthread_sigmask(SIG_UNBLOCK, &sigSet, NULL);
/* setup complete, we are now ready to execute the user code. We will not
* regain control until the user code is finished, in which case we terminate
@@ -171,31 +164,13 @@ finalize_it:
}
-/* This is a dummy handler. We user SIGUSR2 to interrupt blocking system calls
- * if we are in termination mode 1.
- */
-static void sigusr2Dummy(int __attribute__((unused)) sig)
-{
- dbgprintf("sigusr2Dummy called!\n");
-}
-
-
/* initialize the thread-support subsystem
* must be called once at the start of the program
*/
rsRetVal thrdInit(void)
{
DEFiRet;
- struct sigaction sigAct;
-
iRet = llInit(&llThrds, thrdDestruct, NULL, NULL);
-
- /* set up our termination subsystem */
- memset(&sigAct, 0, sizeof (sigAct));
- sigemptyset(&sigAct.sa_mask);
- sigAct.sa_handler = sigusr2Dummy;
- sigaction(SIGUSR2, &sigAct, NULL);
-
RETiRet;
}