__PMSERVERNOTIFYSERVICEMANAGERSTOPPING(3)
π __pmServerNotifyServiceManagerReady β the girlies of PCP internals π
okay bestie, buckle up, we're in the Library Functions Manual (section 3, the C function zone β¨) and this one is a double feature: __pmServerNotifyServiceManagerReady and __pmServerNotifyServiceManagerStopping β together they notify your service manager when stuff starts and when stuff stops. that's it, that's the whole vibe. π
πΈ NAME πΈ
__pmServerNotifyServiceManagerReady, __pmServerNotifyServiceManagerStopping β notify service start and stop π«Ά
β¨ C SYNOPSIS β¨
#include "pmapi.h"
#include "libpcp.h"
int __pmServerNotifyServiceManagerReady(pid_t mainpid);
int __pmServerNotifyServiceManagerStopping(pid_t mainpid);
cc ... -lpcp
like, the includes are right there, the two function signatures are right there, and yeah you gotta link -lpcp. periodt. π
π¨ CAVEAT π¨
bestie. read this part. i'm serious. π
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 go building your whole personality on them, okay? π
π¦ DESCRIPTION π¦
So within the libraries and applications of the Performance Co-Pilot (PCP), these routines are giving "convenient and portable interface to service manager APIs", like sd_notify(3). that's the whole point of them β one cute little wrapper, many platforms. π
PCP service daemons should call __pmServerNotifyServiceManagerReady immediately prior to entering their main loop, and listen β this is true regardless of whether or not they have forked or daemonised. forked, not forked, daemonised, whatever, doesn't matter, you still call it. π
What does it do tho? it notifies the service manager (if any β depends on the platform, okurrr) that the daemon service has started, and that the main process to be tracked is mainpid. π
Similarly, when shutting down, service daemons should call __pmServerNotifyServiceManagerStopping to notify the service manager (if any) that the tracked process of the service has returned from it's main loop and is about to shut down. it's giving "heads up bestie, i'm leaving the party πͺ". π«Ά
These routines are intended to be portable, and thus no conditional code should be needed for any service daemon on any platform. no #ifdef girlie, we don't do that here. β¨
π DIAGNOSTICS π
These functions will print diagnostics to the stderr stream if pmDebugOptions.services is set.
that's it. that's the diagnostic. turn on the debug option, get the tea. π
π RETURN CODE π
If successful, __pmServerNotifyServiceManagerReady returns a positive integer that depends on the platform service manager. lowkey mysterious, highkey platform-dependent, we love that for it.
In the case of systemd(1), the return code is from sd_notify(3). π
If the platform supports systemd(1) but the NOTIFY_SOCKET environment variable is not set (as may be the case if the server program is started manually rather than by systemd(1)), the return code will be PM_ERR_GENERIC β which will normally be ignored, but a diagnostic will be printed if pmDebugOptions.services is set. so like, it's fine, but also we see you. π
On platforms that have no service manager, the return code will be PM_ERR_NYI.
For backward compatibility on these platforms, the return code should be ignored. fr fr. don't check it. it's not gonna be cute. π
π§ a lil sign-off π§
and that's the whole page babes β brought to you by Performance Co-Pilot (that's the source, that's the version, PCP energy through and through π). go forth, notify your service manager, and slay. ππβ¨
π¦ 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) 2020 Red Hat. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms