summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-03-26 16:59:00 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-26 16:59:00 +0100
commit3ab759c40d34f518744efa9b266640784fc3655f (patch)
tree506ea26a66166a4ed4bdfdfa36db89be2382558c
parentb67b5b8f73074931285dad4cb2e6d760923a19f8 (diff)
downloadrsyslog-3ab759c40d34f518744efa9b266640784fc3655f.tar.gz
rsyslog-3ab759c40d34f518744efa9b266640784fc3655f.tar.xz
rsyslog-3ab759c40d34f518744efa9b266640784fc3655f.zip
cleanup in solaris components for imklog
-rw-r--r--plugins/imklog/solaris.c2
-rw-r--r--plugins/imklog/solaris_cddl.c104
2 files changed, 8 insertions, 98 deletions
diff --git a/plugins/imklog/solaris.c b/plugins/imklog/solaris.c
index a0e85dc7..c2aec30a 100644
--- a/plugins/imklog/solaris.c
+++ b/plugins/imklog/solaris.c
@@ -69,7 +69,6 @@ klogWillRun(void)
if (fklog < 0) {
char errStr[1024];
int err = errno;
-perror("XXX");
rs_strerror_r(err, errStr, sizeof(errStr));
DBGPRINTF("error %d opening log socket: %s\n",
GetPath(), errStr);
@@ -167,7 +166,6 @@ rsRetVal klogLogKMsg(void)
{
DEFiRet;
sun_sys_poll();
- //readklog();
RETiRet;
}
diff --git a/plugins/imklog/solaris_cddl.c b/plugins/imklog/solaris_cddl.c
index 700e0ab3..1053de66 100644
--- a/plugins/imklog/solaris_cddl.c
+++ b/plugins/imklog/solaris_cddl.c
@@ -40,61 +40,24 @@
* software developed by the University of California, Berkeley, and its
* contributors.
*/
-
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <sys/poll.h>
-
-//---------
-#include <note.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <ctype.h>
-#include <signal.h>
-#include <string.h>
-#include <strings.h>
-#include <libscf.h>
-#include <netconfig.h>
-#include <netdir.h>
-#include <pwd.h>
-#include <utmpx.h>
-#include <limits.h>
#include <pthread.h>
#include <fcntl.h>
#include <stropts.h>
#include <assert.h>
-#include <sys/statvfs.h>
-
-#include <sys/param.h>
-#include <sys/sysmacros.h>
-#include <sys/syslog.h>
#include <sys/strlog.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/utsname.h>
-#include <sys/poll.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-#include <sys/mman.h>
-#include <sys/note.h>
-#include <door.h>
-//--------
-
#include "rsyslog.h"
static struct pollfd Pfd; /* Pollfd for local the log device */
-
-
-/*
- * findnl_bkwd:
+/* findnl_bkwd:
* Scans each character in buf until it finds the last newline in buf,
* or the scanned character becomes the last COMPLETE character in buf.
* Returns the number of scanned bytes.
@@ -174,8 +137,8 @@ findnl_bkwd(const char *buf, const size_t len)
}
//___ end
-/*
- * Attempts to open the local log device
+
+/* Attempts to open the local log device
* and return a file descriptor.
*/
int
@@ -210,7 +173,7 @@ sun_openklog(char *name, int mode)
* Pull up one message from log driver.
*/
void
-sun_getkmsg(int timeout)
+sun_getkmsg()
{
int flags = 0, i;
char *lastline;
@@ -304,55 +267,13 @@ sun_getkmsg(int timeout)
}
-#if 0
-/*
- * Open the log device, and pull up all pending messages.
- */
-void
-sun_prepare_sys_poll()
-{
- int nfds, funix;
-
-/*
- if ((funix = sun_openklog(LogName, O_RDONLY)) < 0) {
- logerror("can't open kernel log device - fatal");
- exit(1);
- }
-*/
-
- Pfd.fd = funix;
- Pfd.events = POLLIN;
-
- for (;;) {
- nfds = poll(&Pfd, 1, 0);
- /*
- if (nfds <= 0) {
- if (sys_init_msg_count > 0)
- flushmsg(SYNC_FILE);
- break;
- }*/
-
- if (Pfd.revents & POLLIN) {
- sun_getkmsg(0);
- } else if (Pfd.revents & (POLLNVAL|POLLHUP|POLLERR)) {
- //logerror("kernel log driver poll error");
- dbgprintf("klog:kernel log driver poll error");
- break;
- }
- }
-
-}
-#endif
-
-
-/*
- * this thread listens to the local stream log driver for log messages
+/* this thread listens to the local stream log driver for log messages
* generated by this host, formats them, and queues them to the logger
* thread.
*/
/*ARGSUSED*/
void *
-sun_sys_poll(void *ap)
+sun_sys_poll()
{
int nfds;
@@ -369,10 +290,8 @@ sun_sys_poll(void *ap)
for (;;) {
errno = 0;
-dbgprintf("XXX: before poll\n");
nfds = poll(&Pfd, 1, INFTIM);
-dbgprintf("XXX: after poll, nfds %d\n", nfds);
if (nfds == 0)
continue;
@@ -383,9 +302,9 @@ dbgprintf("XXX: after poll, nfds %d\n", nfds);
continue;
}
if (Pfd.revents & POLLIN) {
- sun_getkmsg(INFTIM);
+ sun_getkmsg();
} else {
- // TODO: shutdown, the rsyslog way
+ // TODO: shutdown, the rsyslog way (in v5!)
//if (shutting_down) {
//pthread_exit(0);
//}
@@ -398,13 +317,6 @@ dbgprintf("XXX: after poll, nfds %d\n", nfds);
}
}
-/* while (Pfd.fd == -1 && klogerrs++ < 10) {
- Pfd.fd = sun_openklog(LogName, O_RDONLY);
- }
- if (klogerrs >= 10) {
- logerror("can't reopen kernel log device - fatal");
- exit(1);
- }*/
}
/*NOTREACHED*/
return (NULL);