diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-05 14:53:25 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-05 14:53:25 +0000 |
commit | 24b02dc831889986211600a75572737e733ef9d8 (patch) | |
tree | 50e1525e5749c8b6e51969d8ff88060a172b0497 /modules.c | |
parent | 213e0b596205626214891fb46e1a780af7f26a8b (diff) | |
download | rsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.gz rsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.xz rsyslog-24b02dc831889986211600a75572737e733ef9d8.zip |
- extracted logerror*() family of functions from syslogd, made them their
own class and converted to new object calling conventions
(interface-based)
- converted gss-misc into a loadable library module
Diffstat (limited to 'modules.c')
-rw-r--r-- | modules.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -41,13 +41,14 @@ #include "syslogd.h" #include "cfsysline.h" #include "modules.h" +#include "errmsg.h" /* static data */ DEFobjStaticHelpers +DEFobjCurrIf(errmsg) static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */ static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */ -static int bCfsyslineInitialized = 0; /* config settings */ uchar *pModDir = NULL; /* read-only after startup */ @@ -224,12 +225,6 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()), uchar * assert(modInit != NULL); - if(bCfsyslineInitialized == 0) { - /* we need to initialize the cfsysline subsystem first */ - CHKiRet(cfsyslineInit()); - bCfsyslineInitialized = 1; - } - if((iRet = moduleConstruct(&pNew)) != RS_RET_OK) { pNew = NULL; ABORT_FINALIZE(iRet); @@ -471,20 +466,20 @@ Load(uchar *pModName) if(!(pModHdlr = dlopen((char *) szPath, RTLD_NOW))) { snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', dlopen: %s\n", szPath, dlerror()); errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0'; - logerror((char *) errMsg); + errmsg.LogError(NO_ERRCODE, "%s", errMsg); ABORT_FINALIZE(RS_RET_ERR); } if(!(pModInit = dlsym(pModHdlr, "modInit"))) { snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', dlsym: %s\n", szPath, dlerror()); errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0'; - logerror((char *) errMsg); + errmsg.LogError(NO_ERRCODE, "%s", errMsg); dlclose(pModHdlr); ABORT_FINALIZE(RS_RET_ERR); } if((iRet = doModInit(pModInit, (uchar*) pModName, pModHdlr)) != RS_RET_OK) { snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', rsyslog error %d\n", szPath, iRet); errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0'; - logerror((char *) errMsg); + errmsg.LogError(NO_ERRCODE, "%s", errMsg); dlclose(pModHdlr); ABORT_FINALIZE(RS_RET_ERR); } @@ -527,6 +522,7 @@ ENDobjQueryInterface(module) */ BEGINAbstractObjClassInit(module, 1, OBJ_IS_CORE_MODULE) /* class, version - CHANGE class also in END MACRO! */ /* request objects we use */ + CHKiRet(objUse(errmsg, CORE_COMPONENT)); ENDObjClassInit(module) /* vi:set ai: |