summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-26 16:00:54 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-26 16:00:54 +0000
commit3e6cb38f8a75e2573498d4f94d0dad70979cada3 (patch)
tree5520934bc2ec1485b172098152b5590265ce66aa
parent6e2c5057684a191c565220e6e41e561305b3a6ba (diff)
downloadrsyslog-3e6cb38f8a75e2573498d4f94d0dad70979cada3.tar.gz
rsyslog-3e6cb38f8a75e2573498d4f94d0dad70979cada3.tar.xz
rsyslog-3e6cb38f8a75e2573498d4f94d0dad70979cada3.zip
added IDs to selector_t
-rw-r--r--syslogd-types.h1
-rw-r--r--syslogd.c33
2 files changed, 33 insertions, 1 deletions
diff --git a/syslogd-types.h b/syslogd-types.h
index 5e4d262a..95c2b20f 100644
--- a/syslogd-types.h
+++ b/syslogd-types.h
@@ -127,6 +127,7 @@ struct syslogTime {
* be guarded by mutexes. But beware of deadlocks...
*/
struct filed {
+ int iID; /* ID of this entry - a "selector handle" */
struct filed *f_next; /* next in linked list */
short bEnabled; /* is the related action enabled (1) or disabled (0)? */
time_t f_time; /* time this was last written */
diff --git a/syslogd.c b/syslogd.c
index 7d7f09f9..a0eba597 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -918,7 +918,6 @@ static rsRetVal AddAllowedSender(struct AllowedSenders **ppRoot, struct AllowedS
* iListToPrint = 1 means UDP, 2 means TCP
* rgerhards, 2005-09-27
*/
-
static void PrintAllowedSenders(int iListToPrint)
{
struct AllowedSenders *pSender;
@@ -1413,6 +1412,33 @@ static int srSLMGParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS)
* END CODE-LIBLOGGING *
*******************************************************************/
+/* find a selector entry based on its ID.
+ * rgerhards, 2007-07-26
+ */
+static rsRetVal findSelector(int iID, selector_t **ppf)
+{
+ selector_t *f;
+ selector_t *psFound;
+ rsRetVal iRet;
+
+ assert(ppf != NULL);
+ for(f = Files; f != NULL && psFound == NULL ; f = f->f_next) {
+ if(f->iID == iID) {
+ psFound = f;
+ }
+ }
+
+ if(psFound != NULL) {
+ *ppf = psFound;
+ iRet = RS_RET_OK;
+ } else {
+ iRet = RS_RET_NOT_FOUND;
+ }
+
+ return iRet;
+}
+
+
/**
* Format a syslogTimestamp into format required by MySQL.
* We are using the 14 digits format. For example 20041111122600
@@ -4009,14 +4035,17 @@ static void init()
nextp = (selector_t *)calloc(1, sizeof(selector_t));
Files = nextp; /* set the root! */
cfline("*.ERR\t" _PATH_CONSOLE, nextp);
+ nextp->iID = 0;
nextp->f_next = (selector_t *)calloc(1, sizeof(selector_t));
cfline("*.PANIC\t*", nextp->f_next);
nextp->f_next = (selector_t *)calloc(1, sizeof(selector_t));
+ nextp->iID = 1;
snprintf(cbuf,sizeof(cbuf), "*.*\t%s", ttyname(0));
cfline(cbuf, nextp->f_next);
Initialized = 1;
}
else { /* we should consider moving this into a separate function, its lengthy... */
+ int iIDf = 0; /* ID for next struct filed entry */
/*
* Foreach line in the conf table, open that file.
*/
@@ -4076,6 +4105,7 @@ static void init()
} else {
/* successfully created an entry */
dprintf("selector line successfully processed\n");
+ f->iID = iIDf++;
if(nextp == NULL) {
Files = f;
}
@@ -4165,6 +4195,7 @@ static void init()
f->eHostnameCmpMode == HN_COMP_MATCH ?
"only" : "allbut",
rsCStrGetSzStr(f->pCSHostnameComp));
+ printf("%d: ", f->iID);
if(f->f_filter_type == FILTER_PRI) {
for (i = 0; i <= LOG_NFACILITIES; i++)
if (f->f_filterData.f_pmask[i] == TABLE_NOPRI)