summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module-template.h47
-rw-r--r--modules.c2
-rw-r--r--modules.h2
-rw-r--r--omdiscard.c10
-rw-r--r--omfile.c10
-rw-r--r--omfwd.c155
-rw-r--r--omshell.c10
-rw-r--r--omusrmsg.c10
-rw-r--r--plugins/ommysql/ommysql.c10
-rw-r--r--plugins/ompgsql/ompgsql.c10
-rw-r--r--syslogd.c183
11 files changed, 8 insertions, 441 deletions
diff --git a/module-template.h b/module-template.h
index 9d7deaf4..3b6ebb69 100644
--- a/module-template.h
+++ b/module-template.h
@@ -199,49 +199,6 @@ static rsRetVal needUDPSocket(void *pModData)\
}
-/* onSelectReadyWrite()
- * Extra comments:
- * This is called when select() returned with a writable file descriptor
- * for this module. The fd was most probably obtained by getWriteFDForSelect()
- * before.
- */
-#define BEGINonSelectReadyWrite \
-static rsRetVal onSelectReadyWrite(void *pModData)\
-{\
- rsRetVal iRet = RS_RET_NONE;\
- instanceData *pData = NULL;
-
-#define CODESTARTonSelectReadyWrite \
- pData = (instanceData*) pModData;
-
-#define ENDonSelectReadyWrite \
- return iRet;\
-}
-
-
-/* getWriteFDForSelect()
- * Extra comments:
- * Gets writefd for select call. Must only be returned when the selector must
- * be written to. If the module has no such fds, it must return RS_RET_NONE.
- * In this case, the default implementation is sufficient.
- * This interface will probably go away over time, but we need it now to
- * continue modularization.
- */
-#define BEGINgetWriteFDForSelect \
-static rsRetVal getWriteFDForSelect(void *pModData, short __attribute__((unused)) *fd)\
-{\
- rsRetVal iRet = RS_RET_NONE;\
- instanceData *pData = NULL;
-
-#define CODESTARTgetWriteFDForSelect \
- assert(fd != NULL);\
- pData = (instanceData*) pModData;
-
-#define ENDgetWriteFDForSelect \
- return iRet;\
-}
-
-
/* parseSelectorAct()
* Extra comments:
* try to process a selector action line. Checks if the action
@@ -363,10 +320,6 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
*pEtryPoint = parseSelectorAct;\
} else if(!strcmp((char*) name, "isCompatibleWithFeature")) {\
*pEtryPoint = isCompatibleWithFeature;\
- } else if(!strcmp((char*) name, "getWriteFDForSelect")) {\
- *pEtryPoint = getWriteFDForSelect;\
- } else if(!strcmp((char*) name, "onSelectReadyWrite")) {\
- *pEtryPoint = onSelectReadyWrite;\
} else if(!strcmp((char*) name, "needUDPSocket")) {\
*pEtryPoint = needUDPSocket;\
} else if(!strcmp((char*) name, "tryResume")) {\
diff --git a/modules.c b/modules.c
index d2973018..da46bd2e 100644
--- a/modules.c
+++ b/modules.c
@@ -266,8 +266,6 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)())
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"doAction", &pNew->mod.om.doAction));
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"parseSelectorAct", &pNew->mod.om.parseSelectorAct));
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"isCompatibleWithFeature", &pNew->isCompatibleWithFeature));
- CHKiRet((*pNew->modQueryEtryPt)((uchar*)"getWriteFDForSelect", &pNew->getWriteFDForSelect));
- CHKiRet((*pNew->modQueryEtryPt)((uchar*)"onSelectReadyWrite", &pNew->onSelectReadyWrite));
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"needUDPSocket", &pNew->needUDPSocket));
CHKiRet((*pNew->modQueryEtryPt)((uchar*)"tryResume", &pNew->tryResume));
break;
diff --git a/modules.h b/modules.h
index cf6eda24..0ff49afe 100644
--- a/modules.h
+++ b/modules.h
@@ -59,8 +59,6 @@ typedef struct moduleInfo {
rsRetVal (*modQueryEtryPt)(uchar *name, rsRetVal (**EtryPoint)()); /* query entry point addresses */
rsRetVal (*isCompatibleWithFeature)(syslogFeature);
rsRetVal (*freeInstance)(void*);/* called before termination or module unload */
- rsRetVal (*getWriteFDForSelect)(void*,short *);/* called before termination or module unload */
- rsRetVal (*onSelectReadyWrite)(void*);/* called when fd is writeable after select() */
rsRetVal (*needUDPSocket)(void*);/* called when fd is writeable after select() */
rsRetVal (*dbgPrintInstInfo)(void*);/* called before termination or module unload */
rsRetVal (*tryResume)(void*);/* called to see if module actin can be resumed now */
diff --git a/omdiscard.c b/omdiscard.c
index bfdcdb14..26d5f3da 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -104,16 +104,6 @@ CODESTARTneedUDPSocket
ENDneedUDPSocket
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
BEGINmodExit
CODESTARTmodExit
ENDmodExit
diff --git a/omfile.c b/omfile.c
index 7a931606..bcfaeabc 100644
--- a/omfile.c
+++ b/omfile.c
@@ -611,21 +611,11 @@ CODESTARTfreeInstance
ENDfreeInstance
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
BEGINneedUDPSocket
CODESTARTneedUDPSocket
ENDneedUDPSocket
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
BEGINtryResume
CODESTARTtryResume
ENDtryResume
diff --git a/omfwd.c b/omfwd.c
index 13ec3b73..e8f8584c 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -47,11 +47,7 @@
#ifdef USE_NETZIP
#include <zlib.h>
#endif
-#ifdef USE_PTHREADS
#include <pthread.h>
-#else
-#include <fcntl.h>
-#endif
#ifdef USE_GSSAPI
#include <gssapi.h>
#endif
@@ -109,17 +105,8 @@ typedef struct _instanceData {
# define FORW_UDP 0
# define FORW_TCP 1
/* following fields for TCP-based delivery */
- enum TCPSendStatus {
- TCP_SEND_NOTCONNECTED = 0,
- TCP_SEND_CONNECTING = 1,
- TCP_SEND_READY = 2
- } status;
- char *savedMsg;
- int savedMsgLen; /* length of savedMsg in octets */
time_t ttSuspend; /* time selector was suspended */
-# ifdef USE_PTHREADS
pthread_mutex_t mtxTCPSend;
-# endif
# ifdef USE_GSSAPI
gss_ctx_id_t gss_context;
OM_uint32 gss_flags;
@@ -160,12 +147,10 @@ CODESTARTfreeInstance
free(pData->port);
break;
}
-# ifdef USE_PTHREADS
/* delete any mutex objects, if present */
if(pData->protocol == FORW_TCP) {
pthread_mutex_destroy(&pData->mtxTCPSend);
}
-# endif
# ifdef USE_GSSAPI
if (gss_mode != GSSMODE_NONE) {
OM_uint32 maj_stat, min_stat;
@@ -194,50 +179,6 @@ ENDdbgPrintInstInfo
/* CODE FOR SENDING TCP MESSAGES */
-/* get send status
- * rgerhards, 2005-10-24
- */
-static void TCPSendSetStatus(instanceData *pData, enum TCPSendStatus iNewState)
-{
- assert(pData != NULL);
- assert(pData->protocol == FORW_TCP);
- assert( (iNewState == TCP_SEND_NOTCONNECTED)
- || (iNewState == TCP_SEND_CONNECTING)
- || (iNewState == TCP_SEND_READY));
-
- /* there can potentially be a race condition, so guard by mutex */
-# ifdef USE_PTHREADS
- pthread_mutex_lock(&pData->mtxTCPSend);
-# endif
- pData->status = iNewState;
-# ifdef USE_PTHREADS
- pthread_mutex_unlock(&pData->mtxTCPSend);
-# endif
-}
-
-
-/* set send status
- * rgerhards, 2005-10-24
- */
-static enum TCPSendStatus TCPSendGetStatus(instanceData *pData)
-{
- enum TCPSendStatus eState;
- assert(pData != NULL);
- assert(pData->protocol == FORW_TCP);
-
- /* there can potentially be a race condition, so guard by mutex */
-# ifdef USE_PTHREADS
- pthread_mutex_lock(&pData->mtxTCPSend);
-# endif
- eState = pData->status;
-# ifdef USE_PTHREADS
- pthread_mutex_unlock(&pData->mtxTCPSend);
-# endif
-
- return eState;
-}
-
-
/* Initialize TCP sockets (for sender)
* This is done once per selector line, if not yet initialized.
*/
@@ -262,17 +203,12 @@ static int TCPSendCreateSocket(instanceData *pData, struct addrinfo *addrDest)
* the receivers and the selector line processing are only loosely
* coupled via a memory buffer. Now, I think, we can afford the extra
* wait time. Thus, we enable blocking mode for TCP if we compile with
- * pthreads.
- * rgerhards, 2005-10-25
+ * pthreads. -- rgerhards, 2005-10-25
+ * And now, we always run on multiple threads... -- rgerhards, 2007-12-20
*/
-# ifndef USE_PTHREADS
- /* set to nonblocking - rgerhards 2005-07-20 */
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
-# endif
if (connect (fd, r->ai_addr, r->ai_addrlen) != 0) {
if(errno == EINPROGRESS) {
- /* this is normal - will complete during select */
- TCPSendSetStatus(pData, TCP_SEND_CONNECTING);
+ /* this is normal - will complete later select */
return fd;
} else {
char errStr[1024];
@@ -282,7 +218,6 @@ static int TCPSendCreateSocket(instanceData *pData, struct addrinfo *addrDest)
}
else {
- TCPSendSetStatus(pData, TCP_SEND_READY);
return fd;
}
close(fd);
@@ -437,7 +372,6 @@ static int TCPSendGSSSend(instanceData *pData, char *msg, size_t len)
fail:
close(s);
pData->sock = -1;
- TCPSendSetStatus(pData, TCP_SEND_NOTCONNECTED);
gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER);
*context = GSS_C_NO_CONTEXT;
gss_release_buffer(&min_stat, &out_buf);
@@ -461,7 +395,7 @@ static int TCPSendGSSSend(instanceData *pData, char *msg, size_t len)
* rgerhards 2005-07-06
* This function is now expected to stay. Libloging won't be used for
* that purpose. I have added the param "len", because it is known by the
- * caller and so safes us some time. Also, it MUST be given because there
+ * caller and so saves us some time. Also, it MUST be given because there
* may be NULs inside msg so that we can not rely on strlen(). Please note
* that the restrictions outlined above do not existin in multi-threaded
* mode, which we assume will now be most often used. So there is no
@@ -487,7 +421,6 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
int bIsCompressed;
int lenSend;
char *buf = NULL; /* if this is non-NULL, it MUST be freed before return! */
- enum TCPSendStatus eState;
TCPFRAMINGMODE framingToUse;
assert(pData != NULL);
@@ -514,41 +447,12 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
return -1;
}
- eState = TCPSendGetStatus(pData); /* cache info */
-
- if(eState == TCP_SEND_CONNECTING) {
- /* In this case, we save the buffer. If we have a
- * system with few messages, that hopefully prevents
- * message loss at all. However, we make no further attempts,
- * just the first message is saved. So we only try this
- * if there is not yet a saved message present.
- * rgerhards 2005-07-20
- */
- if(pData->savedMsg == NULL) {
- pData->savedMsg = malloc(len * sizeof(char));
- if(pData->savedMsg == NULL)
- return 0; /* nothing we can do... */
- memcpy(pData->savedMsg, msg, len);
- pData->savedMsgLen = len;
- }
- return 0;
- } else if(eState != TCP_SEND_READY)
- /* This here is debatable. For the time being, we
- * accept the loss of a single message (e.g. during
- * connection setup in favour of not messing with
- * wait time and timeouts. The reason is that such
- * things might otherwise cost us considerable message
- * loss on the receiving side (even at a timeout set
- * to just 1 second). - rgerhards 2005-07-20
- */
- return 0;
-
/* now check if we need to add a line terminator. We need to
* copy the string in memory in this case, this is probably
* quicker than using writev and definitely quicker than doing
* two socket calls.
* rgerhards 2005-07-22
- *//*
+ *
* Some messages already contain a \n character at the end
* of the message. We append one only if we there is not
* already one. This seems the best fit, though this also
@@ -678,9 +582,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
* rgerhards, 2005-10-25
*/
dbgprintf("message not completely (tcp)send, ignoring %d\n", lenSend);
-# if USE_PTHREADS
usleep(1000); /* experimental - might be benefitial in this situation */
-# endif
if(buf != NULL)
free(buf);
return 0;
@@ -694,20 +596,6 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
free(buf);
return 0;
break;
- case EINPROGRESS:
- case EAGAIN:
- dbgprintf("message not (tcp)send, would block\n");
-# if USE_PTHREADS
- usleep(1000); /* experimental - might be benefitial in this situation */
-# endif
- /* we loose this message, but that's better than loosing
- * all ;)
- */
- /* This is not a real error, so it is not flagged as one */
- if(buf != NULL)
- free(buf);
- return 0;
- break;
default:
dbgprintf("message not (tcp)send");
break;
@@ -717,7 +605,6 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
++retry;
/* try to recover */
close(pData->sock);
- TCPSendSetStatus(pData, TCP_SEND_NOTCONNECTED);
pData->sock = -1;
} else {
if(buf != NULL)
@@ -947,9 +834,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
pData->protocol = FORW_TCP;
++p; /* eat this '@', too */
/* in this case, we also need a mutex... */
-# ifdef USE_PTHREADS
pthread_mutex_init(&pData->mtxTCPSend, 0);
-# endif
} else {
pData->protocol = FORW_UDP;
}
@@ -1104,36 +989,6 @@ CODESTARTneedUDPSocket
ENDneedUDPSocket
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
- dbgprintf("tcp send socket %d ready for writing.\n", pData->sock);
- TCPSendSetStatus(pData, TCP_SEND_READY);
- /* Send stored message (if any) */
- if(pData->savedMsg != NULL) {
- if(TCPSend(pData, pData->savedMsg,
- pData->savedMsgLen) != 0) {
- /* error! */
- pData->eDestState = eDestFORW_SUSP;
- errno = 0;
- logerror("error forwarding via tcp, suspending...");
- }
- free(pData->savedMsg);
- pData->savedMsg = NULL;
- }
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
- if( (pData->eDestState == eDestFORW)
- && (pData->protocol == FORW_TCP)
- && TCPSendGetStatus(pData) == TCP_SEND_CONNECTING) {
- *fd = pData->sock;
- iRet = RS_RET_OK;
- }
-ENDgetWriteFDForSelect
-
-
BEGINmodExit
CODESTARTmodExit
ENDmodExit
diff --git a/omshell.c b/omshell.c
index 4ada6a94..932d5b94 100644
--- a/omshell.c
+++ b/omshell.c
@@ -127,16 +127,6 @@ CODESTARTneedUDPSocket
ENDneedUDPSocket
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
BEGINmodExit
CODESTARTmodExit
ENDmodExit
diff --git a/omusrmsg.c b/omusrmsg.c
index 9b23d9df..96a25c57 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -325,16 +325,6 @@ CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
BEGINmodExit
CODESTARTmodExit
ENDmodExit
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index d67d92eb..107419a5 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -104,16 +104,6 @@ CODESTARTdbgPrintInstInfo
ENDdbgPrintInstInfo
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
/* log a database error with descriptive message.
* We check if we have a valid MySQL handle. If not, we simply
* report an error, but can not be specific. RGerhards, 2007-01-30
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 45e3c674..1a0fba29 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -101,16 +101,6 @@ CODESTARTdbgPrintInstInfo
ENDdbgPrintInstInfo
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
/* log a database error with descriptive message.
* We check if we have a valid handle. If not, we simply
* report an error, but can not be specific. RGerhards, 2007-01-30
diff --git a/syslogd.c b/syslogd.c
index b4d63636..6a87102e 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -5448,81 +5448,17 @@ static void processImInternal(void)
}
-/* helper function for mainloop(). This is used to add all module
- * writeFDsfor Select via llExecFunc().
- * rgerhards, 2007-08-02
- */
-typedef struct selectHelperWriteFDSInfo_s { /* struct for pParam */
- fd_set *pWritefds;
- int *pMaxfds;
-} selectHelperWriteFDSInfo_t;
-DEFFUNC_llExecFunc(mainloopAddModWriteFDSforSelect)
-{
- DEFiRet;
- action_t *pAction = (action_t*) pData;
- selectHelperWriteFDSInfo_t *pState = (selectHelperWriteFDSInfo_t*) pParam;
- short fdMod;
-
- assert(pAction != NULL);
- assert(pState != NULL);
-
- if(pAction->pMod->getWriteFDForSelect(pAction->pModData, &fdMod) == RS_RET_OK) {
- FD_SET(fdMod, pState->pWritefds);
- if(fdMod > *pState->pMaxfds)
- *pState->pMaxfds = fdMod;
- }
-
- return iRet;
-}
-
-
-/* helper function for mainloop(). This is used to call module action
- * handlers after select if a fd is writable.
- * HINT: when we change to the new threading model, this function
- * is probably no longer needed.
- * rgerhards, 2007-08-02
- */
-DEFFUNC_llExecFunc(mainloopCallWithWritableFDsActions)
-{
- DEFiRet;
- action_t *pAction = (action_t*) pData;
- selectHelperWriteFDSInfo_t *pState = (selectHelperWriteFDSInfo_t*) pParam;
- short fdMod;
-
- assert(pAction != NULL);
- assert(pState != NULL);
-
- if(pAction->pMod->getWriteFDForSelect(pAction->pModData, &fdMod) == RS_RET_OK) {
- if(FD_ISSET(fdMod, pState->pWritefds)) {
- if((iRet = pAction->pMod->onSelectReadyWrite(pAction->pModData))
- != RS_RET_OK) {
- dbgprintf("error %d from onSelectReadyWrite() - continuing\n", iRet);
- }
- if(--(pState->pMaxfds) == 0) {
- ABORT_FINALIZE(RS_RET_FINISHED); /* all processed, nothing left to do */
- }
- }
- }
-
-finalize_it:
- return iRet;
-}
-
-
/* process the select() selector array after the successful select.
* processing is completed as soon as all selectors needing attention
* are processed.
* rgerhards, 2007-08-08
*/
-static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_set *pWritefds)
+static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds)
{
DEFiRet;
- rsRetVal iRetLL;
int i;
char line[MAXLINE +1];
- selectHelperWriteFDSInfo_t writeFDSInfo;
#ifdef SYSLOG_INET
- selector_t *f;
struct sockaddr_storage frominet;
socklen_t socklen;
uchar fromHost[NI_MAXHOST];
@@ -5552,31 +5488,6 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se
}
#ifdef SYSLOG_INET
- /* Now check the TCP send sockets. So far, we only see if they become
- * writable and then change their internal status. No real async
- * writing is currently done. This code will be replaced once liblogging
- * is used, thus we try not to focus too much on it.
- *
- * IMPORTANT: With the current code, the writefds must be checked first,
- * because the readfds might have messages to be forwarded, which
- * rely on the status setting that is done here!
- * rgerhards 2005-07-20
- *
- * liblogging implementation will not happen as anticipated above. So
- * this code here will stay for quite a while.
- * rgerhards, 2006-12-07
- */
- writeFDSInfo.pWritefds = pWritefds;
- writeFDSInfo.pMaxfds = &nfds;
- for(f = Files; f != NULL ; f = f->f_next) {
- iRetLL = llExecFunc(&f->llActList, mainloopCallWithWritableFDsActions, &writeFDSInfo);
- if(iRetLL == RS_RET_FINISHED) {
- ABORT_FINALIZE(RS_RET_OK); /* we are done in this case */
- }
- }
-#endif /* #ifdef SYSLOG_INET */
-
-#ifdef SYSLOG_INET
if (finet != NULL && AcceptRemote) {
for (i = 0; i < *finet; i++) {
if (FD_ISSET(finet[i+1], pReadfds)) {
@@ -5711,14 +5622,8 @@ static void mainloop(void)
int maxfds;
int nfds;
#ifdef SYSLOG_INET
- selectHelperWriteFDSInfo_t writeFDSInfo;
- fd_set writefds;
- selector_t *f;
int iTCPSess;
#endif /* #ifdef SYSLOG_INET */
-#ifdef BSD
- struct timeval tvSelectTimeout;
-#endif
while(!bFinished){
errno = 0;
@@ -5770,23 +5675,6 @@ static void mainloop(void)
}
}
- /* TODO: activate the code below only if we actually need to check
- * for outstanding writefds.
- */
- if(1) {
- /* Now add the TCP output sockets to the writefds set. This implementation
- * is not optimal (performance-wise) and it should be replaced with something
- * better in the longer term. I've not yet done this, as this code is
- * scheduled to be replaced after the liblogging integration.
- * rgerhards 2005-07-20
- */
- FD_ZERO(&writefds);
- writeFDSInfo.pWritefds = &writefds;
- writeFDSInfo.pMaxfds = &maxfds;
- for (f = Files; f != NULL ; f = f->f_next) {
- llExecFunc(&f->llActList, mainloopAddModWriteFDSforSelect, &writeFDSInfo);
- }
- }
#endif
if ( debugging_on ) {
@@ -5798,37 +5686,7 @@ static void mainloop(void)
dbgprintf("\n");
}
-#define MAIN_SELECT_TIMEVAL NULL
-#ifdef BSD
- /* There seems to be a problem with BSD and threads. When running on
- * multiple threads, a signal will not cause the select call to be
- * interrrupted. I am not sure if this is by design or an bug (some
- * information on the web let's me think it is a bug), but that really
- * does not matter. The issue with our code is that we will not gain
- * control when rsyslogd is terminated or huped. What I am doing now is
- * make the select call timeout after 10 seconds, so that we can check
- * the condition then. Obviously, this causes some sluggish behaviour and
- * also the loss of some (very few) cpu cycles. Both, I think, are
- * absolutely acceptable.
- * rgerhards, 2005-10-26
- * TODO: I got some information: this seems to be expected signal() behaviour
- * we should investigate the use of sigaction() (see klogd.c for an sample).
- * rgerhards, 2007-06-22
- * rgerhards, 2007-09-11: code has been converted to sigaction() now. We need
- * to re-check on BSD, I think the issue is now solved.
- */
- tvSelectTimeout.tv_sec = 10;
- tvSelectTimeout.tv_usec = 0;
-# undef MAIN_SELECT_TIMEVAL
-# define MAIN_SELECT_TIMEVAL &tvSelectTimeout
-#endif
-#ifdef SYSLOG_INET
-#define MAIN_SELECT_WRITEFDS (fd_set *) &writefds
-#else
-#define MAIN_SELECT_WRITEFDS NULL
-#endif
- nfds = select(maxfds+1, (fd_set *) &readfds, MAIN_SELECT_WRITEFDS,
- (fd_set *) NULL, MAIN_SELECT_TIMEVAL);
+ nfds = select(maxfds+1, (fd_set *) &readfds, NULL, NULL, NULL);
if(bRequestDoMark) {
domark();
@@ -5849,10 +5707,7 @@ static void mainloop(void)
continue;
}
- processSelectAfter(maxfds, nfds, &readfds, MAIN_SELECT_WRITEFDS);
-
-#undef MAIN_SELECT_TIMEVAL
-#undef MAIN_SELECT_WRITEFDS
+ processSelectAfter(maxfds, nfds, &readfds);
}
}
@@ -6074,10 +5929,6 @@ 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
@@ -6334,36 +6185,8 @@ int main(int argc, char **argv)
sigaction(SIGXFSZ, &sigAct, NULL); /* do not abort if 2gig file limit is hit */
(void) alarm(TIMERINTVL);
-#if 0
- i = pthread_create(&thrdMain, NULL, immark_runInput, NULL);
- dbgprintf("\"main\" thread started with state %d.\n", i);
-#endif
-
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);
-
- /* we block all signals - they will be processed by the "main"-thread. This most
- * closely resembles previous behaviour. TODO: think about optimizing it, some
- * signals may better be delivered here. rgerhards, 2007-10-08
- */
- sigfillset(&sigSet);
- pthread_sigmask(SIG_BLOCK, &sigSet, NULL);
-
- /* see comment in mainThread on why we start thread and then immediately
- * do a blocking wait on it - it makese sense... ;) rgerhards, 2007-10-08
- */
-#endif
-
/* do any de-init's that need to be done AFTER this comment */
dbgprintf("reaching die\n");