summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2018-03-01 12:32:26 +1100
committerKarolin Seeger <kseeger@samba.org>2018-07-10 10:44:13 +0200
commit6600f4b1641160c902e8318c64a33575610deb31 (patch)
treec6b45e62f882823003cf5714bc578f08b97fd7b5 /ctdb
parent0e3f149a09201ae53d489fd48eec705df0ffdcca (diff)
downloadsamba-6600f4b1641160c902e8318c64a33575610deb31.tar.gz
ctdb-pmda: Use modified API in pcp library 4.0
Support backward compatibility by checking for __pmID_int type, which was previously in <pcp/impl.h>. In the new version, this type is not defined anymore and there is no need to include <pcp/impl.h>. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Mar 2 00:38:52 CET 2018 on sn-devel-144 (cherry picked from commit 426e4a5a20cff73a80d80b46f15826deac3f934f)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/utils/pmda/pmda_ctdb.c30
-rw-r--r--ctdb/wscript1
2 files changed, 22 insertions, 9 deletions
diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c
index 41eaf93fb18..45ec5f19821 100644
--- a/ctdb/utils/pmda/pmda_ctdb.c
+++ b/ctdb/utils/pmda/pmda_ctdb.c
@@ -33,9 +33,17 @@
#include "client/client_sync.h"
#include <pcp/pmapi.h>
-#include <pcp/impl.h>
#include <pcp/pmda.h>
+#ifdef HAVE___PMID_INT
+#include <pcp/impl.h>
+
+#define pmID_cluster(id) id->cluster
+#define pmID_item(id) id->item
+#define pmGetProgname() pmProgname
+#define pmSetProgname(a) __pmSetProgname(a)
+#endif
+
#include "domain.h"
/*
@@ -386,7 +394,11 @@ static int
pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
{
int ret;
+#ifdef HAVE___PMID_INT
__pmID_int *id = (__pmID_int *)&(mdesc->m_desc.pmid);
+#else
+ pmID id = *(pmID *)&(mdesc->m_desc.pmid);
+#endif
if (inst != PM_IN_NULL) {
return PM_ERR_INST;
@@ -399,27 +411,27 @@ pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
}
- switch (id->cluster) {
+ switch (pmID_cluster(id)) {
case 0:
- ret = fill_base(id->item, atom);
+ ret = fill_base(pmID_item(id), atom);
if (ret) {
goto err_out;
}
break;
case 1:
- ret = fill_node(id->item, atom);
+ ret = fill_node(pmID_item(id), atom);
if (ret) {
goto err_out;
}
break;
case 2:
- ret = fill_client(id->item, atom);
+ ret = fill_client(pmID_item(id), atom);
if (ret) {
goto err_out;
}
break;
case 3:
- ret = fill_timeout(id->item, atom);
+ ret = fill_timeout(pmID_item(id), atom);
if (ret) {
goto err_out;
}
@@ -502,7 +514,7 @@ helpfile(void)
static void
usage(void)
{
- fprintf(stderr, "Usage: %s [options]\n\n", pmProgname);
+ fprintf(stderr, "Usage: %s [options]\n\n", pmGetProgname());
fputs("Options:\n"
" -d domain use domain (numeric) for metrics domain of PMDA\n"
" -l logfile write log into logfile rather than using default log name\n"
@@ -524,9 +536,9 @@ main(int argc, char **argv)
char log_file[] = "pmda_ctdb.log";
pmdaInterface dispatch;
- __pmSetProgname(argv[0]);
+ pmSetProgname(argv[0]);
- pmdaDaemon(&dispatch, PMDA_INTERFACE_2, pmProgname, CTDB,
+ pmdaDaemon(&dispatch, PMDA_INTERFACE_2, argv[0], CTDB,
log_file, helpfile());
if (pmdaGetOpt(argc, argv, "d:i:l:pu:?", &dispatch, &err) != EOF) {
diff --git a/ctdb/wscript b/ctdb/wscript
index 059ce3d43d8..6a039991a8f 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -175,6 +175,7 @@ def configure(conf):
if not conf.CHECK_FUNCS_IN('pmdaDaemon', 'pcp_pmda'):
pmda_support = False
if pmda_support:
+ conf.CHECK_TYPE_IN('__pmID_int', 'pcp/pmapi.h pcp/impl.h')
have_pmda = True
else:
Logs.error("PMDA support not available")