1SAM_HC_CALLBACK_REGCIoSrToEsRy(n3c)Cluster Engine ProgrammerS'AsM_MHaCn_uCaAlLLBACK_REGISTER(3)
2
3
4
6 sam_hc_callback_register - Register health check callback
7
8
10 #include <corosync/sam.h>
11
12
13 cs_error_t sam_hc_callback_register (sam_hc_callback_t cb);
14
15
17 The sam_hc_callback_register function is used to register a user pro‐
18 vided healthcheck callback. After calling of this function, the SAM is
19 switched from application driven healthchecking to event driven
20 healthchecking. In this mode, sam_hc_send(3) does not need to be exe‐
21 cuted.
22
23
24 The parameter cb is callback function of type sam_hc_callback_t defined
25 as:
26
27 typedef int (*sam_hc_callback_t)(void);
28
29
30 This function will be regularly called and must return 0 if the process
31 is functioning normally, or -1 if the process is executing abnormally.
32 When -1 is returned, the SAM server execute the registered recovery
33 policy.
34
35
36 A value of NULL can be passed into this function to switch into appli‐
37 cation driven healthchecking. cb to NULL.
38
39
41 This call return CS_OK value if successful, otherwise and error is
42 returned.
43
44
46 CS_ERR_BAD_HANDLE
47 SAM was not initialized and registered or health checking is in
48 running state
49
50 CS_ERR_LIBRARY
51 internal library call failed. This can occur during fork() or
52 pipe() system calls and the errno variable can be read to
53 retrieve more information.
54
55
57 sam_start(3), sam_stop(3), sam_hc_send(3), sam_register(3),
58
59 CS_ERR_TRY_AGAIN Resource temporarily unavailable
60
61 CS_ERR_INVALID_PARAM Invalid argument
62
63 CS_ERR_ACCESS Permission denied
64
65 CS_ERR_LIBRARY The connection failed
66
67 CS_ERR_INTERRUPT System call interrupted by a signal
68
69 CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
70
71 CS_ERR_MESSAGE_ERROR Incorrect auth message received
72
73 CS_ERR_NO_MEMORY Not enough memory to complete the requested task
74
75
76
77corosync Man Page 12/01/2009 SAM_HC_CALLBACK_REGISTER(3)