]> git.pld-linux.org Git - packages/samba.git/blob - pcp.patch
- up to 4.8.3
[packages/samba.git] / pcp.patch
1 commit 426e4a5a20cff73a80d80b46f15826deac3f934f
2 Author: Amitay Isaacs <amitay@gmail.com>
3 Date:   Thu Mar 1 12:32:26 2018 +1100
4
5     ctdb-pmda: Use modified API in pcp library 4.0
6     
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>.
10     
11     Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12     Reviewed-by: Martin Schwenke <martin@meltin.net>
13     
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
16
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
21 @@ -33,9 +33,17 @@
22  #include "client/client_sync.h"
23  
24  #include <pcp/pmapi.h>
25 -#include <pcp/impl.h>
26  #include <pcp/pmda.h>
27  
28 +#ifdef HAVE___PMID_INT
29 +#include <pcp/impl.h>
30 +
31 +#define pmID_cluster(id)       id->cluster
32 +#define pmID_item(id)          id->item
33 +#define pmGetProgname()                pmProgname
34 +#define pmSetProgname(a)       __pmSetProgname(a)
35 +#endif
36 +
37  #include "domain.h"
38  
39  /*
40 @@ -386,7 +394,11 @@ static int
41  pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
42  {
43         int ret;
44 +#ifdef HAVE___PMID_INT
45         __pmID_int *id = (__pmID_int *)&(mdesc->m_desc.pmid);
46 +#else
47 +       pmID id = *(pmID *)&(mdesc->m_desc.pmid);
48 +#endif
49  
50         if (inst != PM_IN_NULL) {
51                 return PM_ERR_INST;
52 @@ -399,27 +411,27 @@ pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
53         }
54  
55  
56 -       switch (id->cluster) {
57 +       switch (pmID_cluster(id)) {
58         case 0:
59 -               ret = fill_base(id->item, atom);
60 +               ret = fill_base(pmID_item(id), atom);
61                 if (ret) {
62                         goto err_out;
63                 }
64                 break;
65         case 1:
66 -               ret = fill_node(id->item, atom);
67 +               ret = fill_node(pmID_item(id), atom);
68                 if (ret) {
69                         goto err_out;
70                 }
71                 break;
72         case 2:
73 -               ret = fill_client(id->item, atom);
74 +               ret = fill_client(pmID_item(id), atom);
75                 if (ret) {
76                         goto err_out;
77                 }
78                 break;
79         case 3:
80 -               ret = fill_timeout(id->item, atom);
81 +               ret = fill_timeout(pmID_item(id), atom);
82                 if (ret) {
83                         goto err_out;
84                 }
85 @@ -502,7 +514,7 @@ helpfile(void)
86  static void
87  usage(void)
88  {
89 -       fprintf(stderr, "Usage: %s [options]\n\n", pmProgname);
90 +       fprintf(stderr, "Usage: %s [options]\n\n", pmGetProgname());
91         fputs("Options:\n"
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;
97  
98 -       __pmSetProgname(argv[0]);
99 +       pmSetProgname(argv[0]);
100  
101 -       pmdaDaemon(&dispatch, PMDA_INTERFACE_2, pmProgname, CTDB,
102 +       pmdaDaemon(&dispatch, PMDA_INTERFACE_2, argv[0], CTDB,
103                    log_file, helpfile());
104  
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
108 --- a/ctdb/wscript
109 +++ b/ctdb/wscript
110 @@ -175,6 +175,7 @@ def configure(conf):
111          if not conf.CHECK_FUNCS_IN('pmdaDaemon', 'pcp_pmda'):
112              pmda_support = False
113          if pmda_support:
114 +            conf.CHECK_TYPE_IN('__pmID_int', 'pcp/pmapi.h pcp/impl.h')
115              have_pmda = True
116          else:
117              Logs.error("PMDA support not available")
This page took 0.500492 seconds and 3 git commands to generate.