pecl-apc fix warnings
Hanno Böck

Hanno Böck commited on 2013-01-09 12:56:43
Zeige 4 geänderte Dateien mit 174 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,4 @@
1
+AUX APC-3.1.13-fix-warnings.diff 4443 SHA256 9011a75d6a6da5e2fdec02d7daa08c68f223aea9728545c93dff7ceab235cca8 SHA512 a34e4df617ecb75fcc3d2594c217b2291897444bc6a65a1aeeaad20ce7434505b93b52e0ef902cb00da11ff79391287e998f6494eb34cdc91bcfdcc797aa989e WHIRLPOOL 3193d1af3bae3ff43819c70cfb18be956621ec2e6a0cb2ea729d6bd477de173b8e7b990cbce78a3ffc4c46b0057968ed1c9bb33f648ddf0195688532c6978be6
2
+AUX pecl-apc.ini 233 SHA256 1529ee803ce25a13bd303c9b40a32b238daf21aa0a993d8e66ae90dc1042d080 SHA512 ec206fd3fc6ebda209e2ff19db7910c7deeced53e8041b9ba5283684cde84144c99ea7521b9291b6b62c6cbc8fdd219bb9141fa11df75b76688d9e706b59c985 WHIRLPOOL 6ee07613551c3032a39296f516caff0b4f25e2cd0e2431af56b945986000146cdc6f585f607041258aecef9351c6852885082ccd6e3fca3c6c0e32db593d3c21
3
+DIST APC-3.1.13.tgz 171591 SHA256 5ef8ba07729e72946e95951672a5378bed98cb5a294e79bf0f0a97ac62829abd SHA512 4ccfa12a61a9276be207c9b70b108b725cf2faa3ed805bab8c9a39b04039fd16a8da6919ab7d5a84592f7b4a7827dcd9adeb154c6a04d208e7071be22268b332 WHIRLPOOL 335020f6ec44ec188b9544fb4132d2c1c62c4d342c3e07f3bfb0266c3827c311316c95ec08517946481724350314a06e7f3b49b13c0cedf2a2dcd1ca5d38149e
4
+EBUILD pecl-apc-3.1.13.ebuild 1703 SHA256 0137e5ac0ac8fe866b8ea8aa567a57ecf005629bda61ebbce3cd5c2256dda995 SHA512 1b09f8b1a2719ab6d79ec4d01322d39ae9f850c779b11e59202a91d216248c365fc98778b62f2310c54a1039182c3f225f9d2ef741e40241affda8a4e4a30d18 WHIRLPOOL 6f4c6cefce1ff34beeca906cf2e78d945875c8f0f48cd1c3cfd843e2e4c55ff64232a845f75e52b1d4b8e2c44baa2c1bf8acfb12b79c5980616c46a1a0b2485f
... ...
@@ -0,0 +1,86 @@
1
+diff -Naur APC-3.1.13/apc_bin.c APC-3.1.13-fix-warnings/apc_bin.c
2
+--- APC-3.1.13/apc_bin.c	2012-09-03 18:52:51.000000000 +0200
3
++++ APC-3.1.13-fix-warnings/apc_bin.c	2013-01-09 12:40:30.906380305 +0100
4
+@@ -719,7 +719,7 @@
5
+     apc_bd_alloc_ex(pool_ptr, sizeof(apc_pool) TSRMLS_CC);
6
+     ctxt.pool = apc_pool_create(APC_UNPOOL, apc_bd_alloc, apc_bd_free, NULL, NULL TSRMLS_CC);  /* ideally the pool wouldn't be alloc'd as part of this */
7
+     if (!ctxt.pool) { /* TODO need to cleanup */
8
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
9
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
10
+         return NULL;
11
+     }
12
+     ctxt.copy = APC_COPY_IN_OPCODE; /* avoid stupid ALLOC_ZVAL calls here, hack */
13
+@@ -894,7 +894,7 @@
14
+     for(i = 0; i < bd->num_entries; i++) {
15
+         ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
16
+         if (!ctxt.pool) { /* TODO need to cleanup previous pools */
17
+-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
18
++            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
19
+             goto failure;
20
+         }
21
+         ep = &bd->entries[i];
22
+diff -Naur APC-3.1.13/apc_cache.c APC-3.1.13-fix-warnings/apc_cache.c
23
+--- APC-3.1.13/apc_cache.c	2012-09-03 18:52:51.000000000 +0200
24
++++ APC-3.1.13-fix-warnings/apc_cache.c	2013-01-09 12:42:24.598958952 +0100
25
+@@ -1334,6 +1334,7 @@
26
+ /* {{{ apc_cache_is_last_key */
27
+ zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC)
28
+ {
29
++    char *log_message;
30
+     apc_keyid_t *lastkey = &cache->header->lastkey;
31
+     unsigned int keylen = key->data.user.identifier_len;
32
+ #ifdef ZTS
33
+@@ -1350,7 +1351,10 @@
34
+         if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) {
35
+             /* potential cache slam */
36
+             if(APCG(slam_defense)) {
37
+-                apc_debug("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);
38
++                log_message = emalloc((key->data.user.identifier_len + 40) * sizeof(char));
39
++                sprintf(log_message, "Potential cache slam averted for key '%s'", key->data.user.identifier);
40
++                php_log_err(log_message TSRMLS_CC);
41
++                efree(log_message);
42
+                 return 1;
43
+             }
44
+         }
45
+diff -Naur APC-3.1.13/apc_main.c APC-3.1.13-fix-warnings/apc_main.c
46
+--- APC-3.1.13/apc_main.c	2012-09-03 18:52:51.000000000 +0200
47
++++ APC-3.1.13-fix-warnings/apc_main.c	2013-01-09 12:40:30.909380268 +0100
48
+@@ -403,7 +403,7 @@
49
+     ctxt.pool = apc_pool_create(APC_MEDIUM_POOL, apc_sma_malloc, apc_sma_free, 
50
+                                                  apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
51
+     if (!ctxt.pool) {
52
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
53
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
54
+         return FAILURE;
55
+     }
56
+     ctxt.copy = APC_COPY_IN_OPCODE;
57
+@@ -528,7 +528,7 @@
58
+         ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free,
59
+                                                 apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
60
+         if (!ctxt.pool) {
61
+-            apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
62
++            php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
63
+             return old_compile_file(h, type TSRMLS_CC);
64
+         }
65
+         ctxt.copy = APC_COPY_OUT_OPCODE;
66
+diff -Naur APC-3.1.13/php_apc.c APC-3.1.13-fix-warnings/php_apc.c
67
+--- APC-3.1.13/php_apc.c	2012-09-03 18:52:51.000000000 +0200
68
++++ APC-3.1.13-fix-warnings/php_apc.c	2013-01-09 12:41:06.435936125 +0100
69
+@@ -589,7 +589,7 @@
70
+     ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
71
+     if (!ctxt.pool) {
72
+         HANDLE_UNBLOCK_INTERRUPTIONS();
73
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
74
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
75
+         return 0;
76
+     }
77
+     ctxt.copy = APC_COPY_IN_USER;
78
+@@ -838,7 +838,7 @@
79
+ 
80
+     ctxt.pool = apc_pool_create(APC_UNPOOL, apc_php_malloc, apc_php_free, NULL, NULL TSRMLS_CC);
81
+     if (!ctxt.pool) {
82
+-        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
83
++        php_log_err("Unable to allocate memory for pool." TSRMLS_CC);
84
+         RETURN_FALSE;
85
+     }
86
+     ctxt.copy = APC_COPY_OUT_USER;
... ...
@@ -0,0 +1,11 @@
1
+apc.enabled="1"
2
+apc.shm_segments="1"
3
+apc.shm_size="30M"
4
+apc.mmap_file_mask="/tmp/apcphp5.XXXXXX"
5
+apc.file_update_protection="2"
6
+apc.enable_cli="0"
7
+apc.max_file_size="1M"
8
+apc.stat="1"
9
+apc.write_lock="1"
10
+apc.include_once_override="0"
11
+
... ...
@@ -0,0 +1,73 @@
1
+# Copyright 1999-2012 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/dev-php/pecl-apc/pecl-apc-3.1.13.ebuild,v 1.1 2012/09/04 12:29:31 olemarkus Exp $
4
+
5
+EAPI=4
6
+
7
+PHP_EXT_NAME="apc"
8
+PHP_EXT_PECL_PKG="APC"
9
+PHP_EXT_INI="yes"
10
+PHP_EXT_ZENDEXT="no"
11
+DOCS="CHANGELOG INSTALL NOTICE TECHNOTES.txt TODO"
12
+
13
+PHP_EXT_INIFILE="${PN}.ini"
14
+
15
+USE_PHP="php5-3 php5-4"
16
+
17
+inherit php-ext-pecl-r2 confutils eutils
18
+
19
+KEYWORDS="~amd64 ~mips ~ppc ~ppc64 ~x86"
20
+
21
+DESCRIPTION="A free, open, and robust framework for caching and optimizing PHP code."
22
+LICENSE="PHP-3.01"
23
+SLOT="0"
24
+IUSE="mmap"
25
+
26
+DEPEND="!dev-php/eaccelerator !dev-php/xcache"
27
+RDEPEND="${DEPEND}"
28
+
29
+LOCKS="pthreadmutex pthreadrw spinlock semaphore"
30
+
31
+LUSE=""
32
+for l in ${LOCKS}; do
33
+	LUSE+="lock_${l} "
34
+done
35
+
36
+IUSE+=" ${LUSE/lock_pthreadmutex/+lock_pthreadmutex}"
37
+
38
+REQUIRED_USE="^^ ( $LUSE )"
39
+
40
+src_prepare() {
41
+	local slot
42
+	for slot in $(php_get_slots); do
43
+		php_init_slot_env ${slot}
44
+		epatch "${FILESDIR}"/APC-3.1.13-fix-warnings.diff
45
+	done
46
+	php-ext-source-r2_src_prepare
47
+}
48
+
49
+
50
+src_configure() {
51
+	my_conf="--enable-apc"
52
+	enable_extension_enable "apc-mmap" "mmap" 0
53
+
54
+	enable_extension_enable "apc-pthreadmutex" "lock_pthreadmutex" 0
55
+	enable_extension_enable "apc-pthreadrwlocks" "lock_pthreadrw" 0
56
+	enable_extension_enable "apc-spinlocks" "lock_spinlock" 0
57
+	enable_extension_enable "apc-sem" "lock_semaphore" 0
58
+
59
+	php-ext-source-r2_src_configure
60
+}
61
+
62
+src_install() {
63
+	php-ext-pecl-r2_src_install
64
+
65
+	dodir "${PHP_EXT_SHARED_DIR}"
66
+	insinto "${PHP_EXT_SHARED_DIR}"
67
+	doins apc.php
68
+}
69
+
70
+pkg_postinst() {
71
+	elog "The apc.php file shipped with this release of PECL-APC was"
72
+	elog "installed into ${PHP_EXT_SHARED_DIR}/."
73
+}
0 74