diff options
Diffstat (limited to 'plugins/imsolaris/imsolaris.c')
-rw-r--r-- | plugins/imsolaris/imsolaris.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/plugins/imsolaris/imsolaris.c b/plugins/imsolaris/imsolaris.c index 6b07ba2b..ee9ec5c6 100644 --- a/plugins/imsolaris/imsolaris.c +++ b/plugins/imsolaris/imsolaris.c @@ -85,6 +85,7 @@ #include "sun_cddl.h" MODULE_TYPE_INPUT +MODULE_TYPE_NOKEEP /* defines */ #define PATH_LOG "/dev/log" @@ -205,7 +206,6 @@ readLog(int fd, uchar *pRcv, int iMaxLine) MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName())); pMsg->iFacility = LOG_FAC(hdr.pri); pMsg->iSeverity = LOG_PRI(hdr.pri); - pMsg->bParseHOSTNAME = 0; pMsg->msgFlags = NEEDS_PARSING | NO_PRI_IN_RAW; CHKiRet(submitMsg(pMsg)); } @@ -224,7 +224,7 @@ finalize_it: * rgerhards, 2010-04-19 */ static inline rsRetVal -getMsgs(int timeout) +getMsgs(thrdInfo_t *pThrd, int timeout) { DEFiRet; int nfds; @@ -247,12 +247,14 @@ getMsgs(int timeout) CHKmalloc(pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1))); } - do { + while(pThrd->bShallStop != TRUE) { DBGPRINTF("imsolaris: waiting for next message (timeout %d)...\n", timeout); if(timeout == 0) { nfds = poll(&sun_Pfd, 1, timeout); /* wait without timeout */ - /* v5-TODO: here we must check if we should terminante! */ + if(pThrd->bShallStop == TRUE) { + break; + } if(nfds == 0) { if(timeout == 0) { @@ -290,9 +292,7 @@ getMsgs(int timeout) readLog(sun_Pfd.fd, pRcv, iMaxLine); } - } while(1); /* TODO: in v5, we must check the termination predicate */ - - /* Note: in v4, this code is never reached (our thread will be cancelled) */ + } finalize_it: if(pRcv != NULL && (size_t) iMaxLine >= sizeof(bufRcv) - 1) @@ -311,7 +311,7 @@ CODESTARTrunInput */ DBGPRINTF("imsolaris: doing startup poll before openeing door()\n"); - CHKiRet(getMsgs(0)); + CHKiRet(getMsgs(pThrd, 0)); /* note: sun's syslogd code claims that the door should only * be opened when the log stream has been polled. So file header @@ -319,8 +319,9 @@ CODESTARTrunInput */ sun_open_door(); DBGPRINTF("imsolaris: starting regular poll loop\n"); - iRet = getMsgs(-1); /* this is the primary poll loop, infinite timeout */ + iRet = getMsgs(pThrd, -1); /* this is the primary poll loop, infinite timeout */ + DBGPRINTF("imsolaris: terminating (bShallStop=%d)\n", pThrd->bShallStop); finalize_it: RETiRet; ENDrunInput @@ -359,9 +360,17 @@ CODESTARTmodExit ENDmodExit +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature + if(eFeat == sFEATURENonCancelInputTermination) + iRet = RS_RET_OK; +ENDisCompatibleWithFeature + + BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_IMOD_QUERIES +CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES ENDqueryEtryPt static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, |