---
name: "pmdaDaemon"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pmdaDaemon"
---

# pmdaDaemon(3)

initialize the PMDA to run as a daemon

## NAME

**pmdaDaemon** - initialize the PMDA to run as a daemon

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**\
 **#include \<pcp/pmda.h\>**

**void pmdaDaemon(pmdaInterface \****dispatch***,** **int** *interface***,** **const char \****name***,** **int** *domain***,** **const char \****logfile***,** **const char \****helptext***);**

**cc ... -lpcp\_pmda -lpcp**

## DESCRIPTION

**pmdaDaemon** initializes the **pmdaInterface** structure to use the *interface* extensions assuming the [**PMDA**(3)](/PMDA/3.md) is to be run as a daemon.  The **pmdaInterface** structure is initialized with:

- *name*

  The name of the agent.

- *domain*

  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)](/pmdaGetOpt/3.md)).

- *logfile*

  The default path to the log file.  This may be replaced by the **-l** command line option if using **pmdaGetOpt**. *logfile* will be copied with [**strdup**(3)](/strdup/3.md), so the storage associated with *logfile* may be released after the call to **pmdaDaemon**.

- *helptext*

  The default path to the help text (see [**pmdaText**(3)](/pmdaText/3.md). This may be replaced by the **-h** command line option if using [**pmdaGetOpt**(3)](/pmdaGetOpt/3.md). If no help text is installed, or you are not using [**pmdaText**(3)](/pmdaText/3.md), then this should be set to NULL, otherwise *helptext* will be copied with [**strdup**(3)](/strdup/3.md), so the storage associated with *helptext* may be released after the call to **pmdaDaemon**.

The callbacks are initialized to [**pmdaProfile**(3)](/pmdaProfile/3.md), [**pmdaFetch**(3)](/pmdaFetch/3.md), [**pmdaDesc**(3)](/pmdaDesc/3.md), [**pmdaText**(3)](/pmdaText/3.md), [**pmdaInstance**(3)](/pmdaInstance/3.md) and [**pmdaStore**(3)](/pmdaStore/3.md).

## CAVEAT

The 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 otherwise released, etc.). If the caller needs to move or relocate the **pmdaInterface** structure for any reason, then after the move [**pmdaInterfaceMoved**(3)](/pmdaInterfaceMoved/3.md) must be called to re-establish the internal integrity of the *pmdaInterface* structure at the new location before any other routine in *libpcp\_pmda* is called.

## DIAGNOSTICS

- **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**.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**PMDA**(3)](/PMDA/3.md), [**pmdaDSO**(3)](/pmdaDSO/3.md), [**pmdaGetOpt**(3)](/pmdaGetOpt/3.md), [**pmdaInterfaceMoved**(3)](/pmdaInterfaceMoved/3.md) and [**pmdaText**(3)](/pmdaText/3.md).
