static int request_fetch(int ctxid, __pmContext *ctxp, int numpmid, pmID pmidlist[]) { int n; if (ctxp->c_sent == 0) { /* * current profile is _not_ already cached at other end of * IPC, so send get current profile */ #ifdef PCP_DEBUG if (pmDebug & DBG_TRACE_PROFILE) { fprintf(stderr, "pmFetch: calling __pmSendProfile, context: %d\n", ctxid); __pmDumpProfile(stderr, PM_INDOM_NULL, ctxp->c_instprof); } #endif if ((n = __pmSendProfile(ctxp->c_pmcd->pc_fd, __pmPtrToHandle(ctxp), ctxid, ctxp->c_instprof)) < 0) return (__pmMapErrno(n)); else ctxp->c_sent = 1; } n = __pmSendFetch(ctxp->c_pmcd->pc_fd, __pmPtrToHandle(ctxp), ctxid, &ctxp->c_origin, numpmid, pmidlist); if (n < 0) { n = __pmMapErrno(n); } return n; }
void dostatus(void) { int i = 0; int n; putchar('\n'); printf("Namespace: "); if (cmd_namespace != NULL) printf("%s\n", cmd_namespace); else { if (pmnsfile == NULL) printf("(default)\n"); else printf("%s\n", pmnsfile); } if (myPmdaName == NULL || connmode == NO_CONN) printf("PMDA: none\n"); else { printf("PMDA: %s\n", myPmdaName); printf("Connection: "); switch (connmode) { case CONN_DSO: printf("dso\n"); printf("DSO Interface Version: %d\n", dispatch.comm.pmda_interface); printf("PMDA PMAPI Version: %d\n", dispatch.comm.pmapi_version); break; case CONN_DAEMON: printf("daemon\n"); printf("PMDA PMAPI Version: "); i = __pmVersionIPC(infd); if (i == UNKNOWN_VERSION) printf("unknown!\n"); else printf("%d\n", i); break; default: printf("unknown!\n"); break; } } printf("Debug options: "); n = 0; for (i = 0; i < num_debug; i++) { if (*(debug_map[i].options)) n++; } if (n == num_debug) printf("(all)"); else if (n == 0) printf("(none)"); else { n = 0; for (i = 0; i < num_debug; i++) { if (*(debug_map[i].options)) { if (n == 0) n = 1; else putchar(' '); printf("%s", debug_map[i].name); } } } putchar('\n'); printf("Timer: "); if (timer == 0) printf("off\n"); else printf("on\n"); printf("Getdesc: "); if (get_desc == 0) printf("off\n"); else printf("on\n"); putchar('\n'); __pmDumpProfile(stdout, PM_INDOM_NULL, profile); putchar('\n'); }