View | Details | Raw Unified | Return to bug 209006
Collapse All | Expand All

(-)Makefile (-7 / +5 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	pacemaker
4
PORTNAME=	pacemaker
5
PORTVERSION=	1.1.14
5
PORTVERSION=	1.1.14
6
PORTREVISION=	1
6
CATEGORIES=	net
7
CATEGORIES=	net
7
8
8
MAINTAINER=	dpejesh@yahoo.com
9
MAINTAINER=	dpejesh@yahoo.com
Lines 10-17 Link Here
10
11
11
LICENSE=	GPLv2
12
LICENSE=	GPLv2
12
13
13
BROKEN_powerpc64=	Does not build
14
15
BUILD_DEPENDS=	bash:shells/bash \
14
BUILD_DEPENDS=	bash:shells/bash \
16
		corosync:net/corosync
15
		corosync:net/corosync
17
LIB_DEPENDS=	libgnutls.so:security/gnutls \
16
LIB_DEPENDS=	libgnutls.so:security/gnutls \
Lines 21-28 Link Here
21
		libxml2.so:textproc/libxml2 \
20
		libxml2.so:textproc/libxml2 \
22
		libxslt.so:textproc/libxslt
21
		libxslt.so:textproc/libxslt
23
RUN_DEPENDS=	bash:shells/bash \
22
RUN_DEPENDS=	bash:shells/bash \
24
		corosync:net/corosync
23
		corosync:net/corosync \
24
		ocf-tester:net-mgmt/resource-agents
25
25
26
BROKEN_powerpc64=	Does not build
27
26
CONFLICTS=	heartbeat-[0-9]*
28
CONFLICTS=	heartbeat-[0-9]*
27
29
28
USERS=		hacluster
30
USERS=		hacluster
Lines 77-84 Link Here
77
post-patch:
79
post-patch:
78
	@${REINPLACE_CMD} ${REPLACE_ARGS} ${WRKSRC}/configure.ac
80
	@${REINPLACE_CMD} ${REPLACE_ARGS} ${WRKSRC}/configure.ac
79
81
80
post-install:
81
	${RM} ${STAGEDIR}${PREFIX}/etc/rc.d/pacemaker
82
	${RM} ${STAGEDIR}${PREFIX}/etc/rc.d/pacemaker_remote
83
84
.include <bsd.port.mk>
82
.include <bsd.port.mk>
(-)files/patch-extra_resources_SysInfo (+44 lines)
Line 0 Link Here
1
--- extra/resources/SysInfo.orig	2016-04-18 16:07:35 UTC
2
+++ extra/resources/SysInfo
3
@@ -164,6 +164,20 @@ SysInfoStats() {
4
 	    cpu_type=`system_profiler SPHardwareDataType | awk -F': ' '/^CPU Type/ {print $2; exit}'`
5
 	    cpu_speed=`system_profiler SPHardwareDataType | awk -F': ' '/^CPU Speed/ {print $2; exit}'`
6
 	    cpu_cores=`system_profiler SPHardwareDataType | awk -F': ' '/^Number Of/ {print $2; exit}'`
7
+	    cpu_load=`uptime | awk '{ print $10 }'`
8
+	;;
9
+	"FreeBSD")
10
+	    cpu_type=`sysctl -in hw.model`
11
+	    cpu_speed=`sysctl -in dev.cpu.0.freq`
12
+	    cpu_cores=`sysctl -in hw.ncpu`
13
+	    cpu_load=`sysctl -in vm.loadavg | awk '{ print $4 }'`
14
+
15
+	    free_pages=`sysctl -in vm.stats.vm.v_free_count`
16
+	    page_count=`sysctl -in vm.stats.vm.v_page_count`
17
+	    page_size=`sysctl -in vm.stats.vm.v_page_size`
18
+
19
+	    mem=`expr $free_pages \* $page_size / 1024 / 1024`M
20
+	    mem_total=`expr $page_count \* $page_size / 1024 / 1024`M
21
 	;;
22
 	"Linux")
23
 	    if [ -f /proc/cpuinfo ]; then
24
@@ -171,6 +185,7 @@ SysInfoStats() {
25
 		cpu_speed=`awk -F': ' '/bogomips/ {print $2; exit}' /proc/cpuinfo`
26
 		cpu_cores=`grep "^processor" /proc/cpuinfo | wc -l`
27
 	    fi
28
+	    cpu_load=`uptime | awk '{ print $10 }'`
29
 
30
 	    if [ -f /proc/meminfo ]; then
31
 	        # meminfo results are in kB
32
@@ -199,9 +214,9 @@ SysInfoStats() {
33
 	UpdateStat cpu_cores "$cpu_cores"
34
     fi
35
 
36
-    loads=`uptime`
37
-    load15=`echo ${loads} | awk '{print $10}'`
38
-    UpdateStat cpu_load $load15
39
+    if [ x != x"$cpu_load" ]; then
40
+	UpdateStat cpu_load "$cpu_load"
41
+    fi
42
 
43
     if [ ! -z "$mem" ]; then
44
         # Massage the memory values
(-)files/patch-extra_resources_ping (-1 / +1 lines)
Lines 1-4 Link Here
1
--- extra/resources/ping.orig	2016-03-21 16:27:02 UTC
1
--- extra/resources/ping.orig	2016-04-18 16:07:35 UTC
2
+++ extra/resources/ping
2
+++ extra/resources/ping
3
@@ -262,6 +262,7 @@ ping_check() {
3
@@ -262,6 +262,7 @@ ping_check() {
4
 	case `uname` in
4
 	case `uname` in
(-)files/patch-lib-common-utils.c (-12 lines)
Lines 1-12 Link Here
1
--- lib/common/utils.c.orig	2016-01-14 21:43:08 UTC
2
+++ lib/common/utils.c
3
@@ -2270,7 +2270,8 @@ find_library_function(void **handle, con
4
     }
5
 
6
     a_function = dlsym(*handle, fn);
7
-    if ((error = dlerror()) != NULL) {
8
+    if (a_function == NULL) {
9
+        error = dlerror();
10
         crm_err("%sCould not find %s in %s: %s", fatal ? "Fatal: " : "", fn, lib, error);
11
         if (fatal) {
12
             crm_exit(DAEMON_RESPAWN_STOP);
(-)files/patch-lib-services-services_linux.c (-180 lines)
Lines 1-180 Link Here
1
--- lib/services/services_linux.c.orig	2016-01-14 21:43:08 UTC
2
+++ lib/services/services_linux.c
3
@@ -457,13 +457,19 @@ action_launch_child(svc_action_t *op)
4
     _exit(op->rc);
5
 }
6
 
7
+#ifndef HAVE_SYS_SIGNALFD_H
8
+static int sigchld_pipe[2];
9
+
10
 static void
11
-action_synced_wait(svc_action_t * op, sigset_t mask)
12
+sigchld_handler()
13
 {
14
+    write(sigchld_pipe[1], "", 1);
15
+}
16
+#endif
17
 
18
-#ifndef HAVE_SYS_SIGNALFD_H
19
-    CRM_ASSERT(FALSE);
20
-#else
21
+static void
22
+action_synced_wait(svc_action_t * op, sigset_t *mask)
23
+{
24
     int status = 0;
25
     int timeout = op->timeout;
26
     int sfd = -1;
27
@@ -471,10 +477,14 @@ action_synced_wait(svc_action_t * op, si
28
     struct pollfd fds[3];
29
     int wait_rc = 0;
30
 
31
-    sfd = signalfd(-1, &mask, SFD_NONBLOCK);
32
+#ifdef HAVE_SYS_SIGNALFD_H
33
+    sfd = signalfd(-1, mask, SFD_NONBLOCK);
34
     if (sfd < 0) {
35
         crm_perror(LOG_ERR, "signalfd() failed");
36
     }
37
+#else
38
+    sfd = sigchld_pipe[0];
39
+#endif
40
 
41
     fds[0].fd = op->opaque->stdout_fd;
42
     fds[0].events = POLLIN;
43
@@ -503,6 +513,7 @@ action_synced_wait(svc_action_t * op, si
44
             }
45
 
46
             if (fds[2].revents & POLLIN) {
47
+#ifdef HAVE_SYS_SIGNALFD_H
48
                 struct signalfd_siginfo fdsi;
49
                 ssize_t s;
50
 
51
@@ -511,6 +522,12 @@ action_synced_wait(svc_action_t * op, si
52
                     crm_perror(LOG_ERR, "Read from signal fd %d failed", sfd);
53
 
54
                 } else if (fdsi.ssi_signo == SIGCHLD) {
55
+#else
56
+                if (1) {
57
+                    /* Clear out the sigchld pipe. */
58
+                    char ch;
59
+                    while (read(sfd, &ch, 1) == 1);
60
+#endif
61
                     wait_rc = waitpid(op->pid, &status, WNOHANG);
62
 
63
                     if (wait_rc < 0){
64
@@ -583,10 +600,10 @@ action_synced_wait(svc_action_t * op, si
65
 
66
     close(op->opaque->stdout_fd);
67
     close(op->opaque->stderr_fd);
68
-    close(sfd);
69
 
70
+#ifdef HAVE_SYS_SIGNALFD_H
71
+    close(sfd);
72
 #endif
73
-
74
 }
75
 
76
 /* For an asynchronous 'op', returns FALSE if 'op' should be free'd by the caller */
77
@@ -596,9 +613,30 @@ services_os_action_execute(svc_action_t 
78
 {
79
     int stdout_fd[2];
80
     int stderr_fd[2];
81
+    struct stat st;
82
+    sigset_t *pmask;
83
+
84
+#ifdef HAVE_SYS_SIGNALFD_H
85
     sigset_t mask;
86
     sigset_t old_mask;
87
-    struct stat st;
88
+#define sigchld_cleanup() {                                                   \
89
+    if (sigismember(&old_mask, SIGCHLD) == 0) {                               \
90
+        if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) {                      \
91
+            crm_perror(LOG_ERR, "sigprocmask() failed to unblock sigchld");   \
92
+        }                                                                     \
93
+    }                                                                         \
94
+}
95
+#else
96
+    struct sigaction sa;
97
+    struct sigaction old_sa;
98
+#define sigchld_cleanup() {                                                   \
99
+    if (sigaction(SIGCHLD, &old_sa, NULL) < 0) {                              \
100
+        crm_perror(LOG_ERR, "sigaction() failed to remove sigchld handler");  \
101
+    }                                                                         \
102
+    close(sigchld_pipe[0]);                                                   \
103
+    close(sigchld_pipe[1]);                                                   \
104
+}
105
+#endif
106
 
107
     if (pipe(stdout_fd) < 0) {
108
         crm_err("pipe() failed");
109
@@ -620,13 +658,33 @@ services_os_action_execute(svc_action_t 
110
     }
111
 
112
     if (synchronous) {
113
+#ifdef HAVE_SYS_SIGNALFD_H
114
         sigemptyset(&mask);
115
         sigaddset(&mask, SIGCHLD);
116
         sigemptyset(&old_mask);
117
 
118
         if (sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0) {
119
-            crm_perror(LOG_ERR, "sigprocmask() failed");
120
+            crm_perror(LOG_ERR, "sigprocmask() failed to block sigchld");
121
+        }
122
+
123
+        pmask = &mask;
124
+#else
125
+        if(pipe(sigchld_pipe) == -1) {
126
+            crm_perror(LOG_ERR, "pipe() failed");
127
+        }
128
+
129
+        set_fd_opts(sigchld_pipe[0], O_NONBLOCK);
130
+        set_fd_opts(sigchld_pipe[1], O_NONBLOCK);
131
+
132
+        sa.sa_handler = sigchld_handler;
133
+        sa.sa_flags = 0;
134
+        sigemptyset(&sa.sa_mask);
135
+        if (sigaction(SIGCHLD, &sa, &old_sa) < 0) {
136
+            crm_perror(LOG_ERR, "sigaction() failed to set sigchld handler");
137
         }
138
+
139
+        pmask = NULL;
140
+#endif
141
     }
142
 
143
     op->pid = fork();
144
@@ -645,6 +703,8 @@ services_os_action_execute(svc_action_t 
145
                 if (!synchronous) {
146
                     return operation_finalize(op);
147
                 }
148
+
149
+                sigchld_cleanup();
150
                 return FALSE;
151
             }
152
         case 0:                /* Child */
153
@@ -663,6 +723,10 @@ services_os_action_execute(svc_action_t 
154
                 close(stderr_fd[1]);
155
             }
156
 
157
+            if (synchronous) {
158
+                sigchld_cleanup();
159
+            }
160
+
161
             action_launch_child(op);
162
     }
163
 
164
@@ -677,14 +741,8 @@ services_os_action_execute(svc_action_t 
165
     set_fd_opts(op->opaque->stderr_fd, O_NONBLOCK);
166
 
167
     if (synchronous) {
168
-        action_synced_wait(op, mask);
169
-
170
-        if (sigismember(&old_mask, SIGCHLD) == 0) {
171
-            if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) {
172
-                crm_perror(LOG_ERR, "sigprocmask() to unblocked failed");
173
-            }
174
-        }
175
-
176
+        action_synced_wait(op, pmask);
177
+        sigchld_cleanup();
178
     } else {
179
 
180
         crm_trace("Async waiting for %d - %s", op->pid, op->opaque->exec);
(-)files/patch-lib_common_utils.c (+12 lines)
Line 0 Link Here
1
--- lib/common/utils.c.orig	2016-01-14 21:43:08 UTC
2
+++ lib/common/utils.c
3
@@ -2270,7 +2270,8 @@ find_library_function(void **handle, con
4
     }
5
 
6
     a_function = dlsym(*handle, fn);
7
-    if ((error = dlerror()) != NULL) {
8
+    if (a_function == NULL) {
9
+        error = dlerror();
10
         crm_err("%sCould not find %s in %s: %s", fatal ? "Fatal: " : "", fn, lib, error);
11
         if (fatal) {
12
             crm_exit(DAEMON_RESPAWN_STOP);
(-)files/patch-lib_services_services__linux.c (+180 lines)
Line 0 Link Here
1
--- lib/services/services_linux.c.orig	2016-01-14 21:43:08 UTC
2
+++ lib/services/services_linux.c
3
@@ -457,13 +457,19 @@ action_launch_child(svc_action_t *op)
4
     _exit(op->rc);
5
 }
6
 
7
+#ifndef HAVE_SYS_SIGNALFD_H
8
+static int sigchld_pipe[2];
9
+
10
 static void
11
-action_synced_wait(svc_action_t * op, sigset_t mask)
12
+sigchld_handler()
13
 {
14
+    write(sigchld_pipe[1], "", 1);
15
+}
16
+#endif
17
 
18
-#ifndef HAVE_SYS_SIGNALFD_H
19
-    CRM_ASSERT(FALSE);
20
-#else
21
+static void
22
+action_synced_wait(svc_action_t * op, sigset_t *mask)
23
+{
24
     int status = 0;
25
     int timeout = op->timeout;
26
     int sfd = -1;
27
@@ -471,10 +477,14 @@ action_synced_wait(svc_action_t * op, si
28
     struct pollfd fds[3];
29
     int wait_rc = 0;
30
 
31
-    sfd = signalfd(-1, &mask, SFD_NONBLOCK);
32
+#ifdef HAVE_SYS_SIGNALFD_H
33
+    sfd = signalfd(-1, mask, SFD_NONBLOCK);
34
     if (sfd < 0) {
35
         crm_perror(LOG_ERR, "signalfd() failed");
36
     }
37
+#else
38
+    sfd = sigchld_pipe[0];
39
+#endif
40
 
41
     fds[0].fd = op->opaque->stdout_fd;
42
     fds[0].events = POLLIN;
43
@@ -503,6 +513,7 @@ action_synced_wait(svc_action_t * op, si
44
             }
45
 
46
             if (fds[2].revents & POLLIN) {
47
+#ifdef HAVE_SYS_SIGNALFD_H
48
                 struct signalfd_siginfo fdsi;
49
                 ssize_t s;
50
 
51
@@ -511,6 +522,12 @@ action_synced_wait(svc_action_t * op, si
52
                     crm_perror(LOG_ERR, "Read from signal fd %d failed", sfd);
53
 
54
                 } else if (fdsi.ssi_signo == SIGCHLD) {
55
+#else
56
+                if (1) {
57
+                    /* Clear out the sigchld pipe. */
58
+                    char ch;
59
+                    while (read(sfd, &ch, 1) == 1);
60
+#endif
61
                     wait_rc = waitpid(op->pid, &status, WNOHANG);
62
 
63
                     if (wait_rc < 0){
64
@@ -583,10 +600,10 @@ action_synced_wait(svc_action_t * op, si
65
 
66
     close(op->opaque->stdout_fd);
67
     close(op->opaque->stderr_fd);
68
-    close(sfd);
69
 
70
+#ifdef HAVE_SYS_SIGNALFD_H
71
+    close(sfd);
72
 #endif
73
-
74
 }
75
 
76
 /* For an asynchronous 'op', returns FALSE if 'op' should be free'd by the caller */
77
@@ -596,9 +613,30 @@ services_os_action_execute(svc_action_t 
78
 {
79
     int stdout_fd[2];
80
     int stderr_fd[2];
81
+    struct stat st;
82
+    sigset_t *pmask;
83
+
84
+#ifdef HAVE_SYS_SIGNALFD_H
85
     sigset_t mask;
86
     sigset_t old_mask;
87
-    struct stat st;
88
+#define sigchld_cleanup() {                                                   \
89
+    if (sigismember(&old_mask, SIGCHLD) == 0) {                               \
90
+        if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) {                      \
91
+            crm_perror(LOG_ERR, "sigprocmask() failed to unblock sigchld");   \
92
+        }                                                                     \
93
+    }                                                                         \
94
+}
95
+#else
96
+    struct sigaction sa;
97
+    struct sigaction old_sa;
98
+#define sigchld_cleanup() {                                                   \
99
+    if (sigaction(SIGCHLD, &old_sa, NULL) < 0) {                              \
100
+        crm_perror(LOG_ERR, "sigaction() failed to remove sigchld handler");  \
101
+    }                                                                         \
102
+    close(sigchld_pipe[0]);                                                   \
103
+    close(sigchld_pipe[1]);                                                   \
104
+}
105
+#endif
106
 
107
     if (pipe(stdout_fd) < 0) {
108
         crm_err("pipe() failed");
109
@@ -620,13 +658,33 @@ services_os_action_execute(svc_action_t 
110
     }
111
 
112
     if (synchronous) {
113
+#ifdef HAVE_SYS_SIGNALFD_H
114
         sigemptyset(&mask);
115
         sigaddset(&mask, SIGCHLD);
116
         sigemptyset(&old_mask);
117
 
118
         if (sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0) {
119
-            crm_perror(LOG_ERR, "sigprocmask() failed");
120
+            crm_perror(LOG_ERR, "sigprocmask() failed to block sigchld");
121
+        }
122
+
123
+        pmask = &mask;
124
+#else
125
+        if(pipe(sigchld_pipe) == -1) {
126
+            crm_perror(LOG_ERR, "pipe() failed");
127
+        }
128
+
129
+        set_fd_opts(sigchld_pipe[0], O_NONBLOCK);
130
+        set_fd_opts(sigchld_pipe[1], O_NONBLOCK);
131
+
132
+        sa.sa_handler = sigchld_handler;
133
+        sa.sa_flags = 0;
134
+        sigemptyset(&sa.sa_mask);
135
+        if (sigaction(SIGCHLD, &sa, &old_sa) < 0) {
136
+            crm_perror(LOG_ERR, "sigaction() failed to set sigchld handler");
137
         }
138
+
139
+        pmask = NULL;
140
+#endif
141
     }
142
 
143
     op->pid = fork();
144
@@ -645,6 +703,8 @@ services_os_action_execute(svc_action_t 
145
                 if (!synchronous) {
146
                     return operation_finalize(op);
147
                 }
148
+
149
+                sigchld_cleanup();
150
                 return FALSE;
151
             }
152
         case 0:                /* Child */
153
@@ -663,6 +723,10 @@ services_os_action_execute(svc_action_t 
154
                 close(stderr_fd[1]);
155
             }
156
 
157
+            if (synchronous) {
158
+                sigchld_cleanup();
159
+            }
160
+
161
             action_launch_child(op);
162
     }
163
 
164
@@ -677,14 +741,8 @@ services_os_action_execute(svc_action_t 
165
     set_fd_opts(op->opaque->stderr_fd, O_NONBLOCK);
166
 
167
     if (synchronous) {
168
-        action_synced_wait(op, mask);
169
-
170
-        if (sigismember(&old_mask, SIGCHLD) == 0) {
171
-            if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0) {
172
-                crm_perror(LOG_ERR, "sigprocmask() to unblocked failed");
173
-            }
174
-        }
175
-
176
+        action_synced_wait(op, pmask);
177
+        sigchld_cleanup();
178
     } else {
179
 
180
         crm_trace("Async waiting for %d - %s", op->pid, op->opaque->exec);
(-)files/patch-lrmd_Makefile.am (+11 lines)
Line 0 Link Here
1
--- lrmd/Makefile.am.orig	2016-04-18 16:07:35 UTC
2
+++ lrmd/Makefile.am
3
@@ -23,8 +23,6 @@ test_SCRIPTS		= regression.py
4
 lrmdlibdir	= $(CRM_DAEMON_DIR)
5
 lrmdlib_PROGRAMS = lrmd lrmd_test lrmd_internal_ctl
6
 
7
-initdir		 = $(INITDIR)
8
-init_SCRIPTS	 = pacemaker_remote
9
 sbin_PROGRAMS	 = pacemaker_remoted
10
 
11
 if BUILD_SYSTEMD
(-)files/patch-mcp_Makefile.am (+11 lines)
Line 0 Link Here
1
--- mcp/Makefile.am.orig	2016-04-18 16:07:35 UTC
2
+++ mcp/Makefile.am
3
@@ -19,8 +19,6 @@ include $(top_srcdir)/Makefile.common
4
 
5
 if BUILD_CS_SUPPORT
6
 
7
-initdir			= $(INITDIR)
8
-init_SCRIPTS		= pacemaker
9
 sbin_PROGRAMS		= pacemakerd
10
 
11
 if BUILD_SYSTEMD
(-)pkg-plist (-2 lines)
Lines 3647-3654 Link Here
3647
%%DATADIR%%/upgrade06.xsl
3647
%%DATADIR%%/upgrade06.xsl
3648
%%DATADIR%%/versions.rng
3648
%%DATADIR%%/versions.rng
3649
share/snmp/mibs/PCMK-MIB.txt
3649
share/snmp/mibs/PCMK-MIB.txt
3650
@dir /usr/local/etc/rc.d
3651
@dir /usr/local/etc
3652
@dir /var/lib/pacemaker/blackbox
3650
@dir /var/lib/pacemaker/blackbox
3653
@dir /var/lib/pacemaker/cib
3651
@dir /var/lib/pacemaker/cib
3654
@dir /var/lib/pacemaker/pengine
3652
@dir /var/lib/pacemaker/pengine

Return to bug 209006