summaryrefslogtreecommitdiffstats
path: root/php-5.6.30-dtrace.patch
blob: 591a337b95704122ac8884cfddde72715163eb21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Backported from PHP 7 for PHP 5 by Remi, from:


From 0c78fe4bb55a9d39afc79cbcbadb9a273f2ec2ef Mon Sep 17 00:00:00 2001
From: Dmitry Stogov <dmitry@zend.com>
Date: Fri, 18 Nov 2016 13:19:30 +0300
Subject: [PATCH] Disabled PHP call tracing by default (it makes significant
 overhead). This may be enabled again using envirionment variable
 USE_ZEND_DTRACE=1.

---
 NEWS        |  5 +++++
 Zend/zend.c | 16 +++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Zend/zend.c b/Zend/zend.c
index d036152..87cdead 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -682,9 +682,19 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
 
 #if HAVE_DTRACE
 /* build with dtrace support */
-	zend_compile_file = dtrace_compile_file;
-	zend_execute_ex = dtrace_execute_ex;
-	zend_execute_internal = dtrace_execute_internal;
+	{
+		char *tmp = getenv("USE_ZEND_DTRACE");
+
+		if (tmp && zend_atoi(tmp, 0)) {
+			zend_compile_file = dtrace_compile_file;
+			zend_execute_ex = dtrace_execute_ex;
+			zend_execute_internal = dtrace_execute_internal;
+		} else {
+			zend_compile_file = compile_file;
+			zend_execute_ex = execute_ex;
+			zend_execute_internal = NULL;
+		}
+	}
 #else
 	zend_compile_file = compile_file;
 	zend_execute_ex = execute_ex;
-- 
2.1.4

From f81b7df618750977b9d17f3443d2cb0d74529f50 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Fri, 20 Jan 2017 17:45:15 +0100
Subject: [PATCH] Fixed bug #73965 DTrace reported as enabled when disabled

---
 Zend/zend.c         | 2 ++
 Zend/zend.h         | 2 ++
 ext/standard/info.c | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Zend/zend.c b/Zend/zend.c
index 2a47e92..22a92a6 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -122,6 +122,7 @@
 #endif
 
 ZEND_API zend_utility_values zend_uv;
+ZEND_API zend_bool zend_dtrace_enabled;
 
 ZEND_API zval zval_used_for_init; /* True global variable */
 
@@ -686,6 +687,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
 		char *tmp = getenv("USE_ZEND_DTRACE");
 
 		if (tmp && zend_atoi(tmp, 0)) {
+			zend_dtrace_enabled = 1;
 			zend_compile_file = dtrace_compile_file;
 			zend_execute_ex = dtrace_execute_ex;
 			zend_execute_internal = dtrace_execute_internal;
diff --git a/Zend/zend.h b/Zend/zend.h
index 141573f..bb9866d 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -718,6 +718,8 @@ extern ZEND_API zend_class_entry *zend_standard_class_def;
 extern ZEND_API zend_utility_values zend_uv;
 extern ZEND_API zval zval_used_for_init;
 
+/* If DTrace is available and enabled */
+extern ZEND_API zend_bool zend_dtrace_enabled;
 END_EXTERN_C()
 
 #define ZEND_UV(name) (zend_uv.name)
diff --git a/ext/standard/info.c b/ext/standard/info.c
index fa19179..6b06f02 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -1019,7 +1019,7 @@ PHPAPI void php_print_info(int flag)
 #endif
 
 #if HAVE_DTRACE
-		php_info_print_table_row(2, "DTrace Support", "enabled" );
+		php_info_print_table_row(2, "DTrace Support", (zend_dtrace_enabled ? "enabled" : "available, disabled"));
 #else
 		php_info_print_table_row(2, "DTrace Support", "disabled" );
 #endif
-- 
2.1.4