show available shm scheme in moduleinfo
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@163 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
c9401d2b31
commit
84d049b8a0
21
xc_shm.c
21
xc_shm.c
|
@ -10,10 +10,10 @@
|
|||
#include <string.h>
|
||||
#include "xc_shm.h"
|
||||
|
||||
typedef struct {
|
||||
struct _xc_shm_scheme_t {
|
||||
const char *name;
|
||||
const xc_shm_handlers_t *handlers;
|
||||
} xc_shm_scheme_t;
|
||||
};
|
||||
static xc_shm_scheme_t xc_shm_schemes[10];
|
||||
|
||||
void xc_shm_init_modules() /* {{{ */
|
||||
|
@ -52,6 +52,23 @@ const xc_shm_handlers_t *xc_shm_scheme_find(const char *name) /* {{{ */
|
|||
return NULL;
|
||||
}
|
||||
/* }}} */
|
||||
xc_shm_scheme_t *xc_shm_scheme_first() /* {{{ */
|
||||
{
|
||||
return xc_shm_schemes;
|
||||
}
|
||||
/* }}} */
|
||||
xc_shm_scheme_t *xc_shm_scheme_next(xc_shm_scheme_t *scheme) /* {{{ */
|
||||
{
|
||||
scheme ++;
|
||||
return scheme->name ? scheme : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
const char *xc_shm_scheme_name(xc_shm_scheme_t *scheme) /* {{{ */
|
||||
{
|
||||
assert(scheme);
|
||||
return scheme->name;
|
||||
}
|
||||
/* }}} */
|
||||
xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2) /* {{{ */
|
||||
{
|
||||
const xc_shm_handlers_t *handlers = xc_shm_scheme_find(type);
|
||||
|
|
4
xc_shm.h
4
xc_shm.h
|
@ -51,10 +51,14 @@ struct _xc_shm_t {
|
|||
const xc_shm_handlers_t *handlers;
|
||||
};
|
||||
#endif
|
||||
typedef struct _xc_shm_scheme_t xc_shm_scheme_t;
|
||||
|
||||
void xc_shm_init_modules();
|
||||
int xc_shm_scheme_register(const char *name, const xc_shm_handlers_t *handlers);
|
||||
const xc_shm_handlers_t *xc_shm_scheme_find(const char *name);
|
||||
xc_shm_scheme_t *xc_shm_scheme_first();
|
||||
xc_shm_scheme_t *xc_shm_scheme_next(xc_shm_scheme_t *scheme);
|
||||
const char *xc_shm_scheme_name(xc_shm_scheme_t *scheme);
|
||||
|
||||
xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2);
|
||||
void xc_shm_destroy(xc_shm_t *shm);
|
||||
|
|
17
xcache.c
17
xcache.c
|
@ -2122,6 +2122,8 @@ static PHP_MINFO_FUNCTION(xcache)
|
|||
{
|
||||
char buf[100];
|
||||
char *ptr;
|
||||
int left, len;
|
||||
xc_shm_scheme_t *scheme;
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "XCache Support", "enabled");
|
||||
|
@ -2131,7 +2133,7 @@ static PHP_MINFO_FUNCTION(xcache)
|
|||
|
||||
if (xc_php_size) {
|
||||
ptr = _php_math_number_format(xc_php_size, 0, '.', ',');
|
||||
sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size);
|
||||
snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size);
|
||||
php_info_print_table_row(2, "Opcode Cache", buf);
|
||||
efree(ptr);
|
||||
}
|
||||
|
@ -2140,13 +2142,24 @@ static PHP_MINFO_FUNCTION(xcache)
|
|||
}
|
||||
if (xc_var_size) {
|
||||
ptr = _php_math_number_format(xc_var_size, 0, '.', ',');
|
||||
sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size);
|
||||
snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size);
|
||||
php_info_print_table_row(2, "Variable Cache", buf);
|
||||
efree(ptr);
|
||||
}
|
||||
else {
|
||||
php_info_print_table_row(2, "Variable Cache", "disabled");
|
||||
}
|
||||
|
||||
left = sizeof(buf);
|
||||
ptr = buf;
|
||||
buf[0] = '\0';
|
||||
for (scheme = xc_shm_scheme_first(); scheme; scheme = xc_shm_scheme_next(scheme)) {
|
||||
len = snprintf(ptr, left, ptr == buf ? "%s" : ", %s", xc_shm_scheme_name(scheme));
|
||||
left -= len;
|
||||
ptr += len;
|
||||
}
|
||||
php_info_print_table_row(2, "Shared Memory Schemes", buf);
|
||||
|
||||
#ifdef HAVE_XCACHE_COVERAGER
|
||||
php_info_print_table_row(2, "Coverage Dumper", XG(coveragedumper) && xc_coveragedump_dir && xc_coveragedump_dir[0] ? "enabled" : "disabled");
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue