ctdb-daemon: Stop using tevent compatibility definitions
[amitay/samba.git] / ctdb / utils / pmda / pmda_ctdb.c
1 /*
2  * CTDB Performance Metrics Domain Agent (PMDA) for Performance Co-Pilot (PCP)
3  *
4  * Copyright (c) 1995,2004 Silicon Graphics, Inc.  All Rights Reserved.
5  * Copyright (c) 2011 David Disseldorp
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; either version 2 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20  */
21
22 #include <pcp/pmapi.h>
23 #include <pcp/impl.h>
24 #include <pcp/pmda.h>
25 #include "includes.h"
26 #include "ctdb_private.h"
27 #include "ctdb_protocol.h"
28 #include "domain.h"
29 #include "common/system.h"
30
31 /*
32  * CTDB PMDA
33  *
34  * This PMDA connects to the locally running ctdbd daemon and pulls
35  * statistics for export via PCP. The ctdbd Unix domain socket path can be
36  * specified with the CTDB_SOCKET environment variable, otherwise the default
37  * path is used.
38  */
39
40 /*
41  * All metrics supported in this PMDA - one table entry for each.
42  * The 4th field specifies the serial number of the instance domain
43  * for the metric, and must be either PM_INDOM_NULL (denoting a
44  * metric that only ever has a single value), or the serial number
45  * of one of the instance domains declared in the instance domain table
46  * (i.e. in indomtab, above).
47  */
48 static pmdaMetric metrictab[] = {
49         /* num_clients */
50         { NULL, { PMDA_PMID(0,0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
51                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
52         /* frozen */
53         { NULL, { PMDA_PMID(0,1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
54                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
55         /* recovering */
56         { NULL, { PMDA_PMID(0,2), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
57                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
58         /* client_packets_sent */
59         { NULL, { PMDA_PMID(0,3), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
60                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
61         /* client_packets_recv */
62         { NULL, { PMDA_PMID(0,4), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
63                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
64         /* node_packets_sent */
65         { NULL, { PMDA_PMID(0,5), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
66                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
67         /* node_packets_recv */
68         { NULL, { PMDA_PMID(0,6), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
69                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
70         /* keepalive_packets_sent */
71         { NULL, { PMDA_PMID(0,7), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
72                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
73         /* keepalive_packets_recv */
74         { NULL, { PMDA_PMID(0,8), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
75                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
76         /* req_call */
77         { NULL, { PMDA_PMID(1,0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
78                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
79         /* reply_call */
80         { NULL, { PMDA_PMID(1,1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
81                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
82         /* req_dmaster */
83         { NULL, { PMDA_PMID(1,2), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
84                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
85         /* reply_dmaster */
86         { NULL, { PMDA_PMID(1,3), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
87                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
88         /* reply_error */
89         { NULL, { PMDA_PMID(1,4), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
90                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
91         /* req_message */
92         { NULL, { PMDA_PMID(1,5), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
93                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
94         /* req_control */
95         { NULL, { PMDA_PMID(1,6), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
96                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
97         /* reply_control */
98         { NULL, { PMDA_PMID(1,7), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
99                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
100         /* req_call */
101         { NULL, { PMDA_PMID(2,0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
102                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
103         /* req_message */
104         { NULL, { PMDA_PMID(2,1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
105                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
106         /* req_control */
107         { NULL, { PMDA_PMID(2,2), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
108                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
109         /* call */
110         { NULL, { PMDA_PMID(3,0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
111                 PMDA_PMUNITS(0,0,1,0,0,0) }, },
112         /* control */
113         { NULL, { PMDA_PMID(3,1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
114                 PMDA_PMUNITS(0,0,1,0,0,0) }, },
115         /* traverse */
116         { NULL, { PMDA_PMID(3,2), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
117                 PMDA_PMUNITS(0,0,1,0,0,0) }, },
118         /* total_calls */
119         { NULL, { PMDA_PMID(0,9), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
120                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
121         /* pending_calls */
122         { NULL, { PMDA_PMID(0,10), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
123                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
124         /* locks.num_calls */
125         { NULL, { PMDA_PMID(0,11), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
126                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
127         /* locks.num_pending */
128         { NULL, { PMDA_PMID(0,12), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
129                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
130         /* childwrite_calls */
131         { NULL, { PMDA_PMID(0,13), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER,
132                 PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, },
133         /* pending_childwrite_calls */
134         { NULL, { PMDA_PMID(0,14), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
135                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
136         /* memory_used */
137         { NULL, { PMDA_PMID(0,15), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
138                 PMDA_PMUNITS(1,0,0,PM_SPACE_BYTE,0,0) }, },
139         /* max_hop_count */
140         { NULL, { PMDA_PMID(0,16), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
141                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
142         /* reclock.ctdbd.max */
143         { NULL, { PMDA_PMID(0,17), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
144                 PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
145         /* reclock.recd.max */
146         { NULL, { PMDA_PMID(0,18), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
147                 PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
148         /* call_latency.max */
149         { NULL, { PMDA_PMID(0,19), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
150                 PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
151         /* locks.latency.max */
152         { NULL, { PMDA_PMID(0,20), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
153                 PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
154         /* childwrite_latency.max */
155         { NULL, { PMDA_PMID(0,21), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
156                 PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
157         /* num_recoveries */
158         { NULL, { PMDA_PMID(0,22), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
159                 PMDA_PMUNITS(0,0,0,0,0,0) }, },
160 };
161
162 static struct tevent_context *ev;
163 static struct ctdb_context *ctdb;
164 static struct ctdb_statistics *stats;
165
166 static void
167 pmda_ctdb_q_read_cb(uint8_t *data, size_t cnt, void *args)
168 {
169         if (cnt == 0) {
170                 fprintf(stderr, "ctdbd unreachable\n");
171                 /* cleanup on request timeout */
172                 return;
173         }
174
175         ctdb_client_read_cb(data, cnt, args);
176 }
177
178
179 static int
180 pmda_ctdb_daemon_connect(void)
181 {
182         const char *socket_name;
183         int ret;
184         struct sockaddr_un addr;
185
186         ev = tevent_context_init(NULL);
187         if (ev == NULL) {
188                 fprintf(stderr, "Failed to init event ctx\n");
189                 return -1;
190         }
191
192         ctdb = ctdb_init(ev);
193         if (ctdb == NULL) {
194                 fprintf(stderr, "Failed to init ctdb\n");
195                 goto err_ev;
196         }
197
198         socket_name = getenv("CTDB_SOCKET");
199         if (socket_name == NULL) {
200                 socket_name = CTDB_SOCKET;
201         }
202
203         ret = ctdb_set_socketname(ctdb, socket_name);
204         if (ret == -1) {
205                 fprintf(stderr, "ctdb_set_socketname failed - %s\n",
206                                 ctdb_errstr(ctdb));
207                 goto err_ctdb;
208         }
209
210         /*
211          * ctdb_socket_connect() sets a default queue callback handler that
212          * calls exit() if ctdbd is unavailable on recv, use our own wrapper to
213          * work around this
214          */
215
216         memset(&addr, 0, sizeof(addr));
217         addr.sun_family = AF_UNIX;
218         strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
219
220         ctdb->daemon.sd = socket(AF_UNIX, SOCK_STREAM, 0);
221         if (ctdb->daemon.sd == -1) {
222                 fprintf(stderr, "Failed to open client socket\n");
223                 goto err_ctdb;
224         }
225
226         set_nonblocking(ctdb->daemon.sd);
227         set_close_on_exec(ctdb->daemon.sd);
228
229         if (connect(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
230                 fprintf(stderr, "Failed to connect to ctdb daemon via %s\n",
231                         ctdb->daemon.name);
232                 goto err_sd;
233         }
234
235         ctdb->daemon.queue = ctdb_queue_setup(ctdb, ctdb, ctdb->daemon.sd,
236                                               CTDB_DS_ALIGNMENT,
237                                               pmda_ctdb_q_read_cb, ctdb,
238                                               "to-ctdbd");
239         if (ctdb->daemon.queue == NULL) {
240                 fprintf(stderr, "Failed to setup queue\n");
241                 goto err_sd;
242         }
243
244         ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0),
245                                      CTDB_CURRENT_NODE);
246         if (ctdb->pnn == (uint32_t)-1) {
247                 fprintf(stderr, "Failed to get ctdb pnn\n");
248                 goto err_sd;
249         }
250
251         return 0;
252 err_sd:
253         close(ctdb->daemon.sd);
254 err_ctdb:
255         talloc_free(ctdb);
256 err_ev:
257         talloc_free(ev);
258         ctdb = NULL;
259         return -1;
260 }
261
262 static void
263 pmda_ctdb_daemon_disconnect(void)
264 {
265         if (ctdb->methods) {
266                 ctdb->methods->shutdown(ctdb);
267         }
268
269         if (ctdb->daemon.sd != -1) {
270                 close(ctdb->daemon.sd);
271         }
272
273         talloc_free(ctdb);
274         talloc_free(ev);
275         ctdb = NULL;
276 }
277
278 static int
279 fill_base(unsigned int item, pmAtomValue *atom)
280 {
281         switch (item) {
282         case 0:
283                 atom->ul = stats->num_clients;
284                 break;
285         case 1:
286                 atom->ul = stats->frozen;
287                 break;
288         case 2:
289                 atom->ul = stats->recovering;
290                 break;
291         case 3:
292                 atom->ul = stats->client_packets_sent;
293                 break;
294         case 4:
295                 atom->ul = stats->client_packets_recv;
296                 break;
297         case 5:
298                 atom->ul = stats->node_packets_sent;
299                 break;
300         case 6:
301                 atom->ul = stats->node_packets_recv;
302                 break;
303         case 7:
304                 atom->ul = stats->keepalive_packets_sent;
305                 break;
306         case 8:
307                 atom->ul = stats->keepalive_packets_recv;
308                 break;
309         case 9:
310                 atom->ul = stats->total_calls;
311                 break;
312         case 10:
313                 atom->ul = stats->pending_calls;
314                 break;
315         case 11:
316                 atom->ul = stats->locks.num_calls;
317                 break;
318         case 12:
319                 atom->ul = stats->locks.num_pending;
320                 break;
321         case 13:
322                 atom->ul = stats->childwrite_calls;
323                 break;
324         case 14:
325                 atom->ul = stats->pending_childwrite_calls;
326                 break;
327         case 15:
328                 atom->ul = stats->memory_used;
329                 break;
330         case 16:
331                 atom->ul = stats->max_hop_count;
332                 break;
333         case 17:
334                 atom->d = stats->reclock.ctdbd.max;
335                 break;
336         case 18:
337                 atom->d = stats->reclock.recd.max;
338                 break;
339         case 19:
340                 atom->d = stats->call_latency.max;
341                 break;
342         case 20:
343                 atom->d = stats->locks.latency.max;
344                 break;
345         case 21:
346                 atom->d = stats->childwrite_latency.max;
347                 break;
348         case 22:
349                 atom->d = stats->num_recoveries;
350                 break;
351         default:
352                 return PM_ERR_PMID;
353         }
354
355         return 0;
356 }
357
358 static int
359 fill_node(unsigned int item, pmAtomValue *atom)
360 {
361         switch (item) {
362         case 0:
363                atom->ul = stats->node.req_call;
364                break;
365         case 1:
366                atom->ul = stats->node.reply_call;
367                break;
368         case 2:
369                atom->ul = stats->node.req_dmaster;
370                break;
371         case 3:
372                atom->ul = stats->node.reply_dmaster;
373                break;
374         case 4:
375                atom->ul = stats->node.reply_error;
376                break;
377         case 5:
378                atom->ul = stats->node.req_message;
379                break;
380         case 6:
381                atom->ul = stats->node.req_control;
382                break;
383         case 7:
384                 atom->ul = stats->node.reply_control;
385                 break;
386         default:
387                 return PM_ERR_PMID;
388         }
389
390         return 0;
391 }
392
393
394 static int
395 fill_client(unsigned int item, pmAtomValue *atom)
396 {
397         switch (item) {
398         case 0:
399                 atom->ul = stats->client.req_call;
400                 break;
401         case 1:
402                 atom->ul = stats->client.req_message;
403                 break;
404         case 2:
405                 atom->ul = stats->client.req_control;
406                 break;
407         default:
408                 return PM_ERR_PMID;
409         }
410
411         return 0;
412 }
413
414 static int
415 fill_timeout(unsigned int item, pmAtomValue *atom)
416 {
417         switch (item) {
418         case 0:
419                 atom->ul = stats->timeouts.call;
420                 break;
421         case 1:
422                 atom->ul = stats->timeouts.control;
423                 break;
424         case 2:
425                 atom->ul = stats->timeouts.traverse;
426                 break;
427         default:
428                 return PM_ERR_PMID;
429         }
430
431         return 0;
432 }
433
434 /*
435  * callback provided to pmdaFetch
436  */
437 static int
438 pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
439 {
440         int ret;
441         __pmID_int *id = (__pmID_int *)&(mdesc->m_desc.pmid);
442
443         if (inst != PM_IN_NULL) {
444                 return PM_ERR_INST;
445         }
446
447         if (stats == NULL) {
448                 fprintf(stderr, "stats not available\n");
449                 ret = PM_ERR_VALUE;
450                 goto err_out;
451         }
452
453
454         switch (id->cluster) {
455         case 0:
456                 ret = fill_base(id->item, atom);
457                 if (ret) {
458                         goto err_out;
459                 }
460                 break;
461         case 1:
462                 ret = fill_node(id->item, atom);
463                 if (ret) {
464                         goto err_out;
465                 }
466                 break;
467         case 2:
468                 ret = fill_client(id->item, atom);
469                 if (ret) {
470                         goto err_out;
471                 }
472                 break;
473         case 3:
474                 ret = fill_timeout(id->item, atom);
475                 if (ret) {
476                         goto err_out;
477                 }
478                 break;
479         default:
480                 return PM_ERR_PMID;
481         }
482
483         ret = 0;
484 err_out:
485         return ret;
486 }
487
488 /*
489  * This routine is called once for each pmFetch(3) operation, so is a
490  * good place to do once-per-fetch functions, such as value caching or
491  * instance domain evaluation.
492  */
493 static int
494 pmda_ctdb_fetch(int numpmid, pmID pmidlist[], pmResult **resp, pmdaExt *pmda)
495 {
496         int ret;
497         TDB_DATA data;
498         int32_t res;
499         struct timeval ctdb_timeout;
500
501         if (ctdb == NULL) {
502                 fprintf(stderr, "attempting reconnect to ctdbd\n");
503                 ret = pmda_ctdb_daemon_connect();
504                 if (ret < 0) {
505                         fprintf(stderr, "reconnect failed\n");
506                         return PM_ERR_VALUE;
507                 }
508         }
509
510         ctdb_timeout = timeval_current_ofs(1, 0);
511         ret = ctdb_control(ctdb, ctdb->pnn, 0,
512                            CTDB_CONTROL_STATISTICS, 0, tdb_null,
513                            ctdb, &data, &res, &ctdb_timeout, NULL);
514
515         if (ret != 0 || res != 0) {
516                 fprintf(stderr, "ctdb control for statistics failed, reconnecting\n");
517                 pmda_ctdb_daemon_disconnect();
518                 ret = PM_ERR_VALUE;
519                 goto err_out;
520         }
521
522         stats = (struct ctdb_statistics *)data.dptr;
523
524         if (data.dsize != sizeof(struct ctdb_statistics)) {
525                 fprintf(stderr, "incorrect statistics size %zu - not %zu\n",
526                         data.dsize, sizeof(struct ctdb_statistics));
527                 ret = PM_ERR_VALUE;
528                 goto err_stats;
529         }
530
531         ret = pmdaFetch(numpmid, pmidlist, resp, pmda);
532
533 err_stats:
534         talloc_free(stats);
535 err_out:
536         return ret;
537 }
538
539 void pmda_ctdb_init(pmdaInterface *dp);
540
541 /*
542  * Initialise the agent
543  */
544 void
545 pmda_ctdb_init(pmdaInterface *dp)
546 {
547         if (dp->status != 0) {
548                 return;
549         }
550
551         dp->version.two.fetch = pmda_ctdb_fetch;
552         pmdaSetFetchCallBack(dp, pmda_ctdb_fetch_cb);
553
554         pmdaInit(dp, NULL, 0, metrictab,
555                  (sizeof(metrictab) / sizeof(metrictab[0])));
556 }
557
558 static char *
559 helpfile(void)
560 {
561         static char buf[MAXPATHLEN];
562
563         if (!buf[0]) {
564                 snprintf(buf, sizeof(buf), "%s/ctdb/help",
565                          pmGetConfig("PCP_PMDAS_DIR"));
566         }
567         return buf;
568 }
569
570 static void
571 usage(void)
572 {
573         fprintf(stderr, "Usage: %s [options]\n\n", pmProgname);
574         fputs("Options:\n"
575           "  -d domain        use domain (numeric) for metrics domain of PMDA\n"
576           "  -l logfile       write log into logfile rather than using default log name\n"
577           "\nExactly one of the following options may appear:\n"
578           "  -i port          expect PMCD to connect on given inet port (number or name)\n"
579           "  -p               expect PMCD to supply stdin/stdout (pipe)\n"
580           "  -u socket        expect PMCD to connect on given unix domain socket\n",
581           stderr);
582         exit(1);
583 }
584
585 /*
586  * Set up the agent if running as a daemon.
587  */
588 int
589 main(int argc, char **argv)
590 {
591         int err = 0;
592         char log_file[] = "pmda_ctdb.log";
593         pmdaInterface dispatch;
594
595         __pmSetProgname(argv[0]);
596
597         pmdaDaemon(&dispatch, PMDA_INTERFACE_2, pmProgname, CTDB,
598                    log_file, helpfile());
599
600         if (pmdaGetOpt(argc, argv, "d:i:l:pu:?", &dispatch, &err) != EOF) {
601                 err++;
602         }
603
604         if (err) {
605                 usage();
606         }
607
608         pmdaOpenLog(&dispatch);
609         pmda_ctdb_init(&dispatch);
610         pmdaConnect(&dispatch);
611         pmdaMain(&dispatch);
612
613         exit(0);
614 }
615