Changeset 32873
- Timestamp:
- 2012-07-25T22:38:22+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
packages/lang/php5/patches/005-APC.patch
r24774 r32873 1 --- /dev/null 2 +++ b/ext/apc/apc_bin.c 1 diff -Naur a/ext/apc/apc_bin.c b/ext/apc/apc_bin.c 2 --- a/ext/apc/apc_bin.c 1970-01-01 01:00:00.000000000 +0100 3 +++ b/ext/apc/apc_bin.c 2012-07-20 00:10:35.000000000 +0200 3 4 @@ -0,0 +1,987 @@ 4 5 +/* … … 6 7 + | APC | 7 8 + +----------------------------------------------------------------------+ 8 + | Copyright (c) 2006-201 0The PHP Group |9 + | Copyright (c) 2006-2011 The PHP Group | 9 10 + +----------------------------------------------------------------------+ 10 11 + | This source file is subject to version 3.01 of the PHP license, | … … 21 22 + */ 22 23 + 23 +/* $Id: apc_bin.c 3 03383 2010-09-15 08:15:58Z dmitry$ */24 +/* $Id: apc_bin.c 324017 2012-03-08 09:46:22Z pajoye $ */ 24 25 + 25 26 +/* Creates a binary architecture specific output to a string or file containing … … 32 33 +#include "apc_bin.h" 33 34 +#include "apc_zend.h" 35 +#include "apc_php.h" 34 36 +#include "apc_sma.h" 35 37 +#include "apc_pool.h" … … 55 57 + } else if((long)ptr > bd->size) { /* not swizzled */ \ 56 58 + apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \ 59 + return; \ 57 60 + } \ 58 61 + printf("\n"); \ … … 74 77 + } else if((ulong)ptr > bd->size) { /* not swizzled */ \ 75 78 + apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, ptr, ((long)bd + bd->size), __FILE__, __LINE__); \ 79 + return NULL; \ 76 80 + } \ 77 81 + } while(0); … … 124 128 + if(zend_hash_index_find(&APCG(apc_bd_alloc_list), (ulong)ptr, (void**)&size) == FAILURE) { 125 129 + apc_error("apc_bd_free could not free pointer (not found in list: %x)" TSRMLS_CC, ptr); 130 + return; 126 131 + } 127 132 + APCG(apc_bd_alloc_ptr) = (void*)((size_t)APCG(apc_bd_alloc_ptr) - *size); … … 150 155 + if(APCG(apc_bd_alloc_ptr) > APCG(apc_bd_alloc_ubptr)) { 151 156 + apc_error("Exceeded bounds check in apc_bd_alloc_ex by %d bytes." TSRMLS_CC, (unsigned char *) APCG(apc_bd_alloc_ptr) - (unsigned char *) APCG(apc_bd_alloc_ubptr)); 157 + return NULL; 152 158 + } 153 159 + zend_hash_index_update(&APCG(apc_bd_alloc_list), (ulong)rval, &size, sizeof(size_t), NULL); … … 169 175 + } else if((ulong)ptr > bd->size) { 170 176 + apc_error("pointer to be swizzled is not within allowed memory range! (%x < %x < %x) in %s on %d" TSRMLS_CC, (long)bd, *ptr, ((long)bd + bd->size), file, line); \ 177 + return; 171 178 + } 172 179 + } … … 293 300 +#ifdef ZEND_ENGINE_2_4 294 301 + if (ce->default_properties_table) { 295 + int i;296 +297 302 + for (i = 0; i < ce->default_properties_count; i++) { 298 303 + if (ce->default_properties_table[i]) { … … 312 317 +#ifdef ZEND_ENGINE_2_4 313 318 + if (ce->default_static_members_table) { 314 + int i;315 +316 319 + for (i = 0; i < ce->default_static_members_count; i++) { 317 320 + if (ce->default_static_members_table[i]) { … … 445 448 + } 446 449 + 447 + switch(zv->type & ~IS_CONSTANT_INDEX) {450 + switch(zv->type & IS_CONSTANT_TYPE_MASK) { 448 451 + case IS_NULL: 449 452 + case IS_LONG: … … 555 558 + if(memcmp(md5_orig, digest, 16)) { 556 559 + apc_error("MD5 checksum of binary dump failed." TSRMLS_CC); 557 + memcpy(bd->md5, md5_orig, 16); /* add back md5 checksum */558 560 + return -1; 559 561 + } … … 567 569 + if(crc_orig != crc) { 568 570 + apc_error("CRC32 checksum of binary dump failed." TSRMLS_CC); 569 + bd->crc = crc_orig;570 571 + return -1; 571 572 + } … … 989 990 + * vim<600: expandtab sw=4 ts=4 sts=4 990 991 + */ 991 --- /dev/null 992 +++ b/ext/apc/apc_bin.h 992 diff -Naur a/ext/apc/apc_bin.h b/ext/apc/apc_bin.h 993 --- a/ext/apc/apc_bin.h 1970-01-01 01:00:00.000000000 +0100 994 +++ b/ext/apc/apc_bin.h 2012-07-20 00:10:35.000000000 +0200 993 995 @@ -0,0 +1,63 @@ 994 996 +/* … … 996 998 + | APC | 997 999 + +----------------------------------------------------------------------+ 998 + | Copyright (c) 2006-201 0The PHP Group |1000 + | Copyright (c) 2006-2011 The PHP Group | 999 1001 + +----------------------------------------------------------------------+ 1000 1002 + | This source file is subject to version 3.01 of the PHP license, | … … 1011 1013 + */ 1012 1014 + 1013 +/* $Id: apc_bin.h 30 0979 2010-07-04 10:15:05Z kalle $ */1015 +/* $Id: apc_bin.h 307048 2011-01-03 23:53:17Z kalle $ */ 1014 1016 + 1015 1017 +#ifndef APC_BINDUMP_H … … 1055 1057 + * vim<600: expandtab sw=4 ts=4 sts=4 1056 1058 + */ 1057 --- /dev/null 1058 +++ b/ext/apc/apc.c 1059 @@ -0,0 +1,636 @@ 1059 diff -Naur a/ext/apc/apc.c b/ext/apc/apc.c 1060 --- a/ext/apc/apc.c 1970-01-01 01:00:00.000000000 +0100 1061 +++ b/ext/apc/apc.c 2012-07-20 00:10:35.000000000 +0200 1062 @@ -0,0 +1,670 @@ 1060 1063 +/* 1061 1064 + +----------------------------------------------------------------------+ 1062 1065 + | APC | 1063 1066 + +----------------------------------------------------------------------+ 1064 + | Copyright (c) 2006-201 0The PHP Group |1067 + | Copyright (c) 2006-2011 The PHP Group | 1065 1068 + +----------------------------------------------------------------------+ 1066 1069 + | This source file is subject to version 3.01 of the PHP license, | … … 1089 1092 + */ 1090 1093 + 1091 +/* $Id: apc.c 3 05003 2010-10-31 19:45:10Z gopalv$ */1094 +/* $Id: apc.c 326710 2012-07-19 20:51:04Z rasmus $ */ 1092 1095 + 1093 1096 +#include "apc.h" 1094 1097 +#include "apc_zend.h" 1095 1098 +#include "apc_cache.h" 1099 +#include "apc_globals.h" 1096 1100 +#include "php.h" 1097 1101 + … … 1115 1119 + if (p == NULL) { 1116 1120 + apc_error("apc_emalloc: malloc failed to allocate %u bytes:" TSRMLS_CC, n); 1121 + return NULL; 1117 1122 + } 1118 1123 + return p; … … 1121 1126 +void* apc_erealloc(void* p, size_t n TSRMLS_DC) 1122 1127 +{ 1123 + p = realloc(p, n); 1124 + if (p == NULL) { 1128 + void *new; 1129 + new = realloc(p, n); 1130 + if (new == NULL) { 1125 1131 + apc_error("apc_erealloc: realloc failed to allocate %u bytes:" TSRMLS_CC, n); 1126 + } 1127 + return p; 1132 + return NULL; 1133 + } 1134 + return new; 1128 1135 +} 1129 1136 + … … 1132 1139 + if (p == NULL) { 1133 1140 + apc_error("apc_efree: attempt to free null pointer" TSRMLS_CC); 1141 + return; 1134 1142 + } 1135 1143 + free(p); 1136 1144 +} 1137 1145 + 1138 +char* apc_estrdup(const char* s TSRMLS_DC)1146 +char* APC_ALLOC apc_estrdup(const char* s TSRMLS_DC) 1139 1147 +{ 1140 1148 + int len; … … 1148 1156 + if (dup == NULL) { 1149 1157 + apc_error("apc_estrdup: malloc failed to allocate %u bytes:" TSRMLS_CC, len+1); 1158 + return NULL; 1150 1159 + } 1151 1160 + memcpy(dup, s, len); … … 1154 1163 +} 1155 1164 + 1156 +void* apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC)1165 +void* APC_ALLOC apc_xstrdup(const char* s, apc_malloc_t f TSRMLS_DC) 1157 1166 +{ 1158 1167 + return s != NULL ? apc_xmemcpy(s, strlen(s)+1, f TSRMLS_CC) : NULL; 1159 1168 +} 1160 1169 + 1161 +void* apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC)1170 +void* APC_ALLOC apc_xmemcpy(const void* p, size_t n, apc_malloc_t f TSRMLS_DC) 1162 1171 +{ 1163 1172 + void* q; … … 1340 1349 + IS_SLASH(filename[2]))))) 1341 1350 + 1351 +/* {{{ stupid stringifcation */ 1352 +#if DEFAULT_SLASH == '/' 1353 + #define DEFAULT_SLASH_STRING "/" 1354 +#elif DEFAULT_SLASH == '\\' 1355 + #define DEFAULT_SLASH_STRING "\\" 1356 +#else 1357 + #error "Unknown value for DEFAULT_SLASH" 1358 +#endif 1359 +/* }}} */ 1342 1360 + 1343 1361 +int apc_search_paths(const char* filename, const char* path, apc_fileinfo_t* fileinfo TSRMLS_DC) … … 1386 1404 + found = 1; 1387 1405 + break; 1406 + } 1407 + } 1408 + /* in cli mode PHP explicitly checks the cwd, so we should as well */ 1409 + if(APCG(enable_cli) && !strcmp(sapi_module.name, "cli")) { 1410 + snprintf(fileinfo->path_buf, sizeof(fileinfo->path_buf), ".%c%s", DEFAULT_SLASH, path_for_open); 1411 + if (APC_URL_STAT(wrapper, fileinfo->path_buf, &fileinfo->st_buf) == 0) { 1412 + fileinfo->fullpath = (char*) fileinfo->path_buf; 1413 + found = 1; 1414 + } 1415 + } 1416 + } else { 1417 + /* read cwd and try to fake up fullpath */ 1418 + fileinfo->path_buf[0] = '\0'; 1419 + if(VCWD_GETCWD(fileinfo->path_buf, sizeof(fileinfo->path_buf))) { 1420 + strlcat(fileinfo->path_buf, DEFAULT_SLASH_STRING, sizeof(fileinfo->path_buf)); 1421 + strlcat(fileinfo->path_buf, path_for_open, sizeof(fileinfo->path_buf)); 1422 + if (APC_URL_STAT(wrapper, fileinfo->path_buf, &fileinfo->st_buf) == 0) { 1423 + fileinfo->fullpath = (char*) fileinfo->path_buf; 1424 + return apc_restat(fileinfo TSRMLS_CC); 1388 1425 + } 1389 1426 + } … … 1694 1731 + * vim<600: expandtab sw=4 ts=4 sts=4 1695 1732 + */ 1696 --- /dev/null 1697 +++ b/ext/apc/apc_cache.c 1698 @@ -0,0 +1,1295 @@ 1733 diff -Naur a/ext/apc/apc_cache.c b/ext/apc/apc_cache.c 1734 --- a/ext/apc/apc_cache.c 1970-01-01 01:00:00.000000000 +0100 1735 +++ b/ext/apc/apc_cache.c 2012-07-20 00:10:35.000000000 +0200 1736 @@ -0,0 +1,1383 @@ 1699 1737 +/* 1700 1738 + +----------------------------------------------------------------------+ 1701 1739 + | APC | 1702 1740 + +----------------------------------------------------------------------+ 1703 + | Copyright (c) 2006-201 0The PHP Group |1741 + | Copyright (c) 2006-2011 The PHP Group | 1704 1742 + +----------------------------------------------------------------------+ 1705 1743 + | This source file is subject to version 3.01 of the PHP license, | … … 1727 1765 + */ 1728 1766 + 1729 +/* $Id: apc_cache.c 3 05771 2010-11-26 12:57:16Z gopalv$ */1767 +/* $Id: apc_cache.c 325482 2012-05-01 00:09:36Z rasmus $ */ 1730 1768 + 1731 1769 +#include "apc_cache.h" … … 1734 1772 +#include "apc_globals.h" 1735 1773 +#include "SAPI.h" 1774 +#include "TSRM.h" 1775 +#include "ext/standard/md5.h" 1736 1776 + 1737 1777 +/* TODO: rehash when load factor exceeds threshold */ … … 1746 1786 + 1747 1787 +/* {{{ hash */ 1748 +static unsigned inthash(apc_cache_key_t key)1749 +{ 1750 + return (unsigned int)(key.data.file.device + key.data.file.inode);1788 +static unsigned long hash(apc_cache_key_t key) 1789 +{ 1790 + return (unsigned long)(key.data.file.device + key.data.file.inode); 1751 1791 +} 1752 1792 +/* }}} */ 1753 1793 + 1754 1794 +/* {{{ string_nhash_8 */ 1755 +#define string_nhash_8(s,len) (unsigned int)(zend_inline_hash_func(s, len))1795 +#define string_nhash_8(s,len) (unsigned long)(zend_inline_hash_func((s), len)) 1756 1796 +/* }}} */ 1797 + 1798 +/* {{{ murmurhash */ 1799 +#if 0 1800 +static inline unsigned long murmurhash(const char *skey, size_t keylen) 1801 +{ 1802 + const long m = 0x7fd652ad; 1803 + const long r = 16; 1804 + unsigned int h = 0xdeadbeef; 1805 + 1806 + while(keylen >= 4) 1807 + { 1808 + h += *(unsigned int*)skey; 1809 + h *= m; 1810 + h ^= h >> r; 1811 + 1812 + skey += 4; 1813 + keylen -= 4; 1814 + } 1815 + 1816 + switch(keylen) 1817 + { 1818 + case 3: 1819 + h += skey[2] << 16; 1820 + case 2: 1821 + h += skey[1] << 8; 1822 + case 1: 1823 + h += skey[0]; 1824 + h *= m; 1825 + h ^= h >> r; 1826 + }; 1827 + 1828 + h *= m; 1829 + h ^= h >> 10; 1830 + h *= m; 1831 + h ^= h >> 17; 1832 + 1833 + return h; 1834 +} 1835 +#endif 1836 +/* }}} */ 1837 + 1757 1838 + 1758 1839 +/* {{{ make_prime */ … … 1770 1851 + 9221, /* 9216 */ 1771 1852 +10243, /* 10240 */ 1772 +#if 01773 1853 +11273, /* 11264 */ 1774 1854 +12289, /* 12288 */ … … 1780 1860 +18433, /* 18432 */ 1781 1861 +19457, /* 19456 */ 1782 +#endif1783 1862 +0 /* sentinel */ 1784 1863 +}; … … 1796 1875 + 1797 1876 +/* {{{ make_slot */ 1798 +slot_t* make_slot(apc_cache_key_t key, apc_cache_entry_t* value, slot_t* next, time_t t TSRMLS_DC)1877 +slot_t* make_slot(apc_cache_key_t *key, apc_cache_entry_t* value, slot_t* next, time_t t TSRMLS_DC) 1799 1878 +{ 1800 1879 + slot_t* p = apc_pool_alloc(value->pool, sizeof(slot_t)); … … 1802 1881 + if (!p) return NULL; 1803 1882 + 1804 + if( value->type == APC_CACHE_ENTRY_USER) {1805 + char *identifier = (char*) apc_pmemcpy(key .data.user.identifier, key.data.user.identifier_len, value->pool TSRMLS_CC);1883 + if(key->type == APC_CACHE_KEY_USER) { 1884 + char *identifier = (char*) apc_pmemcpy(key->data.user.identifier, key->data.user.identifier_len, value->pool TSRMLS_CC); 1806 1885 + if (!identifier) { 1807 1886 + return NULL; 1808 1887 + } 1809 + key .data.user.identifier = identifier;1810 + } else if(key .type == APC_CACHE_KEY_FPFILE) {1811 + char *fullpath = (char*) apc_pstrdup(key .data.fpfile.fullpath, value->pool TSRMLS_CC);1888 + key->data.user.identifier = identifier; 1889 + } else if(key->type == APC_CACHE_KEY_FPFILE) { 1890 + char *fullpath = (char*) apc_pstrdup(key->data.fpfile.fullpath, value->pool TSRMLS_CC); 1812 1891 + if (!fullpath) { 1813 1892 + return NULL; 1814 1893 + } 1815 + key .data.fpfile.fullpath = fullpath;1816 + } 1817 + p->key = key ;1894 + key->data.fpfile.fullpath = fullpath; 1895 + } 1896 + p->key = key[0]; 1818 1897 + p->value = value; 1819 1898 + p->next = next; … … 1840 1919 + 1841 1920 + cache->header->mem_size -= dead->value->mem_size; 1842 + cache->header->num_entries--;1921 + CACHE_FAST_DEC(cache, cache->header->num_entries); 1843 1922 + if (dead->value->ref_count <= 0) { 1844 1923 + free_slot(dead TSRMLS_CC); … … 1879 1958 + switch(dead->value->type) { 1880 1959 + case APC_CACHE_ENTRY_FILE: 1881 + apc_ warning("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC,1960 + apc_debug("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC, 1882 1961 + dead->value->data.file.filename, dead->key.data.file.device, dead->key.data.file.inode, gc_sec); 1883 1962 + break; 1884 1963 + case APC_CACHE_ENTRY_USER: 1885 + apc_ warning("GC cache entry '%s'was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);1964 + apc_debug("GC cache entry '%s' was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec); 1886 1965 + break; 1887 1966 + } … … 1940 2019 + if(!cache->shmaddr) { 1941 2020 + apc_error("Unable to allocate shared memory for cache structures. (Perhaps your shared memory size isn't large enough?). " TSRMLS_CC); 2021 + return NULL; 1942 2022 + } 1943 2023 + memset(cache->shmaddr, 0, cache_size); … … 1971 2051 +{ 1972 2052 + DESTROY_LOCK(cache->header->lock); 1973 +#if defNONBLOCKING_LOCK_AVAILABLE2053 +#if NONBLOCKING_LOCK_AVAILABLE 1974 2054 + DESTROY_LOCK(cache->header->wrlock); 1975 2055 +#endif … … 2023 2103 + */ 2024 2104 + CACHE_SAFE_LOCK(cache); 2105 + process_pending_removals(cache TSRMLS_CC); 2025 2106 + if (apc_sma_get_avail_mem() > (size_t)(APCG(shm_size)/2)) { 2026 2107 + /* probably a queued up expunge, we don't need to do this */ … … 2029 2110 + } 2030 2111 + cache->header->busy = 1; 2031 + cache->header->expunges++;2112 + CACHE_FAST_INC(cache, cache->header->expunges); 2032 2113 +clear_all: 2033 2114 + for (i = 0; i < cache->num_slots; i++) { … … 2053 2134 + 2054 2135 + CACHE_SAFE_LOCK(cache); 2136 + process_pending_removals(cache TSRMLS_CC); 2055 2137 + if (apc_sma_get_avail_mem() > (size_t)(APCG(shm_size)/2)) { 2056 2138 + /* probably a queued up expunge, we don't need to do this */ … … 2059 2141 + } 2060 2142 + cache->header->busy = 1; 2061 + cache->header->expunges++;2143 + CACHE_FAST_INC(cache, cache->header->expunges); 2062 2144 + for (i = 0; i < cache->num_slots; i++) { 2063 2145 + p = &cache->slots[i]; … … 2116 2198 + process_pending_removals(cache TSRMLS_CC); 2117 2199 + 2118 + if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots]; 2119 + else slot = &cache->slots[string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len) % cache->num_slots]; 2200 + slot = &cache->slots[key.h % cache->num_slots]; 2120 2201 + 2121 2202 + while(*slot) { … … 2134 2215 + } 2135 2216 + } else { /* APC_CACHE_KEY_FPFILE */ 2136 + if(!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) { 2217 + if((key.h == (*slot)->key.h) && 2218 + !memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) { 2137 2219 + /* Hrm.. it's already here, remove it and insert new one */ 2138 2220 + remove_slot(cache, slot TSRMLS_CC); … … 2147 2229 + } 2148 2230 + 2149 + if ((*slot = make_slot( key, value, *slot, t TSRMLS_CC)) == NULL) {2231 + if ((*slot = make_slot(&key, value, *slot, t TSRMLS_CC)) == NULL) { 2150 2232 + return -1; 2151 2233 + } … … 2153 2235 + value->mem_size = ctxt->pool->size; 2154 2236 + cache->header->mem_size += ctxt->pool->size; 2155 + cache->header->num_entries++;2156 + cache->header->num_inserts++;2237 + CACHE_FAST_INC(cache, cache->header->num_entries); 2238 + CACHE_FAST_INC(cache, cache->header->num_inserts); 2157 2239 + 2158 2240 + return 1; … … 2196 2278 + slot_t** slot; 2197 2279 + unsigned int keylen = key.data.user.identifier_len; 2198 + unsigned int h = string_nhash_8(key.data.user.identifier, keylen);2199 2280 + apc_keyid_t *lastkey = &cache->header->lastkey; 2200 2281 + … … 2208 2289 + } 2209 2290 + 2210 + if(apc_cache_is_last_key(cache, &key, h,t TSRMLS_CC)) {2291 + if(apc_cache_is_last_key(cache, &key, t TSRMLS_CC)) { 2211 2292 + /* potential cache slam */ 2212 + printf("Last key warning for it!");2213 2293 + return 0; 2214 2294 + } … … 2218 2298 + memset(lastkey, 0, sizeof(apc_keyid_t)); 2219 2299 + 2220 + lastkey->h = h;2300 + lastkey->h = key.h; 2221 2301 + lastkey->keylen = keylen; 2222 2302 + lastkey->mtime = t; … … 2233 2313 + process_pending_removals(cache TSRMLS_CC); 2234 2314 + 2235 + slot = &cache->slots[ h % cache->num_slots];2315 + slot = &cache->slots[key.h % cache->num_slots]; 2236 2316 + 2237 2317 + while (*slot) { 2238 + if (((*slot)->key. data.user.identifier_len == key.data.user.identifier_len) &&2318 + if (((*slot)->key.h == key.h) && 2239 2319 + (!memcmp((*slot)->key.data.user.identifier, key.data.user.identifier, keylen))) { 2240 2320 + /* … … 2267 2347 + } 2268 2348 + 2269 + if ((*slot = make_slot( key, value, *slot, t TSRMLS_CC)) == NULL) {2349 + if ((*slot = make_slot(&key, value, *slot, t TSRMLS_CC)) == NULL) { 2270 2350 + goto fail; 2271 2351 + } … … 2274 2354 + cache->header->mem_size += ctxt->pool->size; 2275 2355 + 2276 + cache->header->num_entries++;2277 + cache->header->num_inserts++;2356 + CACHE_FAST_INC(cache, cache->header->num_entries); 2357 + CACHE_FAST_INC(cache, cache->header->num_inserts); 2278 2358 + 2279 2359 + CACHE_UNLOCK(cache); … … 2294 2374 + volatile slot_t* retval = NULL; 2295 2375 + 2296 + CACHE_ LOCK(cache);2376 + CACHE_RDLOCK(cache); 2297 2377 + if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots]; 2298 + else slot = &cache->slots[ string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len)% cache->num_slots];2378 + else slot = &cache->slots[key.h % cache->num_slots]; 2299 2379 + 2300 2380 + while (*slot) { … … 2303 2383 + if(key_equals((*slot)->key.data.file, key.data.file)) { 2304 2384 + if((*slot)->key.mtime != key.mtime) { 2385 + #if (USE_READ_LOCKS == 0) 2386 + /* this is merely a memory-friendly optimization, if we do have a write-lock 2387 + * might as well move this to the deleted_list right-away. Otherwise an insert 2388 + * of the same key wil do it (or an expunge, *eventually*). 2389 + */ 2305 2390 + remove_slot(cache, slot TSRMLS_CC); 2306 + cache->header->num_misses++; 2307 + CACHE_UNLOCK(cache); 2391 + #endif 2392 + CACHE_SAFE_INC(cache, cache->header->num_misses); 2393 + CACHE_RDUNLOCK(cache); 2308 2394 + return NULL; 2309 2395 + } 2310 + (*slot)->num_hits++;2311 + (*slot)->value->ref_count++;2396 + CACHE_SAFE_INC(cache, (*slot)->num_hits); 2397 + CACHE_SAFE_INC(cache, (*slot)->value->ref_count); 2312 2398 + (*slot)->access_time = t; 2313 2399 + prevent_garbage_collection((*slot)->value); 2314 + cache->header->num_hits++;2400 + CACHE_FAST_INC(cache, cache->header->num_hits); 2315 2401 + retval = *slot; 2316 + CACHE_ UNLOCK(cache);2402 + CACHE_RDUNLOCK(cache); 2317 2403 + return (slot_t*)retval; 2318 2404 + } 2319 2405 + } else { /* APC_CACHE_KEY_FPFILE */ 2320 + if(!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) { 2406 + if(((*slot)->key.h == key.h) && 2407 + !memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1)) { 2321 2408 + /* TTL Check ? */ 2322 + (*slot)->num_hits++;2323 + (*slot)->value->ref_count++;2409 + CACHE_SAFE_INC(cache, (*slot)->num_hits); 2410 + CACHE_SAFE_INC(cache, (*slot)->value->ref_count); 2324 2411 + (*slot)->access_time = t; 2325 2412 + prevent_garbage_collection((*slot)->value); 2326 + cache->header->num_hits++;2413 + CACHE_FAST_INC(cache, cache->header->num_hits); 2327 2414 + retval = *slot; 2328 + CACHE_ UNLOCK(cache);2415 + CACHE_RDUNLOCK(cache); 2329 2416 + return (slot_t*)retval; 2330 2417 + } … … 2333 2420 + slot = &(*slot)->next; 2334 2421 + } 2335 + cache->header->num_misses++;2336 + CACHE_ UNLOCK(cache);2422 + CACHE_FAST_INC(cache, cache->header->num_misses); 2423 + CACHE_RDUNLOCK(cache); 2337 2424 + return NULL; 2338 2425 +} … … 2343 2430 +{ 2344 2431 + slot_t * slot = apc_cache_find_slot(cache, key, t TSRMLS_CC); 2432 + apc_debug("apc_cache_find [%i]\n" TSRMLS_CC, key.h); 2345 2433 + return (slot) ? slot->value : NULL; 2346 2434 +} … … 2352 2440 + slot_t** slot; 2353 2441 + volatile apc_cache_entry_t* value = NULL; 2442 + unsigned long h; 2354 2443 + 2355 2444 + if(apc_cache_busy(cache)) … … 2359 2448 + } 2360 2449 + 2361 + CACHE_LOCK(cache); 2362 + 2363 + slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots]; 2450 + CACHE_RDLOCK(cache); 2451 + 2452 + h = string_nhash_8(strkey, keylen); 2453 + 2454 + slot = &cache->slots[h % cache->num_slots]; 2364 2455 + 2365 2456 + while (*slot) { 2366 + if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2457 + if ((h == (*slot)->key.h) && 2458 + !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2367 2459 + /* Check to make sure this entry isn't expired by a hard TTL */ 2368 2460 + if((*slot)->value->data.user.ttl && (time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) { 2461 + #if (USE_READ_LOCKS == 0) 2462 + /* this is merely a memory-friendly optimization, if we do have a write-lock 2463 + * might as well move this to the deleted_list right-away. Otherwise an insert 2464 + * of the same key wil do it (or an expunge, *eventually*). 2465 + */ 2369 2466 + remove_slot(cache, slot TSRMLS_CC); 2370 + cache->header->num_misses++; 2371 + CACHE_UNLOCK(cache); 2467 + #endif 2468 + CACHE_FAST_INC(cache, cache->header->num_misses); 2469 + CACHE_RDUNLOCK(cache); 2372 2470 + return NULL; 2373 2471 + } 2374 2472 + /* Otherwise we are fine, increase counters and return the cache entry */ 2375 + (*slot)->num_hits++;2376 + (*slot)->value->ref_count++;2473 + CACHE_SAFE_INC(cache, (*slot)->num_hits); 2474 + CACHE_SAFE_INC(cache, (*slot)->value->ref_count); 2377 2475 + (*slot)->access_time = t; 2378 2476 + 2379 + cache->header->num_hits++;2477 + CACHE_FAST_INC(cache, cache->header->num_hits); 2380 2478 + value = (*slot)->value; 2381 + CACHE_ UNLOCK(cache);2479 + CACHE_RDUNLOCK(cache); 2382 2480 + return (apc_cache_entry_t*)value; 2383 2481 + } … … 2385 2483 + } 2386 2484 + 2387 + cache->header->num_misses++;2388 + CACHE_ UNLOCK(cache);2485 + CACHE_FAST_INC(cache, cache->header->num_misses); 2486 + CACHE_RDUNLOCK(cache); 2389 2487 + return NULL; 2390 2488 +} … … 2396 2494 + slot_t** slot; 2397 2495 + volatile apc_cache_entry_t* value = NULL; 2496 + unsigned long h; 2398 2497 + 2399 2498 + if(apc_cache_busy(cache)) … … 2403 2502 + } 2404 2503 + 2405 + CACHE_LOCK(cache); 2406 + 2407 + slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots]; 2504 + CACHE_RDLOCK(cache); 2505 + 2506 + h = string_nhash_8(strkey, keylen); 2507 + 2508 + slot = &cache->slots[h % cache->num_slots]; 2408 2509 + 2409 2510 + while (*slot) { 2410 + if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2511 + if ((h == (*slot)->key.h) && 2512 + !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2411 2513 + /* Check to make sure this entry isn't expired by a hard TTL */ 2412 2514 + if((*slot)->value->data.user.ttl && (time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) { … … 2416 2518 + /* Return the cache entry ptr */ 2417 2519 + value = (*slot)->value; 2418 + CACHE_ UNLOCK(cache);2520 + CACHE_RDUNLOCK(cache); 2419 2521 + return (apc_cache_entry_t*)value; 2420 2522 + } 2421 2523 + slot = &(*slot)->next; 2422 2524 + } 2423 + CACHE_ UNLOCK(cache);2525 + CACHE_RDUNLOCK(cache); 2424 2526 + return NULL; 2425 2527 +} … … 2431 2533 + slot_t** slot; 2432 2534 + int retval; 2535 + unsigned long h; 2433 2536 + 2434 2537 + if(apc_cache_busy(cache)) … … 2440 2543 + CACHE_LOCK(cache); 2441 2544 + 2442 + slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots]; 2545 + h = string_nhash_8(strkey, keylen); 2546 + slot = &cache->slots[h % cache->num_slots]; 2443 2547 + 2444 2548 + while (*slot) { 2445 + if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2446 + retval = updater(cache, (*slot)->value, data); 2447 + (*slot)->key.mtime = apc_time(); 2549 + if ((h == (*slot)->key.h) && 2550 + !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2551 + switch(Z_TYPE_P((*slot)->value->data.user.val) & ~IS_CONSTANT_INDEX) { 2552 + case IS_ARRAY: 2553 + case IS_CONSTANT_ARRAY: 2554 + case IS_OBJECT: 2555 + { 2556 + if(APCG(serializer)) { 2557 + retval = 0; 2558 + break; 2559 + } else { 2560 + /* fall through */ 2561 + } 2562 + } 2563 + /* fall through */ 2564 + default: 2565 + { 2566 + retval = updater(cache, (*slot)->value, data); 2567 + (*slot)->key.mtime = apc_time(); 2568 + } 2569 + break; 2570 + } 2448 2571 + CACHE_UNLOCK(cache); 2449 2572 + return retval; … … 2460 2583 +{ 2461 2584 + slot_t** slot; 2585 + unsigned long h; 2462 2586 + 2463 2587 + CACHE_LOCK(cache); 2464 2588 + 2465 + slot = &cache->slots[string_nhash_8(strkey, keylen) % cache->num_slots]; 2589 + h = string_nhash_8(strkey, keylen); 2590 + 2591 + slot = &cache->slots[h % cache->num_slots]; 2466 2592 + 2467 2593 + while (*slot) { 2468 + if (!memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2594 + if ((h == (*slot)->key.h) && 2595 + !memcmp((*slot)->key.data.user.identifier, strkey, keylen)) { 2469 2596 + remove_slot(cache, slot TSRMLS_CC); 2470 2597 + CACHE_UNLOCK(cache); … … 2497 2624 + 2498 2625 + if(key.type == APC_CACHE_KEY_FILE) slot = &cache->slots[hash(key) % cache->num_slots]; 2499 + else slot = &cache->slots[ string_nhash_8(key.data.fpfile.fullpath, key.data.fpfile.fullpath_len)% cache->num_slots];2626 + else slot = &cache->slots[key.h % cache->num_slots]; 2500 2627 + 2501 2628 + while(*slot) { … … 2508 2635 + } 2509 2636 + } else { /* APC_CACHE_KEY_FPFILE */ 2510 + if(((*slot)->key. data.fpfile.fullpath_len == key.data.fpfile.fullpath_len) &&2637 + if(((*slot)->key.h == key.h) && 2511 2638 + (!memcmp((*slot)->key.data.fpfile.fullpath, key.data.fpfile.fullpath, key.data.fpfile.fullpath_len+1))) { 2512 2639 + remove_slot(cache, slot TSRMLS_CC); … … 2530 2657 +void apc_cache_release(apc_cache_t* cache, apc_cache_entry_t* entry TSRMLS_DC) 2531 2658 +{ 2532 + CACHE_LOCK(cache); 2533 + entry->ref_count--; 2534 + CACHE_UNLOCK(cache); 2659 + CACHE_SAFE_DEC(cache, entry->ref_count); 2535 2660 +} 2536 2661 +/* }}} */ … … 2556 2681 + len = strlen(filename); 2557 2682 + if(APCG(fpstat)==0) { 2558 + if(IS_ABSOLUTE_PATH(filename,len) ) {2683 + if(IS_ABSOLUTE_PATH(filename,len) || strstr(filename, "://")) { 2559 2684 + key->data.fpfile.fullpath = filename; 2560 2685 + key->data.fpfile.fullpath_len = len; 2686 + key->h = string_nhash_8(key->data.fpfile.fullpath, key->data.fpfile.fullpath_len); 2561 2687 + key->mtime = t; 2562 2688 + key->type = APC_CACHE_KEY_FPFILE; … … 2578 2704 + key->data.fpfile.fullpath = APCG(canon_path); 2579 2705 + key->data.fpfile.fullpath_len = strlen(APCG(canon_path)); 2706 + key->h = string_nhash_8(key->data.fpfile.fullpath, key->data.fpfile.fullpath_len); 2580 2707 + key->mtime = t; 2581 2708 + key->type = APC_CACHE_KEY_FPFILE; … … 2626 2753 + key->data.file.device = fileinfo->st_buf.sb.st_dev; 2627 2754 + key->data.file.inode = fileinfo->st_buf.sb.st_ino; 2755 + key->h = (unsigned long) key->data.file.device + (unsigned long) key->data.file.inode; 2628 2756 + 2629 2757 + /* … … 2673 2801 + key->data.user.identifier = identifier; 2674 2802 + key->data.user.identifier_len = identifier_len; 2803 + key->h = string_nhash_8(key->data.user.identifier, key->data.user.identifier_len); 2675 2804 + key->mtime = t; 2676 2805 + key->type = APC_CACHE_KEY_USER; … … 2777 2906 +/* }}} */ 2778 2907 + 2908 +/* {{{ */ 2909 +static zval* apc_cache_link_info(apc_cache_t *cache, slot_t* p TSRMLS_DC) 2910 +{ 2911 + zval *link = NULL; 2912 + char md5str[33]; 2913 + 2914 + ALLOC_INIT_ZVAL(link); 2915 + 2916 + if(!link) { 2917 + return NULL; 2918 + } 2919 + 2920 + array_init(link); 2921 + 2922 + if(p->value->type == APC_CACHE_ENTRY_FILE) { 2923 + add_assoc_string(link, "type", "file", 1); 2924 + if(p->key.type == APC_CACHE_KEY_FILE) { 2925 + 2926 + #ifdef PHP_WIN32 2927 + { 2928 + char buf[20]; 2929 + sprintf(buf, "%I64d", p->key.data.file.device); 2930 + add_assoc_string(link, "device", buf, 1); 2931 + 2932 + sprintf(buf, "%I64d", p->key.data.file.inode); 2933 + add_assoc_string(link, "inode", buf, 1); 2934 + } 2935 + #else 2936 + add_assoc_long(link, "device", p->key.data.file.device); 2937 + add_assoc_long(link, "inode", p->key.data.file.inode); 2938 + #endif 2939 + 2940 + add_assoc_string(link, "filename", p->value->data.file.filename, 1); 2941 + } else { /* This is a no-stat fullpath file entry */ 2942 + add_assoc_long(link, "device", 0); 2943 + add_assoc_long(link, "inode", 0); 2944 + add_assoc_string(link, "filename", (char*)p->key.data.fpfile.fullpath, 1); 2945 + } 2946 + if (APCG(file_md5)) { 2947 + make_digest(md5str, p->key.md5); 2948 + add_assoc_string(link, "md5", md5str, 1); 2949 + } 2950 + } else if(p->value->type == APC_CACHE_ENTRY_USER) { 2951 + add_assoc_stringl(link, "info", p->value->data.user.info, p->value->data.user.info_len-1, 1); 2952 + add_assoc_long(link, "ttl", (long)p->value->data.user.ttl); 2953 + add_assoc_string(link, "type", "user", 1); 2954 + } 2955 + 2956 + add_assoc_double(link, "num_hits", (double)p->num_hits); 2957 + add_assoc_long(link, "mtime", p->key.mtime); 2958 + add_assoc_long(link, "creation_time", p->creation_time); 2959 + add_assoc_long(link, "deletion_time", p->deletion_time); 2960 + add_assoc_long(link, "access_time", p->access_time); 2961 + add_assoc_long(link, "ref_count", p->value->ref_count); 2962 + add_assoc_long(link, "mem_size", p->value->mem_size); 2963 + 2964 + return link; 2965 +} 2966 +/* }}} */ 2967 + 2779 2968 +/* {{{ apc_cache_info */ 2780 +apc_cache_info_t* apc_cache_info(apc_cache_t* cache, zend_bool limited TSRMLS_DC) 2781 +{ 2782 + apc_cache_info_t* info; 2969 +zval* apc_cache_info(apc_cache_t* cache, zend_bool limited TSRMLS_DC) 2970 +{ 2971 + zval *info = NULL; 2972 + zval *list = NULL; 2973 + zval *deleted_list = NULL; 2974 + zval *slots = NULL; 2783 2975 + slot_t* p; 2784 + int i ;2976 + int i, j; 2785 2977 + 2786 2978 + if(!cache) return NULL; 2787 2979 + 2788 + CACHE_LOCK(cache); 2789 + 2790 + info = (apc_cache_info_t*) apc_php_malloc(sizeof(apc_cache_info_t) TSRMLS_CC); 2980 + CACHE_RDLOCK(cache); 2981 + 2982 + ALLOC_INIT_ZVAL(info); 2983 + 2791 2984 + if(!info) { 2792 + CACHE_ UNLOCK(cache);2985 + CACHE_RDUNLOCK(cache); 2793 2986 + return NULL; 2794 2987 + } 2795 + info->num_slots = cache->num_slots; 2796 + info->ttl = cache->ttl; 2797 + info->num_hits = cache->header->num_hits; 2798 + info->num_misses = cache->header->num_misses; 2799 + info->list = NULL; 2800 + info->deleted_list = NULL; 2801 + info->start_time = cache->header->start_time; 2802 + info->expunges = cache->header->expunges; 2803 + info->mem_size = cache->header->mem_size; 2804 + info->num_entries = cache->header->num_entries; 2805 + info->num_inserts = cache->header->num_inserts; 2988 + 2989 + array_init(info); 2990 + add_assoc_long(info, "num_slots", cache->num_slots); 2991 + add_assoc_long(info, "ttl", cache->ttl); 2992 + 2993 + add_assoc_double(info, "num_hits", (double)cache->header->num_hits); 2994 + add_assoc_double(info, "num_misses", (double)cache->header->num_misses); 2995 + add_assoc_double(info, "num_inserts", (double)cache->header->num_inserts); 2996 + add_assoc_double(info, "expunges", (double)cache->header->expunges); 2997 + 2998 + add_assoc_long(info, "start_time", cache->header->start_time); 2999 + add_assoc_double(info, "mem_size", (double)cache->header->mem_size); 3000 + add_assoc_long(info, "num_entries", cache->header->num_entries); 3001 +#ifdef MULTIPART_EVENT_FORMDATA 3002 + add_assoc_long(info, "file_upload_progress", 1); 3003 +#else 3004 + add_assoc_long(info, "file_upload_progress", 0); 3005 +#endif 3006 +#if APC_MMAP 3007 + add_assoc_stringl(info, "memory_type", "mmap", sizeof("mmap")-1, 1); 3008 +#else 3009 + add_assoc_stringl(info, "memory_type", "IPC shared", sizeof("IPC shared")-1, 1); 3010 +#endif 3011 + add_assoc_stringl(info, "locking_type", APC_LOCK_TYPE, sizeof(APC_LOCK_TYPE)-1, 1); 2806 3012 + 2807 3013 + if(!limited) { 2808 3014 + /* For each hashtable slot */ 2809 + for (i = 0; i < info->num_slots; i++) { 3015 + ALLOC_INIT_ZVAL(list); 3016 + array_init(list); 3017 + 3018 + ALLOC_INIT_ZVAL(slots); 3019 + array_init(slots); 3020 + 3021 + for (i = 0; i < cache->num_slots; i++) { 2810 3022 + p = cache->slots[i]; 3023 + j = 0; 2811 3024 + for (; p != NULL; p = p->next) { 2812 + apc_cache_link_t* link = (apc_cache_link_t*) apc_php_malloc(sizeof(apc_cache_link_t) TSRMLS_CC); 2813 + 2814 + if(p->value->type == APC_CACHE_ENTRY_FILE) { 2815 + if(p->key.type == APC_CACHE_KEY_FILE) { 2816 + link->data.file.device = p->key.data.file.device; 2817 + link->data.file.inode = p->key.data.file.inode; 2818 + link->data.file.filename = apc_xstrdup(p->value->data.file.filename, apc_php_malloc TSRMLS_CC); 2819 + } else { /* This is a no-stat fullpath file entry */ 2820 + link->data.file.device = 0; 2821 + link->data.file.inode = 0; 2822 + link->data.file.filename = apc_xstrdup(p->key.data.fpfile.fullpath, apc_php_malloc TSRMLS_CC); 2823 + } 2824 + link->type = APC_CACHE_ENTRY_FILE; 2825 + if (APCG(file_md5)) { 2826 + link->data.file.md5 = emalloc(sizeof(p->key.md5)); 2827 + memcpy(link->data.file.md5, p->key.md5, 16); 2828 + } else { 2829 + link->data.file.md5 = NULL; 2830 + } 2831 + } else if(p->value->type == APC_CACHE_ENTRY_USER) { 2832 + link->data.user.info = apc_xmemcpy(p->value->data.user.info, p->value->data.user.info_len+1, apc_php_malloc TSRMLS_CC); 2833 + link->data.user.ttl = p->value->data.user.ttl; 2834 + link->type = APC_CACHE_ENTRY_USER; 2835 + } 2836 + link->num_hits = p->num_hits; 2837 + link->mtime = p->key.mtime; 2838 + link->creation_time = p->creation_time; 2839 + link->deletion_time = p->deletion_time; 2840 + link->access_time = p->access_time; 2841 + link->ref_count = p->value->ref_count; 2842 + link->mem_size = p->value->mem_size; 2843 + link->next = info->list; 2844 + info->list = link; 3025 + zval *link = apc_cache_link_info(cache, p TSRMLS_CC); 3026 + add_next_index_zval(list, link); 3027 + j++; 2845 3028 + } 3029 + if(j != 0) { 3030 + add_index_long(slots, (ulong)i, j); 3031 + } 2846 3032 + } 2847 3033 + 2848 3034 + /* For each slot pending deletion */ 3035 + ALLOC_INIT_ZVAL(deleted_list); 3036 + array_init(deleted_list); 3037 + 2849 3038 + for (p = cache->header->deleted_list; p != NULL; p = p->next) { 2850 + apc_cache_link_t* link = (apc_cache_link_t*) apc_php_malloc(sizeof(apc_cache_link_t) TSRMLS_CC); 2851 + 2852 + if(p->value->type == APC_CACHE_ENTRY_FILE) { 2853 + if(p->key.type == APC_CACHE_KEY_FILE) { 2854 + link->data.file.device = p->key.data.file.device; 2855 + link->data.file.inode = p->key.data.file.inode; 2856 + link->data.file.filename = apc_xstrdup(p->value->data.file.filename, apc_php_malloc TSRMLS_CC); 2857 + } else { /* This is a no-stat fullpath file entry */ 2858 + link->data.file.device = 0; 2859 + link->data.file.inode = 0; 2860 + link->data.file.filename = apc_xstrdup(p->key.data.fpfile.fullpath, apc_php_malloc TSRMLS_CC); 2861 + } 2862 + link->type = APC_CACHE_ENTRY_FILE; 2863 + if (APCG(file_md5)) { 2864 + link->data.file.md5 = emalloc(sizeof(p->key.md5)); 2865 + memcpy(link->data.file.md5, p->key.md5, 16); 2866 + } else { 2867 + link->data.file.md5 = NULL; 2868 + } 2869 + } else if(p->value->type == APC_CACHE_ENTRY_USER) { 2870 + link->data.user.info = apc_xmemcpy(p->value->data.user.info, p->value->data.user.info_len+1, apc_php_malloc TSRMLS_CC); 2871 + link->data.user.ttl = p->value->data.user.ttl; 2872 + link->type = APC_CACHE_ENTRY_USER; 2873 + } 2874 + link->num_hits = p->num_hits; 2875 + link->mtime = p->key.mtime; 2876 + link->creation_time = p->creation_time; 2877 + link->deletion_time = p->deletion_time; 2878 + link->access_time = p->access_time; 2879 + link->ref_count = p->value->ref_count; 2880 + link->mem_size = p->value->mem_size; 2881 + link->next = info->deleted_list; 2882 + info->deleted_list = link; 2883 + } 2884 + } 2885 + 2886 + CACHE_UNLOCK(cache); 3039 + zval *link = apc_cache_link_info(cache, p TSRMLS_CC); 3040 + add_next_index_zval(deleted_list, link); 3041 + } 3042 + 3043 + add_assoc_zval(info, "cache_list", list); 3044 + add_assoc_zval(info, "deleted_list", deleted_list); 3045 + add_assoc_zval(info, "slot_distribution", slots); 3046 + } 3047 + 3048 + CACHE_RDUNLOCK(cache); 2887 3049 + return info; 2888 +}2889 +/* }}} */2890 +2891 +/* {{{ apc_cache_free_info */2892 +void apc_cache_free_info(apc_cache_info_t* info TSRMLS_DC)2893 +{2894 + apc_cache_link_t* p = info->list;2895 + apc_cache_link_t* q = NULL;2896 + while (p != NULL) {2897 + q = p;2898 + p = p->next;2899 + if(q->type == APC_CACHE_ENTRY_FILE) {2900 + if(q->data.file.md5) {2901 + efree(q->data.file.md5);2902 + }2903 + apc_php_free(q->data.file.filename TSRMLS_CC);2904 + }2905 + else if(q->type == APC_CACHE_ENTRY_USER) apc_php_free(q->data.user.info TSRMLS_CC);2906 + apc_php_free(q TSRMLS_CC);2907 + }2908 + p = info->deleted_list;2909 + while (p != NULL) {2910 + q = p;2911 + p = p->next;2912 + if(q->type == APC_CACHE_ENTRY_FILE) {2913 + if(q->data.file.md5) {2914 + efree(q->data.file.md5);2915 + }2916 + apc_php_free(q->data.file.filename TSRMLS_CC);2917 + }2918 + else if(q->type == APC_CACHE_ENTRY_USER) apc_php_free(q->data.user.info TSRMLS_CC);2919 + apc_php_free(q TSRMLS_CC);2920 + }2921 + apc_php_free(info TSRMLS_CC);2922 3050 +} 2923 3051 +/* }}} */ … … 2938 3066 + 2939 3067 +/* {{{ apc_cache_is_last_key */ 2940 +zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h,time_t t TSRMLS_DC)3068 +zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC) 2941 3069 +{ 2942 3070 + apc_keyid_t *lastkey = &cache->header->lastkey; … … 2951 3079 + 2952 3080 + 2953 + if(!h) h = string_nhash_8(key->data.user.identifier, keylen);2954 +2955 3081 + /* unlocked reads, but we're not shooting for 100% success with this */ 2956 + if(lastkey->h == h && keylen == lastkey->keylen) {3082 + if(lastkey->h == key->h && keylen == lastkey->keylen) { 2957 3083 + if(lastkey->mtime == t && FROM_DIFFERENT_THREAD(lastkey)) { 2958 3084 + /* potential cache slam */ 2959 3085 + if(APCG(slam_defense)) { 2960 + apc_ warning("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier);3086 + apc_debug("Potential cache slam averted for key '%s'" TSRMLS_CC, key->data.user.identifier); 2961 3087 + return 1; 2962 3088 + } … … 2992 3118 + * vim<600: expandtab sw=4 ts=4 sts=4 2993 3119 + */ 2994 --- /dev/null 2995 +++ b/ext/apc/apc_cache.h 2996 @@ -0,0 +1,403 @@ 3120 diff -Naur a/ext/apc/apc_cache.h b/ext/apc/apc_cache.h 3121 --- a/ext/apc/apc_cache.h 1970-01-01 01:00:00.000000000 +0100 3122 +++ b/ext/apc/apc_cache.h 2012-07-20 00:10:35.000000000 +0200 3123 @@ -0,0 +1,371 @@ 2997 3124 +/* 2998 3125 + +----------------------------------------------------------------------+ 2999 3126 + | APC | 3000 3127 + +----------------------------------------------------------------------+ 3001 + | Copyright (c) 2006-201 0The PHP Group |3128 + | Copyright (c) 2006-2011 The PHP Group | 3002 3129 + +----------------------------------------------------------------------+ 3003 3130 + | This source file is subject to version 3.01 of the PHP license, | … … 3023 3150 + */ 3024 3151 + 3025 +/* $Id: apc_cache.h 3 05258 2010-11-10 19:02:06Z gopalv$ */3152 +/* $Id: apc_cache.h 324329 2012-03-18 15:29:37Z mike $ */ 3026 3153 + 3027 3154 +#ifndef APC_CACHE_H … … 3060 3187 +#define CACHE_SAFE_LOCK(cache) { if ((++cache->has_lock) == 1) LOCK(cache->header->lock); } 3061 3188 +#define CACHE_SAFE_UNLOCK(cache) { if ((--cache->has_lock) == 0) UNLOCK(cache->header->lock); } 3189 + 3190 +#if (RDLOCK_AVAILABLE == 1) && defined(HAVE_ATOMIC_OPERATIONS) 3191 +#define USE_READ_LOCKS 1 3192 +#define CACHE_RDLOCK(cache) { RDLOCK(cache->header->lock); cache->has_lock = 0; } 3193 +#define CACHE_RDUNLOCK(cache) { RDUNLOCK(cache->header->lock); cache->has_lock = 0; } 3194 +#define CACHE_SAFE_INC(cache, obj) { ATOMIC_INC(obj); } 3195 +#define CACHE_SAFE_DEC(cache, obj) { ATOMIC_DEC(obj); } 3196 +#else 3197 +#define USE_READ_LOCKS 0 3198 +#define CACHE_RDLOCK(cache) { LOCK(cache->header->lock); cache->has_lock = 1; } 3199 +#define CACHE_RDUNLOCK(cache) { UNLOCK(cache->header->lock); cache->has_lock = 0; } 3200 +#define CACHE_SAFE_INC(cache, obj) { CACHE_SAFE_LOCK(cache); obj++; CACHE_SAFE_UNLOCK(cache);} 3201 +#define CACHE_SAFE_DEC(cache, obj) { CACHE_SAFE_LOCK(cache); obj--; CACHE_SAFE_UNLOCK(cache);} 3202 +#endif 3203 + 3204 +#define CACHE_FAST_INC(cache, obj) { obj++; } 3205 +#define CACHE_FAST_DEC(cache, obj) { obj--; } 3062 3206 +/* }}} */ 3063 3207 + … … 3084 3228 +struct apc_cache_key_t { 3085 3229 + apc_cache_key_data_t data; 3230 + unsigned long h; /* pre-computed hash value */ 3086 3231 + time_t mtime; /* the mtime of this cached entry */ 3087 3232 + unsigned char type; … … 3263 3408 + apc_class_t* classes, 3264 3409 + apc_context_t* ctxt 3265 + 3266 + 3267 + 3268 +zend_bool apc_compile_cache_entry(apc_cache_key_t key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array_pp, apc_cache_entry_t** cache_entry_pp TSRMLS_DC);3410 + TSRMLS_DC); 3411 + 3412 + 3413 +zend_bool apc_compile_cache_entry(apc_cache_key_t *key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array_pp, apc_cache_entry_t** cache_entry_pp TSRMLS_DC); 3269 3414 + 3270 3415 +/* … … 3275 3420 + 3276 3421 +extern int apc_cache_make_user_key(apc_cache_key_t* key, char* identifier, int identifier_len, const time_t t); 3277 +3278 +/* {{{ struct definition: apc_cache_link_data_t */3279 +typedef union _apc_cache_link_data_t {3280 + struct {3281 + char *filename;3282 + apc_ino_t device;3283 + apc_dev_t inode;3284 + unsigned char *md5;3285 + } file;3286 + struct {3287 + char *info;3288 + unsigned int ttl;3289 + } user;3290 +} apc_cache_link_data_t;3291 +/* }}} */3292 +3293 +/* {{{ struct definition: apc_cache_link_t */3294 +typedef struct apc_cache_link_t apc_cache_link_t;3295 +struct apc_cache_link_t {3296 + apc_cache_link_data_t data;3297 + unsigned char type;3298 + unsigned long num_hits;3299 + time_t mtime;3300 + time_t creation_time;3301 + time_t deletion_time;3302 + time_t access_time;3303 + int ref_count;3304 + size_t mem_size;3305 + apc_cache_link_t* next;3306 +};3307 +/* }}} */3308 +3309 +3310 +/* {{{ struct definition: apc_cache_info_t */3311 +typedef struct apc_cache_info_t apc_cache_info_t;3312 +struct apc_cache_info_t {3313 + int num_slots;3314 + unsigned long num_hits;3315 + unsigned long num_misses;3316 + unsigned long num_inserts;3317 + unsigned long expunges;3318 + int ttl;3319 + apc_cache_link_t* list;3320 + apc_cache_link_t* deleted_list;3321 + time_t start_time;3322 + int num_entries;3323 + size_t mem_size;3324 +};3325 +/* }}} */3326 3422 + 3327 3423 +/* {{{ struct definition: slot_t */ … … 3372 3468 +/* }}} */ 3373 3469 + 3374 +extern apc_cache_info_t* apc_cache_info(T cache, zend_bool limited TSRMLS_DC); 3375 +extern void apc_cache_free_info(apc_cache_info_t* info TSRMLS_DC); 3470 +extern zval* apc_cache_info(T cache, zend_bool limited TSRMLS_DC); 3376 3471 +extern void apc_cache_unlock(apc_cache_t* cache TSRMLS_DC); 3377 3472 +extern zend_bool apc_cache_busy(apc_cache_t* cache); 3378 3473 +extern zend_bool apc_cache_write_lock(apc_cache_t* cache TSRMLS_DC); 3379 3474 +extern void apc_cache_write_unlock(apc_cache_t* cache TSRMLS_DC); 3380 +extern zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, unsigned int h,time_t t TSRMLS_DC);3475 +extern zend_bool apc_cache_is_last_key(apc_cache_t* cache, apc_cache_key_t* key, time_t t TSRMLS_DC); 3381 3476 + 3382 3477 +/* used by apc_rfc1867 to update data in-place - not to be used elsewhere */ … … 3398 3493 + * vim<600: expandtab sw=4 ts=4 sts=4 3399 3494 + */ 3400 --- /dev/null 3401 +++ b/ext/apc/apc_compile.c 3402 @@ -0,0 +1,2102 @@ 3495 diff -Naur a/ext/apc/apc_compile.c b/ext/apc/apc_compile.c 3496 --- a/ext/apc/apc_compile.c 1970-01-01 01:00:00.000000000 +0100 3497 +++ b/ext/apc/apc_compile.c 2012-07-20 00:10:35.000000000 +0200 3498 @@ -0,0 +1,2164 @@ 3403 3499 +/* 3404 3500 + +----------------------------------------------------------------------+ 3405 3501 + | APC | 3406 3502 + +----------------------------------------------------------------------+ 3407 + | Copyright (c) 2006-201 0The PHP Group |3503 + | Copyright (c) 2006-2011 The PHP Group | 3408 3504 + +----------------------------------------------------------------------+ 3409 3505 + | This source file is subject to version 3.01 of the PHP license, | … … 3431 3527 + */ 3432 3528 + 3433 +/* $Id: apc_compile.c 3 03796 2010-09-27 17:14:18Z gopalv$ */3529 +/* $Id: apc_compile.c 326703 2012-07-19 17:06:12Z rasmus $ */ 3434 3530 + 3435 3531 +#include "apc_compile.h" 3436 3532 +#include "apc_globals.h" 3437 3533 +#include "apc_zend.h" 3534 +#include "apc_php.h" 3438 3535 +#include "apc_string.h" 3439 3536 +#include "ext/standard/php_var.h" 3440 3537 +#include "ext/standard/php_smart_str.h" 3441 +3442 +#ifndef IS_CONSTANT_TYPE_MASK3443 +#define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX)3444 +#endif3445 3538 + 3446 3539 +typedef void* (*ht_copy_fun_t)(void*, void*, apc_context_t* TSRMLS_DC); … … 3463 3556 +static zval** my_copy_zval_ptr(zval**, const zval**, apc_context_t* TSRMLS_DC); 3464 3557 +static zval* my_copy_zval(zval*, const zval*, apc_context_t* TSRMLS_DC); 3558 +#ifndef ZEND_ENGINE_2_4 3465 3559 +static znode* my_copy_znode(znode*, znode*, apc_context_t* TSRMLS_DC); 3560 +#endif 3466 3561 +static zend_op* my_copy_zend_op(zend_op*, zend_op*, apc_context_t* TSRMLS_DC); 3467 3562 +static zend_function* my_copy_function(zend_function*, zend_function*, apc_context_t* TSRMLS_DC); … … 3496 3591 + */ 3497 3592 +static int my_check_copy_function(Bucket* src, va_list args); 3593 +static int my_check_copy_property_info(Bucket* src, va_list args); 3594 +#ifndef ZEND_ENGINE_2_4 3498 3595 +static int my_check_copy_default_property(Bucket* p, va_list args); 3499 +static int my_check_copy_property_info(Bucket* src, va_list args);3500 3596 +static int my_check_copy_static_member(Bucket* src, va_list args); 3597 +#endif 3501 3598 +static int my_check_copy_constant(Bucket* src, va_list args); 3502 3599 + 3600 +/* }}} */ 3601 + 3602 +/* {{{ apc php serializers */ 3603 +int APC_SERIALIZER_NAME(php) (APC_SERIALIZER_ARGS) 3604 +{ 3605 + smart_str strbuf = {0}; 3606 + php_serialize_data_t var_hash; 3607 + PHP_VAR_SERIALIZE_INIT(var_hash); 3608 + php_var_serialize(&strbuf, (zval**)&value, &var_hash TSRMLS_CC); 3609 + PHP_VAR_SERIALIZE_DESTROY(var_hash); 3610 + if(strbuf.c) { 3611 + *buf = (unsigned char*)strbuf.c; 3612 + *buf_len = strbuf.len; 3613 + smart_str_0(&strbuf); 3614 + return 1; 3615 + } 3616 + return 0; 3617 +} 3618 + 3619 +int APC_UNSERIALIZER_NAME(php) (APC_UNSERIALIZER_ARGS) 3620 +{ 3621 + const unsigned char *tmp = buf; 3622 + php_unserialize_data_t var_hash; 3623 + PHP_VAR_UNSERIALIZE_INIT(var_hash); 3624 + if(!php_var_unserialize(value, &tmp, buf + buf_len, &var_hash TSRMLS_CC)) { 3625 + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); 3626 + zval_dtor(*value); 3627 + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %ld bytes", (long)(tmp - buf), (long)buf_len); 3628 + (*value)->type = IS_NULL; 3629 + return 0; 3630 + } 3631 + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); 3632 + return 1; 3633 +} 3503 3634 +/* }}} */ 3504 3635 + … … 3601 3732 +{ 3602 3733 + smart_str buf = {0}; 3603 + php_serialize_data_t var_hash;3604 3734 + apc_pool* pool = ctxt->pool; 3605 + 3606 + PHP_VAR_SERIALIZE_INIT(var_hash); 3607 + php_var_serialize(&buf, (zval**)&src, &var_hash TSRMLS_CC); 3608 + PHP_VAR_SERIALIZE_DESTROY(var_hash); 3609 + 3610 + if(buf.c) { 3735 + apc_serialize_t serialize = APC_SERIALIZER_NAME(php); 3736 + void *config = NULL; 3737 + 3738 + if(APCG(serializer)) { /* TODO: move to ctxt */ 3739 + serialize = APCG(serializer)->serialize; 3740 + config = APCG(serializer)->config; 3741 + } 3742 + 3743 + if(serialize((unsigned char**)&buf.c, &buf.len, src, config TSRMLS_CC)) { 3611 3744 + dst->type = src->type & ~IS_CONSTANT_INDEX; 3612 3745 + dst->value.str.len = buf.len; 3613 3746 + CHECK(dst->value.str.val = apc_pmemcpy(buf.c, (buf.len + 1), pool TSRMLS_CC)); 3614 + dst->type = src->type;3615 + smart_str_free(&buf);3616 + }3747 + } 3748 + 3749 + if(buf.c) smart_str_free(&buf); 3617 3750 + 3618 3751 + return dst; … … 3623 3756 +static zval* my_unserialize_object(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC) 3624 3757 +{ 3625 + php_unserialize_data_t var_hash; 3626 + const unsigned char *p = (unsigned char*)Z_STRVAL_P(src); 3627 + 3628 + PHP_VAR_UNSERIALIZE_INIT(var_hash); 3629 + if(!php_var_unserialize(&dst, &p, p + Z_STRLEN_P(src), &var_hash TSRMLS_CC)) { 3630 + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); 3758 + apc_unserialize_t unserialize = APC_UNSERIALIZER_NAME(php); 3759 + unsigned char *p = (unsigned char*)Z_STRVAL_P(src); 3760 + void *config = NULL; 3761 + 3762 + if(APCG(serializer)) { /* TODO: move to ctxt */ 3763 + unserialize = APCG(serializer)->unserialize; 3764 + config = APCG(serializer)->config; 3765 + } 3766 + 3767 + if(unserialize(&dst, p, Z_STRLEN_P(src), config TSRMLS_CC)) { 3768 + return dst; 3769 + } else { 3631 3770 + zval_dtor(dst); 3632 + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %d bytes", (long)((char*)p - Z_STRVAL_P(src)), Z_STRLEN_P(src));3633 3771 + dst->type = IS_NULL; 3634 3772 + } 3635 + PHP_VAR_UNSERIALIZE_DESTROY(var_hash);3636 3773 + return dst; 3637 3774 +} … … 3641 3778 +{ 3642 3779 +#ifdef ZEND_ENGINE_2_4 3780 +#ifndef ZTS 3643 3781 + if (pool->type != APC_UNPOOL) { 3644 + char * ret = apc_new_interned_string(str, len TSRMLS_CC);3782 + char * ret = (char*)apc_new_interned_string((const char*)str, len TSRMLS_CC); 3645 3783 + if (ret) { 3646 3784 + return ret; … … 3648 3786 + } 3649 3787 +#endif 3788 +#endif 3650 3789 + return apc_pmemcpy(str, len, pool TSRMLS_CC); 3651 3790 +} 3652 3791 + 3653 3792 +/* {{{ my_copy_zval */ 3654 +static zval* my_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC)3793 +static APC_HOTSPOT zval* my_copy_zval(zval* dst, const zval* src, apc_context_t* ctxt TSRMLS_DC) 3655 3794 +{ 3656 3795 + zval **tmp; … … 3705 3844 + case IS_ARRAY: 3706 3845 + case IS_CONSTANT_ARRAY: 3707 + 3708 + CHECK(dst->value.ht = 3709 + my_copy_hashtable(NULL, 3710 + src->value.ht, 3711 + (ht_copy_fun_t) my_copy_zval_ptr, 3712 + 1, 3713 + ctxt)); 3714 + break; 3846 + if(APCG(serializer) == NULL || 3847 + ctxt->copy == APC_COPY_IN_OPCODE || ctxt->copy == APC_COPY_OUT_OPCODE) { 3848 + 3849 + CHECK(dst->value.ht = 3850 + my_copy_hashtable(NULL, 3851 + src->value.ht, 3852 + (ht_copy_fun_t) my_copy_zval_ptr, 3853 + 1, 3854 + ctxt)); 3855 + break; 3856 + } else { 3857 + /* fall through to object case */ 3858 + } 3715 3859 + 3716 3860 + case IS_OBJECT: … … 4166 4310 + 4167 4311 + if (src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)) { 4168 + int i,n;4312 + int n; 4169 4313 + 4170 4314 + for (n = 0; src->type == ZEND_INTERNAL_CLASS && ZEND_CE_BUILTIN_FUNCTIONS(src)[n].fname != NULL; n++) {} … … 4190 4334 + 4191 4335 +/* {{{ my_copy_hashtable_ex */ 4192 +static HashTable* my_copy_hashtable_ex(HashTable* dst,4336 +static APC_HOTSPOT HashTable* my_copy_hashtable_ex(HashTable* dst, 4193 4337 + HashTable* src TSRMLS_DC, 4194 4338 + ht_copy_fun_t copy_fn, … … 4244 4388 + } else if (IS_INTERNED(curr->arKey)) { 4245 4389 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC))); 4390 +#ifndef ZTS 4246 4391 + } else if (pool->type != APC_UNPOOL) { 4247 4392 + char *arKey; 4248 4393 + 4394 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC))); 4249 4395 + arKey = apc_new_interned_string(curr->arKey, curr->nKeyLength TSRMLS_CC); 4250 4396 + if (!arKey) { 4251 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, (sizeof(Bucket) + curr->nKeyLength), pool TSRMLS_CC))); 4252 + newp->arKey = ((char*)newp) + sizeof(Bucket); 4397 + CHECK((newp->arKey = (char*) apc_pmemcpy(curr->arKey, curr->nKeyLength, pool TSRMLS_CC))); 4253 4398 + } else { 4254 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));4255 4399 + newp->arKey = arKey; 4256 4400 + } 4401 +#endif 4257 4402 + } else { 4258 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, (sizeof(Bucket) + curr->nKeyLength), pool TSRMLS_CC)));4259 + newp->arKey = ((char*)newp) + sizeof(Bucket);4403 + CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC))); 4404 + CHECK((newp->arKey = (char*) apc_pmemcpy(curr->arKey, curr->nKeyLength, pool TSRMLS_CC))); 4260 4405 + } 4261 4406 +#else … … 4304 4449 + 4305 4450 + dst->pListTail = newp; 4451 + 4452 + zend_hash_internal_pointer_reset(dst); 4306 4453 + 4307 4454 + return dst; … … 4372 4519 +#ifdef ZEND_ENGINE_2_3 4373 4520 + case ZEND_JMP_SET: 4521 +#endif 4522 +#ifdef ZEND_ENGINE_2_4 4523 + case ZEND_JMP_SET_VAR: 4374 4524 +#endif 4375 4525 +#ifdef ZEND_ENGINE_2_4 … … 4482 4632 +#ifdef ZEND_ENGINE_2_3 4483 4633 + case ZEND_JMP_SET: 4634 +#endif 4635 +#ifdef ZEND_ENGINE_2_4 4636 + case ZEND_JMP_SET_VAR: 4484 4637 +#endif 4485 4638 + if(flags != NULL) { … … 4617 4770 + Z_STRLEN_P(dzo->op1.zv) = strlen(fullpath); 4618 4771 + Z_STRVAL_P(dzo->op1.zv) = apc_pstrdup(fullpath, pool TSRMLS_CC); 4772 + Z_TYPE_P(dzo->op1.zv) = IS_STRING; 4619 4773 + Z_SET_REFCOUNT_P(dzo->op1.zv, 2); 4620 4774 + Z_SET_ISREF_P(dzo->op1.zv); … … 4940 5094 +#endif 4941 5095 +#ifdef ZEND_ENGINE_2_4 5096 + case ZEND_JMP_SET_VAR: 5097 +#endif 5098 +#ifdef ZEND_ENGINE_2_4 4942 5099 + dzo->op2.jmp_addr = dst->opcodes + 4943 5100 + (zo->op2.jmp_addr - src->opcodes); … … 5052 5209 + 5053 5210 +#ifdef ZEND_ENGINE_2_4 5211 + dst->name = apc_string_pmemcpy((char*)src->name, src->name_length+1, ctxt->pool TSRMLS_CC); 5054 5212 + dst->default_properties_count = src->default_properties_count; 5055 5213 + if (src->default_properties_count) { … … 5503 5661 + * vim<600: expandtab sw=4 ts=4 sts=4 5504 5662 + */ 5505 --- /dev/null 5506 +++ b/ext/apc/apc_compile.h 5507 @@ -0,0 +1,146 @@ 5663 diff -Naur a/ext/apc/apc_compile.h b/ext/apc/apc_compile.h 5664 --- a/ext/apc/apc_compile.h 1970-01-01 01:00:00.000000000 +0100 5665 +++ b/ext/apc/apc_compile.h 2012-07-20 00:10:35.000000000 +0200 5666 @@ -0,0 +1,152 @@ 5508 5667 +/* 5509 5668 + +----------------------------------------------------------------------+ 5510 5669 + | APC | 5511 5670 + +----------------------------------------------------------------------+ 5512 + | Copyright (c) 2006-201 0The PHP Group |5671 + | Copyright (c) 2006-2011 The PHP Group | 5513 5672 + +----------------------------------------------------------------------+ 5514 5673 + | This source file is subject to version 3.01 of the PHP license, | … … 5535 5694 + */ 5536 5695 + 5537 +/* $Id: apc_compile.h 30 3388 2010-09-15 09:50:28Z dmitry$ */5696 +/* $Id: apc_compile.h 307185 2011-01-06 21:13:11Z gopalv $ */ 5538 5697 + 5539 5698 +#ifndef APC_COMPILE_H … … 5549 5708 +#include "apc_php.h" 5550 5709 +#include "apc_main.h" 5710 +#include "apc_serializer.h" 5551 5711 + 5552 5712 +/* {{{ struct definition: apc_function_t */ … … 5642 5802 +void apc_do_halt_compiler_register(const char *filename, long halt_offset TSRMLS_DC); 5643 5803 + 5804 +/* 5805 + * apc serialization functions 5806 + */ 5807 +int APC_SERIALIZER_NAME(php) (APC_SERIALIZER_ARGS); 5808 +int APC_UNSERIALIZER_NAME(php) (APC_UNSERIALIZER_ARGS); 5644 5809 +#endif 5645 5810 + … … 5652 5817 + * vim<600: expandtab sw=4 ts=4 sts=4 5653 5818 + */ 5654 --- /dev/null 5655 +++ b/ext/apc/apc_debug.c 5819 diff -Naur a/ext/apc/apc_debug.c b/ext/apc/apc_debug.c 5820 --- a/ext/apc/apc_debug.c 1970-01-01 01:00:00.000000000 +0100 5821 +++ b/ext/apc/apc_debug.c 2012-07-20 00:10:35.000000000 +0200 5656 5822 @@ -0,0 +1,70 @@ 5657 5823 +/* … … 5659 5825 + | APC | 5660 5826 + +----------------------------------------------------------------------+ 5661 + | Copyright (c) 2006-201 0The PHP Group |5827 + | Copyright (c) 2006-2011 The PHP Group | 5662 5828 + +----------------------------------------------------------------------+ 5663 5829 + | This source file is subject to version 3.01 of the PHP license, | … … 5683 5849 +*/ 5684 5850 + 5685 +/* $Id: apc_debug.c 30 4107 2010-10-05 15:14:06Z kalle $ */5851 +/* $Id: apc_debug.c 307048 2011-01-03 23:53:17Z kalle $ */ 5686 5852 +#include "apc.h" 5687 5853 +#include <stdio.h> … … 5725 5891 +#endif 5726 5892 +} 5727 --- /dev/null 5728 +++ b/ext/apc/apc_debug.h 5893 diff -Naur a/ext/apc/apc_debug.h b/ext/apc/apc_debug.h 5894 --- a/ext/apc/apc_debug.h 1970-01-01 01:00:00.000000000 +0100 5895 +++ b/ext/apc/apc_debug.h 2012-07-20 00:10:35.000000000 +0200 5729 5896 @@ -0,0 +1,29 @@ 5730 5897 +/* … … 5732 5899 + | APC | 5733 5900 + +----------------------------------------------------------------------+ 5734 + | Copyright (c) 2006-201 0The PHP Group |5901 + | Copyright (c) 2006-2011 The PHP Group | 5735 5902 + +----------------------------------------------------------------------+ 5736 5903 + | This source file is subject to version 3.01 of the PHP license, | … … 5757 5924 + 5758 5925 +void dump(zend_op_array * TSRMLS_DC); 5759 --- /dev/null 5760 +++ b/ext/apc/apc_fcntl.c 5926 diff -Naur a/ext/apc/apc_fcntl.c b/ext/apc/apc_fcntl.c 5927 --- a/ext/apc/apc_fcntl.c 1970-01-01 01:00:00.000000000 +0100 5928 +++ b/ext/apc/apc_fcntl.c 2012-07-20 00:10:35.000000000 +0200 5761 5929 @@ -0,0 +1,123 @@ 5762 5930 +/* … … 5764 5932 + | APC | 5765 5933 + +----------------------------------------------------------------------+ 5766 + | Copyright (c) 2006-201 0The PHP Group |5934 + | Copyright (c) 2006-2011 The PHP Group | 5767 5935 + +----------------------------------------------------------------------+ 5768 5936 + | This source file is subject to version 3.01 of the PHP license, | … … 5788 5956 + */ 5789 5957 + 5790 +/* $Id: apc_fcntl.c 30 2175 2010-08-13 06:20:28Z kalle $ */5958 +/* $Id: apc_fcntl.c 307048 2011-01-03 23:53:17Z kalle $ */ 5791 5959 + 5792 5960 +#include "apc.h" … … 5883 6051 + * vim<600: expandtab sw=4 ts=4 sts=4 5884 6052 + */ 5885 --- /dev/null 5886 +++ b/ext/apc/apc_fcntl.h 6053 diff -Naur a/ext/apc/apc_fcntl.h b/ext/apc/apc_fcntl.h 6054 --- a/ext/apc/apc_fcntl.h 1970-01-01 01:00:00.000000000 +0100 6055 +++ b/ext/apc/apc_fcntl.h 2012-07-20 00:10:35.000000000 +0200 5887 6056 @@ -0,0 +1,50 @@ 5888 6057 +/* … … 5890 6059 + | APC | 5891 6060 + +----------------------------------------------------------------------+ 5892 + | Copyright (c) 2006-201 0The PHP Group |6061 + | Copyright (c) 2006-2011 The PHP Group | 5893 6062 + +----------------------------------------------------------------------+ 5894 6063 + | This source file is subject to version 3.01 of the PHP license, | … … 5914 6083 + */ 5915 6084 + 5916 +/* $Id: apc_fcntl.h 30 2175 2010-08-13 06:20:28Z kalle $ */6085 +/* $Id: apc_fcntl.h 307048 2011-01-03 23:53:17Z kalle $ */ 5917 6086 + 5918 6087 +#ifndef APC_FCNTL_H … … 5936 6105 + * vim<600: expandtab sw=4 ts=4 sts=4 5937 6106 + */ 5938 --- /dev/null 5939 +++ b/ext/apc/apc_fcntl_win32.c 5940 @@ -0,0 +1,117 @@ 6107 diff -Naur a/ext/apc/apc_fcntl_win32.c b/ext/apc/apc_fcntl_win32.c 6108 --- a/ext/apc/apc_fcntl_win32.c 1970-01-01 01:00:00.000000000 +0100 6109 +++ b/ext/apc/apc_fcntl_win32.c 2012-07-20 00:10:35.000000000 +0200 6110 @@ -0,0 +1,120 @@ 5941 6111 +/* 5942 6112 + +----------------------------------------------------------------------+ 5943 6113 + | APC | 5944 6114 + +----------------------------------------------------------------------+ 5945 + | Copyright (c) 2006-201 0The PHP Group |6115 + | Copyright (c) 2006-2011 The PHP Group | 5946 6116 + +----------------------------------------------------------------------+ 5947 6117 + | This source file is subject to version 3.01 of the PHP license, | … … 5955 6125 + | Authors: George Schlossnagle <george@omniti.com> | 5956 6126 + | Edin Kadribasic <edink@php.net> | 6127 + | Pierre Joye <pierre@php.net> | 5957 6128 + +----------------------------------------------------------------------+ 5958 6129 + … … 5967 6138 + */ 5968 6139 + 5969 +/* $Id: apc_fcntl_win32.c 30 2175 2010-08-13 06:20:28Z kalle $ */6140 +/* $Id: apc_fcntl_win32.c 309203 2011-03-14 06:47:16Z pajoye $ */ 5970 6141 + 5971 6142 +#include "apc.h" … … 5980 6151 +int apc_fcntl_create(const char* pathname TSRMLS_DC) 5981 6152 +{ 5982 + char *lock_file = emalloc(MAXPATHLEN);6153 + char lock_file[MAXPATHLEN]; 5983 6154 + HANDLE fd; 5984 + DWORD tmp len;5985 + static int i=0;5986 + 5987 + tmplen = GetTempPath(MAXPATHLEN, lock_file);5988 + if (!tmplen) {5989 + efree(lock_file);6155 + DWORD tmp_dirname_len; 6156 + char lock_filename_tpl[] = ".apc.XXXXXX"; 6157 + char *lock_filename; 6158 + 6159 + tmp_dirname_len = GetTempPath(MAXPATHLEN, lock_file); 6160 + if (!tmp_dirname_len) { 5990 6161 + return -1; 5991 6162 + } 5992 6163 + 5993 + snprintf(lock_file + tmplen, MAXPATHLEN - tmplen - 1, "apc.lock.%d", i++); 6164 + lock_filename = _mktemp(lock_filename_tpl); 6165 + if (lock_filename == NULL) { 6166 + return -1; 6167 + } 6168 + 6169 + snprintf(lock_file + tmp_dirname_len, MAXPATHLEN - tmp_dirname_len - 1, "%s", lock_filename); 5994 6170 + 5995 6171 + fd = CreateFile(lock_file, … … 6001 6177 + NULL); 6002 6178 + 6003 +6004 6179 + if (fd == INVALID_HANDLE_VALUE) { 6005 6180 + apc_error("apc_fcntl_create: could not open %s" TSRMLS_CC, lock_file); 6006 + efree(lock_file);6007 6181 + return -1; 6008 6182 + } 6009 6183 + 6010 + efree(lock_file);6011 6184 + return (int)fd; 6012 6185 +} … … 6056 6229 + * vim<600: expandtab sw=4 ts=4 sts=4 6057 6230 + */ 6058 --- /dev/null 6059 +++ b/ext/apc/apc_globals.h 6060 @@ -0,0 +1,148 @@ 6231 diff -Naur a/ext/apc/apc_globals.h b/ext/apc/apc_globals.h 6232 --- a/ext/apc/apc_globals.h 1970-01-01 01:00:00.000000000 +0100 6233 +++ b/ext/apc/apc_globals.h 2012-07-20 00:10:35.000000000 +0200 6234 @@ -0,0 +1,152 @@ 6061 6235 +/* 6062 6236 + +----------------------------------------------------------------------+ 6063 6237 + | APC | 6064 6238 + +----------------------------------------------------------------------+ 6065 + | Copyright (c) 2006-201 0The PHP Group |6239 + | Copyright (c) 2006-2011 The PHP Group | 6066 6240 + +----------------------------------------------------------------------+ 6067 6241 + | This source file is subject to version 3.01 of the PHP license, | … … 6090 6264 + */ 6091 6265 + 6092 +/* $Id: apc_globals.h 30 1232 2010-07-13 12:23:35Z gopalv $ */6266 +/* $Id: apc_globals.h 307215 2011-01-07 09:54:00Z gopalv $ */ 6093 6267 + 6094 6268 +#ifndef APC_GLOBALS_H … … 6098 6272 +#include "apc_stack.h" 6099 6273 +#include "apc_php.h" 6274 +#include "apc_main.h" 6100 6275 + 6101 6276 +/* {{{ struct apc_rfc1867_data */ … … 6119 6294 +}; 6120 6295 +/* }}} */ 6296 + 6121 6297 + 6122 6298 +ZEND_BEGIN_MODULE_GLOBALS(apc) … … 6181 6357 + long shm_strings_buffer; 6182 6358 +#endif 6359 + char *serializer_name; /* the serializer config option */ 6360 + apc_serializer_t *serializer;/* the actual serializer in use */ 6183 6361 +ZEND_END_MODULE_GLOBALS(apc) 6184 6362 + … … 6207 6385 + * vim<600: expandtab sw=4 ts=4 sts=4 6208 6386 + */ 6209 --- /dev/null 6210 +++ b/ext/apc/apc.h 6211 @@ -0,0 +1,124 @@ 6387 diff -Naur a/ext/apc/apc.h b/ext/apc/apc.h 6388 --- a/ext/apc/apc.h 1970-01-01 01:00:00.000000000 +0100 6389 +++ b/ext/apc/apc.h 2012-07-20 00:10:35.000000000 +0200 6390 @@ -0,0 +1,136 @@ 6212 6391 +/* 6213 6392 + +----------------------------------------------------------------------+ 6214 6393 + | APC | 6215 6394 + +----------------------------------------------------------------------+ 6216 + | Copyright (c) 2006-201 0The PHP Group |6395 + | Copyright (c) 2006-2011 The PHP Group | 6217 6396 + +----------------------------------------------------------------------+ 6218 6397 + | This source file is subject to version 3.01 of the PHP license, | … … 6241 6420 + */ 6242 6421 + 6243 +/* $Id: apc.h 30 4310 2010-10-11 12:19:24Z gopalv $ */6422 +/* $Id: apc.h 307264 2011-01-08 13:20:20Z gopalv $ */ 6244 6423 + 6245 6424 +#ifndef APC_H … … 6322 6501 + 6323 6502 +#define apc_time() \ 6324 + (APCG(use_request_time) ? sapi_get_request_time(TSRMLS_C) : time(0)); 6503 + (APCG(use_request_time) ? (time_t) sapi_get_request_time(TSRMLS_C) : time(0)); 6504 + 6505 +#if defined(__GNUC__) 6506 +# define APC_UNUSED __attribute__((unused)) 6507 +# define APC_USED __attribute__((used)) 6508 +# define APC_ALLOC __attribute__((malloc)) 6509 +# define APC_HOTSPOT __attribute__((hot)) 6510 +#else 6511 +# define APC_UNUSED 6512 +# define APC_USED 6513 +# define APC_ALLOC 6514 +# define APC_HOTSPOT 6515 +#endif 6325 6516 + 6326 6517 +#endif … … 6334 6525 + * vim<600: expandtab sw=4 ts=4 sts=4 6335 6526 + */ 6336 --- /dev/null 6337 +++ b/ext/apc/apc_iterator.c 6338 @@ -0,0 +1,710 @@ 6527 diff -Naur a/ext/apc/apc_iterator.c b/ext/apc/apc_iterator.c 6528 --- a/ext/apc/apc_iterator.c 1970-01-01 01:00:00.000000000 +0100 6529 +++ b/ext/apc/apc_iterator.c 2012-07-20 00:10:35.000000000 +0200 6530 @@ -0,0 +1,741 @@ 6339 6531 +/* 6340 6532 + +----------------------------------------------------------------------+ 6341 6533 + | APC | 6342 6534 + +----------------------------------------------------------------------+ 6343 + | Copyright (c) 2006-201 0The PHP Group |6535 + | Copyright (c) 2006-2011 The PHP Group | 6344 6536 + +----------------------------------------------------------------------+ 6345 6537 + | This source file is subject to version 3.01 of the PHP license, | … … 6356 6548 + */ 6357 6549 + 6358 +/* $Id: apc_iterator.c 3 02175 2010-08-13 06:20:28Z kalle $ */6550 +/* $Id: apc_iterator.c 324326 2012-03-18 13:19:50Z pajoye $ */ 6359 6551 + 6360 6552 +#include "php_apc.h" … … 6457 6649 + if (APC_ITER_MD5 & iterator->format) { 6458 6650 + if(slot->value->type == APC_CACHE_ENTRY_FILE) { 6459 + if( slot->key.md5) {6651 + if(APCG(file_md5) && slot->key.md5) { 6460 6652 + make_digest(md5str, slot->key.md5); 6461 6653 + add_assoc_string(item->value, "md5", md5str, 1); … … 6556 6748 + ALLOC_HASHTABLE(iterator->obj.properties); 6557 6749 + zend_hash_init(iterator->obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0); 6750 +#ifdef ZEND_ENGINE_2_4 6751 + iterator->obj.properties_table = NULL; 6752 +#endif 6558 6753 + iterator->obj.guards = NULL; 6559 6754 + iterator->initialized = 0; … … 6572 6767 + int key_len; 6573 6768 + char *fname_key = NULL; 6574 + int fname_key_len ;6769 + int fname_key_len = 0; 6575 6770 + int rval = 1; 6576 6771 + 6577 6772 + if ((*slot)->key.type == APC_CACHE_KEY_FILE) { 6578 + key = estrdup((*slot)->value->data.file.filename);6773 + key = (*slot)->value->data.file.filename; 6579 6774 + key_len = strlen(key); 6580 6775 + fname_key_len = spprintf(&fname_key, 0, "%ld %ld", (*slot)->key.data.file.device, (*slot)->key.data.file.inode); … … 6585 6780 + key = (char*)(*slot)->key.data.fpfile.fullpath; 6586 6781 + key_len = (*slot)->key.data.fpfile.fullpath_len; 6782 + } else { 6783 + return 0; 6587 6784 + } 6588 6785 + … … 6604 6801 +/* }}} */ 6605 6802 + 6803 +/* {{{ apc_iterator_check_expiry */ 6804 +static int apc_iterator_check_expiry(apc_cache_t* cache, slot_t **slot, time_t t) 6805 +{ 6806 + if((*slot)->value->type == APC_CACHE_ENTRY_USER) { 6807 + if((*slot)->value->data.user.ttl) { 6808 + if((time_t) ((*slot)->creation_time + (*slot)->value->data.user.ttl) < t) { 6809 + return 0; 6810 + } 6811 + } else if(cache->ttl) { 6812 + if((*slot)->creation_time + cache->ttl < t) { 6813 + return 0; 6814 + } 6815 + } 6816 + } else if((*slot)->access_time < (t - cache->ttl)) { 6817 + return 0; 6818 + } 6819 + 6820 + return 1; 6821 +} 6822 +/* }}} */ 6823 + 6606 6824 +/* {{{ apc_iterator_fetch_active */ 6607 6825 +static int apc_iterator_fetch_active(apc_iterator_t *iterator TSRMLS_DC) { … … 6609 6827 + slot_t **slot; 6610 6828 + apc_iterator_item_t *item; 6829 + time_t t; 6830 + 6831 + t = apc_time(); 6611 6832 + 6612 6833 + while (apc_stack_size(iterator->stack) > 0) { … … 6618 6839 + slot = &iterator->cache->slots[iterator->slot_idx]; 6619 6840 + while(*slot) { 6620 + if (apc_iterator_search_match(iterator, slot)) { 6621 + count++; 6622 + item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC); 6623 + if (item) { 6624 + apc_stack_push(iterator->stack, item TSRMLS_CC); 6841 + if (apc_iterator_check_expiry(iterator->cache, slot, t)) { 6842 + if (apc_iterator_search_match(iterator, slot)) { 6843 + count++; 6844 + item = apc_iterator_item_ctor(iterator, slot TSRMLS_CC); 6845 + if (item) { 6846 + apc_stack_push(iterator->stack, item TSRMLS_CC); 6847 + } 6625 6848 + } 6626 6849 + } … … 7047 7270 + * vim<600: expandtab sw=4 ts=4 sts=4 7048 7271 + */ 7049 --- /dev/null 7050 +++ b/ext/apc/apc_iterator.h 7272 diff -Naur a/ext/apc/apc_iterator.h b/ext/apc/apc_iterator.h 7273 --- a/ext/apc/apc_iterator.h 1970-01-01 01:00:00.000000000 +0100 7274 +++ b/ext/apc/apc_iterator.h 2012-07-20 00:10:35.000000000 +0200 7051 7275 @@ -0,0 +1,117 @@ 7052 7276 +/* … … 7054 7278 + | APC | 7055 7279 + +----------------------------------------------------------------------+ 7056 + | Copyright (c) 2006-201 0The PHP Group |7280 + | Copyright (c) 2006-2011 The PHP Group | 7057 7281 + +----------------------------------------------------------------------+ 7058 7282 + | This source file is subject to version 3.01 of the PHP license, | … … 7069 7293 + */ 7070 7294 + 7071 +/* $Id: apc_iterator.h 30 0979 2010-07-04 10:15:05Z kalle $ */7295 +/* $Id: apc_iterator.h 307048 2011-01-03 23:53:17Z kalle $ */ 7072 7296 + 7073 7297 +#ifndef APC_ITERATOR_H … … 7167 7391 + * vim<600: expandtab sw=4 ts=4 sts=4 7168 7392 + */ 7169 --- /dev/null 7170 +++ b/ext/apc/apc_lock.h 7171 @@ -0,0 +1,101 @@ 7393 diff -Naur a/ext/apc/apc_lock.h b/ext/apc/apc_lock.h 7394 --- a/ext/apc/apc_lock.h 1970-01-01 01:00:00.000000000 +0100 7395 +++ b/ext/apc/apc_lock.h 2012-07-20 00:10:35.000000000 +0200 7396 @@ -0,0 +1,160 @@ 7172 7397 +/* 7173 7398 + +----------------------------------------------------------------------+ 7174 7399 + | APC | 7175 7400 + +----------------------------------------------------------------------+ 7176 + | Copyright (c) 2006-201 0The PHP Group |7401 + | Copyright (c) 2006-2011 The PHP Group | 7177 7402 + +----------------------------------------------------------------------+ 7178 7403 + | This source file is subject to version 3.01 of the PHP license, | … … 7186 7411 + | Authors: George Schlossnagle <george@omniti.com> | 7187 7412 + | Rasmus Lerdorf <rasmus@php.net> | 7413 + | Pierre Joye <pierre@php.net> | 7188 7414 + +----------------------------------------------------------------------+ 7189 7415 + … … 7198 7424 + */ 7199 7425 + 7200 +/* $Id: apc_lock.h 3 02175 2010-08-13 06:20:28Z kalle$ */7426 +/* $Id: apc_lock.h 311339 2011-05-22 17:18:49Z gopalv $ */ 7201 7427 + 7202 7428 +#ifndef APC_LOCK 7203 7429 +#define APC_LOCK 7430 + 7431 +#ifdef HAVE_CONFIG_H 7432 +# include <config.h> 7433 +#endif 7204 7434 + 7205 7435 +#include "apc.h" … … 7207 7437 +#include "apc_fcntl.h" 7208 7438 +#include "apc_pthreadmutex.h" 7439 +#include "apc_pthreadrwlock.h" 7209 7440 +#include "apc_spin.h" 7210 +#ifdef HAVE_CONFIG_H 7211 +#include <config.h> 7212 +#endif 7441 +#include "apc_windows_srwlock_kernel.h" 7213 7442 + 7214 7443 +/* {{{ generic locking macros */ … … 7218 7447 +#define RDLOCK(lock) { HANDLE_BLOCK_INTERRUPTIONS(); apc_lck_rdlock(lock); } 7219 7448 +#define UNLOCK(lock) { apc_lck_unlock(lock); HANDLE_UNBLOCK_INTERRUPTIONS(); } 7449 +#define RDUNLOCK(lock) { apc_lck_rdunlock(lock); HANDLE_UNBLOCK_INTERRUPTIONS(); } 7220 7450 +/* }}} */ 7221 7451 + 7452 +/* atomic operations : rdlocks are impossible without these */ 7453 +#if HAVE_ATOMIC_OPERATIONS 7454 +# ifdef PHP_WIN32 7455 +# define ATOMIC_INC(a) InterlockedIncrement(&a) 7456 +# define ATOMIC_DEC(a) InterlockedDecrement(&a) 7457 +# else 7458 +# define ATOMIC_INC(a) __sync_add_and_fetch(&a, 1) 7459 +# define ATOMIC_DEC(a) __sync_sub_and_fetch(&a, 1) 7460 +# endif 7461 +#endif 7462 + 7222 7463 +#if defined(APC_SEM_LOCKS) 7223 +#define APC_LOCK_TYPE "IPC Semaphore" 7224 +#define RDLOCK_AVAILABLE 0 7225 +#define NONBLOCKING_LOCK_AVAILABLE 1 7226 +#define apc_lck_t int 7227 +#define apc_lck_create(a,b,c,d) d=apc_sem_create((b),(c) TSRMLS_CC) 7228 +#define apc_lck_destroy(a) apc_sem_destroy(a) 7229 +#define apc_lck_lock(a) apc_sem_lock(a TSRMLS_CC) 7230 +#define apc_lck_nb_lock(a) apc_sem_nonblocking_lock(a TSRMLS_CC) 7231 +#define apc_lck_rdlock(a) apc_sem_lock(a TSRMLS_CC) 7232 +#define apc_lck_unlock(a) apc_sem_unlock(a TSRMLS_CC) 7464 +# define APC_LOCK_TYPE "IPC Semaphore" 7465 +# define RDLOCK_AVAILABLE 0 7466 +# define NONBLOCKING_LOCK_AVAILABLE 1 7467 +# define apc_lck_t int 7468 +# define apc_lck_create(a,b,c,d) d=apc_sem_create((b),(c) TSRMLS_CC) 7469 +# define apc_lck_destroy(a) apc_sem_destroy(a) 7470 +# define apc_lck_lock(a) apc_sem_lock(a TSRMLS_CC) 7471 +# define apc_lck_nb_lock(a) apc_sem_nonblocking_lock(a TSRMLS_CC) 7472 +# define apc_lck_rdlock(a) apc_sem_lock(a TSRMLS_CC) 7473 +# define apc_lck_unlock(a) apc_sem_unlock(a TSRMLS_CC) 7474 +# define apc_lck_rdunlock(a) apc_sem_unlock(a TSRMLS_CC) 7233 7475 +#elif defined(APC_PTHREADMUTEX_LOCKS) 7234 +#define APC_LOCK_TYPE "pthread mutex Locks" 7235 +#define RDLOCK_AVAILABLE 0 7236 +#define NONBLOCKING_LOCK_AVAILABLE 1 7237 +#define apc_lck_t pthread_mutex_t 7238 +#define apc_lck_create(a,b,c,d) apc_pthreadmutex_create((pthread_mutex_t*)&d TSRMLS_CC) 7239 +#define apc_lck_destroy(a) apc_pthreadmutex_destroy(&a) 7240 +#define apc_lck_lock(a) apc_pthreadmutex_lock(&a TSRMLS_CC) 7241 +#define apc_lck_nb_lock(a) apc_pthreadmutex_nonblocking_lock(&a TSRMLS_CC) 7242 +#define apc_lck_rdlock(a) apc_pthreadmutex_lock(&a TSRMLS_CC) 7243 +#define apc_lck_unlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC) 7476 +# define APC_LOCK_TYPE "pthread mutex Locks" 7477 +# define RDLOCK_AVAILABLE 0 7478 +# define NONBLOCKING_LOCK_AVAILABLE 1 7479 +# define apc_lck_t pthread_mutex_t 7480 +# define apc_lck_create(a,b,c,d) apc_pthreadmutex_create((pthread_mutex_t*)&d TSRMLS_CC) 7481 +# define apc_lck_destroy(a) apc_pthreadmutex_destroy(&a) 7482 +# define apc_lck_lock(a) apc_pthreadmutex_lock(&a TSRMLS_CC) 7483 +# define apc_lck_nb_lock(a) apc_pthreadmutex_nonblocking_lock(&a TSRMLS_CC) 7484 +# define apc_lck_rdlock(a) apc_pthreadmutex_lock(&a TSRMLS_CC) 7485 +# define apc_lck_unlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC) 7486 +# define apc_lck_rdunlock(a) apc_pthreadmutex_unlock(&a TSRMLS_CC) 7487 +#elif defined(APC_PTHREADRW_LOCKS) 7488 +# define APC_LOCK_TYPE "pthread read/write Locks" 7489 +# define RDLOCK_AVAILABLE 1 7490 +# define NONBLOCKING_LOCK_AVAILABLE 1 7491 +# define apc_lck_t pthread_rwlock_t 7492 +# define apc_lck_create(a,b,c,d) apc_pthreadrwlock_create((pthread_rwlock_t*)&d TSRMLS_CC) 7493 +# define apc_lck_destroy(a) apc_pthreadrwlock_destroy(&a) 7494 +# define apc_lck_lock(a) apc_pthreadrwlock_lock(&a TSRMLS_CC) 7495 +# define apc_lck_nb_lock(a) apc_pthreadrwlock_nonblocking_lock(&a TSRMLS_CC) 7496 +# define apc_lck_rdlock(a) apc_pthreadrwlock_rdlock(&a TSRMLS_CC) 7497 +# define apc_lck_unlock(a) apc_pthreadrwlock_unlock(&a TSRMLS_CC) 7498 +# define apc_lck_rdunlock(a) apc_pthreadrwlock_unlock(&a TSRMLS_CC) 7244 7499 +#elif defined(APC_SPIN_LOCKS) 7245 +#define APC_LOCK_TYPE "spin Locks" 7246 +#define RDLOCK_AVAILABLE 0 7247 +#define NONBLOCKING_LOCK_AVAILABLE APC_SLOCK_NONBLOCKING_LOCK_AVAILABLE 7248 +#define apc_lck_t slock_t 7249 +#define apc_lck_create(a,b,c,d) apc_slock_create((slock_t*)&(d)) 7250 +#define apc_lck_destroy(a) apc_slock_destroy(&a) 7251 +#define apc_lck_lock(a) apc_slock_lock(&a TSRMLS_CC) 7252 +#define apc_lck_nb_lock(a) apc_slock_nonblocking_lock(&a) 7253 +#define apc_lck_rdlock(a) apc_slock_lock(&a TSRMLS_CC) 7254 +#define apc_lck_unlock(a) apc_slock_unlock(&a) 7500 +# define APC_LOCK_TYPE "spin Locks" 7501 +# define RDLOCK_AVAILABLE 0 7502 +# define NONBLOCKING_LOCK_AVAILABLE APC_SLOCK_NONBLOCKING_LOCK_AVAILABLE 7503 +# define apc_lck_t slock_t 7504 +# define apc_lck_create(a,b,c,d) apc_slock_create((slock_t*)&(d)) 7505 +# define apc_lck_destroy(a) apc_slock_destroy(&a) 7506 +# define apc_lck_lock(a) apc_slock_lock(&a TSRMLS_CC) 7507 +# define apc_lck_nb_lock(a) apc_slock_nonblocking_lock(&a) 7508 +# define apc_lck_rdlock(a) apc_slock_lock(&a TSRMLS_CC) 7509 +# define apc_lck_unlock(a) apc_slock_unlock(&a) 7510 +# define apc_lck_rdunlock(a) apc_slock_unlock(&a) 7511 +#elif defined(APC_SRWLOCK_NATIVE) && defined(PHP_WIN32) 7512 +# define APC_LOCK_TYPE "Windows Slim RWLOCK (native)" 7513 +# define RDLOCK_AVAILABLE 1 7514 +# define NONBLOCKING_LOCK_AVAILABLE 0 7515 +# define apc_lck_t SRWLOCK 7516 +# define apc_lck_create(a,b,c,d) InitializeSRWLock((SRWLOCK*)&(d)) 7517 +# define apc_lck_destroy(a) 7518 +# define apc_lck_lock(a) AcquireSRWLockExclusive(&a) 7519 +# define apc_lck_rdlock(a) AcquireSRWLockShared(&a) 7520 +# define apc_lck_unlock(a) ReleaseSRWLockExclusive(&a) 7521 +# define apc_lck_rdunlock(a) ReleaseSRWLockShared(&a) 7522 +# if NONBLOCKING_LOCK_AVAILABLE==1 /* Only in win7/2008 */ 7523 +# define apc_lck_nb_lock(a) (TryAcquireSRWLockExclusive(&a TSRMLS_CC) == 0 ? 1 : 0); 7524 +# endif 7525 +#elif defined(APC_SRWLOCK_KERNEL) && defined(PHP_WIN32) 7526 +# define APC_LOCK_TYPE "Windows Slim RWLOCK (kernel)" 7527 +# define RDLOCK_AVAILABLE 1 7528 +# define NONBLOCKING_LOCK_AVAILABLE 0 7529 +# define apc_lck_t apc_windows_cs_rwlock_t 7530 +# define apc_lck_create(a,b,c,d) apc_windows_cs_create((apc_windows_cs_rwlock_t*)&(d) TSRMLS_CC) 7531 +# define apc_lck_destroy(a) apc_windows_cs_destroy(&a); 7532 +# define apc_lck_lock(a) apc_windows_cs_lock(&a TSRMLS_CC) 7533 +# define apc_lck_rdlock(a) apc_windows_cs_rdlock(&a TSRMLS_CC) 7534 +# define apc_lck_unlock(a) apc_windows_cs_unlock_wr(&a TSRMLS_CC) 7535 +# define apc_lck_rdunlock(a) apc_windows_cs_unlock_rd(&a TSRMLS_CC) 7255 7536 +#else 7256 +#define APC_LOCK_TYPE "File Locks" 7257 +#define RDLOCK_AVAILABLE 1 7258 +#ifdef PHP_WIN32 7259 +#define NONBLOCKING_LOCK_AVAILABLE 0 7260 +#else 7261 +#define NONBLOCKING_LOCK_AVAILABLE 1 7262 +#endif 7263 +#define apc_lck_t int 7264 +#define apc_lck_create(a,b,c,d) d=apc_fcntl_create((a) TSRMLS_CC) 7265 +#define apc_lck_destroy(a) apc_fcntl_destroy(a) 7266 +#define apc_lck_lock(a) apc_fcntl_lock(a TSRMLS_CC) 7267 +#define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a TSRMLS_CC) 7268 +#define apc_lck_rdlock(a) apc_fcntl_rdlock(a TSRMLS_CC) 7269 +#define apc_lck_unlock(a) apc_fcntl_unlock(a TSRMLS_CC) 7270 +#endif 7271 + 7272 +#endif 7273 --- /dev/null 7274 +++ b/ext/apc/apc_main.c 7275 @@ -0,0 +1,969 @@ 7537 +# define APC_LOCK_TYPE "File Locks" 7538 +# ifdef HAVE_ATOMIC_OPERATIONS 7539 +# define RDLOCK_AVAILABLE 1 7540 +# endif 7541 +# ifdef PHP_WIN32 7542 +# define NONBLOCKING_LOCK_AVAILABLE 0 7543 +# else 7544 +# define NONBLOCKING_LOCK_AVAILABLE 1 7545 +# endif 7546 +# define apc_lck_t int 7547 +# define apc_lck_create(a,b,c,d) d=apc_fcntl_create((a) TSRMLS_CC) 7548 +# define apc_lck_destroy(a) apc_fcntl_destroy(a) 7549 +# define apc_lck_lock(a) apc_fcntl_lock(a TSRMLS_CC) 7550 +# define apc_lck_nb_lock(a) apc_fcntl_nonblocking_lock(a TSRMLS_CC) 7551 +# define apc_lck_rdlock(a) apc_fcntl_rdlock(a TSRMLS_CC) 7552 +# define apc_lck_unlock(a) apc_fcntl_unlock(a TSRMLS_CC) 7553 +# define apc_lck_rdunlock(a) apc_fcntl_unlock(a TSRMLS_CC) 7554 +#endif 7555 + 7556 +#endif 7557 diff -Naur a/ext/apc/apc_main.c b/ext/apc/apc_main.c 7558 --- a/ext/apc/apc_main.c 1970-01-01 01:00:00.000000000 +0100 7559 +++ b/ext/apc/apc_main.c 2012-07-20 00:10:35.000000000 +0200 7560 @@ -0,0 +1,1030 @@ 7276 7561 +/* 7277 7562 + +----------------------------------------------------------------------+ 7278 7563 + | APC | 7279 7564 + +----------------------------------------------------------------------+ 7280 + | Copyright (c) 2006-201 0The PHP Group |7565 + | Copyright (c) 2006-2011 The PHP Group | 7281 7566 + +----------------------------------------------------------------------+ 7282 7567 + | This source file is subject to version 3.01 of the PHP license, | … … 7304 7589 + */ 7305 7590 + 7306 +/* $Id: apc_main.c 3 04994 2010-10-30 20:33:46Z gopalv$ */7591 +/* $Id: apc_main.c 324326 2012-03-18 13:19:50Z pajoye $ */ 7307 7592 + 7308 7593 +#include "apc_php.h" … … 7323 7608 +#include "ext/standard/md5.h" 7324 7609 + 7610 +#define APC_MAX_SERIALIZERS 16 7611 + 7325 7612 +/* {{{ module variables */ 7326 7613 + … … 7328 7615 +typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int TSRMLS_DC); 7329 7616 +static zend_compile_t *old_compile_file; 7617 +static apc_serializer_t apc_serializers[APC_MAX_SERIALIZERS] = {{0,}}; 7330 7618 + 7331 7619 +/* }}} */ … … 7664 7952 + 7665 7953 +/* {{{ apc_compile_cache_entry */ 7666 +zend_bool apc_compile_cache_entry(apc_cache_key_t key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array, apc_cache_entry_t** cache_entry TSRMLS_DC) {7954 +zend_bool apc_compile_cache_entry(apc_cache_key_t *key, zend_file_handle* h, int type, time_t t, zend_op_array** op_array, apc_cache_entry_t** cache_entry TSRMLS_DC) { 7667 7955 + int num_functions, num_classes; 7668 7956 + apc_function_t* alloc_functions; … … 7710 7998 + PHP_MD5Update(&context, buf, n); 7711 7999 + } 7712 + PHP_MD5Final(key .md5, &context);8000 + PHP_MD5Final(key->md5, &context); 7713 8001 + php_stream_close(stream); 7714 8002 + if(n<0) { … … 7732 8020 + 7733 8021 + path = h->opened_path; 8022 + if(!path && key->type == APC_CACHE_KEY_FPFILE) path = (char*)key->data.fpfile.fullpath; 7734 8023 + if(!path) path=h->filename; 7735 8024 + … … 7762 8051 + apc_context_t ctxt = {0,}; 7763 8052 + int bailout=0; 7764 + 8053 + const char* filename = NULL; 7765 8054 + 7766 8055 + if (!APCG(enabled) || apc_cache_busy(apc_cache)) { … … 7879 8168 + 7880 8169 + zend_try { 7881 + if (apc_compile_cache_entry( key, h, type, t, &op_array, &cache_entry TSRMLS_CC) == SUCCESS) {8170 + if (apc_compile_cache_entry(&key, h, type, t, &op_array, &cache_entry TSRMLS_CC) == SUCCESS) { 7882 8171 + ctxt.pool = cache_entry->pool; 7883 8172 + ctxt.copy = APC_COPY_IN_OPCODE; … … 8024 8313 +/* }}} */ 8025 8314 + 8315 +/* {{{ apc_serializer hooks */ 8316 +static int _apc_register_serializer(const char* name, apc_serialize_t serialize, 8317 + apc_unserialize_t unserialize, 8318 + void *config TSRMLS_DC) 8319 +{ 8320 + int i; 8321 + apc_serializer_t *serializer; 8322 + 8323 + for(i = 0; i < APC_MAX_SERIALIZERS; i++) { 8324 + serializer = &apc_serializers[i]; 8325 + if(!serializer->name) { 8326 + /* empty entry */ 8327 + serializer->name = name; /* assumed to be const */ 8328 + serializer->serialize = serialize; 8329 + serializer->unserialize = unserialize; 8330 + serializer->config = config; 8331 + apc_serializers[i+1].name = NULL; 8332 + return 1; 8333 + } 8334 + } 8335 + 8336 + return 0; 8337 +} 8338 + 8339 +apc_serializer_t* apc_find_serializer(const char* name TSRMLS_DC) 8340 +{ 8341 + int i; 8342 + apc_serializer_t *serializer; 8343 + 8344 + for(i = 0; i < APC_MAX_SERIALIZERS; i++) { 8345 + serializer = &apc_serializers[i]; 8346 + if(serializer->name && (strcmp(serializer->name, name) == 0)) { 8347 + return serializer; 8348 + } 8349 + } 8350 + return NULL; 8351 +} 8352 + 8353 +apc_serializer_t* apc_get_serializers(TSRMLS_D) 8354 +{ 8355 + return &(apc_serializers[0]); 8356 +} 8357 +/* }}} */ 8358 + 8026 8359 +/* {{{ module init and shutdown */ 8027 8360 + … … 8042 8375 + REGISTER_LONG_CONSTANT("\000apc_magic", (long)&set_compile_hook, CONST_PERSISTENT | CONST_CS); 8043 8376 + REGISTER_LONG_CONSTANT("\000apc_compile_file", (long)&my_compile_file, CONST_PERSISTENT | CONST_CS); 8377 + REGISTER_LONG_CONSTANT(APC_SERIALIZER_CONSTANT, (long)&_apc_register_serializer, CONST_PERSISTENT | CONST_CS); 8378 + 8379 + /* test out the constant function pointer */ 8380 + apc_register_serializer("php", APC_SERIALIZER_NAME(php), APC_UNSERIALIZER_NAME(php), NULL TSRMLS_CC); 8381 + 8382 + assert(apc_serializers[0].name != NULL); 8044 8383 + 8045 8384 + apc_pool_init(); … … 8064 8403 + 8065 8404 +#ifdef ZEND_ENGINE_2_4 8405 +#ifndef ZTS 8066 8406 + apc_interned_strings_init(TSRMLS_C); 8407 +#endif 8067 8408 +#endif 8068 8409 + … … 8109 8450 + } 8110 8451 + 8452 +#ifdef ZEND_ENGINE_2_4 8453 +#ifndef ZTS 8454 + apc_interned_strings_shutdown(TSRMLS_C); 8455 +#endif 8456 +#endif 8457 + 8111 8458 + apc_cache_destroy(apc_cache TSRMLS_CC); 8112 8459 + apc_cache_destroy(apc_user_cache TSRMLS_CC); 8113 8460 + apc_sma_cleanup(TSRMLS_C); 8114 +8115 +#ifdef ZEND_ENGINE_2_48116 + apc_interned_strings_shutdown(TSRMLS_C);8117 +#endif8118 8461 + 8119 8462 + APCG(initialized) = 0; … … 8190 8533 + } 8191 8534 + 8535 + if (!APCG(serializer) && APCG(serializer_name)) { 8536 + /* Avoid race conditions between MINIT of apc and serializer exts like igbinary */ 8537 + APCG(serializer) = apc_find_serializer(APCG(serializer_name) TSRMLS_CC); 8538 + } 8539 + 8192 8540 +#if APC_HAVE_LOOKUP_HOOKS 8193 8541 + if(APCG(lazy_functions)) { … … 8211 8559 +int apc_request_shutdown(TSRMLS_D) 8212 8560 +{ 8213 +8214 8561 +#if APC_HAVE_LOOKUP_HOOKS 8215 8562 + if(APCG(lazy_class_table)) { … … 8228 8575 + zval_ptr_dtor(&APCG(filehits)); 8229 8576 +#endif 8230 +8231 8577 + return 0; 8232 8578 +} … … 8243 8589 + * vim<600: expandtab sw=4 ts=4 sts=4 8244 8590 + */ 8245 --- /dev/null 8246 +++ b/ext/apc/apc_main.h 8247 @@ -0,0 +1,74 @@ 8591 diff -Naur a/ext/apc/apc_main.h b/ext/apc/apc_main.h 8592 --- a/ext/apc/apc_main.h 1970-01-01 01:00:00.000000000 +0100 8593 +++ b/ext/apc/apc_main.h 2012-07-20 00:10:35.000000000 +0200 8594 @@ -0,0 +1,88 @@ 8248 8595 +/* 8249 8596 + +----------------------------------------------------------------------+ 8250 8597 + | APC | 8251 8598 + +----------------------------------------------------------------------+ 8252 + | Copyright (c) 2006-201 0The PHP Group |8599 + | Copyright (c) 2006-2011 The PHP Group | 8253 8600 + +----------------------------------------------------------------------+ 8254 8601 + | This source file is subject to version 3.01 of the PHP license, | … … 8277 8624 + */ 8278 8625 + 8279 +/* $Id: apc_main.h 30 0979 2010-07-04 10:15:05Z kalle$ */8626 +/* $Id: apc_main.h 308594 2011-02-23 12:35:33Z gopalv $ */ 8280 8627 + 8281 8628 +#ifndef APC_MAIN_H … … 8283 8630 + 8284 8631 +#include "apc_pool.h" 8632 +#include "apc_serializer.h" 8285 8633 + 8286 8634 +/* … … 8309 8657 + unsigned int force_update:1; 8310 8658 +} apc_context_t; 8659 + 8660 +/* {{{ struct apc_serializer_t */ 8661 +typedef struct apc_serializer_t apc_serializer_t; 8662 +struct apc_serializer_t { 8663 + const char *name; 8664 + apc_serialize_t serialize; 8665 + apc_unserialize_t unserialize; 8666 + void *config; 8667 +}; 8668 +/* }}} */ 8669 + 8670 +apc_serializer_t* apc_get_serializers(TSRMLS_D); 8671 +apc_serializer_t* apc_find_serializer(const char* name TSRMLS_DC); 8311 8672 + 8312 8673 +#endif … … 8320 8681 + * vim<600: expandtab sw=4 ts=4 sts=4 8321 8682 + */ 8322 --- /dev/null 8323 +++ b/ext/apc/apc_mmap.c 8324 @@ -0,0 +1,175 @@ 8683 diff -Naur a/ext/apc/apc_mmap.c b/ext/apc/apc_mmap.c 8684 --- a/ext/apc/apc_mmap.c 1970-01-01 01:00:00.000000000 +0100 8685 +++ b/ext/apc/apc_mmap.c 2012-07-20 00:10:35.000000000 +0200 8686 @@ -0,0 +1,177 @@ 8325 8687 +/* 8326 8688 + +----------------------------------------------------------------------+ 8327 8689 + | APC | 8328 8690 + +----------------------------------------------------------------------+ 8329 + | Copyright (c) 2006-201 0The PHP Group |8691 + | Copyright (c) 2006-2011 The PHP Group | 8330 8692 + +----------------------------------------------------------------------+ 8331 8693 + | This source file is subject to version 3.01 of the PHP license, | … … 8350 8712 + */ 8351 8713 + 8352 +/* $Id: apc_mmap.c 30 2175 2010-08-13 06:20:28Z kalle $ */8714 +/* $Id: apc_mmap.c 307048 2011-01-03 23:53:17Z kalle $ */ 8353 8715 + 8354 8716 +#include "apc.h" … … 8448 8810 + 8449 8811 + segment.shmaddr = (void *)mmap(NULL, size, PROT_READ | PROT_WRITE, flags, fd, 0); 8812 + segment.size = size; 8450 8813 + 8451 8814 +#ifdef APC_MEMPROTECT … … 8468 8831 + 8469 8832 + segment.shmaddr = (void*)-1; 8833 + segment.size = 0; 8470 8834 +#ifdef APC_MEMPROTECT 8471 8835 + segment.roaddr = NULL; … … 8498 8862 + * vim<600: expandtab sw=4 ts=4 sts=4 8499 8863 + */ 8500 --- /dev/null 8501 +++ b/ext/apc/apc_mmap.h 8864 diff -Naur a/ext/apc/apc_mmap.h b/ext/apc/apc_mmap.h 8865 --- a/ext/apc/apc_mmap.h 1970-01-01 01:00:00.000000000 +0100 8866 +++ b/ext/apc/apc_mmap.h 2012-07-20 00:10:35.000000000 +0200 8502 8867 @@ -0,0 +1,54 @@ 8503 8868 +/* … … 8505 8870 + | APC | 8506 8871 + +----------------------------------------------------------------------+ 8507 + | Copyright (c) 2006-201 0The PHP Group |8872 + | Copyright (c) 2006-2011 The PHP Group | 8508 8873 + +----------------------------------------------------------------------+ 8509 8874 + | This source file is subject to version 3.01 of the PHP license, | … … 8528 8893 + */ 8529 8894 + 8530 +/* $Id: apc_mmap.h 30 2175 2010-08-13 06:20:28Z kalle $ */8895 +/* $Id: apc_mmap.h 307048 2011-01-03 23:53:17Z kalle $ */ 8531 8896 + 8532 8897 +#ifndef APC_MMAP_H … … 8555 8920 + * vim<600: expandtab sw=4 ts=4 sts=4 8556 8921 + */ 8557 --- /dev/null 8558 +++ b/ext/apc/apc.php 8922 diff -Naur a/ext/apc/apc.php b/ext/apc/apc.php 8923 --- a/ext/apc/apc.php 1970-01-01 01:00:00.000000000 +0100 8924 +++ b/ext/apc/apc.php 2012-07-20 00:10:35.000000000 +0200 8559 8925 @@ -0,0 +1,1362 @@ 8560 8926 +<?php … … 8563 8929 + | APC | 8564 8930 + +----------------------------------------------------------------------+ 8565 + | Copyright (c) 2006-201 0The PHP Group |8931 + | Copyright (c) 2006-2011 The PHP Group | 8566 8932 + +----------------------------------------------------------------------+ 8567 8933 + | This source file is subject to version 3.01 of the PHP license, | … … 8582 8948 + */ 8583 8949 + 8584 +$VERSION='$Id: apc.php 3 04410 2010-10-15 11:21:07Z gopalv$';8950 +$VERSION='$Id: apc.php 325483 2012-05-01 00:34:04Z rasmus $'; 8585 8951 + 8586 8952 +////////// READ OPTIONAL CONFIGURATION FILE //////////// … … 8651 9017 + 'SORT2' => '/^[DA]$/', // second sort key 8652 9018 + 'AGGR' => '/^\d+$/', // aggregation by dir level 8653 + 'SEARCH' => '~^[a-zA-Z0- 1/_.-]*$~' // aggregation by dir level9019 + 'SEARCH' => '~^[a-zA-Z0-9/_.-]*$~' // aggregation by dir level 8654 9020 +); 8655 9021 + … … 9920 10286 +</body> 9921 10287 +</html> 9922 --- /dev/null 9923 +++ b/ext/apc/apc_php.h 9924 @@ -0,0 +1,77 @@ 10288 diff -Naur a/ext/apc/apc_php.h b/ext/apc/apc_php.h 10289 --- a/ext/apc/apc_php.h 1970-01-01 01:00:00.000000000 +0100 10290 +++ b/ext/apc/apc_php.h 2012-07-20 00:10:35.000000000 +0200 10291 @@ -0,0 +1,81 @@ 9925 10292 +/* 9926 10293 + +----------------------------------------------------------------------+ 9927 10294 + | APC | 9928 10295 + +----------------------------------------------------------------------+ 9929 + | Copyright (c) 2006-201 0The PHP Group |10296 + | Copyright (c) 2006-2011 The PHP Group | 9930 10297 + +----------------------------------------------------------------------+ 9931 10298 + | This source file is subject to version 3.01 of the PHP license, | … … 9954 10321 + */ 9955 10322 + 9956 +/* $Id: apc_php.h 3 00979 2010-07-04 10:15:05Z kalle$ */10323 +/* $Id: apc_php.h 313808 2011-07-28 06:17:10Z gopalv $ */ 9957 10324 + 9958 10325 +#ifndef APC_PHP_H … … 9986 10353 +#ifdef ZEND_ENGINE_2_1 9987 10354 +#include "zend_vm.h" 10355 +#endif 10356 + 10357 +#ifndef IS_CONSTANT_TYPE_MASK 10358 +#define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX) 9988 10359 +#endif 9989 10360 + … … 10000 10371 + * vim<600: expandtab sw=4 ts=4 sts=4 10001 10372 + */ 10002 --- /dev/null 10003 +++ b/ext/apc/apc_php_pcre.h 10373 diff -Naur a/ext/apc/apc_php_pcre.h b/ext/apc/apc_php_pcre.h 10374 --- a/ext/apc/apc_php_pcre.h 1970-01-01 01:00:00.000000000 +0100 10375 +++ b/ext/apc/apc_php_pcre.h 2012-07-20 00:10:35.000000000 +0200 10004 10376 @@ -0,0 +1,98 @@ 10005 10377 +/* … … 10007 10379 + | APC/PHP Version 5 | 10008 10380 + +----------------------------------------------------------------------+ 10009 + | Copyright (c) 1997-201 0The PHP Group |10381 + | Copyright (c) 1997-2011 The PHP Group | 10010 10382 + +----------------------------------------------------------------------+ 10011 10383 + | This source file is subject to version 3.01 of the PHP license, | … … 10021 10393 + */ 10022 10394 + 10023 +/* $Id: apc_php_pcre.h 30 0979 2010-07-04 10:15:05Z kalle $ */10395 +/* $Id: apc_php_pcre.h 307048 2011-01-03 23:53:17Z kalle $ */ 10024 10396 + 10025 10397 +#ifndef PHP_PCRE_H … … 10101 10473 + 10102 10474 +#endif /* PHP_PCRE_H */ 10103 --- /dev/null 10104 +++ b/ext/apc/apc_pool.c 10105 @@ -0,0 +1,488 @@ 10475 diff -Naur a/ext/apc/apc_pool.c b/ext/apc/apc_pool.c 10476 --- a/ext/apc/apc_pool.c 1970-01-01 01:00:00.000000000 +0100 10477 +++ b/ext/apc/apc_pool.c 2012-07-20 00:10:35.000000000 +0200 10478 @@ -0,0 +1,507 @@ 10106 10479 +/* 10107 10480 + +----------------------------------------------------------------------+ 10108 10481 + | APC | 10109 10482 + +----------------------------------------------------------------------+ 10110 + | Copyright (c) 2006-201 0The PHP Group |10483 + | Copyright (c) 2006-2011 The PHP Group | 10111 10484 + +----------------------------------------------------------------------+ 10112 10485 + | This source file is subject to version 3.01 of the PHP license, | … … 10131 10504 + */ 10132 10505 + 10133 +/* $Id: apc_pool.c 30 1964 2010-08-07 03:34:18Z rasmus$ */10506 +/* $Id: apc_pool.c 307555 2011-01-18 07:17:21Z gopalv $ */ 10134 10507 + 10135 10508 + … … 10274 10647 + void *owner; 10275 10648 + 10649 + unsigned long count; 10650 + 10276 10651 + pool_block *head; 10277 10652 + pool_block first; … … 10327 10702 + 10328 10703 + rpool->parent.size += realsize; 10704 + 10705 + rpool->count++; 10329 10706 + 10330 10707 + return entry; … … 10343 10720 + size_t *sizeinfo= NULL; 10344 10721 + pool_block *entry = NULL; 10722 + unsigned long i; 10345 10723 + 10346 10724 + if(APC_POOL_HAS_REDZONES(pool)) { … … 10355 10733 + } 10356 10734 + 10357 + 10358 + for(entry = rpool->head; entry != NULL; entry = entry->next) { 10735 + /* minimize look-back, a value of 8 seems to give similar fill-ratios (+2%) 10736 + * as looping through the entire list. And much faster in allocations. */ 10737 + for(entry = rpool->head, i = 0; entry != NULL && (i < 8); entry = entry->next, i++) { 10359 10738 + if(entry->avail >= realsize) { 10360 10739 + goto found; 10361 10740 + } 10741 + } 10742 + 10743 + /* upgrade the pool type to reduce overhead */ 10744 + if(rpool->count > 4 && rpool->dsize < 4096) { 10745 + rpool->dsize = 4096; 10746 + } else if(rpool->count > 8 && rpool->dsize < 8192) { 10747 + rpool->dsize = 8192; 10362 10748 + } 10363 10749 + … … 10409 10795 + * overwrite check only when the sizeinfo 10410 10796 + * is set. 10797 + * 10798 + * Marked as used in gcc, so that this function 10799 + * is accessible from gdb, eventhough it is never 10800 + * used in code in non-debug builds. 10411 10801 + */ 10412 +static int apc_realpool_check_integrity(apc_realpool *rpool)10802 +static APC_USED int apc_realpool_check_integrity(apc_realpool *rpool) 10413 10803 +{ 10414 10804 + apc_pool *pool = &(rpool->parent); … … 10429 10819 + if(!APC_POOL_HAS_REDZONES(pool) || 10430 10820 + !APC_POOL_HAS_SIZEINFO(pool)) { 10821 + (void)pool; /* remove unused warning */ 10431 10822 + return 1; 10432 10823 + } … … 10543 10934 + rpool->dsize = dsize; 10544 10935 + rpool->head = NULL; 10936 + rpool->count = 0; 10545 10937 + 10546 10938 + INIT_POOL_BLOCK(rpool, &(rpool->first), dsize); … … 10565 10957 + 10566 10958 +/* {{{ apc_pstrdup */ 10567 +void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC)10959 +void* APC_ALLOC apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC) 10568 10960 +{ 10569 10961 + return s != NULL ? apc_pmemcpy(s, (strlen(s) + 1), pool TSRMLS_CC) : NULL; … … 10572 10964 + 10573 10965 +/* {{{ apc_pmemcpy */ 10574 +void* apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC)10966 +void* APC_ALLOC apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC) 10575 10967 +{ 10576 10968 + void* q; … … 10592 10984 + * vim<600: expandtab sw=4 ts=4 sts=4 10593 10985 + */ 10594 --- /dev/null 10595 +++ b/ext/apc/apc_pool.h 10986 diff -Naur a/ext/apc/apc_pool.h b/ext/apc/apc_pool.h 10987 --- a/ext/apc/apc_pool.h 1970-01-01 01:00:00.000000000 +0100 10988 +++ b/ext/apc/apc_pool.h 2012-07-20 00:10:35.000000000 +0200 10596 10989 @@ -0,0 +1,114 @@ 10597 10990 +/* … … 10599 10992 + | APC | 10600 10993 + +----------------------------------------------------------------------+ 10601 + | Copyright (c) 2006-201 0The PHP Group |10994 + | Copyright (c) 2006-2011 The PHP Group | 10602 10995 + +----------------------------------------------------------------------+ 10603 10996 + | This source file is subject to version 3.01 of the PHP license, | … … 10622 11015 + */ 10623 11016 + 10624 +/* $Id: apc_pool.h 30 1682 2010-07-29 11:09:00Z gopalv$ */11017 +/* $Id: apc_pool.h 307048 2011-01-03 23:53:17Z kalle $ */ 10625 11018 + 10626 11019 +#ifndef APC_POOL_H … … 10709 11102 + 10710 11103 +#endif 10711 --- /dev/null 10712 +++ b/ext/apc/apc_pthreadmutex.c 11104 diff -Naur a/ext/apc/apc_pthreadmutex.c b/ext/apc/apc_pthreadmutex.c 11105 --- a/ext/apc/apc_pthreadmutex.c 1970-01-01 01:00:00.000000000 +0100 11106 +++ b/ext/apc/apc_pthreadmutex.c 2012-07-20 00:10:35.000000000 +0200 10713 11107 @@ -0,0 +1,111 @@ 10714 11108 +/* … … 10716 11110 + | APC | 10717 11111 + +----------------------------------------------------------------------+ 10718 + | Copyright (c) 2006-201 0The PHP Group |11112 + | Copyright (c) 2006-2011 The PHP Group | 10719 11113 + +----------------------------------------------------------------------+ 10720 11114 + | This source file is subject to version 3.01 of the PHP license, | … … 10731 11125 + */ 10732 11126 + 10733 +/* $Id: apc_pthreadmutex.c 30 2175 2010-08-13 06:20:28Z kalle $ */11127 +/* $Id: apc_pthreadmutex.c 307048 2011-01-03 23:53:17Z kalle $ */ 10734 11128 + 10735 11129 +#include "apc_pthreadmutex.h" … … 10823 11217 + * vim<600: expandtab sw=4 ts=4 sts=4 10824 11218 + */ 10825 --- /dev/null 10826 +++ b/ext/apc/apc_pthreadmutex.h 11219 diff -Naur a/ext/apc/apc_pthreadmutex.h b/ext/apc/apc_pthreadmutex.h 11220 --- a/ext/apc/apc_pthreadmutex.h 1970-01-01 01:00:00.000000000 +0100 11221 +++ b/ext/apc/apc_pthreadmutex.h 2012-07-20 00:10:35.000000000 +0200 10827 11222 @@ -0,0 +1,48 @@ 10828 11223 +/* … … 10830 11225 + | APC | 10831 11226 + +----------------------------------------------------------------------+ 10832 + | Copyright (c) 2006-201 0The PHP Group |11227 + | Copyright (c) 2006-2011 The PHP Group | 10833 11228 + +----------------------------------------------------------------------+ 10834 11229 + | This source file is subject to version 3.01 of the PHP license, | … … 10845 11240 + */ 10846 11241 + 10847 +/* $Id: apc_pthreadmutex.h 30 2175 2010-08-13 06:20:28Z kalle $ */11242 +/* $Id: apc_pthreadmutex.h 307048 2011-01-03 23:53:17Z kalle $ */ 10848 11243 + 10849 11244 +#ifndef APC_PTHREADMUTEX_H … … 10874 11269 + * vim<600: expandtab sw=4 ts=4 sts=4 10875 11270 + */ 10876 --- /dev/null 10877 +++ b/ext/apc/apc_rfc1867.c 10878 @@ -0,0 +1,232 @@ 11271 diff -Naur a/ext/apc/apc_pthreadrwlock.c b/ext/apc/apc_pthreadrwlock.c 11272 --- a/ext/apc/apc_pthreadrwlock.c 1970-01-01 01:00:00.000000000 +0100 11273 +++ b/ext/apc/apc_pthreadrwlock.c 2012-07-20 00:10:35.000000000 +0200 11274 @@ -0,0 +1,120 @@ 10879 11275 +/* 10880 11276 + +----------------------------------------------------------------------+ 10881 11277 + | APC | 10882 11278 + +----------------------------------------------------------------------+ 10883 + | Copyright (c) 2006-201 0The PHP Group |11279 + | Copyright (c) 2006-2011 The PHP Group | 10884 11280 + +----------------------------------------------------------------------+ 10885 11281 + | This source file is subject to version 3.01 of the PHP license, | … … 10891 11287 + | license@php.net so we can mail you a copy immediately. | 10892 11288 + +----------------------------------------------------------------------+ 11289 + | Authors: Gopal V <gopalv@php.net> | 11290 + +----------------------------------------------------------------------+ 11291 + 11292 + */ 11293 + 11294 +/* $Id: $ */ 11295 + 11296 +#include "apc_pthreadrwlock.h" 11297 + 11298 +#ifdef APC_PTHREADRW_LOCKS 11299 + 11300 +pthread_rwlock_t *apc_pthreadrwlock_create(pthread_rwlock_t *lock TSRMLS_DC) 11301 +{ 11302 + int result; 11303 + pthread_rwlockattr_t attr; 11304 + 11305 + result = pthread_rwlockattr_init(&attr); 11306 + if(result == ENOMEM) { 11307 + apc_error("pthread rwlock error: Insufficient memory exists to create the rwlock attribute object." TSRMLS_CC); 11308 + } else if(result == EINVAL) { 11309 + apc_error("pthread rwlock error: attr does not point to writeable memory." TSRMLS_CC); 11310 + } else if(result == EFAULT) { 11311 + apc_error("pthread rwlock error: attr is an invalid pointer." TSRMLS_CC); 11312 + } 11313 + 11314 +#ifdef __USE_UNIX98 11315 + pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); 11316 +#endif 11317 + 11318 + result = pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); 11319 + if(result == EINVAL) { 11320 + apc_error("pthread rwlock error: attr is not an initialized rwlock attribute object, or pshared is not a valid process-shared state setting." TSRMLS_CC); 11321 + } else if(result == EFAULT) { 11322 + apc_error("pthread rwlock error: attr is an invalid pointer." TSRMLS_CC); 11323 + } else if(result == ENOTSUP) { 11324 + apc_error("pthread rwlock error: pshared was set to PTHREAD_PROCESS_SHARED." TSRMLS_CC); 11325 + } 11326 + 11327 + if(pthread_rwlock_init(lock, &attr)) { 11328 + apc_error("unable to initialize pthread rwlock" TSRMLS_CC); 11329 + } 11330 + 11331 + pthread_rwlockattr_destroy(&attr); 11332 + 11333 + return lock; 11334 +} 11335 + 11336 +void apc_pthreadrwlock_destroy(pthread_rwlock_t *lock) 11337 +{ 11338 + return; /* we don't actually destroy the rwlock, as it would destroy it for all processes */ 11339 +} 11340 + 11341 +void apc_pthreadrwlock_lock(pthread_rwlock_t *lock TSRMLS_DC) 11342 +{ 11343 + int result; 11344 + result = pthread_rwlock_wrlock(lock); 11345 + if(result == EINVAL) { 11346 + apc_error("unable to obtain pthread lock (EINVAL)" TSRMLS_CC); 11347 + } else if(result == EDEADLK) { 11348 + apc_error("unable to obtain pthread lock (EDEADLK)" TSRMLS_CC); 11349 + } 11350 +} 11351 + 11352 +void apc_pthreadrwlock_rdlock(pthread_rwlock_t *lock TSRMLS_DC) 11353 +{ 11354 + int result; 11355 + result = pthread_rwlock_rdlock(lock); 11356 + if(result == EINVAL) { 11357 + apc_error("unable to obtain pthread lock (EINVAL)" TSRMLS_CC); 11358 + } else if(result == EDEADLK) { 11359 + apc_error("unable to obtain pthread lock (EDEADLK)" TSRMLS_CC); 11360 + } 11361 +} 11362 + 11363 +void apc_pthreadrwlock_unlock(pthread_rwlock_t *lock TSRMLS_DC) 11364 +{ 11365 + if(pthread_rwlock_unlock(lock)) { 11366 + apc_error("unable to unlock pthread lock" TSRMLS_CC); 11367 + } 11368 +} 11369 + 11370 +zend_bool apc_pthreadrwlock_nonblocking_lock(pthread_rwlock_t *lock TSRMLS_DC) 11371 +{ 11372 + int rval; 11373 + rval = pthread_rwlock_trywrlock(lock); 11374 + if(rval == EBUSY) { /* Lock is already held */ 11375 + return 0; 11376 + } else if(rval == 0) { /* Obtained lock */ 11377 + return 1; 11378 + } else { /* Other error */ 11379 + apc_error("unable to obtain pthread trylock" TSRMLS_CC); 11380 + return 0; 11381 + } 11382 +} 11383 + 11384 + 11385 +#endif 11386 + 11387 +/* 11388 + * Local variables: 11389 + * tab-width: 4 11390 + * c-basic-offset: 4 11391 + * End: 11392 + * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 11393 + * vim<600: expandtab sw=4 ts=4 sts=4 11394 + */ 11395 diff -Naur a/ext/apc/apc_pthreadrwlock.h b/ext/apc/apc_pthreadrwlock.h 11396 --- a/ext/apc/apc_pthreadrwlock.h 1970-01-01 01:00:00.000000000 +0100 11397 +++ b/ext/apc/apc_pthreadrwlock.h 2012-07-20 00:10:35.000000000 +0200 11398 @@ -0,0 +1,49 @@ 11399 +/* 11400 + +----------------------------------------------------------------------+ 11401 + | APC | 11402 + +----------------------------------------------------------------------+ 11403 + | Copyright (c) 2006-2011 The PHP Group | 11404 + +----------------------------------------------------------------------+ 11405 + | This source file is subject to version 3.01 of the PHP license, | 11406 + | that is bundled with this package in the file LICENSE, and is | 11407 + | available through the world-wide-web at the following url: | 11408 + | http://www.php.net/license/3_01.txt | 11409 + | If you did not receive a copy of the PHP license and are unable to | 11410 + | obtain it through the world-wide-web, please send a note to | 11411 + | license@php.net so we can mail you a copy immediately. | 11412 + +----------------------------------------------------------------------+ 11413 + | Authors: Gopal V <gopalv@php.net> | 11414 + +----------------------------------------------------------------------+ 11415 + 11416 + */ 11417 + 11418 +/* $Id: apc_pthreadrwlock.h 302175 2010-08-13 06:20:28Z kalle $ */ 11419 + 11420 +#ifndef APC_PTHREADRWLOCK_H 11421 +#define APC_PTHREADRWLOCK_H 11422 + 11423 +#include "apc.h" 11424 + 11425 +#ifdef APC_PTHREADRW_LOCKS 11426 + 11427 +#include <pthread.h> 11428 + 11429 +pthread_rwlock_t *apc_pthreadrwlock_create(pthread_rwlock_t *lock TSRMLS_DC); 11430 +void apc_pthreadrwlock_destroy(pthread_rwlock_t *lock); 11431 +void apc_pthreadrwlock_lock(pthread_rwlock_t *lock TSRMLS_DC); 11432 +void apc_pthreadrwlock_rdlock(pthread_rwlock_t *lock TSRMLS_DC); 11433 +void apc_pthreadrwlock_unlock(pthread_rwlock_t *lock TSRMLS_DC); 11434 +zend_bool apc_pthreadrwlock_nonblocking_lock(pthread_rwlock_t *lock TSRMLS_DC); 11435 + 11436 +#endif 11437 + 11438 +#endif 11439 + 11440 +/* 11441 + * Local variables: 11442 + * tab-width: 4 11443 + * c-basic-offset: 4 11444 + * End: 11445 + * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 11446 + * vim<600: expandtab sw=4 ts=4 sts=4 11447 + */ 11448 diff -Naur a/ext/apc/apc_rfc1867.c b/ext/apc/apc_rfc1867.c 11449 --- a/ext/apc/apc_rfc1867.c 1970-01-01 01:00:00.000000000 +0100 11450 +++ b/ext/apc/apc_rfc1867.c 2012-07-20 00:10:35.000000000 +0200 11451 @@ -0,0 +1,236 @@ 11452 +/* 11453 + +----------------------------------------------------------------------+ 11454 + | APC | 11455 + +----------------------------------------------------------------------+ 11456 + | Copyright (c) 2006-2011 The PHP Group | 11457 + +----------------------------------------------------------------------+ 11458 + | This source file is subject to version 3.01 of the PHP license, | 11459 + | that is bundled with this package in the file LICENSE, and is | 11460 + | available through the world-wide-web at the following url: | 11461 + | http://www.php.net/license/3_01.txt | 11462 + | If you did not receive a copy of the PHP license and are unable to | 11463 + | obtain it through the world-wide-web, please send a note to | 11464 + | license@php.net so we can mail you a copy immediately. | 11465 + +----------------------------------------------------------------------+ 10893 11466 + | Authors: Rasmus Lerdorf <rasmus@php.net> | 10894 11467 + +----------------------------------------------------------------------+ … … 10904 11477 + */ 10905 11478 + 10906 +/* $Id: apc_rfc1867.c 30 5798 2010-11-28 13:43:20Z gopalv$*/11479 +/* $Id: apc_rfc1867.c 309694 2011-03-25 18:47:38Z rasmus $*/ 10907 11480 + 10908 11481 +#include "apc.h" … … 11058 11631 + RFC1867_DATA(bytes_processed) = data->post_bytes_processed; 11059 11632 + RFC1867_DATA(cancel_upload) = data->cancel_upload; 11060 + RFC1867_DATA(temp_filename) = data->temp_filename; 11633 + if(data->temp_filename) { 11634 + RFC1867_DATA(temp_filename) = data->temp_filename; 11635 + } else { 11636 + RFC1867_DATA(temp_filename) = ""; 11637 + } 11061 11638 + ALLOC_INIT_ZVAL(track); 11062 11639 + array_init(track); … … 11109 11686 + * vim<600: expandtab sw=4 ts=4 sts=4 11110 11687 + */ 11111 --- /dev/null 11112 +++ b/ext/apc/apc_sem.c 11688 diff -Naur a/ext/apc/apc_sem.c b/ext/apc/apc_sem.c 11689 --- a/ext/apc/apc_sem.c 1970-01-01 01:00:00.000000000 +0100 11690 +++ b/ext/apc/apc_sem.c 2012-07-20 00:10:35.000000000 +0200 11113 11691 @@ -0,0 +1,192 @@ 11114 11692 +/* … … 11116 11694 + | APC | 11117 11695 + +----------------------------------------------------------------------+ 11118 + | Copyright (c) 2006-201 0The PHP Group |11696 + | Copyright (c) 2006-2011 The PHP Group | 11119 11697 + +----------------------------------------------------------------------+ 11120 11698 + | This source file is subject to version 3.01 of the PHP license, | … … 11139 11717 + */ 11140 11718 + 11141 +/* $Id: apc_sem.c 30 2175 2010-08-13 06:20:28Z kalle $ */11719 +/* $Id: apc_sem.c 307048 2011-01-03 23:53:17Z kalle $ */ 11142 11720 + 11143 11721 +#include "apc.h" … … 11304 11882 + * vim<600: expandtab sw=4 ts=4 sts=4 11305 11883 + */ 11306 --- /dev/null 11307 +++ b/ext/apc/apc_sem.h 11884 diff -Naur a/ext/apc/apc_sem.h b/ext/apc/apc_sem.h 11885 --- a/ext/apc/apc_sem.h 1970-01-01 01:00:00.000000000 +0100 11886 +++ b/ext/apc/apc_sem.h 2012-07-20 00:10:35.000000000 +0200 11308 11887 @@ -0,0 +1,52 @@ 11309 11888 +/* … … 11311 11890 + | APC | 11312 11891 + +----------------------------------------------------------------------+ 11313 + | Copyright (c) 2006-201 0The PHP Group |11892 + | Copyright (c) 2006-2011 The PHP Group | 11314 11893 + +----------------------------------------------------------------------+ 11315 11894 + | This source file is subject to version 3.01 of the PHP license, | … … 11334 11913 + */ 11335 11914 + 11336 +/* $Id: apc_sem.h 30 2175 2010-08-13 06:20:28Z kalle $ */11915 +/* $Id: apc_sem.h 307048 2011-01-03 23:53:17Z kalle $ */ 11337 11916 + 11338 11917 +#ifndef APC_SEM_H … … 11359 11938 + * vim<600: expandtab sw=4 ts=4 sts=4 11360 11939 + */ 11361 --- /dev/null 11362 +++ b/ext/apc/apc_shm.c 11363 @@ -0,0 +1,114 @@ 11940 diff -Naur a/ext/apc/apc_serializer.h b/ext/apc/apc_serializer.h 11941 --- a/ext/apc/apc_serializer.h 1970-01-01 01:00:00.000000000 +0100 11942 +++ b/ext/apc/apc_serializer.h 2012-07-20 00:10:35.000000000 +0200 11943 @@ -0,0 +1,84 @@ 11364 11944 +/* 11365 11945 + +----------------------------------------------------------------------+ 11366 11946 + | APC | 11367 11947 + +----------------------------------------------------------------------+ 11368 + | Copyright (c) 2006-2010 The PHP Group | 11948 + | Copyright (c) 2006-2011 The PHP Group | 11949 + +----------------------------------------------------------------------+ 11950 + | This source file is subject to version 3.01 of the PHP license, | 11951 + | that is bundled with this package in the file LICENSE, and is | 11952 + | available through the world-wide-web at the following url: | 11953 + | http://www.php.net/license/3_01.txt. | 11954 + | If you did not receive a copy of the PHP license and are unable to | 11955 + | obtain it through the world-wide-web, please send a note to | 11956 + | license@php.net so we can mail you a copy immediately. | 11957 + +----------------------------------------------------------------------+ 11958 + | Authors: Gopal Vijayaraghavan <gopalv@php.net> | 11959 + +----------------------------------------------------------------------+ 11960 + 11961 + */ 11962 + 11963 +/* $Id: $ */ 11964 + 11965 +#ifndef APC_SERIALIZER_H 11966 +#define APC_SERIALIZER_H 11967 + 11968 +/* this is a shipped .h file, do not include any other header in this file */ 11969 +#define APC_SERIALIZER_NAME(module) module##_apc_serializer 11970 +#define APC_UNSERIALIZER_NAME(module) module##_apc_unserializer 11971 + 11972 +#define APC_SERIALIZER_ARGS unsigned char **buf, size_t *buf_len, const zval *value, void *config TSRMLS_DC 11973 +#define APC_UNSERIALIZER_ARGS zval **value, unsigned char *buf, size_t buf_len, void *config TSRMLS_DC 11974 + 11975 +typedef int (*apc_serialize_t)(APC_SERIALIZER_ARGS); 11976 +typedef int (*apc_unserialize_t)(APC_UNSERIALIZER_ARGS); 11977 + 11978 +typedef int (*apc_register_serializer_t)(const char* name, 11979 + apc_serialize_t serialize, 11980 + apc_unserialize_t unserialize, 11981 + void *config TSRMLS_DC); 11982 + 11983 +/* 11984 + * ABI version for constant hooks. Increment this any time you make any changes 11985 + * to any function in this file. 11986 + */ 11987 +#define APC_SERIALIZER_ABI "0" 11988 +#define APC_SERIALIZER_CONSTANT "\000apc_register_serializer-" APC_SERIALIZER_ABI 11989 + 11990 +#if !defined(APC_UNUSED) 11991 +# if defined(__GNUC__) 11992 +# define APC_UNUSED __attribute__((unused)) 11993 +# else 11994 +# define APC_UNUSED 11995 +# endif 11996 +#endif 11997 + 11998 +static APC_UNUSED int apc_register_serializer(const char* name, 11999 + apc_serialize_t serialize, 12000 + apc_unserialize_t unserialize, 12001 + void *config TSRMLS_DC) 12002 +{ 12003 + zval apc_magic_constant; 12004 + int retval = 0; 12005 + 12006 + /* zend_get_constant will return 1 on success, otherwise apc_magic_constant wouldn't be touched at all */ 12007 + if (zend_get_constant(APC_SERIALIZER_CONSTANT, sizeof(APC_SERIALIZER_CONSTANT)-1, &apc_magic_constant TSRMLS_CC)) { 12008 + apc_register_serializer_t register_func = (apc_register_serializer_t)(Z_LVAL(apc_magic_constant)); 12009 + if(register_func) { 12010 + retval = register_func(name, serialize, unserialize, NULL TSRMLS_CC); 12011 + } 12012 + zval_dtor(&apc_magic_constant); 12013 + } 12014 + 12015 + return retval; 12016 +} 12017 + 12018 +#endif 12019 + 12020 +/* 12021 + * Local variables: 12022 + * tab-width: 4 12023 + * c-basic-offset: 4 12024 + * End: 12025 + * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 12026 + * vim<600: expandtab sw=4 ts=4 sts=4 12027 + */ 12028 diff -Naur a/ext/apc/apc_shm.c b/ext/apc/apc_shm.c 12029 --- a/ext/apc/apc_shm.c 1970-01-01 01:00:00.000000000 +0100 12030 +++ b/ext/apc/apc_shm.c 2012-07-20 00:10:35.000000000 +0200 12031 @@ -0,0 +1,116 @@ 12032 +/* 12033 + +----------------------------------------------------------------------+ 12034 + | APC | 12035 + +----------------------------------------------------------------------+ 12036 + | Copyright (c) 2006-2011 The PHP Group | 11369 12037 + +----------------------------------------------------------------------+ 11370 12038 + | This source file is subject to version 3.01 of the PHP license, | … … 11390 12058 + */ 11391 12059 + 11392 +/* $Id: apc_shm.c 30 2175 2010-08-13 06:20:28Z kalle$ */12060 +/* $Id: apc_shm.c 307259 2011-01-08 12:05:24Z gopalv $ */ 11393 12061 + 11394 12062 +#include "apc_shm.h" … … 11431 12099 +} 11432 12100 + 11433 +apc_segment_t apc_shm_attach(int shmid TSRMLS_DC)12101 +apc_segment_t apc_shm_attach(int shmid, size_t size TSRMLS_DC) 11434 12102 +{ 11435 12103 + apc_segment_t segment; /* shm segment */ … … 11446 12114 + 11447 12115 +#endif 12116 + 12117 + segment.size = size; 11448 12118 + 11449 12119 + /* … … 11476 12146 + * vim<600: expandtab sw=4 ts=4 sts=4 11477 12147 + */ 11478 --- /dev/null 11479 +++ b/ext/apc/apc_shm.h 12148 diff -Naur a/ext/apc/apc_shm.h b/ext/apc/apc_shm.h 12149 --- a/ext/apc/apc_shm.h 1970-01-01 01:00:00.000000000 +0100 12150 +++ b/ext/apc/apc_shm.h 2012-07-20 00:10:35.000000000 +0200 11480 12151 @@ -0,0 +1,56 @@ 11481 12152 +/* … … 11483 12154 + | APC | 11484 12155 + +----------------------------------------------------------------------+ 11485 + | Copyright (c) 2006-201 0The PHP Group |12156 + | Copyright (c) 2006-2011 The PHP Group | 11486 12157 + +----------------------------------------------------------------------+ 11487 12158 + | This source file is subject to version 3.01 of the PHP license, | … … 11506 12177 + */ 11507 12178 + 11508 +/* $Id: apc_shm.h 30 2175 2010-08-13 06:20:28Z kalle$ */12179 +/* $Id: apc_shm.h 307259 2011-01-08 12:05:24Z gopalv $ */ 11509 12180 + 11510 12181 +#ifndef APC_SHM_H … … 11522 12193 +extern int apc_shm_create(int proj, size_t size TSRMLS_DC); 11523 12194 +extern void apc_shm_destroy(int shmid); 11524 +extern apc_segment_t apc_shm_attach(int shmid TSRMLS_DC);12195 +extern apc_segment_t apc_shm_attach(int shmid, size_t size TSRMLS_DC); 11525 12196 +extern void apc_shm_detach(apc_segment_t* segment TSRMLS_DC); 11526 12197 + … … 11535 12206 + * vim<600: expandtab sw=4 ts=4 sts=4 11536 12207 + */ 11537 --- /dev/null 11538 +++ b/ext/apc/apc_signal.c 12208 diff -Naur a/ext/apc/apc_signal.c b/ext/apc/apc_signal.c 12209 --- a/ext/apc/apc_signal.c 1970-01-01 01:00:00.000000000 +0100 12210 +++ b/ext/apc/apc_signal.c 2012-07-20 00:10:35.000000000 +0200 11539 12211 @@ -0,0 +1,197 @@ 11540 12212 +/* … … 11542 12214 + | APC | 11543 12215 + +----------------------------------------------------------------------+ 11544 + | Copyright (c) 2006-201 0The PHP Group |12216 + | Copyright (c) 2006-2011 The PHP Group | 11545 12217 + +----------------------------------------------------------------------+ 11546 12218 + | This source file is subject to version 3.01 of the PHP license, | … … 11564 12236 + */ 11565 12237 + 11566 + /* $Id: apc_signal.c 30 2175 2010-08-13 06:20:28Z kalle $ */12238 + /* $Id: apc_signal.c 307048 2011-01-03 23:53:17Z kalle $ */ 11567 12239 + 11568 12240 + /* Allows apc to install signal handlers and maintain signalling … … 11735 12407 + * vim<600: expandtab sw=4 ts=4 sts=4 11736 12408 + */ 11737 --- /dev/null 11738 +++ b/ext/apc/apc_signal.h 12409 diff -Naur a/ext/apc/apc_signal.h b/ext/apc/apc_signal.h 12410 --- a/ext/apc/apc_signal.h 1970-01-01 01:00:00.000000000 +0100 12411 +++ b/ext/apc/apc_signal.h 2012-07-20 00:10:35.000000000 +0200 11739 12412 @@ -0,0 +1,51 @@ 11740 12413 +/* … … 11742 12415 + | APC | 11743 12416 + +----------------------------------------------------------------------+ 11744 + | Copyright (c) 2006-201 0The PHP Group |12417 + | Copyright (c) 2006-2011 The PHP Group | 11745 12418 + +----------------------------------------------------------------------+ 11746 12419 + | This source file is subject to version 3.01 of the PHP license, | … … 11757 12430 + */ 11758 12431 + 11759 +/* $Id: apc_signal.h 30 0986 2010-07-04 14:41:33Z felipe $ */12432 +/* $Id: apc_signal.h 307048 2011-01-03 23:53:17Z kalle $ */ 11760 12433 + 11761 12434 +#ifndef APC_SIGNAL_H … … 11789 12462 + * vim<600: expandtab sw=4 ts=4 sts=4 11790 12463 + */ 11791 --- /dev/null 11792 +++ b/ext/apc/apc_sma.c 12464 diff -Naur a/ext/apc/apc_sma.c b/ext/apc/apc_sma.c 12465 --- a/ext/apc/apc_sma.c 1970-01-01 01:00:00.000000000 +0100 12466 +++ b/ext/apc/apc_sma.c 2012-07-20 00:10:35.000000000 +0200 11793 12467 @@ -0,0 +1,765 @@ 11794 12468 +/* … … 11796 12470 + | APC | 11797 12471 + +----------------------------------------------------------------------+ 11798 + | Copyright (c) 2006-201 0The PHP Group |12472 + | Copyright (c) 2006-2011 The PHP Group | 11799 12473 + +----------------------------------------------------------------------+ 11800 12474 + | This source file is subject to version 3.01 of the PHP license, | … … 11820 12494 + */ 11821 12495 + 11822 +/* $Id: apc_sma.c 30 5260 2010-11-10 19:23:02Z gopalv$ */12496 +/* $Id: apc_sma.c 309489 2011-03-21 00:00:54Z pajoye $ */ 11823 12497 + 11824 12498 +#include "apc_sma.h" … … 11971 12645 + 11972 12646 +/* {{{ sma_allocate: tries to allocate at least size bytes in a segment */ 11973 +static size_t sma_allocate(sma_header_t* header, size_t size, size_t fragment, size_t *allocated)12647 +static APC_HOTSPOT size_t sma_allocate(sma_header_t* header, size_t size, size_t fragment, size_t *allocated) 11974 12648 +{ 11975 12649 + void* shmaddr; /* header of shared memory segment */ … … 12068 12742 + 12069 12743 +/* {{{ sma_deallocate: deallocates the block at the given offset */ 12070 +static size_t sma_deallocate(void* shmaddr, size_t offset)12744 +static APC_HOTSPOT size_t sma_deallocate(void* shmaddr, size_t offset) 12071 12745 +{ 12072 12746 + sma_header_t* header; /* header of shared memory segment */ … … 12165 12839 + if(sma_numseg != 1) memcpy(&mmap_file_mask[strlen(mmap_file_mask)-6], "XXXXXX", 6); 12166 12840 +#else 12167 + sma_segments[i] = apc_shm_attach(apc_shm_create(i, sma_segsize TSRMLS_CC) TSRMLS_CC);12841 + sma_segments[i] = apc_shm_attach(apc_shm_create(i, sma_segsize TSRMLS_CC), sma_segsize TSRMLS_CC); 12168 12842 +#endif 12169 12843 + … … 12293 12967 + if(!nuked) { 12294 12968 + apc_cache->expunge_cb(apc_cache, (n+fragment) TSRMLS_CC); 12295 + apc_user_cache->expunge_cb(apc_ cache, (n+fragment) TSRMLS_CC);12969 + apc_user_cache->expunge_cb(apc_user_cache, (n+fragment) TSRMLS_CC); 12296 12970 + nuked = 1; 12297 12971 + goto restart; … … 12487 13161 + 12488 13162 + } 12489 + UNLOCK(SMA_LCK(i));13163 + RDUNLOCK(SMA_LCK(i)); 12490 13164 + } 12491 13165 + … … 12557 13231 + * vim<600: expandtab sw=4 ts=4 sts=4 12558 13232 + */ 12559 --- /dev/null 12560 +++ b/ext/apc/apc_sma.h 13233 diff -Naur a/ext/apc/apc_sma.h b/ext/apc/apc_sma.h 13234 --- a/ext/apc/apc_sma.h 1970-01-01 01:00:00.000000000 +0100 13235 +++ b/ext/apc/apc_sma.h 2012-07-20 00:10:35.000000000 +0200 12561 13236 @@ -0,0 +1,103 @@ 12562 13237 +/* … … 12564 13239 + | APC | 12565 13240 + +----------------------------------------------------------------------+ 12566 + | Copyright (c) 2006-201 0The PHP Group |13241 + | Copyright (c) 2006-2011 The PHP Group | 12567 13242 + +----------------------------------------------------------------------+ 12568 13243 + | This source file is subject to version 3.01 of the PHP license, | … … 12587 13262 + */ 12588 13263 + 12589 +/* $Id: apc_sma.h 30 3274 2010-09-11 14:31:32Z iliaa$ */13264 +/* $Id: apc_sma.h 307048 2011-01-03 23:53:17Z kalle $ */ 12590 13265 + 12591 13266 +#ifndef APC_SMA_H … … 12663 13338 + * vim<600: expandtab sw=4 ts=4 sts=4 12664 13339 + */ 12665 --- /dev/null 12666 +++ b/ext/apc/apc_spin.c 13340 diff -Naur a/ext/apc/apc_spin.c b/ext/apc/apc_spin.c 13341 --- a/ext/apc/apc_spin.c 1970-01-01 01:00:00.000000000 +0100 13342 +++ b/ext/apc/apc_spin.c 2012-07-20 00:10:35.000000000 +0200 12667 13343 @@ -0,0 +1,66 @@ 12668 13344 +/* … … 12670 13346 + | APC | 12671 13347 + +----------------------------------------------------------------------+ 12672 + | Copyright (c) 2006-201 0The PHP Group |13348 + | Copyright (c) 2006-2011 The PHP Group | 12673 13349 + +----------------------------------------------------------------------+ 12674 13350 + | This source file is subject to version 3.01 of the PHP license, | … … 12685 13361 + */ 12686 13362 + 12687 +/* $Id: apc_spin.c 30 2175 2010-08-13 06:20:28Z kalle $ */13363 +/* $Id: apc_spin.c 307048 2011-01-03 23:53:17Z kalle $ */ 12688 13364 + 12689 13365 +#include "apc_spin.h" … … 12732 13408 + * vim<600: expandtab sw=4 ts=4 sts=4 12733 13409 + */ 12734 --- /dev/null 12735 +++ b/ext/apc/apc_spin.h 13410 diff -Naur a/ext/apc/apc_spin.h b/ext/apc/apc_spin.h 13411 --- a/ext/apc/apc_spin.h 1970-01-01 01:00:00.000000000 +0100 13412 +++ b/ext/apc/apc_spin.h 2012-07-20 00:10:35.000000000 +0200 12736 13413 @@ -0,0 +1,48 @@ 12737 13414 +/* … … 12739 13416 + | APC | 12740 13417 + +----------------------------------------------------------------------+ 12741 + | Copyright (c) 2006-201 0The PHP Group |13418 + | Copyright (c) 2006-2011 The PHP Group | 12742 13419 + +----------------------------------------------------------------------+ 12743 13420 + | This source file is subject to version 3.01 of the PHP license, | … … 12754 13431 + */ 12755 13432 + 12756 +/* $Id: apc_spin.h 30 2175 2010-08-13 06:20:28Z kalle $ */13433 +/* $Id: apc_spin.h 307048 2011-01-03 23:53:17Z kalle $ */ 12757 13434 + 12758 13435 +#ifndef APC_SPIN_H … … 12783 13460 + * vim<600: expandtab sw=4 ts=4 sts=4 12784 13461 + */ 12785 --- /dev/null 12786 +++ b/ext/apc/apc_stack.c 13462 diff -Naur a/ext/apc/apc_stack.c b/ext/apc/apc_stack.c 13463 --- a/ext/apc/apc_stack.c 1970-01-01 01:00:00.000000000 +0100 13464 +++ b/ext/apc/apc_stack.c 2012-07-20 00:10:35.000000000 +0200 12787 13465 @@ -0,0 +1,106 @@ 12788 13466 +/* … … 12790 13468 + | APC | 12791 13469 + +----------------------------------------------------------------------+ 12792 + | Copyright (c) 2006-201 0The PHP Group |13470 + | Copyright (c) 2006-2011 The PHP Group | 12793 13471 + +----------------------------------------------------------------------+ 12794 13472 + | This source file is subject to version 3.01 of the PHP license, | … … 12813 13491 + */ 12814 13492 + 12815 +/* $Id: apc_stack.c 30 2175 2010-08-13 06:20:28Z kalle $ */13493 +/* $Id: apc_stack.c 307048 2011-01-03 23:53:17Z kalle $ */ 12816 13494 + 12817 13495 +#include "apc.h" … … 12892 13570 + * vim<600: expandtab sw=4 ts=4 sts=4 12893 13571 + */ 12894 --- /dev/null 12895 +++ b/ext/apc/apc_stack.h 13572 diff -Naur a/ext/apc/apc_stack.h b/ext/apc/apc_stack.h 13573 --- a/ext/apc/apc_stack.h 1970-01-01 01:00:00.000000000 +0100 13574 +++ b/ext/apc/apc_stack.h 2012-07-20 00:10:35.000000000 +0200 12896 13575 @@ -0,0 +1,58 @@ 12897 13576 +/* … … 12899 13578 + | APC | 12900 13579 + +----------------------------------------------------------------------+ 12901 + | Copyright (c) 2006-201 0The PHP Group |13580 + | Copyright (c) 2006-2011 The PHP Group | 12902 13581 + +----------------------------------------------------------------------+ 12903 13582 + | This source file is subject to version 3.01 of the PHP license, | … … 12923 13602 + */ 12924 13603 + 12925 +/* $Id: apc_stack.h 30 2175 2010-08-13 06:20:28Z kalle $ */13604 +/* $Id: apc_stack.h 307048 2011-01-03 23:53:17Z kalle $ */ 12926 13605 + 12927 13606 +#ifndef APC_STACK_H … … 12953 13632 + * vim<600: expandtab sw=4 ts=4 sts=4 12954 13633 + */ 12955 --- /dev/null 12956 +++ b/ext/apc/apc_string.c 12957 @@ -0,0 +1,247 @@ 13634 diff -Naur a/ext/apc/apc_string.c b/ext/apc/apc_string.c 13635 --- a/ext/apc/apc_string.c 1970-01-01 01:00:00.000000000 +0100 13636 +++ b/ext/apc/apc_string.c 2012-07-20 00:10:35.000000000 +0200 13637 @@ -0,0 +1,261 @@ 12958 13638 +/* 12959 13639 + +----------------------------------------------------------------------+ 12960 13640 + | APC | 12961 13641 + +----------------------------------------------------------------------+ 12962 + | Copyright (c) 2006-201 0The PHP Group |13642 + | Copyright (c) 2006-2011 The PHP Group | 12963 13643 + +----------------------------------------------------------------------+ 12964 13644 + | This source file is subject to version 3.01 of the PHP license, | … … 12983 13663 + */ 12984 13664 + 12985 +/* $Id: $ */13665 +/* $Id: apc_string.c 326089 2012-06-11 04:29:57Z rasmus $ */ 12986 13666 + 12987 13667 +#include "apc.h" … … 12992 13672 +#ifdef ZEND_ENGINE_2_4 12993 13673 + 13674 +#ifndef ZTS 12994 13675 +typedef struct _apc_interned_strings_data_t { 12995 13676 + char *interned_strings_start; … … 13006 13687 +static char *old_interned_strings_start; 13007 13688 +static char *old_interned_strings_end; 13008 +static c har *(*old_new_interned_string)(char *str, int len, int free_src TSRMLS_DC);13689 +static const char *(*old_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); 13009 13690 +static void (*old_interned_strings_snapshot)(TSRMLS_D); 13010 13691 +static void (*old_interned_strings_restore)(TSRMLS_D); 13011 13692 + 13012 +static c har *apc_dummy_new_interned_string_for_php(char *str, int len, int free_src TSRMLS_DC)13693 +static const char *apc_dummy_new_interned_string_for_php(const char *str, int len, int free_src TSRMLS_DC) 13013 13694 +{ 13014 13695 + return str; … … 13022 13703 +{ 13023 13704 +} 13024 + 13025 +char *apc_new_interned_string(char *arKey, int nKeyLength TSRMLS_DC) 13026 +{ 13705 +#endif 13706 + 13707 +const char *apc_new_interned_string(const char *arKey, int nKeyLength TSRMLS_DC) 13708 +{ 13709 +#ifndef ZTS 13027 13710 + ulong h; 13028 13711 + uint nIndex; … … 13046 13729 + } 13047 13730 + 13048 + if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength ) >=13731 + if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1) >= 13049 13732 + APCSG(interned_strings_end)) { 13050 13733 + /* no memory */ … … 13053 13736 + 13054 13737 + p = (Bucket *) APCSG(interned_strings_top); 13055 + APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength );13738 + APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1); 13056 13739 + 13057 13740 + p->arKey = (char*)(p+1); 13058 13741 + memcpy(p->arKey, arKey, nKeyLength); 13742 + ((char *)p->arKey)[nKeyLength] = '\0'; 13059 13743 + p->nKeyLength = nKeyLength; 13060 13744 + p->h = h; … … 13082 13766 + 13083 13767 + return p->arKey; 13084 +} 13085 + 13768 +#else 13769 + return zend_new_interned_string(arKey, nKeyLength, 0 TSRMLS_CC); 13770 +#endif 13771 +} 13772 + 13773 +#ifndef ZTS 13086 13774 +static void apc_copy_internal_strings(TSRMLS_D) 13087 13775 +{ … … 13103 13791 + p->arKey = apc_new_interned_string(p->arKey, p->nKeyLength TSRMLS_CC); 13104 13792 + } 13793 + 13794 + if (ce->name) { 13795 + ce->name = apc_new_interned_string(ce->name, ce->name_length+1 TSRMLS_CC); 13796 + } 13105 13797 + 13106 13798 + q = ce->properties_info.pListHead; … … 13152 13844 + 13153 13845 + apc_interned_strings_data = (apc_interned_strings_data_t*) apc_sma_malloc(APCG(shm_strings_buffer) TSRMLS_CC); 13846 + memset((void *)apc_interned_strings_data, 0, APCG(shm_strings_buffer)); 13154 13847 + 13155 13848 + CREATE_LOCK(APCSG(lock)); … … 13192 13885 + DESTROY_LOCK(APCSG(lock)); 13193 13886 +} 13887 +#endif 13194 13888 + 13195 13889 +#endif … … 13203 13897 + * vim<600: expandtab sw=4 ts=4 sts=4 13204 13898 + */ 13205 --- /dev/null 13206 +++ b/ext/apc/apc_string.h 13207 @@ -0,0 +1,49 @@ 13899 diff -Naur a/ext/apc/apc_string.h b/ext/apc/apc_string.h 13900 --- a/ext/apc/apc_string.h 1970-01-01 01:00:00.000000000 +0100 13901 +++ b/ext/apc/apc_string.h 2012-07-20 00:10:35.000000000 +0200 13902 @@ -0,0 +1,51 @@ 13208 13903 +/* 13209 13904 + +----------------------------------------------------------------------+ 13210 13905 + | APC | 13211 13906 + +----------------------------------------------------------------------+ 13212 + | Copyright (c) 2006-201 0The PHP Group |13907 + | Copyright (c) 2006-2011 The PHP Group | 13213 13908 + +----------------------------------------------------------------------+ 13214 13909 + | This source file is subject to version 3.01 of the PHP license, | … … 13233 13928 + */ 13234 13929 + 13235 +/* $Id: $ */13930 +/* $Id: apc_string.h 324145 2012-03-12 11:38:28Z pajoye $ */ 13236 13931 + 13237 13932 +#ifndef APC_STRING … … 13240 13935 +#include "apc.h" 13241 13936 + 13937 +#ifndef ZTS 13242 13938 +void apc_interned_strings_init(TSRMLS_D); 13243 13939 +void apc_interned_strings_shutdown(TSRMLS_D); 13244 + 13245 +char *apc_new_interned_string(char *arKey, int nKeyLength TSRMLS_DC); 13940 +#endif 13941 + 13942 +const char *apc_new_interned_string(const char *arKey, int nKeyLength TSRMLS_DC); 13246 13943 + 13247 13944 +#endif … … 13255 13952 + * vim<600: expandtab sw=4 ts=4 sts=4 13256 13953 + */ 13257 --- /dev/null 13258 +++ b/ext/apc/apc_zend.c 13259 @@ -0,0 +1,271 @@ 13954 diff -Naur a/ext/apc/apc_windows_srwlock_kernel.c b/ext/apc/apc_windows_srwlock_kernel.c 13955 --- a/ext/apc/apc_windows_srwlock_kernel.c 1970-01-01 01:00:00.000000000 +0100 13956 +++ b/ext/apc/apc_windows_srwlock_kernel.c 2012-07-20 00:10:35.000000000 +0200 13957 @@ -0,0 +1,133 @@ 13260 13958 +/* 13261 13959 + +----------------------------------------------------------------------+ 13262 13960 + | APC | 13263 13961 + +----------------------------------------------------------------------+ 13264 + | Copyright (c) 2006-201 0The PHP Group |13962 + | Copyright (c) 2006-2011 The PHP Group | 13265 13963 + +----------------------------------------------------------------------+ 13266 13964 + | This source file is subject to version 3.01 of the PHP license, | … … 13272 13970 + | license@php.net so we can mail you a copy immediately. | 13273 13971 + +----------------------------------------------------------------------+ 13972 + | Authors: Pierre Joye <pierre@php.net> | 13973 + +----------------------------------------------------------------------+ 13974 + */ 13975 +/* $Id$ */ 13976 +/* 13977 + These APIs are not actually exposed nor documented. But should work fine 13978 + from a binary as available since XP without signature changes. 13979 +*/ 13980 +/* 13981 +TODOs: 13982 +non blocking could be possible using the fWait argument (to 0). However 13983 +I'm not sure whether the wait handlers is actually implemented in all 13984 +supported platforms (xp+). could be enabled later once really tested. 13985 + */ 13986 +/* $Id: $ */ 13987 + 13988 +#include <php.h> 13989 + 13990 +#ifdef APC_SRWLOCK_KERNEL 13991 +#include "apc_windows_srwlock_kernel.h" 13992 + 13993 +/* 13994 +For references: 13995 +void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl); 13996 +void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl); 13997 +BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait); 13998 +BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait); 13999 +void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl); 14000 +*/ 14001 +typedef void (WINAPI *tRtlInitializeResource)(LPRTL_RWLOCK rwl); 14002 +typedef void (WINAPI *tRtlDeleteResource)(LPRTL_RWLOCK rwl); 14003 +typedef BYTE (WINAPI *tRtlAcquireResourceExclusive)(LPRTL_RWLOCK rwl, BYTE fWait); 14004 +typedef BYTE (WINAPI *tRtlAcquireResourceShared)(LPRTL_RWLOCK rwl, BYTE fWait); 14005 +typedef void (WINAPI *tRtlReleaseResource)(LPRTL_RWLOCK rwl); 14006 +typedef void (WINAPI *tRtlDumpResource)(LPRTL_RWLOCK rwl); 14007 + 14008 +tRtlInitializeResource pRtlInitializeResource = 0; 14009 +tRtlDeleteResource pRtlDeleteResource = 0; 14010 +tRtlAcquireResourceExclusive pRtlAcquireResourceExclusive = 0; 14011 +tRtlAcquireResourceShared pRtlAcquireResourceShared = 0; 14012 +tRtlReleaseResource pRtlReleaseResource = 0; 14013 +tRtlDumpResource pRtlDumpResource = 0; 14014 + 14015 +HINSTANCE ntdll; 14016 + 14017 +void apc_windows_cs_status(apc_windows_cs_rwlock_t *lock ); 14018 +apc_windows_cs_rwlock_t *apc_windows_cs_create(apc_windows_cs_rwlock_t *lock TSRMLS_DC) 14019 +{ 14020 + ntdll = LoadLibrary("ntdll.dll"); 14021 + if (ntdll == 0) { 14022 + return NULL; 14023 + } 14024 + 14025 + pRtlInitializeResource = (tRtlInitializeResource) GetProcAddress(ntdll, "RtlInitializeResource"); 14026 + pRtlDeleteResource = (tRtlDeleteResource) GetProcAddress(ntdll, "RtlDeleteResource"); 14027 + pRtlAcquireResourceExclusive = (tRtlAcquireResourceExclusive) GetProcAddress(ntdll, "RtlAcquireResourceExclusive"); 14028 + pRtlAcquireResourceShared = (tRtlAcquireResourceShared) GetProcAddress(ntdll, "RtlAcquireResourceShared"); 14029 + pRtlReleaseResource = (tRtlReleaseResource) GetProcAddress(ntdll, "RtlReleaseResource"); 14030 + pRtlDumpResource = (tRtlReleaseResource) GetProcAddress(ntdll, "RtlDumpResource"); 14031 + if (pRtlInitializeResource == 0 || pRtlDeleteResource == 0 || pRtlAcquireResourceExclusive == 0 || 14032 + pRtlAcquireResourceShared == 0 || pRtlReleaseResource == 0 || pRtlDumpResource == 0) { 14033 + return NULL; 14034 + } 14035 + pRtlInitializeResource(lock); 14036 + return lock; 14037 +} 14038 + 14039 +void apc_windows_cs_destroy(apc_windows_cs_rwlock_t *lock) 14040 +{ 14041 + __try 14042 + { 14043 + pRtlDeleteResource(lock); 14044 + } 14045 + __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 14046 + EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) 14047 + { 14048 + /* Ignore exception (resource was freed during shutdown of another thread) */ 14049 + } 14050 + FreeLibrary(ntdll); 14051 + return; 14052 +} 14053 + 14054 +void apc_windows_cs_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC) 14055 +{ 14056 + pRtlAcquireResourceExclusive(lock, 1); 14057 +} 14058 + 14059 +void apc_windows_cs_rdlock(apc_windows_cs_rwlock_t *lock TSRMLS_DC) 14060 +{ 14061 + pRtlAcquireResourceShared(lock, 1); 14062 +} 14063 + 14064 +void apc_windows_cs_unlock_rd(apc_windows_cs_rwlock_t *lock TSRMLS_DC) 14065 +{ 14066 + pRtlReleaseResource(lock); 14067 +} 14068 + 14069 +void apc_windows_cs_unlock_wr(apc_windows_cs_rwlock_t *lock TSRMLS_DC) 14070 +{ 14071 + pRtlReleaseResource(lock); 14072 +} 14073 + 14074 +/* debugging purposes, output using trace msgs */ 14075 +void apc_windows_cs_status(apc_windows_cs_rwlock_t *lock) 14076 +{ 14077 + pRtlDumpResource(lock); 14078 + return; 14079 +} 14080 + 14081 +#endif 14082 + 14083 +/* 14084 + * Local variables: 14085 + * tab-width: 4 14086 + * c-basic-offset: 4 14087 + * End: 14088 + * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 14089 + * vim<600: expandtab sw=4 ts=4 sts=4 14090 + */ 14091 diff -Naur a/ext/apc/apc_windows_srwlock_kernel.h b/ext/apc/apc_windows_srwlock_kernel.h 14092 --- a/ext/apc/apc_windows_srwlock_kernel.h 1970-01-01 01:00:00.000000000 +0100 14093 +++ b/ext/apc/apc_windows_srwlock_kernel.h 2012-07-20 00:10:35.000000000 +0200 14094 @@ -0,0 +1,74 @@ 14095 +/* 14096 + +----------------------------------------------------------------------+ 14097 + | APC | 14098 + +----------------------------------------------------------------------+ 14099 + | Copyright (c) 2006-2011 The PHP Group | 14100 + +----------------------------------------------------------------------+ 14101 + | This source file is subject to version 3.01 of the PHP license, | 14102 + | that is bundled with this package in the file LICENSE, and is | 14103 + | available through the world-wide-web at the following url: | 14104 + | http://www.php.net/license/3_01.txt | 14105 + | If you did not receive a copy of the PHP license and are unable to | 14106 + | obtain it through the world-wide-web, please send a note to | 14107 + | license@php.net so we can mail you a copy immediately. | 14108 + +----------------------------------------------------------------------+ 14109 + | Authors: Pierre Joye <pierre@php.net> | 14110 + +----------------------------------------------------------------------+ 14111 + */ 14112 +/* $Id$ */ 14113 + 14114 +#ifndef APC_WINDOWS_CS_RWLOCK_H 14115 +#define APC_WINDOWS_CS_RWLOCK_H 14116 + 14117 +#include "apc.h" 14118 + 14119 +#ifdef APC_SRWLOCK_KERNEL 14120 + 14121 +typedef struct _RTL_RWLOCK { 14122 + RTL_CRITICAL_SECTION rtlCS; 14123 + 14124 + HANDLE hSharedReleaseSemaphore; 14125 + UINT uSharedWaiters; 14126 + 14127 + HANDLE hExclusiveReleaseSemaphore; 14128 + UINT uExclusiveWaiters; 14129 + 14130 + INT iNumberActive; 14131 + HANDLE hOwningThreadId; 14132 + DWORD dwTimeoutBoost; 14133 + PVOID pDebugInfo; 14134 +} RTL_RWLOCK, *LPRTL_RWLOCK; 14135 + 14136 +#define apc_windows_cs_rwlock_t RTL_RWLOCK 14137 + 14138 +struct apc_windows_cs_rwlock_t { 14139 + CRITICAL_SECTION cs; 14140 + LONG writers_waiting_count; 14141 + LONG readers_waiting_count; 14142 + DWORD active_writers_readers_flag; 14143 + HANDLE ready_to_read; 14144 + HANDLE ready_to_write; 14145 + DWORD reader_races_lost; 14146 +}; 14147 + 14148 +apc_windows_cs_rwlock_t *apc_windows_cs_create(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14149 +void apc_windows_cs_destroy(apc_windows_cs_rwlock_t *lock); 14150 +void apc_windows_cs_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14151 +void apc_windows_cs_rdlock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14152 +void apc_windows_cs_unlock_rd(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14153 +void apc_windows_cs_unlock_wr(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14154 +# if NONBLOCKING_LOCK_AVAILABLE==1 /* Only in win7/2008 */ 14155 +zend_bool apc_pthreadrwlock_nonblocking_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 14156 +# endif 14157 +#endif 14158 + 14159 +#endif 14160 + 14161 +/* 14162 + * Local variables: 14163 + * tab-width: 4 14164 + * c-basic-offset: 4 14165 + * End: 14166 + * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 14167 + * vim<600: expandtab sw=4 ts=4 sts=4 14168 + */ 14169 diff -Naur a/ext/apc/apc_zend.c b/ext/apc/apc_zend.c 14170 --- a/ext/apc/apc_zend.c 1970-01-01 01:00:00.000000000 +0100 14171 +++ b/ext/apc/apc_zend.c 2012-07-20 00:10:35.000000000 +0200 14172 @@ -0,0 +1,271 @@ 14173 +/* 14174 + +----------------------------------------------------------------------+ 14175 + | APC | 14176 + +----------------------------------------------------------------------+ 14177 + | Copyright (c) 2006-2011 The PHP Group | 14178 + +----------------------------------------------------------------------+ 14179 + | This source file is subject to version 3.01 of the PHP license, | 14180 + | that is bundled with this package in the file LICENSE, and is | 14181 + | available through the world-wide-web at the following url: | 14182 + | http://www.php.net/license/3_01.txt | 14183 + | If you did not receive a copy of the PHP license and are unable to | 14184 + | obtain it through the world-wide-web, please send a note to | 14185 + | license@php.net so we can mail you a copy immediately. | 14186 + +----------------------------------------------------------------------+ 13274 14187 + | Authors: Daniel Cowgill <dcowgill@communityconnect.com> | 13275 14188 + +----------------------------------------------------------------------+ … … 13285 14198 + */ 13286 14199 + 13287 +/* $Id: apc_zend.c 30 3426 2010-09-16 16:39:08Z iliaa$ */14200 +/* $Id: apc_zend.c 307048 2011-01-03 23:53:17Z kalle $ */ 13288 14201 + 13289 14202 +#include "apc_zend.h" … … 13529 14442 + * vim<600: expandtab sw=4 ts=4 sts=4 13530 14443 + */ 13531 --- /dev/null 13532 +++ b/ext/apc/apc_zend.h 14444 diff -Naur a/ext/apc/apc_zend.h b/ext/apc/apc_zend.h 14445 --- a/ext/apc/apc_zend.h 1970-01-01 01:00:00.000000000 +0100 14446 +++ b/ext/apc/apc_zend.h 2012-07-20 00:10:35.000000000 +0200 13533 14447 @@ -0,0 +1,191 @@ 13534 14448 +/* … … 13536 14450 + | APC | 13537 14451 + +----------------------------------------------------------------------+ 13538 + | Copyright (c) 2006-201 0The PHP Group |14452 + | Copyright (c) 2006-2011 The PHP Group | 13539 14453 + +----------------------------------------------------------------------+ 13540 14454 + | This source file is subject to version 3.01 of the PHP license, | … … 13559 14473 + */ 13560 14474 + 13561 +/* $Id: apc_zend.h 3 03464 2010-09-17 12:19:29Z gopalv$ */14475 +/* $Id: apc_zend.h 326712 2012-07-19 21:33:27Z rasmus $ */ 13562 14476 + 13563 14477 +#ifndef APC_ZEND_H … … 13674 14588 +# define APC_OPCODE_HANDLER_COUNT ((25 * 152) + 1) 13675 14589 +# elif defined(ZEND_ENGINE_2_4) 13676 +# define APC_OPCODE_HANDLER_COUNT ((25 * 15 7) + 1) /* 3 new opcodes in 5.4? -separate, bind_trais, add_trait */14590 +# define APC_OPCODE_HANDLER_COUNT ((25 * 159) + 1) /* 5 new opcodes in 5.4 - qm_assign_var, jmp_set_var, separate, bind_trais, add_trait */ 13677 14591 +# elif PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 13678 14592 +# define APC_OPCODE_HANDLER_COUNT ((25 * 154) + 1) /* 3 new opcodes in 5.3 - unused, lambda, jmp_set */ … … 13723 14637 + * vim<600: expandtab sw=4 ts=4 sts=4 13724 14638 + */ 13725 --- /dev/null 13726 +++ b/ext/apc/CHANGELOG 14639 diff -Naur a/ext/apc/CHANGELOG b/ext/apc/CHANGELOG 14640 --- a/ext/apc/CHANGELOG 1970-01-01 01:00:00.000000000 +0100 14641 +++ b/ext/apc/CHANGELOG 2012-07-20 00:10:35.000000000 +0200 13727 14642 @@ -0,0 +1,249 @@ 13728 14643 + … … 13975 14890 +1.0.1: 13976 14891 +- added optional file modification time check [djc 2001-01-12] 13977 --- /dev/null 13978 +++ b/ext/apc/config.m4 13979 @@ -0,0 +1,246 @@ 14892 diff -Naur a/ext/apc/config.m4 b/ext/apc/config.m4 14893 --- a/ext/apc/config.m4 1970-01-01 01:00:00.000000000 +0100 14894 +++ b/ext/apc/config.m4 2012-07-20 00:10:35.000000000 +0200 14895 @@ -0,0 +1,404 @@ 13980 14896 +dnl 13981 +dnl $Id: config.m4 3 04101 2010-10-05 14:37:36Z kalle$14897 +dnl $Id: config.m4 326700 2012-07-19 11:56:57Z ab $ 13982 14898 +dnl 13983 14899 + … … 13988 14904 +[ --enable-apc-debug Enable APC debugging], 13989 14905 +[ 13990 + PHP_APC_DEBUG= yes14906 + PHP_APC_DEBUG=$enableval 13991 14907 +], 13992 14908 +[ … … 14075 14991 + } 14076 14992 + 14077 + puts("pthread mutex 's are supported!");14993 + puts("pthread mutexs are supported!"); 14078 14994 + return 0; 14079 14995 + } … … 14083 14999 + ], 14084 15000 + [ dnl -Failure- 14085 + AC_MSG_WARN([It doesn't appear that pthread mutex 's are supported on your system])15001 + AC_MSG_WARN([It doesn't appear that pthread mutexes are supported on your system]) 14086 15002 + PHP_APC_PTHREADMUTEX=no 14087 15003 + ], … … 14092 15008 + LIBS="$orig_LIBS" 14093 15009 +fi 15010 + 15011 +AC_MSG_CHECKING(whether we should use pthread read/write locking) 15012 +AC_ARG_ENABLE(apc-pthreadrwlocks, 15013 +[ --enable-apc-pthreadrwlocks 15014 + Enable pthread read/write locking ], 15015 +[ 15016 + PHP_APC_PTHREADRWLOCK=$enableval 15017 + AC_MSG_RESULT($enableval) 15018 +], 15019 +[ 15020 + PHP_APC_PTHREADRWLOCK=no 15021 + AC_MSG_RESULT(no) 15022 +]) 15023 + 15024 +if test "$PHP_APC_PTHREADRWLOCK" != "no"; then 15025 + orig_LIBS="$LIBS" 15026 + LIBS="$LIBS -lpthread" 15027 + AC_TRY_RUN( 15028 + [ 15029 + #include <sys/types.h> 15030 + #include <pthread.h> 15031 + main() { 15032 + pthread_rwlock_t rwlock; 15033 + pthread_rwlockattr_t attr; 15034 + 15035 + if(pthread_rwlockattr_init(&attr)) { 15036 + puts("Unable to initialize pthread attributes (pthread_rwlockattr_init)."); 15037 + return -1; 15038 + } 15039 + if(pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) { 15040 + puts("Unable to set PTHREAD_PROCESS_SHARED (pthread_rwlockattr_setpshared), your system may not support shared rwlock's."); 15041 + return -1; 15042 + } 15043 + if(pthread_rwlock_init(&rwlock, &attr)) { 15044 + puts("Unable to initialize the rwlock (pthread_rwlock_init)."); 15045 + return -1; 15046 + } 15047 + if(pthread_rwlockattr_destroy(&attr)) { 15048 + puts("Unable to destroy rwlock attributes (pthread_rwlockattr_destroy)."); 15049 + return -1; 15050 + } 15051 + if(pthread_rwlock_destroy(&rwlock)) { 15052 + puts("Unable to destroy rwlock (pthread_rwlock_destroy)."); 15053 + return -1; 15054 + } 15055 + 15056 + puts("pthread rwlocks are supported!"); 15057 + return 0; 15058 + } 15059 + ], 15060 + [ dnl -Success- 15061 + PHP_ADD_LIBRARY(pthread) 15062 + APC_CFLAGS="-D_GNU_SOURCE" 15063 + ], 15064 + [ dnl -Failure- 15065 + AC_MSG_WARN([It doesn't appear that pthread rwlocks are supported on your system]) 15066 + PHP_APC_PTHREADRWLOCK=no 15067 + ], 15068 + [ 15069 + PHP_ADD_LIBRARY(pthread) 15070 + ] 15071 + ) 15072 + LIBS="$orig_LIBS" 15073 +fi 15074 + 15075 + AC_CACHE_CHECK([whether the target compiler supports builtin atomics], PHP_cv_APC_GCC_ATOMICS, [ 15076 + 15077 + AC_TRY_LINK([],[ 15078 + int foo = 0; 15079 + __sync_fetch_and_add(&foo, 1); 15080 + __sync_bool_compare_and_swap(&foo, 0, 1); 15081 + return __sync_fetch_and_add(&foo, 1); 15082 + ], 15083 + [PHP_cv_APC_GCC_ATOMICS=yes], 15084 + [PHP_cv_APC_GCC_ATOMICS=no]) 15085 + ]) 15086 + 15087 + if test "x${PHP_cv_APC_GCC_ATOMICS}" != "xno"; then 15088 + AC_DEFINE(HAVE_ATOMIC_OPERATIONS, 1, 15089 + [Define this if your target compiler supports builtin atomics]) 15090 + else 15091 + if test "$PHP_APC_PTHREADRWLOCK" != "no"; then 15092 + AC_MSG_WARN([Disabling pthread rwlocks, because of missing atomic operations]) 15093 + dnl - fall back would most likely be pthread mutexes 15094 + PHP_APC_PTHREADRWLOCK=no 15095 + fi 15096 + fi 14094 15097 + 14095 15098 +AC_MSG_CHECKING(whether we should use spin locks) … … 14106 15109 +]) 14107 15110 + 15111 + 14108 15112 +AC_MSG_CHECKING(whether we should enable memory protection) 14109 15113 +AC_ARG_ENABLE(apc-memprotect, … … 14130 15134 + elif test "$PHP_APC_SPINLOCKS" != "no"; then 14131 15135 + AC_DEFINE(APC_SPIN_LOCKS, 1, [ ]) 15136 + elif test "$PHP_APC_PTHREADRWLOCK" != "no"; then 15137 + AC_DEFINE(APC_PTHREADRW_LOCKS, 1, [ ]) 14132 15138 + elif test "$PHP_APC_PTHREADMUTEX" != "no"; then 14133 15139 + AC_DEFINE(APC_PTHREADMUTEX_LOCKS, 1, [ ]) … … 14205 15211 + apc_shm.c \ 14206 15212 + apc_pthreadmutex.c \ 15213 + apc_pthreadrwlock.c \ 14207 15214 + apc_spin.c \ 14208 15215 + pgsql_s_lock.c \ … … 14221 15228 + PHP_SUBST(APC_SHARED_LIBADD) 14222 15229 + PHP_SUBST(APC_CFLAGS) 15230 + PHP_INSTALL_HEADERS(ext/apc, [apc_serializer.h]) 14223 15231 + AC_DEFINE(HAVE_APC, 1, [ ]) 14224 15232 +fi 14225 15233 + 14226 --- /dev/null 14227 +++ b/ext/apc/config.w32 14228 @@ -0,0 +1,48 @@ 14229 +// $Id: config.w32 305410 2010-11-16 16:47:18Z pajoye $ 15234 +PHP_ARG_ENABLE(coverage, whether to include code coverage symbols, 15235 +[ --enable-coverage DEVELOPERS ONLY!!], no, no) 15236 + 15237 +if test "$PHP_COVERAGE" = "yes"; then 15238 + 15239 + if test "$GCC" != "yes"; then 15240 + AC_MSG_ERROR([GCC is required for --enable-coverage]) 15241 + fi 15242 + 15243 + dnl Check if ccache is being used 15244 + case `$php_shtool path $CC` in 15245 + *ccache*[)] gcc_ccache=yes;; 15246 + *[)] gcc_ccache=no;; 15247 + esac 15248 + 15249 + if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then 15250 + AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) 15251 + fi 15252 + 15253 + lcov_version_list="1.5 1.6 1.7 1.9" 15254 + 15255 + AC_CHECK_PROG(LCOV, lcov, lcov) 15256 + AC_CHECK_PROG(GENHTML, genhtml, genhtml) 15257 + PHP_SUBST(LCOV) 15258 + PHP_SUBST(GENHTML) 15259 + 15260 + if test "$LCOV"; then 15261 + AC_CACHE_CHECK([for lcov version], php_cv_lcov_version, [ 15262 + php_cv_lcov_version=invalid 15263 + lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` #' 15264 + for lcov_check_version in $lcov_version_list; do 15265 + if test "$lcov_version" = "$lcov_check_version"; then 15266 + php_cv_lcov_version="$lcov_check_version (ok)" 15267 + fi 15268 + done 15269 + ]) 15270 + else 15271 + lcov_msg="To enable code coverage reporting you must have one of the following LCOV versions installed: $lcov_version_list" 15272 + AC_MSG_ERROR([$lcov_msg]) 15273 + fi 15274 + 15275 + case $php_cv_lcov_version in 15276 + ""|invalid[)] 15277 + lcov_msg="You must have one of the following versions of LCOV: $lcov_version_list (found: $lcov_version)." 15278 + AC_MSG_ERROR([$lcov_msg]) 15279 + LCOV="exit 0;" 15280 + ;; 15281 + esac 15282 + 15283 + if test -z "$GENHTML"; then 15284 + AC_MSG_ERROR([Could not find genhtml from the LCOV package]) 15285 + fi 15286 + 15287 + PHP_ADD_MAKEFILE_FRAGMENT 15288 + 15289 + dnl Remove all optimization flags from CFLAGS 15290 + changequote({,}) 15291 + CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` 15292 + CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` 15293 + changequote([,]) 15294 + 15295 + dnl Add the special gcc flags 15296 + CFLAGS="$CFLAGS -O0 -ggdb -fprofile-arcs -ftest-coverage" 15297 + CXXFLAGS="$CXXFLAGS -ggdb -O0 -fprofile-arcs -ftest-coverage" 15298 +fi 15299 +dnl vim: set ts=2 15300 diff -Naur a/ext/apc/config.w32 b/ext/apc/config.w32 15301 --- a/ext/apc/config.w32 1970-01-01 01:00:00.000000000 +0100 15302 +++ b/ext/apc/config.w32 2012-07-20 00:10:35.000000000 +0200 15303 @@ -0,0 +1,60 @@ 15304 +// $Id: config.w32 309203 2011-03-14 06:47:16Z pajoye $ 14230 15305 +// vim:ft=javascript 14231 +14232 15306 + 14233 15307 +ARG_ENABLE('apc', 'Whether to enable APC support', 'no'); … … 14236 15310 +ARG_ENABLE('apc-spinlocks', 'Whether to use spin locks (experimental)', 'no'); 14237 15311 +ARG_ENABLE('apc-memprotect', 'Whether to enable memory protection (experimental)', 'no'); 15312 +ARG_ENABLE('apc-srwlock-native', 'Whether to use SRWLOCK locks native (win7/2008 only)', 'no'); 15313 +ARG_ENABLE('apc-srwlock-kernel', 'Whether to use SRWLOCK locks (loaded at runtime)', 'no'); 14238 15314 + 14239 15315 +if(PHP_APC != 'no') … … 14259 15335 + } 14260 15336 + 14261 + if(PHP_APC_SPINLOCKS != 'no') 14262 + { 14263 + AC_DEFINE('APC_SPIN_LOCKS', 1); 14264 + ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1'); 14265 + 14266 + apc_sources += ' apc_spin.c pgsql_s_lock.c'; 15337 + if(PHP_APC_SRWLOCK_NATIVE != 'no') { 15338 + AC_DEFINE('APC_SRWLOCK_NATIVE', 1); 15339 + } else { 15340 + if(PHP_APC_SRWLOCK_KERNEL != 'no') { 15341 + AC_DEFINE('APC_SRWLOCK_KERNEL', 1); 15342 + ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1'); 15343 + 15344 + apc_sources += ' apc_windows_srwlock_kernel.c'; 15345 + } else { 15346 + if(PHP_APC_SPINLOCKS != 'no') { 15347 + AC_DEFINE('APC_SPIN_LOCKS', 1); 15348 + ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1'); 15349 + 15350 + apc_sources += ' apc_spin.c pgsql_s_lock.c'; 15351 + } else { 15352 + AC_DEFINE('APC_FCNTL_LOCKS', 1); 15353 + } 15354 + } 14267 15355 + } 14268 + else14269 + {14270 + AC_DEFINE('APC_FCNTL_LOCKS', 1);14271 + }14272 15356 + 14273 15357 + AC_DEFINE('HAVE_APC', 1); 15358 + AC_DEFINE('HAVE_ATOMIC_OPERATIONS', 1); 15359 + 15360 + PHP_INSTALL_HEADERS("ext/apc", "apc_serializer.h"); 14274 15361 + 14275 15362 + EXTENSION('apc', apc_sources); 14276 15363 +} 14277 \ No newline at end of file 14278 --- /dev/null14279 +++ b/ext/apc/INSTALL 14280 @@ -0,0 +1,40 0@@15364 diff -Naur a/ext/apc/INSTALL b/ext/apc/INSTALL 15365 --- a/ext/apc/INSTALL 1970-01-01 01:00:00.000000000 +0100 15366 +++ b/ext/apc/INSTALL 2012-07-20 00:10:35.000000000 +0200 15367 @@ -0,0 +1,407 @@ 14281 15368 +Installation Instructions for APC 14282 15369 +--------------------------------- … … 14304 15391 + extension=apc.so 14305 15392 + apc.enabled=1 14306 + apc.shm_size=128 15393 + apc.shm_size=128M 14307 15394 + apc.ttl=7200 14308 15395 + apc.user_ttl=7200 … … 14498 15585 + By default, some systems (including most BSD 14499 15586 + variants) have very low limits on the size of a 14500 + shared memory segment. 15587 + shared memory segment. M/G suffixes must be used. 14501 15588 + (Default: 30) 15589 + 14502 15590 + 14503 15591 + apc.optimization This option has been deprecated. … … 14679 15767 + expensive system calls used. 14680 15768 + (Default: 0) 14681 --- /dev/null 14682 +++ b/ext/apc/LICENSE 15769 + 15770 + apc.serializer 15771 + Defines which serializer should be used. Default is the 15772 + standard PHP serializer. Other can be used without having 15773 + to re compile apc, like igbinary for example. 15774 + (apc.serializer=igbinary) 15775 diff -Naur a/ext/apc/LICENSE b/ext/apc/LICENSE 15776 --- a/ext/apc/LICENSE 1970-01-01 01:00:00.000000000 +0100 15777 +++ b/ext/apc/LICENSE 2012-07-20 00:10:35.000000000 +0200 14683 15778 @@ -0,0 +1,68 @@ 14684 15779 +-------------------------------------------------------------------- 14685 15780 + The PHP License, version 3.01 14686 +Copyright (c) 1999 - 201 0The PHP Group. All rights reserved.15781 +Copyright (c) 1999 - 2011 The PHP Group. All rights reserved. 14687 15782 +-------------------------------------------------------------------- 14688 15783 + … … 14750 15845 +PHP includes the Zend Engine, freely available at 14751 15846 +<http://www.zend.com>. 14752 --- /dev/null 14753 +++ b/ext/apc/NOTICE 15847 diff -Naur a/ext/apc/NOTICE b/ext/apc/NOTICE 15848 --- a/ext/apc/NOTICE 1970-01-01 01:00:00.000000000 +0100 15849 +++ b/ext/apc/NOTICE 2012-07-20 00:10:35.000000000 +0200 14754 15850 @@ -0,0 +1,43 @@ 14755 15851 +This is the NOTICE file that holds acknowledgements and stuff. … … 14796 15892 + Christian Rishøj help debugging phplib problems 14797 15893 + Sascha Schumann memory error bug fix 14798 --- /dev/null 14799 +++ b/ext/apc/package.xml 14800 @@ -0,0 +1,827 @@ 14801 +<?xml version="1.0" encoding="UTF-8"?> 14802 +<package packagerversion="1.9.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> 14803 + <name>APC</name> 14804 + <channel>pecl.php.net</channel> 14805 + <summary>Alternative PHP Cache</summary> 14806 + <description>APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.</description> 14807 + <lead> 14808 + <name>Daniel Cowgill</name> 14809 + <user>dcowgill</user> 14810 + <email>dan@mail.communityconnect.com</email> 14811 + <active>no</active> 14812 + </lead> 14813 + <lead> 14814 + <name>George Schlossnagle</name> 14815 + <user>gschlossnagle</user> 14816 + <email>george@omniti.com</email> 14817 + <active>no</active> 14818 + </lead> 14819 + <lead> 14820 + <name>Rasmus Lerdorf</name> 14821 + <user>rasmus</user> 14822 + <email>rasmus@php.net</email> 14823 + <active>yes</active> 14824 + </lead> 14825 + <lead> 14826 + <name>Gopal Vijayaraghavan</name> 14827 + <user>gopalv</user> 14828 + <email>gopalv@php.net</email> 14829 + <active>yes</active> 14830 + </lead> 14831 + <developer> 14832 + <name>Edin Kadribasic</name> 14833 + <user>edink</user> 14834 + <email>edink@emini.dk</email> 14835 + <active>no</active> 14836 + </developer> 14837 + <developer> 14838 + <name>Ilia Alshanetsky</name> 14839 + <user>iliaa</user> 14840 + <email>ilia@prohost.org</email> 14841 + <active>yes</active> 14842 + </developer> 14843 + <developer> 14844 + <name>Marcus Börger</name> 14845 + <user>helly</user> 14846 + <email>helly@php.net</email> 14847 + <active>no</active> 14848 + </developer> 14849 + <developer> 14850 + <name>Sara Golemon</name> 14851 + <user>pollita</user> 14852 + <email>pollita@php.net</email> 14853 + <active>no</active> 14854 + </developer> 14855 + <developer> 14856 + <name>Brian Shire</name> 14857 + <user>shire</user> 14858 + <email>shire@php.net</email> 14859 + <active>yes</active> 14860 + </developer> 14861 + <developer> 14862 + <name>Kalle Sommer Nielsen</name> 14863 + <user>kalle</user> 14864 + <email>kalle@php.net</email> 14865 + <active>yes</active> 14866 + </developer> 14867 + <developer> 14868 + <name>Pierre Joye</name> 14869 + <user>pajoye</user> 14870 + <email>pierre@php.net</email> 14871 + <active>yes</active> 14872 + </developer> 14873 + <date>2010-11-30</date> 14874 + <time>15:48:31</time> 14875 + <version> 14876 + <release>3.1.6</release> 14877 + <api>3.1.0</api> 14878 + </version> 14879 + <stability> 14880 + <release>stable</release> 14881 + <api>stable</api> 14882 + </stability> 14883 + <license uri="http://www.php.net/license">PHP License</license> 14884 + <notes> 14885 +- make slam_defense a little more optimistic, allow a thread/process to write to cache in a loop 14886 +- ensure realpaths hit the realpath_cache, in no-stat mode 14887 +- prevent memory starvation, nuke all caches when expunging just one doesn't work 14888 +- fix uploadprogress keylength issues (NUL is part of keylen, pecl bug #20016) 14889 + </notes> 14890 + <contents> 14891 + <dir name="/"> 14892 + <file md5sum="d8778d844e157a2bb49e11858057050f" name="tests/apc_001.phpt" role="test" /> 14893 + <file md5sum="cc1dba4e429ff93dce1ca7dea01c2899" name="tests/apc_002.phpt" role="test" /> 14894 + <file md5sum="04c800594e9934cf8e15157e9bd4c52f" name="tests/apc_003.phpt" role="test" /> 14895 + <file md5sum="538f198f432614d9f2c0819fea5193a7" name="tests/apc_003b.phpt" role="test" /> 14896 + <file md5sum="43c8e1c89fad5bb25ded528837e63b2b" name="tests/apc_004.phpt" role="test" /> 14897 + <file md5sum="06432141cbc82df8ddde7fac52e9f65e" name="tests/apc_005.phpt" role="test" /> 14898 + <file md5sum="74f802b99f111d1cdab6abaf20edae95" name="tests/apc_006.phpt" role="test" /> 14899 + <file md5sum="b724592cd9629ab5e9dac9f1ef5d3e10" name="tests/apc_007.phpt" role="test" /> 14900 + <file md5sum="0674cbe2e88fe5c331bee3fbb1395d4f" name="tests/apc_008.phpt" role="test" /> 14901 + <file md5sum="4f15ba9d73035c6c0493f05e57ee70f0" name="tests/apc_009.phpt" role="test" /> 14902 + <file md5sum="6640964ee33a683b1693b545d1ff2ed0" name="tests/apc_010.phpt" role="test" /> 14903 + <file md5sum="611e5e725d57fcca216bf79778238290" name="tests/apc53_001.phpt" role="test" /> 14904 + <file md5sum="1cd474d5a3567601d66d1078699fd587" name="tests/apc53_002.phpt" role="test" /> 14905 + <file md5sum="3d863bb88c5f2624320b7b72e368d668" name="tests/apc53_003.phpt" role="test" /> 14906 + <file md5sum="128e9590ff8d3d0791a1ef9ce9c078f5" name="tests/apc53_004.phpt" role="test" /> 14907 + <file md5sum="c710a33310dfacef4d51cb721855857e" name="tests/apc53_005.phpt" role="test" /> 14908 + <file md5sum="5001c1cd063b4c2032189fcb74d04644" name="tests/apc_bin_001.phpt" role="test" /> 14909 + <file md5sum="c992d44557b849a10984b089419d2e01" name="tests/apc_bin_002-1.inc" role="test" /> 14910 + <file md5sum="409cadd9efc9d863421b15d63d8c6515" name="tests/apc_bin_002-2.inc" role="test" /> 14911 + <file md5sum="2667d74094dac9e366020c11b3a9bd47" name="tests/apc_bin_002.phpt" role="test" /> 14912 + <file md5sum="1bb542e50a5e6eb06b54a89ceaa81976" name="tests/iterator_001.phpt" role="test" /> 14913 + <file md5sum="7ee077f992cd81940f74b5f1b0e885c0" name="tests/iterator_002.phpt" role="test" /> 14914 + <file md5sum="eccbaee4d483213ee8ba0583c705224b" name="tests/iterator_003.phpt" role="test" /> 14915 + <file md5sum="4ec172b4fc8ed2f45f3d7426865a0db5" name="tests/iterator_004.phpt" role="test" /> 14916 + <file md5sum="eec4bf6bdfa4936cb122845216cad7e0" name="tests/iterator_005.phpt" role="test" /> 14917 + <file md5sum="3b0a6f2a4e03382a0d56d66b7f7324bc" name="tests/iterator_006.phpt" role="test" /> 14918 + <file md5sum="82a40b37c545631cd87c3e1e421353b5" name="tests/iterator_007.phpt" role="test" /> 14919 + <file md5sum="92e7b033fac8b625c6ad52e21d1222bf" name="tests/php_5_3_ns.inc" role="test" /> 14920 + <file md5sum="6ecba4154b6bd6f8703000f5198710cc" name="tests/skipif.inc" role="test" /> 14921 + <file md5sum="ed9a4192d7ab7f953856b92c5e689cf5" name="CHANGELOG" role="doc" /> 14922 + <file md5sum="530c37a06cb3d2f7dc578399e08dc532" name="INSTALL" role="doc" /> 14923 + <file md5sum="cb564efdf78cce8ea6e4b5a4f7c05d97" name="LICENSE" role="doc" /> 14924 + <file md5sum="eea150699d3dffb2cdf7d243854189d7" name="NOTICE" role="doc" /> 14925 + <file md5sum="4bcb366801c544b5d9df03a445f33b3f" name="TODO" role="doc" /> 14926 + <file md5sum="1a12ed6c0aa4124837cc96cefa507fe1" name="TECHNOTES.txt" role="doc" /> 14927 + <file md5sum="f1df0d7f7d913424082440bd1c456f57" name="apc.c" role="src" /> 14928 + <file md5sum="db933bf95d955bdac3756ff64aa68e00" name="apc.h" role="src" /> 14929 + <file md5sum="94a046b4eb5890778dc0f78173d0d4cc" name="apc_bin.c" role="src" /> 14930 + <file md5sum="7f88578dc04a829b8b66a4992241b93c" name="apc_bin.h" role="src" /> 14931 + <file md5sum="0960b84970794199b1d303097bbb6ace" name="apc_cache.c" role="src" /> 14932 + <file md5sum="f4e3dc54d403741e3d62caa5a5ba0f22" name="apc_cache.h" role="src" /> 14933 + <file md5sum="0a7155470ba3df4718883710122abb2b" name="apc_compile.c" role="src" /> 14934 + <file md5sum="c8f3eb20167f2c4274e0d851c16bd9e0" name="apc_compile.h" role="src" /> 14935 + <file md5sum="5b5a25592270765352ef45ffd5b514d9" name="apc_debug.c" role="src" /> 14936 + <file md5sum="3d8d0bd66ed185f6fbb9b4612b20bd2a" name="apc_debug.h" role="src" /> 14937 + <file md5sum="e874b4944016989e23801dae5ad7c5ad" name="apc_fcntl.c" role="src" /> 14938 + <file md5sum="e6d336752e1a0c7768e8d013de60c861" name="apc_fcntl.h" role="src" /> 14939 + <file md5sum="972d4372d466abca82b531f448501331" name="apc_globals.h" role="src" /> 14940 + <file md5sum="fe05863f7a9e156a3494ff2e3012e2fb" name="apc_lock.h" role="src" /> 14941 + <file md5sum="bda9b7cd75b85fda2dad3c9cb20ed293" name="apc_main.c" role="src" /> 14942 + <file md5sum="248fc93a72f5b6beba82c3d29eba3f24" name="apc_main.h" role="src" /> 14943 + <file md5sum="f49d49907ef24e6698b1c85aeb89bcd4" name="apc_mmap.c" role="src" /> 14944 + <file md5sum="d86e21617ad249ab5b2be1a7d7fcfd21" name="apc_mmap.h" role="src" /> 14945 + <file md5sum="9a82909be30c52b1ca267886d832b129" name="apc_php.h" role="src" /> 14946 + <file md5sum="7d193d20531dbc39acf2e828a757f01b" name="apc_php_pcre.h" role="php" /> 14947 + <file md5sum="e1e4fc3330b2e6497259caf08b27100c" name="apc_pthreadmutex.c" role="src" /> 14948 + <file md5sum="52fa7e9b676a9e6264dbb4425320aa7f" name="apc_pthreadmutex.h" role="src" /> 14949 + <file md5sum="88028345c8f453573975ec59241442ef" name="apc_sem.c" role="src" /> 14950 + <file md5sum="15c5e77be5e97cf089a8b4b0719e2ec6" name="apc_sem.h" role="src" /> 14951 + <file md5sum="05f78a27fbf80993c1f35933e16bbe6d" name="apc_shm.c" role="src" /> 14952 + <file md5sum="0bb9ac1689d846570a819b708af1105a" name="apc_shm.h" role="src" /> 14953 + <file md5sum="b16c47e998f8092c5e6c61368e1d4a24" name="apc_sma.c" role="src" /> 14954 + <file md5sum="3e5265ba778a5b9de42148b27c199c7d" name="apc_sma.h" role="src" /> 14955 + <file md5sum="a107ff01a0df3349a96d38ae5fc84f5f" name="apc_spin.c" role="src" /> 14956 + <file md5sum="8a44c26956bf889155cb24088712dc50" name="apc_spin.h" role="src" /> 14957 + <file md5sum="0939854bf2b61f1d88201da833243e37" name="apc_stack.c" role="src" /> 14958 + <file md5sum="1c36a4153b213cb6f9b3ccad26606791" name="apc_stack.h" role="src" /> 14959 + <file md5sum="aba4b2d34f04ba69d10bd9bcff696e84" name="apc_string.h" role="src" /> 14960 + <file md5sum="0c8e5033f2bf7189badf50954a2c99a0" name="apc_string.c" role="src" /> 14961 + <file md5sum="458f49fb5f03544e94ac5f530d0a9c68" name="apc_zend.c" role="src" /> 14962 + <file md5sum="15b6b1e684e6b22390f0a3783d2bc134" name="apc_zend.h" role="src" /> 14963 + <file md5sum="b94678c89b8f0b6f5bd1a8aba00e77a7" name="apc_signal.c" role="src" /> 14964 + <file md5sum="596f0878de5ae6cf8ccd9d8242a203c4" name="apc_signal.h" role="src" /> 14965 + <file md5sum="ac0ac4ad53248999d41ae83c9a460086" name="apc_iterator.c" role="src" /> 14966 + <file md5sum="8bad478e9e94682a185cf22167be5e84" name="apc_iterator.h" role="src" /> 14967 + <file md5sum="a4ad70727d8a4302a80aca9be6b267c2" name="apc_pool.c" role="src" /> 14968 + <file md5sum="95d87754c41bb7cd919bd02c08fcbead" name="apc_pool.h" role="src" /> 14969 + <file md5sum="0635ec3025ca2eac5b146ecd74240697" name="config.m4" role="src" /> 14970 + <file md5sum="45ef21f58c191413ff5c06e708dec2f8" name="config.w32" role="src" /> 14971 + <file md5sum="aee455af2782bed51730fa8e85deff5f" name="php_apc.c" role="src" /> 14972 + <file md5sum="6b52620bc10e2d49ca33dbaa9c037002" name="php_apc.h" role="src" /> 14973 + <file md5sum="3bdccc0fa74ea0b6c2539fcb0b5a6253" name="pgsql_s_lock.c" role="src" /> 14974 + <file md5sum="c63703a3966a0486150ea5b780d6ebec" name="pgsql_s_lock.h" role="src" /> 14975 + <file md5sum="3b737f451ebf7175e00ebe0246c97e16" name="apc_fcntl_win32.c" role="src" /> 14976 + <file md5sum="48817fe8f775ad3861dc7c5307c88c59" name="apc_rfc1867.c" role="src" /> 14977 + <file md5sum="f1d6a8535a55ed9129088066e18867b4" name="apc.php" role="php" /> 14978 + </dir> 14979 + </contents> 14980 + <dependencies> 14981 + <required> 14982 + <php> 14983 + <min>5.1.0</min> 14984 + </php> 14985 + <pearinstaller> 14986 + <min>1.4.0</min> 14987 + </pearinstaller> 14988 + </required> 14989 + </dependencies> 14990 + <providesextension>apc</providesextension> 14991 + <extsrcrelease> 14992 + <configureoption default="no" name="enable-apc-filehits" prompt="Enable per request file info about files used from the APC cache" /> 14993 + <configureoption default="no" name="enable-apc-spinlocks" prompt="Enable spin locks (EXPERIMENTAL)" /> 14994 + </extsrcrelease> 14995 + <changelog> 14996 + <release> 14997 + <stability> 14998 + <release>stable</release> 14999 + <api>stable</api> 15000 + </stability> 15001 + <version> 15002 + <release>2.0.0</release> 15003 + <api>2.0.0</api> 15004 + </version> 15005 + <date>2003-07-01</date> 15006 + <notes> 15007 +Complete rework. 15008 + </notes> 15009 + </release> 15010 + <release> 15011 + <stability> 15012 + <release>stable</release> 15013 + <api>stable</api> 15014 + </stability> 15015 + <version> 15016 + <release>2.0.1</release> 15017 + <api>2.0.0</api> 15018 + </version> 15019 + <date>2003-07-01</date> 15020 + <notes> 15021 +Win32 support added. 15022 + </notes> 15023 + </release> 15024 + <release> 15025 + <stability> 15026 + <release>stable</release> 15027 + <api>stable</api> 15028 + </stability> 15029 + <version> 15030 + <release>2.0.2</release> 15031 + <api>2.0.0</api> 15032 + </version> 15033 + <date>2004-03-12</date> 15034 + <notes> 15035 +Fixed non-existant class bug. 15036 + </notes> 15037 + </release> 15038 + <release> 15039 + <stability> 15040 + <release>stable</release> 15041 + <api>stable</api> 15042 + </stability> 15043 + <version> 15044 + <release>3.0.0</release> 15045 + <api>3.0.0</api> 15046 + </version> 15047 + <date>2005-07-05</date> 15048 + <notes> 15049 +PHP-5.1 Support and numerous fixes 15050 + </notes> 15051 + </release> 15052 + <release> 15053 + <stability> 15054 + <release>stable</release> 15055 + <api>stable</api> 15056 + </stability> 15057 + <version> 15058 + <release>3.0.1</release> 15059 + <api>3.0.0</api> 15060 + </version> 15061 + <date>2005-07-05</date> 15062 + <notes> 15063 +PHP4 build fix 15064 + </notes> 15065 + </release> 15066 + <release> 15067 + <stability> 15068 + <release>stable</release> 15069 + <api>stable</api> 15070 + </stability> 15071 + <version> 15072 + <release>3.0.2</release> 15073 + <api>3.0.0</api> 15074 + </version> 15075 + <date>2005-07-05</date> 15076 + <notes> 15077 +Default to mmap and add a better error message for shmget failures 15078 + </notes> 15079 + </release> 15080 + <release> 15081 + <stability> 15082 + <release>stable</release> 15083 + <api>stable</api> 15084 + </stability> 15085 + <version> 15086 + <release>3.0.3</release> 15087 + <api>3.0.0</api> 15088 + </version> 15089 + <date>2005-07-07</date> 15090 + <notes> 15091 +Fix compile problem against PHP 5.0.x 15092 + </notes> 15093 + </release> 15094 + <release> 15095 + <stability> 15096 + <release>stable</release> 15097 + <api>stable</api> 15098 + </stability> 15099 + <version> 15100 + <release>3.0.4</release> 15101 + <api>3.0.0</api> 15102 + </version> 15103 + <date>2005-07-18</date> 15104 + <notes> 15105 +Add win32 support from Edin. 15106 +Add --with-apxs switch to work around problem when loading APC into Apache binary compiled with LFS switches 15107 +A couple of other minor fixes. 15108 + </notes> 15109 + </release> 15110 + <release> 15111 + <stability> 15112 + <release>stable</release> 15113 + <api>stable</api> 15114 + </stability> 15115 + <version> 15116 + <release>3.0.5</release> 15117 + <api>3.0.0</api> 15118 + </version> 15119 + <date>2005-07-27</date> 15120 + <notes> 15121 +Make it easier for sapis that only populate file_handle->filename to use APC. (Rasmus) 15122 +Support extensions such as bcompiler that need to hook into compile_file. (Val) 15123 +Ralf Becker's apcgui code has now become the default apc.php status page. (Ralf, Rasmus, Ilia) 15124 +Segfault in cache cleanup code (Ilia, Rasmus) 15125 + </notes> 15126 + </release> 15127 + <release> 15128 + <stability> 15129 + <release>stable</release> 15130 + <api>stable</api> 15131 + </stability> 15132 + <version> 15133 + <release>3.0.6</release> 15134 + <api>3.0.0</api> 15135 + </version> 15136 + <date>2005-07-30</date> 15137 + <notes> 15138 +Added apc.php to package.xml file. 15139 +Track per-entry memory usage. (Val) 15140 +Various apc.php fixes and enhancements. (Ralf, Ilia, Rasmus) 15141 +fcntl locking robustness fixes. (Rasmus) 15142 +Shared read-locks where possible. (Rasmus) 15143 +Added file_update_protection configuration parameter. (Rasmus) 15144 +Windows ZTS fixes (Frank) 15145 + </notes> 15146 + </release> 15147 + <release> 15148 + <stability> 15149 + <release>stable</release> 15150 + <api>stable</api> 15151 + </stability> 15152 + <version> 15153 + <release>3.0.7</release> 15154 + <api>3.0.0</api> 15155 + </version> 15156 + <date>2005-08-16</date> 15157 + <notes> 15158 +Fix to apc.php to show final segment in frag chart. (Ilia) 15159 +A couple of win32 fixes. (Frank) 15160 +Add apc.enable_cli ini directive. (Rasmus) 15161 +Add test cases. (Marcus) 15162 +Fix apc_define_constants() bug - http://pecl.php.net/bugs/5084 (Rasmus) 15163 +Simplify user cache handling by removing the user_cache_stack (Rasmus) 15164 +Fix apc_fetch() memory corruption (Andrei,Rasmus) 15165 +Added apc.max_file_size INI setting that allows exclusion of large files from being cached. Default file size limit, 1 megabyte. (Ilia) 15166 + </notes> 15167 + </release> 15168 + <release> 15169 + <stability> 15170 + <release>stable</release> 15171 + <api>stable</api> 15172 + </stability> 15173 + <version> 15174 + <release>3.0.8</release> 15175 + <api>3.0.0</api> 15176 + </version> 15177 + <date>2005-08-24</date> 15178 + <notes> 15179 +Fix invalid free in globals destructor introduced in 3.0.7 (Rasmus) 15180 +Cache corruption fix in cache-full cleanup code (Gopal) 15181 + </notes> 15182 + </release> 15183 + <release> 15184 + <stability> 15185 + <release>stable</release> 15186 + <api>stable</api> 15187 + </stability> 15188 + <version> 15189 + <release>3.0.9</release> 15190 + <api>3.0.0</api> 15191 + </version> 15192 + <date>2006-03-04</date> 15193 + <notes> 15194 +Eliminate rand() call when slam_defense is not set (Rasmus) 15195 +Fix for __isset problem (Gopal) 15196 +Rewrite allocator from a "best fit" to a "next fit" algorithm (Rasmus) 15197 +Added a Cache Full counter so we have an idea how many times the segment has filled up causing an expunge (Rasmus) 15198 +Report back the correct number of available bytes in the segment instead of the allocated bytes. (Rasmus) 15199 +Add cache busy flag which is set when an expunge is underway (Rasmus) 15200 +Add automatic serialization of objects in apc_store() (Marcus) 15201 +64-bit .ini flag fix (Rasmus) 15202 +Static members fix (Gopal) 15203 +sma_cleanup() mem leak fix (Rasmus) 15204 +Fix for http://pecl.php.net/bugs/5311 (Rasmus) 15205 +Fix autoglobals JIT bug (Gopal) 15206 +Fix instance bug (Gopal) 15207 +Add a lock cleanup safety net to request shutdown (Rasmus) 15208 +Fix apc.slam_defense edge-case bug (Rasmus) 15209 +User entry memory usage tracking support (Ilia) 15210 +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) 15211 + </notes> 15212 + </release> 15213 + <release> 15214 + <stability> 15215 + <release>stable</release> 15216 + <api>stable</api> 15217 + </stability> 15218 + <version> 15219 + <release>3.0.10</release> 15220 + <api>3.0.0</api> 15221 + </version> 15222 + <date>2006-03-11</date> 15223 + <notes> 15224 +* Add apc.stat ini flag which defaults to 1. If set to 0, the main script and any fullpath 15225 + includes will not be stat'ed for any changes. You will have to restart the server if you 15226 + change anything. This mode increases performance quite a bit, especially if you have a 15227 + lot of includes. 15228 + 15229 +* Get rid of the lock safety net hack I added in 3.0.9. It seems to cause more problems 15230 + than it solves. I'll need to revisit locking and signal handling at some point soon. 15231 + </notes> 15232 + </release> 15233 + <release> 15234 + <stability> 15235 + <release>stable</release> 15236 + <api>stable</api> 15237 + </stability> 15238 + <version> 15239 + <release>3.0.11</release> 15240 + <api>3.0.0</api> 15241 + </version> 15242 + <date>2006-08-16</date> 15243 + <notes> 15244 +* Made --enable-apc-mmap the default compile option (for real this time) 15245 + 15246 +* Add an optional flag to apc_cache_info() and some apc.php tweaks to make it 15247 + only fetch header information to make it useful when you have tens of 15248 + thousands of entries. (Brian Shire) 15249 + 15250 +* 64-bit fixes (George) 15251 + 15252 +* Don't mix Full Path and Inode keys (George) 15253 + 15254 +* Override ZEND_INCLUDE_OR_EVAL opcode (when possible) to speed up use of 15255 + require_once() and include_once() statements. (Sara) 15256 + 15257 +* Add a non-blocking write_lock for cache inserts. This is a better approach 15258 + to prevent cache slams and deprecates the slam_defense setting. (Rasmus) 15259 + 15260 +* A bit of work on the optimizer. (Sara) 15261 + 15262 +* Various memory issues resolved. (Gopal) 15263 + </notes> 15264 + </release> 15265 + <release> 15266 + <stability> 15267 + <release>stable</release> 15268 + <api>stable</api> 15269 + </stability> 15270 + <version> 15271 + <release>3.0.12</release> 15272 + <api>3.0.0</api> 15273 + </version> 15274 + <date>2006-09-04</date> 15275 + <notes> 15276 +* Fix stray debug message 15277 + 15278 +* Work on the optimizer - still not stable (Gopal, Ilia, Sara) 15279 + 15280 +* Performance boost - Replace multiple loops over the opcode 15281 + array with a single loop for copying, jump fixups and auto 15282 + global pre-fetches. (Gopal) 15283 + 15284 +* Perform fetch_global checks only in php5 and only if 15285 + auto_globals_jit is enabled. (Gopal) 15286 + 15287 +* Fix bug #8579 - scrub php4 classes' function_table and default 15288 + properties before inserting into cache. (Gopal) 15289 + 15290 +* Fix bug #8606 - ZEND_FETCH_GLOBAL is not an opcode, but is a 15291 + op1->type. The opcodes applicable are ZEND_FETCH_R and 15292 + ZEND_FETCH_W. (Gopal) 15293 + 15294 +* PHP 5.2 Compatibility (Gopal) 15295 + 15296 +* Make the include_once override optional - default off (Sara) 15297 + 15298 +* Fixed crash when apc run in CLI, but enable_cli is off. (Ilia) 15299 + 15300 +* Ensure that the apc_globals->cache_stack is cleared before the 15301 + shm cache is destroyed. Fixes segfault for corner-case i.e request 15302 + shutdown (apc_deactivate) is not called before module shutdown 15303 + calls (php_apc_shutdown_globals) (Gopal) 15304 + 15305 +* TSRM fixes (ensure ts_free_id before apc.so is dlclosed) (Gopal) 15306 + 15307 +* Fix memory leak of apc_cache_info_t->deleted_list (Gopal) 15308 + </notes> 15309 + </release> 15310 + <release> 15311 + <stability> 15312 + <release>stable</release> 15313 + <api>stable</api> 15314 + </stability> 15315 + <version> 15316 + <release>3.0.12p1</release> 15317 + <api>3.0.0</api> 15318 + </version> 15319 + <date>2006-09-05</date> 15320 + <notes> 15321 +* The only change here is a trivial PHP 4 build fix. 15322 + </notes> 15323 + </release> 15324 + <release> 15325 + <stability> 15326 + <release>stable</release> 15327 + <api>stable</api> 15328 + </stability> 15329 + <version> 15330 + <release>3.0.12p2</release> 15331 + <api>3.0.0</api> 15332 + </version> 15333 + <date>2006-09-05</date> 15334 + <notes> 15335 +* Let's get the version number right. 3.0.12p2 now. 15336 + </notes> 15337 + </release> 15338 + <release> 15339 + <stability> 15340 + <release>stable</release> 15341 + <api>stable</api> 15342 + </stability> 15343 + <version> 15344 + <release>3.0.13</release> 15345 + <api>3.0.0</api> 15346 + </version> 15347 + <date>2007-02-24</date> 15348 + <notes> 15349 +* PHP 5.2 file upload progress tracking support (Rasmus) 15350 +* Pthread mutex and spin locks (Shire) 15351 +* Recursive zval support for apc_fetch/_store (Shire, Gopal) 15352 +* apc.stat_ctime flag for ctime checks (Rasmus) 15353 +* Multiple key fetches with apc_fetch (Shire) 15354 +* Canary checks for shm memory deallocation (Gopal) 15355 +* Add hooks for external optimizer (Shire) 15356 +* Obsolete and remove apc optimizer (Gopal) 15357 +* APC info changes - cache insert rate, hit and miss rates (Shire) 15358 +* Fix apc_load_constants (Gopal) 15359 +* Rewrite dump opcode code to use vld (Gopal) 15360 +* Use apc_[ewn]print functions for error reporting (Shire) 15361 +* Auto global fixes and refactoring (Gopal, Shire) 15362 +* Fix memory leaks in object serialization (Ilia) 15363 +* Memory cleanup code for destructor order (Gopal) 15364 +* Win32 build fixes (Ilia, Wez) 15365 +* ZTS and Php 4 build fixes (Bjori) 15366 +* Add apc_add() function (Rasmus) 15367 +* Add optional limited flag to apc_sma_info() (Rasmus) 15368 + </notes> 15369 + </release> 15370 + <release> 15371 + <stability> 15372 + <release>stable</release> 15373 + <api>stable</api> 15374 + </stability> 15375 + <version> 15376 + <release>3.0.14</release> 15377 + <api>3.0.0</api> 15378 + </version> 15379 + <date>2007-04-02</date> 15380 + <notes> 15381 +* Build fix (Shire) 15382 +* Don't hook the upload hook if APC is disabled (Rasmus) 15383 +* Local shadow cache support (Gopal) 15384 +* Avoid uneccessary loops over op_arrays for "known" auto-globals (Gopal) 15385 +* Fix apc_add() to overwrite timed out user entries (Rasmus) 15386 +* Fix double inclusion of files with conditional classes in php4 (Gopal) 15387 +* Allocator fixes to reduce fragmentation (Gopal) 15388 + </notes> 15389 + </release> 15390 + <release> 15391 + <stability> 15392 + <release>stable</release> 15393 + <api>stable</api> 15394 + </stability> 15395 + <version> 15396 + <release>3.0.15</release> 15397 + <api>3.0.0</api> 15398 + </version> 15399 + <date>2007-10-18</date> 15400 + <notes> 15401 +* Eliminate a per-request time() syscall (Rasmus) 15402 +* Added rfc1867 prefix, name, and freq ini options (Shire) 15403 +* Allow deletion of individual user cache entries via apc.php (Sara) 15404 +* Fix overzealous cleanup during RSHUTDOWN (Gopal) 15405 +* Fix memory alignment and locking issues (Gopal) 15406 +* Make apc_compile insert/replace entries (Shire) 15407 +* Make mixed inheritance recompile & cache afresh (Gopal) 15408 +* Make nostat mode search include_path for canonicalization (Gopal) 15409 +* ZTS & other compile fixes (Gopal, Edin, Shire) 15410 + </notes> 15411 + </release> 15412 + <release> 15413 + <version> 15414 + <release>3.0.16</release> 15415 + <api>3.0.0</api> 15416 + </version> 15417 + <stability> 15418 + <release>stable</release> 15419 + <api>stable</api> 15420 + </stability> 15421 + <license uri="http://www.php.net/license">PHP License</license> 15422 + <date>2008-03-26</date> 15423 + <notes> 15424 +* Fix for longstanding cache-full crash (Christian Seiler) 15425 + http://news.php.net/php.pecl.dev/4951 for the details 15426 +* Added optional shm unmap on a fatal signal feature (Lucas Nealan) 15427 +* Added PTHREAD_MUTEX_ADAPTIVE_NP option pthread locks (Paul Saab) 15428 +* Minor cleanups (Lucas Nealan) 15429 +* Added configure option to enable apc_cache_info('filehits') (Shire) 15430 + </notes> 15431 + </release> 15432 + <release> 15433 + <version> 15434 + <release>3.0.17</release> 15435 + <api>3.0.0</api> 15436 + </version> 15437 + <stability> 15438 + <release>stable</release> 15439 + <api>stable</api> 15440 + </stability> 15441 + <license uri="http://www.php.net/license">PHP License</license> 15442 + <date>2008-03-29</date> 15443 + <notes> 15444 +* Crash fixes 15445 +* Fix apc_add() cache expunge bug (Rasmus) 15446 +* Added parameter to apc_fetch to determine success/failure when fetching booleans (shire) 15447 +* Fix misc. memleaks (shire) 15448 + </notes> 15449 + </release> 15450 + <release> 15451 + <version> 15452 + <release>3.0.18</release> 15453 + <api>3.0.0</api> 15454 + </version> 15455 + <stability> 15456 + <release>stable</release> 15457 + <api>stable</api> 15458 + </stability> 15459 + <license uri="http://www.php.net/license">PHP License</license> 15460 + <date>2008-03-29</date> 15461 + <notes> 15462 +- Revert apc_expunge_cb bug-fix 15463 +- Misc memleaks 15464 + </notes> 15465 + </release> 15466 + <release> 15467 + <version> 15468 + <release>3.0.19</release> 15469 + <api>3.0.0</api> 15470 + </version> 15471 + <stability> 15472 + <release>stable</release> 15473 + <api>stable</api> 15474 + </stability> 15475 + <license uri="http://www.php.net/license">PHP License</license> 15476 + <date>2008-05-15</date> 15477 + <notes> 15478 +- Safe-mode and fast-cgi fixes 15479 +- Fix double-free of builtin_functions 15480 +- php 5.3 fixes 15481 + </notes> 15482 + </release> 15483 + <release> 15484 + <version> 15485 + <release>3.1.1</release> 15486 + <api>3.1.0</api> 15487 + </version> 15488 + <stability> 15489 + <release>beta</release> 15490 + <api>beta</api> 15491 + </stability> 15492 + <license uri="http://www.php.net/license">PHP License</license> 15493 + <date>2008-12-12</date> 15494 + <notes> 15495 +- PHP4 compatibilty break 15496 +- apc_pool allocator (Gopal) 15497 +- doubly-linked sma allocator (Shire) 15498 +- php 5.3 gc compatibility (Gopal) 15499 +- APCIterator for easy access (Shire) 15500 +- apc_delete_file (Shire) 15501 +- apc_inc/apc_dec/apc_cas functions (Shire) 15502 +- apc.canonicalize (Gopal) 15503 +- apc.preload_path (Gopal) 15504 +- apc.rfc1867_ttl (Shire) 15505 +- apc.file_md5 (Shire) 15506 +- consolidate locking macros (Shire) 15507 +- remove futex/TSRM locks (Shire) 15508 +- non-blocking semaphore locks (Shire) 15509 +- zval* object rework (Gopal) 15510 + </notes> 15511 + </release> 15512 + <release> 15513 + <version> 15514 + <release>3.1.2</release> 15515 + <api>3.1.0</api> 15516 + </version> 15517 + <stability> 15518 + <release>beta</release> 15519 + <api>beta</api> 15520 + </stability> 15521 + <license uri="http://www.php.net/license">PHP License</license> 15522 + <date>2008-12-12</date> 15523 + <notes> 15524 +- pecl package.xml/build fixes (bjori) 15525 + </notes> 15526 + </release> 15527 + <release> 15528 + <version> 15529 + <release>3.1.3</release> 15530 + <api>3.1.0</api> 15531 + </version> 15532 + <stability> 15533 + <release>beta</release> 15534 + <api>beta</api> 15535 + </stability> 15536 + <license uri="http://www.php.net/license">PHP License</license> 15537 + <date>2009-08-13</date> 15538 + <notes> 15539 +- pecl package.xml/build fixes (bjori) 15540 +- 5.3 support + test-cases (Gopal) 15541 +- Lazy loading support (Shire) 15542 +- Fix PCRE module init order issues (Shire) 15543 +- APCIterator fixes (Shire) 15544 +- Cache slam checks (Gopal) 15545 +- ZEND_JMP_SET support (Shire) 15546 +- apc.use_request_time option (shire) 15547 +- apc.php hostname fixes (Shire) 15548 +- memprotect framework (Gopal) 15549 +- Win32 build-fixes (Kalle) 15550 + </notes> 15551 + </release> 15552 + <release> 15553 + <version> 15554 + <release>3.1.3p1</release> 15555 + <api>3.1.0</api> 15556 + </version> 15557 + <stability> 15558 + <release>beta</release> 15559 + <api>beta</api> 15560 + </stability> 15561 + <license uri="http://www.php.net/license">PHP License</license> 15562 + <date>2009-08-14</date> 15563 + <notes> 15564 +- fix pecl build / package.xml (Gopal) 15565 + </notes> 15566 + </release> 15567 + <release> 15568 + <version> 15569 + <release>3.1.4</release> 15570 + <api>3.1.0</api> 15571 + </version> 15572 + <stability> 15573 + <release>beta</release> 15574 + <api>beta</api&