PMAREWRITEMETA(3)
β¨ pmaRewriteMeta β¨ (that's section 3 of the Library Functions Manual, bestie π )
okay so likeβ¦ this is a <pcp/libpcp.h> internal-zone situation and I'm obsessed π«Ά it lives in the Library Functions Manual, section 3, and it's giving very specific, very developer-only energy. let's get into it π
πΈ NAME πΈ
pmaRewriteMeta β try to change the version of an archive metadata record π¦
π C SYNOPSIS π
#include <pcp/pmapi.h>
#include <pcp/libpcp.h>
#include <pcp/archive.h>
int pmaRewriteMeta(__pmLogCtl *inlcp, __pmLogCtl *outlcp,
__int32_t *rbuf);
cc ... -lpcp_archive -lpcp
so you include all three of those headers, no skipsies, and you link against -lpcp_archive and -lpcp. both. periodt β¨
π¨ CAVEAT π¨
bestie this is internal. like, for real.
This documentation is intended for internal Performance Co-Pilot (PCP) developer use. π
These interfaces are not part of the PCP APIs that are guaranteed to remain fixed across releases, and they may not work, or may provide different semantics at some point in the future. π so don't build your whole personality on them, iykyk.
π DESCRIPTION π
okay so here's the vibe π
A physical metadata record from the input archive identified by inlcp gets passed in via rbuf, and this function reformats it if required to produce the equivalent metadata record for the output archive identified by outlcp. slay π¦
Combined with the input and output archive versions, the type of the metadata record (as extracted from rbuf) is used to decide if β because for some record types and version changes, no rewriting is required. so sometimes it justβ¦ doesn't do anything. iconic behavior honestly β¨
pmaRewriteMeta is intended to be used in cases where the archive version of inlcp and outlcp are different. The only sane choice of archive versions today is PM_LOG_VERS02 for inlcp and PM_LOG_VERS03 for outlcp, which would be requesting a rewrite from archive version 2 format to archive version 3 format (as only versions 2 and 3 are currently supported). so like, 2 β‘οΈ 3, that's the move, that's the only move π
β οΈ the important bit, do not skip this one β οΈ If rewriting takes place, the oldrbufwill have beenfree'd and a newrbufallocated withmalloc(3). It is the caller's responsibility to make sure this potential free-and-allocate will be safe β e.g. no dangling references into the contents ofrbuf, or pass in a copy of the record if it is precious. π do not let your pointers dangle, bestie, that's not the vibe.
π₯ DIAGNOSTICS AND RETURN VALUES π₯
In several places, fatal errors will trigger an error message and force the application to exit. π³ like, it's not asking. the app is leaving.
If there is no defined translation for the versions of inlcp and outlcp then pmaRewriteMeta returns PM_ERR_APPVERSION (a slight perversion of this error code). π iconic honestly
If no rewrite is performed, the return value is 0. Otherwise, a return value of 1 indicates a rewrite has taken place and rbuf has been reallocated. so:
0β no rewrite, nothing happened, we're chilling πΈ1β rewrite happened,rbufgot reallocated, check your pointers bestie π«ΆPM_ERR_APPVERSIONβ no defined translation for those versions, rip π
π SEE ALSO π
and that's the whole page, bestie π this one came straight out of Performance Co-Pilot (that's PCP π) and it's dated PCP, filed under PMAREWRITEMETA(3) in the Library Functions Manual. go forth and rewrite those metadata records responsibly, mwah π
β¨
π¦ 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: libpcp-archive1-dev 7.1.1-1
- ubuntu stonking: libpcp-archive1-dev 7.2.1-2build1
- Copyright (c) 2022 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms