__pmcleanmapdir(3) — Linux manual page


PMCLEANMAPDIR(3)        Library Functions Manual        PMCLEANMAPDIR(3)

NAME         top

       __pmCleanMapDir - remove old files from a map directory

C SYNOPSIS         top

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

       int __pmCleanMapDir(const char *dirname, const char * special);

       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

       pmlogger(1) and pmie(1) maintain directories of map files that
       provide a mapping from a pmlogger(1) or pmie(1) process id (PID)
       to important parameters of those processes.

       __pmCleanMapDir removes ``dead'' files in these directories,
       specifically the directory entries in dirname should follow these
       rules, else __pmCleanMapDir will remove them:

       + the name should be numeric, else it should be equal special (if
         special is not NULL)

       + for a numeric directory entry it should be a regular file and
         the name should be the PID of a running process

       + for a match on special the directory entry should be a symbolic
         link and the last component of the link should be the ASCII
         encoding of the PID of a running process

       Before any of these checks are done, __pmCleanMapDir checks that
       dirname is indeed a directory, and the user id and group id of
       the caller match the user id and group id of dirname.

RETURN VALUES         top

       If a serious error occurs, __pmCleanMapDir returns a negative
       value suitable for reporting with pmErrStr(3).  Otherwise the
       return value is the number of entries that have been removed.

DIAGNOSTICS         top

       Verbose diagnostics describing the actions of __pmCleanMapDir
       will be reported on standard error of the debug option misc is
       set, e.g. via -D misc from the command line.

SEE ALSO         top

       pmdbg(1), PMAPI(3) and pmErrStr(3).

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.
       Information 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 2024-06-14.
       (At that time, the date of the most recent commit that was found
       in the repository was 2024-06-14.)  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

Performance Co-Pilot               PCP                  PMCLEANMAPDIR(3)