Changeset 163 for trunk


Ignore:
Timestamp:
2006-09-13T14:11:36+02:00 (8 years ago)
Author:
moo
Message:

show available shm scheme in moduleinfo

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/xc_shm.c

    r153 r163  
    1111#include "xc_shm.h" 
    1212 
    13 typedef struct { 
     13struct _xc_shm_scheme_t { 
    1414    const char              *name; 
    1515    const xc_shm_handlers_t *handlers; 
    16 } xc_shm_scheme_t; 
     16}; 
    1717static xc_shm_scheme_t xc_shm_schemes[10]; 
    1818 
     
    5353} 
    5454/* }}} */ 
     55xc_shm_scheme_t *xc_shm_scheme_first() /* {{{ */ 
     56{ 
     57    return xc_shm_schemes; 
     58} 
     59/* }}} */ 
     60xc_shm_scheme_t *xc_shm_scheme_next(xc_shm_scheme_t *scheme) /* {{{ */ 
     61{ 
     62    scheme ++; 
     63    return scheme->name ? scheme : NULL; 
     64} 
     65/* }}} */ 
     66const char *xc_shm_scheme_name(xc_shm_scheme_t *scheme) /* {{{ */ 
     67{ 
     68    assert(scheme); 
     69    return scheme->name; 
     70} 
     71/* }}} */ 
    5572xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2) /* {{{ */ 
    5673{ 
  • trunk/xc_shm.h

    r148 r163  
    5252}; 
    5353#endif 
     54typedef struct _xc_shm_scheme_t xc_shm_scheme_t; 
    5455 
    5556void xc_shm_init_modules(); 
    5657int xc_shm_scheme_register(const char *name, const xc_shm_handlers_t *handlers); 
    5758const xc_shm_handlers_t *xc_shm_scheme_find(const char *name); 
     59xc_shm_scheme_t *xc_shm_scheme_first(); 
     60xc_shm_scheme_t *xc_shm_scheme_next(xc_shm_scheme_t *scheme); 
     61const char *xc_shm_scheme_name(xc_shm_scheme_t *scheme); 
    5862 
    5963xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2); 
  • trunk/xcache.c

    r154 r163  
    21232123    char buf[100]; 
    21242124    char *ptr; 
     2125    int left, len; 
     2126    xc_shm_scheme_t *scheme; 
    21252127 
    21262128    php_info_print_table_start(); 
     
    21322134    if (xc_php_size) { 
    21332135        ptr = _php_math_number_format(xc_php_size, 0, '.', ','); 
    2134         sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); 
     2136        snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); 
    21352137        php_info_print_table_row(2, "Opcode Cache", buf); 
    21362138        efree(ptr); 
     
    21412143    if (xc_var_size) { 
    21422144        ptr = _php_math_number_format(xc_var_size, 0, '.', ','); 
    2143         sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); 
     2145        snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); 
    21442146        php_info_print_table_row(2, "Variable Cache", buf); 
    21452147        efree(ptr); 
     
    21482150        php_info_print_table_row(2, "Variable Cache", "disabled"); 
    21492151    } 
     2152 
     2153    left = sizeof(buf); 
     2154    ptr = buf; 
     2155    buf[0] = '\0'; 
     2156    for (scheme = xc_shm_scheme_first(); scheme; scheme = xc_shm_scheme_next(scheme)) { 
     2157        len = snprintf(ptr, left, ptr == buf ? "%s" : ", %s", xc_shm_scheme_name(scheme)); 
     2158        left -= len; 
     2159        ptr += len; 
     2160    } 
     2161    php_info_print_table_row(2, "Shared Memory Schemes", buf); 
     2162 
    21502163#ifdef HAVE_XCACHE_COVERAGER 
    21512164    php_info_print_table_row(2, "Coverage Dumper", XG(coveragedumper) && xc_coveragedump_dir && xc_coveragedump_dir[0] ? "enabled" : "disabled"); 
Note: See TracChangeset for help on using the changeset viewer.