MCPcopy Create free account
hub / github.com/corosync/corosync / sam_register

Function sam_register

lib/sam.c:1259–1398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1257}
1258
1259cs_error_t sam_register (
1260 unsigned int *instance_id)
1261{
1262 pid_t pid;
1263 int pipe_error;
1264 int pipe_fd_out[2], pipe_fd_in[2];
1265 enum sam_parent_action_t action, old_action;
1266 int child_status;
1267 sam_recovery_policy_t recpol;
1268 cs_error_t ret;
1269
1270 ret = CS_OK;
1271
1272 if (sam_internal_data.internal_status != SAM_INTERNAL_STATUS_INITIALIZED) {
1273 ret = CS_ERR_BAD_HANDLE;
1274 goto exit_error;
1275 }
1276
1277 recpol = sam_internal_data.recovery_policy;
1278
1279 if (recpol & SAM_RECOVERY_POLICY_CMAP) {
1280 /*
1281 * Register to cmap
1282 */
1283 if ((ret = sam_cmap_register ()) != CS_OK) {
1284 ret = CS_ERR_BAD_HANDLE;
1285 goto exit_error;
1286 }
1287 }
1288
1289 while (1) {
1290 if ((pipe_error = pipe (pipe_fd_out)) != 0) {
1291 ret = CS_ERR_LIBRARY;
1292 goto exit_error;
1293 }
1294
1295 if ((pipe_error = pipe (pipe_fd_in)) != 0) {
1296 close (pipe_fd_out[0]);
1297 close (pipe_fd_out[1]);
1298
1299 ret = CS_ERR_BAD_HANDLE;
1300 goto exit_error;
1301 }
1302
1303 if (recpol & SAM_RECOVERY_POLICY_CMAP) {
1304 if ((ret = sam_cmap_update_key (SAM_CMAP_KEY_STATE, SAM_CMAP_S_REGISTERED)) != CS_OK) {
1305 goto exit_error;
1306 }
1307 }
1308
1309 sam_internal_data.instance_id++;
1310
1311 sam_internal_data.term_send = 0;
1312
1313 pid = fork ();
1314
1315 if (pid == -1) {
1316 /*

Callers 10

test_basicsFunction · 0.85
test_signalFunction · 0.85
test_smokeFunction · 0.85
test_data_store_restoreFunction · 0.85
test_hcFunction · 0.85
test_warn_signalFunction · 0.85
test_quorumFunction · 0.85
test_finalize_deadlockFunction · 0.85
test_cmap_quitFunction · 0.85
test_cmap_restartFunction · 0.85

Calls 5

sam_cmap_registerFunction · 0.85
sam_cmap_update_keyFunction · 0.85
sam_parent_handlerFunction · 0.85
quorum_finalizeFunction · 0.85

Tested by 10

test_basicsFunction · 0.68
test_signalFunction · 0.68
test_smokeFunction · 0.68
test_data_store_restoreFunction · 0.68
test_hcFunction · 0.68
test_warn_signalFunction · 0.68
test_quorumFunction · 0.68
test_finalize_deadlockFunction · 0.68
test_cmap_quitFunction · 0.68
test_cmap_restartFunction · 0.68