summaryrefslogtreecommitdiffstats
path: root/runtime/debug.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-03-22 09:33:33 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-03-22 09:33:33 +0100
commit223439934c20f38bc00ec5287124737932d33ddb (patch)
tree83f1b2b82271574ddd503ab1c43049b86817f839 /runtime/debug.c
parent785e0c3c8b00614b6f780f902442025f4558a160 (diff)
parent906ed9df906fe3a52b042929130e6fc9a00b53a8 (diff)
downloadrsyslog-223439934c20f38bc00ec5287124737932d33ddb.tar.gz
rsyslog-223439934c20f38bc00ec5287124737932d33ddb.tar.bz2
rsyslog-223439934c20f38bc00ec5287124737932d33ddb.zip
Merge branch 'master' into master-gt
Conflicts: configure.ac runtime/rsyslog.h
Diffstat (limited to 'runtime/debug.c')
-rw-r--r--runtime/debug.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/runtime/debug.c b/runtime/debug.c
index fa39e7fe..876f61d0 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -303,7 +303,7 @@ static inline void dbgFuncDBRemoveMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_
void
dbgOutputTID(char* name)
{
-# ifdef HAVE_SYSCALL
+# if defined(HAVE_SYSCALL) && defined(HAVE_SYS_gettid)
if(bOutputTidToStderr)
fprintf(stderr, "thread tid %u, name '%s'\n",
(unsigned)syscall(SYS_gettid), name);
@@ -1315,6 +1315,15 @@ dbgmalloc(size_t size)
}
+/* report fd used for debug log. This is needed in case of
+ * auto-backgrounding, where the debug log shall not be closed.
+ */
+int
+dbgGetDbglogFd(void)
+{
+ return altdbg;
+}
+
/* read in the runtime options
* rgerhards, 2008-02-28
*/
@@ -1398,6 +1407,25 @@ dbgGetRuntimeOptions(void)
}
+void
+dbgSetDebugLevel(int level)
+{
+ Debug = level;
+ debugging_on = (level == DEBUG_FULL) ? 1 : 0;
+}
+
+void
+dbgSetDebugFile(uchar *fn)
+{
+ if(altdbg != -1) {
+ dbgprintf("switching to debug file %s\n", fn);
+ close(altdbg);
+ }
+ if((altdbg = open((char*)fn, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY|O_CLOEXEC, S_IRUSR|S_IWUSR)) == -1) {
+ fprintf(stderr, "alternate debug file could not be opened, ignoring. Error: %s\n", strerror(errno));
+ }
+}
+
/* end support system to set debug options at runtime */
rsRetVal dbgClassInit(void)