diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-29 09:14:10 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-29 09:14:10 +0000 |
commit | 4412b88148a21d54ba1c2f88ba894b6223986b9a (patch) | |
tree | 07c18ea553bf5060d2ca1b431164d5a36b725d73 /debug.c | |
parent | 3d0f49a82e46fdffd8bb2c653ccb46ddd516e112 (diff) | |
download | rsyslog-4412b88148a21d54ba1c2f88ba894b6223986b9a.tar.gz rsyslog-4412b88148a21d54ba1c2f88ba894b6223986b9a.tar.bz2 rsyslog-4412b88148a21d54ba1c2f88ba894b6223986b9a.zip |
changed obj base object's calling interface to use the new obj_if_t
interface structure
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -51,7 +51,8 @@ /* static data (some time to be replaced) */ -int Debug; /* debug flag - read-only after startup */ +DEFobjCurrIf(obj) +int Debug; /* debug flag - read-only after startup */ int debugging_on = 0; /* read-only, except on sig USR1 */ static int bLogFuncFlow = 0; /* shall the function entry and exit be logged to the debug log? */ static int bLogAllocFree = 0; /* shall calls to (m/c)alloc and free be logged to the debug log? */ @@ -800,8 +801,8 @@ dbgoprint(obj_t *pObj, char *fmt, ...) if(altdbg != NULL) fprintf(altdbg, "%s: ", pszThrdName); /* print object name header if we have an object */ if(pObj != NULL) { - if(stddbg != NULL) fprintf(stddbg, "%s: ", objGetName(pObj)); - if(altdbg != NULL) fprintf(altdbg, "%s: ", objGetName(pObj)); + if(stddbg != NULL) fprintf(stddbg, "%s: ", obj.GetName(pObj)); + if(altdbg != NULL) fprintf(altdbg, "%s: ", obj.GetName(pObj)); } } bWasNL = (*(fmt + strlen(fmt) - 1) == '\n') ? 1 : 0; @@ -1183,15 +1184,25 @@ dbgGetRuntimeOptions(void) } } + /* end support system to set debug options at runtime */ rsRetVal dbgClassInit(void) { + DEFiRet; + struct sigaction sigAct; sigset_t sigSet; (void) pthread_key_create(&keyCallStack, dbgCallStackDestruct); /* MUST be the first action done! */ + + /* while we try not to use any of the real rsyslog code (to avoid infinite loops), we + * need to have the ability to query object names. Thus, we need to obtain a pointer to + * the object interface. -- rgerhards, 2008-02-29 + */ + CHKiRet(objGetObjInterface(&obj)); /* this provides the root pointer for all other queries */ + memset(&sigAct, 0, sizeof (sigAct)); sigemptyset(&sigAct.sa_mask); sigAct.sa_handler = sigusr2Hdlr; @@ -1212,7 +1223,9 @@ rsRetVal dbgClassInit(void) } dbgSetThrdName((uchar*)"main thread"); - return RS_RET_OK; + +finalize_it: + RETiRet; } |