/usr/include/heartbeat/apphb.h is in libheartbeat2-dev 1:3.0.5+hg12629-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | #ifndef _APPHB_H
#define _APPHB_H
/*
* Copyright (C) 2002 Alan Robertson <alanr@unix.sh>
* This software licensed under the GNU LGPL.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****************************************************************
* Application Heartbeat API
*
* Application heartbeating declares an expectation between a client
* application and a heartbeat monitoring service. The heartbeat
* monitoring service is used to monitor the basic sanity of
* participating applications.
*
* To register with the monitoring service, use apphb_register().
*
* Once an application has registered, it is expected that it
* will make periodic calls to apphb_hb(). If it does not, that
* fact will be logged by the heartbeat monitoring service.
*
* To tell the monitoring service how often to expect apphb_hb(),
* calls, use apphb_setinterval().
*
* To tell the monitoring service not to expect further apphb_hb()
* calls, use apphb_unregister().
*
****************************************************************
*
* Each of these functions returns a negative value on error
* and sets errno to an appropriate value.
*
* Success is indicated by a non-negative return value.
*/
/*
* apphb_register: register a process for heartbeat monitoring.
*
* parameters:
* appname: name this process is registered as (for notification purposes)
*
* The heartbeat interval for the current process is initially defaulted
* to 10 seconds (10000 ms).
*
* NOTE: apphb_register() calls are not inherited by child processes.
* child processes must register themselves.
*
* errno values:
* EEXIST: current process already registered for monitoring.
* EBADF: application heartbeat service not available
* EINVAL: NULL 'appname' argument
* ENOSPC: too many clients already registered
* ENAMETOOLONG: appname or appinstance argument is too long.
*/
int apphb_register(const char * appname, const char * appinstance);
/*
* apphb_unregister: unregister a process from heartbeat monitoring.
*
* After this call, no further heartbeat calls are expected or allowed
* from the current process, unless it reregisters.
*
* errno values:
* EBADF: application heartbeat service not available
* ESRCH: current process not registered for monitoring.
*/
int apphb_unregister(void);
/*
* apphb_setinterval: set heartbeat interval
* parameters:
* hbms: the expected heartbeat interval in milliseconds.
* an hbms of zero temporarily diables heartbeat monitoring
*
* errno values:
* EBADF: application heartbeat service not available
* ESRCH: current process not registered for monitoring.
* EINVAL: illegal/invalid hbms value
*
*/
int apphb_setinterval(unsigned long hbms);
/*
* apphb_setwarn: set heartbeat warning time
* parameters:
* hbms: the heartbeat warning time in milliseconds
* an hbms of zero temporarily diables heartbeat monitoring
*
* errno values:
* EBADF: application heartbeat service not available
* ESRCH: current process not registered for monitoring.
* EINVAL: illegal/invalid hbms value
*
*
*/
int apphb_setwarn(unsigned long hbms);
/*
* apphb_setreboot: set auto-reboot on failure
* When a process which has autoreboot enabled
* exits prematurely doesn't heartbeat, the OS
* is immediately rebooted.
* parameters:
* truefalse: set to a non-zero value to enable auto-reboot,
* zero to disable auto-reboot for this process.
*
* errno values:
* EBADF: application heartbeat service not available
* ESRCH: current process not registered for monitoring.
* EPERM: no permission to set this machine to auto-reboot
* on failure.
*/
int apphb_setreboot(unsigned int truefalse);
/*
* apphb_hb: application heartbeat call.
*
* errno values:
* EBADF: application heartbeat service not available
* ESRCH: current process not registered for monitoring.
*
* If a registered application does not call apphb_hb() frequently
* enough, then when the heartbeat falls out of spec, the
* event is logged. Each time it resumes heartbeating afterwards,
* this resumption is also logged.
*
* It is expected that there is a process somewhere watching these events,
* and taking recovery actions if an application goes away or
* fails to heartbeat either for too long, or heartbeats intermittently
* too often. This application is outside the scope of this API, but
* in spite of this, recovery is really the whole point of application
* heartbeating ;-)
*/
int apphb_hb(void);
#endif
|