| 1 | #ifndef __XCACHE_H |
|---|
| 2 | #define __XCACHE_H |
|---|
| 3 | #define XCACHE_NAME "XCache" |
|---|
| 4 | #define XCACHE_VERSION "2.0.0-dev" |
|---|
| 5 | #define XCACHE_AUTHOR "mOo" |
|---|
| 6 | #define XCACHE_COPYRIGHT "Copyright (c) 2005-2011" |
|---|
| 7 | #define XCACHE_URL "http://xcache.lighttpd.net" |
|---|
| 8 | #define XCACHE_WIKI_URL XCACHE_URL "/wiki" |
|---|
| 9 | |
|---|
| 10 | #include <php.h> |
|---|
| 11 | #include <zend_compile.h> |
|---|
| 12 | #include <zend_API.h> |
|---|
| 13 | #include <zend.h> |
|---|
| 14 | #include "php_ini.h" |
|---|
| 15 | #include "zend_hash.h" |
|---|
| 16 | |
|---|
| 17 | #ifdef HAVE_CONFIG_H |
|---|
| 18 | #include <config.h> |
|---|
| 19 | #endif |
|---|
| 20 | #include "xc_shm.h" |
|---|
| 21 | #include "lock.h" |
|---|
| 22 | |
|---|
| 23 | #define HAVE_INODE |
|---|
| 24 | #if !defined(ZEND_ENGINE_2_4) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 99 || PHP_MAJOR_VERSION > 5) |
|---|
| 25 | # define ZEND_ENGINE_2_4 |
|---|
| 26 | #endif |
|---|
| 27 | #if !defined(ZEND_ENGINE_2_3) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 || defined(ZEND_ENGINE_2_4)) |
|---|
| 28 | # define ZEND_ENGINE_2_3 |
|---|
| 29 | #endif |
|---|
| 30 | #if !defined(ZEND_ENGINE_2_2) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 || defined(ZEND_ENGINE_2_3)) |
|---|
| 31 | # define ZEND_ENGINE_2_2 |
|---|
| 32 | #endif |
|---|
| 33 | #if !defined(ZEND_ENGINE_2_1) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 || defined(ZEND_ENGINE_2_2)) |
|---|
| 34 | # define ZEND_ENGINE_2_1 |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| 37 | #define NOTHING |
|---|
| 38 | /* ZendEngine code Switcher */ |
|---|
| 39 | #ifndef ZEND_ENGINE_2 |
|---|
| 40 | # define ZESW(v1, v2) v1 |
|---|
| 41 | #else |
|---|
| 42 | # define ZESW(v1, v2) v2 |
|---|
| 43 | #endif |
|---|
| 44 | |
|---|
| 45 | #ifdef do_alloca_with_limit |
|---|
| 46 | # define my_do_alloca(size, use_heap) do_alloca_with_limit(size, use_heap) |
|---|
| 47 | # define my_free_alloca(size, use_heap) free_alloca_with_limit(size, use_heap) |
|---|
| 48 | #elif defined(ALLOCA_FLAG) |
|---|
| 49 | # define my_do_alloca(size, use_heap) do_alloca(size, use_heap) |
|---|
| 50 | # define my_free_alloca(size, use_heap) free_alloca(size, use_heap) |
|---|
| 51 | #else |
|---|
| 52 | # define my_do_alloca(size, use_heap) do_alloca(size) |
|---|
| 53 | # define my_free_alloca(size, use_heap) free_alloca(size) |
|---|
| 54 | # define ALLOCA_FLAG(x) |
|---|
| 55 | #endif |
|---|
| 56 | #ifndef Z_SET_ISREF |
|---|
| 57 | # define Z_SET_ISREF(z) (z).is_ref = 1 |
|---|
| 58 | #endif |
|---|
| 59 | #ifndef Z_UNSET_ISREF |
|---|
| 60 | # define Z_UNSET_ISREF(z) (z).is_ref = 0 |
|---|
| 61 | #endif |
|---|
| 62 | #ifndef Z_SET_REFCOUNT |
|---|
| 63 | # define Z_SET_REFCOUNT(z, rc) (z).refcount = rc |
|---|
| 64 | #endif |
|---|
| 65 | #ifndef IS_CONSTANT_TYPE_MASK |
|---|
| 66 | # define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX) |
|---|
| 67 | #endif |
|---|
| 68 | |
|---|
| 69 | /* {{{ dirty fix for PHP 6 */ |
|---|
| 70 | #ifdef add_assoc_long_ex |
|---|
| 71 | static inline void my_add_assoc_long_ex(zval *arg, char *key, uint key_len, long value) |
|---|
| 72 | { |
|---|
| 73 | add_assoc_long_ex(arg, key, key_len, value); |
|---|
| 74 | } |
|---|
| 75 | # undef add_assoc_long_ex |
|---|
| 76 | # define add_assoc_long_ex my_add_assoc_long_ex |
|---|
| 77 | #endif |
|---|
| 78 | #ifdef add_assoc_bool_ex |
|---|
| 79 | static inline void my_add_assoc_bool_ex(zval *arg, char *key, uint key_len, zend_bool value) |
|---|
| 80 | { |
|---|
| 81 | add_assoc_bool_ex(arg, key, key_len, value); |
|---|
| 82 | } |
|---|
| 83 | # undef add_assoc_bool_ex |
|---|
| 84 | # define add_assoc_bool_ex my_add_assoc_bool_ex |
|---|
| 85 | #endif |
|---|
| 86 | #ifdef add_assoc_null_ex |
|---|
| 87 | static inline void my_add_assoc_null_ex(zval *arg, char *key, uint key_len) |
|---|
| 88 | { |
|---|
| 89 | add_assoc_null_ex(arg, key, key_len); |
|---|
| 90 | } |
|---|
| 91 | # undef add_assoc_null_ex |
|---|
| 92 | # define add_assoc_null_ex my_add_assoc_null_ex |
|---|
| 93 | #endif |
|---|
| 94 | |
|---|
| 95 | #ifdef ZEND_ENGINE_2_4 |
|---|
| 96 | # define Z_OP(op) (op) |
|---|
| 97 | # define Z_OP_CONSTANT(op) (op).literal->constant |
|---|
| 98 | # define Z_OP_TYPE(op) op##_##type |
|---|
| 99 | # define Z_OP_TYPEOF_TYPE zend_uchar |
|---|
| 100 | |
|---|
| 101 | # define Z_CLASS_INFO(className) (className).info.user |
|---|
| 102 | #else |
|---|
| 103 | # define Z_OP(op) (op).u |
|---|
| 104 | # define Z_OP_CONSTANT(op) (op).u.constant |
|---|
| 105 | # define Z_OP_TYPE(op) (op).op_type |
|---|
| 106 | # define Z_OP_TYPEOF_TYPE int |
|---|
| 107 | typedef znode znode_op; |
|---|
| 108 | |
|---|
| 109 | # define Z_CLASS_INFO(className) (className) |
|---|
| 110 | #endif |
|---|
| 111 | |
|---|
| 112 | /* }}} */ |
|---|
| 113 | |
|---|
| 114 | /* unicode */ |
|---|
| 115 | #ifdef IS_UNICODE |
|---|
| 116 | # define UNISW(text, unicode) unicode |
|---|
| 117 | #else |
|---|
| 118 | # define UNISW(text, unicode) text |
|---|
| 119 | #endif |
|---|
| 120 | #define BUCKET_KEY_SIZE(b) \ |
|---|
| 121 | (UNISW( \ |
|---|
| 122 | (b)->nKeyLength, \ |
|---|
| 123 | ((b)->key.type == IS_UNICODE) \ |
|---|
| 124 | ? UBYTES(b->nKeyLength) \ |
|---|
| 125 | : b->nKeyLength \ |
|---|
| 126 | )) |
|---|
| 127 | #define BUCKET_KEY(b) (UNISW((b)->arKey, (b)->key.arKey)) |
|---|
| 128 | #define BUCKET_KEY_S(b) ZSTR_S(BUCKET_KEY(b)) |
|---|
| 129 | #define BUCKET_KEY_U(b) ZSTR_U(BUCKET_KEY(b)) |
|---|
| 130 | #define BUCKET_KEY_TYPE(b) (UNISW(IS_STRING, (b)->key.type)) |
|---|
| 131 | #ifdef IS_UNICODE |
|---|
| 132 | # define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, key.arKey) |
|---|
| 133 | #else |
|---|
| 134 | # define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, arKey) |
|---|
| 135 | #endif |
|---|
| 136 | #define BUCKET_SIZE(b) (BUCKET_HEAD_SIZE(b) + BUCKET_KEY_SIZE(b)) |
|---|
| 137 | |
|---|
| 138 | #ifndef IS_UNICODE |
|---|
| 139 | typedef char *zstr; |
|---|
| 140 | typedef const char *const_zstr; |
|---|
| 141 | # define ZSTR_S(s) (s) |
|---|
| 142 | # define ZSTR_U(s) (s) |
|---|
| 143 | # define ZSTR_V(s) (s) |
|---|
| 144 | # define ZSTR_PS(s) (s) |
|---|
| 145 | # define ZSTR_PU(s) (s) |
|---|
| 146 | # define ZSTR_PV(s) (s) |
|---|
| 147 | #else |
|---|
| 148 | typedef const zstr const_zstr; |
|---|
| 149 | # define ZSTR_S(zs) ((zs).s) |
|---|
| 150 | # define ZSTR_U(zs) ((zs).u) |
|---|
| 151 | # define ZSTR_V(zs) ((zs).v) |
|---|
| 152 | # define ZSTR_PS(pzs) ((pzs)->s) |
|---|
| 153 | # define ZSTR_PU(pzs) ((pzs)->u) |
|---|
| 154 | # define ZSTR_PV(pzs) ((pzs)->v) |
|---|
| 155 | #endif |
|---|
| 156 | |
|---|
| 157 | #ifndef ZSTR |
|---|
| 158 | # define ZSTR(s) (s) |
|---|
| 159 | #endif |
|---|
| 160 | |
|---|
| 161 | #ifndef Z_UNIVAL |
|---|
| 162 | # define Z_UNIVAL(zval) (zval).value.str.val |
|---|
| 163 | # define Z_UNILEN(zval) (zval).value.str.len |
|---|
| 164 | #endif |
|---|
| 165 | |
|---|
| 166 | /* {{{ u hash wrapper */ |
|---|
| 167 | #ifndef IS_UNICODE |
|---|
| 168 | # define zend_u_hash_add(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ |
|---|
| 169 | zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) |
|---|
| 170 | |
|---|
| 171 | # define zend_u_hash_quick_add(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ |
|---|
| 172 | zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) |
|---|
| 173 | |
|---|
| 174 | # define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ |
|---|
| 175 | zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) |
|---|
| 176 | |
|---|
| 177 | # define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ |
|---|
| 178 | zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) |
|---|
| 179 | |
|---|
| 180 | # define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \ |
|---|
| 181 | zend_hash_find(ht, arKey, nKeyLength, pData) |
|---|
| 182 | |
|---|
| 183 | # define zend_u_hash_quick_find(ht, type, arKey, nKeyLength, h, pData) \ |
|---|
| 184 | zend_hash_quick_find(ht, arKey, nKeyLength, h, pData) |
|---|
| 185 | |
|---|
| 186 | # define add_u_assoc_zval_ex(arg, type, key, key_len, value) \ |
|---|
| 187 | add_assoc_zval_ex(arg, key, key_len, value) |
|---|
| 188 | |
|---|
| 189 | # define zend_u_is_auto_global(type, name, name_len) \ |
|---|
| 190 | zend_is_auto_global(name, name_len) |
|---|
| 191 | #endif |
|---|
| 192 | /* }}} */ |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | #define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0]))) |
|---|
| 196 | #define ECALLOC_ONE(x) ECALLOC_N(x, 1) |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | typedef ulong xc_hash_value_t; |
|---|
| 201 | typedef struct { |
|---|
| 202 | int bits; |
|---|
| 203 | int size; |
|---|
| 204 | int mask; |
|---|
| 205 | } xc_hash_t; |
|---|
| 206 | |
|---|
| 207 | /* the class entry type to be stored in class_table */ |
|---|
| 208 | typedef ZESW(zend_class_entry, zend_class_entry*) xc_cest_t; |
|---|
| 209 | |
|---|
| 210 | /* xc_cest_t to (zend_class_entry*) */ |
|---|
| 211 | #define CestToCePtr(st) (ZESW(\ |
|---|
| 212 | &(st), \ |
|---|
| 213 | st \ |
|---|
| 214 | ) ) |
|---|
| 215 | |
|---|
| 216 | /* ZCEP=zend class entry ptr */ |
|---|
| 217 | #define ZCEP_REFCOUNT_PTR(pce) (ZESW( \ |
|---|
| 218 | (pce)->refcount, \ |
|---|
| 219 | &((pce)->refcount) \ |
|---|
| 220 | )) |
|---|
| 221 | |
|---|
| 222 | #define ZCE_REFCOUNT_PTR(ce) ZCE_REFCOUNT_PTR(&ce) |
|---|
| 223 | |
|---|
| 224 | typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC); |
|---|
| 225 | |
|---|
| 226 | typedef struct _xc_entry_t xc_entry_t; |
|---|
| 227 | typedef struct _xc_entry_data_php_t xc_entry_data_php_t; |
|---|
| 228 | /* {{{ xc_cache_t */ |
|---|
| 229 | typedef struct { |
|---|
| 230 | int cacheid; |
|---|
| 231 | xc_hash_t *hcache; /* hash to cacheid */ |
|---|
| 232 | |
|---|
| 233 | time_t compiling; |
|---|
| 234 | zend_ulong misses; |
|---|
| 235 | zend_ulong hits; |
|---|
| 236 | zend_ulong clogs; |
|---|
| 237 | zend_ulong ooms; |
|---|
| 238 | zend_ulong errors; |
|---|
| 239 | xc_lock_t *lck; |
|---|
| 240 | xc_shm_t *shm; /* to which shm contains us */ |
|---|
| 241 | xc_mem_t *mem; /* to which mem contains us */ |
|---|
| 242 | |
|---|
| 243 | xc_entry_t **entries; |
|---|
| 244 | int entries_count; |
|---|
| 245 | xc_entry_data_php_t **phps; |
|---|
| 246 | int phps_count; |
|---|
| 247 | xc_entry_t *deletes; |
|---|
| 248 | int deletes_count; |
|---|
| 249 | xc_hash_t *hentry; /* hash settings to entry */ |
|---|
| 250 | xc_hash_t *hphp; /* hash settings to php */ |
|---|
| 251 | |
|---|
| 252 | time_t last_gc_deletes; |
|---|
| 253 | time_t last_gc_expires; |
|---|
| 254 | |
|---|
| 255 | time_t hits_by_hour_cur_time; |
|---|
| 256 | zend_uint hits_by_hour_cur_slot; |
|---|
| 257 | zend_ulong hits_by_hour[24]; |
|---|
| 258 | time_t hits_by_second_cur_time; |
|---|
| 259 | zend_uint hits_by_second_cur_slot; |
|---|
| 260 | zend_ulong hits_by_second[5]; |
|---|
| 261 | } xc_cache_t; |
|---|
| 262 | /* }}} */ |
|---|
| 263 | /* {{{ xc_op_array_info_t */ |
|---|
| 264 | typedef struct { |
|---|
| 265 | #ifdef ZEND_ENGINE_2_4 |
|---|
| 266 | zend_uint literalinfo_cnt; |
|---|
| 267 | int *literalinfos; |
|---|
| 268 | #else |
|---|
| 269 | zend_uint oplineinfo_cnt; |
|---|
| 270 | int *oplineinfos; |
|---|
| 271 | #endif |
|---|
| 272 | } xc_op_array_info_t; |
|---|
| 273 | /* }}} */ |
|---|
| 274 | /* {{{ xc_classinfo_t */ |
|---|
| 275 | typedef struct { |
|---|
| 276 | #ifdef IS_UNICODE |
|---|
| 277 | zend_uchar type; |
|---|
| 278 | #endif |
|---|
| 279 | zstr key; |
|---|
| 280 | zend_uint key_size; |
|---|
| 281 | ulong h; |
|---|
| 282 | zend_uint methodinfo_cnt; |
|---|
| 283 | xc_op_array_info_t *methodinfos; |
|---|
| 284 | xc_cest_t cest; |
|---|
| 285 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
|---|
| 286 | int oplineno; |
|---|
| 287 | #endif |
|---|
| 288 | } xc_classinfo_t; |
|---|
| 289 | /* }}} */ |
|---|
| 290 | #ifdef HAVE_XCACHE_CONSTANT |
|---|
| 291 | /* {{{ xc_constinfo_t */ |
|---|
| 292 | typedef struct { |
|---|
| 293 | #ifdef IS_UNICODE |
|---|
| 294 | zend_uchar type; |
|---|
| 295 | #endif |
|---|
| 296 | zstr key; |
|---|
| 297 | zend_uint key_size; |
|---|
| 298 | ulong h; |
|---|
| 299 | zend_constant constant; |
|---|
| 300 | } xc_constinfo_t; |
|---|
| 301 | /* }}} */ |
|---|
| 302 | #endif |
|---|
| 303 | /* {{{ xc_funcinfo_t */ |
|---|
| 304 | typedef struct { |
|---|
| 305 | #ifdef IS_UNICODE |
|---|
| 306 | zend_uchar type; |
|---|
| 307 | #endif |
|---|
| 308 | zstr key; |
|---|
| 309 | zend_uint key_size; |
|---|
| 310 | ulong h; |
|---|
| 311 | xc_op_array_info_t op_array_info; |
|---|
| 312 | zend_function func; |
|---|
| 313 | } xc_funcinfo_t; |
|---|
| 314 | /* }}} */ |
|---|
| 315 | #ifdef ZEND_ENGINE_2_1 |
|---|
| 316 | /* {{{ xc_autoglobal_t */ |
|---|
| 317 | typedef struct { |
|---|
| 318 | #ifdef IS_UNICODE |
|---|
| 319 | zend_uchar type; |
|---|
| 320 | #endif |
|---|
| 321 | zstr key; |
|---|
| 322 | zend_uint key_len; |
|---|
| 323 | ulong h; |
|---|
| 324 | } xc_autoglobal_t; |
|---|
| 325 | /* }}} */ |
|---|
| 326 | #endif |
|---|
| 327 | typedef enum { XC_TYPE_PHP, XC_TYPE_VAR } xc_entry_type_t; |
|---|
| 328 | typedef char xc_md5sum_t[16]; |
|---|
| 329 | /* {{{ xc_compilererror_t */ |
|---|
| 330 | typedef struct { |
|---|
| 331 | int type; |
|---|
| 332 | uint lineno; |
|---|
| 333 | int error_len; |
|---|
| 334 | char *error; |
|---|
| 335 | } xc_compilererror_t; |
|---|
| 336 | /* }}} */ |
|---|
| 337 | /* {{{ xc_entry_data_php_t */ |
|---|
| 338 | struct _xc_entry_data_php_t { |
|---|
| 339 | xc_hash_value_t hvalue; /* hash of md5 */ |
|---|
| 340 | xc_entry_data_php_t *next; |
|---|
| 341 | xc_cache_t *cache; /* which cache it's on */ |
|---|
| 342 | |
|---|
| 343 | xc_md5sum_t md5; /* md5sum of the source */ |
|---|
| 344 | zend_ulong refcount; /* count of entries referencing to this data */ |
|---|
| 345 | |
|---|
| 346 | size_t sourcesize; |
|---|
| 347 | zend_ulong hits; /* hits of this php */ |
|---|
| 348 | size_t size; |
|---|
| 349 | |
|---|
| 350 | xc_op_array_info_t op_array_info; |
|---|
| 351 | zend_op_array *op_array; |
|---|
| 352 | |
|---|
| 353 | #ifdef HAVE_XCACHE_CONSTANT |
|---|
| 354 | zend_uint constinfo_cnt; |
|---|
| 355 | xc_constinfo_t *constinfos; |
|---|
| 356 | #endif |
|---|
| 357 | |
|---|
| 358 | zend_uint funcinfo_cnt; |
|---|
| 359 | xc_funcinfo_t *funcinfos; |
|---|
| 360 | |
|---|
| 361 | zend_uint classinfo_cnt; |
|---|
| 362 | xc_classinfo_t *classinfos; |
|---|
| 363 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
|---|
| 364 | zend_bool have_early_binding; |
|---|
| 365 | #endif |
|---|
| 366 | |
|---|
| 367 | #ifdef ZEND_ENGINE_2_1 |
|---|
| 368 | zend_uint autoglobal_cnt; |
|---|
| 369 | xc_autoglobal_t *autoglobals; |
|---|
| 370 | #endif |
|---|
| 371 | |
|---|
| 372 | #ifdef E_STRICT |
|---|
| 373 | zend_uint compilererror_cnt; |
|---|
| 374 | xc_compilererror_t *compilererrors; |
|---|
| 375 | #endif |
|---|
| 376 | |
|---|
| 377 | zend_bool have_references; |
|---|
| 378 | }; |
|---|
| 379 | /* }}} */ |
|---|
| 380 | /* {{{ xc_entry_data_var_t */ |
|---|
| 381 | typedef struct { |
|---|
| 382 | zval *value; |
|---|
| 383 | |
|---|
| 384 | zend_bool have_references; |
|---|
| 385 | } xc_entry_data_var_t; |
|---|
| 386 | /* }}} */ |
|---|
| 387 | typedef zvalue_value xc_entry_name_t; |
|---|
| 388 | /* {{{ xc_entry_t */ |
|---|
| 389 | struct _xc_entry_t { |
|---|
| 390 | xc_entry_type_t type; |
|---|
| 391 | xc_hash_value_t hvalue; |
|---|
| 392 | xc_entry_t *next; |
|---|
| 393 | xc_cache_t *cache; /* which cache it's on */ |
|---|
| 394 | |
|---|
| 395 | size_t size; |
|---|
| 396 | zend_ulong refcount; /* count of instances holding this entry */ |
|---|
| 397 | zend_ulong hits; |
|---|
| 398 | time_t ctime; /* the ctime of this entry */ |
|---|
| 399 | time_t atime; /* the atime of this entry */ |
|---|
| 400 | time_t dtime; /* the deletion time of this entry */ |
|---|
| 401 | long ttl; /* ttl of time entry, var only */ |
|---|
| 402 | |
|---|
| 403 | #ifdef IS_UNICODE |
|---|
| 404 | zend_uchar name_type; |
|---|
| 405 | #endif |
|---|
| 406 | xc_entry_name_t name; |
|---|
| 407 | |
|---|
| 408 | union { |
|---|
| 409 | xc_entry_data_php_t *php; |
|---|
| 410 | xc_entry_data_var_t *var; |
|---|
| 411 | } data; |
|---|
| 412 | |
|---|
| 413 | time_t mtime; /* the mtime of origin source file */ |
|---|
| 414 | #ifdef HAVE_INODE |
|---|
| 415 | int device; /* the filesystem device */ |
|---|
| 416 | int inode; /* the filesystem inode */ |
|---|
| 417 | #endif |
|---|
| 418 | |
|---|
| 419 | /* php only */ |
|---|
| 420 | int filepath_len; |
|---|
| 421 | char *filepath; |
|---|
| 422 | int dirpath_len; |
|---|
| 423 | char *dirpath; |
|---|
| 424 | #ifdef IS_UNICODE |
|---|
| 425 | UChar *ufilepath; |
|---|
| 426 | int ufilepath_len; |
|---|
| 427 | UChar *udirpath; |
|---|
| 428 | int udirpath_len; |
|---|
| 429 | #endif |
|---|
| 430 | |
|---|
| 431 | }; |
|---|
| 432 | /* }}} */ |
|---|
| 433 | |
|---|
| 434 | extern zend_module_entry xcache_module_entry; |
|---|
| 435 | #define phpext_xcache_ptr &xcache_module_entry |
|---|
| 436 | |
|---|
| 437 | int xc_is_rw(const void *p); |
|---|
| 438 | int xc_is_ro(const void *p); |
|---|
| 439 | int xc_is_shm(const void *p); |
|---|
| 440 | /* {{{ xc_gc_op_array_t */ |
|---|
| 441 | typedef struct { |
|---|
| 442 | #ifdef ZEND_ENGINE_2 |
|---|
| 443 | zend_uint num_args; |
|---|
| 444 | zend_arg_info *arg_info; |
|---|
| 445 | #endif |
|---|
| 446 | zend_uint last; |
|---|
| 447 | zend_op *opcodes; |
|---|
| 448 | } xc_gc_op_array_t; |
|---|
| 449 | /* }}} */ |
|---|
| 450 | void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC); |
|---|
| 451 | void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copied, const xc_op_array_info_t *op_array_info TSRMLS_DC); |
|---|
| 452 | |
|---|
| 453 | #endif /* __XCACHE_H */ |
|---|