This file is indexed.

/var/lib/pcp/testsuite/src/descreqX2.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
/*
 * Copyright (c) 1997-2001 Silicon Graphics, Inc.  All Rights Reserved.
 */

/*
 * 2 DESC_REQs back-to-back ... trying to understand www.sgi.com PMDA deaths
 */

#include <stdio.h>
#include <pcp/pmapi.h>
#include <pcp/impl.h>

int
main(int argc, char **argv)
{
    int		c;
    int		fd;
    int		ctx;
    int		errflag = 0;
    int		e;
    int		sts;
    __pmContext	*ctxp;
    __pmPDU	*pb;
    pmID	pmid;
    char	*name = "sample.seconds";

    __pmSetProgname(argv[0]);

    if (argc > 1) {
	while ((c = getopt(argc, argv, "D:")) != EOF) {
	    switch (c) {
	    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 '?':
	    default:
		errflag++;
		break;
	    }
	}

	if (errflag || optind > argc) {
	    fprintf(stderr, "Usage: %s [-D]\n", pmProgname);
	    exit(1);
	}
    }

    if ((ctx = pmNewContext(PM_CONTEXT_HOST, "localhost")) < 0) {
	fprintf(stderr, "pmNewContext: %s\n", pmErrStr(ctx));
	exit(1);
    }

    if ((ctxp = __pmHandleToPtr(ctx)) == NULL) {
	fprintf(stderr, "__pmHandleToPtr failed: eh?\n");
	exit(1);
    }

    fd = ctxp->c_pmcd->pc_fd;

    if ((e = pmLoadNameSpace(PM_NS_DEFAULT)) < 0) {
	fprintf(stderr, "pmLoadNameSpace: %s\n", pmErrStr(e));
	exit(1);
    }

    if ((e = pmLookupName(1, &name, &pmid)) < 0) {
	printf("pmLookupName: Unexpected error: %s\n", pmErrStr(e));
	exit(1);
    }

    if ((e = __pmSendDescReq(fd, FROM_ANON, pmid)) < 0) {
	fprintf(stderr, "Error: SendDescReqX1: %s\n", pmErrStr(e));
	exit(1);
    }

    if ((e = __pmSendDescReq(fd, FROM_ANON, pmid)) < 0) {
	fprintf(stderr, "Error: SendDescReqX2: %s\n", pmErrStr(e));
	exit(1);
    }

    if ((e = __pmGetPDU(fd, ANY_SIZE, TIMEOUT_DEFAULT, &pb)) < 0)
	fprintf(stderr, "Error: __pmGetPDUX1: %s\n", pmErrStr(e));
    else
	fprintf(stderr, "__pmGetPDUX1 -> 0x%x\n", e);

    if ((e = __pmGetPDU(fd, ANY_SIZE, TIMEOUT_DEFAULT, &pb)) < 0)
	fprintf(stderr, "Error: __pmGetPDUX2: %s\n", pmErrStr(e));
    else
	fprintf(stderr, "__pmGetPDUX2 -> 0x%x\n", e);

    exit(0);
}