---
name: "__pmServerNotifyServiceManagerReady"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__pmServerNotifyServiceManagerReady"
---

# \_\_pmServerNotifyServiceManagerReady(3)

notify service start and stop

## 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**

## CAVEAT

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

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)](/sd_notify/3.md).

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

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

## RETURN CODE

If successful, **\_\_pmServerNotifyServiceManagerReady** returns a positive integer that depends on the platform service manager. In the case of [**systemd**(1)](/systemd/1.md), the return code is from [**sd\_notify**(3)](/sd_notify/3.md). If the platform supports [**systemd**(1)](/systemd/1.md) 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)](/systemd/1.md)), 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.
