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

# pmdaEventClient(3)

client context tracking interfaces for event queues

## NAME

**pmdaEventNewClient**, **pmdaEventEndClient**, **pmdaEventClients** - client context tracking interfaces for event queues

## C SYNOPSIS

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

**int pmdaEventNewClient(int** *context***);**\
 **int pmdaEventEndClient(int** *context***);**\
 **int pmdaEventClients(pmAtomValue \****avp***);**

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

## DESCRIPTION

A Performance Metrics Domain Agent (PMDA) that exports event records needs to track which clients are connected to it, in order that it can track which events have been sent to which clients so far. Only once an event has been sent to all monitoring tools that registered an interest can the event be discarded and any memory reclaimed.

The [**PMDA**(3)](/PMDA/3.md) library provides callback routines for PMDA developers to provide custom handling of client connections and disconnections. If the PMDA is making use of the event queuing mechanism provided by [**pmdaEventNewQueue**(3)](/pmdaEventNewQueue/3.md) and friends, client connections and disconnections must be tracked via calls to **pmdaEventNewClient** and **pmdaEventEndClient** respectively. This allows the library to keep track of when events can be discarded from a queue, for example, for the *context* specified. This parameter is passed into the e\_endCallBack function directly, and for other callback functions is available via the e\_context field of the pmdaExt structure. Additionally, it can be queried at any time using [**pmdaGetContext**(3)](/pmdaGetContext/3.md).

Sometimes it is useful for the PMDA to export a metric indicating the current count of attached clients - this is available using the **pmdaEventClients** routine, which will fill in the *avp* pmAtomValue structure on behalf of a PMDA fetch callback routine.

## SEE ALSO

[**pmdaEventNewArray**(3)](/pmdaEventNewArray/3.md), [**pmdaEventNewQueue**(3)](/pmdaEventNewQueue/3.md), [**PMAPI**(3)](/PMAPI/3.md), [**PMDA**(3)](/PMDA/3.md) and [**pmEventFlagsStr**(3)](/pmEventFlagsStr/3.md).
