__pmcontextwalk(3) — Linux manual page

NAME | C SYNOPSIS | CAVEAT | DESCRIPTION | RETURN VALUES | SEE ALSO | COLOPHON

PMCONTEXTWALK(3)         Library Functions Manual        PMCONTEXTWALK(3)

NAME         top

       __pmContextWalk - traversal of all PMAPI contexts

C SYNOPSIS         top

       #include "pmapi.h"
       #include "libpcp.h"

       void (*__pmContextWalkCallback)(void *handle, __pmContext *ctxp);
       int __pmContextWalk(void *handle, __pmContextWalkCallback
       callback,

       cc ... -lpcp

CAVEAT         top

       This  documentation  is intended for internal Performance Co-Pilot
       (PCP) developer use.

       These interfaces are not part of the PCP APIs that are  guaranteed
       to  remain  fixed  across  releases, and they may not work, or may
       provide different semantics at some point in the future.

DESCRIPTION         top

       __pmContextWalk provides a thread-safe and lock-safe way  of  pro‐
       cessing each active PMAPI context in turn.

       For  each  valid  PMAPI  context,  callback  is called with handle
       passed in from the __pmContextWalk caller and ctxp pointing  to  a
       context  for  which the c_lock lock has been acquired.  The handle
       argument is a pointer to an arbitrary object that  may  be  shared
       between  the  __pmContextWalk caller and the callback routine, but
       is not otherwise accessed by __pmContextWalk, so could be NULL.

       The per-context c_lock is released by __pmContextWalk after  call‐
       back is called and should not be unlocked by callback.

       For the duration of the call to __pmContextWalk all context initi‐
       ation      (via      pmNewContext(3),      pmDupContext(3)      or
       pmReconnectContext(3)) and teardown (via  pmDestroyContext(3))  is
       blocked.

RETURN VALUES         top

       __pmContextWalk returns the number of contexts processed and hence
       the  number  of  times  callback was called, else a negative value
       suitable for reporting with pmErrStr(3).

SEE ALSO         top

       PMAPI(3),   pmDestroyContext(3),   pmDupContext(3),   pmErrStr(3),
       pmNewContext(3) and pmReconnectContext(3).

COLOPHON         top

       This  page is part of the PCP (Performance Co-Pilot) project.  In‐
       formation about the project can be found at  ⟨http://www.pcp.io/⟩.
       If  you  have  a  bug  report  for  this  manual  page, send it to
       pcp@groups.io.  This page was obtained from the project's upstream
       Git repository ⟨https://github.com/performancecopilot/pcp.git⟩  on
       2026-01-16.   (At  that  time,  the date of the most recent commit
       that was found in the repository was 2026-01-16.)  If you discover
       any rendering problems in this HTML version of the  page,  or  you
       believe  there is a better or more up-to-date source for the page,
       or you have corrections or improvements to the information in this
       COLOPHON (which is not part of the original manual page),  send  a
       mail to man-pages@man7.org

Performance Co-Pilot               PCP                   PMCONTEXTWALK(3)