| 1842 | | PHP_INI_ENTRY1 ("xcache.size", "0", PHP_INI_SYSTEM, xc_OnUpdateLong, &xc_php_size) |
| 1843 | | PHP_INI_ENTRY1 ("xcache.count", "1", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_php_hcache) |
| 1844 | | PHP_INI_ENTRY1 ("xcache.slots", "8K", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_php_hentry) |
| 1845 | | |
| 1846 | | PHP_INI_ENTRY1 ("xcache.var_size", "0", PHP_INI_SYSTEM, xc_OnUpdateLong, &xc_var_size) |
| 1847 | | PHP_INI_ENTRY1 ("xcache.var_count", "1", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_var_hcache) |
| 1848 | | PHP_INI_ENTRY1 ("xcache.var_slots", "8K", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_var_hentry) |
| 1849 | | |
| | 1837 | static int xc_config_long_disp(char *name, char *default_value) /* {{{ */ |
| | 1838 | { |
| | 1839 | char *value; |
| | 1840 | char buf[100]; |
| | 1841 | |
| | 1842 | if (cfg_get_string(name, &value) != SUCCESS) { |
| | 1843 | sprintf(buf, "%s (default)", default_value); |
| | 1844 | php_info_print_table_row(2, name, buf); |
| | 1845 | } |
| | 1846 | else { |
| | 1847 | php_info_print_table_row(2, name, value); |
| | 1848 | } |
| | 1849 | |
| | 1850 | return SUCCESS; |
| | 1851 | } |
| | 1852 | /* }}} */ |
| | 1853 | #define xc_config_hash_disp xc_config_long_disp |
| 1873 | | php_info_print_table_row(2, "Opcode Cache", xc_php_size ? "enabled" : "disabled"); |
| 1874 | | php_info_print_table_row(2, "Variable Cache", xc_var_size ? "enabled" : "disabled"); |
| | 1865 | |
| | 1866 | if (xc_php_size) { |
| | 1867 | ptr = _php_math_number_format(xc_php_size, 0, '.', ','); |
| | 1868 | sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); |
| | 1869 | php_info_print_table_row(2, "Opcode Cache", buf); |
| | 1870 | efree(ptr); |
| | 1871 | } |
| | 1872 | else { |
| | 1873 | php_info_print_table_row(2, "Opcode Cache", "disabled"); |
| | 1874 | } |
| | 1875 | if (xc_var_size) { |
| | 1876 | ptr = _php_math_number_format(xc_var_size, 0, '.', ','); |
| | 1877 | sprintf(buf, "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); |
| | 1878 | php_info_print_table_row(2, "Variable Cache", buf); |
| | 1879 | efree(ptr); |
| | 1880 | } |
| | 1881 | else { |
| | 1882 | php_info_print_table_row(2, "Variable Cache", "disabled"); |
| | 1883 | } |
| | 1888 | |
| | 1889 | php_info_print_table_start(); |
| | 1890 | php_info_print_table_header(2, "Directive ", "Value"); |
| | 1891 | xc_config_long_disp("xcache.size", "0"); |
| | 1892 | xc_config_hash_disp("xcache.count", "1"); |
| | 1893 | xc_config_hash_disp("xcache.slots", "8K"); |
| | 1894 | |
| | 1895 | xc_config_long_disp("xcache.var_size", "0"); |
| | 1896 | xc_config_hash_disp("xcache.var_count", "1"); |
| | 1897 | xc_config_hash_disp("xcache.var_slots", "8K"); |
| | 1898 | php_info_print_table_end(); |
| | 1899 | |
| | 1936 | static int xc_config_hash(xc_hash_t *p, char *name, char *default_value) /* {{{ */ |
| | 1937 | { |
| | 1938 | int bits, size; |
| | 1939 | char *value; |
| | 1940 | |
| | 1941 | if (cfg_get_string(name, &value) != SUCCESS) { |
| | 1942 | value = default_value; |
| | 1943 | } |
| | 1944 | |
| | 1945 | p->size = zend_atoi(value, strlen(value)); |
| | 1946 | for (size = 1, bits = 1; size < p->size; bits ++, size <<= 1) { |
| | 1947 | /* empty body */ |
| | 1948 | } |
| | 1949 | p->size = size; |
| | 1950 | p->bits = bits; |
| | 1951 | p->mask = size - 1; |
| | 1952 | |
| | 1953 | return SUCCESS; |
| | 1954 | } |
| | 1955 | /* }}} */ |
| | 1956 | static int xc_config_long(long *p, char *name, char *default_value) /* {{{ */ |
| | 1957 | { |
| | 1958 | char *value; |
| | 1959 | |
| | 1960 | if (cfg_get_string(name, &value) != SUCCESS) { |
| | 1961 | value = default_value; |
| | 1962 | } |
| | 1963 | |
| | 1964 | *p = zend_atoi(value, strlen(value)); |
| | 1965 | return SUCCESS; |
| | 1966 | } |
| | 1967 | /* }}} */ |
| | 1993 | |
| | 1994 | xc_config_long(&xc_php_size, "xcache.size", "0"); |
| | 1995 | xc_config_hash(&xc_php_hcache, "xcache.count", "1"); |
| | 1996 | xc_config_hash(&xc_php_hentry, "xcache.slots", "8K"); |
| | 1997 | |
| | 1998 | xc_config_long(&xc_var_size, "xcache.var_size", "0"); |
| | 1999 | xc_config_hash(&xc_var_hcache, "xcache.var_count", "1"); |
| | 2000 | xc_config_hash(&xc_var_hentry, "xcache.var_slots", "8K"); |