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

Function sam_start

lib/sam.c:601–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601cs_error_t sam_start (void)
602{
603 char command;
604 cs_error_t ret;
605 sam_recovery_policy_t recpol;
606
607 ret = CS_OK;
608
609 pthread_mutex_lock (&sam_internal_data.lock);
610
611 if (sam_internal_data.internal_status != SAM_INTERNAL_STATUS_REGISTERED) {
612 ret = CS_ERR_BAD_HANDLE;
613 goto exit_mutex_unlock;
614 }
615
616 recpol = sam_internal_data.recovery_policy;
617
618 command = SAM_COMMAND_START;
619
620 if (sam_safe_write (sam_internal_data.child_fd_out, &command, sizeof (command)) != sizeof (command)) {
621 ret = CS_ERR_LIBRARY;
622 goto exit_mutex_unlock;
623 }
624
625 if (recpol & SAM_RECOVERY_POLICY_QUORUM || recpol & SAM_RECOVERY_POLICY_CMAP) {
626 /*
627 * Wait for parent reply
628 */
629 if ((ret = sam_read_reply (sam_internal_data.child_fd_in)) != CS_OK) {
630 goto exit_mutex_unlock;
631 }
632 }
633
634 if (sam_internal_data.hc_callback) {
635 if (sam_safe_write (sam_internal_data.cb_wpipe_fd, &command, sizeof (command)) != sizeof (command)) {
636 ret = CS_ERR_LIBRARY;
637 goto exit_mutex_unlock;
638 }
639 }
640
641 sam_internal_data.internal_status = SAM_INTERNAL_STATUS_STARTED;
642
643exit_mutex_unlock:
644 pthread_mutex_unlock (&sam_internal_data.lock);
645
646 return (ret);
647}
648
649static cs_error_t sam_stop_nolock (void)
650{

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 2

sam_safe_writeFunction · 0.85
sam_read_replyFunction · 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