summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-17 12:46:57 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-17 12:46:57 +0200
commit60309004dfc57c3243abb2f01042950201596773 (patch)
tree707b9fbe0e4cc00133611701af0999c1bdacfbfc /tools/syslogd.c
parente5130affc022eff12a3d9584576a385edbb13465 (diff)
downloadrsyslog-60309004dfc57c3243abb2f01042950201596773.tar.gz
rsyslog-60309004dfc57c3243abb2f01042950201596773.tar.xz
rsyslog-60309004dfc57c3243abb2f01042950201596773.zip
completed better modularity of runtime
- added the ability to specify an error log function for the runtime - removed dependency of core runtime on dirty.h Note that it is "better" modularity, not perfect. There is still work to do, but I think we can for the time being proceed with other things.
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 67c7d11b..f2b18a3d 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -847,6 +847,19 @@ finalize_it:
RETiRet;
}
+
+/* this is a special function used to submit an error message. This
+ * function is also passed to the runtime library as the generic error
+ * message handler. -- rgerhards, 2008-04-17
+ */
+rsRetVal
+submitErrMsg(uchar *msg)
+{
+ DEFiRet;
+ iRet = logmsgInternal(LOG_SYSLOG|LOG_ERR, msg, ADDDATE);
+ RETiRet;
+}
+
/* rgerhards 2004-11-09: the following is a function that can be used
* to log a message orginating from the syslogd itself. In sysklogd code,
* this is done by simply calling logmsg(). However, logmsg() is changed in
@@ -857,14 +870,14 @@ finalize_it:
* think on the best way to do this.
*/
rsRetVal
-logmsgInternal(int pri, char *msg, int flags)
+logmsgInternal(int pri, uchar *msg, int flags)
{
DEFiRet;
msg_t *pMsg;
CHKiRet(msgConstruct(&pMsg));
- MsgSetUxTradMsg(pMsg, msg);
- MsgSetRawMsg(pMsg, msg);
+ MsgSetUxTradMsg(pMsg, (char*)msg);
+ MsgSetRawMsg(pMsg, (char*)msg);
MsgSetHOSTNAME(pMsg, (char*)glbl.GetLocalHostName());
MsgSetRcvFrom(pMsg, (char*)glbl.GetLocalHostName());
MsgSetTAG(pMsg, "rsyslogd:");
@@ -1877,7 +1890,7 @@ die(int sig)
"\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"]" " exiting on signal %d.",
(int) myPid, sig);
errno = 0;
- logmsgInternal(LOG_SYSLOG|LOG_INFO, buf, ADDDATE);
+ logmsgInternal(LOG_SYSLOG|LOG_INFO, (uchar*)buf, ADDDATE);
}
/* drain queue (if configured so) and stop main queue worker thread pool */
@@ -2330,7 +2343,7 @@ init(void)
" [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \
"\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"] restart",
(int) myPid);
- logmsgInternal(LOG_SYSLOG|LOG_INFO, bufStartUpMsg, ADDDATE);
+ logmsgInternal(LOG_SYSLOG|LOG_INFO, (uchar*)bufStartUpMsg, ADDDATE);
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);