Changeset 602


Ignore:
Timestamp:
2009-07-05T07:49:25+02:00 (5 years ago)
Author:
moo
Message:

merged r363,r366,r376,r381,r382,r383,r384,r385,r386,r387 from trunk

Location:
branches/1.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/ChangeLog

    r494 r602  
     11.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 
    161.2.2 2007-12-29 
    27== ChangeLog == 
  • branches/1.3/NEWS

    r494 r602  
     11.3.0 2009-??-?? 
     2======== 
     3  
    141.2.2 2007-12-29 
    25======== 
  • branches/1.3/admin/xcache.php

    r422 r602  
    207207    phpinfo(INFO_MODULES); 
    208208    $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)) { 
    210210        $moduleinfo = $m[1]; 
    211211    } 
  • branches/1.3/xc_malloc.c

    r593 r602  
    2020}; 
    2121 
     22/* {{{ _xc_malloc_shm_t */ 
     23struct _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 
    2233#define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) 
    2334 
     35static 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/* }}} */ 
     45static 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 
    2453static XC_MEM_MALLOC(xc_malloc_malloc) /* {{{ */ 
    2554{ 
    26     return malloc(size); 
     55    return xc_add_to_blocks(mem, malloc(size), size); 
    2756} 
    2857/* }}} */ 
    2958static XC_MEM_FREE(xc_malloc_free) /* {{{ return block size freed */ 
    3059{ 
     60    xc_del_from_blocks(mem, (void *) p); 
    3161    free((void *) p); 
    3262    return 0; 
     
    3565static XC_MEM_CALLOC(xc_malloc_calloc) /* {{{ */ 
    3666{ 
    37     return calloc(memb, size); 
     67    return xc_add_to_blocks(mem, calloc(memb, size), size); 
    3868} 
    3969/* }}} */ 
    4070static XC_MEM_REALLOC(xc_malloc_realloc) /* {{{ */ 
    4171{ 
    42     return realloc((void *) p, size); 
     72    return xc_add_to_blocks(mem, realloc((void *) p, size), size); 
    4373} 
    4474/* }}} */ 
    4575static XC_MEM_STRNDUP(xc_malloc_strndup) /* {{{ */ 
    4676{ 
    47     char *p = malloc(len); 
     77    char *p = xc_add_to_blocks(mem, malloc(len), len); 
    4878    if (!p) { 
    4979        return NULL; 
     
    111141/* }}} */ 
    112142 
    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  
    121143static XC_SHM_CAN_READONLY(xc_malloc_can_readonly) /* {{{ */ 
    122144{ 
     
    126148static XC_SHM_IS_READWRITE(xc_malloc_is_readwrite) /* {{{ */ 
    127149{ 
     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 
    128163    return 0; 
    129164} 
     
    147182static XC_SHM_DESTROY(xc_malloc_destroy) /* {{{ */ 
    148183{ 
     184#ifdef HAVE_XCACHE_TEST 
     185    zend_hash_destroy(&shm->blocks); 
     186#endif 
    149187    free(shm); 
    150188    return; 
     
    157195    shm->size = size; 
    158196 
     197#ifdef HAVE_XCACHE_TEST 
     198    zend_hash_init(&shm->blocks, 64, NULL, NULL, 1); 
     199#endif 
    159200    return shm; 
    160201err: 
  • branches/1.3/xcache.c

    r601 r602  
    392392    xc_mem_t *mem = cache->mem; 
    393393    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    } 
    395401 
    396402    add_assoc_long_ex(return_value, ZEND_STRS("slots"),     cache->hentry->size); 
     
    405411    add_assoc_long_ex(return_value, ZEND_STRS("deleted"),   cache->deletes_count); 
    406412    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); 
    408415    } 
    409416    else { 
     
    16241631    } 
    16251632 
    1626 #define STR "WWW-authenticate: basic realm='XCache Administration'" 
     1633#define STR "WWW-authenticate: Basic Realm=\"XCache Administration\"" 
    16271634    sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC); 
    16281635#undef STR 
     
    24532460static void xc_zend_extension_register(zend_extension *new_extension, DL_HANDLE handle) 
    24542461{ 
    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); 
    24632470    TRACE("%s", "registered"); 
    24642471} 
     
    25132520static int xc_zend_extension_startup(zend_extension *extension) 
    25142521{ 
    2515     if (extension->startup) { 
    2516         if (extension->startup(extension) != SUCCESS) { 
     2522    if (extension->startup) { 
     2523        if (extension->startup(extension) != SUCCESS) { 
    25172524            return FAILURE; 
    2518         } 
    2519     } 
     2525        } 
     2526    } 
    25202527    return SUCCESS; 
    25212528} 
Note: See TracChangeset for help on using the changeset viewer.