From: Tim Yardley Date: Wed, 16 Jan 2008 17:30:17 +0000 (+0000) Subject: update php-apc to 3.0.16, disable pthread mutex's as they are on by default now. X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=63bc55b0bac892ae0fc8e57cf60ec5ca921ea0f0;p=openwrt%2Fsvn-archive%2Fpackages.git update php-apc to 3.0.16, disable pthread mutex's as they are on by default now. SVN-Revision: 10213 --- diff --git a/lang/php5/Makefile b/lang/php5/Makefile index 51201df21..d28e3ebee 100644 --- a/lang/php5/Makefile +++ b/lang/php5/Makefile @@ -270,7 +270,7 @@ else PKG_CONFIGURE_OPTS+= --disable-xml endif ifneq ($(CONFIG_PACKAGE_php5-mod-apc),) - PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap + PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex PKG_CONFIGURE_LIBS+= -lrt else PKG_CONFIGURE_OPTS+= --disable-apc diff --git a/lang/php5/patches/005-APC.patch b/lang/php5/patches/005-APC.patch index 6e2068202..a7e7ee472 100644 --- a/lang/php5/patches/005-APC.patch +++ b/lang/php5/patches/005-APC.patch @@ -1,7 +1,6 @@ -Index: php-5.2.4/ext/apc/apc.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc.c php-5.2.5/ext/apc/apc.c +--- php-5.2.5-orig/ext/apc/apc.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,554 @@ +/* + +----------------------------------------------------------------------+ @@ -34,7 +33,7 @@ Index: php-5.2.4/ext/apc/apc.c + + */ + -+/* $Id: apc.c,v 3.17 2007/03/17 14:01:41 gopalv Exp $ */ ++/* $Id: apc.c,v 3.18 2007/11/29 22:15:53 shire Exp $ */ + +#include "apc.h" +#include /* for POSIX regular expressions */ @@ -179,7 +178,7 @@ Index: php-5.2.4/ext/apc/apc.c + +void apc_dprint(const char* fmt, ...) +{ -+#ifdef APC_DBG ++#ifdef APC_DEBUG + va_list args; + va_start(args, fmt); + my_log(APC_DBG, fmt, args); @@ -557,11 +556,10 @@ Index: php-5.2.4/ext/apc/apc.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_cache.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_cache.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,1328 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_cache.c php-5.2.5/ext/apc/apc_cache.c +--- php-5.2.5-orig/ext/apc/apc_cache.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_cache.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,1343 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -592,7 +590,7 @@ Index: php-5.2.4/ext/apc/apc_cache.c + + */ + -+/* $Id: apc_cache.c,v 3.140 2007/04/02 22:57:10 rasmus Exp $ */ ++/* $Id: apc_cache.c,v 3.145 2007/10/05 23:06:56 gopalv Exp $ */ + +#include "apc_cache.h" +#include "apc_lock.h" @@ -661,6 +659,7 @@ Index: php-5.2.4/ext/apc/apc_cache.c +struct local_slot_t { + slot_t *original; /* the original slot in shm */ + int num_hits; /* number of hits */ ++ time_t creation_time; /* creation time */ + apc_cache_entry_t *value; /* shallow copy of slot->value */ + local_slot_t *next; /* only for dead list */ +}; @@ -870,6 +869,9 @@ Index: php-5.2.4/ext/apc/apc_cache.c + cache_size = sizeof(header_t) + num_slots*sizeof(slot_t*); + + cache->shmaddr = apc_sma_malloc(cache_size); ++ if(!cache->shmaddr) { ++ apc_eprint("Unable to allocate shared memory for cache structures. (Perhaps your shared memory size isn't large enough?). "); ++ } + memset(cache->shmaddr, 0, cache_size); + + cache->header = (header_t*) cache->shmaddr; @@ -1276,11 +1278,10 @@ Index: php-5.2.4/ext/apc/apc_cache.c + time_t t + TSRMLS_DC) +{ -+ static char canon_path[MAXPATHLEN]; + struct stat *tmp_buf=NULL; + struct apc_fileinfo_t fileinfo = { {0}, }; + int len; -+ ++ + assert(key != NULL); + + if (!filename || !SG(request_info).path_translated) { @@ -1298,12 +1299,18 @@ Index: php-5.2.4/ext/apc/apc_cache.c + key->mtime = t; + key->type = APC_CACHE_KEY_FPFILE; + } else { -+ if(!realpath(filename, canon_path)) { -+ fprintf(stderr, "realpath failed to canonicalize %s - bailing\n", filename); ++ if (apc_search_paths(filename, include_path, &fileinfo) != 0) { ++ apc_wprint("apc failed to locate %s - bailing", filename); ++ return 0; ++ } ++ ++ if(!realpath(fileinfo.fullpath, APCG(canon_path))) { ++ apc_wprint("realpath failed to canonicalize %s - bailing", filename); + return 0; + } -+ key->data.fpfile.fullpath = canon_path; -+ key->data.fpfile.fullpath_len = strlen(canon_path); ++ ++ key->data.fpfile.fullpath = APCG(canon_path); ++ key->data.fpfile.fullpath_len = strlen(APCG(canon_path)); + key->mtime = t; + key->type = APC_CACHE_KEY_FPFILE; + } @@ -1417,7 +1424,6 @@ Index: php-5.2.4/ext/apc/apc_cache.c + entry->type = APC_CACHE_ENTRY_FILE; + entry->ref_count = 0; + entry->mem_size = 0; -+ entry->autofiltered = 0; + entry->local = 0; + return entry; +} @@ -1559,7 +1565,6 @@ Index: php-5.2.4/ext/apc/apc_cache.c + entry->type = APC_CACHE_ENTRY_USER; + entry->ref_count = 0; + entry->mem_size = 0; -+ entry->autofiltered = 0; + entry->local = 0; + return entry; +} @@ -1735,7 +1740,7 @@ Index: php-5.2.4/ext/apc/apc_cache.c +#endif + +/* {{{ make_local_slot */ -+static local_slot_t* make_local_slot(apc_local_cache_t* cache, local_slot_t* lslot, slot_t* slot) ++static local_slot_t* make_local_slot(apc_local_cache_t* cache, local_slot_t* lslot, slot_t* slot, time_t t) +{ + apc_cache_entry_t* value; + @@ -1745,7 +1750,8 @@ Index: php-5.2.4/ext/apc/apc_cache.c + + lslot->original = slot; + lslot->value = value; -+ lslot->num_hits++; ++ lslot->num_hits = 0; ++ lslot->creation_time = t; + + return lslot; /* for what joy ? ... consistency */ +} @@ -1797,10 +1803,11 @@ Index: php-5.2.4/ext/apc/apc_cache.c + + int i; + for(i = 0; i < cache->num_slots; i++) { -+ slot_t * slot = cache->slots[i].original; -+ if((slot && slot->access_time < (t - cache->ttl)) || ++ lslot = &cache->slots[i]; ++ /* every slot lives for exactly TTL seconds */ ++ if((lslot->original && lslot->creation_time < (t - cache->ttl)) || + cache->generation != cache->shmcache->header->expunges) { -+ free_local_slot(cache, &cache->slots[i]); ++ free_local_slot(cache, lslot); + } + } + @@ -1856,9 +1863,15 @@ Index: php-5.2.4/ext/apc/apc_cache.c + free_local_slot(cache, lslot); + goto not_found; + } ++ cache->num_hits++; ++ lslot->num_hits++; ++ lslot->original->access_time = t; /* unlocked write, but last write wins */ + return lslot->value; + } else if(key.type == APC_CACHE_KEY_FPFILE) { + if(!memcmp(slot->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) { ++ cache->num_hits++; ++ lslot->num_hits++; ++ lslot->original->access_time = t; /* unlocked write, but last write wins */ + return lslot->value; + } + } @@ -1875,7 +1888,7 @@ Index: php-5.2.4/ext/apc/apc_cache.c + /* i.e maintain a sort of top list */ + if(lslot->original == NULL || (lslot->original->num_hits + lslot->num_hits) < slot->num_hits) { + free_local_slot(cache, lslot); -+ make_local_slot(cache, lslot, slot); ++ make_local_slot(cache, lslot, slot, t); + return lslot->value; + } + return slot->value; @@ -1890,11 +1903,10 @@ Index: php-5.2.4/ext/apc/apc_cache.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_cache.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_cache.h 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,313 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_cache.h php-5.2.5/ext/apc/apc_cache.h +--- php-5.2.5-orig/ext/apc/apc_cache.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_cache.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,312 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -1923,7 +1935,7 @@ Index: php-5.2.4/ext/apc/apc_cache.h + + */ + -+/* $Id: apc_cache.h,v 3.45 2007/03/22 16:03:59 gopalv Exp $ */ ++/* $Id: apc_cache.h,v 3.46 2007/10/05 23:06:56 gopalv Exp $ */ + +#ifndef APC_CACHE_H +#define APC_CACHE_H @@ -1990,7 +2002,6 @@ Index: php-5.2.4/ext/apc/apc_cache.h +struct apc_cache_entry_t { + apc_cache_entry_value_t data; + unsigned char type; -+ unsigned char autofiltered; + unsigned char local; + int ref_count; + size_t mem_size; @@ -2208,11 +2219,10 @@ Index: php-5.2.4/ext/apc/apc_cache.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_compile.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_compile.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,2530 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_compile.c php-5.2.5/ext/apc/apc_compile.c +--- php-5.2.5-orig/ext/apc/apc_compile.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_compile.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,2529 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -2243,7 +2253,7 @@ Index: php-5.2.4/ext/apc/apc_compile.c + + */ + -+/* $Id: apc_compile.c,v 3.85 2007/03/28 07:35:55 gopalv Exp $ */ ++/* $Id: apc_compile.c,v 3.87 2007/08/25 13:09:13 gopalv Exp $ */ + +#include "apc_compile.h" +#include "apc_globals.h" @@ -3481,11 +3491,10 @@ Index: php-5.2.4/ext/apc/apc_compile.c + if((zo->opcode == ZEND_INCLUDE_OR_EVAL) && + (zo->op1.op_type == IS_CONST && zo->op1.u.constant.type == IS_STRING)) { + /* constant includes */ -+ if(!IS_ABSOLUTE_PATH(Z_STRVAL_P(&zo->op1.u.constant),len)) { ++ if(!IS_ABSOLUTE_PATH(Z_STRVAL_P(&zo->op1.u.constant),Z_STRLEN_P(&zo->op1.u.constant))) { + if (apc_search_paths(Z_STRVAL_P(&zo->op1.u.constant), PG(include_path), &fileinfo) == 0) { -+ if((IS_ABSOLUTE_PATH(fileinfo.fullpath, strlen(fileinfo.fullpath)) && (fullpath = fileinfo.fullpath)) -+ || (fullpath = realpath(fileinfo.fullpath, canon_path))) { -+ /* is either an absolute path or it goes through a realpath() */ ++ if((fullpath = realpath(fileinfo.fullpath, canon_path))) { ++ /* everything has to go through a realpath() */ + zend_op *dzo = &(dst->opcodes[i]); + deallocate(dzo->op1.u.constant.value.str.val); + dzo->op1.u.constant.value.str.len = strlen(fullpath); @@ -4743,10 +4752,9 @@ Index: php-5.2.4/ext/apc/apc_compile.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_compile.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_compile.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_compile.h php-5.2.5/ext/apc/apc_compile.h +--- php-5.2.5-orig/ext/apc/apc_compile.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_compile.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,134 @@ +/* + +----------------------------------------------------------------------+ @@ -4882,10 +4890,9 @@ Index: php-5.2.4/ext/apc/apc_compile.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_debug.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_debug.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_debug.c php-5.2.5/ext/apc/apc_debug.c +--- php-5.2.5-orig/ext/apc/apc_debug.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_debug.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ @@ -4944,16 +4951,14 @@ Index: php-5.2.4/ext/apc/apc_debug.c + } +#endif +} -Index: php-5.2.4/ext/apc/apc_debug.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_debug.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_debug.h php-5.2.5/ext/apc/apc_debug.h +--- php-5.2.5-orig/ext/apc/apc_debug.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_debug.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1 @@ +void dump(zend_op_array * TSRMLS_DC); -Index: php-5.2.4/ext/apc/apc.dsp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc.dsp 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc.dsp php-5.2.5/ext/apc/apc.dsp +--- php-5.2.5-orig/ext/apc/apc.dsp 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc.dsp 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,207 @@ +# Microsoft Developer Studio Project File - Name="apc" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 @@ -5162,10 +5167,9 @@ Index: php-5.2.4/ext/apc/apc.dsp +# End Group +# End Target +# End Project -Index: php-5.2.4/ext/apc/apc_fcntl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_fcntl.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_fcntl.c php-5.2.5/ext/apc/apc_fcntl.c +--- php-5.2.5-orig/ext/apc/apc_fcntl.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_fcntl.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,118 @@ +/* + +----------------------------------------------------------------------+ @@ -5285,10 +5289,9 @@ Index: php-5.2.4/ext/apc/apc_fcntl.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_fcntl.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_fcntl.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_fcntl.h php-5.2.5/ext/apc/apc_fcntl.h +--- php-5.2.5-orig/ext/apc/apc_fcntl.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_fcntl.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ @@ -5340,10 +5343,9 @@ Index: php-5.2.4/ext/apc/apc_fcntl.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_fcntl_win32.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_fcntl_win32.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_fcntl_win32.c php-5.2.5/ext/apc/apc_fcntl_win32.c +--- php-5.2.5-orig/ext/apc/apc_fcntl_win32.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_fcntl_win32.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,117 @@ +/* + +----------------------------------------------------------------------+ @@ -5462,10 +5464,9 @@ Index: php-5.2.4/ext/apc/apc_fcntl_win32.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_futex.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_futex.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_futex.c php-5.2.5/ext/apc/apc_futex.c +--- php-5.2.5-orig/ext/apc/apc_futex.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_futex.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,116 @@ +/* + +----------------------------------------------------------------------+ @@ -5583,10 +5584,9 @@ Index: php-5.2.4/ext/apc/apc_futex.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_futex.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_futex.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_futex.h php-5.2.5/ext/apc/apc_futex.h +--- php-5.2.5-orig/ext/apc/apc_futex.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_futex.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ @@ -5643,11 +5643,10 @@ Index: php-5.2.4/ext/apc/apc_futex.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_globals.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_globals.h 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,110 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_globals.h php-5.2.5/ext/apc/apc_globals.h +--- php-5.2.5-orig/ext/apc/apc_globals.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_globals.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -5679,12 +5678,12 @@ Index: php-5.2.4/ext/apc/apc_globals.h + + */ + -+/* $Id: apc_globals.h,v 3.59 2007/03/21 21:07:28 rasmus Exp $ */ ++/* $Id: apc_globals.h,v 3.70 2007/12/26 22:46:33 rasmus Exp $ */ + +#ifndef APC_GLOBALS_H +#define APC_GLOBALS_H + -+#define APC_VERSION "3.0.14" ++#define APC_VERSION "3.0.16" + +#include "apc_cache.h" +#include "apc_stack.h" @@ -5724,6 +5723,9 @@ Index: php-5.2.4/ext/apc/apc_globals.h + apc_optimize_function_t apc_optimize_function; /* optimizer function callback */ +#ifdef MULTIPART_EVENT_FORMDATA + zend_bool rfc1867; /* Flag to enable rfc1867 handler */ ++ char* rfc1867_prefix; /* Key prefix */ ++ char* rfc1867_name; /* Name of hidden field to activate upload progress/key suffix */ ++ double rfc1867_freq; /* Update frequency as percentage or bytes */ +#endif + HashTable *copied_zvals; /* my_copy recursion detection list */ +#ifdef ZEND_ENGINE_2 @@ -5732,6 +5734,12 @@ Index: php-5.2.4/ext/apc/apc_globals.h + zend_bool localcache; /* enable local cache */ + long localcache_size; /* size of fast cache */ + apc_local_cache_t* lcache; /* unlocked local cache */ ++ zend_bool force_file_update; /* force files to be updated during apc_compile_file */ ++ char canon_path[MAXPATHLEN]; /* canonical path for key data */ ++#if APC_FILEHITS ++ zval *filehits; /* Files that came from the cache for this request */ ++#endif ++ zend_bool coredump_unmap; /* Trap signals that coredump and unmap shared memory */ +ZEND_END_MODULE_GLOBALS(apc) + +/* (the following declaration is defined in php_apc.c) */ @@ -5758,10 +5766,9 @@ Index: php-5.2.4/ext/apc/apc_globals.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc.h php-5.2.5/ext/apc/apc.h +--- php-5.2.5-orig/ext/apc/apc.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,126 @@ +/* + +----------------------------------------------------------------------+ @@ -5889,10 +5896,9 @@ Index: php-5.2.4/ext/apc/apc.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_lock.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_lock.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_lock.h php-5.2.5/ext/apc/apc_lock.h +--- php-5.2.5-orig/ext/apc/apc_lock.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_lock.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,105 @@ +/* + +----------------------------------------------------------------------+ @@ -5999,11 +6005,10 @@ Index: php-5.2.4/ext/apc/apc_lock.h +#endif + +#endif -Index: php-5.2.4/ext/apc/apc_main.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_main.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,681 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_main.c php-5.2.5/ext/apc/apc_main.c +--- php-5.2.5-orig/ext/apc/apc_main.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_main.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,701 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -6034,7 +6039,7 @@ Index: php-5.2.4/ext/apc/apc_main.c + + */ + -+/* $Id: apc_main.c,v 3.97 2007/03/22 16:03:59 gopalv Exp $ */ ++/* $Id: apc_main.c,v 3.103 2007/11/14 19:46:46 shire Exp $ */ + +#include "apc_php.h" +#include "apc_main.h" @@ -6264,7 +6269,6 @@ Index: php-5.2.4/ext/apc/apc_main.c + +default_compile: + -+ cache_entry->autofiltered = 1; + if(APCG(report_autofilter)) { + apc_wprint("Autofiltering %s", h->opened_path); + } @@ -6276,14 +6280,16 @@ Index: php-5.2.4/ext/apc/apc_main.c + } + + apc_stack_pop(APCG(cache_stack)); /* pop out cache_entry */ ++ ++ apc_cache_release(apc_cache, cache_entry); + + /* cannot free up cache data yet, it maybe in use */ + + zend_llist_del_element(&CG(open_files), h, compare_file_handles); /* XXX: kludge */ + + h->type = ZEND_HANDLE_FILENAME; -+ -+ return old_compile_file(h, type TSRMLS_CC); ++ ++ return NULL; +} +/* }}} */ + @@ -6317,7 +6323,7 @@ Index: php-5.2.4/ext/apc/apc_main.c + return old_compile_file(h, type TSRMLS_CC); + } + -+#if PHP_API_VERSION <= 20041225 ++#if PHP_API_VERSION < 20041225 +#if HAVE_APACHE && defined(APC_PHP4_STAT) + t = ((request_rec *)SG(server_context))->request_time; +#else @@ -6336,15 +6342,20 @@ Index: php-5.2.4/ext/apc/apc_main.c + return old_compile_file(h, type TSRMLS_CC); + } + -+ if(APCG(localcache)) { -+ /* search for the file in the local cache */ -+ cache_entry = apc_local_cache_find(APCG(lcache), key, t); ++ ++ if(!APCG(force_file_update)) { ++ if(APCG(localcache)) { ++ /* search for the file in the local cache */ ++ cache_entry = apc_local_cache_find(APCG(lcache), key, t); ++ } else { ++ /* search for the file in the cache */ ++ cache_entry = apc_cache_find(apc_cache, key, t); ++ } + } else { -+ /* search for the file in the cache */ -+ cache_entry = apc_cache_find(apc_cache, key, t); ++ cache_entry = NULL; + } + -+ if (cache_entry != NULL && !cache_entry->autofiltered) { ++ if (cache_entry != NULL) { + int dummy = 1; + if (h->opened_path == NULL) { + h->opened_path = estrdup(cache_entry->data.file.filename); @@ -6352,27 +6363,18 @@ Index: php-5.2.4/ext/apc/apc_main.c + zend_hash_add(&EG(included_files), h->opened_path, strlen(h->opened_path)+1, (void *)&dummy, sizeof(int), NULL); + zend_llist_add_element(&CG(open_files), h); /* XXX kludge */ + apc_stack_push(APCG(cache_stack), cache_entry); -+ return cached_compile(h, type TSRMLS_CC); -+ } -+ else if(cache_entry != NULL && cache_entry->autofiltered) { -+ /* nobody else is using this cache_entry */ -+ if(cache_entry->ref_count == 1) { -+ if(cache_entry->data.file.op_array) { -+ apc_free_op_array(cache_entry->data.file.op_array, apc_sma_free); -+ cache_entry->data.file.op_array = NULL; -+ } -+ if(cache_entry->data.file.functions) { -+ apc_free_functions(cache_entry->data.file.functions, apc_sma_free); -+ cache_entry->data.file.functions = NULL; -+ } -+ if(cache_entry->data.file.classes) { -+ apc_free_classes(cache_entry->data.file.classes, apc_sma_free); -+ cache_entry->data.file.classes = NULL; -+ } ++ op_array = cached_compile(h, type TSRMLS_CC); ++ if(op_array) { ++#ifdef APC_FILEHITS ++ /* If the file comes from the cache, add it to the global request file list */ ++ add_next_index_string(APCG(filehits), h->filename, 1); ++#endif ++ return op_array; + } -+ /* We never push this into the cache_stack, so we have to do a release */ -+ apc_cache_release(apc_cache, cache_entry); -+ return old_compile_file(h, type TSRMLS_CC); ++ if(APCG(report_autofilter)) { ++ apc_wprint("Recompiling %s", h->opened_path); ++ } ++ /* TODO: check what happens with EG(included_files) */ + } + + if(apc_cache_busy(apc_cache) && APCG(localcache)) { @@ -6408,6 +6410,26 @@ Index: php-5.2.4/ext/apc/apc_main.c + } + } + ++ /* Make sure the mtime reflects the files last known mtime in the case of fpstat==0 */ ++ if(key.type == APC_CACHE_KEY_FPFILE) { ++ apc_fileinfo_t fileinfo; ++ struct stat *tmp_buf = NULL; ++ if(!strcmp(SG(request_info).path_translated, h->filename)) { ++ tmp_buf = sapi_get_stat(TSRMLS_C); /* Apache has already done this stat() for us */ ++ } ++ if(tmp_buf) { ++ fileinfo.st_buf = *tmp_buf; ++ } else { ++ if (apc_search_paths(h->filename, PG(include_path), &fileinfo) != 0) { ++#ifdef __DEBUG_APC__ ++ fprintf(stderr,"Stat failed %s - bailing (%s) (%d)\n",filename,SG(request_info).path_translated); ++#endif ++ return op_array; ++ } ++ } ++ key.mtime = fileinfo.st_buf.st_mtime; ++ } ++ + HANDLE_BLOCK_INTERRUPTIONS(); + +#if NONBLOCKING_LOCK_AVAILABLE @@ -6607,12 +6629,23 @@ Index: php-5.2.4/ext/apc/apc_main.c + apc_stack_clear(APCG(cache_stack)); + APCG(slam_rand) = -1; + APCG(copied_zvals) = NULL; ++ ++#ifdef APC_FILEHITS ++ ALLOC_INIT_ZVAL(APCG(filehits)); ++ array_init(APCG(filehits)); ++#endif ++ + return 0; +} + +int apc_request_shutdown(TSRMLS_D) +{ + apc_deactivate(TSRMLS_C); ++ ++#ifdef APC_FILEHITS ++ zval_ptr_dtor(&APCG(filehits)); ++#endif ++ + return 0; +} + @@ -6635,14 +6668,6 @@ Index: php-5.2.4/ext/apc/apc_main.c + apc_cache_entry_t* cache_entry = + (apc_cache_entry_t*) apc_stack_pop(APCG(cache_stack)); + -+ if (cache_entry->data.file.functions) { -+ for (i = 0; cache_entry->data.file.functions[i].function != NULL; i++) { -+ zend_hash_del(EG(function_table), -+ cache_entry->data.file.functions[i].name, -+ cache_entry->data.file.functions[i].name_len+1); -+ } -+ } -+ + if (cache_entry->data.file.classes) { + for (i = 0; cache_entry->data.file.classes[i].class_entry != NULL; i++) { +#ifdef ZEND_ENGINE_2 @@ -6685,10 +6710,9 @@ Index: php-5.2.4/ext/apc/apc_main.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_main.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_main.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_main.h php-5.2.5/ext/apc/apc_main.h +--- php-5.2.5-orig/ext/apc/apc_main.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_main.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ @@ -6757,11 +6781,10 @@ Index: php-5.2.4/ext/apc/apc_main.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_mmap.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_mmap.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,137 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_mmap.c php-5.2.5/ext/apc/apc_mmap.c +--- php-5.2.5-orig/ext/apc/apc_mmap.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_mmap.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,139 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -6789,7 +6812,7 @@ Index: php-5.2.4/ext/apc/apc_mmap.c + + */ + -+/* $Id: apc_mmap.c,v 3.5 2006/03/12 00:31:45 rasmus Exp $ */ ++/* $Id: apc_mmap.c,v 3.7 2007/12/20 23:00:51 shire Exp $ */ + +#include "apc.h" + @@ -6810,7 +6833,7 @@ Index: php-5.2.4/ext/apc/apc_mmap.c +#define MAP_NOSYNC 0 +#endif + -+void *apc_mmap(char *file_mask, int size) ++void *apc_mmap(char *file_mask, size_t size) +{ + void* shmaddr; /* the shared memory address */ + @@ -6884,9 +6907,11 @@ Index: php-5.2.4/ext/apc/apc_mmap.c + return shmaddr; +} + -+void apc_unmap(void* shmaddr, int size) ++void apc_unmap(void* shmaddr, size_t size) +{ -+ munmap(shmaddr, size); ++ if (munmap(shmaddr, size) < 0) { ++ apc_wprint("apc_unmap: munmap failed:"); ++ } +} + +#endif @@ -6899,11 +6924,10 @@ Index: php-5.2.4/ext/apc/apc_mmap.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc.php -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc.php 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,1313 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc.php php-5.2.5/ext/apc/apc.php +--- php-5.2.5-orig/ext/apc/apc.php 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc.php 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,1326 @@ + '/^\d+$/', // operational mode switch + 'CC' => '/^[01]$/', // clear cache requested ++ 'DU' => '/^.*$/', // Delete User Key + 'SH' => '/^[a-z0-9]+$/', // shared object description + + 'IMG' => '/^[123]$/', // image to generate @@ -6991,7 +7016,7 @@ Index: php-5.2.4/ext/apc/apc.php + 'SORT1' => '/^[AHSMCDTZ]$/', // first sort key + 'SORT2' => '/^[DA]$/', // second sort key + 'AGGR' => '/^\d+$/', // aggregation by dir level -+ 'SEARCH' => '/^.*$/' // aggregation by dir level ++ 'SEARCH' => '~^[a-zA-Z0-1/_.-]*$~' // aggregation by dir level +); + +// default cache mode @@ -7020,7 +7045,7 @@ Index: php-5.2.4/ext/apc/apc.php +foreach($vardom as $var => $dom) { + if (!isset($_REQUEST[$var])) { + $MYREQUEST[$var]=NULL; -+ } else if (!is_array($_REQUEST[$var]) && preg_match($dom,$_REQUEST[$var])) { ++ } else if (!is_array($_REQUEST[$var]) && preg_match($dom.'D',$_REQUEST[$var])) { + $MYREQUEST[$var]=$_REQUEST[$var]; + } else { + $MYREQUEST[$var]=$_REQUEST[$var]=NULL; @@ -7085,6 +7110,10 @@ Index: php-5.2.4/ext/apc/apc.php + apc_clear_cache($cache_mode); +} + ++if ($AUTHENTICATED && !empty($MYREQUEST['DU'])) { ++ apc_delete($MYREQUEST['DU']); ++} ++ +if(!function_exists('apc_cache_info') || !($cache=@apc_cache_info($cache_mode))) { + echo "No cache info available. APC does not appear to be running."; + exit; @@ -7835,7 +7864,6 @@ Index: php-5.2.4/ext/apc/apc.php + $fieldheading='User Entry Label'; + $fieldkey='info'; + -+ +// ----------------------------------------------- +// System Cache Entries +// ----------------------------------------------- @@ -7999,9 +8027,18 @@ Index: php-5.2.4/ext/apc/apc.php + else + echo 'None'; + } -+ echo -+ '',$entry['deletion_time'] ? date(DATE_FORMAT,$entry['deletion_time']) : '-','', -+ ''; ++ if ($entry['deletion_time']) { ++ ++ echo '', date(DATE_FORMAT,$entry['deletion_time']), ''; ++ } else if ($MYREQUEST['OB'] == OB_USER_CACHE) { ++ ++ echo ''; ++ echo '[Delete Now]'; ++ echo ''; ++ } else { ++ echo '   '; ++ } ++ echo ''; + $i++; + if ($i == $MYREQUEST['COUNT']) + break; @@ -8217,10 +8254,9 @@ Index: php-5.2.4/ext/apc/apc.php + + + -Index: php-5.2.4/ext/apc/apc_php.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_php.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_php.h php-5.2.5/ext/apc/apc_php.h +--- php-5.2.5-orig/ext/apc/apc_php.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_php.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ @@ -8293,11 +8329,10 @@ Index: php-5.2.4/ext/apc/apc_php.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_pthreadmutex.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_pthreadmutex.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,104 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_pthreadmutex.c php-5.2.5/ext/apc/apc_pthreadmutex.c +--- php-5.2.5-orig/ext/apc/apc_pthreadmutex.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_pthreadmutex.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,111 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -8317,7 +8352,7 @@ Index: php-5.2.4/ext/apc/apc_pthreadmutex.c + + */ + -+/* $Id: apc_pthreadmutex.c,v 3.2 2007/02/15 21:40:45 shire Exp $ */ ++/* $Id: apc_pthreadmutex.c,v 3.3 2007/12/21 01:36:51 shire Exp $ */ + +#include "apc_pthreadmutex.h" + @@ -8338,6 +8373,13 @@ Index: php-5.2.4/ext/apc/apc_pthreadmutex.c + apc_eprint("pthread mutex error: attr is an invalid pointer."); + } + ++#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP ++ result = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_ADAPTIVE_NP); ++ if (result == EINVAL) { ++ apc_eprint("pthread_mutexattr_settype: unable to set adaptive mutexes"); ++ } ++#endif ++ + /* pthread_mutexattr_settype(attr, PTHREAD_MUTEX_ERRORCHECK); */ + result = pthread_mutexattr_setpshared(attr, PTHREAD_PROCESS_SHARED); + if(result == EINVAL) { @@ -8402,10 +8444,9 @@ Index: php-5.2.4/ext/apc/apc_pthreadmutex.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_pthreadmutex.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_pthreadmutex.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_pthreadmutex.h php-5.2.5/ext/apc/apc_pthreadmutex.h +--- php-5.2.5-orig/ext/apc/apc_pthreadmutex.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_pthreadmutex.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ @@ -8455,11 +8496,10 @@ Index: php-5.2.4/ext/apc/apc_pthreadmutex.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_rfc1867.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_rfc1867.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,175 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_rfc1867.c php-5.2.5/ext/apc/apc_rfc1867.c +--- php-5.2.5-orig/ext/apc/apc_rfc1867.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_rfc1867.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,195 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -8487,11 +8527,16 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + + */ + -+/* $Id: apc_rfc1867.c,v 3.4 2007/02/24 11:45:29 rasmus Exp $*/ ++/* $Id: apc_rfc1867.c,v 3.12 2007/10/18 20:37:20 rasmus Exp $*/ + +#include "apc.h" ++#include "apc_globals.h" +#include "rfc1867.h" + ++#ifdef PHP_WIN32 ++#include "win32/time.h" ++#endif ++ +#ifdef MULTIPART_EVENT_FORMDATA +extern int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int ttl, const int exclusive TSRMLS_DC); + @@ -8499,7 +8544,7 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + struct timeval a; + double t; + gettimeofday(&a, NULL); -+ t = a.tv_sec + (a.tv_usec/1000000); ++ t = a.tv_sec + (a.tv_usec/1000000.00); + return t; +} + @@ -8513,6 +8558,8 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + static int cancel_upload = 0; + static double start_time; + static size_t bytes_processed = 0; ++ static size_t prev_bytes_processed = 0; ++ static int update_freq = 0; + static double rate; + zval *track = NULL; + @@ -8530,17 +8577,21 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + start_time = my_time(); + bytes_processed = 0; + rate = 0; ++ update_freq = APCG(rfc1867_freq); ++ if(update_freq < 0) { // frequency is a percentage, not bytes ++ update_freq = content_length * APCG(rfc1867_freq) / 100; ++ } + } + break; + + case MULTIPART_EVENT_FORMDATA: + { ++ int prefix_len = strlen(APCG(rfc1867_prefix)); + multipart_event_formdata *data = (multipart_event_formdata *) event_data; -+ -+ if(data->name && !strncasecmp(data->name,"apc_upload_progress",19) && data->value && data->length && data->length < 58) { -+ strlcat(tracking_key, "upload_", 63); ++ if(data->name && !strncasecmp(data->name, APCG(rfc1867_name), strlen(APCG(rfc1867_name))) && data->value && data->length && data->length < sizeof(tracking_key) - prefix_len) { ++ strlcat(tracking_key, APCG(rfc1867_prefix), 63); + strlcat(tracking_key, *data->value, 63); -+ key_length = data->length+7; ++ key_length = data->length + prefix_len; + bytes_processed = data->post_bytes_processed; + } + } @@ -8561,6 +8612,7 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + add_assoc_string(track, "filename", filename, 1); + add_assoc_string(track, "name", name, 1); + add_assoc_long(track, "done", 0); ++ add_assoc_double(track, "start_time", start_time); + _apc_store(tracking_key, key_length, track, 3600, 0 TSRMLS_CC); + zval_ptr_dtor(&track); + } @@ -8577,7 +8629,11 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + add_assoc_string(track, "filename", filename, 1); + add_assoc_string(track, "name", name, 1); + add_assoc_long(track, "done", 0); -+ _apc_store(tracking_key, key_length, track, 3600, 0 TSRMLS_CC); ++ add_assoc_double(track, "start_time", start_time); ++ if(bytes_processed - prev_bytes_processed > update_freq) { ++ _apc_store(tracking_key, key_length, track, 3600, 0 TSRMLS_CC); ++ prev_bytes_processed = bytes_processed; ++ } + zval_ptr_dtor(&track); + } + break; @@ -8597,6 +8653,7 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + add_assoc_string(track, "temp_filename", temp_filename, 1); + add_assoc_long(track, "cancel_upload", cancel_upload); + add_assoc_long(track, "done", 0); ++ add_assoc_double(track, "start_time", start_time); + _apc_store(tracking_key, key_length, track, 3600, 0 TSRMLS_CC); + zval_ptr_dtor(&track); + } @@ -8616,9 +8673,12 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + add_assoc_double(track, "rate", rate); + add_assoc_string(track, "filename", filename, 1); + add_assoc_string(track, "name", name, 1); -+ add_assoc_string(track, "temp_filename", temp_filename, 1); ++ if(temp_filename) { ++ add_assoc_string(track, "temp_filename", temp_filename, 1); ++ } + add_assoc_long(track, "cancel_upload", cancel_upload); + add_assoc_long(track, "done", 1); ++ add_assoc_double(track, "start_time", start_time); + _apc_store(tracking_key, key_length, track, 3600, 0 TSRMLS_CC); + zval_ptr_dtor(&track); + } @@ -8635,10 +8695,9 @@ Index: php-5.2.4/ext/apc/apc_rfc1867.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_sem.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_sem.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_sem.c php-5.2.5/ext/apc/apc_sem.c +--- php-5.2.5-orig/ext/apc/apc_sem.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_sem.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,177 @@ +/* + +----------------------------------------------------------------------+ @@ -8817,10 +8876,9 @@ Index: php-5.2.4/ext/apc/apc_sem.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_sem.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_sem.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_sem.h php-5.2.5/ext/apc/apc_sem.h +--- php-5.2.5-orig/ext/apc/apc_sem.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_sem.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ @@ -8873,11 +8931,10 @@ Index: php-5.2.4/ext/apc/apc_sem.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_shm.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_shm.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,111 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_shm.c php-5.2.5/ext/apc/apc_shm.c +--- php-5.2.5-orig/ext/apc/apc_shm.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_shm.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,110 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -8906,11 +8963,10 @@ Index: php-5.2.4/ext/apc/apc_shm.c + + */ + -+/* $Id: apc_shm.c,v 3.10 2006/05/31 22:24:48 rasmus Exp $ */ ++/* $Id: apc_shm.c,v 3.11 2007/05/09 22:15:33 shire Exp $ */ + +#include "apc_shm.h" +#include "apc.h" -+#include +#ifdef PHP_WIN32 +/* shm functions are available in TSRM */ +#include @@ -8928,7 +8984,7 @@ Index: php-5.2.4/ext/apc/apc_shm.c +# define SHM_A 0222 /* write permission */ +#endif + -+int apc_shm_create(const char* pathname, int proj, int size) ++int apc_shm_create(const char* pathname, int proj, size_t size) +{ + int shmid; /* shared memory id */ + int oflag; /* permissions on shm */ @@ -8989,11 +9045,10 @@ Index: php-5.2.4/ext/apc/apc_shm.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_shm.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_shm.h 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,49 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_shm.h php-5.2.5/ext/apc/apc_shm.h +--- php-5.2.5-orig/ext/apc/apc_shm.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_shm.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -9021,14 +9076,19 @@ Index: php-5.2.4/ext/apc/apc_shm.h + + */ + -+/* $Id: apc_shm.h,v 3.6 2006/03/12 00:31:45 rasmus Exp $ */ ++/* $Id: apc_shm.h,v 3.8 2007/05/23 01:23:21 auroraeosrose Exp $ */ + +#ifndef APC_SHM_H +#define APC_SHM_H + ++#include ++#ifdef PHP_WIN32 ++#include ++#endif ++ +/* Wrapper functions for unix shared memory */ + -+extern int apc_shm_create(const char* name, int proj, int size); ++extern int apc_shm_create(const char* name, int proj, size_t size); +extern void apc_shm_destroy(int shmid); +extern void* apc_shm_attach(int shmid); +extern void apc_shm_detach(void* shmaddr); @@ -9043,11 +9103,246 @@ Index: php-5.2.4/ext/apc/apc_shm.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_sma.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_sma.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,624 @@ +diff -ubrN php-5.2.5-orig/ext/apc/apc_signal.c php-5.2.5/ext/apc/apc_signal.c +--- php-5.2.5-orig/ext/apc/apc_signal.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_signal.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,178 @@ ++/* ++ +----------------------------------------------------------------------+ ++ | APC | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2006 The PHP Group | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.01 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_01.txt | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Authors: Lucas Nealan | ++ +----------------------------------------------------------------------+ ++ ++ This software was contributed to PHP by Facebook Inc. in 2007. ++ ++ Future revisions and derivatives of this source code must acknowledge ++ Facebook Inc. as the original contributor of this module by leaving ++ this note intact in the source code. ++ ++ All other licensing and usage conditions are those of the PHP Group. ++ */ ++ ++ /* $Id: apc_signal.c,v 1.2 2007/12/26 22:38:43 rasmus Exp $ */ ++ ++ /* Allows apc to install signal handlers and maintain signalling ++ to already registered handlers. Registers all signals that ++ coredump by default and unmaps the shared memory segment ++ before the coredump. Note: PHP module init is called before ++ signals are set by Apache and thus apc_set_signals should ++ be called in request init (RINIT) ++ */ ++ ++#include ++#include "apc_globals.h" ++#include "apc_sma.h" ++#include "apc_signal.h" ++ ++static apc_signal_info_t apc_signal_info = {0}; ++ ++static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*)); ++static void apc_rehandle_signal(int signo, siginfo_t *siginfo, void *context); ++static void apc_core_unmap(int signo, siginfo_t *siginfo, void *context); ++ ++/* {{{ apc_core_unmap ++ * Coredump signal handler, unmaps shm and calls previously installed handlers ++ */ ++static void apc_core_unmap(int signo, siginfo_t *siginfo, void *context) ++{ ++ apc_sma_cleanup(); ++ apc_rehandle_signal(signo, siginfo, context); ++ ++#if !defined(WIN32) && !defined(NETWARE) ++ kill(getpid(), signo); ++#else ++ raise(signo); ++#endif ++} /* }}} */ ++ ++/* {{{ apc_rehandle_signal ++ * Call the previously registered handler for a signal ++ */ ++static void apc_rehandle_signal(int signo, siginfo_t *siginfo, void *context) ++{ ++ int i; ++ apc_signal_entry_t p_sig = {0}; ++ ++ for (i=0; (i < apc_signal_info.installed && p_sig.signo != signo); i++) { ++ p_sig = *apc_signal_info.prev[i]; ++ if (p_sig.signo == signo) { ++ if (p_sig.siginfo) { ++ (*(void (*)(int, siginfo_t*, void*))p_sig.handler)(signo, siginfo, context); ++ } else { ++ (*(void (*)(int))p_sig.handler)(signo); ++ } ++ } ++ } ++ ++} /* }}} */ ++ ++/* {{{ apc_register_signal ++ * Set a handler for a previously installed signal and save so we can ++ * callback when handled ++ */ ++static int apc_register_signal(int signo, void (*handler)(int, siginfo_t*, void*)) ++{ ++#if HAVE_SIGACTION ++ struct sigaction sa = {0}; ++ apc_signal_entry_t p_sig = {0}; ++ ++ if (sigaction(signo, NULL, &sa) == 0) { ++ if ((void*)sa.sa_handler == (void*)handler) { ++ return SUCCESS; ++ } ++ ++ if (sa.sa_handler != SIG_ERR && sa.sa_handler != SIG_DFL && sa.sa_handler != SIG_IGN) { ++ p_sig.signo = signo; ++ p_sig.siginfo = ((sa.sa_flags & SA_SIGINFO) == SA_SIGINFO); ++ p_sig.handler = (void *)sa.sa_handler; ++ ++ apc_signal_info.prev = (apc_signal_entry_t **)apc_erealloc(apc_signal_info.prev, (apc_signal_info.installed+1)*sizeof(apc_signal_entry_t *)); ++ apc_signal_info.prev[apc_signal_info.installed] = (apc_signal_entry_t *)apc_emalloc(sizeof(apc_signal_entry_t)); ++ *apc_signal_info.prev[apc_signal_info.installed++] = p_sig; ++ } else { ++ /* inherit flags and mask if already set */ ++ sigemptyset(&sa.sa_mask); ++ sa.sa_flags = 0; ++ sa.sa_flags |= SA_SIGINFO; /* we'll use a siginfo handler */ ++#if defined(SA_ONESHOT) ++ sa.sa_flags = SA_ONESHOT; ++#elif defined(SA_RESETHAND) ++ sa.sa_flags = SA_RESETHAND; ++#endif ++ } ++ sa.sa_handler = (void*)handler; ++ ++ if (sigaction(signo, &sa, NULL) < 0) { ++ apc_wprint("Error installing apc signal handler for %d", signo); ++ } ++ ++ return SUCCESS; ++ } ++#endif ++ return FAILURE; ++} /* }}} */ ++ ++/* {{{ apc_set_signals ++ * Install our signal handlers */ ++void apc_set_signals(TSRMLS_D) ++{ ++ if (APCG(coredump_unmap) && apc_signal_info.installed == 0) { ++ /* ISO C standard signals that coredump */ ++ apc_register_signal(SIGSEGV, apc_core_unmap); ++ apc_register_signal(SIGABRT, apc_core_unmap); ++ apc_register_signal(SIGFPE, apc_core_unmap); ++ apc_register_signal(SIGILL, apc_core_unmap); ++ /* extended signals that coredump */ ++#ifdef SIGBUS ++ apc_register_signal(SIGBUS, apc_core_unmap); ++#endif ++#ifdef SIGABORT ++ apc_register_signal(SIGABORT, apc_core_unmap); ++#endif ++#ifdef SIGEMT ++ apc_register_signal(SIGEMT, apc_core_unmap); ++#endif ++#ifdef SIGIOT ++ apc_register_signal(SIGIOT, apc_core_unmap); ++#endif ++#ifdef SIGQUIT ++ apc_register_signal(SIGQUIT, apc_core_unmap); ++#endif ++#ifdef SIGSYS ++ apc_register_signal(SIGSYS, apc_core_unmap); ++#endif ++#ifdef SIGTRAP ++ apc_register_signal(SIGTRAP, apc_core_unmap); ++#endif ++#ifdef SIGXCPU ++ apc_register_signal(SIGXCPU, apc_core_unmap); ++#endif ++#ifdef SIGXFSZ ++ apc_register_signal(SIGXFSZ, apc_core_unmap); ++#endif ++ } ++} /* }}} */ ++ ++/* ++ * Local variables: ++ * tab-width: 4 ++ * c-basic-offset: 4 ++ * End: ++ * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker ++ * vim<600: expandtab sw=4 ts=4 sts=4 ++ */ +diff -ubrN php-5.2.5-orig/ext/apc/apc_signal.h php-5.2.5/ext/apc/apc_signal.h +--- php-5.2.5-orig/ext/apc/apc_signal.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_signal.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,50 @@ ++/* ++ +----------------------------------------------------------------------+ ++ | APC | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2006 The PHP Group | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.01 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_01.txt | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Authors: Lucas Nealan | ++ +----------------------------------------------------------------------+ ++ ++ */ ++ ++/* $Id: apc_signal.h,v 1.1 2007/12/26 22:36:06 rasmus Exp $ */ ++ ++#ifndef APC_SIGNAL_H ++#define APC_SIGNAL_H ++ ++#include "apc.h" ++#include "apc_php.h" ++ ++typedef struct apc_signal_entry_t { ++ int signo; /* signal number */ ++ int siginfo; /* siginfo style handler calling */ ++ void* handler; /* signal handler */ ++} apc_signal_entry_t; ++ ++typedef struct apc_signal_info_t { ++ int installed; /* How many signals we've installed handles for */ ++ apc_signal_entry_t **prev; /* Previous signal handlers */ ++} apc_signal_info_t; ++ ++void apc_set_signals(TSRMLS_D); ++ ++#endif ++ ++/* ++ * Local variables: ++ * tab-width: 4 ++ * c-basic-offset: 4 ++ * End: ++ * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker ++ * vim<600: expandtab sw=4 ts=4 sts=4 ++ */ +diff -ubrN php-5.2.5-orig/ext/apc/apc_sma.c php-5.2.5/ext/apc/apc_sma.c +--- php-5.2.5-orig/ext/apc/apc_sma.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_sma.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,628 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -9076,7 +9371,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + + */ + -+/* $Id: apc_sma.c,v 1.63 2007/04/02 09:02:57 gopalv Exp $ */ ++/* $Id: apc_sma.c,v 1.69 2007/12/26 21:35:39 gopalv Exp $ */ + +#include "apc_sma.h" +#include "apc.h" @@ -9085,8 +9380,8 @@ Index: php-5.2.4/ext/apc/apc_sma.c +#include "apc_shm.h" +#include +#if APC_MMAP -+void *apc_mmap(char *file_mask, int size); -+void apc_unmap(void* shmaddr, int size); ++void *apc_mmap(char *file_mask, size_t size); ++void apc_unmap(void* shmaddr, size_t size); +#endif + +/* {{{ locking macros */ @@ -9100,7 +9395,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c +static int sma_initialized = 0; /* true if the sma has been initialized */ +static unsigned int sma_numseg; /* number of shm segments to allow */ +static size_t sma_segsize; /* size of each shm segment */ -+static int* sma_segments; /* array of shm segment ids */ ++static size_t* sma_segments; /* array of shm segment ids */ +static void** sma_shmaddrs; /* array of shm segment addresses */ +static int sma_lastseg = 0; /* index of MRU segment */ + @@ -9200,8 +9495,13 @@ Index: php-5.2.4/ext/apc/apc_sma.c + /* If we have a next fit offset, start searching from there */ + if(header->nfoffset) { + prv = BLOCKAT(header->nfoffset); ++ /* if prv is the last block, jump to the beginning */ ++ if(prv->next == 0) { ++ prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); ++ wrapped = 1; ++ } + } else { -+ prv = BLOCKAT(sizeof(header_t)); ++ prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); + } + + CHECK_CANARY(prv); @@ -9222,7 +9522,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + + /* Check to see if we need to wrap around and search from the top */ + if(header->nfoffset && prv->next == 0) { -+ prv = BLOCKAT(sizeof(header_t)); ++ prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); +#ifdef __APC_SMA_DEBUG__ + CHECK_CANARY(prv); +#endif @@ -9297,7 +9597,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + + /* find position of new block in free list */ + cur = BLOCKAT(offset); -+ prv = BLOCKAT(sizeof(header_t)); ++ prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); + + CHECK_CANARY(cur); + @@ -9356,7 +9656,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + +/* {{{ apc_sma_init */ + -+void apc_sma_init(int numseg, int segsize, char *mmap_file_mask) ++void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask) +{ + int i; + @@ -9383,7 +9683,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + + sma_segsize = segsize > 0 ? segsize : DEFAULT_SEGSIZE; + -+ sma_segments = (int*) apc_emalloc(sma_numseg*sizeof(int)); ++ sma_segments = (size_t*) apc_emalloc(sma_numseg*sizeof(size_t)); + sma_shmaddrs = (void**) apc_emalloc(sma_numseg*sizeof(void*)); + + for (i = 0; i < sma_numseg; i++) { @@ -9404,8 +9704,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + header = (header_t*) shmaddr; + apc_lck_create(NULL, 0, 1, header->sma_lock); + header->segsize = sma_segsize; -+ header->avail = sma_segsize - sizeof(header_t) - sizeof(block_t) - -+ ALIGNWORD(sizeof(int)); ++ header->avail = sma_segsize - ALIGNWORD(sizeof(header_t)) - ALIGNWORD(sizeof(block_t)); + header->nfoffset = 0; +#if ALLOC_DISTRIBUTION + { @@ -9413,9 +9712,9 @@ Index: php-5.2.4/ext/apc/apc_sma.c + for(j=0; j<30; j++) header->adist[j] = 0; + } +#endif -+ block = BLOCKAT(sizeof(header_t)); ++ block = BLOCKAT(ALIGNWORD(sizeof(header_t))); + block->size = 0; -+ block->next = sizeof(header_t) + sizeof(block_t); ++ block->next = ALIGNWORD(sizeof(header_t)) + ALIGNWORD(sizeof(block_t)); + SET_CANARY(block); +#ifdef __APC_SMA_DEBUG__ + block->id = -1; @@ -9472,10 +9771,10 @@ Index: php-5.2.4/ext/apc/apc_sma.c + UNLOCK(((header_t*)sma_shmaddrs[sma_lastseg])->sma_lock); + + for (i = 0; i < sma_numseg; i++) { -+ LOCK(((header_t*)sma_shmaddrs[i])->sma_lock); + if (i == sma_lastseg) { + continue; + } ++ LOCK(((header_t*)sma_shmaddrs[i])->sma_lock); + off = sma_allocate(sma_shmaddrs[i], n); + if (off != -1) { + void* p = (void *)(((char *)(sma_shmaddrs[i])) + off); @@ -9560,7 +9859,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + + info = (apc_sma_info_t*) apc_emalloc(sizeof(apc_sma_info_t)); + info->num_seg = sma_numseg; -+ info->seg_size = sma_segsize - sizeof(header_t) - sizeof(block_t) - ALIGNWORD(sizeof(int)); ++ info->seg_size = sma_segsize - ALIGNWORD(sizeof(header_t)) - ALIGNWORD(sizeof(block_t)); + + info->list = apc_emalloc(info->num_seg * sizeof(apc_sma_link_t*)); + for (i = 0; i < sma_numseg; i++) { @@ -9573,7 +9872,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + for (i = 0; i < sma_numseg; i++) { + RDLOCK(((header_t*)sma_shmaddrs[i])->sma_lock); + shmaddr = sma_shmaddrs[i]; -+ prv = BLOCKAT(sizeof(header_t)); ++ prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); + + link = &info->list[i]; + @@ -9618,9 +9917,9 @@ Index: php-5.2.4/ext/apc/apc_sma.c +/* }}} */ + +/* {{{ apc_sma_get_avail_mem */ -+int apc_sma_get_avail_mem() ++size_t apc_sma_get_avail_mem() +{ -+ int avail_mem = 0; ++ size_t avail_mem = 0; + int i; + + for (i = 0; i < sma_numseg; i++) { @@ -9648,7 +9947,7 @@ Index: php-5.2.4/ext/apc/apc_sma.c + for (i = 0; i < sma_numseg; i++) { + char* shmaddr = sma_shmaddrs[i]; + header_t* header = (header_t*) shmaddr; -+ block_t* prv = BLOCKAT(sizeof(header_t)); ++ block_t* prv = BLOCKAT(ALIGNWORD(sizeof(header_t))); + int avail = 0; + + /* For each block in this segment */ @@ -9672,10 +9971,9 @@ Index: php-5.2.4/ext/apc/apc_sma.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_sma.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_sma.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_sma.h php-5.2.5/ext/apc/apc_sma.h +--- php-5.2.5-orig/ext/apc/apc_sma.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_sma.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,82 @@ +/* + +----------------------------------------------------------------------+ @@ -9704,7 +10002,7 @@ Index: php-5.2.4/ext/apc/apc_sma.h + + */ + -+/* $Id: apc_sma.h,v 1.16 2007/02/24 11:59:40 rasmus Exp $ */ ++/* $Id: apc_sma.h,v 1.18 2007/05/11 01:46:31 shire Exp $ */ + +#ifndef APC_SMA_H +#define APC_SMA_H @@ -9715,7 +10013,7 @@ Index: php-5.2.4/ext/apc/apc_sma.h + +/* Simple shared memory allocator */ + -+extern void apc_sma_init(int numseg, int segsize, char *mmap_file_mask); ++extern void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask); +extern void apc_sma_cleanup(); +extern void* apc_sma_malloc(size_t size); +extern void* apc_sma_realloc(void* p, size_t size); @@ -9728,8 +10026,8 @@ Index: php-5.2.4/ext/apc/apc_sma.h +/* {{{ struct definition: apc_sma_link_t */ +typedef struct apc_sma_link_t apc_sma_link_t; +struct apc_sma_link_t { -+ int size; /* size of this free block */ -+ int offset; /* offset in segment of this block */ ++ long size; /* size of this free block */ ++ long offset; /* offset in segment of this block */ + apc_sma_link_t* next; /* link to next free block */ +}; +/* }}} */ @@ -9738,7 +10036,7 @@ Index: php-5.2.4/ext/apc/apc_sma.h +typedef struct apc_sma_info_t apc_sma_info_t; +struct apc_sma_info_t { + int num_seg; /* number of shared memory segments */ -+ int seg_size; /* size of each shared memory segment */ ++ long seg_size; /* size of each shared memory segment */ + apc_sma_link_t** list; /* there is one list per segment */ +}; +/* }}} */ @@ -9746,7 +10044,7 @@ Index: php-5.2.4/ext/apc/apc_sma.h +extern apc_sma_info_t* apc_sma_info(zend_bool limited); +extern void apc_sma_free_info(apc_sma_info_t* info); + -+extern int apc_sma_get_avail_mem(); ++extern size_t apc_sma_get_avail_mem(); +extern void apc_sma_check_integrity(); + +#endif @@ -9759,10 +10057,9 @@ Index: php-5.2.4/ext/apc/apc_sma.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_spin.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_spin.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_spin.c php-5.2.5/ext/apc/apc_spin.c +--- php-5.2.5-orig/ext/apc/apc_spin.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_spin.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ @@ -9829,10 +10126,9 @@ Index: php-5.2.4/ext/apc/apc_spin.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_spin.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_spin.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_spin.h php-5.2.5/ext/apc/apc_spin.h +--- php-5.2.5-orig/ext/apc/apc_spin.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_spin.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ @@ -9882,10 +10178,9 @@ Index: php-5.2.4/ext/apc/apc_spin.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_stack.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_stack.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_stack.c php-5.2.5/ext/apc/apc_stack.c +--- php-5.2.5-orig/ext/apc/apc_stack.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_stack.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,105 @@ +/* + +----------------------------------------------------------------------+ @@ -9992,10 +10287,9 @@ Index: php-5.2.4/ext/apc/apc_stack.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_stack.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_stack.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_stack.h php-5.2.5/ext/apc/apc_stack.h +--- php-5.2.5-orig/ext/apc/apc_stack.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_stack.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ @@ -10055,10 +10349,9 @@ Index: php-5.2.4/ext/apc/apc_stack.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_zend.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_zend.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_zend.c php-5.2.5/ext/apc/apc_zend.c +--- php-5.2.5-orig/ext/apc/apc_zend.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_zend.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,277 @@ +/* + +----------------------------------------------------------------------+ @@ -10337,10 +10630,9 @@ Index: php-5.2.4/ext/apc/apc_zend.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/apc_zend.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/apc_zend.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/apc_zend.h php-5.2.5/ext/apc/apc_zend.h +--- php-5.2.5-orig/ext/apc/apc_zend.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/apc_zend.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ @@ -10395,11 +10687,238 @@ Index: php-5.2.4/ext/apc/apc_zend.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/CHANGELOG -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/CHANGELOG 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,192 @@ +diff -ubrN php-5.2.5-orig/ext/apc/arch/atomic.h php-5.2.5/ext/apc/arch/atomic.h +--- php-5.2.5-orig/ext/apc/arch/atomic.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/arch/atomic.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,38 @@ ++/* ++ +----------------------------------------------------------------------+ ++ | APC | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2006 The PHP Group | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.01 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_01.txt | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Authors: Brian Shire | ++ +----------------------------------------------------------------------+ ++ ++ */ ++ ++/* $Id: atomic.h,v 1.1 2006/09/29 07:13:01 shire Exp $ */ ++ ++#ifndef APC_ARCH_ATOMIC_H ++ ++#define APC_ARCH_ATOMIC_H ++ ++#if defined __x86_64__ ++#include "x86_64/atomic.h" ++ ++#elif defined __i386__ ++#include "i386/atomic.h" ++ ++#else ++#error "Unknown or Unsupported Architecture. If you would like futex suupport for your architecture, please file a request at http://pecl.php.net/bugs/report.php?package=APC" ++ ++#endif ++ ++ ++#endif +diff -ubrN php-5.2.5-orig/ext/apc/arch/i386/atomic.h php-5.2.5/ext/apc/arch/i386/atomic.h +--- php-5.2.5-orig/ext/apc/arch/i386/atomic.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/arch/i386/atomic.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,79 @@ ++/* ++ +----------------------------------------------------------------------+ ++ | APC | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2006 The PHP Group | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.01 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_01.txt | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Authors: Brian Shire | ++ +----------------------------------------------------------------------+ ++ ++ */ ++ ++/* $Id: atomic.h,v 1.1 2006/09/29 07:13:01 shire Exp $ */ ++ ++ ++#include ++#include ++#include ++ ++/* int sys_futex (void *futex, int op, int val, const struct timespec *timeout); */ ++static inline long int apc_sys_futex(void *futex, int op, int val, const struct timespec *timeout) { ++ ++ long int ret; ++ ++ /* i386 system calls are performed with nt 80h operation. ++ * the argument order is a, b, c, d, S, D ++ */ ++ asm volatile ("int $0x80" ++ : "=a" (ret) ++ : "0" (SYS_futex), ++ "b" (futex), ++ "c" (op), ++ "d" (val), ++ "S" (timeout) ++ : "memory" ++ ); ++ ++ return ret; ++ ++} ++ ++ ++static inline int apc_cmpxchg(volatile int *ptr, int old, int new) { ++ ++ int prev; ++ ++ asm volatile ("LOCK cmpxchgl %1, %2" ++ : "=a" (prev) ++ : "r" (new), ++ "m" (*(ptr)), ++ "0"(old) ++ : "memory", "cc" ++ ); ++ ++ return prev; ++} ++ ++static inline int apc_xchg(volatile int *ptr, int new) { ++ ++ int ret; ++ ++ asm volatile ("LOCK xchgl %[new], %[ptr]" ++ : "=a" (ret) ++ : [new] "0" (new), ++ [ptr] "m" (*(ptr)) ++ : "memory" ++ ); ++ ++ return ret; ++ ++} ++ +diff -ubrN php-5.2.5-orig/ext/apc/arch/x86_64/atomic.h php-5.2.5/ext/apc/arch/x86_64/atomic.h +--- php-5.2.5-orig/ext/apc/arch/x86_64/atomic.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/arch/x86_64/atomic.h 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,80 @@ ++/* ++ +----------------------------------------------------------------------+ ++ | APC | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2006 The PHP Group | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.01 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_01.txt | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Authors: Brian Shire | ++ +----------------------------------------------------------------------+ ++ ++ */ ++ ++/* $Id: atomic.h,v 1.1 2006/09/29 07:13:01 shire Exp $ */ ++ ++ ++#include ++#include ++#include ++ ++/* int sys_futex (void *futex, int op, int val, const struct timespec *timeout); */ ++static inline long int apc_sys_futex(void *futex, int op, int val, const struct timespec *timeout) { ++ ++ long int ret; ++ ++ /* x86_64 system calls are performed with the faster SYSCALL operation. ++ * the argument order is D, S, d, c, b, a rather than ++ * a, b, c, d, S, D as on the i386 int 80h call. ++ */ ++ asm volatile ("syscall" ++ : "=a" (ret) ++ : "0" (SYS_futex), ++ "D" (futex), ++ "S" (op), ++ "d" (val), ++ "c" (timeout) ++ : "r11", "rcx", "memory" ++ ); ++ ++ return ret; ++ ++} ++ ++ ++static inline int apc_cmpxchg(volatile int *ptr, int old, int new) { ++ ++ int prev; ++ ++ asm volatile ("LOCK cmpxchgl %1, %2" ++ : "=a" (prev) ++ : "r" (new), ++ "m" (*(ptr)), ++ "0"(old) ++ : "memory", "cc" ++ ); ++ ++ return prev; ++} ++ ++static inline int apc_xchg(volatile int *ptr, int new) { ++ ++ int ret; ++ ++ asm volatile ("LOCK xchgl %[new], %[ptr]" ++ : "=a" (ret) ++ : [new] "0" (new), ++ [ptr] "m" (*(ptr)) ++ : "memory" ++ ); ++ ++ return ret; ++ ++} ++ +diff -ubrN php-5.2.5-orig/ext/apc/CHANGELOG php-5.2.5/ext/apc/CHANGELOG +--- php-5.2.5-orig/ext/apc/CHANGELOG 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/CHANGELOG 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,211 @@ ++3.0.16: 2007-12-26 ++- Fix for longstanding cache-full crash (Christian Seiler) ++ http://news.php.net/php.pecl.dev/4951 for the details ++- Added optional shm unmap on a fatal signal feature (Lucas Nealan) ++- Added PTHREAD_MUTEX_ADAPTIVE_NP option pthread locks (Paul Saab) ++- Minor cleanups (Lucas Nealan) ++- Added configure option to enable apc_cache_info('filehits') (Shire) ++ ++3.0.15: 2007-10-18 ++- Eliminate a per-request time() syscall (Rasmus) ++- Added rfc1867 prefix, name, and freq ini options (Shire) ++- Allow deletion of individual user cache entries via apc.php (Sara) ++- Fix overzealous cleanup during RSHUTDOWN (Gopal) ++- Fix memory alignment and locking issues (Gopal) ++- Make apc_compile insert/replace entries (Shire) ++- Make mixed inheritance recompile & cache afresh (Gopal) ++- Make nostat mode search include_path for canonicalization (Gopal) ++- ZTS & other compile fixes (Gopal, Edin, Shire) ++ +3.0.14: 2007-03-21 +- Build fix (Shire) +- Don't hook the upload hook if APC is disabled (Rasmus) @@ -10592,13 +11111,12 @@ Index: php-5.2.4/ext/apc/CHANGELOG + +1.0.1: +- added optional file modification time check [djc 2001-01-12] -Index: php-5.2.4/ext/apc/config.m4 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/config.m4 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,214 @@ +diff -ubrN php-5.2.5-orig/ext/apc/config.m4 php-5.2.5/ext/apc/config.m4 +--- php-5.2.5-orig/ext/apc/config.m4 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/config.m4 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,238 @@ +dnl -+dnl $Id: config.m4,v 3.25 2007/02/24 15:57:59 rasmus Exp $ ++dnl $Id: config.m4,v 3.30 2007/12/26 22:31:20 rasmus Exp $ +dnl + +AC_MSG_CHECKING(whether apc needs to get compiler flags from apxs) @@ -10646,6 +11164,20 @@ Index: php-5.2.4/ext/apc/config.m4 +PHP_ARG_ENABLE(apc, whether to enable APC support, +[ --enable-apc Enable APC support]) + ++AC_MSG_CHECKING(Checking whether we should enable cache request file info) ++AC_ARG_ENABLE(apc-filehits, ++[ --enable-apc-filehits Enable per request file info about files used from the APC cache (ie: apc_cache_info('filehits')) ], ++[ ++ PHP_APC_FILEHITS=$enableval ++ AC_MSG_RESULT($enableval) ++], ++[ ++ PHP_APC_FILEHITS=no ++ AC_MSG_RESULT(no) ++]) ++ ++ ++ +AC_MSG_CHECKING(Checking whether we should use mmap) +AC_ARG_ENABLE(apc-mmap, +[ --disable-apc-mmap @@ -10689,15 +11221,15 @@ Index: php-5.2.4/ext/apc/config.m4 + +AC_MSG_CHECKING(Checking whether we should use pthread mutex locking) +AC_ARG_ENABLE(apc-pthreadmutex, -+[ --enable-apc-pthreadmutex -+ Enable pthread mutex locking EXPERIMENTAL ], -+[ -+ PHP_APC_PTHREADMUTEX=$enableval -+ AC_MSG_RESULT($enableval) -+], ++[ --disable-apc-pthreadmutex ++ Disable pthread mutex locking ], +[ + PHP_APC_PTHREADMUTEX=no + AC_MSG_RESULT(no) ++], ++[ ++ PHP_APC_PTHREADMUTEX=yes ++ AC_MSG_RESULT(yes) +]) +if test "$PHP_APC_PTHREADMUTEX" != "no"; then + orig_LIBS="$LIBS" @@ -10715,7 +11247,7 @@ Index: php-5.2.4/ext/apc/config.m4 + return -1; + } + if(pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) { -+ puts("Unable to set PTHREAD_PROCESS_SHARED (pthread_mutexattr_setpshared), your system may not support shared mutex's which are required. (if you're using threads you should just use the built-in php thread locking)."); ++ puts("Unable to set PTHREAD_PROCESS_SHARED (pthread_mutexattr_setpshared), your system may not support shared mutex's."); + return -1; + } + if(pthread_mutex_init(&mutex, &attr)) { @@ -10739,7 +11271,8 @@ Index: php-5.2.4/ext/apc/config.m4 + PHP_ADD_LIBRARY(pthread) + ], + [ dnl -Failure- -+ AC_MSG_ERROR([It doesn't appear that pthread mutex's are supported on your system, please try a different configuration]) ++ AC_MSG_WARN([It doesn't appear that pthread mutex's are supported on your system]) ++ PHP_APC_PTHREADMUTEX=no + ], + [ + PHP_ADD_LIBRARY(pthread) @@ -10763,11 +11296,19 @@ Index: php-5.2.4/ext/apc/config.m4 + +if test "$PHP_APC" != "no"; then + test "$PHP_APC_MMAP" != "no" && AC_DEFINE(APC_MMAP, 1, [ ]) -+ test "$PHP_APC_SEM" != "no" && AC_DEFINE(APC_SEM_LOCKS, 1, [ ]) -+ test "$PHP_APC_FUTEX" != "no" && AC_DEFINE(APC_FUTEX_LOCKS, 1, [ ]) -+ test "$PHP_APC_PTHREADMUTEX" != "no" && AC_DEFINE(APC_PTHREADMUTEX_LOCKS, 1, [ ]) -+ test "$PHP_APC_SPINLOCKS" != "no" && AC_DEFINE(APC_SPIN_LOCKS, 1, [ ]) -+ ++ test "$PHP_APC_FILEHITS" != "no" && AC_DEFINE(APC_FILEHITS, 1, [ ]) ++ ++ if test "$PHP_APC_SEM" != "no"; then ++ AC_DEFINE(APC_SEM_LOCKS, 1, [ ]) ++ elif test "$PHP_APC_FUTEX" != "no"; then ++ AC_DEFINE(APC_FUTEX_LOCKS, 1, [ ]) ++ elif test "$PHP_APC_SPINLOCKS" != "no"; then ++ AC_DEFINE(APC_SPIN_LOCKS, 1, [ ]) ++ elif test "$PHP_APC_PTHREADMUTEX" != "no"; then ++ AC_DEFINE(APC_PTHREADMUTEX_LOCKS, 1, [ ]) ++ fi ++ ++ AC_CHECK_FUNCS(sigaction) + AC_CACHE_CHECK(for union semun, php_cv_semun, + [ + AC_TRY_COMPILE([ @@ -10797,12 +11338,13 @@ Index: php-5.2.4/ext/apc/config.m4 + apc_shm.c \ + apc_futex.c \ + apc_pthreadmutex.c \ -+ apc_spin.c \ -+ pgsql_s_lock.c \ ++ apc_spin.c \ ++ pgsql_s_lock.c \ + apc_sma.c \ + apc_stack.c \ + apc_zend.c \ -+ apc_rfc1867.c " ++ apc_rfc1867.c \ ++ apc_signal.c " + + PHP_CHECK_LIBRARY(rt, shm_open, [PHP_ADD_LIBRARY(rt,,APC_SHARED_LIBADD)]) + PHP_NEW_EXTENSION(apc, $apc_sources, $ext_shared,, \\$(APC_CFLAGS)) @@ -10811,11 +11353,10 @@ Index: php-5.2.4/ext/apc/config.m4 + AC_DEFINE(HAVE_APC, 1, [ ]) +fi + -Index: php-5.2.4/ext/apc/INSTALL -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/INSTALL 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,405 @@ +diff -ubrN php-5.2.5-orig/ext/apc/INSTALL php-5.2.5/ext/apc/INSTALL +--- php-5.2.5-orig/ext/apc/INSTALL 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/INSTALL 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,422 @@ +Installation Instructions for APC +--------------------------------- + @@ -11209,6 +11750,23 @@ Index: php-5.2.4/ext/apc/INSTALL + still going will disable the tracking for the previous. + (Default: 0) + ++ apc.rfc1867_prefix Key prefix to use for the user cache entry generated by ++ rfc1867 upload progress functionality. ++ (Default: "upload_") ++ ++ apc.rfc1867_name Specify the hidden form entry name that activates APC upload ++ progress and specifies the user cache key suffix. ++ (Default: "APC_UPLOAD_PROGRESS") ++ ++ apc.rfc1867_freq The frequency that updates should be made to the user cache ++ entry for upload progress. This can take the form of a ++ percentage of the total file size or a size in bytes ++ optionally suffixed with 'k', 'm', or 'g' for kilobytes, ++ megabytes, or gigabytes respectively (case insensitive). ++ A setting of 0 updates as often as possible, which may cause ++ slower uploads. ++ (Default: 0) ++ + apc.localcache This enables a lock-free local process shadow-cache which + reduces lock contention when the cache is being written to. + (Default: 0) @@ -11221,10 +11779,9 @@ Index: php-5.2.4/ext/apc/INSTALL + Optimize include_once and require_once calls and avoid the + expensive system calls used. + (Default: 0) -Index: php-5.2.4/ext/apc/LICENSE -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/LICENSE 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/LICENSE php-5.2.5/ext/apc/LICENSE +--- php-5.2.5-orig/ext/apc/LICENSE 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/LICENSE 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 @@ -11294,10 +11851,9 @@ Index: php-5.2.4/ext/apc/LICENSE + +PHP includes the Zend Engine, freely available at +. -Index: php-5.2.4/ext/apc/NOTICE -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/NOTICE 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/NOTICE php-5.2.5/ext/apc/NOTICE +--- php-5.2.5-orig/ext/apc/NOTICE 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/NOTICE 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,43 @@ +This is the NOTICE file that holds acknowledgements and stuff. + @@ -11342,10 +11898,547 @@ Index: php-5.2.4/ext/apc/NOTICE + Angel Li diffs for ANSI comment compliance + Christian Rishøj help debugging phplib problems + Sascha Schumann memory error bug fix -Index: php-5.2.4/ext/apc/pgsql_s_lock.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/pgsql_s_lock.c 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/package.xml php-5.2.5/ext/apc/package.xml +--- php-5.2.5-orig/ext/apc/package.xml 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/package.xml 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,534 @@ ++ ++ ++ APC ++ pecl.php.net ++ Alternative PHP Cache ++ APC is a free, open, and robust framework for caching and optimizing PHP intermediate code. ++ ++ Daniel Cowgill ++ dcowgill ++ dan@mail.communityconnect.com ++ no ++ ++ ++ George Schlossnagle ++ gschlossnagle ++ george@omniti.com ++ no ++ ++ ++ Rasmus Lerdorf ++ rasmus ++ rasmus@php.net ++ yes ++ ++ ++ Gopal Vijayaraghavan ++ gopalv ++ gopalv@php.net ++ yes ++ ++ ++ Edin Kadribasic ++ edink ++ edink@emini.dk ++ yes ++ ++ ++ Ilia Alshanetsky ++ iliaa ++ ilia@prohost.org ++ yes ++ ++ ++ Marcus Börger ++ helly ++ helly@php.net ++ yes ++ ++ ++ Sara Golemon ++ pollita ++ pollita@php.net ++ yes ++ ++ ++ Brian Shire ++ shire ++ shire@php.net ++ yes ++ ++ 2007-12-26 ++ ++ ++ 3.0.16 ++ 3.0.0 ++ ++ ++ stable ++ stable ++ ++ PHP License ++ * Fix for longstanding cache-full crash (Christian Seiler) ++ http://news.php.net/php.pecl.dev/4951 for the details ++* Added optional shm unmap on a fatal signal feature (Lucas Nealan) ++* Added PTHREAD_MUTEX_ADAPTIVE_NP option pthread locks (Paul Saab) ++* Minor cleanups (Lucas Nealan) ++* Added configure option to enable apc_cache_info('filehits') (Shire) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 4.3.0 ++ 5.0.0 ++ 5.0.1 ++ 5.0.2 ++ 5.0.3 ++ 5.0.4 ++ 5.0.5 ++ ++ ++ 1.4.0 ++ ++ ++ ++ apc ++ ++ ++ ++ ++ ++ ++ stable ++ stable ++ ++ ++ 2.0.0 ++ 2.0.0 ++ ++ 2003-07-01 ++ Complete rework. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 2.0.1 ++ 2.0.0 ++ ++ 2003-07-01 ++ Win32 support added. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 2.0.2 ++ 2.0.0 ++ ++ 2004-03-12 ++ Fixed non-existant class bug. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.0 ++ 3.0.0 ++ ++ 2005-07-05 ++ PHP-5.1 Support and numerous fixes ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.1 ++ 3.0.0 ++ ++ 2005-07-05 ++ PHP4 build fix ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.2 ++ 3.0.0 ++ ++ 2005-07-05 ++ Default to mmap and add a better error message for shmget failures ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.3 ++ 3.0.0 ++ ++ 2005-07-07 ++ Fix compile problem against PHP 5.0.x ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.4 ++ 3.0.0 ++ ++ 2005-07-18 ++ Add win32 support from Edin. ++Add --with-apxs switch to work around problem when loading APC into Apache binary compiled with LFS switches ++A couple of other minor fixes. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.5 ++ 3.0.0 ++ ++ 2005-07-27 ++ Make it easier for sapis that only populate file_handle->filename to use APC. (Rasmus) ++Support extensions such as bcompiler that need to hook into compile_file. (Val) ++Ralf Becker's apcgui code has now become the default apc.php status page. (Ralf, Rasmus, Ilia) ++Segfault in cache cleanup code (Ilia, Rasmus) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.6 ++ 3.0.0 ++ ++ 2005-07-30 ++ Added apc.php to package.xml file. ++Track per-entry memory usage. (Val) ++Various apc.php fixes and enhancements. (Ralf, Ilia, Rasmus) ++fcntl locking robustness fixes. (Rasmus) ++Shared read-locks where possible. (Rasmus) ++Added file_update_protection configuration parameter. (Rasmus) ++Windows ZTS fixes (Frank) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.7 ++ 3.0.0 ++ ++ 2005-08-16 ++ Fix to apc.php to show final segment in frag chart. (Ilia) ++A couple of win32 fixes. (Frank) ++Add apc.enable_cli ini directive. (Rasmus) ++Add test cases. (Marcus) ++Fix apc_define_constants() bug - http://pecl.php.net/bugs/5084 (Rasmus) ++Simplify user cache handling by removing the user_cache_stack (Rasmus) ++Fix apc_fetch() memory corruption (Andrei,Rasmus) ++Added apc.max_file_size INI setting that allows exclusion of large files from being cached. Default file size limit, 1 megabyte. (Ilia) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.8 ++ 3.0.0 ++ ++ 2005-08-24 ++ Fix invalid free in globals destructor introduced in 3.0.7 (Rasmus) ++Cache corruption fix in cache-full cleanup code (Gopal) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.9 ++ 3.0.0 ++ ++ 2006-03-04 ++ Eliminate rand() call when slam_defense is not set (Rasmus) ++Fix for __isset problem (Gopal) ++Rewrite allocator from a "best fit" to a "next fit" algorithm (Rasmus) ++Added a Cache Full counter so we have an idea how many times the segment has filled up causing an expunge (Rasmus) ++Report back the correct number of available bytes in the segment instead of the allocated bytes. (Rasmus) ++Add cache busy flag which is set when an expunge is underway (Rasmus) ++Add automatic serialization of objects in apc_store() (Marcus) ++64-bit .ini flag fix (Rasmus) ++Static members fix (Gopal) ++sma_cleanup() mem leak fix (Rasmus) ++Fix for http://pecl.php.net/bugs/5311 (Rasmus) ++Fix autoglobals JIT bug (Gopal) ++Fix instance bug (Gopal) ++Add a lock cleanup safety net to request shutdown (Rasmus) ++Fix apc.slam_defense edge-case bug (Rasmus) ++User entry memory usage tracking support (Ilia) ++Allow keys used in apc_store/apc_fetch/apc_delete to be binary safe and prevent conflicts between keys that are found at the start of other keys. (Ilia) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.10 ++ 3.0.0 ++ ++ 2006-03-11 ++ * Add apc.stat ini flag which defaults to 1. If set to 0, the main script and any fullpath ++ includes will not be stat'ed for any changes. You will have to restart the server if you ++ change anything. This mode increases performance quite a bit, especially if you have a ++ lot of includes. ++ ++* Get rid of the lock safety net hack I added in 3.0.9. It seems to cause more problems ++ than it solves. I'll need to revisit locking and signal handling at some point soon. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.11 ++ 3.0.0 ++ ++ 2006-08-16 ++ * Made --enable-apc-mmap the default compile option (for real this time) ++ ++* Add an optional flag to apc_cache_info() and some apc.php tweaks to make it ++ only fetch header information to make it useful when you have tens of ++ thousands of entries. (Brian Shire) ++ ++* 64-bit fixes (George) ++ ++* Don't mix Full Path and Inode keys (George) ++ ++* Override ZEND_INCLUDE_OR_EVAL opcode (when possible) to speed up use of ++ require_once() and include_once() statements. (Sara) ++ ++* Add a non-blocking write_lock for cache inserts. This is a better approach ++ to prevent cache slams and deprecates the slam_defense setting. (Rasmus) ++ ++* A bit of work on the optimizer. (Sara) ++ ++* Various memory issues resolved. (Gopal) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.12 ++ 3.0.0 ++ ++ 2006-09-04 ++ * Fix stray debug message ++ ++* Work on the optimizer - still not stable (Gopal, Ilia, Sara) ++ ++* Performance boost - Replace multiple loops over the opcode ++ array with a single loop for copying, jump fixups and auto ++ global pre-fetches. (Gopal) ++ ++* Perform fetch_global checks only in php5 and only if ++ auto_globals_jit is enabled. (Gopal) ++ ++* Fix bug #8579 - scrub php4 classes' function_table and default ++ properties before inserting into cache. (Gopal) ++ ++* Fix bug #8606 - ZEND_FETCH_GLOBAL is not an opcode, but is a ++ op1->type. The opcodes applicable are ZEND_FETCH_R and ++ ZEND_FETCH_W. (Gopal) ++ ++* PHP 5.2 Compatibility (Gopal) ++ ++* Make the include_once override optional - default off (Sara) ++ ++* Fixed crash when apc run in CLI, but enable_cli is off. (Ilia) ++ ++* Ensure that the apc_globals->cache_stack is cleared before the ++ shm cache is destroyed. Fixes segfault for corner-case i.e request ++ shutdown (apc_deactivate) is not called before module shutdown ++ calls (php_apc_shutdown_globals) (Gopal) ++ ++* TSRM fixes (ensure ts_free_id before apc.so is dlclosed) (Gopal) ++ ++* Fix memory leak of apc_cache_info_t->deleted_list (Gopal) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.12p1 ++ 3.0.0 ++ ++ 2006-09-05 ++ * The only change here is a trivial PHP 4 build fix. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.12p2 ++ 3.0.0 ++ ++ 2006-09-05 ++ * Let's get the version number right. 3.0.12p2 now. ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.13 ++ 3.0.0 ++ ++ 2007-02-24 ++ * PHP 5.2 file upload progress tracking support (Rasmus) ++* Pthread mutex and spin locks (Shire) ++* Recursive zval support for apc_fetch/_store (Shire, Gopal) ++* apc.stat_ctime flag for ctime checks (Rasmus) ++* Multiple key fetches with apc_fetch (Shire) ++* Canary checks for shm memory deallocation (Gopal) ++* Add hooks for external optimizer (Shire) ++* Obsolete and remove apc optimizer (Gopal) ++* APC info changes - cache insert rate, hit and miss rates (Shire) ++* Fix apc_load_constants (Gopal) ++* Rewrite dump opcode code to use vld (Gopal) ++* Use apc_[ewn]print functions for error reporting (Shire) ++* Auto global fixes and refactoring (Gopal, Shire) ++* Fix memory leaks in object serialization (Ilia) ++* Memory cleanup code for destructor order (Gopal) ++* Win32 build fixes (Ilia, Wez) ++* ZTS and Php 4 build fixes (Bjori) ++* Add apc_add() function (Rasmus) ++* Add optional limited flag to apc_sma_info() (Rasmus) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.14 ++ 3.0.0 ++ ++ 2007-04-02 ++ * Build fix (Shire) ++* Don't hook the upload hook if APC is disabled (Rasmus) ++* Local shadow cache support (Gopal) ++* Avoid uneccessary loops over op_arrays for "known" auto-globals (Gopal) ++* Fix apc_add() to overwrite timed out user entries (Rasmus) ++* Fix double inclusion of files with conditional classes in php4 (Gopal) ++* Allocator fixes to reduce fragmentation (Gopal) ++ ++ ++ ++ stable ++ stable ++ ++ ++ 3.0.15 ++ 3.0.0 ++ ++ 2007-10-18 ++ * Eliminate a per-request time() syscall (Rasmus) ++* Added rfc1867 prefix, name, and freq ini options (Shire) ++* Allow deletion of individual user cache entries via apc.php (Sara) ++* Fix overzealous cleanup during RSHUTDOWN (Gopal) ++* Fix memory alignment and locking issues (Gopal) ++* Make apc_compile insert/replace entries (Shire) ++* Make mixed inheritance recompile & cache afresh (Gopal) ++* Make nostat mode search include_path for canonicalization (Gopal) ++* ZTS & other compile fixes (Gopal, Edin, Shire) ++ ++ ++ +diff -ubrN php-5.2.5-orig/ext/apc/pgsql_s_lock.c php-5.2.5/ext/apc/pgsql_s_lock.c +--- php-5.2.5-orig/ext/apc/pgsql_s_lock.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/pgsql_s_lock.c 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,481 @@ +/* + +----------------------------------------------------------------------+ @@ -11828,10 +12921,9 @@ Index: php-5.2.4/ext/apc/pgsql_s_lock.c +#endif /* S_LOCK_TEST */ + +#endif /* APC_SPIN_LOCKS */ -Index: php-5.2.4/ext/apc/pgsql_s_lock.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/pgsql_s_lock.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/pgsql_s_lock.h php-5.2.5/ext/apc/pgsql_s_lock.h +--- php-5.2.5-orig/ext/apc/pgsql_s_lock.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/pgsql_s_lock.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,928 @@ +/* + +----------------------------------------------------------------------+ @@ -12761,11 +13853,10 @@ Index: php-5.2.4/ext/apc/pgsql_s_lock.h +#endif + +#endif /* S_LOCK_H */ -Index: php-5.2.4/ext/apc/php_apc.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/php_apc.c 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,957 @@ +diff -ubrN php-5.2.5-orig/ext/apc/php_apc.c php-5.2.5/ext/apc/php_apc.c +--- php-5.2.5-orig/ext/apc/php_apc.c 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/php_apc.c 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,991 @@ +/* + +----------------------------------------------------------------------+ + | APC | @@ -12794,7 +13885,7 @@ Index: php-5.2.4/ext/apc/php_apc.c + + */ + -+/* $Id: php_apc.c,v 3.140 2007/03/28 07:14:54 gopalv Exp $ */ ++/* $Id: php_apc.c,v 3.154 2007/12/26 22:31:20 rasmus Exp $ */ + +#include "apc_zend.h" +#include "apc_cache.h" @@ -12816,6 +13907,10 @@ Index: php-5.2.4/ext/apc/php_apc.c +#endif +#endif + ++#if HAVE_SIGACTION ++#include "apc_signal.h" ++#endif ++ +/* {{{ PHP_FUNCTION declarations */ +PHP_FUNCTION(apc_cache_info); +PHP_FUNCTION(apc_clear_cache); @@ -12860,6 +13955,8 @@ Index: php-5.2.4/ext/apc/php_apc.c + apc_globals->localcache = 0; + apc_globals->localcache_size = 0; + apc_globals->lcache = NULL; ++ apc_globals->force_file_update = 0; ++ apc_globals->coredump_unmap = 0; +} + +static void php_apc_shutdown_globals(zend_apc_globals* apc_globals TSRMLS_DC) @@ -12907,6 +14004,28 @@ Index: php-5.2.4/ext/apc/php_apc.c +} +/* }}} */ + ++#ifdef MULTIPART_EVENT_FORMDATA ++static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */ ++{ ++ int tmp; ++ tmp = zend_atoi(new_value, new_value_length); ++ if(tmp < 0) { ++ apc_eprint("rfc1867_freq must be greater than or equal to zero."); ++ return FAILURE; ++ } ++ if(new_value[new_value_length-1] == '%') { ++ if(tmp > 100) { ++ apc_eprint("rfc1867_freq cannot be over 100%%"); ++ return FAILURE; ++ } ++ APCG(rfc1867_freq) = tmp / 100.0; ++ } else { ++ APCG(rfc1867_freq) = tmp; ++ } ++ return SUCCESS; ++} ++/* }}} */ ++#endif + +#ifdef ZEND_ENGINE_2 +#define OnUpdateInt OnUpdateLong @@ -12937,9 +14056,13 @@ Index: php-5.2.4/ext/apc/php_apc.c +STD_PHP_INI_BOOLEAN("apc.report_autofilter", "0", PHP_INI_SYSTEM, OnUpdateBool, report_autofilter,zend_apc_globals, apc_globals) +#ifdef MULTIPART_EVENT_FORMDATA +STD_PHP_INI_BOOLEAN("apc.rfc1867", "0", PHP_INI_SYSTEM, OnUpdateBool, rfc1867, zend_apc_globals, apc_globals) ++STD_PHP_INI_ENTRY("apc.rfc1867_prefix", "upload_", PHP_INI_SYSTEM, OnUpdateStringUnempty, rfc1867_prefix, zend_apc_globals, apc_globals) ++STD_PHP_INI_ENTRY("apc.rfc1867_name", "APC_UPLOAD_PROGRESS", PHP_INI_SYSTEM, OnUpdateStringUnempty, rfc1867_name, zend_apc_globals, apc_globals) ++STD_PHP_INI_ENTRY("apc.rfc1867_freq", "0", PHP_INI_SYSTEM, OnUpdateRfc1867Freq, rfc1867_freq, zend_apc_globals, apc_globals) +#endif +STD_PHP_INI_BOOLEAN("apc.localcache", "0", PHP_INI_SYSTEM, OnUpdateBool, localcache, zend_apc_globals, apc_globals) +STD_PHP_INI_ENTRY("apc.localcache.size", "512", PHP_INI_SYSTEM, OnUpdateInt, localcache_size, zend_apc_globals, apc_globals) ++STD_PHP_INI_BOOLEAN("apc.coredump_unmap", "0", PHP_INI_SYSTEM, OnUpdateBool, coredump_unmap, zend_apc_globals, apc_globals) +PHP_INI_END() + +/* }}} */ @@ -12967,7 +14090,7 @@ Index: php-5.2.4/ext/apc/php_apc.c +#else + php_info_print_table_row(2, "Locking type", "File Locks"); +#endif -+ php_info_print_table_row(2, "Revision", "$Revision: 3.140 $"); ++ php_info_print_table_row(2, "Revision", "$Revision: 3.154 $"); + php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); + php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); @@ -13034,6 +14157,10 @@ Index: php-5.2.4/ext/apc/php_apc.c +{ + if(APCG(enabled)) { + apc_request_init(TSRMLS_C); ++ ++#if HAVE_SIGACTION ++ apc_set_signals(); ++#endif + } + return SUCCESS; +} @@ -13066,6 +14193,13 @@ Index: php-5.2.4/ext/apc/php_apc.c + if(ZEND_NUM_ARGS()) { + if(!strcasecmp(cache_type,"user")) { + info = apc_cache_info(apc_user_cache, limited); ++ } else if(!strcasecmp(cache_type,"filehits")) { ++#ifdef APC_FILEHITS ++ RETVAL_ZVAL(APCG(filehits), 1, 0); ++ return; ++#else ++ RETURN_FALSE; ++#endif + } else { + info = apc_cache_info(apc_cache, limited); + } @@ -13271,7 +14405,7 @@ Index: php-5.2.4/ext/apc/php_apc.c + time_t t; + size_t mem_size = 0; + -+#if PHP_API_VERSION <= 20041225 ++#if PHP_API_VERSION < 20041225 +#if HAVE_APACHE && defined(APC_PHP4_STAT) + t = ((request_rec *)SG(server_context))->request_time; +#else @@ -13406,7 +14540,7 @@ Index: php-5.2.4/ext/apc/php_apc.c + return; + } + -+#if PHP_API_VERSION <= 20041225 ++#if PHP_API_VERSION < 20041225 +#if HAVE_APACHE && defined(APC_PHP4_STAT) + t = ((request_rec *)SG(server_context))->request_time; +#else @@ -13563,7 +14697,7 @@ Index: php-5.2.4/ext/apc/php_apc.c + + if(!strkey_len) RETURN_FALSE; + -+#if PHP_API_VERSION <= 20041225 ++#if PHP_API_VERSION < 20041225 +#if HAVE_APACHE && defined(APC_PHP4_STAT) + t = ((request_rec *)SG(server_context))->request_time; +#else @@ -13606,23 +14740,15 @@ Index: php-5.2.4/ext/apc/php_apc.c + + if(!filename) RETURN_FALSE; + -+ /* If slam defense is active, temporarily disable */ -+ if(APCG(slam_defense)) { -+ slam_defense = APCG(slam_defense); -+ APCG(slam_defense) = 0; -+ } ++ /* reset slam defense, filters, and cache_by_default */ ++ slam_defense = APCG(slam_defense); ++ APCG(slam_defense) = 0; + -+ /* If filter is active, temporarily disable */ -+ if(APCG(filters) != NULL) { -+ filters = APCG(filters); -+ APCG(filters) = NULL; -+ } ++ filters = APCG(filters); ++ APCG(filters) = NULL; + -+ /* If cache_by_default is off, temporarily enable */ -+ if(!APCG(cache_by_default)) { -+ cache_by_default = APCG(cache_by_default); -+ APCG(cache_by_default) = 1; -+ } ++ cache_by_default = APCG(cache_by_default); ++ APCG(cache_by_default) = 1; + + /* Replace function/class tables to avoid namespace conflicts */ + zend_hash_init_ex(&cg_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); @@ -13631,12 +14757,11 @@ Index: php-5.2.4/ext/apc/php_apc.c + zend_hash_init_ex(&cg_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); + cg_orig_class_table = CG(class_table); + CG(class_table) = &cg_class_table; -+ zend_hash_init_ex(&eg_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); + eg_orig_function_table = EG(function_table); -+ EG(function_table) = &eg_function_table; -+ zend_hash_init_ex(&eg_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); ++ EG(function_table) = CG(function_table); + eg_orig_class_table = EG(class_table); -+ EG(class_table) = &eg_class_table; ++ EG(class_table) = CG(class_table); ++ APCG(force_file_update) = 1; + + /* Compile the file, loading it into the cache */ + file_handle.type = ZEND_HANDLE_FILENAME; @@ -13646,19 +14771,18 @@ Index: php-5.2.4/ext/apc/php_apc.c + zend_try { + op_array = zend_compile_file(&file_handle, ZEND_INCLUDE TSRMLS_CC); + } zend_catch { -+ apc_eprint("Error compiling %s in apc_compile_file.", filename); ++ apc_wprint("Error compiling %s in apc_compile_file.", filename); + op_array = NULL; + } zend_end_try(); + + /* Return class/function tables to previous states, destroy temp tables */ ++ APCG(force_file_update) = 0; + CG(function_table) = cg_orig_function_table; + zend_hash_destroy(&cg_function_table); + CG(class_table) = cg_orig_class_table; + zend_hash_destroy(&cg_class_table); + EG(function_table) = eg_orig_function_table; -+ zend_hash_destroy(&eg_function_table); + EG(class_table) = eg_orig_class_table; -+ zend_hash_destroy(&eg_class_table); + + /* Restore global settings */ + APCG(slam_defense) = slam_defense; @@ -13691,6 +14815,7 @@ Index: php-5.2.4/ext/apc/php_apc.c + PHP_FE(apc_define_constants, NULL) + PHP_FE(apc_load_constants, NULL) + PHP_FE(apc_compile_file, NULL) ++ PHP_FE(apc_add, NULL) + {NULL, NULL, NULL} +}; +/* }}} */ @@ -13723,10 +14848,9 @@ Index: php-5.2.4/ext/apc/php_apc.c + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/php_apc.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/php_apc.h 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/php_apc.h php-5.2.5/ext/apc/php_apc.h +--- php-5.2.5-orig/ext/apc/php_apc.h 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/php_apc.h 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ @@ -13780,11 +14904,10 @@ Index: php-5.2.4/ext/apc/php_apc.h + * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker + * vim<600: expandtab sw=4 ts=4 sts=4 + */ -Index: php-5.2.4/ext/apc/TECHNOTES.txt -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/TECHNOTES.txt 2007-09-02 12:24:46.000000000 +0200 -@@ -0,0 +1,357 @@ +diff -ubrN php-5.2.5-orig/ext/apc/TECHNOTES.txt php-5.2.5/ext/apc/TECHNOTES.txt +--- php-5.2.5-orig/ext/apc/TECHNOTES.txt 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/TECHNOTES.txt 2007-12-26 16:51:32.000000000 -0600 +@@ -0,0 +1,361 @@ +APC Quick-Start Braindump + +This is a rapidly written braindump of how APC currently works in the @@ -13870,8 +14993,12 @@ Index: php-5.2.4/ext/apc/TECHNOTES.txt + + typedef struct block_t block_t; + struct block_t { -+ int size; /* size of this block */ -+ int next; /* offset in segment of next free block */ ++ size_t size; /* size of this block */ ++ size_t next; /* offset in segment of next free block */ ++ size_t canary; /* canary to check for memory overwrites */ ++#ifdef __APC_SMA_DEBUG__ ++ int id; /* identifier for the memory block */ ++#endif + }; + + The BLOCKAT macro turns an offset into an actual address for you: @@ -14142,10 +15269,9 @@ Index: php-5.2.4/ext/apc/TECHNOTES.txt +If you made it to the end of this, you should have a pretty good idea of where things are in +the code. I skimmed over a lot of things, so plan on spending some time reading through the code. + -Index: php-5.2.4/ext/apc/tests/apc_001.phpt -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/tests/apc_001.phpt 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/tests/apc_001.phpt php-5.2.5/ext/apc/tests/apc_001.phpt +--- php-5.2.5-orig/ext/apc/tests/apc_001.phpt 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/tests/apc_001.phpt 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,27 @@ +--TEST-- +APC: apc_store/fetch with strings @@ -14174,10 +15300,9 @@ Index: php-5.2.4/ext/apc/tests/apc_001.phpt +string(11) "hello world" +string(4) "nice" +===DONE=== -Index: php-5.2.4/ext/apc/tests/apc_002.phpt -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/tests/apc_002.phpt 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/tests/apc_002.phpt php-5.2.5/ext/apc/tests/apc_002.phpt +--- php-5.2.5-orig/ext/apc/tests/apc_002.phpt 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/tests/apc_002.phpt 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,34 @@ +--TEST-- +APC: apc_store/fetch with objects @@ -14213,10 +15338,9 @@ Index: php-5.2.4/ext/apc/tests/apc_002.phpt + bool(true) +} +===DONE=== -Index: php-5.2.4/ext/apc/tests/apc_003.phpt -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/tests/apc_003.phpt 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/tests/apc_003.phpt php-5.2.5/ext/apc/tests/apc_003.phpt +--- php-5.2.5-orig/ext/apc/tests/apc_003.phpt 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/tests/apc_003.phpt 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,112 @@ +--TEST-- +APC: apc_store/fetch with objects @@ -14330,10 +15454,9 @@ Index: php-5.2.4/ext/apc/tests/apc_003.phpt + bool(true) +} +===DONE=== -Index: php-5.2.4/ext/apc/tests/skipif.inc -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/tests/skipif.inc 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/tests/skipif.inc php-5.2.5/ext/apc/tests/skipif.inc +--- php-5.2.5-orig/ext/apc/tests/skipif.inc 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/tests/skipif.inc 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,6 @@ + -Index: php-5.2.4/ext/apc/TODO -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ php-5.2.4/ext/apc/TODO 2007-09-02 12:24:46.000000000 +0200 +diff -ubrN php-5.2.5-orig/ext/apc/TODO php-5.2.5/ext/apc/TODO +--- php-5.2.5-orig/ext/apc/TODO 1969-12-31 18:00:00.000000000 -0600 ++++ php-5.2.5/ext/apc/TODO 2007-12-26 16:51:32.000000000 -0600 @@ -0,0 +1,30 @@ +Known Bugs +