ports/167953: devel/pecl-xhprof patch for single core cpu

Svyatoslav Lempert svyatoslav.lempert at gmail.com
Wed May 16 10:00:07 UTC 2012


>Number:         167953
>Category:       ports
>Synopsis:       devel/pecl-xhprof patch for single core cpu
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 16 10:00:06 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Svyatoslav Lempert
>Release:        8.3-STABLE
>Organization:
>Environment:
>Description:
Install port on single core (VPS with VDSmanager-FreeBSD jail-like
virtualizaion http://ispsystem.com/en/software/vdsmanager/freebsd_virtualization)


# cat test.php
<?
xhprof_enable();
?>

# php test.php
setaffinity: Resource deadlock avoided
setaffinity: Resource deadlock avoided
Segmentation fault

# sysctl -n kern.smp.cpus
1

>How-To-Repeat:
For fix this issue we should not use cpu_set_t in xhprof.c
>Fix:
Patch to port

Patch attached with submission follows:

diff -Nru pecl-xhprof.old/Makefile pecl-xhprof/Makefile
--- pecl-xhprof.old/Makefile	2010-09-17 04:14:49.000000000 +0900
+++ pecl-xhprof/Makefile	2012-05-16 18:43:34.000000000 +0900
@@ -24,6 +24,12 @@
 
 .include <bsd.port.pre.mk>
 
+CPUS!=	${SYSCTL} -n kern.smp.cpus
+
+.if ${CPUS} == "1"
+EXTRA_PATCHES=${FILESDIR}/extra-onecorecpu-xhprof.c.patch
+.endif
+
 .if ${OSVERSION} < 700110
 BROKEN=	Requires cpuset support
 .endif
diff -Nru pecl-xhprof.old/files/extra-onecorecpu-xhprof.c.patch pecl-xhprof/files/extra-onecorecpu-xhprof.c.patch
--- pecl-xhprof.old/files/extra-onecorecpu-xhprof.c.patch	1970-01-01 08:00:00.000000000 +0800
+++ pecl-xhprof/files/extra-onecorecpu-xhprof.c.patch	2012-05-16 15:14:02.000000000 +0900
@@ -0,0 +1,25 @@
+--- xhprof.c.orig	2009-06-02 02:52:32.000000000 +0900
++++ xhprof.c	2012-05-16 15:12:22.000000000 +0900
+@@ -1203,11 +1203,6 @@
+   CPU_ZERO(&new_mask);
+   CPU_SET(cpu_id, &new_mask);
+ 
+-  if (SET_AFFINITY(0, sizeof(cpu_set_t), &new_mask) < 0) {
+-    perror("setaffinity");
+-    return -1;
+-  }
+-
+   /* record the cpu_id the process is bound to. */
+   hp_globals.cur_cpu_id = cpu_id;
+ 
+@@ -1330,10 +1325,6 @@
+  * @author cjiang
+  */
+ int restore_cpu_affinity(cpu_set_t * prev_mask) {
+-  if (SET_AFFINITY(0, sizeof(cpu_set_t), prev_mask) < 0) {
+-    perror("restore setaffinity");
+-    return -1;
+-  }
+   /* default value ofor cur_cpu_id is 0. */
+   hp_globals.cur_cpu_id = 0;
+   return 0;


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list