ham_heartbeat()

Updated: May 06, 2022

Send a heartbeat to the HAM

Synopsis:

#include <ha/ham.h>

int ham_heartbeat( void );

Library:

libham

Description:

Self-attached entities that have committed to sending heartbeats at prescribed intervals need to call ham_heartbeat() when they want to transmit a heartbeat.

The ham_heartbeat() function does nothing if the client isn't a self-attached entity or hasn't committed to sending heartbeats.

Returns:

This function always succeeds.

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler Yes
Signal handler Yes
Thread Yes

Caveats:

Clients that want to use ham_heartbeat() must be root and have their UID set to 0 for them to be able to send heartbeats to HAM. Non-root procceses attempting this will fail silently unless they have the CONNECTION ability (by calling procmgr_ability() with the PROCMGR_AID_CONNECTION identifier) before dropping from root or they use a secpol policy that allows the CONNECTION ability to be given to a non-root process.

Although this function always succeeds, the HAM doesn't always receive the heartbeat right away.

For example, if a client commits to sending a heartbeat every 5 seconds (at 5-, 10-, 15-second intervals, and so on), but instead transmits at the 2-second mark, then the HAM won't receive a heartbeat until the 5-second mark.

Or if the client sends a heartbeat at the 7-second mark and another at the 8-second mark, then the HAM will receive only one heartbeat at the 10-second mark.