Scroll to navigation

PMCLEANMAPDIR(3) Library Functions Manual PMCLEANMAPDIR(3)

NAME

__pmCleanMapDir - remove old files from a map directory

C SYNOPSIS

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

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

cc ... -lpcp

CAVEAT

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

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

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

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

SEE ALSO

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

PCP Performance Co-Pilot