/var/lib/pcp/testsuite/src/pmdacache.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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #include <pcp/pmapi.h>
#include <pcp/impl.h>
#include <pcp/pmda.h>
int
main(int argc, char **argv)
{
int errflag = 0;
int indom = 123;
int sts;
int c;
__pmSetProgname(argv[0]);
while ((c = getopt(argc, argv, "Cc:D:dh:LSs:")) != EOF) {
switch (c) {
case 'C':
sts = pmdaCacheOp(indom, PMDA_CACHE_CULL);
fprintf(stderr, "cull() -> %d", sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case 'c':
sts = pmdaCacheStore(indom, PMDA_CACHE_CULL, optarg, NULL);
fprintf(stderr, "cull(%s) -> %d", optarg, sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case 'D': /* debug flag */
sts = __pmParseDebug(optarg);
if (sts < 0) {
fprintf(stderr, "%s: unrecognized debug flag specification (%s)\n",
pmProgname, optarg);
errflag++;
}
else
pmDebug |= sts;
break;
case 'd':
#ifdef PMDA_CACHE_DUMP_ALL
sts = pmdaCacheOp(indom, PMDA_CACHE_DUMP_ALL);
#else
sts = pmdaCacheOp(indom, PMDA_CACHE_DUMP);
#endif
break;
case 'h':
sts = pmdaCacheStore(indom, PMDA_CACHE_HIDE, optarg, NULL);
fprintf(stderr, "hide(%s) -> %d", optarg, sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case 'L':
sts = pmdaCacheOp(indom, PMDA_CACHE_LOAD);
fprintf(stderr, "load() -> %d", sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case 'S':
sts = pmdaCacheOp(indom, PMDA_CACHE_SAVE);
fprintf(stderr, "save() -> %d", sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case 's':
sts = pmdaCacheStore(indom, PMDA_CACHE_ADD, optarg, NULL);
fprintf(stderr, "store(%s) -> %d", optarg, sts);
if (sts < 0) fprintf(stderr, " %s", pmErrStr(sts));
fputc('\n', stderr);
break;
case '?':
default:
errflag++;
break;
}
}
if (errflag) {
fprintf(stderr, "Usage: %s ...\n", pmProgname);
fprintf(stderr, "options:\n");
fprintf(stderr, "-C cull all\n");
fprintf(stderr, "-c inst cull one\n");
fprintf(stderr, "-D debug\n");
fprintf(stderr, "-d dump\n");
fprintf(stderr, "-h inst hide\n");
fprintf(stderr, "-L load\n");
fprintf(stderr, "-S store\n");
fprintf(stderr, "-s inst save\n");
exit(1);
}
return 0;
}
|