1SAM_INITIALIZE(3) Corosync Cluster Engine Programmer's ManualSAM_INITIALIZE(3)
2
3
4
6 sam_initialize - Initialize health checking
7
8
10 #include <corosync/sam.h>
11
12
13 cs_error_t sam_initialize (int time_interval, sam_recovery_policy_t
14 recovery_policy);
15
16
18 The sam_initialize function is used to initialize health checking of a
19 process.
20
21
22 Application can have only one instance of SAM. This function must be
23 called before any other of SAM functions. It is recommended to ini‐
24 tialize before the process begins any process initialization.
25
26
27 The time_interval parameter is a timeout in milliseconds before taking
28 recovery action after having not received a healthcheck.
29
30 If time_interval parameter is zero, there is no time limit and no
31 healthcheck must be sent by the process. In this operational mode, a
32 process failure will continue to execute the recovery policy.
33
34
35 The recovery_policy is defined as type:
36
37 typedef enum {
38 SAM_RECOVERY_POLICY_QUIT = 1,
39 SAM_RECOVERY_POLICY_RESTART = 2,
40 } sam_recovery_policy_t;
41
42
43 where
44
45
46 SAM_RECOVERY_POLICY_QUIT
47 on failure, the process will terminate.
48
49 SAM_RECOVERY_POLICY_RESTART
50 on failure, the process will restart.
51
52
53 To perform event driven healthchecking, sam_register(3) and
54 sam_start(3) functions must called. Event driven healthchecking causes
55 the duplicate standby process running the SAM serve rto periodically
56 request healthchecks from the active process.
57
58
60 This call return CS_OK value if successful, otherwise and error is
61 returned.
62
63
65 CS_ERR_BAD_HANDLE
66 can happened in case of double initialization.
67
68 CS_ERR_INVALID_PARAM
69 recovery_policy has invalid value.
70
71
73 sam_register(3), sam_start(3), sam_hc_callback_register(3)
74
75
76
77corosync Man Page 12/01/2009 SAM_INITIALIZE(3)