Changeset 602 for branches/1.3
- Timestamp:
- 2009-07-05T07:49:25+02:00 (4 years ago)
- Location:
- branches/1.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
- Property svn:mergeinfo changed
/trunk merged: 363,366,376,381-387
- Property svn:mergeinfo changed
-
branches/1.3/ChangeLog
r494 r602 1 1.3.0 2009-??-?? 2 == ChangeLog == 3 * could not show module info in admin page when XCache is the last module 4 * wrong http auth realm 5 1 6 1.2.2 2007-12-29 2 7 == ChangeLog == -
branches/1.3/NEWS
r494 r602 1 1.3.0 2009-??-?? 2 ======== 3 1 4 1.2.2 2007-12-29 2 5 ======== -
branches/1.3/admin/xcache.php
r422 r602 207 207 phpinfo(INFO_MODULES); 208 208 $moduleinfo = ob_get_clean(); 209 if (preg_match('!XCache</a></h2>(.*?)<h2> <a name="module_!is', $moduleinfo, $m)) {209 if (preg_match('!XCache</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) { 210 210 $moduleinfo = $m[1]; 211 211 } -
branches/1.3/xc_malloc.c
r593 r602 20 20 }; 21 21 22 /* {{{ _xc_malloc_shm_t */ 23 struct _xc_malloc_shm_t { 24 xc_shm_handlers_t *handlers; 25 xc_shmsize_t size; 26 xc_shmsize_t memoffset; 27 #ifdef HAVE_XCACHE_TEST 28 HashTable blocks; 29 #endif 30 }; 31 /* }}} */ 32 22 33 #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) 23 34 35 static void *xc_add_to_blocks(xc_mem_t *mem, void *p, size_t size) /* {{{ */ 36 { 37 #ifdef HAVE_XCACHE_TEST 38 if (p) { 39 zend_hash_add(&mem->shm->blocks, (void *) &p, sizeof(p), (void *) &size, sizeof(size), NULL); 40 } 41 #endif 42 return p; 43 } 44 /* }}} */ 45 static void xc_del_from_blocks(xc_mem_t *mem, void *p) /* {{{ */ 46 { 47 #ifdef HAVE_XCACHE_TEST 48 zend_hash_del(&mem->shm->blocks, (void *) &p, sizeof(p)); 49 #endif 50 } 51 /* }}} */ 52 24 53 static XC_MEM_MALLOC(xc_malloc_malloc) /* {{{ */ 25 54 { 26 return malloc(size);55 return xc_add_to_blocks(mem, malloc(size), size); 27 56 } 28 57 /* }}} */ 29 58 static XC_MEM_FREE(xc_malloc_free) /* {{{ return block size freed */ 30 59 { 60 xc_del_from_blocks(mem, (void *) p); 31 61 free((void *) p); 32 62 return 0; … … 35 65 static XC_MEM_CALLOC(xc_malloc_calloc) /* {{{ */ 36 66 { 37 return calloc(memb, size);67 return xc_add_to_blocks(mem, calloc(memb, size), size); 38 68 } 39 69 /* }}} */ 40 70 static XC_MEM_REALLOC(xc_malloc_realloc) /* {{{ */ 41 71 { 42 return realloc((void *) p, size);72 return xc_add_to_blocks(mem, realloc((void *) p, size), size); 43 73 } 44 74 /* }}} */ 45 75 static XC_MEM_STRNDUP(xc_malloc_strndup) /* {{{ */ 46 76 { 47 char *p = malloc(len);77 char *p = xc_add_to_blocks(mem, malloc(len), len); 48 78 if (!p) { 49 79 return NULL; … … 111 141 /* }}} */ 112 142 113 /* {{{ _xc_malloc_shm_t */114 struct _xc_malloc_shm_t {115 xc_shm_handlers_t *handlers;116 xc_shmsize_t size;117 xc_shmsize_t memoffset;118 };119 /* }}} */120 121 143 static XC_SHM_CAN_READONLY(xc_malloc_can_readonly) /* {{{ */ 122 144 { … … 126 148 static XC_SHM_IS_READWRITE(xc_malloc_is_readwrite) /* {{{ */ 127 149 { 150 HashPosition pos; 151 size_t *psize; 152 char **ptr; 153 154 zend_hash_internal_pointer_reset_ex(&shm->blocks, &pos); 155 while (zend_hash_get_current_data_ex(&shm->blocks, (void **) &psize, &pos) == SUCCESS) { 156 zend_hash_get_current_key_ex(&shm->blocks, (void *) &ptr, NULL, NULL, 0, &pos); 157 if ((char *) p >= *ptr && (char *) p < *ptr + *psize) { 158 return 1; 159 } 160 zend_hash_move_forward_ex(&shm->blocks, &pos); 161 } 162 128 163 return 0; 129 164 } … … 147 182 static XC_SHM_DESTROY(xc_malloc_destroy) /* {{{ */ 148 183 { 184 #ifdef HAVE_XCACHE_TEST 185 zend_hash_destroy(&shm->blocks); 186 #endif 149 187 free(shm); 150 188 return; … … 157 195 shm->size = size; 158 196 197 #ifdef HAVE_XCACHE_TEST 198 zend_hash_init(&shm->blocks, 64, NULL, NULL, 1); 199 #endif 159 200 return shm; 160 201 err: -
branches/1.3/xcache.c
r601 r602 392 392 xc_mem_t *mem = cache->mem; 393 393 const xc_mem_handlers_t *handlers = mem->handlers; 394 zend_ulong interval = (cachetype == XC_TYPE_PHP) ? xc_php_gc_interval : xc_var_gc_interval; 394 zend_ulong interval; 395 if (cachetype == XC_TYPE_PHP) { 396 interval = xc_php_ttl ? xc_php_gc_interval : 0; 397 } 398 else { 399 interval = xc_var_gc_interval; 400 } 395 401 396 402 add_assoc_long_ex(return_value, ZEND_STRS("slots"), cache->hentry->size); … … 405 411 add_assoc_long_ex(return_value, ZEND_STRS("deleted"), cache->deletes_count); 406 412 if (interval) { 407 add_assoc_long_ex(return_value, ZEND_STRS("gc"), (cache->last_gc_expires + interval) - XG(request_time)); 413 time_t gc = (cache->last_gc_expires + interval) - XG(request_time); 414 add_assoc_long_ex(return_value, ZEND_STRS("gc"), gc > 0 ? gc : 0); 408 415 } 409 416 else { … … 1624 1631 } 1625 1632 1626 #define STR "WWW-authenticate: basic realm='XCache Administration'"1633 #define STR "WWW-authenticate: Basic Realm=\"XCache Administration\"" 1627 1634 sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC); 1628 1635 #undef STR … … 2453 2460 static void xc_zend_extension_register(zend_extension *new_extension, DL_HANDLE handle) 2454 2461 { 2455 zend_extension extension;2456 2457 extension = *new_extension;2458 extension.handle = handle;2459 2460 zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);2461 2462 zend_llist_prepend_element(&zend_extensions, &extension);2462 zend_extension extension; 2463 2464 extension = *new_extension; 2465 extension.handle = handle; 2466 2467 zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension); 2468 2469 zend_llist_prepend_element(&zend_extensions, &extension); 2463 2470 TRACE("%s", "registered"); 2464 2471 } … … 2513 2520 static int xc_zend_extension_startup(zend_extension *extension) 2514 2521 { 2515 if (extension->startup) {2516 if (extension->startup(extension) != SUCCESS) {2522 if (extension->startup) { 2523 if (extension->startup(extension) != SUCCESS) { 2517 2524 return FAILURE; 2518 }2519 }2525 } 2526 } 2520 2527 return SUCCESS; 2521 2528 }
Note: See TracChangeset
for help on using the changeset viewer.

