PMGETCONFIG(3)
π PMGETCONFIG(3) β bestie edition π
okay so real talk, this is a page from the Library Functions Manual of Performance Co-Pilot (PCP), and it's all about three little functions that go dig up your config values for you. no cap, they're iconic. let's get into it π«Ά
β¨ NAME β¨
pmGetConfig, pmGetOptionalConfig, pmGetAPIConfig β they hand you back values for Performance Co-Pilot configuration variables. that's the whole job bestie π
πΈ C SYNOPSIS πΈ
include the header like so:
#include <pcp/pmapi.h>
and here are your three girls, exact signatures, don't @ me:
char *pmGetConfig(const char *variable);
char *pmGetOptionalConfig(const char *variable);
char *pmGetAPIConfig(const char *feature);
and when you compile, you link it up like this:
cc ... -lpcp
π¦ DESCRIPTION π¦
okay so pmGetConfig and pmGetOptionalConfig both go hunting for variable. first stop: the environment. and if it's not there? they check the Performance Co-Pilot (PCP) configuration file. then they hand you back the string result, slay. π
and here's the little extra: if variable was not already in the environment, it gets added β with a call to setenv(3) β before the function returns. so it's like, once you ask, it's just there now. main character energy fr.
now, pmGetOptionalConfig is the chill one. it's totally fine with failure β whether that's variable not being set at all, or the config file straight-up being missing. she's unbothered. π
pmGetConfig though? she is NOT chill. a missing configuration file is treated as a critical PCP installation failure. that's serious. go read the RETURN VALUE section below for the full tea.
the default location of the PCP configuration file is /etc/pcp.conf π but you can change it by setting PCP_CONF in the environment to a new location β all the details live in pcp.conf(5).
then there's pmGetAPIConfig, which is the one who reports on features of the PCP library. she's your girl for querying support for multi-threading, security extensions, and other features. vibe check on the library itself, basically.
and pssst β the pmconfig(1) utility gives you command line access to both of these interfaces π and it also has a mechanism for listing all available variables and features that are valid arguments to these routines. so if you're ever like "wait what can I even pass in here??" β that's your answer, iykyk.
π RETURN VALUE π
let's get into the consequences, bestie:
- if
variableis not found in either the environment or the PCP configuration file, or if the configuration file is inaccessible βpmGetOptionalConfigreturnsNULL. she's fine, she's just empty handed. π - if
variableis found in neither the environment nor the PCP configuration file βpmGetConfigreturns an empty string. - but if the PCP configuration file is not found β a fatal error message is printed and the process will
exit(2). π
okay yes that sounds drastic. and it IS. but the page is very clear that it's the only course of action available, because the PCP configuration/installation is deemed fatally flawed. nothing else to do. periodt.
pmGetAPIConfigreturnsNULLon failure to look up the requestedfeature. it does not modify the environment, and it returns a pointer to a static read-only string.
and for all three of these routines β the value you get back is either a static pointer or a pointer into the environment. so changing it is a bad idea. do not touch. hands off. π
π PCP ENVIRONMENT π
environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. π
on each installation, the file /etc/pcp.conf contains the local values for these variables. the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
and values for these variables may be obtained programmatically using the pmGetConfig(3) function. cute, right? everything connects. π«Ά
π SEE ALSO π
go read these too, bestie, they're all part of the lore:
PCPIntro(1), pmconfig(1), pmGetVersion(3), exit(2), PMAPI(3), getenv(3), setenv(3), pcp.conf(5), pcp.env(5) and environ(7).
and that's the whole page!! mwah π
this lil masterpiece came to you courtesy of Performance Co-Pilot β that's the source, and PCP is the version, so jot that down β and it's the PMGETCONFIG(3) page, which we already knew because it's literally the title. slay, stan, and remember to link with -lpcp β¨π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2012,2015,2018 Red Hat
- Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms