summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-10-17 07:41:50 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-10-17 07:41:50 +0000
commitff24062577a7adf0da08d1770e7194d7801a5648 (patch)
tree2b15e989a9ebcade9df255e2382b6110f789a998
parente29ae4effc8df2184d5cb48dc79ed1d0b3ac2112 (diff)
downloadrsyslog-ff24062577a7adf0da08d1770e7194d7801a5648.tar.gz
rsyslog-ff24062577a7adf0da08d1770e7194d7801a5648.tar.xz
rsyslog-ff24062577a7adf0da08d1770e7194d7801a5648.zip
undid creation of a separate thread for the main loop -- this did not turn
out to be needed or useful, so reduce complexity once again.
-rw-r--r--ChangeLog4
-rw-r--r--syslogd.c39
2 files changed, 24 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 319202d4..41641d2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@ Version 1.19.10 (rgerhards), 2007-10-15
in selector lines; modified ommysql to support it. This is primarily
an aid for further modules and a prequisite to actually allow third
party modules to be created.
+- minor fix in slackware startup script, "-r 0" is now "-r0"
+- updated rsyslogd doc set man page; now in html format
+- undid creation of a separate thread for the main loop -- this did not
+ turn out to be needed or useful, so reduce complexity once again.
---------------------------------------------------------------------------
Version 1.19.9 (rgerhards), 2007-10-12
- now packaging system which again contains all components in a single
diff --git a/syslogd.c b/syslogd.c
index 2c174b39..a7ca44d1 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -6056,20 +6056,14 @@ static void printVersion(void)
}
-/* This is a special function to run all those things (namely the inputs) that
- * were uses to run on the startup thread. I discovered a problem with malloc/free
- * when used in different threads.
- * See http://rgerhards.blogspot.com/2007/10/could-i-really-reproduce-bug.html
- * This is now a work-around, in which I create a new thread to do all the work. If
- * the malloc/free behaviour is relly what I described, then this should fix the
- * segfault issue...
- * RGerhards, 2007-10-08
+/* This function is called after initial initalization. It is used to
+ * move code out of the too-long main() function.
+ * rgerhards, 2007-10-17
*/
-static void *mainThread()
+static void mainThread()
{
DEFiRet;
uchar *pTmp;
- sigset_t sigSet;
/* doing some core initializations */
if((iRet = modInitIminternal()) != RS_RET_OK) {
@@ -6084,13 +6078,9 @@ static void *mainThread()
exit(1); /* "good" exit, leaving at init for fatal error */
}
- /* Block signals, all are delivered to the startup thread.
- * TODO: reconsider SIGUSR1 and alarm(), which we may need to interrupt()
- * the select call. For the time being, its acceptable (after all, we are right
- * now doing a tester...). rgerhards, 2007-10-08
+ /* Note: signals MUST be processed by the thread this code is running in. The reason
+ * is that we need to interrupt the select() system call. -- rgerhards, 2007-10-17
*/
- //sigfillset(&sigSet);
- //pthread_sigmask(SIG_BLOCK, &sigSet, NULL);
/* initialize the default templates
* we use template names with a SP in front - these
@@ -6129,8 +6119,6 @@ static void *mainThread()
/* do any de-init's that need to be done AFTER this comment */
die(bFinished);
-
- pthread_exit(0);
}
@@ -6147,9 +6135,11 @@ int main(int argc, char **argv)
extern int optind;
extern char *optarg;
struct sigaction sigAct;
+#if 0 /* see comment for #if 0 below (towards end of function) */
pthread_t thrdMain;
-
sigset_t sigSet;
+#endif
+
#ifdef MTRACE
mtrace(); /* this is a debug aid for leak detection - either remove
* or put in conditional compilation. 2005-01-18 RGerhards */
@@ -6394,6 +6384,16 @@ int main(int argc, char **argv)
sigaction(SIGXFSZ, &sigAct, NULL); /* do not abort if 2gig file limit is hit */
(void) alarm(TIMERINTVL);
+ mainThread();
+
+#if 0
+ /* This commented-out code was once used to spawn a separate thread
+ * for the mainThread(). This was initially done to solve a problem that not
+ * really existed. Thus the code is now commented out. I do not remove it yet,
+ * because there may be use for it in the not too distant future. If it is
+ * still commented out in a year's time, that's a good indication it should
+ * be removed! -- rgerhards, 2007-10-17
+ */
i = pthread_create(&thrdMain, NULL, mainThread, NULL);
dbgprintf("\"main\" thread started with state %d.\n", i);
@@ -6408,6 +6408,7 @@ int main(int argc, char **argv)
* do a blocking wait on it - it makese sense... ;) rgerhards, 2007-10-08
*/
pthread_join(thrdMain, NULL);
+#endif
return 0;
}