Created
November 5, 2014 15:46
-
-
Save vincepii/b5d8f356a35d535313b5 to your computer and use it in GitHub Desktop.
Terrible patch for pacemaker on OmniOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/extra/resources/Dummy b/extra/resources/Dummy | |
index 2410c4d..6b6e886 100644 | |
--- a/extra/resources/Dummy | |
+++ b/extra/resources/Dummy | |
@@ -30,6 +30,7 @@ | |
####################################################################### | |
# Initialization: | |
+export OCF_ROOT=/opt/usr/lib/ocf/ | |
: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs} | |
. ${OCF_FUNCTIONS} | |
: ${__OCF_ACTION=$1} | |
diff --git a/lib/services/services_linux.c b/lib/services/services_linux.c | |
index 961ff18..aefd136 100644 | |
--- a/lib/services/services_linux.c | |
+++ b/lib/services/services_linux.c | |
@@ -445,20 +445,20 @@ static void | |
action_synced_wait(svc_action_t * op, sigset_t mask) | |
{ | |
-#ifndef HAVE_SYS_SIGNALFD_H | |
- CRM_ASSERT(FALSE); | |
-#else | |
+// #ifndef HAVE_SYS_SIGNALFD_H | |
+// CRM_ASSERT(FALSE); | |
+// #else | |
int status = 0; | |
int timeout = op->timeout; | |
int sfd = -1; | |
time_t start = -1; | |
- struct pollfd fds[3]; | |
+ struct pollfd fds[2]; | |
int wait_rc = 0; | |
- sfd = signalfd(-1, &mask, SFD_NONBLOCK); | |
- if (sfd < 0) { | |
- crm_perror(LOG_ERR, "signalfd() failed"); | |
- } | |
+ // sfd = signalfd(-1, &mask, SFD_NONBLOCK); | |
+ // if (sfd < 0) { | |
+ // crm_perror(LOG_ERR, "signalfd() failed"); | |
+ // } | |
fds[0].fd = op->opaque->stdout_fd; | |
fds[0].events = POLLIN; | |
@@ -474,6 +474,9 @@ action_synced_wait(svc_action_t * op, sigset_t mask) | |
crm_trace("Waiting for %d", op->pid); | |
start = time(NULL); | |
+ | |
+ op->timeout = 5000; | |
+ timeout = op->timeout; | |
do { | |
int poll_rc = poll(fds, 3, timeout); | |
@@ -486,25 +489,25 @@ action_synced_wait(svc_action_t * op, sigset_t mask) | |
svc_read_output(op->opaque->stderr_fd, op, TRUE); | |
} | |
- if (fds[2].revents & POLLIN) { | |
- struct signalfd_siginfo fdsi; | |
- ssize_t s; | |
- | |
- s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo)); | |
- if (s != sizeof(struct signalfd_siginfo)) { | |
- crm_perror(LOG_ERR, "Read from signal fd %d failed", sfd); | |
- | |
- } else if (fdsi.ssi_signo == SIGCHLD) { | |
- wait_rc = waitpid(op->pid, &status, WNOHANG); | |
- | |
- if (wait_rc < 0){ | |
- crm_perror(LOG_ERR, "waitpid() for %d failed", op->pid); | |
- | |
- } else if (wait_rc > 0) { | |
- break; | |
- } | |
- } | |
- } | |
+// if (fds[2].revents & POLLIN) { | |
+// struct signalfd_siginfo fdsi; | |
+// ssize_t s; | |
+// | |
+// s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo)); | |
+// if (s != sizeof(struct signalfd_siginfo)) { | |
+// crm_perror(LOG_ERR, "Read from signal fd %d failed", sfd); | |
+// | |
+// } else if (fdsi.ssi_signo == SIGCHLD) { | |
+// wait_rc = waitpid(op->pid, &status, WNOHANG); | |
+// | |
+// if (wait_rc < 0){ | |
+// crm_perror(LOG_ERR, "waitpid() for %d failed", op->pid); | |
+// | |
+// } else if (wait_rc > 0) { | |
+// break; | |
+// } | |
+// } | |
+// } | |
} else if (poll_rc == 0) { | |
timeout = 0; | |
@@ -522,12 +525,13 @@ action_synced_wait(svc_action_t * op, sigset_t mask) | |
} while ((op->timeout < 0 || timeout > 0)); | |
crm_trace("Child done: %d", op->pid); | |
+ wait_rc = waitpid(op->pid, &status, WNOHANG); | |
if (wait_rc <= 0) { | |
int killrc = kill(op->pid, SIGKILL); | |
op->rc = PCMK_OCF_UNKNOWN_ERROR; | |
if (op->timeout > 0 && timeout <= 0) { | |
- op->status = PCMK_LRM_OP_TIMEOUT; | |
+ op->status = PCMK_LRM_OP_DONE; | |
crm_warn("%s:%d - timed out after %dms", op->id, op->pid, op->timeout); | |
} else { | |
@@ -569,7 +573,7 @@ action_synced_wait(svc_action_t * op, sigset_t mask) | |
close(op->opaque->stderr_fd); | |
close(sfd); | |
-#endif | |
+// #endif | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment