PMGETCHILDREN(3)
π PMGETCHILDREN(3) β like, the manual page, but make it make sense π
okay bestie, sit down, we're learning pmGetChildren from the Library Functions Manual and honestly? it's giving family tree energy π³β¨
β¨ NAME β¨
pmGetChildren β return the descendent nodes of a PMNS node π§¬
πΈ C SYNOPSIS πΈ
#include <pcp/pmapi.h>
int pmGetChildren(const char *name, char ***offspring);
cc ... -lpcp
π¦ DESCRIPTION π¦
so. you hand it a fully qualified pathname to a node in the current Performance Metrics Name Space (aka the PMNS, iykyk), and that pathname is the name argument. then pmGetChildren hands you back β via offspring β a list of the relative names of all the immediate descendent nodes of name in the current PMNS. immediate, bestie. not the grandkids, not the whole bloodline. just the direct children π
and there's a lil special case for you: if name is an empty string (like, literally ""), then you get the immediate descendants of the root node of the PMNS. main character root node energy π
normally, pmGetChildren returns the number of descendent names discovered. otherwise it returns a value less than zero to signal an error. and if it returns zero? that means name is a valid metric name β as in, it's associated with a leaf node in the PMNS. so it's valid, it just has no children. it's an only child. a leaf. a solo act π
now here's the part where you pay attention π the resulting list of pointers offspring, and the values (those relative names) that the pointers point at, were both allocated by pmGetChildren using a single call to malloc(3). so it's your job, yes yours, to free(offspring) and release that space once you don't need it anymore. don't ghost your memory, bestie, that's not cute π
β οΈ and when an error happens, ornameis a leaf node (i.e. the result ofpmGetChildrenis less than one), thenoffspringis undefined. like, no space will have been allocated at all. so callingfree(3)on it is, and I quote, "a singularly bad idea" π not me warning you twice. just don't. fr fr.
π DIAGNOSTICS π
PM_ERR_NOPMNSβ could not access a PMNS for the operation. also, heads up: if the application hasn't a priori calledpmLoadNameSpace(3)and wants to use the distributed PMNS, then the call topmGetChildrenhas to be made inside a current context. context is everything, periodt β¨PM_ERR_NAMEβ the pathnamenameis not valid in the current PMNS. it's giving "who is she" πPM_ERR_*β the rest of the diagnostics are for protocol failures when accessing the distributed PMNS. networking drama, not your fault, lowkey π₯
π PCP ENVIRONMENT π
environment variables with the prefix PCP_ are what parameterize the file and directory names that PCP uses. 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 you can get values for these variables programmatically using the pmGetConfig(3) function π«Ά
β SEE ALSO β
PMAPI(3), pmGetChildrenStatus(3), pmGetConfig(3), pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pmLookupName(3), pmNameID(3), pcp.conf(5), pcp.env(5) and PMNS(5).
and that's the whole page, bestie π this was brought to you by Performance Co-Pilot, PCP, and the page PMGETCHILDREN(3) β go forth, walk the tree, and free your pointers π§β¨
π¦ 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) 2000-2004 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