__pmServerNotifyServiceManagerReady(3) — Linux manual page

NAME | C SYNOPSIS | CAVEAT | DESCRIPTION | DIAGNOSTICS | RETURN CODE | COLOPHON

PMSERVERNOTIFYSERVICEMANAGERREADY(3)tionsVManualFYSERVICEMANAGERREADY(3)

NAME         top

       __pmServerNotifyServiceManagerReady,
       __pmServerNotifyServiceManagerStopping - notify service start and
       stop

C SYNOPSIS         top

       #include "pmapi.h"
       #include "libpcp.h"

       int __pmServerNotifyServiceManagerReady(pid_t mainpid);
       int __pmServerNotifyServiceManagerStopping(pid_t mainpid);

       cc ... -lpcp

CAVEAT         top

       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.

DESCRIPTION         top

       Within the libraries and applications of the Performance Co-Pilot
       (PCP) these routines provide a convenient and portable interface
       to service manager APIs, such as sd_notify(3).

       PCP service daemons should call
       __pmServerNotifyServiceManagerReady immediately prior to entering
       their main loop, regardless of whether or not they have forked or
       daemonised.  This will notify the service manager (if any,
       depending on the platform) 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.

       These routines are intended to be portable and thus no
       conditional code should be needed for any service daemon on any
       platform.

DIAGNOSTICS         top

       These functions will print diagnostics to the stderr stream if
       pmDebugOptions.services is set.

RETURN CODE         top

       If successful, __pmServerNotifyServiceManagerReady returns a
       positive integer that depends on the platform service manager.
       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.  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.

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.
       Information about the project can be found at 
       ⟨http://www.pcp.io/⟩.  If you have a bug report for this manual
       page, send it to pcp@groups.io.  This page was obtained from the
       project's upstream Git repository
       ⟨https://github.com/performancecopilot/pcp.git⟩ on 2021-08-27.
       (At that time, the date of the most recent commit that was found
       in the repository was 2021-08-27.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there
       is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       man-pages@man7.org

Performance Co-Pilot               PCPPMSERVERNOTIFYSERVICEMANAGERREADY(3)

Pages that refer to this page: pmlogger(1)