1SAM_REGISTER(3) Corosync Cluster Engine Programmer's Manual SAM_REGISTER(3)
2
3
4
6 sam_rehister - Register component for health checking
7
8
10 #include <corosync/sam.h>
11
12
13 cs_error_t sam_register (unsigned int *instance_id);
14
15
17 The sam_register function is used to register a process for
18 healthchecking. If recovery policy is set to SAM_RECOVERY_POL‐
19 ICY_RESTART and recovery action will be taken, the new process instance
20 will begin execution at the next code line after this function is
21 called.
22
23
24 This function can be called only once and SAM must be initialized by
25 sam_initialize(3) function.
26
27
28 The instance_id argument is a pointer to a value storing the current
29 iteration instance. If this parameter is NULL, no instance_id is
30 returned. and then, no instance_id will be returned. This value starts
31 at 0 for the first iteration instance, and increases by 1 each time a
32 recovery restart is executed. After reaching MAX_INT, the instance_id
33 will reset to 0.
34
35
36 The placement of this function is important because after it is called,
37 the process id will change.
38
39
40 After registration, event driven health checking is not running.
41
42
44 This call return CS_OK value if successful, otherwise and error is
45 returned.
46
47
49 CS_ERR_BAD_HANDLE
50 health checking was not started by calling sam_start(3) func‐
51 tion.
52
53 CS_ERR_LIBRARY
54 internal library call failed. This can be one of pipe creation
55 or fork. It's possible to get more information from errno.
56
57
59 sam_start(3), sam_initialize(3), sam_hc_callback_register(3)
60
61 CS_ERR_TRY_AGAIN Resource temporarily unavailable
62
63 CS_ERR_INVALID_PARAM Invalid argument
64
65 CS_ERR_ACCESS Permission denied
66
67 CS_ERR_LIBRARY The connection failed
68
69 CS_ERR_INTERRUPT System call interrupted by a signal
70
71 CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
72
73 CS_ERR_MESSAGE_ERROR Incorrect auth message received
74
75 CS_ERR_NO_MEMORY Not enough memory to complete the requested task
76
77
78
79corosync Man Page 12/01/2009 SAM_REGISTER(3)