diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-02 11:01:18 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-02 11:01:18 +0200 |
commit | 732761063db3d7521334cb7d72736e913e735e71 (patch) | |
tree | 27a25cf46a03d15ceb084cc1e3727aac15425d87 | |
parent | 1531c541b294b6c029e5de9a01d4d8499f7e4718 (diff) | |
parent | 1908bae50491624d270c73609ea45634c15246fd (diff) | |
download | rsyslog-732761063db3d7521334cb7d72736e913e735e71.tar.gz rsyslog-732761063db3d7521334cb7d72736e913e735e71.tar.xz rsyslog-732761063db3d7521334cb7d72736e913e735e71.zip |
Merge branch 'helgrind' into perf
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/build_from_repo.html | 54 | ||||
-rw-r--r-- | doc/index.html | 32 | ||||
-rw-r--r-- | doc/install.html | 19 | ||||
-rw-r--r-- | doc/manual.html | 1 | ||||
-rw-r--r-- | doc/rsyslog_conf.html | 7 | ||||
-rw-r--r-- | runtime/msg.c | 2 | ||||
-rw-r--r-- | runtime/net.c | 28 | ||||
-rw-r--r-- | runtime/queue.c | 7 | ||||
-rw-r--r-- | runtime/wti.c | 9 | ||||
-rw-r--r-- | runtime/wti.h | 1 | ||||
-rw-r--r-- | runtime/wtp.c | 5 |
14 files changed, 154 insertions, 24 deletions
@@ -272,14 +272,19 @@ Version 3.19.0 (rgerhards), 2008-05-06 for the patch --------------------------------------------------------------------------- Version 3.18.5 (rgerhards), 2008-10-?? -- added doc on malformed messages, cause and how to work-around, to the - doc set - bugfix: imudp input module could cause segfault on HUP It did not properly de-init a variable acting as a linked list head. That resulted in trying to access freed memory blocks after the HUP. +- bugfix: rsyslogd could hang on HUP + because getnameinfo() is not cancel-safe, but was not guarded against + being cancelled. pthread_cancel() is routinely being called during + HUP processing. - doc bugfix: $ActionExecOnlyWhenPreviousIsSuspended was still misspelled as $...OnlyIfPrev... in some parts of the documentation. Thanks to Lorenzo M. Catucci for reporting this bug. +- added doc on malformed messages, cause and how to work-around, to the + doc set +- added doc on how to build from source repository --------------------------------------------------------------------------- Version 3.18.4 (rgerhards), 2008-09-18 - bugfix: order-of magnitude issue with base-10 size definitions @@ -1,4 +1,4 @@ -This file has been superseeded by the fils in the doc folder. +This file has been superseeded by the files in the doc folder. Please see doc/manual.html for futher details. If you are looking for install information doc/install.html is for you! If you do not have the doc set, see diff --git a/doc/Makefile.am b/doc/Makefile.am index edf3bbb5..22d368e0 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,5 @@ html_files = \ + index.html \ bugs.html \ debug.html \ features.html \ @@ -7,6 +8,7 @@ html_files = \ history.html \ how2help.html \ install.html \ + build_from_repo.html \ ipv6.html \ log_rotation_fix_size.html \ manual.html \ diff --git a/doc/build_from_repo.html b/doc/build_from_repo.html new file mode 100644 index 00000000..8d3b20fe --- /dev/null +++ b/doc/build_from_repo.html @@ -0,0 +1,54 @@ +<html><head> +<title>Building rsyslog from the source repository</title> +</head> +<body> +<h1>Building rsyslog from the source repository</h1> +<p>In most cases, people install rsyslog either via a package or use an "official" +distribution tarball to generate it. But there may be situations where it is desirable +to build directly from the source repository. This is useful for people who would like to +participate in development or who would like to use the latest, not-yet-released code. +The later may especially be the case if you are asked to try out an experimental version. +<p>Building from the repsitory is not much different than building from the source +tarball, but some files are missing because they are output files and thus do not +belong into the repository. +<h2>Obtaining the Source</h2> +<p>First of all, you need to download the sources. Rsyslog is currently kept in a git +repository. You can clone this repository either via http or git protocol (with the later +being much faster. URLS are: +<ul> +<li>git://git.adiscon.com/git/rsyslog.git +<li>http://git.adiscon.com/git/rsyslog.git +</ul> +<p>There is also a browsable version (gitweb) available at +<a href="http://git.adiscon.com/?p=rsyslog.git;a=summary">http://git.adiscon.com/?p=rsyslog.git;a=summary</a>. +This version also offers snapshots of each commit for easy download. You can use these if +you do not have git present on your system. +<p>After you have cloned the repository, you are in the master branch by default. This +is where we keep the devel branch. If you need any other branch, you need to do +a "git checkout --track -b branch origin/branch". For example, the command to check out +the beta branch is "git checkout --track -b beta origin/beta". +<h2>Prequisites</h2> +<p>To build the compilation system, you need the <b>pkg-config</b> package (an utility for +autotools) present on your system. Otherwise, configure will fail with something like +<pre><code> +checking for SYSLOG_UNIXAF support... yes +checking for FSSTND support... yes +./configure: line 25895: syntax error near unexpected token `RELP,' +./configure: line 25895: ` PKG_CHECK_MODULES(RELP, relp >= 0.1.1)' +</code></pre> +<h2>Creating the Build Environment</h2> +<p>This is fairly easy: just issue "<b>autoreconf -fvi</b>", which should do everything you need. +Once this is done, you can follow the usual ./configure steps just like when +you downloaded an official distribution tarball (see the +<a href="install.html">rsyslog install guide</a>, starting at step 2, +for further details about that). + +<p>[<a href="manual.html">manual index</a>] +[<a href="http://www.rsyslog.com/">rsyslog site</a>]</p> +<p><font size="2">This documentation is part of the +<a href="http://www.rsyslog.com/">rsyslog</a> project.<br> +Copyright © 2008 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and +<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL +version 1.2 or higher.</font></p> +</body> +</html> diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 00000000..349c8e57 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,32 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><title>Welcome to rsyslog</title></head> +<body> +<h1>Welcome to rsyslog</h1> +<p><b><a href="http://www.rsyslog.com/">Rsyslog</a> +is an enhanced syslogd suitable both for small systems as +well as large enterprises.</b> +<p>This page provide a few quick pointers which hopefully make your +experience with rsyslog a pleasant one. These are +<ul> +<li><b>Most importantly, the <a href="manual.html">rsyslog manual</a></b> - this points to locally +installed documentation which exactly matches the version you have installed. +It is highly suggested to at least briefly look over these files. +<li>The <a href="http://www.rsyslog.com">rsyslog web site</a> which offers +probably every information you'll ever need (ok, just kidding...). +<li>The <a href="http://www.rsyslog.com/doc-status.html">project status page</a> provides +information on current releases +<li>and the <a href="troubleshoot.html">troubleshooting guide</a> hopefully helps if +things do not immediately work out +</ul> +<p>In general, rsyslog supports plain old syslog.conf format, except that the +config file is now called rsyslog.conf. This should help you get started +quickly. +To do the really cool things, though, +you need to learn a bit about its new features. +The man pages offer a bare minimum of information (and are still quite long). Read the +<a href="manual.html">html documentation</a> instead. +When you change the configuration, +remember to restart (or HUP) rsyslogd, because otherwise it won't use your +new settings (and you'll end up totally puzzled why this great config of yours +does not even work a bit...;)) +</body></html> diff --git a/doc/install.html b/doc/install.html index 661ae943..48b7f649 100644 --- a/doc/install.html +++ b/doc/install.html @@ -24,7 +24,11 @@ you volunteer to create one, <a href="mailto:rgerhards@adiscon.com">drop me a line</a>). Thus, this guide focuses on installing from the source, which thankfully is <b>quite easy</b>.</p> <h3>Step 1 - Download Software</h3> -<p>For obvious reasons, you need to download rsyslog. Load the most recent build +<p>For obvious reasons, you need to download rsyslog. Here, I assume that you +use a distribution tarball. If you would like to use a version directly from +the repository, see <a href="build_from_repo.html">build rsyslog from repository</a> +instead. +<p>Load the most recent build from <a href="http://www.rsyslog.com/downloads">http://www.rsyslog.com/downloads</a>. Extract the software with "tar xzf -nameOfDownloadSet-". This will create a new subdirectory rsyslog-version in the current working directory. CD into that. </p> @@ -150,9 +154,12 @@ comments or bug sighting reports are very welcome. Please <li>2007-07-13 * <a href="http://www.adiscon.com/en/people/rainer-gerhards.php">Rainer Gerhards</a> * updated to new autotools-based build system</li> + <li>2008-10-01 * + <a href="http://www.adiscon.com/en/people/rainer-gerhards.php">Rainer Gerhards</a> + * added info on building from source repository</li> </ul> <h3>Copyright</h3> -<p>Copyright (c) 2005, 2007 +<p>Copyright © 2005-2008 <a href="http://www.adiscon.com/en/people/rainer-gerhards.php">Rainer Gerhards</a> and <a href="http://www.adiscon.com/en/">Adiscon</a>.</p> <p> Permission is granted to copy, distribute and/or modify this document @@ -162,6 +169,12 @@ comments or bug sighting reports are very welcome. Please Texts. A copy of the license can be viewed at <a href="http://www.gnu.org/copyleft/fdl.html"> http://www.gnu.org/copyleft/fdl.html</a>.</p> - +<p>[<a href="manual.html">manual index</a>] +[<a href="http://www.rsyslog.com/">rsyslog site</a>]</p> +<p><font size="2">This documentation is part of the +<a href="http://www.rsyslog.com/">rsyslog</a> project.<br> +Copyright © 2008 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and +<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL +version 1.2 or higher.</font></p> </body> </html> diff --git a/doc/manual.html b/doc/manual.html index 91e7d0eb..e40f0c06 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -45,6 +45,7 @@ generic syslog application design</a><!-- not good as it currently is ;) <li><a <p><b>We have some in-depth papers on</b></p> <ul> <li><a href="install.html">installing rsyslog</a></li> +<li><a href="build_from_repo.html">obtaining rsyslog from the source repository</a></li> <li><a href="ipv6.html">rsyslog and IPv6</a> (which is fully supported)</li> <li><a href="rsyslog_tls.html">native TLS encryption for syslog</a></li> <li><a href="rsyslog_stunnel.html">ssl-encrypting syslog with stunnel</a></li> diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html index 0db69451..7cd40cb7 100644 --- a/doc/rsyslog_conf.html +++ b/doc/rsyslog_conf.html @@ -29,7 +29,7 @@ what they do (list is currently not complete)</p> trap output module</li> <li><a href="omrelp.html">omrelp</a> - RELP output module</li> -<li>omgss - output module for GSS-enabled syslog</li> +<li>omgssapi - output module for GSS-enabled syslog</li> <li><a href="ommysql.html">ommysql</a> - output module for MySQL</li> <li>ompgsql - output module for PostgreSQL</li> <li><a href="omlibdbi.html">omlibdbi</a> - @@ -45,7 +45,7 @@ input module</li> <li><a href="imtcp.html">imtcp</a> - input plugin for plain tcp syslog</li> <li><a href="imgssapi.html">imgssapi</a> - -input plugin for plain tcp and GSS-enable syslog</li> +input plugin for plain tcp and GSS-enabled syslog</li> <li>immark - support for mark messages</li> <li><a href="imklog.html">imklog</a> - kernel logging</li> <li><a href="imuxsock.html">imuxsock</a> - @@ -1255,6 +1255,5 @@ When compared to syslogd from sysklogd package, rsyslogd offers additional <a href="features.html">features</a> (like template and database support). For obvious reasons, the syntax for defining -such features is available in rsyslogd, only.<br> - </p> +such features is available in rsyslogd, only.</p> </body></html> diff --git a/runtime/msg.c b/runtime/msg.c index 8e3749ef..ac387354 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -342,8 +342,8 @@ CODESTARTobjDestruct(msg) MsgUnlock(pThis); funcDeleteMutex(pThis); } else { - pThis = NULL; /* tell framework not to destructing the object! */ MsgUnlock(pThis); + pThis = NULL; /* tell framework not to destructing the object! */ } ENDobjDestruct(msg) diff --git a/runtime/net.c b/runtime/net.c index f5b8f46a..44c9008a 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -450,6 +450,27 @@ static inline void MaskIP4 (struct in_addr *addr, uint8_t bits) { #define SIN(sa) ((struct sockaddr_in *)(sa)) #define SIN6(sa) ((struct sockaddr_in6 *)(sa)) + +/* This is a cancel-safe getnameinfo() version, because we learned + * (via drd/valgrind) that getnameinfo() seems to have some issues + * when being cancelled, at least if the module was dlloaded. + * rgerhards, 2008-09-30 + */ +static inline int +mygetnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + int iCancelStateSave; + int i; + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave); + i = getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); + pthread_setcancelstate(iCancelStateSave, NULL); + return i; +} + + /* This function adds an allowed sender entry to the ACL linked list. * In any case, a single entry is added. If an error occurs, the * function does its error reporting itself. All validity checks @@ -708,7 +729,7 @@ void PrintAllowedSenders(int iListToPrint) if (F_ISSET(pSender->allowedSender.flags, ADDR_NAME)) dbgprintf ("\t%s\n", pSender->allowedSender.addr.HostWildcard); else { - if(getnameinfo (pSender->allowedSender.addr.NetAddr, + if(mygetnameinfo (pSender->allowedSender.addr.NetAddr, SALEN(pSender->allowedSender.addr.NetAddr), (char*)szIP, 64, NULL, 0, NI_NUMERICHOST) == 0) { dbgprintf ("\t%s/%u\n", szIP, pSender->SignificantBits); @@ -956,7 +977,6 @@ should_use_so_bsdcompat(void) #define SO_BSDCOMPAT 0 #endif - /* get the hostname of the message source. This was originally in cvthname() * but has been moved out of it because of clarity and fuctional separation. * It must be provided by the socket we received the message on as well as @@ -982,7 +1002,7 @@ gethname(struct sockaddr_storage *f, uchar *pszHostFQDN, uchar *ip) assert(f != NULL); assert(pszHostFQDN != NULL); - error = getnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *)f), + error = mygetnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *)f), (char*) ip, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if (error) { @@ -997,7 +1017,7 @@ gethname(struct sockaddr_storage *f, uchar *pszHostFQDN, uchar *ip) sigaddset(&nmask, SIGHUP); pthread_sigmask(SIG_BLOCK, &nmask, &omask); - error = getnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *) f), + error = mygetnameinfo((struct sockaddr *)f, SALEN((struct sockaddr *) f), (char*)pszHostFQDN, NI_MAXHOST, NULL, 0, NI_NAMEREQD); if (error == 0) { diff --git a/runtime/queue.c b/runtime/queue.c index 3fae4aa7..76c2f10f 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1430,8 +1430,13 @@ queueDequeueConsumable(queue_t *pThis, wti_t *pWti, int iCancelStateSave) pthread_cond_broadcast(&pThis->belowLightDlyWtrMrk); } - d_pthread_mutex_unlock(pThis->mut); + /* rgerhards, 2008-09-30: I reversed the order of cond_signal und mutex_unlock + * as of the pthreads recommendation on predictable scheduling behaviour. I don't see + * any problems caused by this, but I add this comment in case some will be seen + * in the next time. + */ pthread_cond_signal(&pThis->notFull); + d_pthread_mutex_unlock(pThis->mut); pthread_setcancelstate(iCancelStateSave, NULL); /* WE ARE NO LONGER PROTECTED BY THE MUTEX */ diff --git a/runtime/wti.c b/runtime/wti.c index 13554232..365b25d5 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -113,6 +113,9 @@ wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex) wtiGetDbgHdr(pThis), tCmd, pThis->tCurrCmd); } else { dbgprintf("%s: receiving command %d\n", wtiGetDbgHdr(pThis), tCmd); + /* we could replace this with a simple if, but we leave the switch in in case we need + * to add something at a later stage. -- rgerhards, 2008-09-30 + */ switch(tCmd) { case eWRKTHRD_TERMINATING: /* TODO: re-enable meaningful debug msg! (via function callback?) @@ -123,10 +126,8 @@ wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex) pthread_cond_signal(&pThis->condExitDone); dbgprintf("%s: worker terminating\n", wtiGetDbgHdr(pThis)); break; - case eWRKTHRD_RUNNING: - pthread_cond_signal(&pThis->condInitDone); - break; /* these cases just to satisfy the compiler, we do (yet) not act an them: */ + case eWRKTHRD_RUNNING: case eWRKTHRD_STOPPED: case eWRKTHRD_RUN_CREATED: case eWRKTHRD_RUN_INIT: @@ -190,7 +191,6 @@ CODESTARTobjDestruct(wti) d_pthread_mutex_unlock(&pThis->mut); /* actual destruction */ - pthread_cond_destroy(&pThis->condInitDone); pthread_cond_destroy(&pThis->condExitDone); pthread_mutex_destroy(&pThis->mut); @@ -202,7 +202,6 @@ ENDobjDestruct(wti) /* Standard-Constructor for the wti object */ BEGINobjConstruct(wti) /* be sure to specify the object type also in END macro! */ - pthread_cond_init(&pThis->condInitDone, NULL); pthread_cond_init(&pThis->condExitDone, NULL); pthread_mutex_init(&pThis->mut, NULL); ENDobjConstruct(wti) diff --git a/runtime/wti.h b/runtime/wti.h index b3d92473..0cd6744e 100644 --- a/runtime/wti.h +++ b/runtime/wti.h @@ -35,7 +35,6 @@ typedef struct wti_s { qWrkCmd_t tCurrCmd; /* current command to be carried out by worker */ obj_t *pUsrp; /* pointer to an object meaningful for current user pointer (e.g. queue pUsr data elemt) */ wtp_t *pWtp; /* my worker thread pool (important if only the work thread instance is passed! */ - pthread_cond_t condInitDone; /* signaled when the thread startup is done (once per thread existance) */ pthread_cond_t condExitDone; /* signaled when the thread exit is done (once per thread existance) */ pthread_mutex_t mut; int bShutdownRqtd; /* shutdown for this thread requested? 0 - no , 1 - yes */ diff --git a/runtime/wtp.c b/runtime/wtp.c index c28efc51..45034fa7 100644 --- a/runtime/wtp.c +++ b/runtime/wtp.c @@ -304,11 +304,12 @@ wtpShutdownAll(wtp_t *pThis, wtpState_t tShutdownCmd, struct timespec *ptTimeout rsRetVal wtpSignalWrkrTermination(wtp_t *pThis) { DEFiRet; - /* I leave the mutex code here out as it give as deadlocks. I think it is not really + /* I leave the mutex code here out as it gives us deadlocks. I think it is not really * needed and we are on the safe side. I leave this comment in if practice proves us - * wrong. The whole thing should be removed after half a your or year if we see there + * wrong. The whole thing should be removed after half a year or year if we see there * actually is no issue (or revisit it from a theoretical POV). * rgerhards, 2008-01-28 + * revisited 2008-09-30, still a bit unclear, leave in */ /*TODO: mutex or not mutex, that's the question ;)DEFVARS_mutexProtection;*/ |