/var/lib/pcp/testsuite/src/parsemetricspec.c is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <stdio.h>
#include <pcp/pmapi.h>
int
main(int argc, char **argv)
{
int isarch;
char *msg;
pmMetricSpec *rslt;
int sts;
int i;
if (argc != 4) {
fprintf(stderr, "Usage: parsemetricspec spec isarch host\n");
exit(1);
}
if (strcmp(argv[1], "NULL") == 0) argv[1] = NULL;
isarch = atol(argv[2]);
if (strcmp(argv[3], "NULL") == 0) argv[3] = NULL;
printf("pmParseMetricSpec(\"%s\", %d, \"%s\", ...)\n",
argv[1], isarch, argv[3]);
sts = pmParseMetricSpec(argv[1], isarch, argv[3], &rslt, &msg);
if (sts < 0) {
if (sts == PM_ERR_GENERIC)
printf("pmParseMetricSpec Error:\n%s\n", msg);
else
printf("error: %s\n", pmErrStr(sts));
}
else {
printf("isarch: %d\n", rslt->isarch);
printf("source: \"%s\"\n", rslt->source);
printf("metric: \"%s\"\n", rslt->metric);
for (i = 0; i < rslt->ninst; i++) {
printf("inst[%d]: \"%s\"\n", i, rslt->inst[i]);
}
}
exit(0);
}
|