1 commit 426e4a5a20cff73a80d80b46f15826deac3f934f
2 Author: Amitay Isaacs <amitay@gmail.com>
3 Date: Thu Mar 1 12:32:26 2018 +1100
5 ctdb-pmda: Use modified API in pcp library 4.0
7 Support backward compatibility by checking for __pmID_int type, which
8 was previously in <pcp/impl.h>. In the new version, this type is not
9 defined anymore and there is no need to include <pcp/impl.h>.
11 Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 Reviewed-by: Martin Schwenke <martin@meltin.net>
14 Autobuild-User(master): Martin Schwenke <martins@samba.org>
15 Autobuild-Date(master): Fri Mar 2 00:38:52 CET 2018 on sn-devel-144
17 diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c
18 index 41eaf93fb18..45ec5f19821 100644
19 --- a/ctdb/utils/pmda/pmda_ctdb.c
20 +++ b/ctdb/utils/pmda/pmda_ctdb.c
22 #include "client/client_sync.h"
24 #include <pcp/pmapi.h>
25 -#include <pcp/impl.h>
28 +#ifdef HAVE___PMID_INT
29 +#include <pcp/impl.h>
31 +#define pmID_cluster(id) id->cluster
32 +#define pmID_item(id) id->item
33 +#define pmGetProgname() pmProgname
34 +#define pmSetProgname(a) __pmSetProgname(a)
40 @@ -386,7 +394,11 @@ static int
41 pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
44 +#ifdef HAVE___PMID_INT
45 __pmID_int *id = (__pmID_int *)&(mdesc->m_desc.pmid);
47 + pmID id = *(pmID *)&(mdesc->m_desc.pmid);
50 if (inst != PM_IN_NULL) {
52 @@ -399,27 +411,27 @@ pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
56 - switch (id->cluster) {
57 + switch (pmID_cluster(id)) {
59 - ret = fill_base(id->item, atom);
60 + ret = fill_base(pmID_item(id), atom);
66 - ret = fill_node(id->item, atom);
67 + ret = fill_node(pmID_item(id), atom);
73 - ret = fill_client(id->item, atom);
74 + ret = fill_client(pmID_item(id), atom);
80 - ret = fill_timeout(id->item, atom);
81 + ret = fill_timeout(pmID_item(id), atom);
85 @@ -502,7 +514,7 @@ helpfile(void)
89 - fprintf(stderr, "Usage: %s [options]\n\n", pmProgname);
90 + fprintf(stderr, "Usage: %s [options]\n\n", pmGetProgname());
92 " -d domain use domain (numeric) for metrics domain of PMDA\n"
93 " -l logfile write log into logfile rather than using default log name\n"
94 @@ -524,9 +536,9 @@ main(int argc, char **argv)
95 char log_file[] = "pmda_ctdb.log";
96 pmdaInterface dispatch;
98 - __pmSetProgname(argv[0]);
99 + pmSetProgname(argv[0]);
101 - pmdaDaemon(&dispatch, PMDA_INTERFACE_2, pmProgname, CTDB,
102 + pmdaDaemon(&dispatch, PMDA_INTERFACE_2, argv[0], CTDB,
103 log_file, helpfile());
105 if (pmdaGetOpt(argc, argv, "d:i:l:pu:?", &dispatch, &err) != EOF) {
106 diff --git a/ctdb/wscript b/ctdb/wscript
107 index f96d692cc16..d4170996aad 100644
110 @@ -175,6 +175,7 @@ def configure(conf):
111 if not conf.CHECK_FUNCS_IN('pmdaDaemon', 'pcp_pmda'):
114 + conf.CHECK_TYPE_IN('__pmID_int', 'pcp/pmapi.h pcp/impl.h')
117 Logs.error("PMDA support not available")