/var/lib/pcp/testsuite/src/debug.c is in pcp-testsuite 4.0.1-1.
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 | /*
* Exercise pmSetDebug() and pmClearDebug(), and the deprecated
* __pmParseDebug() interface.
*
* Copyright (c) 2017 Ken McDonell. All Rights Reserved.
*/
#include <pcp/pmapi.h>
#include <pcp/deprecated.h>
#include "libpcp.h"
int
main(int argc, char **argv)
{
int c;
int sts;
int errflag = 0;
/* trim cmd name of leading directory components */
pmSetProgname(argv[0]);
while ((c = getopt(argc, argv, "D:?")) != EOF) {
switch (c) {
case 'D': /* debug options */
sts = pmSetDebug(optarg);
if (sts < 0) {
fprintf(stderr, "%s: unrecognized debug options specification (%s)\n",
pmGetProgname(), optarg);
errflag++;
}
break;
case '?':
default:
errflag++;
break;
}
}
if (errflag) {
fprintf(stderr,
"Usage: %s [options]\n\
\n\
Options:\n\
-D debug[,...] set PCP debug options\n",
pmGetProgname());
exit(1);
}
if ((sts = pmNewContext(PM_CONTEXT_HOST, "localhost")) < 0) {
fprintf(stderr, "%s: Cannot connect to PMCD on localhost: %s\n",
pmGetProgname(), pmErrStr(sts));
exit(1);
}
while (optind < argc) {
printf("arg: %s\n", argv[optind]);
printf("pmSetDebug(\"%s\") ...\n", argv[optind]);
if ((sts = pmSetDebug(argv[optind])) != 0) {
printf("pmSetDebug -> %s\n", pmErrStr(sts));
}
__pmDumpDebug(stdout);
printf("pmClearDebug(\"%s\") ...\n", argv[optind]);
if ((sts = pmClearDebug(argv[optind])) != 0) {
printf("pmClearDebug -> %s\n", pmErrStr(sts));
}
__pmDumpDebug(stdout);
printf("__pmParseDebug(\"%s\") ...\n", argv[optind]);
sts = __pmParseDebug(argv[optind]);
printf("__pmParseDebug -> %d\n", sts);
if (sts > 0)
__pmSetDebugBits(sts);
__pmDumpDebug(stdout);
printf("pmClearDebug(\"%s\") ...\n", argv[optind]);
if ((sts = pmClearDebug(argv[optind])) != 0) {
printf("pmClearDebug -> %s\n", pmErrStr(sts));
}
__pmDumpDebug(stdout);
optind++;
}
return 0;
}
|