---
name: "pmgetusername"
section: "3"
platform: "linux"
package: "libpcp3-dev"
version: "4.3.2+really4.3.1-0.1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/pmGetUsername"
---

# pmgetusername(3)

fetch special PCP username

Part of [pmGetUsername(3)](/pmGetUsername/3.md).

## NAME

**pmGetUsername** - fetch special PCP username

## C SYNOPSIS

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

**int pmGetUsername(char \*\****username***)**

**cc ... -lpcp**

## DESCRIPTION

Within the Performance Co-Pilot (PCP) some applications use a special (non-root) username to allow access, e.g. to write log files into protected directories.

**pmGetUsername** returns the name via *username*.

The variable name **PCP\_USER** is fetched using [**pmGetOptionalConfig**(3)](/pmGetOptionalConfig/3.md). If this succeeds, **pmGetUsername** returns 1. Otherwise. *username* is set to the default value of **pcp** and **pmGetUsername** returns 0.

**pmGetUsername** is most often used in conjunction with [**pmSetProcessIdentity**(3)](/pmSetProcessIdentity/3.md) at process start up.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**pmGetOptionalConfig**(3)](/pmGetOptionalConfig/3.md) and [**pmSetProcessIdentity**(3)](/pmSetProcessIdentity/3.md).
