C SYNOPSIS#include <pcp/pmapi.h>
void pmdaDaemon(pmdaInterface *dispatch, int interface, char *name, int domain, char *logfile, char *helptext);
cc ... -lpcp_pmda -lpcp
DESCRIPTIONpmdaDaemon initializes the pmdaInterface structure to use the interface extensions assuming the PMDA(3) is to be run as a daemon. The pmdaInterface structure is initialized with:
- The name of the agent.
- The default domain number of the agent which uniquely identifies this PMDA from other running PMDAs. This may be subsequently changed by a command line option -d (see pmdaGetOpt(3)).
- The default path to the log file. This may be replaced by the -l command line option if using pmdaGetOpt.
- The default path to the help text (see pmdaText(3). This may be replaced by the -h command line option if using pmdaGetOpt(3). If no help text is installed, or you are not using pmdaText(3), then this should be set to NULL.
- Unable to allocate memory for pmdaExt structure
- In addition, the dispatch->status field is set to a value less than zero.
- PMDA interface version interface not supported
- The interface version is not supported by pmdaDaemon.
CAVEATThe PMDA must be using PMDA_INTERFACE_2 or later.
Once pmdaDaemon has been called, it is expected that the pmdaInterface structure pointed to by dispatch will remain accessible to the routines in libpcp_pmda (not reclaimed off the stack, not freed or oherwise released, etc.). If the caller needs to move or relocate the pmdaInterface structure for any reason, then after the move pmdaInterfaceMoved(3) must be called to resestablish the internal integrity of the pmdaInterface structure at the new location before any other routine in libpcp_pmda is called.