1PMSERVERNOTIFYSERVICEMANAGERLRiEbArDaYr(y3)FunctionPsMSMEaRnVuEaRlNOTIFYSERVICEMANAGERREADY(3)
2
3
4
6 __pmServerNotifyServiceManagerReady, __pmServerNotifyServiceManager‐
7 Stopping - notify service start and stop
8
10 #include "pmapi.h"
11 #include "libpcp.h"
12
13 int __pmServerNotifyServiceManagerReady(pid_t mainpid);
14 int __pmServerNotifyServiceManagerStopping(pid_t mainpid);
15
16 cc ... -lpcp
17
19 This documentation is intended for internal Performance Co-Pilot (PCP)
20 developer use.
21
22 These interfaces are not part of the PCP APIs that are guaranteed to
23 remain fixed across releases, and they may not work, or may provide
24 different semantics at some point in the future.
25
27 Within the libraries and applications of the Performance Co-Pilot (PCP)
28 these routines provide a convenient and portable interface to service
29 manager APIs, such as sd_notify(3).
30
31 PCP service daemons should call __pmServerNotifyServiceManagerReady
32 immediately prior to entering their main loop, regardless of whether or
33 not they have forked or daemonised. This will notify the service man‐
34 ager (if any, depending on the platform) that the daemon service has
35 started, and that the main process to be tracked is mainpid.
36
37 Similarly when shutting down, service daemons should call __pmServer‐
38 NotifyServiceManagerStopping to notify the service manager (if any)
39 that the tracked process of the service has returned from it's main
40 loop and is about to shut down.
41
42 These routines are intended to be portable and thus no conditional code
43 should be needed for any service daemon on any platform.
44
46 These functions will print diagnostics to the stderr stream if pmDebu‐
47 gOptions.services is set.
48
50 If successful, __pmServerNotifyServiceManagerReady returns a positive
51 integer that depends on the platform service manager. In the case of
52 systemd(1), the return code is from sd_notify(3). If the platform sup‐
53 ports systemd(1) but the NOTIFY_SOCKET environment variable is not set
54 (as may be the case if the server program is started manually rather
55 than by systemd(1)), the return code will be PM_ERR_GENERIC which will
56 normally be ignored but a diagnostic will be printed if pmDebugOp‐
57 tions.services is set. On platforms that have no service manager, the
58 return code will be PM_ERR_NYI. For backward compatibility on these
59 platforms, the return code should be ignored.
60
61
62
63Performance Co-Pilot PCP PMSERVERNOTIFYSERVICEMANAGERREADY(3)