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

# mmv\_set(3)

set a value in a Memory Mapped Value file

## NAME

**mmv\_set**, **mmv\_set\_value**, **mmv\_set\_atomvalue** - set a value in a Memory Mapped Value file

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**\
 **#include \<pcp/mmv\_stats.h\>**

**void mmv\_set(void \****addr***, pmAtomValue \****av***, void \****val***);**\
 **void mmv\_set\_value(void \****addr***,** **pmAtomValue \****av***,** **double** *val***);**\
 **void mmv\_set\_atomvalue(void \****addr***,** **pmAtomValue \****av***,** **pmAtomValue \****val***);**

**cc ... -lpcp\_mmv -lpcp**

## DESCRIPTION

**mmv\_set**, **mmv\_set\_value** and **mmv\_set\_atomvalue** provide convenient ways of directly setting a value for a metric *av* previously returned by the [**mmv\_lookup\_value\_desc**(3)](/mmv_lookup_value_desc/3.md) interface. *addr* is the address returned from [**mmv\_stats\_init**(3)](/mmv_stats_init/3.md).

These interfaces are typically used with instantaneous and discrete metrics. Refer to [**mmv\_inc\_value**(3)](/mmv_inc_value/3.md) for a mechanism suited to monotonic increasing counter metrics.

With **mmv\_set** and **mmv\_set\_atomvalue** the value provided via the *val* pointer must match the type of the metric and will be used as the new value of the metric.

In the case of **mmv\_set** and **mmv\_set\_value**, the pointer value *val* is internally cast to match the type of the metric and then used as the value for the metric.

## SEE ALSO

[**mmv\_inc\_value**(3)](/mmv_inc_value/3.md), [**mmv\_stats\_init**(3)](/mmv_stats_init/3.md), [**mmv\_lookup\_value\_desc**(3)](/mmv_lookup_value_desc/3.md) and [**mmv**(5)](/mmv/5.md).
