summaryrefslogtreecommitdiff
path: root/plugins/ompgsql
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2008-04-05 19:13:49 +0200
committerMichael Biebl <biebl@debian.org>2008-04-05 19:13:49 +0200
commit85df627b6c1cfc388a70ef5b01681d5d952a9dd7 (patch)
tree5b4136af33910f18d7f24c8506a2519620c6da1d /plugins/ompgsql
parent6eda8c4f5837480a4f897513d6951e3f5743723d (diff)
downloadrsyslog-85df627b6c1cfc388a70ef5b01681d5d952a9dd7.tar.gz
Imported Upstream version 3.14.1upstream/3.14.1
Diffstat (limited to 'plugins/ompgsql')
-rw-r--r--plugins/ompgsql/Makefile.am4
-rw-r--r--plugins/ompgsql/Makefile.in12
-rw-r--r--plugins/ompgsql/ompgsql.c47
-rw-r--r--plugins/ompgsql/ompgsql.h15
4 files changed, 39 insertions, 39 deletions
diff --git a/plugins/ompgsql/Makefile.am b/plugins/ompgsql/Makefile.am
index 5206b36..b2e3eff 100644
--- a/plugins/ompgsql/Makefile.am
+++ b/plugins/ompgsql/Makefile.am
@@ -1,7 +1,7 @@
pkglib_LTLIBRARIES = ompgsql.la
-ompgsql_la_SOURCES = ompgsql.c ompgsql.h ../../module-template.h
-ompgsql_la_CPPFLAGS = $(pgsql_cflags) -I$(srcdir)/../..
+ompgsql_la_SOURCES = ompgsql.c ompgsql.h
+ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags)
ompgsql_la_LDFLAGS = -module -avoid-version
ompgsql_la_LIBADD = $(pgsql_libs)
diff --git a/plugins/ompgsql/Makefile.in b/plugins/ompgsql/Makefile.in
index 3c41da8..ab791c4 100644
--- a/plugins/ompgsql/Makefile.in
+++ b/plugins/ompgsql/Makefile.in
@@ -166,6 +166,8 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+libdbi_cflags = @libdbi_cflags@
+libdbi_libs = @libdbi_libs@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -183,9 +185,15 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
pthreads_cflags = @pthreads_cflags@
pthreads_libs = @pthreads_libs@
+relp_cflags = @relp_cflags@
+relp_libs = @relp_libs@
+rfc3195_cflags = @rfc3195_cflags@
+rfc3195_libs = @rfc3195_libs@
rt_libs = @rt_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
+snmp_cflags = @snmp_cflags@
+snmp_libs = @snmp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
@@ -193,8 +201,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
zlib_libs = @zlib_libs@
pkglib_LTLIBRARIES = ompgsql.la
-ompgsql_la_SOURCES = ompgsql.c ompgsql.h ../../module-template.h
-ompgsql_la_CPPFLAGS = $(pgsql_cflags) -I$(srcdir)/../..
+ompgsql_la_SOURCES = ompgsql.c ompgsql.h
+ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags)
ompgsql_la_LDFLAGS = -module -avoid-version
ompgsql_la_LIBADD = $(pgsql_libs)
EXTRA_DIST = createDB.sql
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 24a68a5..1d7b2eb 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -8,19 +8,20 @@
*
* Copyright 2007 Rainer Gerhards and Adiscon GmbH.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of rsyslog.
*
- * This program is distributed in the hope that it will be useful,
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/
@@ -41,10 +42,14 @@
#include "template.h"
#include "ompgsql.h"
#include "module-template.h"
+#include "errmsg.h"
+
+MODULE_TYPE_OUTPUT
/* internal structures
*/
DEF_OMOD_STATIC_DATA
+DEFobjCurrIf(errmsg)
typedef struct _instanceData {
PGconn *f_hpgsql; /* handle to PgSQL */
@@ -87,27 +92,12 @@ CODESTARTfreeInstance
ENDfreeInstance
-BEGINneedUDPSocket
-CODESTARTneedUDPSocket
-ENDneedUDPSocket
-
-
BEGINdbgPrintInstInfo
CODESTARTdbgPrintInstInfo
/* nothing special here */
ENDdbgPrintInstInfo
-BEGINonSelectReadyWrite
-CODESTARTonSelectReadyWrite
-ENDonSelectReadyWrite
-
-
-BEGINgetWriteFDForSelect
-CODESTARTgetWriteFDForSelect
-ENDgetWriteFDForSelect
-
-
/* log a database error with descriptive message.
* We check if we have a valid handle. If not, we simply
* report an error, but can not be specific. RGerhards, 2007-01-30
@@ -123,7 +113,7 @@ static void reportDBError(instanceData *pData, int bSilent)
/* output log message */
errno = 0;
if(pData->f_hpgsql == NULL) {
- logerror("unknown DB error occured - could not obtain PgSQL handle");
+ errmsg.LogError(NO_ERRCODE, "unknown DB error occured - could not obtain PgSQL handle");
} else { /* we can ask pgsql for the error description... */
ePgSQLStatus = PQstatus(pData->f_hpgsql);
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", ePgSQLStatus,
@@ -132,7 +122,7 @@ static void reportDBError(instanceData *pData, int bSilent)
dbgprintf("pgsql, DBError(silent): %s\n", errMsg);
else {
pData->eLastPgSQLStatus = ePgSQLStatus;
- logerror(errMsg);
+ errmsg.LogError(NO_ERRCODE, "%s", errMsg);
}
}
@@ -160,7 +150,7 @@ static rsRetVal initPgSQL(instanceData *pData, int bSilent)
iRet = RS_RET_SUSPENDED;
}
- return iRet;
+ RETiRet;
}
@@ -196,7 +186,7 @@ finalize_it:
pData->eLastPgSQLStatus = CONNECTION_OK; /* reset error for error supression */
}
- return iRet;
+ RETiRet;
}
@@ -274,7 +264,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* Retries make no sense.
*/
if (iPgSQLPropErr) {
- logerror("Trouble with PgSQL connection properties. -PgSQL logging disabled");
+ errmsg.LogError(NO_ERRCODE, "Trouble with PgSQL connection properties. -PgSQL logging disabled");
ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
} else {
CHKiRet(initPgSQL(pData, 0));
@@ -296,8 +286,9 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
ENDmodInit
/*
* vi:set ai:
diff --git a/plugins/ompgsql/ompgsql.h b/plugins/ompgsql/ompgsql.h
index 8285ac3..495291f 100644
--- a/plugins/ompgsql/ompgsql.h
+++ b/plugins/ompgsql/ompgsql.h
@@ -5,19 +5,20 @@
*
* Copyright 2007 Rainer Gerhards and Adiscon GmbH.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of rsyslog.
*
- * This program is distributed in the hope that it will be useful,
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/