PMDADAEMON(3)
π PMDADAEMON π
okay bestie, welcome to pmdaDaemon from section 3 of the library functions manual β it's giving "let's make your PMDA a real daemon" and honestly? iconic.
β¨ NAME β¨
pmdaDaemon β initialize the PMDA to run as a daemon π§
πΈ C SYNOPSIS πΈ
#include <pcp/pmapi.h>
#include <pcp/pmda.h>
void pmdaDaemon(pmdaInterface *dispatch, int interface,
const char *name, int domain, const char *logfile,
const char *helptext);
cc ... -lpcp_pmda -lpcp
π DESCRIPTION π
so pmdaDaemon sets up your pmdaInterface structure to use the interface extensions, assuming your PMDA(3) is gonna be running as a daemon. no cap, that's the whole vibe. π«Ά
Here's what the pmdaInterface structure gets initialized with:
nameβ the name of the agent. literally just its name, periodt.domainβ the default domain number of the agent, which uniquely identifies this PMDA from other running PMDAs. lowkey important. it may get changed later by the command line option-d(go peek at pmdaGetOpt(3)).logfileβ the default path to the log file. this may be replaced by the-lcommand line option if you're usingpmdaGetOpt. heads up bestie:logfilegets copied with strdup(3), so the storage associated withlogfilemay be released after the call topmdaDaemon. you don't gotta hold onto it. πhelptextβ the default path to the help text (see pmdaText(3)). this may be replaced by the-hcommand line option if you're using pmdaGetOpt(3). if no help text is installed, or you're not using pmdaText(3), then set this toNULL. otherwisehelptextgets copied with strdup(3), so the storage associated withhelptextmay be released after the call topmdaDaemon. same energy aslogfile, fr fr. β¨
The callbacks get initialized to pmdaProfile(3), pmdaFetch(3), pmdaDesc(3), pmdaText(3), pmdaInstance(3) and pmdaStore(3). yes, all six. main character callback energy. π
π¨ CAVEAT π¨
The PMDA must be using PMDA_INTERFACE_2 or later. no earlier versions, bestie, that's the rule. π
Once pmdaDaemon has been called, it is expected that the pmdaInterface structure pointed to by dispatch will remain accessible to the routines in libpcp_pmda. that means not reclaimed off the stack, not freed or otherwise released, etc. like... do not touch it. it lives there now. π
If the caller needs to move or relocate the pmdaInterface structure for any reason, then after the move pmdaInterfaceMoved(3) must be called to re-establish the internal integrity of the pmdaInterface structure at the new location β and it has to happen before any other routine in libpcp_pmda is called. so: move first, then pmdaInterfaceMoved(3), then literally anything else. got it? good. π
π₯ DIAGNOSTICS π₯
- Unable to allocate memory for pmdaExt structure β In addition, the
dispatch->statusfield is set to a value less than zero. not great, not terrible, but mostly not great. π - PMDA interface version interface not supported β The interface version is not supported by
pmdaDaemon. that version said "not today" and honestly we respect it. π
π SEE ALSO π
PMAPI(3), PMDA(3), pmdaDSO(3), pmdaGetOpt(3), pmdaInterfaceMoved(3) and pmdaText(3). go read them, they're all slay. π¦
and that's the whole page bestie!! this one came from Performance Co-Pilot (PCP), section 3 of the library functions manual β pmdaDaemon(3), mwah. π stay daemon-y, keep your pmdaInterface on the stack, and never free what you didn't malloc. bye pookie!! πβ¨π
π¦ 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-pmda3-dev 7.1.1-1
- ubuntu stonking: libpcp-pmda3-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