mirror of
https://github.com/php/pecl-caching-wincache.git
synced 2026-03-23 23:02:17 +01:00
Initial check in for WinCache 2.0.0.0 for PHP7
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
..\pecl\wincache\template.rc: ..\pecl\wincache\wincache_etw.rc
|
||||
..\pecl\wincache2\template.rc: ..\pecl\wincache2\wincache_etw.rc
|
||||
|
||||
..\pecl\wincache\wincache_etw.h ..\pecl\wincache\wincache_etw.rc: ..\pecl\wincache\wincache_etw.man
|
||||
$(MC) -um -e h -h ..\pecl\wincache\ -r ..\pecl\wincache\ wincache_etw.man
|
||||
..\pecl\wincache2\wincache_etw.h ..\pecl\wincache2\wincache_etw.rc: ..\pecl\wincache2\wincache_etw.man
|
||||
$(MC) -um -e h -h ..\pecl\wincache2\ -r ..\pecl\wincache2\ wincache_etw.man
|
||||
|
||||
70
config.w32
70
config.w32
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Windows Cache for PHP |
|
||||
| Windows Cache for PHP v2 |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Copyright (c) 2009, Microsoft Corporation. All rights reserved. |
|
||||
| |
|
||||
@@ -28,45 +28,51 @@
|
||||
| Module: config.w32 |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
| Author: Kanwaljeet Singla <ksingla@microsoft.com> |
|
||||
| Updated: Eric Stenson <ericsten@microsoft.com> |
|
||||
+----------------------------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
ARG_ENABLE("wincache", "Windows PHP Cache", "no");
|
||||
ARG_ENABLE("wincache", "Windows PHP Cache 2", "no");
|
||||
|
||||
if (PHP_WINCACHE != "no") {
|
||||
if (PHP_ZTS != "no") {
|
||||
WARNING("WinCache module requires --disable-zts build of PHP on windows");
|
||||
} else {
|
||||
EXTENSION('wincache', "php_wincache.c wincache_utils.c wincache_error.c \
|
||||
wincache_debug.c wincache_lock.c wincache_filemap.c \
|
||||
wincache_alloc.c \
|
||||
wincache_fcache.c wincache_rplist.c wincache_aplist.c \
|
||||
wincache_zvcache.c wincache_session.c \
|
||||
wincache_fcnotify.c",
|
||||
true,
|
||||
"/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
|
||||
EXTENSION('wincache', "php_wincache.c wincache_utils.c wincache_error.c \
|
||||
wincache_debug.c wincache_lock.c wincache_filemap.c \
|
||||
wincache_alloc.c wincache_ocache.c wincache_opcopy.c \
|
||||
wincache_fcache.c wincache_rplist.c wincache_aplist.c \
|
||||
wincache_zvcache.c wincache_session.c \
|
||||
wincache_fcnotify.c wincache_string.c");
|
||||
ADD_EXTENSION_DEP('wincache', 'session');
|
||||
AC_DEFINE('HAVE_WINCACHE', 1);
|
||||
|
||||
ADD_EXTENSION_DEP('wincache', 'session');
|
||||
AC_DEFINE('HAVE_WINCACHE', 1);
|
||||
DEFINE('WINCACHE_ETW_RC', '..\\pecl\\wincache\\wincache_etw.rc');
|
||||
|
||||
DEFINE('WINCACHE_ETW_RC', '..\\pecl\\wincache\\wincache_etw.rc');
|
||||
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/NXCOMPAT');
|
||||
if (!X64) {
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/SAFESEH');
|
||||
}
|
||||
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/GS');
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/I$(BUILD_DIR)\\pecl\\wincache\\ ');
|
||||
|
||||
if (PHP_DEBUG == "yes") {
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/debug /debugtype:cv,fixup');
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/D WINCACHE_DEBUG');
|
||||
if (VCVERS >= 1700) {
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/ZI');
|
||||
} else {
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/Zi');
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/NXCOMPAT');
|
||||
if (!X64) {
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/SAFESEH');
|
||||
}
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/WX');
|
||||
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/GS');
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/I$(BUILD_DIR)\\pecl\\wincache\\ ');
|
||||
|
||||
if (PHP_DEBUG == "yes") {
|
||||
ADD_FLAG('LDFLAGS_WINCACHE', '/debug /debugtype:cv,fixup');
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/D WINCACHE_DEBUG');
|
||||
if (VCVERS >= 1700) {
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/ZI');
|
||||
} else {
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/Zi');
|
||||
}
|
||||
ADD_FLAG('CFLAGS_WINCACHE', '/WX');
|
||||
}
|
||||
|
||||
ADD_FLAG('DEPS_WINCACHE', '..\\pecl\\wincache\\wincache_etw.rc');
|
||||
|
||||
CHECK_LIB("Kernel32.lib", "wincache", PHP_WINCACHE);
|
||||
}
|
||||
|
||||
ADD_FLAG('DEPS_WINCACHE', '..\\pecl\\wincache\\wincache_etw.rc');
|
||||
|
||||
CHECK_LIB("Kernel32.lib", "wincache", PHP_WINCACHE);
|
||||
}
|
||||
|
||||
74
package.xml
74
package.xml
@@ -29,37 +29,32 @@
|
||||
<email>ericsten@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2015-03-23</date>
|
||||
<date>2015-10-01</date>
|
||||
<version>
|
||||
<release>1.3.7.4</release>
|
||||
<api>1.3.0</api>
|
||||
<release>2.0.0.0</release>
|
||||
<api>2.0.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<release>beta</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
|
||||
<notes>
|
||||
1.3.7.4:
|
||||
- Fix uninitialized variable issue that leads to av (null zend_error_cb).
|
||||
- Increase the timeout used to wait for other processes to finish initialization.
|
||||
- Re-order initialization such that User Cache will still work even if file cache fails to init.
|
||||
- Remove noisy ASSERTs.
|
||||
- Improve error checking in shared memory heap management functions.
|
||||
- Fix alloc bug in wincache_file_get_contents.
|
||||
- Enable setting of debuglevel and reroute_enabled from .user.ini.
|
||||
- Move shared memory segments out of the Windows System Pagefile. Added new configuration setting wincache.filemapdir to control where the temp files are created.
|
||||
- Refine VM base address selection for shared memory maps.
|
||||
- Ensure all named objects created with Global prefix when apppoolid is set.
|
||||
2.0.0.0:
|
||||
- PHP7 Support
|
||||
- Remove opcode cache support
|
||||
- Enforce NTS-only build
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<file role="doc" name="config.w32"/>
|
||||
<file role="doc" name="INSTALL"/>
|
||||
<file role="doc" name="LICENSE"/>
|
||||
<file role="src" name="MSG00001.bin"/>
|
||||
<file role="src" name="php_wincache.c"/>
|
||||
<file role="src" name="php_wincache.h"/>
|
||||
<file role="src" name="precomp.h"/>
|
||||
<file role="doc" name="README.TXT"/>
|
||||
<file role="src" name="template.rc"/>
|
||||
<file role="src" name="wincache_alloc.c"/>
|
||||
<file role="src" name="wincache_alloc.h"/>
|
||||
@@ -67,8 +62,13 @@
|
||||
<file role="src" name="wincache_aplist.h"/>
|
||||
<file role="src" name="wincache_debug.c"/>
|
||||
<file role="src" name="wincache_debug.h"/>
|
||||
<file role="src" name="wincache_dummy_etw.h"/>
|
||||
<file role="src" name="wincache_error.c"/>
|
||||
<file role="src" name="wincache_error.h"/>
|
||||
<file role="src" name="wincache_etw.h"/>
|
||||
<file role="src" name="wincache_etw.man"/>
|
||||
<file role="src" name="wincache_etw.rc"/>
|
||||
<file role="src" name="wincache_etwTEMP.bin"/>
|
||||
<file role="src" name="wincache_fcache.c"/>
|
||||
<file role="src" name="wincache_fcache.h"/>
|
||||
<file role="src" name="wincache_fcnotify.c"/>
|
||||
@@ -77,10 +77,6 @@
|
||||
<file role="src" name="wincache_filemap.h"/>
|
||||
<file role="src" name="wincache_lock.c"/>
|
||||
<file role="src" name="wincache_lock.h"/>
|
||||
<file role="src" name="wincache_ocache.c"/>
|
||||
<file role="src" name="wincache_ocache.h"/>
|
||||
<file role="src" name="wincache_opcopy.c"/>
|
||||
<file role="src" name="wincache_opcopy.h"/>
|
||||
<file role="src" name="wincache_rplist.c"/>
|
||||
<file role="src" name="wincache_rplist.h"/>
|
||||
<file role="src" name="wincache_session.h"/>
|
||||
@@ -92,12 +88,25 @@
|
||||
<file role="src" name="wincache_zvcache.h"/>
|
||||
<file role="src" name="wincache_zvcache.c"/>
|
||||
<file role="php" name="wincache.php"/>
|
||||
<dir role="test" name="tests">
|
||||
<file role="test" name="skipif.inc"/>
|
||||
<file role="test" name="wincache_001.phpt"/>
|
||||
<file role="test" name="wincache_002.phpt"/>
|
||||
<file role="test" name="wincache_003.phpt"/>
|
||||
<file role="test" name="wincache_004.phpt"/>
|
||||
<file role="test" name="wincache_004_require.php"/>
|
||||
<file role="test" name="wincache_005.phpt"/>
|
||||
<file role="test" name="wincache_006.phpt"/>
|
||||
<file role="test" name="wincache_007.phpt"/>
|
||||
<file role="test" name="wincache_require.php"/>
|
||||
<file role="test" name="wincache_require.phpt"/>
|
||||
</dir>
|
||||
</dir>
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>5.2.0</min>
|
||||
<min>7.0.0</min>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.4.0</min>
|
||||
@@ -108,6 +117,31 @@
|
||||
<extsrcrelease/>
|
||||
|
||||
<changelog>
|
||||
<release>
|
||||
<date>2015-03-23</date>
|
||||
<version>
|
||||
<release>1.3.7.4</release>
|
||||
<api>1.3.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<notes>
|
||||
1.3.7.4:
|
||||
- Fix uninitialized variable issue that leads to av (null zend_error_cb).
|
||||
- Increase the timeout used to wait for other processes to finish initialization.
|
||||
- Re-order initialization such that User Cache will still work even if file cache fails to init.
|
||||
- Remove noisy ASSERTs.
|
||||
- Improve error checking in shared memory heap management functions.
|
||||
- Fix alloc bug in wincache_file_get_contents.
|
||||
- Enable setting of debuglevel and reroute_enabled from .user.ini.
|
||||
- Move shared memory segments out of the Windows System Pagefile. Added new configuration setting wincache.filemapdir to control where the temp files are created.
|
||||
- Refine VM base address selection for shared memory maps.
|
||||
- Ensure all named objects created with Global prefix when apppoolid is set.
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<release>
|
||||
<date>2015-01-10</date>
|
||||
<version>
|
||||
|
||||
1754
php_wincache.c
1754
php_wincache.c
File diff suppressed because it is too large
Load Diff
@@ -43,13 +43,6 @@ extern zend_module_entry wincache_module_entry;
|
||||
#include "precomp.h"
|
||||
#endif
|
||||
|
||||
typedef struct ocacheval_list ocacheval_list;
|
||||
struct ocacheval_list
|
||||
{
|
||||
ocache_value * pvalue; /* ocache value which is in use */
|
||||
ocacheval_list * next; /* pointer to next ocacheval_list entry */
|
||||
};
|
||||
|
||||
typedef struct wclock_context wclock_context;
|
||||
struct wclock_context
|
||||
{
|
||||
@@ -61,7 +54,6 @@ struct wclock_context
|
||||
/* Module globals */
|
||||
ZEND_BEGIN_MODULE_GLOBALS(wincache)
|
||||
aplist_context * lfcache; /* Shared memory for fcache filelist */
|
||||
aplist_context * locache; /* Shared memory for ocache filelist */
|
||||
zvcache_context * zvucache; /* User controlled user cache */
|
||||
zvcache_context * zvscache; /* Zval cache used to store session data */
|
||||
HashTable * phscache; /* Hashtable for session caches for modified savepaths */
|
||||
@@ -97,14 +89,11 @@ ZEND_BEGIN_MODULE_GLOBALS(wincache)
|
||||
zend_bool fcenabled; /* File cache enabled or disabled */
|
||||
unsigned int fcachesize; /* File cache size in MBs */
|
||||
unsigned int maxfilesize; /* Max file size (kb) allowed in fcache */
|
||||
zend_bool ocenabled; /* Opcode cache enabled or disabled */
|
||||
unsigned int ocachesize; /* Opcode cache size in MB */
|
||||
zend_bool ucenabled; /* User cache enabled or disabled */
|
||||
unsigned int ucachesize; /* User cache size in MBs */
|
||||
unsigned int scachesize; /* Session cache size in MBs */
|
||||
unsigned int debuglevel; /* Debug dump level (0/101/201/301/401/501) */
|
||||
char * ignorelist; /* Pipe-separated list of files to ignore */
|
||||
char * ocefilter; /* Comma-separated sitelist having ocenabled toggled */
|
||||
char * fcefilter; /* Comma-separated sitelist having fcenabled toggled */
|
||||
char * namesalt; /* Salt to use in all the names */
|
||||
zend_bool fcndetect; /* File change notication detection enabled */
|
||||
@@ -112,8 +101,6 @@ ZEND_BEGIN_MODULE_GLOBALS(wincache)
|
||||
|
||||
HashTable * wclocks; /* Locks created using wincache_lock call */
|
||||
HashTable * zvcopied; /* Copied zvals to make refcounting work */
|
||||
ocacheval_list * oclisthead; /* List of ocache_value entries in use */
|
||||
ocacheval_list * oclisttail; /* Tail of ocache_value entries list */
|
||||
unsigned int lasterror; /* Last error value */
|
||||
unsigned int uclasterror; /* Last error value encountered by user cache */
|
||||
unsigned int parentpid; /* Parent process identifier */
|
||||
@@ -121,17 +108,11 @@ ZEND_BEGIN_MODULE_GLOBALS(wincache)
|
||||
zend_llist * errmsglist; /* List of errors generated by PHP */
|
||||
zend_ini_entry * inifce; /* fcenabled ini_entry in ini_directives */
|
||||
zend_ini_entry * inisavepath; /* save_path ini_entry in ini_directives */
|
||||
unsigned char dooctoggle; /* Do toggle of ocenabled due to filter settigns */
|
||||
unsigned char dofctoggle; /* Do toggle of fcenabled due to filter settigns */
|
||||
zend_bool srwlocks; /* Enable shared reader/writer locks */
|
||||
/* Enable wrapper functions around standard PHP functions */
|
||||
zend_bool reroute_enabled;
|
||||
#ifdef ZEND_ENGINE_2_4
|
||||
unsigned int internedsize; /* Bytes for the interned strings cache */
|
||||
#endif /* ZEND_ENGINE_2_4 */
|
||||
#ifdef WINCACHE_TEST
|
||||
zend_bool olocaltest; /* Local opcode cache test configuration */
|
||||
#endif
|
||||
const char * apppoolid; /* The application id. */
|
||||
char * filemapdir; /* Directory where temp filemap files should be created */
|
||||
ZEND_END_MODULE_GLOBALS(wincache)
|
||||
@@ -139,29 +120,27 @@ ZEND_END_MODULE_GLOBALS(wincache)
|
||||
ZEND_EXTERN_MODULE_GLOBALS(wincache)
|
||||
|
||||
#ifdef ZTS
|
||||
#define WCG(v) TSRMG(wincache_globals_id, zend_wincache_globals *, v)
|
||||
#define WCG(v) ZEND_TSRMG(wincache_globals_id, zend_wincache_globals *, v)
|
||||
# ifdef COMPILE_DL_WINCACHE
|
||||
ZEND_TSRMLS_CACHE_EXTERN();
|
||||
# endif
|
||||
#else
|
||||
#define WCG(v) (wincache_globals.v)
|
||||
#endif
|
||||
|
||||
typedef char *(*fn_zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
|
||||
typedef int (*fn_zend_stream_open_function)(const char * filename, zend_file_handle *handle TSRMLS_DC);
|
||||
typedef zend_op_array * (*fn_zend_compile_file)(zend_file_handle *, int TSRMLS_DC);
|
||||
typedef zend_string *(*fn_zend_resolve_path)(const char *filename, int filename_len);
|
||||
typedef int (*fn_zend_stream_open_function)(const char * filename, zend_file_handle *handle);
|
||||
typedef zend_op_array * (*fn_zend_compile_file)(zend_file_handle *, int);
|
||||
typedef void (*fn_zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
|
||||
fn_zend_resolve_path original_resolve_path;
|
||||
fn_zend_stream_open_function original_stream_open_function;
|
||||
fn_zend_compile_file original_compile_file;
|
||||
fn_zend_error_cb original_error_cb;
|
||||
|
||||
extern char * wincache_resolve_path(const char * filename, int filename_len TSRMLS_DC);
|
||||
extern int wincache_stream_open_function(const char * filename, zend_file_handle * file_handle TSRMLS_DC);
|
||||
extern zend_op_array * wincache_compile_file(zend_file_handle * file_handle, int type TSRMLS_DC);
|
||||
extern void wincache_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
|
||||
|
||||
extern void wincache_intercept_functions_init(TSRMLS_DC);
|
||||
extern void wincache_intercept_functions_shutdown(TSRMLS_DC);
|
||||
extern void wincache_save_orig_functions(TSRMLS_DC);
|
||||
extern zend_string * wincache_resolve_path(const char * filename, int filename_len);
|
||||
extern int wincache_stream_open_function(const char * filename, zend_file_handle * file_handle);
|
||||
|
||||
extern void wincache_intercept_functions_init();
|
||||
extern void wincache_intercept_functions_shutdown();
|
||||
extern void wincache_save_orig_functions();
|
||||
|
||||
#endif /* _PHP_WINCACHE_H_ */
|
||||
|
||||
39
precomp.h
39
precomp.h
@@ -35,7 +35,7 @@
|
||||
#define _PRECOMP_H_
|
||||
|
||||
#define PHP_WINCACHE_EXTNAME "wincache"
|
||||
#define PHP_WINCACHE_VERSION "1.3.7.7"
|
||||
#define PHP_WINCACHE_VERSION "2.0.0.0"
|
||||
#define PHP_WINCACHE_VERSION_LEN (sizeof(PHP_WINCACHE_VERSION)-1)
|
||||
|
||||
#define GLOBAL_SCOPE_PREFIX "Global\\"
|
||||
@@ -63,7 +63,7 @@
|
||||
#include "php_ini.h"
|
||||
#include "sapi.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/php_smart_str.h"
|
||||
#include "zend_smart_str.h"
|
||||
#include "ext/session/php_session.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
@@ -76,33 +76,6 @@
|
||||
#define XSTRVER2(maj, min) #maj "." #min
|
||||
#define STRVER2(maj, min) XSTRVER2(maj, min)
|
||||
|
||||
#if PHP_VERSION_ID < 50300
|
||||
#define PHP_VERSION_52
|
||||
#endif
|
||||
|
||||
#if ZEND_MODULE_API_NO >= 20131226
|
||||
/* Zend added CG(interened_empty_string) in 20131226 */
|
||||
#define ZEND_ENGINE_2_6_1
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO >= 20131106
|
||||
#define ZEND_ENGINE_2_6
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO >= 20121204
|
||||
#define ZEND_ENGINE_2_5
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO >= 20100409
|
||||
#define ZEND_ENGINE_2_4
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO > 20060613
|
||||
#define ZEND_ENGINE_2_3
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO > 20050922
|
||||
#define ZEND_ENGINE_2_2
|
||||
#endif
|
||||
#if ZEND_MODULE_API_NO > 20050921
|
||||
#define ZEND_ENGINE_2_1
|
||||
#endif
|
||||
|
||||
#ifdef _ASSERT
|
||||
#undef _ASSERT
|
||||
#endif
|
||||
@@ -133,12 +106,9 @@
|
||||
|
||||
#define APLIST_TYPE_INVALID 255
|
||||
#define APLIST_TYPE_GLOBAL 0
|
||||
#define APLIST_TYPE_OPCODE_LOCAL 1
|
||||
|
||||
#define NUM_FILES_MINIMUM 1024
|
||||
#define NUM_FILES_MAXIMUM 16384
|
||||
#define OCACHE_SIZE_MINIMUM 15
|
||||
#define OCACHE_SIZE_MAXIMUM 255
|
||||
#define FCACHE_SIZE_MINIMUM 5
|
||||
#define FCACHE_SIZE_MAXIMUM 255
|
||||
#define ZCACHE_SIZE_MINIMUM 5
|
||||
@@ -163,17 +133,12 @@
|
||||
#include "wincache_lock.h"
|
||||
#include "wincache_filemap.h"
|
||||
#include "wincache_alloc.h"
|
||||
#include "wincache_ocache.h"
|
||||
#include "wincache_opcopy.h"
|
||||
#include "wincache_fcnotify.h"
|
||||
#include "wincache_fcache.h"
|
||||
#include "wincache_rplist.h"
|
||||
#include "wincache_aplist.h"
|
||||
#include "wincache_zvcache.h"
|
||||
#include "wincache_session.h"
|
||||
#ifdef ZEND_ENGINE_2_4
|
||||
#include "wincache_string.h"
|
||||
#endif /* ZEND_ENGINE_2_4 */
|
||||
|
||||
#if (_MSC_VER >= 1700)
|
||||
#include "wincache_etw.h"
|
||||
|
||||
10
template.rc
10
template.rc
@@ -38,10 +38,10 @@
|
||||
#include "winresrc.h"
|
||||
#include "main/php_version.h"
|
||||
|
||||
#define WINCACHE_VMAJOR 1
|
||||
#define WINCACHE_VMINOR 3
|
||||
#define WINCACHE_VMMDD 7
|
||||
#define WINCACHE_VREVISION 7
|
||||
#define WINCACHE_VMAJOR 2
|
||||
#define WINCACHE_VMINOR 0
|
||||
#define WINCACHE_VMMDD 0
|
||||
#define WINCACHE_VREVISION 0
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
@@ -82,7 +82,7 @@ BEGIN
|
||||
VALUE "FileVersion", STRVER4(WINCACHE_VMAJOR,WINCACHE_VMINOR,WINCACHE_VMMDD,WINCACHE_VREVISION)
|
||||
VALUE "LegalCopyright", "Copyright © 2014 Microsoft Corp. All Rights Reserved.\0"
|
||||
VALUE "OriginalFilename", FILE_NAME "\0"
|
||||
VALUE "ProductName", "Windows Cache Extension " STRVER2(WINCACHE_VMAJOR,WINCACHE_VMINOR) " for PHP " STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION)
|
||||
VALUE "ProductName", "Windows Cache Extension" STRVER2(WINCACHE_VMAJOR,WINCACHE_VMINOR) " for PHP " STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION)
|
||||
VALUE "ProductVersion", STRVER2(WINCACHE_VMAJOR,WINCACHE_VMINOR)
|
||||
VALUE "URL", "http://www.microsoft.com\0"
|
||||
END
|
||||
|
||||
@@ -4,7 +4,6 @@ Testing Function call in case insensitive way
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Testing require directive
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Testing return statement from an included file
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Testing ini directive include_path
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Testing static variables inside class
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Wincache - Testing Global Variables
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
|
||||
@@ -4,7 +4,6 @@ Wincache - Testing Reroute
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.ocenabled=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
wincache.reroute_enabled=1
|
||||
|
||||
161
tests/wincache_ucache_array.phpt
Normal file
161
tests/wincache_ucache_array.phpt
Normal file
@@ -0,0 +1,161 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* functions with IS_ARRAY data
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting 'foo'\n");
|
||||
$bar = array('green' => 5, 'Blue' => '6', 'yellow', 'cyan' => 'eight');
|
||||
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
var_dump(wincache_ucache_get('foo'));
|
||||
var_dump(wincache_ucache_set('foo', array('pink' => 9, 'chartruce' => '10', 'brown', 'magenta' => 'twelve')));
|
||||
var_dump(wincache_ucache_get('foo'));
|
||||
var_dump(wincache_ucache_exists('foo'));
|
||||
var_dump(wincache_ucache_info(false, 'foo'));
|
||||
var_dump(wincache_ucache_delete('foo'));
|
||||
|
||||
echo("setting \$foo\n");
|
||||
$foo = "FOO";
|
||||
|
||||
var_dump(wincache_ucache_add($foo, $bar));
|
||||
var_dump(wincache_ucache_add($foo, $bar));
|
||||
var_dump(wincache_ucache_get($foo));
|
||||
var_dump(wincache_ucache_set($foo, array('pink' => 9, 'chartruce' => '10', 'brown', 'magenta' => 'twelve')));
|
||||
var_dump(wincache_ucache_get($foo));
|
||||
var_dump(wincache_ucache_exists($foo));
|
||||
var_dump(wincache_ucache_info(false, $foo));
|
||||
var_dump(wincache_ucache_delete($foo));
|
||||
|
||||
echo("Done!");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting 'foo'
|
||||
bool(true)
|
||||
|
||||
Warning: wincache_ucache_add(): function called with a key which already exists in %s on line %d
|
||||
bool(false)
|
||||
array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
bool(true)
|
||||
array(4) {
|
||||
["pink"]=>
|
||||
int(9)
|
||||
["chartruce"]=>
|
||||
string(2) "10"
|
||||
[0]=>
|
||||
string(5) "brown"
|
||||
["magenta"]=>
|
||||
string(6) "twelve"
|
||||
}
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(1)
|
||||
["total_hit_count"]=>
|
||||
int(2)
|
||||
["total_miss_count"]=>
|
||||
int(0)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(3) "foo"
|
||||
["value_type"]=>
|
||||
string(5) "array"
|
||||
["value_size"]=>
|
||||
int(%d)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
setting $foo
|
||||
bool(true)
|
||||
|
||||
Warning: wincache_ucache_add(): function called with a key which already exists in %s on line %d
|
||||
bool(false)
|
||||
array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
bool(true)
|
||||
array(4) {
|
||||
["pink"]=>
|
||||
int(9)
|
||||
["chartruce"]=>
|
||||
string(2) "10"
|
||||
[0]=>
|
||||
string(5) "brown"
|
||||
["magenta"]=>
|
||||
string(6) "twelve"
|
||||
}
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(1)
|
||||
["total_hit_count"]=>
|
||||
int(4)
|
||||
["total_miss_count"]=>
|
||||
int(0)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(3) "FOO"
|
||||
["value_type"]=>
|
||||
string(5) "array"
|
||||
["value_size"]=>
|
||||
int(%d)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
Done!
|
||||
48
tests/wincache_ucache_errors.phpt
Normal file
48
tests/wincache_ucache_errors.phpt
Normal file
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* known-bad conditions
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting 'foo'\n");
|
||||
$bar = "BAR";
|
||||
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
$bar1 = wincache_ucache_get('foo');
|
||||
var_dump(wincache_ucache_delete('foo'));
|
||||
var_dump(wincache_ucache_exists('foo'));
|
||||
var_dump($bar1);
|
||||
|
||||
$bar = function($a) {
|
||||
return $a * 2;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
echo ("Done!");
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting 'foo'
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
string(3) "BAR"
|
||||
string(41) "Serialization of 'Closure' is not allowed"
|
||||
Done!
|
||||
265
tests/wincache_ucache_reference.phpt
Normal file
265
tests/wincache_ucache_reference.phpt
Normal file
@@ -0,0 +1,265 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* functions with IS_REFERENCE data
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting 'foo' with \$bar\n");
|
||||
$bar = "BAR";
|
||||
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
|
||||
echo("setting 'foo2' with reference to \$bar\n");
|
||||
$bar1 = &$bar;
|
||||
var_dump(wincache_ucache_add('foo2', $bar1));
|
||||
echo("\$bar = \"BAR++\"\n");
|
||||
$bar = "BAR++";
|
||||
echo("\$bar:\n");
|
||||
var_dump($bar);
|
||||
echo("\$bar1:\n");
|
||||
var_dump($bar1);
|
||||
echo("wincache_ucache_get('foo2'):\n");
|
||||
var_dump(wincache_ucache_get('foo2'));
|
||||
|
||||
/* And now, with arrays... */
|
||||
|
||||
$arr = array('green' => 5, 'Blue' => '6', 'yellow', 'cyan' => 'eight');
|
||||
$arr2 = &$arr;
|
||||
echo("wincache_ucache_add('foo3', \$arr2)");
|
||||
var_dump(wincache_ucache_add('foo3', $arr2));
|
||||
echo("wincache_ucache_get('foo3')");
|
||||
var_dump(wincache_ucache_get('foo3'));
|
||||
|
||||
/* update an element in the array, and push back into the user cache */
|
||||
$arr3 = wincache_ucache_get('foo3');
|
||||
echo("set \$arr3['green'] = 57\n");
|
||||
$arr3['green'] = 57;
|
||||
var_dump(wincache_ucache_set('foo3', $arr3));
|
||||
var_dump(wincache_ucache_get('foo3'));
|
||||
|
||||
/* bizzare reference problem: reference to an array element, and does it
|
||||
* change arrays that were copied from the original array?
|
||||
*/
|
||||
|
||||
$arr4 = array('pink' => 9, 'chartruce' => '10', 'brown', 'magenta' => 'twelve');
|
||||
|
||||
echo("\$my_ref = &\$arr4['chartruce']\n");
|
||||
$my_ref = &$arr4['chartruce'];
|
||||
echo("setting 'foo4' with \$arr4\n");
|
||||
var_dump(wincache_ucache_add('foo4', $arr4));
|
||||
echo("wincache_ucache_get('foo4'):\n");
|
||||
var_dump(wincache_ucache_get('foo4'));
|
||||
|
||||
/* Arrays with references to other things */
|
||||
$arr6 = array('black' => &$bar, 'black2' => &$bar1, 'gray' => &$arr, 'ref_to_arr' => &$arr2, 'midnight', 'dusk' => $arr3['Blue']);
|
||||
echo("Nasty arr6:\n");
|
||||
var_dump($arr6);
|
||||
var_dump(wincache_ucache_set('foo6', $arr6));
|
||||
echo("wincache_ucache_get('foo6'):\n");
|
||||
var_dump(wincache_ucache_get('foo6'));
|
||||
|
||||
/* modify complex array and set back on top of the same key */
|
||||
echo("\$arr6['gray']['Blue'] = 9\n");
|
||||
$arr6['gray']['Blue'] = 9;
|
||||
echo("Nasty arr6:\n");
|
||||
var_dump($arr6);
|
||||
|
||||
echo("wincache_ucache_get('foo6'):\n");
|
||||
var_dump(wincache_ucache_get('foo6'));
|
||||
|
||||
echo ("Done!");
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting 'foo' with $bar
|
||||
bool(true)
|
||||
setting 'foo2' with reference to $bar
|
||||
bool(true)
|
||||
$bar = "BAR++"
|
||||
$bar:
|
||||
string(5) "BAR++"
|
||||
$bar1:
|
||||
string(5) "BAR++"
|
||||
wincache_ucache_get('foo2'):
|
||||
string(3) "BAR"
|
||||
wincache_ucache_add('foo3', $arr2)bool(true)
|
||||
wincache_ucache_get('foo3')array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
set $arr3['green'] = 57
|
||||
bool(true)
|
||||
array(4) {
|
||||
["green"]=>
|
||||
int(57)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
$my_ref = &$arr4['chartruce']
|
||||
setting 'foo4' with $arr4
|
||||
bool(true)
|
||||
wincache_ucache_get('foo4'):
|
||||
array(4) {
|
||||
["pink"]=>
|
||||
int(9)
|
||||
["chartruce"]=>
|
||||
string(2) "10"
|
||||
[0]=>
|
||||
string(5) "brown"
|
||||
["magenta"]=>
|
||||
string(6) "twelve"
|
||||
}
|
||||
Nasty arr6:
|
||||
array(6) {
|
||||
["black"]=>
|
||||
&string(5) "BAR++"
|
||||
["black2"]=>
|
||||
&string(5) "BAR++"
|
||||
["gray"]=>
|
||||
&array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
["ref_to_arr"]=>
|
||||
&array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
[0]=>
|
||||
string(8) "midnight"
|
||||
["dusk"]=>
|
||||
string(1) "6"
|
||||
}
|
||||
bool(true)
|
||||
wincache_ucache_get('foo6'):
|
||||
array(6) {
|
||||
["black"]=>
|
||||
%string(5) "BAR++"
|
||||
["black2"]=>
|
||||
%string(5) "BAR++"
|
||||
["gray"]=>
|
||||
%srray(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
["ref_to_arr"]=>
|
||||
%srray(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
[0]=>
|
||||
string(8) "midnight"
|
||||
["dusk"]=>
|
||||
string(1) "6"
|
||||
}
|
||||
$arr6['gray']['Blue'] = 9
|
||||
Nasty arr6:
|
||||
array(6) {
|
||||
["black"]=>
|
||||
&string(5) "BAR++"
|
||||
["black2"]=>
|
||||
&string(5) "BAR++"
|
||||
["gray"]=>
|
||||
&array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
int(9)
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
["ref_to_arr"]=>
|
||||
&array(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
int(9)
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
[0]=>
|
||||
string(8) "midnight"
|
||||
["dusk"]=>
|
||||
string(1) "6"
|
||||
}
|
||||
wincache_ucache_get('foo6'):
|
||||
array(6) {
|
||||
["black"]=>
|
||||
%string(5) "BAR++"
|
||||
["black2"]=>
|
||||
%string(5) "BAR++"
|
||||
["gray"]=>
|
||||
%srray(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
["ref_to_arr"]=>
|
||||
%srray(4) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
[0]=>
|
||||
string(6) "yellow"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
[0]=>
|
||||
string(8) "midnight"
|
||||
["dusk"]=>
|
||||
string(1) "6"
|
||||
}
|
||||
Done!
|
||||
93
tests/wincache_ucache_serialization.phpt
Normal file
93
tests/wincache_ucache_serialization.phpt
Normal file
@@ -0,0 +1,93 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* functions with IS_OBJECT data
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
/* Setting a random function should fail */
|
||||
|
||||
$bar = function($a) {
|
||||
return $a * 2;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
/* Setting a user-defined class should work */
|
||||
|
||||
class Connection
|
||||
{
|
||||
private $dsn, $username, $password;
|
||||
|
||||
public function __construct($dsn, $username, $password)
|
||||
{
|
||||
$this->dsn = $dsn;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
return array('dsn', 'username', 'password');
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
echo 'waking up: ' . $this . "\n";
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->dsn . ':' . $this->username . ':*****';
|
||||
}
|
||||
}
|
||||
|
||||
$bar2 = new Connection('MyDsn', 'MyUsername', 'MyPassword');
|
||||
|
||||
try
|
||||
{
|
||||
var_dump(wincache_ucache_add('foo2', $bar2));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
$bar3 = wincache_ucache_get('foo2');
|
||||
echo "Fetched: {$bar3}\n";
|
||||
var_dump($bar3);
|
||||
|
||||
|
||||
echo("Done!");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
string(41) "Serialization of 'Closure' is not allowed"
|
||||
bool(true)
|
||||
waking up: MyDsn:MyUsername:*****
|
||||
Fetched: MyDsn:MyUsername:*****
|
||||
object(Connection)#4 (3) {
|
||||
["dsn":"Connection":private]=>
|
||||
string(5) "MyDsn"
|
||||
["username":"Connection":private]=>
|
||||
string(10) "MyUsername"
|
||||
["password":"Connection":private]=>
|
||||
string(10) "MyPassword"
|
||||
}
|
||||
Done!
|
||||
179
tests/wincache_ucache_set_array.phpt
Normal file
179
tests/wincache_ucache_set_array.phpt
Normal file
@@ -0,0 +1,179 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* functions with arrays of values
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting array\n");
|
||||
/*
|
||||
* NOTE: setting ucache entries via an array, if the value is not defined, then
|
||||
* the index is not added to the cache. So, 'yellow' below won't be added to
|
||||
* the WinCache ucache.
|
||||
*/
|
||||
$bar = array('green' => 5, 'Blue' => '6', 'yellow', 'cyan' => 'eight');
|
||||
|
||||
var_dump(wincache_ucache_add($bar, NULL));
|
||||
var_dump(wincache_ucache_add(array('green' => 13, 'black' => 14)));
|
||||
var_dump(wincache_ucache_get(array('green', 'Blue', 'cyan')));
|
||||
var_dump(wincache_ucache_get('yellow')); /* should be not found! */
|
||||
var_dump(wincache_ucache_set(array('green' => 9, 'Blue' => '10', 'yellow', 'cyan' => 'twelve')));
|
||||
var_dump(wincache_ucache_get('green'));
|
||||
var_dump(wincache_ucache_exists('green'));
|
||||
var_dump(wincache_ucache_info(false, 'green'));
|
||||
var_dump(wincache_ucache_delete(array('green', 'Blue', 'yellow', 'cyan')));
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting \$foo\n");
|
||||
$foo = array('green' => 5, 'Blue' => '6', 'yellow', 'cyan' => 'eight');
|
||||
$foo_get = array('green', 'Blue', 'cyan');
|
||||
|
||||
var_dump(wincache_ucache_add($foo, NULL));
|
||||
var_dump(wincache_ucache_add($foo, NULL));
|
||||
var_dump(wincache_ucache_get($foo_get));
|
||||
var_dump(wincache_ucache_set(array('green' => 9, 'pink' => 10, 'chartruce' => '11', 'brown', 'magenta' => 'thirteen')));
|
||||
var_dump(wincache_ucache_get($foo));
|
||||
var_dump(wincache_ucache_exists('pink'));
|
||||
var_dump(wincache_ucache_info(false, 'pink'));
|
||||
var_dump(wincache_ucache_delete($foo_get));
|
||||
|
||||
echo("Done!");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting array
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
["green"]=>
|
||||
int(-1)
|
||||
}
|
||||
array(3) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
int(9)
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(5)
|
||||
["total_hit_count"]=>
|
||||
int(4)
|
||||
["total_miss_count"]=>
|
||||
int(1)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(5) "green"
|
||||
["value_type"]=>
|
||||
string(4) "long"
|
||||
["value_size"]=>
|
||||
int(16)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(5) "green"
|
||||
[1]=>
|
||||
string(4) "Blue"
|
||||
[2]=>
|
||||
string(4) "cyan"
|
||||
}
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting $foo
|
||||
array(0) {
|
||||
}
|
||||
array(4) {
|
||||
["green"]=>
|
||||
int(-1)
|
||||
["Blue"]=>
|
||||
int(-1)
|
||||
[0]=>
|
||||
int(-1)
|
||||
["cyan"]=>
|
||||
int(-1)
|
||||
}
|
||||
array(3) {
|
||||
["green"]=>
|
||||
int(5)
|
||||
["Blue"]=>
|
||||
string(1) "6"
|
||||
["cyan"]=>
|
||||
string(5) "eight"
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(7)
|
||||
["total_hit_count"]=>
|
||||
int(7)
|
||||
["total_miss_count"]=>
|
||||
int(5)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(4) "pink"
|
||||
["value_type"]=>
|
||||
string(4) "long"
|
||||
["value_size"]=>
|
||||
int(16)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(5) "green"
|
||||
[1]=>
|
||||
string(4) "Blue"
|
||||
[2]=>
|
||||
string(4) "cyan"
|
||||
}
|
||||
Done!
|
||||
125
tests/wincache_ucache_string.phpt
Normal file
125
tests/wincache_ucache_string.phpt
Normal file
@@ -0,0 +1,125 @@
|
||||
--TEST--
|
||||
Wincache - Testing wincache_ucache_* functions with simple strings
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
wincache.enablecli=1
|
||||
wincache.fcenabled=1
|
||||
wincache.ucenabled=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo("clearing ucache\n");
|
||||
var_dump(wincache_ucache_clear());
|
||||
|
||||
echo("setting 'foo'\n");
|
||||
$bar = "BAR";
|
||||
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
var_dump(wincache_ucache_add('foo', $bar));
|
||||
var_dump(wincache_ucache_get('foo'));
|
||||
var_dump(wincache_ucache_set('foo', 'BAR2'));
|
||||
var_dump(wincache_ucache_get('foo'));
|
||||
var_dump(wincache_ucache_exists('foo'));
|
||||
var_dump(wincache_ucache_info(false, 'foo'));
|
||||
var_dump(wincache_ucache_delete('foo'));
|
||||
|
||||
echo("setting \$foo\n");
|
||||
$foo = "FOO";
|
||||
|
||||
var_dump(wincache_ucache_add($foo, $bar));
|
||||
var_dump(wincache_ucache_add($foo, $bar));
|
||||
var_dump(wincache_ucache_get($foo));
|
||||
var_dump(wincache_ucache_set($foo, 'BAR2'));
|
||||
var_dump(wincache_ucache_get($foo));
|
||||
var_dump(wincache_ucache_exists($foo));
|
||||
var_dump(wincache_ucache_info(false, $foo));
|
||||
var_dump(wincache_ucache_delete($foo));
|
||||
|
||||
echo("Done!");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
clearing ucache
|
||||
bool(true)
|
||||
setting 'foo'
|
||||
bool(true)
|
||||
|
||||
Warning: wincache_ucache_add(): function called with a key which already exists in %swincache_ucache_string.php on line %d
|
||||
bool(false)
|
||||
string(3) "BAR"
|
||||
bool(true)
|
||||
string(4) "BAR2"
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(1)
|
||||
["total_hit_count"]=>
|
||||
int(2)
|
||||
["total_miss_count"]=>
|
||||
int(0)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(3) "foo"
|
||||
["value_type"]=>
|
||||
string(6) "string"
|
||||
["value_size"]=>
|
||||
int(%d)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
setting $foo
|
||||
bool(true)
|
||||
|
||||
Warning: wincache_ucache_add(): function called with a key which already exists in %swincache_ucache_string.php on line %d
|
||||
bool(false)
|
||||
string(3) "BAR"
|
||||
bool(true)
|
||||
string(4) "BAR2"
|
||||
bool(true)
|
||||
array(6) {
|
||||
["total_cache_uptime"]=>
|
||||
int(0)
|
||||
["is_local_cache"]=>
|
||||
bool(false)
|
||||
["total_item_count"]=>
|
||||
int(1)
|
||||
["total_hit_count"]=>
|
||||
int(4)
|
||||
["total_miss_count"]=>
|
||||
int(0)
|
||||
["ucache_entries"]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
array(6) {
|
||||
["key_name"]=>
|
||||
string(3) "FOO"
|
||||
["value_type"]=>
|
||||
string(6) "string"
|
||||
["value_size"]=>
|
||||
int(%d)
|
||||
["ttl_seconds"]=>
|
||||
int(0)
|
||||
["age_seconds"]=>
|
||||
int(0)
|
||||
["hitcount"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
Done!
|
||||
194
wincache.php
194
wincache.php
@@ -91,7 +91,6 @@ if ( USE_AUTHENTICATION == 1 ) {
|
||||
define('IMG_WIDTH', 320);
|
||||
define('IMG_HEIGHT', 220);
|
||||
define('SUMMARY_DATA', 1);
|
||||
define('OCACHE_DATA', 2); // Opcode cache
|
||||
define('FCACHE_DATA', 3); // File cache
|
||||
define('UCACHE_DATA', 4); // User cache
|
||||
define('SCACHE_DATA', 5); // Session cache
|
||||
@@ -115,7 +114,7 @@ if ( !is_numeric( $page ) || $page < SUMMARY_DATA || $page > RCACHE_DATA )
|
||||
$img = 0;
|
||||
if ( isset( $_GET['img'] ) && is_numeric( $_GET['img'] ) ) {
|
||||
$img = $_GET['img'];
|
||||
if ( $img < OCACHE_DATA || $img > SCACHE_DATA)
|
||||
if ( $img < FCACHE_DATA || $img > RCACHE_DATA)
|
||||
$img = 0;
|
||||
}
|
||||
$chart_type = BAR_CHART;
|
||||
@@ -163,9 +162,6 @@ if ( isset( $_GET['key'] ) )
|
||||
// Initialize global variables
|
||||
$user_cache_available = function_exists('wincache_ucache_info') && !strcmp( ini_get( 'wincache.ucenabled' ), "1" );
|
||||
$session_cache_available = function_exists('wincache_scache_info') && !strcasecmp( ini_get( 'session.save_handler' ), "wincache" );
|
||||
$ocache_mem_info = null;
|
||||
$ocache_file_info = null;
|
||||
$ocache_summary_info = null;
|
||||
$fcache_mem_info = null;
|
||||
$fcache_file_info = null;
|
||||
$fcache_summary_info = null;
|
||||
@@ -262,21 +258,6 @@ function get_trimmed_ini_value( $input, $max_len, $separators = array('|', ',')
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_ocache_summary( $entries ) {
|
||||
$result = array();
|
||||
$result['total_classes'] = 0;
|
||||
$result['total_functions'] = 0;
|
||||
$result['oldest_entry'] = '';
|
||||
$result['recent_entry'] = '';
|
||||
|
||||
if ( isset( $entries ) && count( $entries ) > 0 && isset( $entries[1]['file_name'] ) ) {
|
||||
foreach ( (array)$entries as $entry ) {
|
||||
$result['total_classes'] += $entry['class_count'];
|
||||
$result['total_functions'] += $entry['function_count'];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
function get_fcache_summary( $entries ) {
|
||||
$result = array();
|
||||
$result['total_size'] = 0;
|
||||
@@ -291,22 +272,12 @@ function get_fcache_summary( $entries ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_ocache_size_markup( $size ) {
|
||||
$size_string = convert_bytes_to_string( $size );
|
||||
|
||||
if ( $size > ( ini_get( 'wincache.ocachesize' ) * pow( 1024, 2 ) ) ) {
|
||||
return '<td class="n" title="The opcode cache size has been automatically increased to be at least 3 times bigger than file cache size.">'.$size_string.'</td>';
|
||||
}
|
||||
|
||||
return '<td class="v">'.$size_string.'</td>';
|
||||
}
|
||||
|
||||
function get_chart_title( $chart_data )
|
||||
{
|
||||
$chart_title = '';
|
||||
switch( $chart_data ) {
|
||||
case OCACHE_DATA: {
|
||||
$chart_title = 'Opcode Cache';
|
||||
case RCACHE_DATA: {
|
||||
$chart_title = 'Resolve Cache';
|
||||
break;
|
||||
}
|
||||
case FCACHE_DATA: {
|
||||
@@ -557,7 +528,7 @@ if ( $img > 0 ) {
|
||||
}
|
||||
|
||||
function get_chart_markup( $data_type, $chart_type, $chart_param1, $chart_param2 ) {
|
||||
global $PHP_SELF;
|
||||
global $PHP_SELF;
|
||||
|
||||
$result = '';
|
||||
$alt_title = '';
|
||||
@@ -593,10 +564,7 @@ function cache_scope_text( $is_local )
|
||||
|
||||
function init_cache_info( $cache_data = SUMMARY_DATA )
|
||||
{
|
||||
global $ocache_mem_info,
|
||||
$ocache_file_info,
|
||||
$ocache_summary_info,
|
||||
$fcache_mem_info,
|
||||
global $fcache_mem_info,
|
||||
$fcache_file_info,
|
||||
$fcache_summary_info,
|
||||
$rpcache_mem_info,
|
||||
@@ -608,11 +576,6 @@ function init_cache_info( $cache_data = SUMMARY_DATA )
|
||||
$user_cache_available,
|
||||
$session_cache_available;
|
||||
|
||||
if ( $cache_data == SUMMARY_DATA || $cache_data == OCACHE_DATA ) {
|
||||
$ocache_mem_info = wincache_ocache_meminfo();
|
||||
$ocache_file_info = wincache_ocache_fileinfo();
|
||||
$ocache_summary_info = get_ocache_summary( $ocache_file_info['file_entries'] );
|
||||
}
|
||||
if ( $cache_data == SUMMARY_DATA || $cache_data == FCACHE_DATA ) {
|
||||
$fcache_mem_info = wincache_fcache_meminfo();
|
||||
$fcache_file_info = wincache_fcache_fileinfo();
|
||||
@@ -811,7 +774,6 @@ th {
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li <?php echo ($page == SUMMARY_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', SUMMARY_DATA; ?>">Summary</a></li>
|
||||
<li <?php echo ($page == OCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', OCACHE_DATA; ?>">Opcode Cache</a></li>
|
||||
<li <?php echo ($page == FCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', FCACHE_DATA; ?>">File System Cache</a></li>
|
||||
<li <?php echo ($page == UCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', UCACHE_DATA; ?>">User Cache</a></li>
|
||||
<li <?php echo ($page == SCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', SCACHE_DATA; ?>">Session Cache</a></li>
|
||||
@@ -906,61 +868,6 @@ foreach ( ini_get_all( 'wincache' ) as $ini_name => $ini_value) {
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview">
|
||||
<div class="leftpanel extra_margin">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th colspan="2">Opcode Cache Overview</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cache scope</td>
|
||||
<td class="v"><?php echo ( isset( $ocache_file_info['is_local_cache'] ) ) ? cache_scope_text( $ocache_file_info['is_local_cache'] ) : 'Unknown'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cache uptime</td>
|
||||
<td class="v"><?php echo ( isset( $ocache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $ocache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cached files</td>
|
||||
<td class="v"><a href="<?php echo $PHP_SELF, '?page=', OCACHE_DATA, '#filelist'; ?>"><?php echo $ocache_file_info['total_file_count']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Hits</td>
|
||||
<td class="v"><?php echo $ocache_file_info['total_hit_count']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Misses</td>
|
||||
<td class="v"><?php echo $ocache_file_info['total_miss_count']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Total memory</td>
|
||||
<?php echo get_ocache_size_markup( $ocache_mem_info['memory_total'] ); ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Available memory</td>
|
||||
<td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_free'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Memory overhead</td>
|
||||
<td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_overhead'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Number of functions</td>
|
||||
<td class="v"><?php echo $ocache_summary_info['total_functions']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Number of classes</td>
|
||||
<td class="v"><?php echo $ocache_summary_info['total_classes']; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="rightpanel">
|
||||
<?php echo get_chart_markup( OCACHE_DATA, BAR_CHART, $ocache_file_info['total_hit_count'], $ocache_file_info['total_miss_count'] ); ?>
|
||||
</div>
|
||||
<div class="rightpanel">
|
||||
<?php echo get_chart_markup( OCACHE_DATA, PIE_CHART, $ocache_mem_info['memory_total'] - $ocache_mem_info['memory_free'], $ocache_mem_info['memory_free'] ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview">
|
||||
<div class="leftpanel extra_margin">
|
||||
<table style="width: 100%">
|
||||
@@ -1131,95 +1038,6 @@ foreach ( ini_get_all( 'wincache' ) as $ini_name => $ini_value) {
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else if ( $page == OCACHE_DATA ) {
|
||||
init_cache_info( OCACHE_DATA );
|
||||
?>
|
||||
<div class="overview">
|
||||
<div class="leftpanel extra_margin">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th colspan="2">Opcode Cache Overview</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cache scope</td>
|
||||
<td class="v"><?php echo ( isset( $ocache_file_info['is_local_cache'] ) ) ? cache_scope_text( $ocache_file_info['is_local_cache'] ) : 'Unknown'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cache uptime</td>
|
||||
<td class="v"><?php echo ( isset( $ocache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $ocache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Cached files</td>
|
||||
<td class="v"><?php echo $ocache_file_info['total_file_count']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Hits</td>
|
||||
<td class="v"><?php echo $ocache_file_info['total_hit_count']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Misses</td>
|
||||
<td class="v"><?php echo $ocache_file_info['total_miss_count']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Total memory</td>
|
||||
<?php echo get_ocache_size_markup( $ocache_mem_info['memory_total'] ); ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Available memory</td>
|
||||
<td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_free'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Memory overhead</td>
|
||||
<td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_overhead'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Number of functions</td>
|
||||
<td class="v"><?php echo $ocache_summary_info['total_functions']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Number of classes</td>
|
||||
<td class="v"><?php echo $ocache_summary_info['total_classes']; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="rightpanel">
|
||||
<?php echo get_chart_markup( OCACHE_DATA, BAR_CHART, $ocache_file_info['total_hit_count'], $ocache_file_info['total_miss_count'] ); ?>
|
||||
</div>
|
||||
<div class="rightpanel">
|
||||
<?php echo get_chart_markup( OCACHE_DATA, PIE_CHART, $ocache_mem_info['memory_total'] - $ocache_mem_info['memory_free'], $ocache_mem_info['memory_free'] ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" id="filelist">
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<th colspan="7">Opcode cache entries</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th title="Name of the file">File name</th>
|
||||
<th title="Number of PHP functions in the file">Function count</th>
|
||||
<th title="Number of PHP classes in the file">Class count</th>
|
||||
<th title="Indicates total amount of time in seconds for which the file has been in the cache">Add time</th>
|
||||
<th title="Total amount of time in seconds which has elapsed since the file was last used">Use time</th>
|
||||
<th title="Indicates total amount of time in seconds which has elapsed since the file was last checked for file change">Last check</th>
|
||||
<th title="Number of times cache has been hit">Hit count</th>
|
||||
</tr>
|
||||
<?php
|
||||
$sort_key = 'file_name';
|
||||
usort( $ocache_file_info['file_entries'], 'cmp' );
|
||||
foreach ( $ocache_file_info['file_entries'] as $entry ) {
|
||||
echo '<tr title="', $entry['file_name'] ,'">', "\n";
|
||||
echo '<td class="e">', get_trimmed_filename( $entry['file_name'], PATH_MAX_LENGTH ),'</td>', "\n";
|
||||
echo '<td class="v">', $entry['function_count'],'</td>', "\n";
|
||||
echo '<td class="v">', $entry['class_count'],'</td>', "\n";
|
||||
echo '<td class="v">', $entry['add_time'],'</td>', "\n";
|
||||
echo '<td class="v">', $entry['use_time'],'</td>', "\n";
|
||||
echo '<td class="v">', $entry['last_check'],'</td>', "\n";
|
||||
echo '<td class="v">', $entry['hit_count'],'</td>', "\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<?php } else if ( $page == FCACHE_DATA ) {
|
||||
init_cache_info( FCACHE_DATA );
|
||||
?>
|
||||
@@ -1322,7 +1140,7 @@ foreach ( ini_get_all( 'wincache' ) as $ini_name => $ini_value) {
|
||||
<td class="v"><?php echo $ucache_info['total_item_count'];
|
||||
if ( USE_AUTHENTICATION && $ucache_info['total_item_count'] > 0 )
|
||||
echo ' (<a href="', $PHP_SELF, '?page=', UCACHE_DATA, '&clc=1">Clear All</a>)'; ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="e">Hits</td>
|
||||
|
||||
@@ -541,7 +541,7 @@ static void * alloc_realloc(alloc_context * palloc, unsigned int type, void * ad
|
||||
static char * alloc_strdup(alloc_context * palloc, unsigned int type, const char * str)
|
||||
{
|
||||
char * result = NULL;
|
||||
int strl = 0;
|
||||
size_t strl = 0;
|
||||
|
||||
_ASSERT(str != NULL);
|
||||
strl = strlen(str) + 1;
|
||||
@@ -650,7 +650,7 @@ void alloc_destroy(alloc_context * palloc)
|
||||
|
||||
/* initmemory should be 1 for all non file backed shared memory allocators and 0 */
|
||||
/* for file backed shared memory allocators when filemap->existing is set to 1 */
|
||||
int alloc_initialize(alloc_context * palloc, unsigned short islocal, char * name, unsigned short cachekey, void * staddr, size_t size, unsigned char initmemory TSRMLS_DC)
|
||||
int alloc_initialize(alloc_context * palloc, unsigned short islocal, char * name, unsigned short cachekey, void * staddr, size_t size, unsigned char initmemory)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned short locktype = LOCK_TYPE_SHARED;
|
||||
@@ -688,7 +688,7 @@ int alloc_initialize(alloc_context * palloc, unsigned short islocal, char * name
|
||||
palloc->islocal = islocal;
|
||||
}
|
||||
|
||||
result = lock_initialize(palloc->rwlock, name, cachekey, locktype, LOCK_USET_XREAD_XWRITE, NULL TSRMLS_CC);
|
||||
result = lock_initialize(palloc->rwlock, name, cachekey, locktype, LOCK_USET_XREAD_XWRITE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1348,7 +1348,7 @@ char * alloc_osstrdup(alloc_context * palloc, size_t hoffset, const char * str)
|
||||
char * alloc_omstrdup(alloc_context * palloc, size_t hoffset, const char * str)
|
||||
{
|
||||
char * memaddr = NULL;
|
||||
int strl = 0;
|
||||
size_t strl = 0;
|
||||
|
||||
_ASSERT(palloc != NULL);
|
||||
_ASSERT(hoffset > 0);
|
||||
@@ -1407,7 +1407,6 @@ void alloc_runtest()
|
||||
alloc_free_header * freeh = NULL;
|
||||
alloc_used_header * usedh = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("*** STARTING ALLOC TESTS ***");
|
||||
|
||||
memaddr = malloc(4096);
|
||||
@@ -1423,7 +1422,7 @@ void alloc_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = alloc_initialize(palloc, islocal, "ALLOC_TEST", 1, memaddr, 4096, 1 TSRMLS_CC);
|
||||
result = alloc_initialize(palloc, islocal, "ALLOC_TEST", 1, memaddr, 4096, 1);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
|
||||
@@ -139,7 +139,7 @@ struct alloc_info
|
||||
|
||||
extern int alloc_create(alloc_context ** ppalloc);
|
||||
extern void alloc_destroy(alloc_context * palloc);
|
||||
extern int alloc_initialize(alloc_context * palloc, unsigned short islocal, char * name, unsigned short cachekey, void * staddr, size_t size, unsigned char initmemory TSRMLS_DC);
|
||||
extern int alloc_initialize(alloc_context * palloc, unsigned short islocal, char * name, unsigned short cachekey, void * staddr, size_t size, unsigned char initmemory);
|
||||
extern void alloc_terminate(alloc_context * palloc);
|
||||
extern int alloc_create_mpool(alloc_context * palloc, size_t * phoffset);
|
||||
extern void alloc_free_mpool(alloc_context * palloc, size_t hoffset);
|
||||
|
||||
@@ -56,7 +56,7 @@ static void add_aplist_entry(aplist_context * pcache, unsigned int index, aplist
|
||||
static void remove_aplist_entry(aplist_context * pcache, unsigned int index, aplist_value * pvalue);
|
||||
static void delete_aplist_fileentry(aplist_context * pcache, const char * filename);
|
||||
static void run_aplist_scavenger(aplist_context * pcache, unsigned char ffull);
|
||||
static int set_lastcheck_time(aplist_context * pcache, const char * filename, unsigned int newvalue TSRMLS_DC);
|
||||
static int set_lastcheck_time(aplist_context * pcache, const char * filename, unsigned int newvalue);
|
||||
|
||||
/* Globals */
|
||||
unsigned short glcacheid = 1;
|
||||
@@ -96,7 +96,7 @@ static int find_aplist_entry(aplist_context * pcache, const char * filename, uns
|
||||
/* If this process is good to delete the opcode */
|
||||
/* cache data tell caller to delete it */
|
||||
if(ppdelete != NULL && *ppdelete == NULL &&
|
||||
pcache->apctype == APLIST_TYPE_GLOBAL && pcache->pocache != NULL && pcache->polocal == NULL)
|
||||
pcache->apctype == APLIST_TYPE_GLOBAL)
|
||||
{
|
||||
*ppdelete = pvalue;
|
||||
}
|
||||
@@ -246,14 +246,13 @@ static int create_aplist_data(aplist_context * pcache, const char * filename, ap
|
||||
char * filepath = NULL;
|
||||
|
||||
HANDLE hFile = INVALID_HANDLE_VALUE;
|
||||
unsigned int filesizel = 0;
|
||||
unsigned int filesizeh = 0;
|
||||
LARGE_INTEGER li = { 0 };
|
||||
unsigned int openflags = 0;
|
||||
BY_HANDLE_FILE_INFORMATION finfo;
|
||||
aplist_value * pvalue = NULL;
|
||||
|
||||
unsigned int flength = 0;
|
||||
unsigned int alloclen = 0;
|
||||
size_t flength = 0;
|
||||
size_t alloclen = 0;
|
||||
char * pbaseadr = NULL;
|
||||
char * pcurrent = NULL;
|
||||
|
||||
@@ -323,8 +322,7 @@ static int create_aplist_data(aplist_context * pcache, const char * filename, ap
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
filesizel = GetFileSize(hFile, &filesizeh);
|
||||
if(filesizel == INVALID_FILE_SIZE)
|
||||
if(0 == GetFileSizeEx(hFile, &li))
|
||||
{
|
||||
error_setlasterror();
|
||||
result = FATAL_FCACHE_GETFILESIZE;
|
||||
@@ -332,8 +330,11 @@ static int create_aplist_data(aplist_context * pcache, const char * filename, ap
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
/* File sizes greater than 4096MB not allowed */
|
||||
_ASSERT(filesizeh == 0);
|
||||
/* Fail if file is larger than 4GB */
|
||||
if (li.HighPart != 0)
|
||||
{
|
||||
result = FATAL_FCACHE_FILE_TOO_BIG;
|
||||
}
|
||||
|
||||
if(!GetFileInformationByHandle(hFile, &finfo))
|
||||
{
|
||||
@@ -353,7 +354,7 @@ static int create_aplist_data(aplist_context * pcache, const char * filename, ap
|
||||
*(pcurrent + flength) = 0;
|
||||
pvalue->file_path = pcurrent - pcache->apmemaddr;
|
||||
|
||||
pvalue->file_size = filesizel;
|
||||
pvalue->file_size = li.LowPart;
|
||||
pvalue->modified_time = finfo.ftLastWriteTime;
|
||||
pvalue->attributes = finfo.dwFileAttributes;
|
||||
|
||||
@@ -365,7 +366,6 @@ static int create_aplist_data(aplist_context * pcache, const char * filename, ap
|
||||
pvalue->is_changed = 0;
|
||||
|
||||
pvalue->fcacheval = 0;
|
||||
pvalue->ocacheval = 0;
|
||||
pvalue->resentry = 0;
|
||||
pvalue->fcnotify = 0;
|
||||
pvalue->fcncount = 0;
|
||||
@@ -423,11 +423,10 @@ static void destroy_aplist_data(aplist_context * pcache, aplist_value * pvalue)
|
||||
fcnotify_close(pcache->pnotify, &pvalue->fcnotify, &pvalue->fcncount);
|
||||
}
|
||||
|
||||
/* Resolve path cache, file cache and ocache entries */
|
||||
/* Resolve path cache and file cache entries */
|
||||
/* should be deleted by a call to remove_aplist_entry */
|
||||
_ASSERT(pvalue->resentry == 0);
|
||||
_ASSERT(pvalue->fcacheval == 0);
|
||||
_ASSERT(pvalue->ocacheval == 0);
|
||||
|
||||
alloc_sfree(pcache->apalloc, pvalue);
|
||||
pvalue = NULL;
|
||||
@@ -488,7 +487,6 @@ static void remove_aplist_entry(aplist_context * pcache, unsigned int index, apl
|
||||
aplist_header * header = NULL;
|
||||
aplist_value * ptemp = NULL;
|
||||
fcache_value * pfvalue = NULL;
|
||||
ocache_value * povalue = NULL;
|
||||
|
||||
dprintverbose("start remove_aplist_entry");
|
||||
|
||||
@@ -496,22 +494,6 @@ static void remove_aplist_entry(aplist_context * pcache, unsigned int index, apl
|
||||
_ASSERT(pvalue != NULL);
|
||||
_ASSERT(pvalue->file_path != 0);
|
||||
|
||||
/* If entry from global cache is removed by a process which has */
|
||||
/* a local cache, mark the entry deleted but do not delete it */
|
||||
if(pcache->apctype == APLIST_TYPE_GLOBAL && pcache->pocache == NULL && pcache->polocal != NULL)
|
||||
{
|
||||
/* Mark resolve path entries deleted so that it rplist stop */
|
||||
/* handing pointer to aplist entries which are marked deleted */
|
||||
if(pvalue->resentry != 0)
|
||||
{
|
||||
_ASSERT(pcache->prplist != NULL);
|
||||
rplist_markdeleted(pcache->prplist, pvalue->resentry);
|
||||
}
|
||||
|
||||
pvalue->is_deleted = 1;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
/* Delete resolve path cache entries */
|
||||
if(pvalue->resentry != 0)
|
||||
{
|
||||
@@ -537,22 +519,6 @@ static void remove_aplist_entry(aplist_context * pcache, unsigned int index, apl
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete opcode cache entry */
|
||||
if(pvalue->ocacheval != 0)
|
||||
{
|
||||
_ASSERT(pcache->pocache != NULL);
|
||||
povalue = ocache_getvalue(pcache->pocache, pvalue->ocacheval);
|
||||
|
||||
InterlockedExchange(&povalue->is_deleted, 1);
|
||||
pvalue->ocacheval = 0;
|
||||
|
||||
if(InterlockedCompareExchange(&povalue->refcount, 0, 0) == 0)
|
||||
{
|
||||
ocache_destroyval(pcache->pocache, povalue);
|
||||
povalue = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
apalloc = pcache->apalloc;
|
||||
header = pcache->apheader;
|
||||
|
||||
@@ -579,12 +545,10 @@ static void remove_aplist_entry(aplist_context * pcache, unsigned int index, apl
|
||||
}
|
||||
}
|
||||
|
||||
/* Destroy aplist data now that fcache and ocache is deleted */
|
||||
/* Destroy aplist data now that fcache is deleted */
|
||||
destroy_aplist_data(pcache, pvalue);
|
||||
pvalue = NULL;
|
||||
|
||||
Finished:
|
||||
|
||||
dprintverbose("end remove_aplist_entry");
|
||||
return;
|
||||
}
|
||||
@@ -720,7 +684,6 @@ int aplist_create(aplist_context ** ppcache)
|
||||
pcache->prplist = NULL;
|
||||
pcache->pnotify = NULL;
|
||||
pcache->pfcache = NULL;
|
||||
pcache->pocache = NULL;
|
||||
pcache->resnumber = -1;
|
||||
|
||||
*ppcache = pcache;
|
||||
@@ -752,10 +715,10 @@ void aplist_destroy(aplist_context * pcache)
|
||||
return;
|
||||
}
|
||||
|
||||
int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned int filecount, unsigned int fchangefreq, unsigned int ttlmax TSRMLS_DC)
|
||||
int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned int filecount, unsigned int fchangefreq, unsigned int ttlmax)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
size_t mapsize = 0;
|
||||
unsigned int mapsize = 0;
|
||||
size_t segsize = 0;
|
||||
aplist_header * header = NULL;
|
||||
unsigned int msize = 0;
|
||||
@@ -774,7 +737,6 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
dprintverbose("start aplist_initialize");
|
||||
|
||||
_ASSERT(pcache != NULL);
|
||||
_ASSERT(apctype == APLIST_TYPE_GLOBAL || apctype == APLIST_TYPE_OPCODE_LOCAL);
|
||||
_ASSERT(filecount >= NUM_FILES_MINIMUM && filecount <= NUM_FILES_MAXIMUM);
|
||||
_ASSERT((fchangefreq >= FCHECK_FREQ_MINIMUM && fchangefreq <= FCHECK_FREQ_MAXIMUM) || fchangefreq == 0);
|
||||
_ASSERT((ttlmax >= TTL_VALUE_MINIMUM && ttlmax <= TTL_VALUE_MAXIMUM) || ttlmax == 0);
|
||||
@@ -786,7 +748,7 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
/* Disable scavenger if opcode cache is local only */
|
||||
/* Or if ttlmax value is set to 0 */
|
||||
pcache->scstatus = SCAVENGER_STATUS_ACTIVE;
|
||||
if(pcache->apctype == APLIST_TYPE_OPCODE_LOCAL || ttlmax == 0)
|
||||
if(ttlmax == 0)
|
||||
{
|
||||
pcache->scstatus = SCAVENGER_STATUS_INACTIVE;
|
||||
}
|
||||
@@ -823,14 +785,14 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
islocked = 1;
|
||||
|
||||
/* shmfilepath = NULL to make it use page file */
|
||||
result = filemap_initialize(pcache->apfilemap, FILEMAP_TYPE_FILELIST, cachekey, mapclass, mapsize, isfirst, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pcache->apfilemap, FILEMAP_TYPE_FILELIST, cachekey, mapclass, mapsize, isfirst, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pcache->apmemaddr = (char *)pcache->apfilemap->mapaddr;
|
||||
segsize = filemap_getsize(pcache->apfilemap TSRMLS_CC);
|
||||
segsize = filemap_getsize(pcache->apfilemap);
|
||||
initmemory = (pcache->apfilemap->existing == 0);
|
||||
|
||||
/* Create allocator for file list segment */
|
||||
@@ -841,7 +803,7 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
}
|
||||
|
||||
/* initmemory = 1 for all page file backed shared memory allocators */
|
||||
result = alloc_initialize(pcache->apalloc, pcache->islocal, "FILELIST_SEGMENT", cachekey, pcache->apfilemap->mapaddr, segsize, 1 TSRMLS_CC);
|
||||
result = alloc_initialize(pcache->apalloc, pcache->islocal, "FILELIST_SEGMENT", cachekey, pcache->apfilemap->mapaddr, segsize, 1);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -865,7 +827,7 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = lock_initialize(pcache->aprwlock, "FILELIST_CACHE", cachekey, locktype, LOCK_USET_SREAD_XWRITE, &header->rdcount TSRMLS_CC);
|
||||
result = lock_initialize(pcache->aprwlock, "FILELIST_CACHE", cachekey, locktype, LOCK_USET_SREAD_XWRITE, &header->rdcount);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -880,7 +842,7 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = rplist_initialize(pcache->prplist, pcache->islocal, isfirst, cachekey, filecount TSRMLS_CC);
|
||||
result = rplist_initialize(pcache->prplist, pcache->islocal, isfirst, cachekey, filecount);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -897,7 +859,7 @@ int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned
|
||||
|
||||
/* Number of folders on which listeners will be active will */
|
||||
/* be very small. Using filecount as 32 so that scavenger is quick */
|
||||
result = fcnotify_initialize(pcache->pnotify, pcache->islocal, pcache, pcache->apalloc, 32 TSRMLS_CC);
|
||||
result = fcnotify_initialize(pcache->pnotify, pcache->islocal, pcache, pcache->apalloc, 32);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1045,7 +1007,7 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_fcache_initialize(aplist_context * plcache, unsigned int size, unsigned int maxfilesize TSRMLS_DC)
|
||||
int aplist_fcache_initialize(aplist_context * plcache, unsigned int size, unsigned int maxfilesize)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
fcache_context * pfcache = NULL;
|
||||
@@ -1060,7 +1022,7 @@ int aplist_fcache_initialize(aplist_context * plcache, unsigned int size, unsign
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = fcache_initialize(pfcache, plcache->islocal, 1, size, maxfilesize TSRMLS_CC);
|
||||
result = fcache_initialize(pfcache, plcache->islocal, 1, size, maxfilesize);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1090,133 +1052,6 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_ocache_initialize(aplist_context * plcache, int resnumber, unsigned int size TSRMLS_DC)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
ocache_context * pocache = NULL;
|
||||
HANDLE hfirst = NULL;
|
||||
unsigned char isfirst = 1;
|
||||
unsigned char islocked = 0;
|
||||
|
||||
unsigned int count = 0;
|
||||
aplist_value * pvalue = NULL;
|
||||
unsigned int index = 0;
|
||||
size_t offset = 0;
|
||||
DWORD ret = 0;
|
||||
|
||||
dprintverbose("start aplist_ocache_initialize");
|
||||
|
||||
_ASSERT(plcache != NULL);
|
||||
|
||||
if(!plcache->islocal)
|
||||
{
|
||||
result = utils_create_init_event(plcache->aprwlock->nameprefix, "GLOBAL_OCACHE_FINIT", &hfirst, &isfirst);
|
||||
if (FAILED(result))
|
||||
{
|
||||
result = FATAL_APLIST_OCACHE_INIT_EVENT;
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
islocked = 1;
|
||||
|
||||
result = ocache_create(&pocache);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = ocache_initialize(pocache, plcache->islocal, 1, resnumber, size TSRMLS_CC);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if(!plcache->islocal && isfirst)
|
||||
{
|
||||
_ASSERT(hfirst != NULL);
|
||||
|
||||
/* A new opcode cache is created for global aplist. It is possible that */
|
||||
/* global aplist is old with obsolete ocacheval offsets. Set ocachevals to 0 */
|
||||
lock_writelock(plcache->aprwlock);
|
||||
|
||||
count = plcache->apheader->valuecount;
|
||||
for(index = 0; index < count; index++)
|
||||
{
|
||||
offset = plcache->apheader->values[index];
|
||||
if(offset == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pvalue = (aplist_value *)alloc_get_cachevalue(plcache->apalloc, offset);
|
||||
while(pvalue != NULL)
|
||||
{
|
||||
pvalue->ocacheval = 0;
|
||||
|
||||
offset = pvalue->next_value;
|
||||
if(offset == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pvalue = (aplist_value *)alloc_get_cachevalue(plcache->apalloc, offset);
|
||||
}
|
||||
}
|
||||
|
||||
lock_writeunlock(plcache->aprwlock);
|
||||
|
||||
/* Set the event now that ocacheval is set to 0 */
|
||||
ReleaseMutex(hfirst);
|
||||
islocked = 0;
|
||||
}
|
||||
|
||||
plcache->resnumber = resnumber;
|
||||
plcache->pocache = pocache;
|
||||
|
||||
_ASSERT(SUCCEEDED(result));
|
||||
|
||||
Finished:
|
||||
|
||||
if (islocked)
|
||||
{
|
||||
ReleaseMutex(hfirst);
|
||||
islocked = 0;
|
||||
}
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in aplist_ocache_initialize", result);
|
||||
|
||||
/* Make sure process with local cache doesn't increment */
|
||||
/* refcount of named object created above */
|
||||
if(hfirst != NULL)
|
||||
{
|
||||
CloseHandle(hfirst);
|
||||
hfirst = NULL;
|
||||
}
|
||||
|
||||
if(pocache != NULL)
|
||||
{
|
||||
ocache_terminate(pocache);
|
||||
ocache_destroy(pocache);
|
||||
|
||||
pocache = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: We're leaking the hfirst handle if we succeed. Must Fix!
|
||||
* TODO: We MUST keep the hfirst handle alive for the lifetime of the
|
||||
* process, otherwise other instances might erroneously believe they're
|
||||
* 'first', and wipe out the cache.
|
||||
*/
|
||||
|
||||
dprintverbose("end aplist_ocache_initialize");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void aplist_terminate(aplist_context * pcache)
|
||||
{
|
||||
dprintverbose("start aplist_terminate");
|
||||
@@ -1255,15 +1090,6 @@ void aplist_terminate(aplist_context * pcache)
|
||||
pcache->pfcache = NULL;
|
||||
}
|
||||
|
||||
if(pcache->pocache != NULL)
|
||||
{
|
||||
ocache_terminate(pcache->pocache);
|
||||
ocache_destroy(pcache->pocache);
|
||||
|
||||
pcache->pocache = NULL;
|
||||
pcache->resnumber = -1;
|
||||
}
|
||||
|
||||
if(pcache->aprwlock != NULL)
|
||||
{
|
||||
lock_terminate(pcache->aprwlock);
|
||||
@@ -1300,17 +1126,6 @@ void aplist_terminate(aplist_context * pcache)
|
||||
return;
|
||||
}
|
||||
|
||||
void aplist_setsc_olocal(aplist_context * pcache, aplist_context * plocal)
|
||||
{
|
||||
_ASSERT(pcache != NULL);
|
||||
_ASSERT(plocal != NULL);
|
||||
|
||||
pcache->scstatus = SCAVENGER_STATUS_INACTIVE;
|
||||
pcache->polocal = plocal;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int aplist_getentry(aplist_context * pcache, const char * filename, unsigned int findex, aplist_value ** ppvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
@@ -1381,15 +1196,6 @@ int aplist_getentry(aplist_context * pcache, const char * filename, unsigned int
|
||||
/* or if the cache entry is stale, create a new entry */
|
||||
if(fchange == FILE_IS_CHANGED || pvalue == NULL)
|
||||
{
|
||||
/* If we are about to create an entry in global aplist, */
|
||||
/* remove the cache entry in local cache if one is present */
|
||||
if(pcache->pocache == NULL && pcache->polocal != NULL)
|
||||
{
|
||||
lock_writelock(pcache->polocal->aprwlock);
|
||||
delete_aplist_fileentry(pcache->polocal, filename);
|
||||
lock_writeunlock(pcache->polocal->aprwlock);
|
||||
}
|
||||
|
||||
result = create_aplist_data(pcache, filename, &pnewval);
|
||||
if(FAILED(result))
|
||||
{
|
||||
@@ -1500,10 +1306,10 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_force_fccheck(aplist_context * pcache, zval * filelist TSRMLS_DC)
|
||||
int aplist_force_fccheck(aplist_context * pcache, zval * filelist)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
zval ** fileentry = NULL;
|
||||
zval * fileentry = NULL;
|
||||
aplist_value * pvalue = NULL;
|
||||
unsigned char flock = 0;
|
||||
|
||||
@@ -1522,11 +1328,11 @@ int aplist_force_fccheck(aplist_context * pcache, zval * filelist TSRMLS_DC)
|
||||
flock = 1;
|
||||
|
||||
/* Always make currently executing file refresh on next load */
|
||||
if(filelist != NULL && zend_is_executing(TSRMLS_C))
|
||||
if(filelist != NULL && zend_is_executing())
|
||||
{
|
||||
execfile = zend_get_executed_filename(TSRMLS_C);
|
||||
execfile = zend_get_executed_filename();
|
||||
|
||||
result = set_lastcheck_time(pcache, execfile, 0 TSRMLS_CC);
|
||||
result = set_lastcheck_time(pcache, execfile, 0);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1569,7 +1375,7 @@ int aplist_force_fccheck(aplist_context * pcache, zval * filelist TSRMLS_DC)
|
||||
}
|
||||
|
||||
/* Set the last_check time of this file to 0 */
|
||||
result = set_lastcheck_time(pcache, Z_STRVAL_P(filelist), 0 TSRMLS_CC);
|
||||
result = set_lastcheck_time(pcache, Z_STRVAL_P(filelist), 0);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1577,29 +1383,27 @@ int aplist_force_fccheck(aplist_context * pcache, zval * filelist TSRMLS_DC)
|
||||
}
|
||||
else if(Z_TYPE_P(filelist) == IS_ARRAY)
|
||||
{
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(filelist));
|
||||
while(zend_hash_get_current_data(Z_ARRVAL_P(filelist), (void **)&fileentry) == SUCCESS)
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filelist), fileentry)
|
||||
{
|
||||
/* If array contains an entry which is not string, return false */
|
||||
if(Z_TYPE_PP(fileentry) != IS_STRING)
|
||||
if(Z_TYPE_P(fileentry) != IS_STRING)
|
||||
{
|
||||
result = FATAL_INVALID_ARGUMENT;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if(Z_STRLEN_PP(fileentry) == 0)
|
||||
if(Z_STRLEN_P(fileentry) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result = set_lastcheck_time(pcache, Z_STRVAL_PP(fileentry), 0 TSRMLS_CC);
|
||||
result = set_lastcheck_time(pcache, Z_STRVAL_P(fileentry), 0);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_P(filelist));
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
_ASSERT(SUCCEEDED(result));
|
||||
@@ -1674,7 +1478,7 @@ void aplist_mark_file_changed(aplist_context * pcache, char * filepath)
|
||||
return;
|
||||
}
|
||||
|
||||
static int set_lastcheck_time(aplist_context * pcache, const char * filename, unsigned int newvalue TSRMLS_DC)
|
||||
static int set_lastcheck_time(aplist_context * pcache, const char * filename, unsigned int newvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
char * resolve_path = NULL;
|
||||
@@ -1688,7 +1492,7 @@ static int set_lastcheck_time(aplist_context * pcache, const char * filename, un
|
||||
|
||||
/* Ok to call aplist_fcache_get with lock acquired when last param is NULL */
|
||||
/* If file is not accessible or not present, we will throw an error */
|
||||
result = aplist_fcache_get(pcache, filename, SKIP_STREAM_OPEN_CHECK, &resolve_path, NULL TSRMLS_CC);
|
||||
result = aplist_fcache_get(pcache, filename, SKIP_STREAM_OPEN_CHECK, &resolve_path, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1723,19 +1527,19 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_fcache_reset_lastcheck_time(aplist_context * pcache, const char * filename TSRMLS_DC)
|
||||
int aplist_fcache_reset_lastcheck_time(aplist_context * pcache, const char * filename)
|
||||
{
|
||||
return set_lastcheck_time(pcache, filename, 0 TSRMLS_CC);
|
||||
return set_lastcheck_time(pcache, filename, 0);
|
||||
}
|
||||
|
||||
/* Used by wincache_resolve_path and wincache_stream_open_function */
|
||||
/* If ppvalue is passed as null, this function return the standardized form of */
|
||||
/* filename which can include resolve path to absolute path mapping as well */
|
||||
/* Make sure this function is called without write lock when ppvalue is non-null */
|
||||
int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned char usesopen, char ** ppfullpath, fcache_value ** ppvalue TSRMLS_DC)
|
||||
int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned char usesopen, char ** ppfullpath, fcache_value ** ppvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int length = 0;
|
||||
size_t length = 0;
|
||||
unsigned int findex = 0;
|
||||
unsigned int addticks = 0;
|
||||
unsigned char fchanged = 0;
|
||||
@@ -1762,7 +1566,7 @@ int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned c
|
||||
lock_readlock(pcache->aprwlock);
|
||||
flock = 1;
|
||||
|
||||
result = rplist_getentry(pcache->prplist, filename, &rpvalue, &resentry TSRMLS_CC);
|
||||
result = rplist_getentry(pcache->prplist, filename, &rpvalue, &resentry);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1869,8 +1673,15 @@ int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned c
|
||||
/* If no valid absentry is found so far, get the fullpath from php-core */
|
||||
if(pvalue == NULL)
|
||||
{
|
||||
length = strlen(filename);
|
||||
if (length > MAXPATHLEN)
|
||||
{
|
||||
result = WARNING_ORESOLVE_FAILURE;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
/* Get fullpath by using copy of php_resolve_path */
|
||||
fullpath = utils_resolve_path(filename, strlen(filename), PG(include_path) TSRMLS_CC);
|
||||
fullpath = utils_resolve_path(filename, (int)length, PG(include_path));
|
||||
if(fullpath == NULL)
|
||||
{
|
||||
result = WARNING_ORESOLVE_FAILURE;
|
||||
@@ -1921,7 +1732,7 @@ int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned c
|
||||
{
|
||||
/* Do a check for include_path, open_basedir validity */
|
||||
/* by calling original stream open function */
|
||||
result = original_stream_open_function(fullpath, &fhandle TSRMLS_CC);
|
||||
result = original_stream_open_function(fullpath, &fhandle);
|
||||
|
||||
/* Set is_verified status in rpvalue */
|
||||
if(rpvalue != NULL)
|
||||
@@ -1935,23 +1746,7 @@ int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned c
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if(fhandle.handle.stream.closer && fhandle.handle.stream.handle)
|
||||
{
|
||||
fhandle.handle.stream.closer(fhandle.handle.stream.handle TSRMLS_CC);
|
||||
fhandle.handle.stream.handle = NULL;
|
||||
}
|
||||
|
||||
if(fhandle.opened_path)
|
||||
{
|
||||
efree(fhandle.opened_path);
|
||||
fhandle.opened_path = NULL;
|
||||
}
|
||||
|
||||
if(fhandle.free_filename && fhandle.filename)
|
||||
{
|
||||
efree((void *)fhandle.filename);
|
||||
fhandle.filename = NULL;
|
||||
}
|
||||
zend_file_handle_dtor(&fhandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1997,7 +1792,11 @@ int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned c
|
||||
if(rpvalue != NULL && rpvalue->absentry == 0)
|
||||
{
|
||||
rplist_setabsval(pcache->prplist, rpvalue, alloc_get_valueoffset(pcache->apalloc, pvalue), pvalue->resentry);
|
||||
#ifdef _WIN64
|
||||
InterlockedExchange64(&pvalue->resentry, resentry);
|
||||
#else
|
||||
InterlockedExchange(&pvalue->resentry, resentry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2053,7 +1852,7 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_fcache_delete(aplist_context * pcache, const char * filename TSRMLS_DC)
|
||||
int aplist_fcache_delete(aplist_context * pcache, const char * filename)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
aplist_value * pvalue = NULL;
|
||||
@@ -2066,7 +1865,7 @@ int aplist_fcache_delete(aplist_context * pcache, const char * filename TSRMLS_D
|
||||
|
||||
lock_writelock(pcache->aprwlock);
|
||||
|
||||
result = rplist_getentry(pcache->prplist, filename, &rpvalue, &resentry TSRMLS_CC);
|
||||
result = rplist_getentry(pcache->prplist, filename, &rpvalue, &resentry);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -2140,217 +1939,6 @@ void aplist_fcache_close(aplist_context * pcache, fcache_value * pfvalue)
|
||||
return;
|
||||
}
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Fetches the cached opcode cache entry for the filename/file_handle, if it
|
||||
exists.
|
||||
|
||||
If the file is not cached, compile the file and create the opcode cache
|
||||
entry with the returned opcode array.
|
||||
|
||||
If this function creates the opcode cache entry, the poparray will contain
|
||||
the original compiled opcode array. If this function simply found an
|
||||
existing opcode cache entry, the poparray will contain NULL.
|
||||
|
||||
Arguments:
|
||||
|
||||
pcache - Cache Context.
|
||||
filename - Name of file to cache.
|
||||
file_handle - File handle of file to cache.
|
||||
type - (???)
|
||||
poparray - receives pointer to opcode array if the file is not found in the
|
||||
opcode cache. Set to NULL if the file is in the opcode cache, or if the
|
||||
call failed.
|
||||
ppvalue - On successful return, receives the pointer to the opcode cache
|
||||
entry. Set to NULL if the call failed.
|
||||
|
||||
Return Value:
|
||||
|
||||
NONFATAL - successful return.
|
||||
FAILED() - downstream failure.
|
||||
|
||||
--*/
|
||||
int aplist_ocache_get(aplist_context * pcache, const char * filename, zend_file_handle * file_handle, int type, zend_op_array ** poparray, ocache_value ** ppvalue TSRMLS_DC)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int findex = 0;
|
||||
aplist_value * pvalue = NULL;
|
||||
ocache_value * povalue = NULL;
|
||||
|
||||
dprintverbose("start aplist_ocache_get");
|
||||
|
||||
_ASSERT(pcache != NULL);
|
||||
_ASSERT(filename != NULL);
|
||||
_ASSERT(file_handle != NULL);
|
||||
_ASSERT(poparray != NULL);
|
||||
_ASSERT(ppvalue != NULL);
|
||||
|
||||
*poparray = NULL;
|
||||
*ppvalue = NULL;
|
||||
|
||||
findex = utils_getindex(filename, pcache->apheader->valuecount);
|
||||
|
||||
result = aplist_getentry(pcache, filename, findex, &pvalue);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
lock_readlock(pcache->aprwlock);
|
||||
|
||||
/* If opcode cache value is not created for this file, create one */
|
||||
if(pvalue->ocacheval == 0)
|
||||
{
|
||||
lock_readunlock(pcache->aprwlock);
|
||||
|
||||
/* Create opcode cache entry in shared segment */
|
||||
result = ocache_createval(pcache->pocache, filename, file_handle, type, poparray, &povalue TSRMLS_CC);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
/* Get a write lock and update ocacheval if some other */
|
||||
/* process didn't beat this process in updating the value */
|
||||
lock_writelock(pcache->aprwlock);
|
||||
if(pvalue->ocacheval == 0)
|
||||
{
|
||||
pvalue->ocacheval = ocache_getoffset(pcache->pocache, povalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
ocache_destroyval(pcache->pocache, povalue);
|
||||
povalue = NULL;
|
||||
}
|
||||
|
||||
lock_writeunlock(pcache->aprwlock);
|
||||
lock_readlock(pcache->aprwlock);
|
||||
}
|
||||
|
||||
if(povalue == NULL)
|
||||
{
|
||||
_ASSERT(pvalue->ocacheval != 0);
|
||||
povalue = ocache_getvalue(pcache->pocache, pvalue->ocacheval);
|
||||
}
|
||||
|
||||
_ASSERT(povalue != NULL);
|
||||
*ppvalue = povalue;
|
||||
|
||||
if(*poparray == NULL)
|
||||
{
|
||||
/* We found an entry in the opcode cache */
|
||||
/* Do ref increment before releasing the readlock */
|
||||
ocache_refinc(pcache->pocache, povalue);
|
||||
}
|
||||
|
||||
lock_readunlock(pcache->aprwlock);
|
||||
|
||||
_ASSERT(SUCCEEDED(result));
|
||||
|
||||
Finished:
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in aplist_ocache_get", result);
|
||||
}
|
||||
|
||||
dprintverbose("end aplist_ocache_get");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_ocache_get_value(aplist_context * pcache, const char * filename, ocache_value ** ppvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int findex = 0;
|
||||
aplist_value * pvalue = NULL;
|
||||
ocache_value * povalue = NULL;
|
||||
|
||||
dprintverbose("start aplist_ocache_get_value");
|
||||
|
||||
_ASSERT(pcache != NULL);
|
||||
_ASSERT(filename != NULL);
|
||||
_ASSERT(ppvalue != NULL);
|
||||
|
||||
*ppvalue = NULL;
|
||||
|
||||
findex = utils_getindex(filename, pcache->apheader->valuecount);
|
||||
result = aplist_getentry(pcache, filename, findex, &pvalue);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
lock_readlock(pcache->aprwlock);
|
||||
if(pvalue->ocacheval == 0)
|
||||
{
|
||||
lock_readunlock(pcache->aprwlock);
|
||||
result = FATAL_UNEXPECTED_DATA;
|
||||
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
povalue = ocache_getvalue(pcache->pocache, pvalue->ocacheval);
|
||||
|
||||
_ASSERT(povalue != NULL);
|
||||
*ppvalue = povalue;
|
||||
|
||||
/* Do refinc while holding the lock so that ocache */
|
||||
/* entry doesn't get deleted while before refinc */
|
||||
ocache_refinc(pcache->pocache, povalue);
|
||||
|
||||
lock_readunlock(pcache->aprwlock);
|
||||
|
||||
_ASSERT(SUCCEEDED(result));
|
||||
|
||||
Finished:
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in aplist_ocache_get_value", result);
|
||||
}
|
||||
|
||||
dprintverbose("end aplist_ocache_get_value");
|
||||
return result;
|
||||
}
|
||||
|
||||
int aplist_ocache_use(aplist_context * pcache, ocache_value * povalue, zend_op_array ** pparray TSRMLS_DC)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
|
||||
dprintverbose("start aplist_ocache_use");
|
||||
|
||||
_ASSERT(pcache != NULL);
|
||||
_ASSERT(povalue != NULL);
|
||||
_ASSERT(pparray != NULL);
|
||||
|
||||
result = ocache_useval(pcache->pocache, povalue, pparray TSRMLS_CC);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
_ASSERT(SUCCEEDED(result));
|
||||
|
||||
Finished:
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in aplist_ocache_use", result);
|
||||
}
|
||||
|
||||
dprintverbose("end aplist_ocache_use");
|
||||
return result;
|
||||
}
|
||||
|
||||
void aplist_ocache_close(aplist_context * pcache, ocache_value * povalue)
|
||||
{
|
||||
ocache_refdec(pcache->pocache, povalue);
|
||||
return;
|
||||
}
|
||||
|
||||
int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summaryonly, cache_info ** ppinfo)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
@@ -2361,7 +1949,6 @@ int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summar
|
||||
|
||||
unsigned char flock = 0;
|
||||
fcache_value * pfvalue = NULL;
|
||||
ocache_value * povalue = NULL;
|
||||
|
||||
unsigned int ticks = 0;
|
||||
unsigned int index = 0;
|
||||
@@ -2398,9 +1985,9 @@ int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summar
|
||||
}
|
||||
else if(type == CACHE_TYPE_BYTECODES)
|
||||
{
|
||||
pcinfo->itemcount = pcache->pocache->header->itemcount;
|
||||
pcinfo->hitcount = pcache->pocache->header->hitcount;
|
||||
pcinfo->misscount = pcache->pocache->header->misscount;
|
||||
dprintimportant("Opcode Cache is no longer supported.");
|
||||
result = FATAL_OCACHE_CREATION;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pcinfo->entries = NULL;
|
||||
@@ -2422,7 +2009,7 @@ int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summar
|
||||
pvalue = (aplist_value *)alloc_get_cachevalue(pcache->apalloc, offset);
|
||||
while(pvalue != NULL)
|
||||
{
|
||||
if((type == CACHE_TYPE_FILECONTENT && pvalue->fcacheval != 0) || (type == CACHE_TYPE_BYTECODES && pvalue->ocacheval != 0))
|
||||
if (type == CACHE_TYPE_FILECONTENT && pvalue->fcacheval != 0)
|
||||
{
|
||||
ptemp = (cache_entry_info *)alloc_emalloc(sizeof(cache_entry_info));
|
||||
if(ptemp == NULL)
|
||||
@@ -2454,8 +2041,9 @@ int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summar
|
||||
}
|
||||
else if(type == CACHE_TYPE_BYTECODES)
|
||||
{
|
||||
povalue = ocache_getvalue(pcache->pocache, pvalue->ocacheval);
|
||||
result = ocache_getinfo(povalue, (ocache_entry_info **)&ptemp->cdata);
|
||||
dprintimportant("Opcode Cache no longer supported.");
|
||||
result = FATAL_OCACHE_CREATION;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if(FAILED(result))
|
||||
@@ -2520,11 +2108,6 @@ Finished:
|
||||
{
|
||||
fcache_freeinfo(ptemp->cdata);
|
||||
}
|
||||
else if(type == CACHE_TYPE_BYTECODES)
|
||||
{
|
||||
ocache_freeinfo(ptemp->cdata);
|
||||
}
|
||||
|
||||
ptemp->cdata = NULL;
|
||||
}
|
||||
|
||||
@@ -2569,11 +2152,6 @@ void aplist_freeinfo(unsigned char type, cache_info * pinfo)
|
||||
{
|
||||
fcache_freeinfo(petemp->cdata);
|
||||
}
|
||||
else if(type == CACHE_TYPE_BYTECODES)
|
||||
{
|
||||
ocache_freeinfo(petemp->cdata);
|
||||
}
|
||||
|
||||
petemp->cdata = NULL;
|
||||
}
|
||||
|
||||
@@ -2600,7 +2178,6 @@ void aplist_runtest()
|
||||
unsigned int ttlmax = 0;
|
||||
char * filename = "testfile.php";
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("*** STARTING APLIST TESTS ***");
|
||||
|
||||
result = aplist_create(&pcache);
|
||||
@@ -2609,7 +2186,7 @@ void aplist_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = aplist_initialize(pcache, APLIST_TYPE_GLOBAL, filecount, fchfreq, ttlmax TSRMLS_CC);
|
||||
result = aplist_initialize(pcache, APLIST_TYPE_GLOBAL, filecount, fchfreq, ttlmax);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
|
||||
@@ -56,7 +56,6 @@ struct aplist_value
|
||||
unsigned short is_changed; /* If set to 1, value is marked changed */
|
||||
|
||||
size_t fcacheval; /* File cache value offset */
|
||||
size_t ocacheval; /* Opcode cache value offset */
|
||||
size_t resentry; /* Offset of first entry in rplist */
|
||||
size_t fcnotify; /* Offset of file change notification entry */
|
||||
unsigned int fcncount; /* fcnotify_value reusecount to detect handoff */
|
||||
@@ -100,7 +99,6 @@ struct aplist_context
|
||||
aplist_context * polocal; /* Absolute path cache with local opcode cache*/
|
||||
rplist_context * prplist; /* Resolve path cache to resolve all paths */
|
||||
fcache_context * pfcache; /* File cache containing file content */
|
||||
ocache_context * pocache; /* Opcode cache containing opcodes */
|
||||
fcnotify_context * pnotify; /* File change notification context */
|
||||
int resnumber; /* Resource number for this extension */
|
||||
};
|
||||
@@ -129,29 +127,23 @@ struct cache_info
|
||||
|
||||
extern int aplist_create(aplist_context ** ppcache);
|
||||
extern void aplist_destroy(aplist_context * pcache);
|
||||
extern int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned int filecount, unsigned int fchangefreq, unsigned int ttlmax TSRMLS_DC);
|
||||
extern int aplist_initialize(aplist_context * pcache, unsigned short apctype, unsigned int filecount, unsigned int fchangefreq, unsigned int ttlmax);
|
||||
extern void aplist_terminate(aplist_context * pcache);
|
||||
|
||||
extern void aplist_setsc_olocal(aplist_context * pcache, aplist_context * plocal);
|
||||
extern int aplist_getinfo(aplist_context * pcache, unsigned char type, zend_bool summaryonly, cache_info ** ppinfo);
|
||||
extern void aplist_freeinfo(unsigned char type, cache_info * pinfo);
|
||||
extern int aplist_getentry(aplist_context * pcache, const char * filename, unsigned int findex, aplist_value ** ppvalue);
|
||||
extern int aplist_force_fccheck(aplist_context * pcache, zval * filelist TSRMLS_DC);
|
||||
extern int aplist_force_fccheck(aplist_context * pcache, zval * filelist);
|
||||
extern void aplist_mark_changed(aplist_context * pcache, char * folderpath, char * filename);
|
||||
extern void aplist_mark_file_changed(aplist_context * pcache, char * filepath);
|
||||
|
||||
extern int aplist_fcache_initialize(aplist_context * plcache, unsigned int size, unsigned int maxfilesize TSRMLS_DC);
|
||||
extern int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned char usesopen, char ** ppfullpath, fcache_value ** ppvalue TSRMLS_DC);
|
||||
extern int aplist_fcache_initialize(aplist_context * plcache, unsigned int size, unsigned int maxfilesize);
|
||||
extern int aplist_fcache_get(aplist_context * pcache, const char * filename, unsigned char usesopen, char ** ppfullpath, fcache_value ** ppvalue);
|
||||
extern int aplist_fcache_use(aplist_context * pcache, const char * fullpath, fcache_value * pvalue, zend_file_handle ** pphandle);
|
||||
extern void aplist_fcache_close(aplist_context * pcache, fcache_value * pvalue);
|
||||
extern int aplist_fcache_delete(aplist_context * pcache, const char * filename TSRMLS_DC);
|
||||
extern int aplist_fcache_reset_lastcheck_time(aplist_context * pcache, const char * filename TSRMLS_DC);
|
||||
|
||||
extern int aplist_ocache_initialize(aplist_context * plcache, int resnumber, unsigned int size TSRMLS_DC);
|
||||
extern int aplist_ocache_get(aplist_context * pcache, const char * filename, zend_file_handle * file_handle, int type, zend_op_array ** poparray, ocache_value ** ppvalue TSRMLS_DC);
|
||||
extern int aplist_ocache_get_value(aplist_context * pcache, const char * filename, ocache_value ** ppvalue);
|
||||
extern int aplist_ocache_use(aplist_context * pcache, ocache_value * pvalue, zend_op_array ** pparray TSRMLS_DC);
|
||||
extern void aplist_ocache_close(aplist_context * pcache, ocache_value * pvalue);
|
||||
extern int aplist_fcache_delete(aplist_context * pcache, const char * filename);
|
||||
extern int aplist_fcache_reset_lastcheck_time(aplist_context * pcache, const char * filename);
|
||||
|
||||
extern void aplist_runtest();
|
||||
|
||||
|
||||
@@ -130,13 +130,13 @@ void dprintdecorate(char * format, ...)
|
||||
|
||||
ZEND_INI_MH(wincache_modify_debuglevel)
|
||||
{
|
||||
if (new_value_length == 0)
|
||||
if (ZSTR_LEN(new_value) == 0)
|
||||
{
|
||||
dprintsetlevel(WINCACHE_DEBUG_MTYPE_DISABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintsetlevel(atoi(new_value));
|
||||
dprintsetlevel(atoi(ZSTR_VAL(new_value)));
|
||||
WCG(debuglevel) = gdebuglevel;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#define FATAL_LOCK_SHORT_BUFFER FATAL_LOCK_BASE + 4
|
||||
#define FATAL_LOCK_NUMBER_LARGE FATAL_LOCK_BASE + 5
|
||||
#define FATAL_LOCK_INVALID_TYPE FATAL_LOCK_BASE + 6
|
||||
#define FATAL_LOCK_NOT_FOUND FATAL_LOCK_BASE + 7
|
||||
|
||||
/* Error codes used in filemap functionality */
|
||||
#define FATAL_FILEMAP_BASE 200
|
||||
@@ -113,6 +114,7 @@
|
||||
#define FATAL_FCACHE_INIT_EVENT FATAL_FCACHE_BASE + 9
|
||||
#define FATAL_FCACHE_ORIGINAL_OPEN FATAL_FCACHE_BASE + 10
|
||||
#define FATAL_FCACHE_BYHANDLE_INFO FATAL_FCACHE_BASE + 11
|
||||
#define FATAL_FCACHE_FILE_TOO_BIG FATAL_FCACHE_BASE + 12
|
||||
|
||||
/* Error codes used by opcode cache */
|
||||
#define FATAL_OCACHE_BASE 700
|
||||
@@ -140,7 +142,6 @@
|
||||
#define FATAL_ZVCACHE_INIT_EVENT FATAL_ZVCACHE_BASE + 2
|
||||
#define FATAL_ZVCACHE_INVALID_ZVAL FATAL_ZVCACHE_BASE + 3
|
||||
#define FATAL_ZVCACHE_INVALID_KEY_LENGTH FATAL_ZVCACHE_BASE + 4
|
||||
#define FATAL_ZVCACHE_BUCKET_COPY_FAILED FATAL_ZVCACHE_BASE + 5
|
||||
|
||||
/* Error codes used by session handler */
|
||||
#define FATAL_SESSION_BASE 1000
|
||||
|
||||
@@ -136,7 +136,11 @@ static int read_file_content(HANDLE hFile, unsigned int filesize, void ** ppbuff
|
||||
}
|
||||
else
|
||||
{
|
||||
readahead = filesize - coffset;
|
||||
/*
|
||||
* we've validated that the difference is safe to cast to
|
||||
* a 32-bit value before making this assignment.
|
||||
*/
|
||||
readahead = (unsigned int)(filesize - coffset);
|
||||
}
|
||||
|
||||
breturn = ReadFile(hFile, pvread, readahead, &readahead, &Overlapped);
|
||||
@@ -238,7 +242,7 @@ void fcache_destroy(fcache_context * pfcache)
|
||||
return;
|
||||
}
|
||||
|
||||
int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned short cachekey, unsigned int cachesize, unsigned int maxfsize TSRMLS_DC)
|
||||
int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned short cachekey, unsigned int cachesize, unsigned int maxfsize)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
size_t size = 0;
|
||||
@@ -281,7 +285,7 @@ int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = lock_initialize(pfcache->prwlock, "FILECONTENT_CACHE", cachekey, locktype, LOCK_USET_XREAD_XWRITE, NULL TSRMLS_CC);
|
||||
result = lock_initialize(pfcache->prwlock, "FILECONTENT_CACHE", cachekey, locktype, LOCK_USET_XREAD_XWRITE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -297,14 +301,14 @@ int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned
|
||||
islocked = 1;
|
||||
|
||||
/* shmfilepath = NULL to use page file for shared memory */
|
||||
result = filemap_initialize(pfcache->pfilemap, FILEMAP_TYPE_FILECONTENT, cachekey, mapclass, cachesize, isfirst, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pfcache->pfilemap, FILEMAP_TYPE_FILECONTENT, cachekey, mapclass, cachesize, isfirst, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pfcache->memaddr = (char *)pfcache->pfilemap->mapaddr;
|
||||
size = filemap_getsize(pfcache->pfilemap TSRMLS_CC);
|
||||
size = filemap_getsize(pfcache->pfilemap);
|
||||
initmemory = (pfcache->pfilemap->existing == 0);
|
||||
|
||||
/* Create allocator for filecache segment */
|
||||
@@ -315,7 +319,7 @@ int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned
|
||||
}
|
||||
|
||||
/* initmemory = 1 for all page file backed shared memory allocators */
|
||||
result = alloc_initialize(pfcache->palloc, islocal, "FILECONTENT_SEGMENT", cachekey, pfcache->memaddr, size, 1 TSRMLS_CC);
|
||||
result = alloc_initialize(pfcache->palloc, islocal, "FILECONTENT_SEGMENT", cachekey, pfcache->memaddr, size, 1);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -682,18 +686,13 @@ int fcache_useval(fcache_context * pcache, const char * filename, fcache_value *
|
||||
|
||||
phandle->filename = (char *)filename;
|
||||
phandle->free_filename = 0;
|
||||
phandle->opened_path = alloc_estrdup(filename);
|
||||
phandle->opened_path = zend_string_init(filename, strlen(filename), 0);
|
||||
|
||||
ZeroMemory(&phandle->handle.stream, sizeof(zend_stream));
|
||||
|
||||
phandle->handle.stream.reader = (zend_stream_reader_t)fcache_reader;
|
||||
phandle->handle.stream.closer = (zend_stream_closer_t)fcache_closer;
|
||||
|
||||
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3
|
||||
phandle->handle.stream.fsizer = (zend_stream_fsizer_t)fcache_fsizer;
|
||||
#elif PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2
|
||||
phandle->handle.stream.fteller = (zend_stream_fteller_t)fcache_fsizer;
|
||||
#endif
|
||||
|
||||
fhandle->pfcache = pcache;
|
||||
fhandle->pfvalue = pvalue;
|
||||
@@ -826,7 +825,7 @@ void fcache_freeinfo(fcache_entry_info * pinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t fcache_fsizer(void * handle TSRMLS_DC)
|
||||
size_t fcache_fsizer(void * handle)
|
||||
{
|
||||
size_t size = 0;
|
||||
fcache_handle * fhandle = NULL;
|
||||
@@ -843,7 +842,7 @@ size_t fcache_fsizer(void * handle TSRMLS_DC)
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t fcache_reader(void * handle, char * buf, size_t length TSRMLS_DC)
|
||||
size_t fcache_reader(void * handle, char * buf, size_t length)
|
||||
{
|
||||
size_t size = 0;
|
||||
fcache_handle * fhandle = NULL;
|
||||
@@ -882,7 +881,7 @@ size_t fcache_reader(void * handle, char * buf, size_t length TSRMLS_DC)
|
||||
return size;
|
||||
}
|
||||
|
||||
void fcache_closer(void * handle TSRMLS_DC)
|
||||
void fcache_closer(void * handle)
|
||||
{
|
||||
fcache_handle * fhandle = NULL;
|
||||
|
||||
@@ -913,7 +912,6 @@ void fcache_runtest()
|
||||
unsigned int maxfsize = 250;
|
||||
char * filename = "testfile.php";
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("*** STARTING FCACHE TESTS ***");
|
||||
|
||||
result = fcache_create(&pfcache);
|
||||
@@ -922,7 +920,7 @@ void fcache_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = fcache_initialize(pfcache, islocal, 57, cachesize, maxfsize TSRMLS_CC);
|
||||
result = fcache_initialize(pfcache, islocal, 57, cachesize, maxfsize);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -958,13 +956,13 @@ Finished:
|
||||
* php_stream_ops functions
|
||||
*/
|
||||
|
||||
size_t wincache_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||
size_t wincache_stream_write(php_stream *stream, const char *buf, size_t count)
|
||||
{
|
||||
/* ignore writes */
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t wincache_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||
size_t wincache_stream_read(php_stream *stream, char *buf, size_t count)
|
||||
{
|
||||
size_t toread = 0;
|
||||
|
||||
@@ -996,12 +994,12 @@ size_t wincache_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_D
|
||||
return toread;
|
||||
}
|
||||
|
||||
int wincache_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
|
||||
int wincache_stream_close(php_stream *stream, int close_handle)
|
||||
{
|
||||
/* ignore close */
|
||||
return 0;
|
||||
}
|
||||
int wincache_stream_flush(php_stream *stream TSRMLS_DC)
|
||||
int wincache_stream_flush(php_stream *stream)
|
||||
{
|
||||
/* ignore flush */
|
||||
return 0;
|
||||
@@ -1026,10 +1024,10 @@ Returns:
|
||||
0 - Success
|
||||
-1 - Failure
|
||||
-*/
|
||||
int wincache_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)
|
||||
int wincache_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset)
|
||||
{
|
||||
int ret = -1;
|
||||
long newPos = 0;
|
||||
zend_off_t newPos = 0;
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_CUR: /* Current Position. Offset may be negative. */
|
||||
@@ -1078,19 +1076,19 @@ int wincache_stream_seek(php_stream *stream, off_t offset, int whence, off_t *n
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wincache_stream_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
|
||||
int wincache_stream_cast(php_stream *stream, int castas, void **ret)
|
||||
{
|
||||
/* ignore cast */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wincache_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
|
||||
int wincache_stream_stat(php_stream *stream, php_stream_statbuf *ssb)
|
||||
{
|
||||
/* never return stat info */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int wincache_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
|
||||
int wincache_stream_set_option(php_stream *stream, int option, int value, void *ptrparam)
|
||||
{
|
||||
/* ignore set option */
|
||||
return 0;
|
||||
|
||||
@@ -102,7 +102,7 @@ struct fcache_entry_info
|
||||
|
||||
extern int fcache_create(fcache_context ** ppfcache);
|
||||
extern void fcache_destroy(fcache_context * pfcache);
|
||||
extern int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned short cachekey, unsigned int cachesize, unsigned int maxfsize TSRMLS_DC);
|
||||
extern int fcache_initialize(fcache_context * pfcache, unsigned short islocal, unsigned short cachekey, unsigned int cachesize, unsigned int maxfsize);
|
||||
extern void fcache_terminate(fcache_context * pfcache);
|
||||
|
||||
extern int fcache_createval(fcache_context * pfcache, const char * filename, fcache_value ** ppvalue);
|
||||
@@ -115,9 +115,9 @@ extern void fcache_refdec(fcache_context * pfcache, fcache_value * pvalue);
|
||||
extern int fcache_getinfo(fcache_value * pvalue, fcache_entry_info ** ppinfo);
|
||||
extern void fcache_freeinfo(fcache_entry_info * pinfo);
|
||||
|
||||
extern size_t fcache_fsizer(void * handle TSRMLS_DC);
|
||||
extern size_t fcache_reader(void * handle, char * buf, size_t length TSRMLS_DC);
|
||||
extern void fcache_closer(void * handle TSRMLS_DC);
|
||||
extern size_t fcache_fsizer(void * handle);
|
||||
extern size_t fcache_reader(void * handle, char * buf, size_t length);
|
||||
extern void fcache_closer(void * handle);
|
||||
|
||||
extern void fcache_runtest();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ static void listener_refdec(fcnotify_context * pnotify, fcnotify_listen * pliste
|
||||
static void destroy_fcnotify_data(fcnotify_context * pnotify, fcnotify_value * pvalue);
|
||||
static void add_fcnotify_entry(fcnotify_context * pnotify, unsigned int index, fcnotify_value * pvalue);
|
||||
static void remove_fcnotify_entry(fcnotify_context * pnotify, unsigned int index, fcnotify_value * pvalue);
|
||||
static int pidhandles_apply(void * pdestination TSRMLS_DC);
|
||||
static int pidhandles_apply(void * pdestination);
|
||||
static void run_fcnotify_scavenger(fcnotify_context * pnotify);
|
||||
static unsigned char process_alive_check(fcnotify_context * pnotify, fcnotify_value * pvalue);
|
||||
|
||||
@@ -276,7 +276,7 @@ static int create_fcnotify_data(fcnotify_context * pnotify, const char * folderp
|
||||
int result = NONFATAL;
|
||||
fcnotify_value * pvalue = NULL;
|
||||
alloc_context * palloc = NULL;
|
||||
unsigned int pathlen = 0;
|
||||
size_t pathlen = 0;
|
||||
char * paddr = NULL;
|
||||
unsigned int fshare = 0;
|
||||
unsigned int flags = 0;
|
||||
@@ -683,7 +683,7 @@ void fcnotify_destroy(fcnotify_context * pnotify)
|
||||
return;
|
||||
}
|
||||
|
||||
int fcnotify_initialize(fcnotify_context * pnotify, unsigned short islocal, void * paplist, alloc_context * palloc, unsigned int filecount TSRMLS_DC)
|
||||
int fcnotify_initialize(fcnotify_context * pnotify, unsigned short islocal, void * paplist, alloc_context * palloc, unsigned int filecount)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned short locktype = LOCK_TYPE_SHARED;
|
||||
@@ -727,7 +727,7 @@ int fcnotify_initialize(fcnotify_context * pnotify, unsigned short islocal, void
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = lock_initialize(pnotify->fclock, "FILE_CHANGE_NOTIFY", 1, locktype, LOCK_USET_SREAD_XWRITE, &header->rdcount TSRMLS_CC);
|
||||
result = lock_initialize(pnotify->fclock, "FILE_CHANGE_NOTIFY", 1, locktype, LOCK_USET_SREAD_XWRITE, &header->rdcount);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -886,7 +886,7 @@ void fcnotify_terminate(fcnotify_context * pnotify)
|
||||
return;
|
||||
}
|
||||
|
||||
static int pidhandles_apply(void * pdestination TSRMLS_DC)
|
||||
static int pidhandles_apply(void * pdestination)
|
||||
{
|
||||
HANDLE * hprocess = NULL;
|
||||
unsigned int exitcode = 0;
|
||||
@@ -915,7 +915,6 @@ static void run_fcnotify_scavenger(fcnotify_context * pnotify)
|
||||
unsigned int count = 0;
|
||||
HashTable * phashtable = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("start run_fcnotify_scavenger");
|
||||
|
||||
pheader = pnotify->fcheader;
|
||||
@@ -948,7 +947,7 @@ static void run_fcnotify_scavenger(fcnotify_context * pnotify)
|
||||
lock_writeunlock(pnotify->fclock);
|
||||
|
||||
/* Go through pidhandles table and remove entries for dead processes */
|
||||
zend_hash_apply(phashtable, pidhandles_apply TSRMLS_CC);
|
||||
zend_hash_apply(phashtable, pidhandles_apply);
|
||||
pnotify->lscavenge = GetTickCount();
|
||||
|
||||
dprintverbose("end run_fcnotify_scavenger");
|
||||
@@ -980,7 +979,8 @@ static unsigned char process_alive_check(fcnotify_context * pnotify, fcnotify_va
|
||||
|
||||
phashtable = pnotify->pidhandles;
|
||||
|
||||
if(zend_hash_index_find(phashtable, (ulong)ownerpid, (void **)&phdata) == FAILURE)
|
||||
phdata = (HANDLE *)zend_hash_index_find_ptr(phashtable, (zend_ulong)ownerpid);
|
||||
if(phdata == NULL)
|
||||
{
|
||||
/* Check if impersonation is enabled */
|
||||
/* If it is, get impersonated token and set it back after calling OpenProcess */
|
||||
@@ -1009,7 +1009,7 @@ static unsigned char process_alive_check(fcnotify_context * pnotify, fcnotify_va
|
||||
}
|
||||
|
||||
/* Keep the handle around to save OpenProcess calls */
|
||||
zend_hash_index_update(phashtable, (ulong)ownerpid, (void **)&hprocess, sizeof(HANDLE), NULL);
|
||||
zend_hash_index_update_ptr(phashtable, (zend_ulong)ownerpid, (void *)hprocess);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1024,7 +1024,7 @@ static unsigned char process_alive_check(fcnotify_context * pnotify, fcnotify_va
|
||||
{
|
||||
/* GetProcessId failure means process is gone */
|
||||
CloseHandle(hprocess);
|
||||
zend_hash_index_del(phashtable, (ulong)ownerpid);
|
||||
zend_hash_index_del(phashtable, (zend_ulong)ownerpid);
|
||||
|
||||
listenp = PROCESS_IS_DEAD;
|
||||
}
|
||||
@@ -1038,7 +1038,7 @@ Finished:
|
||||
int fcnotify_check(fcnotify_context * pnotify, const char * filepath, size_t * poffset, unsigned int * pcount)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int flength = 0;
|
||||
size_t flength = 0;
|
||||
char * folderpath = NULL;
|
||||
unsigned char allocated = 0;
|
||||
unsigned int index = 0;
|
||||
|
||||
@@ -114,7 +114,7 @@ struct fcnotify_info
|
||||
|
||||
extern int fcnotify_create(fcnotify_context ** ppnotify);
|
||||
extern void fcnotify_destroy(fcnotify_context * pnotify);
|
||||
extern int fcnotify_initialize(fcnotify_context * pnotify, unsigned short islocal, void * paplist, alloc_context * palloc, unsigned int filecount TSRMLS_DC);
|
||||
extern int fcnotify_initialize(fcnotify_context * pnotify, unsigned short islocal, void * paplist, alloc_context * palloc, unsigned int filecount);
|
||||
extern void fcnotify_initheader(fcnotify_context * pnotify, unsigned int filecount);
|
||||
extern void fcnotify_terminate(fcnotify_context * pnotify);
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
#define FILEMAP_INFO_HEADER_SIZE ALIGNQWORD(sizeof(filemap_information_header))
|
||||
#define FILEMAP_INFO_ENTRY_SIZE ALIGNQWORD(sizeof(filemap_information_entry))
|
||||
|
||||
static unsigned int getppid(TSRMLS_D);
|
||||
static int create_rwlock(char * lockname, lock_context ** pplock TSRMLS_DC);
|
||||
static unsigned int getppid();
|
||||
static int create_rwlock(char * lockname, lock_context ** pplock);
|
||||
static void destroy_rwlock(lock_context * plock);
|
||||
static int create_file_mapping(char * name, char * shmfilepath, unsigned char isfirst,size_t size, HANDLE * pshmfile, unsigned int * pexisting, HANDLE * pmap);
|
||||
static void * map_viewof_file(HANDLE handle, void * baseaddr);
|
||||
static int create_information_filemap(filemap_information ** ppinfo TSRMLS_DC);
|
||||
static int create_information_filemap(filemap_information ** ppinfo);
|
||||
static void destroy_information_filemap(filemap_information * pinfo);
|
||||
|
||||
/* Array of filemap prefixes, in the same order & value as FILEMAP_TYPE_*
|
||||
@@ -61,7 +61,7 @@ static char * g_filemap_prefix[] = {
|
||||
unsigned short gfilemapid = 1;
|
||||
|
||||
/* private method to get parent process id */
|
||||
static unsigned int getppid(TSRMLS_D)
|
||||
static unsigned int getppid()
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int pid = 0;
|
||||
@@ -88,7 +88,7 @@ static unsigned int getppid(TSRMLS_D)
|
||||
}
|
||||
|
||||
/* Use CRC of user provided apppoolid as ppid if available */
|
||||
poolpid = utils_apoolpid(TSRMLS_C);
|
||||
poolpid = utils_apoolpid();
|
||||
if(poolpid != -1)
|
||||
{
|
||||
WCG(parentpid) = poolpid;
|
||||
@@ -195,7 +195,7 @@ static int build_filemap_name(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int create_rwlock(char * lockname, lock_context ** pplock TSRMLS_DC)
|
||||
static int create_rwlock(char * lockname, lock_context ** pplock)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
lock_context * plock = NULL;
|
||||
@@ -214,7 +214,7 @@ static int create_rwlock(char * lockname, lock_context ** pplock TSRMLS_DC)
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = lock_initialize(plock, lockname, 1, LOCK_TYPE_SHARED, LOCK_USET_XREAD_XWRITE, NULL TSRMLS_CC);
|
||||
result = lock_initialize(plock, lockname, 1, LOCK_TYPE_SHARED, LOCK_USET_XREAD_XWRITE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -279,6 +279,7 @@ static int create_file_mapping(
|
||||
unsigned int sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
unsigned int access = GENERIC_READ | GENERIC_WRITE;
|
||||
unsigned char globalName[MAX_PATH+1];
|
||||
ULARGE_INTEGER li = { 0 };
|
||||
|
||||
dprintverbose("start create_file_mapping");
|
||||
|
||||
@@ -349,7 +350,8 @@ static int create_file_mapping(
|
||||
}
|
||||
|
||||
/* Call CreateFileMapping to create new or open existing file mapping object */
|
||||
maphandle = CreateFileMapping(filehandle, NULL, PAGE_READWRITE, 0, size, name);
|
||||
li.QuadPart = (ULONGLONG)size; /* safely handle size_t on x64 */
|
||||
maphandle = CreateFileMapping(filehandle, NULL, PAGE_READWRITE, li.HighPart, li.LowPart, name);
|
||||
|
||||
/* handle value null means a fatal error */
|
||||
if(maphandle == NULL)
|
||||
@@ -506,12 +508,13 @@ Finished:
|
||||
return pBaseTemp;
|
||||
}
|
||||
|
||||
static int create_information_filemap(filemap_information ** ppinfo TSRMLS_DC)
|
||||
static int create_information_filemap(filemap_information ** ppinfo)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
int index = 0;
|
||||
int size = 0;
|
||||
int namelen = 0;
|
||||
int infonamelen = 0;
|
||||
size_t size = 0;
|
||||
size_t namelen = 0;
|
||||
filemap_information * pinfo = NULL;
|
||||
filemap_information_entry * pentry = NULL;
|
||||
unsigned char isfirst = 1;
|
||||
@@ -544,7 +547,7 @@ static int create_information_filemap(filemap_information ** ppinfo TSRMLS_DC)
|
||||
|
||||
/* First thing to do is create the lock */
|
||||
/* As the lock is xread_xwrite, doing this before mapping is fine */
|
||||
result = create_rwlock("FILEMAP_INFO_HRWLOCK", &pinfo->hrwlock TSRMLS_CC);
|
||||
result = create_rwlock("FILEMAP_INFO_HRWLOCK", &pinfo->hrwlock);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -582,14 +585,20 @@ static int create_information_filemap(filemap_information ** ppinfo TSRMLS_DC)
|
||||
/* Create name as FILE_INFORMATION_PREFIX_<ppid> */
|
||||
if(WCG(namesalt) == NULL)
|
||||
{
|
||||
_snprintf_s(pinfo->infoname, namelen, namelen - 1, "%s%s_%u", scopePrefix, FILEMAP_INFORMATION_PREFIX, WCG(fmapgdata)->ppid);
|
||||
infonamelen = _snprintf_s(pinfo->infoname, namelen, namelen - 1, "%s%s_%u", scopePrefix, FILEMAP_INFORMATION_PREFIX, WCG(fmapgdata)->ppid);
|
||||
}
|
||||
else
|
||||
{
|
||||
_snprintf_s(pinfo->infoname, namelen, namelen - 1, "%s%s_%s_%u", scopePrefix, FILEMAP_INFORMATION_PREFIX, WCG(namesalt), WCG(fmapgdata)->ppid);
|
||||
infonamelen = _snprintf_s(pinfo->infoname, namelen, namelen - 1, "%s%s_%s_%u", scopePrefix, FILEMAP_INFORMATION_PREFIX, WCG(namesalt), WCG(fmapgdata)->ppid);
|
||||
}
|
||||
|
||||
pinfo->infonlen = strlen(pinfo->infoname);
|
||||
if (infonamelen < 0)
|
||||
{
|
||||
result = FATAL_INVALID_DATA;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pinfo->infonlen = infonamelen;
|
||||
|
||||
result = utils_create_init_event(pinfo->infoname, "_FCACHE_INIT", &pinfo->hinitdone, &isfirst);
|
||||
if (FAILED(result))
|
||||
@@ -782,7 +791,7 @@ static void destroy_information_filemap(filemap_information * pinfo)
|
||||
}
|
||||
|
||||
/* Global initializer which should be called once per process */
|
||||
int filemap_global_initialize(TSRMLS_D)
|
||||
int filemap_global_initialize()
|
||||
{
|
||||
int result = NONFATAL;
|
||||
filemap_global_context * fgcontext = NULL;
|
||||
@@ -805,13 +814,13 @@ int filemap_global_initialize(TSRMLS_D)
|
||||
|
||||
/* Set default values of structure members */
|
||||
fgcontext->pid = GetCurrentProcessId();
|
||||
fgcontext->ppid = getppid(TSRMLS_C);
|
||||
fgcontext->ppid = getppid();
|
||||
fgcontext->info = NULL;
|
||||
|
||||
/* Set global as soon as pid and ppid are set */
|
||||
WCG(fmapgdata) = fgcontext;
|
||||
|
||||
result = create_information_filemap(&fgcontext->info TSRMLS_CC);
|
||||
result = create_information_filemap(&fgcontext->info);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -845,7 +854,7 @@ Finished:
|
||||
}
|
||||
|
||||
/* Terminate global information including information filemap */
|
||||
void filemap_global_terminate(TSRMLS_D)
|
||||
void filemap_global_terminate()
|
||||
{
|
||||
dprintverbose("start filemap_global_terminate");
|
||||
|
||||
@@ -867,7 +876,7 @@ void filemap_global_terminate(TSRMLS_D)
|
||||
}
|
||||
|
||||
/* API to get current process ID */
|
||||
unsigned int filemap_getpid(TSRMLS_D)
|
||||
unsigned int filemap_getpid()
|
||||
{
|
||||
_ASSERT(WCG(fmapgdata) != NULL);
|
||||
return WCG(fmapgdata)->pid;
|
||||
@@ -876,7 +885,7 @@ unsigned int filemap_getpid(TSRMLS_D)
|
||||
/* API tp get the parent process ID */
|
||||
/* Use parent process identifier to create */
|
||||
/* separate caches for processes under a process */
|
||||
unsigned int filemap_getppid(TSRMLS_D)
|
||||
unsigned int filemap_getppid()
|
||||
{
|
||||
_ASSERT(WCG(fmapgdata) != NULL);
|
||||
return WCG(fmapgdata)->ppid;
|
||||
@@ -937,7 +946,7 @@ void filemap_destroy(filemap_context * pfilemap)
|
||||
return;
|
||||
}
|
||||
|
||||
int filemap_initialize(filemap_context * pfilemap, unsigned short fmaptype, unsigned short cachekey, unsigned short fmclass, unsigned int size_mb, unsigned char isfirst, char * shmfilepath TSRMLS_DC)
|
||||
int filemap_initialize(filemap_context * pfilemap, unsigned short fmaptype, unsigned short cachekey, unsigned short fmclass, unsigned int size_mb, unsigned char isfirst, char * shmfilepath)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int ffree = 0;
|
||||
@@ -1039,8 +1048,8 @@ int filemap_initialize(filemap_context * pfilemap, unsigned short fmaptype, unsi
|
||||
|
||||
pentry->size = size;
|
||||
pentry->mapcount = 0;
|
||||
pentry->cpid = filemap_getpid(TSRMLS_C);
|
||||
pentry->opid = filemap_getpid(TSRMLS_C);
|
||||
pentry->cpid = filemap_getpid();
|
||||
pentry->opid = filemap_getpid();
|
||||
pentry->mapaddr = NULL;
|
||||
|
||||
if (fmclass == FILEMAP_MAP_SFIXED)
|
||||
@@ -1125,8 +1134,8 @@ int filemap_initialize(filemap_context * pfilemap, unsigned short fmaptype, unsi
|
||||
|
||||
pentry->size = size;
|
||||
pentry->mapcount = 0;
|
||||
pentry->cpid = filemap_getpid(TSRMLS_C);
|
||||
pentry->opid = filemap_getpid(TSRMLS_C);
|
||||
pentry->cpid = filemap_getpid();
|
||||
pentry->opid = filemap_getpid();
|
||||
pentry->mapaddr = NULL;
|
||||
|
||||
/* This filemap is local only */
|
||||
@@ -1225,7 +1234,6 @@ void filemap_terminate(filemap_context * pfilemap)
|
||||
char * sm_file_path = NULL;
|
||||
unsigned short fmaptype = FILEMAP_TYPE_UNUSED;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("start filemap_terminate");
|
||||
|
||||
if(pfilemap != NULL)
|
||||
@@ -1305,7 +1313,7 @@ void filemap_terminate(filemap_context * pfilemap)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t filemap_getsize(filemap_context * pfilemap TSRMLS_DC)
|
||||
size_t filemap_getsize(filemap_context * pfilemap)
|
||||
{
|
||||
size_t size = 0;
|
||||
|
||||
@@ -1321,7 +1329,7 @@ size_t filemap_getsize(filemap_context * pfilemap TSRMLS_DC)
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned int filemap_getcpid(filemap_context * pfilemap TSRMLS_DC)
|
||||
unsigned int filemap_getcpid(filemap_context * pfilemap)
|
||||
{
|
||||
unsigned int cpid = 0;
|
||||
|
||||
@@ -1354,12 +1362,11 @@ void filemap_runtest()
|
||||
unsigned int orig_mapcount = 0;
|
||||
unsigned short orig_entry_count = 0;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("*** STARTING FILEMAP TESTS ***");
|
||||
|
||||
if(WCG(fmapgdata) == NULL)
|
||||
{
|
||||
result = filemap_global_initialize(TSRMLS_C);
|
||||
result = filemap_global_initialize();
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintverbose("filemap_global_initialize failed");
|
||||
@@ -1398,7 +1405,7 @@ void filemap_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = filemap_initialize(pfilemap1, FILEMAP_TYPE_FILECONTENT, 58, FILEMAP_MAP_SRANDOM, 20, TRUE, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pfilemap1, FILEMAP_TYPE_FILECONTENT, 58, FILEMAP_MAP_SRANDOM, 20, TRUE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1414,8 +1421,8 @@ void filemap_runtest()
|
||||
_ASSERT(pentry->cachekey == 58);
|
||||
_ASSERT(pentry->size == 20 * 1024 * 1024);
|
||||
_ASSERT(pentry->mapcount == 1);
|
||||
_ASSERT(pentry->cpid == filemap_getpid(TSRMLS_C));
|
||||
_ASSERT(pentry->opid == filemap_getpid(TSRMLS_C));
|
||||
_ASSERT(pentry->cpid == filemap_getpid());
|
||||
_ASSERT(pentry->opid == filemap_getpid());
|
||||
_ASSERT(pentry->mapaddr != NULL);
|
||||
|
||||
_ASSERT(pinfoh->mapcount == orig_mapcount);
|
||||
@@ -1427,7 +1434,7 @@ void filemap_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = filemap_initialize(pfilemap2, FILEMAP_TYPE_BYTECODES, 59, FILEMAP_MAP_SFIXED, 10, TRUE, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pfilemap2, FILEMAP_TYPE_BYTECODES, 59, FILEMAP_MAP_SFIXED, 10, TRUE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1443,8 +1450,8 @@ void filemap_runtest()
|
||||
_ASSERT(pentry->cachekey == 59);
|
||||
_ASSERT(pentry->size == 10 * 1024 * 1024);
|
||||
_ASSERT(pentry->mapcount == 1);
|
||||
_ASSERT(pentry->cpid == filemap_getpid(TSRMLS_C));
|
||||
_ASSERT(pentry->opid == filemap_getpid(TSRMLS_C));
|
||||
_ASSERT(pentry->cpid == filemap_getpid());
|
||||
_ASSERT(pentry->opid == filemap_getpid());
|
||||
_ASSERT(pentry->mapaddr != NULL);
|
||||
|
||||
_ASSERT(pinfoh->mapcount == orig_mapcount);
|
||||
@@ -1467,7 +1474,7 @@ void filemap_runtest()
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = filemap_initialize(pfilemap1, FILEMAP_TYPE_BYTECODES, 58, FILEMAP_MAP_SFIXED, 10, TRUE, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pfilemap1, FILEMAP_TYPE_BYTECODES, 58, FILEMAP_MAP_SFIXED, 10, TRUE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -1505,7 +1512,7 @@ Finished:
|
||||
|
||||
if(initialized == 1)
|
||||
{
|
||||
filemap_global_terminate(TSRMLS_C);
|
||||
filemap_global_terminate();
|
||||
}
|
||||
|
||||
dprintverbose("*** ENDING FILEMAP TESTS ***");
|
||||
|
||||
@@ -138,7 +138,7 @@ struct filemap_information
|
||||
{
|
||||
HANDLE hinfomap; /* Handle to filemap object */
|
||||
char * infoname; /* Name of memory map to store filemap info */
|
||||
unsigned int infonlen; /* Length of name buffer */
|
||||
size_t infonlen; /* Length of name buffer */
|
||||
filemap_information_header * header; /* Mapped memory address to information segment */
|
||||
HANDLE hinitdone; /* event inidicating if memory is initialized */
|
||||
lock_context * hrwlock; /* Lock object for read/write to info filemap */
|
||||
@@ -152,10 +152,10 @@ struct filemap_global_context
|
||||
filemap_information * info; /* pointer to filemap_information */
|
||||
};
|
||||
|
||||
extern int filemap_global_initialize(TSRMLS_D);
|
||||
extern void filemap_global_terminate(TSRMLS_D);
|
||||
extern unsigned int filemap_getpid(TSRMLS_D);
|
||||
extern unsigned int filemap_getppid(TSRMLS_D);
|
||||
extern int filemap_global_initialize();
|
||||
extern void filemap_global_terminate();
|
||||
extern unsigned int filemap_getpid();
|
||||
extern unsigned int filemap_getppid();
|
||||
|
||||
extern int filemap_create(filemap_context ** ppfilemap);
|
||||
extern void filemap_destroy(filemap_context * pfilemap);
|
||||
@@ -168,12 +168,12 @@ filemap_initialize(
|
||||
unsigned short fmclass,
|
||||
unsigned int size_mb,
|
||||
unsigned char isfirst,
|
||||
char * shmfilepath TSRMLS_DC);
|
||||
char * shmfilepath);
|
||||
|
||||
extern void filemap_terminate(filemap_context * pfilemap);
|
||||
|
||||
extern size_t filemap_getsize(filemap_context * pfilemap TSRMLS_DC);
|
||||
extern unsigned int filemap_getcpid(filemap_context * pfilemap TSRMLS_DC);
|
||||
extern size_t filemap_getsize(filemap_context * pfilemap);
|
||||
extern unsigned int filemap_getcpid(filemap_context * pfilemap);
|
||||
|
||||
extern void filemap_runtest();
|
||||
|
||||
|
||||
@@ -122,7 +122,8 @@ int lock_get_nameprefix(
|
||||
{
|
||||
int result = NONFATAL;
|
||||
char * objname = 0;
|
||||
int namelen = 0;
|
||||
size_t namelen = 0;
|
||||
int actual_len = 0;
|
||||
int pid = 0;
|
||||
int ppid = 0;
|
||||
char * scopePrefix = "";
|
||||
@@ -193,22 +194,25 @@ int lock_get_nameprefix(
|
||||
/* Create nameprefix as name_pid_ppid_ */
|
||||
if(WCG(namesalt) == NULL)
|
||||
{
|
||||
namelen = _snprintf_s(objname, namelen + 1, namelen, "%s%s_" STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION) "_" PHP_WINCACHE_VERSION "_%u_%u_%u_", scopePrefix, name, cachekey, pid, ppid);
|
||||
actual_len = _snprintf_s(objname, namelen + 1, namelen, "%s%s_" STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION) "_" PHP_WINCACHE_VERSION "_%u_%u_%u_", scopePrefix, name, cachekey, pid, ppid);
|
||||
}
|
||||
else
|
||||
{
|
||||
namelen = _snprintf_s(objname, namelen + 1, namelen, "%s%s_" STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION) "_" PHP_WINCACHE_VERSION "_%u_%s_%u_%u_", scopePrefix, name, cachekey, WCG(namesalt), pid, ppid);
|
||||
actual_len = _snprintf_s(objname, namelen + 1, namelen, "%s%s_" STRVER2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION) "_" PHP_WINCACHE_VERSION "_%u_%s_%u_%u_", scopePrefix, name, cachekey, WCG(namesalt), pid, ppid);
|
||||
}
|
||||
|
||||
if (-1 == namelen)
|
||||
if (-1 == actual_len)
|
||||
{
|
||||
error_setlasterror();
|
||||
result = FATAL_LOCK_LONGNAME;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
/* Zero out the trailing portion of the buffer, for safety! */
|
||||
ZeroMemory(objname + actual_len, namelen - actual_len);
|
||||
|
||||
*ppnew_prefix = objname;
|
||||
*pcchnew_prefix = namelen;
|
||||
*pcchnew_prefix = actual_len;
|
||||
|
||||
Finished:
|
||||
return result;
|
||||
@@ -216,7 +220,7 @@ Finished:
|
||||
|
||||
/* Initialize the lock context with valid information */
|
||||
/* lock is not ready to use unless initialize is called */
|
||||
int lock_initialize(lock_context * plock, char * name, unsigned short cachekey, unsigned short type, unsigned short usetype, unsigned int * prcount TSRMLS_DC)
|
||||
int lock_initialize(lock_context * plock, char * name, unsigned short cachekey, unsigned short type, unsigned short usetype, unsigned int * prcount)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
char * objname = 0;
|
||||
@@ -262,10 +266,9 @@ int lock_initialize(lock_context * plock, char * name, unsigned short cachekey,
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
ZeroMemory(plock->nameprefix, namelen + 1);
|
||||
|
||||
strcpy_s(plock->nameprefix, namelen + 1, objname);
|
||||
plock->namelen = namelen;
|
||||
memcpy(plock->nameprefix, objname, namelen);
|
||||
plock->nameprefix[namelen] = '\0';
|
||||
plock->namelen = (unsigned short)namelen;
|
||||
|
||||
/* Depending on what type of lock this needs */
|
||||
/* to be, create one or two handles */
|
||||
@@ -333,6 +336,7 @@ int lock_initialize(lock_context * plock, char * name, unsigned short cachekey,
|
||||
/* Only create one mutex which will be used */
|
||||
/* to synchronize access to read and write */
|
||||
objname[namelen] = 'X';
|
||||
_ASSERT(objname[namelen+1] == '\0');
|
||||
plock->hxwrite = CreateMutex(NULL, FALSE, objname);
|
||||
if( plock->hxwrite == NULL )
|
||||
{
|
||||
@@ -793,8 +797,8 @@ void lock_writeunlock(lock_context * plock)
|
||||
int lock_getnewname(lock_context * plock, char * suffix, char * newname, unsigned int length)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int namelen = 0;
|
||||
unsigned int sufflen = 0;
|
||||
size_t namelen = 0;
|
||||
size_t sufflen = 0;
|
||||
|
||||
dprintverbose("start lock_getnewname");
|
||||
|
||||
@@ -837,7 +841,6 @@ void lock_runtest()
|
||||
lock_context * plock1 = NULL;
|
||||
lock_context * plock2 = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
dprintverbose("*** STARTING LOCK TESTS ***");
|
||||
|
||||
/* Create two locks of different types */
|
||||
@@ -859,7 +862,7 @@ void lock_runtest()
|
||||
_ASSERT(plock1->id != plock2->id);
|
||||
|
||||
/* Initialize first lock */
|
||||
result = lock_initialize(plock1, "LOCK_TEST1", 1, LOCK_TYPE_SHARED, LOCK_USET_SREAD_XWRITE, &rdcount TSRMLS_CC);
|
||||
result = lock_initialize(plock1, "LOCK_TEST1", 1, LOCK_TYPE_SHARED, LOCK_USET_SREAD_XWRITE, &rdcount);
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintverbose("lock_initialize for plock1 failed");
|
||||
@@ -874,7 +877,7 @@ void lock_runtest()
|
||||
_ASSERT(plock1->hxwrite != NULL);
|
||||
|
||||
/* Initialize second lock */
|
||||
result = lock_initialize(plock2, "LOCK_TEST2", 1, LOCK_TYPE_LOCAL, LOCK_USET_XREAD_XWRITE, NULL TSRMLS_CC);
|
||||
result = lock_initialize(plock2, "LOCK_TEST2", 1, LOCK_TYPE_LOCAL, LOCK_USET_XREAD_XWRITE, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintverbose("lock_intialize for plock2 failed");
|
||||
|
||||
@@ -87,7 +87,7 @@ extern int lock_get_nameprefix(
|
||||
char **ppnew_prefix,
|
||||
size_t * pcchnew_prefix
|
||||
);
|
||||
extern int lock_initialize(lock_context * plock, char * name, unsigned short cachekey, unsigned short type, unsigned short usetype, unsigned int * prcount TSRMLS_DC);
|
||||
extern int lock_initialize(lock_context * plock, char * name, unsigned short cachekey, unsigned short type, unsigned short usetype, unsigned int * prcount);
|
||||
extern void lock_terminate(lock_context * plock);
|
||||
|
||||
extern void lock_readlock(lock_context * plock);
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
#define RPLIST_VALUE(p, o) ((rplist_value *)alloc_get_cachevalue(p, o))
|
||||
|
||||
static int findrpath_in_cache(rplist_context * pcache, const char * filename, const char * cwd_cexec, unsigned int index, rplist_value ** ppvalue TSRMLS_DC);
|
||||
static int create_rplist_data(rplist_context * pcache, const char * filename, const char * cwdcexec, rplist_value ** ppvalue TSRMLS_DC);
|
||||
static int findrpath_in_cache(rplist_context * pcache, const char * filename, const char * cwd_cexec, unsigned int index, rplist_value ** ppvalue);
|
||||
static int create_rplist_data(rplist_context * pcache, const char * filename, const char * cwdcexec, rplist_value ** ppvalue);
|
||||
static void destroy_rplist_data(rplist_context * pcache, rplist_value * pvalue);
|
||||
static void add_rplist_entry(rplist_context * pcache, unsigned int index, rplist_value * pvalue);
|
||||
static void remove_rplist_entry(rplist_context * pcache, unsigned int index, rplist_value * pvalue);
|
||||
@@ -44,7 +44,7 @@ static void remove_rplist_entry(rplist_context * pcache, unsigned int index, rpl
|
||||
/* Private methods */
|
||||
|
||||
/* Call this method atleast under a read lock */
|
||||
static int findrpath_in_cache(rplist_context * pcache, const char * filename, const char * cwd_cexec, unsigned int index, rplist_value ** ppvalue TSRMLS_DC)
|
||||
static int findrpath_in_cache(rplist_context * pcache, const char * filename, const char * cwd_cexec, unsigned int index, rplist_value ** ppvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
rplist_header * rpheader = NULL;
|
||||
@@ -85,19 +85,19 @@ static int findrpath_in_cache(rplist_context * pcache, const char * filename, co
|
||||
return result;
|
||||
}
|
||||
|
||||
static int create_rplist_data(rplist_context * pcache, const char * filename, const char * cwdcexec, rplist_value ** ppvalue TSRMLS_DC)
|
||||
static int create_rplist_data(rplist_context * pcache, const char * filename, const char * cwdcexec, rplist_value ** ppvalue)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
rplist_value * pvalue = NULL;
|
||||
char * filepath = NULL;
|
||||
char * fileinfo = NULL;
|
||||
|
||||
unsigned int flength = 0;
|
||||
unsigned int cclength = 0;
|
||||
unsigned int incplen = 0;
|
||||
unsigned int openblen = 0;
|
||||
unsigned int alloclen = 0;
|
||||
unsigned int memlen = 0;
|
||||
size_t flength = 0;
|
||||
size_t cclength = 0;
|
||||
size_t incplen = 0;
|
||||
size_t openblen = 0;
|
||||
size_t alloclen = 0;
|
||||
size_t memlen = 0;
|
||||
char * pbaseadr = NULL;
|
||||
|
||||
dprintverbose("start create_rplist_data");
|
||||
@@ -366,10 +366,10 @@ void rplist_destroy(rplist_context * pcache)
|
||||
return;
|
||||
}
|
||||
|
||||
int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned char isfirst, unsigned short cachekey, unsigned int filecount TSRMLS_DC)
|
||||
int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned char isfirst, unsigned short cachekey, unsigned int filecount)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
size_t mapsize = 0;
|
||||
unsigned int mapsize = 0;
|
||||
size_t segsize = 0;
|
||||
unsigned short mapclass = FILEMAP_MAP_SRANDOM;
|
||||
unsigned short locktype = LOCK_TYPE_SHARED;
|
||||
@@ -395,14 +395,14 @@ int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned
|
||||
}
|
||||
|
||||
/* shmfilepath = NULL to create filemap on page file */
|
||||
result = filemap_initialize(pcache->rpfilemap, FILEMAP_TYPE_RESPATHS, cachekey, mapclass, mapsize, isfirst, NULL TSRMLS_CC);
|
||||
result = filemap_initialize(pcache->rpfilemap, FILEMAP_TYPE_RESPATHS, cachekey, mapclass, mapsize, isfirst, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pcache->rpmemaddr = (char *)pcache->rpfilemap->mapaddr;
|
||||
segsize = filemap_getsize(pcache->rpfilemap TSRMLS_CC);
|
||||
segsize = filemap_getsize(pcache->rpfilemap);
|
||||
|
||||
/* Create allocator for respaths segment */
|
||||
result = alloc_create(&pcache->rpalloc);
|
||||
@@ -412,7 +412,7 @@ int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned
|
||||
}
|
||||
|
||||
/* initmemory = 1 for all page file backed shared memory allocators */
|
||||
result = alloc_initialize(pcache->rpalloc, islocal, "RESPATHS_SEGMENT", cachekey, pcache->rpfilemap->mapaddr, segsize, 1 TSRMLS_CC);
|
||||
result = alloc_initialize(pcache->rpalloc, islocal, "RESPATHS_SEGMENT", cachekey, pcache->rpfilemap->mapaddr, segsize, 1);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -434,7 +434,7 @@ int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = lock_initialize(pcache->rprwlock, "RESPATHS_CACHE", cachekey, locktype, LOCK_USET_SREAD_XWRITE, &pcache->rpheader->rdcount TSRMLS_CC);
|
||||
result = lock_initialize(pcache->rprwlock, "RESPATHS_CACHE", cachekey, locktype, LOCK_USET_SREAD_XWRITE, &pcache->rpheader->rdcount);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -517,7 +517,7 @@ void rplist_terminate(rplist_context * pcache)
|
||||
return;
|
||||
}
|
||||
|
||||
int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value ** ppvalue, size_t * poffset TSRMLS_DC)
|
||||
int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value ** ppvalue, size_t * poffset)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned char flock = 0;
|
||||
@@ -541,14 +541,14 @@ int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value
|
||||
rpheader = pcache->rpheader;
|
||||
findex = utils_getindex(filename, rpheader->valuecount);
|
||||
|
||||
result = utils_cwdcexec(cwdcexec, MAX_PATH * 2 TSRMLS_CC);
|
||||
result = utils_cwdcexec(cwdcexec, MAX_PATH * 2);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
lock_readlock(pcache->rprwlock);
|
||||
result = findrpath_in_cache(pcache, filename, cwdcexec, findex, &pvalue TSRMLS_CC);
|
||||
result = findrpath_in_cache(pcache, filename, cwdcexec, findex, &pvalue);
|
||||
lock_readunlock(pcache->rprwlock);
|
||||
|
||||
if(FAILED(result))
|
||||
@@ -559,7 +559,7 @@ int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value
|
||||
/* If the entry was not found in cache */
|
||||
if(pvalue == NULL)
|
||||
{
|
||||
result = create_rplist_data(pcache, filename, cwdcexec, &pnewval TSRMLS_CC);
|
||||
result = create_rplist_data(pcache, filename, cwdcexec, &pnewval);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -569,7 +569,7 @@ int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value
|
||||
flock = 1;
|
||||
|
||||
/* Check if entry is still missing after getting write lock */
|
||||
result = findrpath_in_cache(pcache, filename, cwdcexec, findex, &pvalue TSRMLS_CC);
|
||||
result = findrpath_in_cache(pcache, filename, cwdcexec, findex, &pvalue);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
|
||||
@@ -95,11 +95,11 @@ struct rplist_info
|
||||
|
||||
extern int rplist_create(rplist_context ** ppcache);
|
||||
extern void rplist_destroy(rplist_context * pcache);
|
||||
extern int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned char isfirst, unsigned short cachekey, unsigned int filecount TSRMLS_DC);
|
||||
extern int rplist_initialize(rplist_context * pcache, unsigned short islocal, unsigned char isfirst, unsigned short cachekey, unsigned int filecount);
|
||||
extern void rplist_initheader(rplist_context * pcache, unsigned int filecount);
|
||||
extern void rplist_terminate(rplist_context * pcache);
|
||||
|
||||
extern int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value ** ppvalue, size_t * poffset TSRMLS_DC);
|
||||
extern int rplist_getentry(rplist_context * pcache, const char * filename, rplist_value ** ppvalue, size_t * poffset);
|
||||
extern void rplist_setabsval(rplist_context * pcache, rplist_value * pvalue, size_t absentry, size_t prevsame);
|
||||
extern void rplist_deleteval(rplist_context * pcache, size_t valoffset);
|
||||
extern void rplist_markdeleted(rplist_context * pcache, size_t valoffset);
|
||||
|
||||
@@ -60,16 +60,15 @@ static void scache_destructor(void * pdestination)
|
||||
PS_OPEN_FUNC(wincache)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
zvcache_context ** ppcache = NULL;
|
||||
zvcache_context * pcache = NULL;
|
||||
zvcache_context * pzcache = NULL;
|
||||
zend_ini_entry * pinientry = NULL;
|
||||
HashTable * phtable = NULL;
|
||||
unsigned char hashupdate = 0;
|
||||
char * scolon = NULL;
|
||||
char * filepath = NULL;
|
||||
unsigned int fpathlen = 0;
|
||||
unsigned int cachekey = 0;
|
||||
int rethash = 0;
|
||||
char * filepath = NULL;
|
||||
size_t fpathlen = 0;
|
||||
uint32_t cachekey = 0;
|
||||
HANDLE hOriginalToken = NULL;
|
||||
int fCreatedHashtable = 0;
|
||||
|
||||
@@ -77,8 +76,8 @@ PS_OPEN_FUNC(wincache)
|
||||
|
||||
if(WCG(inisavepath) == NULL)
|
||||
{
|
||||
rethash = zend_hash_find(EG(ini_directives), "session.save_path", sizeof("session.save_path"), (void **)&pinientry);
|
||||
_ASSERT(rethash != FAILURE);
|
||||
pinientry = zend_hash_str_find_ptr(EG(ini_directives), "session.save_path", sizeof("session.save_path")-1);
|
||||
_ASSERT(pinientry != NULL);
|
||||
WCG(inisavepath) = pinientry;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ PS_OPEN_FUNC(wincache)
|
||||
|
||||
/* Use zvscache for unmodified save_path. Else get zvcache_context from phscache */
|
||||
/* If save path is modified but is same as PHP_INI_SYSTEM, use zvscache */
|
||||
if(WCG(inisavepath)->modified == 0 || _stricmp(WCG(inisavepath)->orig_value, WCG(inisavepath)->value) == 0)
|
||||
if(WCG(inisavepath)->modified == 0 || zend_string_equals(WCG(inisavepath)->orig_value, WCG(inisavepath)->value))
|
||||
{
|
||||
pzcache = WCG(zvscache);
|
||||
cachekey = ZVSCACHE_KEY;
|
||||
@@ -113,14 +112,15 @@ PS_OPEN_FUNC(wincache)
|
||||
cachekey = utils_hashcalc(save_path, strlen(save_path));
|
||||
cachekey = (cachekey % 65534) + 2;
|
||||
|
||||
if(zend_hash_index_find(WCG(phscache), (ulong)cachekey, (void **)&ppcache) == FAILURE)
|
||||
pcache = zend_hash_index_find_ptr(WCG(phscache), (ulong)cachekey);
|
||||
if(pcache == NULL)
|
||||
{
|
||||
/* If cachekey cache is not found, update it after creating it */
|
||||
hashupdate = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pzcache = *ppcache;
|
||||
pzcache = pcache;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,7 @@ PS_OPEN_FUNC(wincache)
|
||||
save_path = php_get_temporary_directory();
|
||||
|
||||
/* Check if path is accessible as per open_basedir */
|
||||
if(
|
||||
#ifndef ZEND_ENGINE_2_4
|
||||
(PG(safe_mode) && (!php_checkuid(save_path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
|
||||
#endif /* ZEND_ENGINE_2_4 */
|
||||
php_check_open_basedir(save_path TSRMLS_CC))
|
||||
if(php_check_open_basedir(save_path))
|
||||
{
|
||||
result = FATAL_SESSION_INITIALIZE;
|
||||
goto Finished;
|
||||
@@ -202,7 +198,7 @@ PS_OPEN_FUNC(wincache)
|
||||
}
|
||||
|
||||
/* issession = 1, islocal = 0, zvcount = 256 */
|
||||
result = zvcache_initialize(pzcache, 1, 0, (unsigned short)cachekey, 256, WCG(scachesize), filepath TSRMLS_CC);
|
||||
result = zvcache_initialize(pzcache, 1, 0, (unsigned short)cachekey, 256, WCG(scachesize), filepath);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -210,7 +206,7 @@ PS_OPEN_FUNC(wincache)
|
||||
|
||||
if(hashupdate)
|
||||
{
|
||||
zend_hash_index_update(WCG(phscache), (ulong)cachekey, (void **)&pzcache, sizeof(zvcache_context *), NULL);
|
||||
zend_hash_index_update_ptr(WCG(phscache), (ulong)cachekey, (void *) pzcache);
|
||||
}
|
||||
|
||||
if(cachekey == ZVSCACHE_KEY)
|
||||
@@ -294,14 +290,14 @@ PS_CLOSE_FUNC(wincache)
|
||||
PS_READ_FUNC(wincache)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
zval * pzval = NULL;
|
||||
zval tmp_zval;
|
||||
zval * pzval = &tmp_zval;
|
||||
zvcache_context * pzcache = NULL;
|
||||
|
||||
dprintverbose("start ps_read_func");
|
||||
|
||||
_ASSERT(key != NULL);
|
||||
_ASSERT(val != NULL);
|
||||
_ASSERT(vallen != NULL);
|
||||
|
||||
pzcache = PS_GET_MOD_DATA();
|
||||
if(pzcache == NULL)
|
||||
@@ -310,31 +306,23 @@ PS_READ_FUNC(wincache)
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(pzval);
|
||||
ZVAL_NULL(pzval);
|
||||
|
||||
result = zvcache_get(pzcache, key, &pzval TSRMLS_CC);
|
||||
result = zvcache_get(pzcache, ZSTR_VAL(key), &pzval);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
*val = Z_STRVAL_P(pzval);
|
||||
*vallen = Z_STRLEN_P(pzval);
|
||||
*val = zend_string_copy(Z_STR_P(pzval));
|
||||
|
||||
Finished:
|
||||
|
||||
if(pzval != NULL)
|
||||
{
|
||||
FREE_ZVAL(pzval);
|
||||
pzval = NULL;
|
||||
}
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in ps_read_func", result);
|
||||
|
||||
|
||||
*val = ZSTR_EMPTY_ALLOC();
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -345,9 +333,9 @@ Finished:
|
||||
/* Called on session close which writes all values to memory */
|
||||
PS_WRITE_FUNC(wincache)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
zval * pzval = NULL;
|
||||
zvcache_context * pzcache = NULL;
|
||||
int result = NONFATAL;
|
||||
zval tmp_zval;
|
||||
zvcache_context * pzcache = NULL;
|
||||
|
||||
dprintverbose("start ps_write_func");
|
||||
|
||||
@@ -361,11 +349,10 @@ PS_WRITE_FUNC(wincache)
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(pzval);
|
||||
ZVAL_STRINGL(pzval, val, vallen, 0);
|
||||
ZVAL_STR(&tmp_zval, val);
|
||||
|
||||
/* ttl = session.gc_maxlifetime, isadd = 0 */
|
||||
result = zvcache_set(pzcache, key, pzval, INI_INT("session.gc_maxlifetime"), 0 TSRMLS_CC);
|
||||
result = zvcache_set(pzcache, ZSTR_VAL(key), &tmp_zval, (unsigned int)INI_INT("session.gc_maxlifetime"), 0);
|
||||
if(FAILED(result))
|
||||
{
|
||||
goto Finished;
|
||||
@@ -373,12 +360,6 @@ PS_WRITE_FUNC(wincache)
|
||||
|
||||
Finished:
|
||||
|
||||
if(pzval != NULL)
|
||||
{
|
||||
FREE_ZVAL(pzval);
|
||||
pzval = NULL;
|
||||
}
|
||||
|
||||
if(FAILED(result))
|
||||
{
|
||||
dprintimportant("failure %d in ps_write_func", result);
|
||||
@@ -407,7 +388,7 @@ PS_DESTROY_FUNC(wincache)
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
result = zvcache_delete(pzcache, key);
|
||||
result = zvcache_delete(pzcache, ZSTR_VAL(key));
|
||||
if(FAILED(result))
|
||||
{
|
||||
/* Entry not found is not a fatal error */
|
||||
|
||||
143
wincache_utils.c
143
wincache_utils.c
@@ -70,11 +70,11 @@ SetFileDacl(
|
||||
|
||||
/* CRC 32 functions */
|
||||
|
||||
static unsigned int crc32_generate(int n);
|
||||
static unsigned int utils_crc32(const char * str, unsigned int strlen);
|
||||
static uint32_t crc32_generate(int n);
|
||||
static uint32_t utils_crc32(const char * str, size_t strlen);
|
||||
|
||||
/* CRC table generated by crc32_generate() */
|
||||
static unsigned int crc32_table[] = {
|
||||
static uint32_t crc32_table[] = {
|
||||
/* 0 */ 0x00000000, 0x3b83984b, 0x77073096, 0x4c84a8dd,
|
||||
/* 4 */ 0xee0e612c, 0xd58df967, 0x990951ba, 0xa28ac9f1,
|
||||
/* 8 */ 0x076dc419, 0x3cee5c52, 0x706af48f, 0x4be96cc4,
|
||||
@@ -141,10 +141,10 @@ static unsigned int crc32_table[] = {
|
||||
/* 252 */ 0xb7bd5c3b, 0x8c3ec470, 0xc0ba6cad, 0xfb39f4e6,
|
||||
};
|
||||
|
||||
static unsigned int crc32_generate(int n)
|
||||
static uint32_t crc32_generate(int n)
|
||||
{
|
||||
int i = 0;
|
||||
unsigned int crc = 0;
|
||||
uint32_t crc = 0;
|
||||
|
||||
crc = n;
|
||||
for(i = 8; i >= 0; i--)
|
||||
@@ -162,11 +162,11 @@ static unsigned int crc32_generate(int n)
|
||||
return crc;
|
||||
}
|
||||
|
||||
static unsigned int utils_crc32(const char * str, unsigned int strlen)
|
||||
static uint32_t utils_crc32(const char * str, size_t strlen)
|
||||
{
|
||||
unsigned int index = 0;
|
||||
unsigned int table_index = 0;
|
||||
unsigned int crcvalue = 0xFFFFFFFF;
|
||||
size_t index = 0;
|
||||
uint32_t table_index = 0;
|
||||
uint32_t crcvalue = 0xFFFFFFFF;
|
||||
char chvalue = 0;
|
||||
char toldiff = 'a' - 'A';
|
||||
|
||||
@@ -189,15 +189,15 @@ static unsigned int utils_crc32(const char * str, unsigned int strlen)
|
||||
return ~crcvalue;
|
||||
}
|
||||
|
||||
unsigned int utils_hashcalc(const char * str, unsigned int strlen)
|
||||
uint32_t utils_hashcalc(const char * str, size_t strlen)
|
||||
{
|
||||
return utils_crc32(str, strlen);
|
||||
}
|
||||
|
||||
unsigned int utils_getindex(const char * filename, unsigned int numfiles)
|
||||
uint32_t utils_getindex(const char * filename, unsigned int numfiles)
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
unsigned int length = 0;
|
||||
uint32_t hash = 0;
|
||||
size_t length = 0;
|
||||
|
||||
dprintdecorate("start utils_getindex");
|
||||
|
||||
@@ -206,10 +206,15 @@ unsigned int utils_getindex(const char * filename, unsigned int numfiles)
|
||||
|
||||
length = strlen(filename);
|
||||
_ASSERT(length != 0);
|
||||
if (length > MAX_PATH)
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
hash = utils_hashcalc(filename, length);
|
||||
hash = hash % numfiles;
|
||||
|
||||
Finished:
|
||||
dprintdecorate("end utils_getindex");
|
||||
|
||||
return hash;
|
||||
@@ -225,7 +230,7 @@ const char * utils_filepath(zend_file_handle * file_handle)
|
||||
/* Use filename if opened_path is null */
|
||||
if(file_handle->opened_path != NULL)
|
||||
{
|
||||
pchar = file_handle->opened_path;
|
||||
pchar = ZSTR_VAL(file_handle->opened_path);
|
||||
}
|
||||
else if(file_handle->filename != NULL)
|
||||
{
|
||||
@@ -236,7 +241,7 @@ const char * utils_filepath(zend_file_handle * file_handle)
|
||||
return pchar;
|
||||
}
|
||||
|
||||
char * utils_fullpath(const char * filename, int filename_len)
|
||||
char * utils_fullpath(const char * filename, size_t filename_len)
|
||||
{
|
||||
char * filepath = NULL;
|
||||
unsigned int fplength = 0;
|
||||
@@ -281,12 +286,12 @@ Finished:
|
||||
return filepath;
|
||||
}
|
||||
|
||||
int utils_cwdcexec(char * buffer, unsigned int length TSRMLS_DC)
|
||||
int utils_cwdcexec(char * buffer, size_t length)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
unsigned int cwdlen = 0;
|
||||
const char * execname = NULL;
|
||||
unsigned int execlen = 0;
|
||||
size_t execlen = 0;
|
||||
|
||||
dprintverbose("start utils_cwdcxec");
|
||||
|
||||
@@ -295,12 +300,12 @@ int utils_cwdcexec(char * buffer, unsigned int length TSRMLS_DC)
|
||||
|
||||
ZeroMemory(buffer, length);
|
||||
|
||||
cwdlen = GetCurrentDirectory(length, buffer);
|
||||
cwdlen = GetCurrentDirectory((DWORD)length, buffer);
|
||||
*(buffer + cwdlen) = '|';
|
||||
|
||||
if(zend_is_executing(TSRMLS_C))
|
||||
if(zend_is_executing())
|
||||
{
|
||||
execname = zend_get_executed_filename(TSRMLS_C);
|
||||
execname = zend_get_executed_filename();
|
||||
execlen = strlen(execname);
|
||||
|
||||
if((length - cwdlen - 2) < execlen)
|
||||
@@ -324,7 +329,7 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int utils_filefolder(const char * filepath, unsigned int flength, char * pbuffer, unsigned int length)
|
||||
int utils_filefolder(const char * filepath, size_t flength, char * pbuffer, size_t length)
|
||||
{
|
||||
int result = NONFATAL;
|
||||
char * pbslash = NULL;
|
||||
@@ -353,7 +358,7 @@ int utils_filefolder(const char * filepath, unsigned int flength, char * pbuffer
|
||||
|
||||
/* length does not include backslash */
|
||||
folderlen = pbslash - filepath;
|
||||
if (folderlen > length)
|
||||
if (folderlen > (size_t)length)
|
||||
{
|
||||
result = FATAL_INVALID_ARGUMENT;
|
||||
goto Finished;
|
||||
@@ -371,7 +376,7 @@ Finished:
|
||||
return result;
|
||||
}
|
||||
|
||||
int utils_apoolpid(TSRMLS_D)
|
||||
int utils_apoolpid()
|
||||
{
|
||||
int retval = -1;
|
||||
char * buffer = NULL;
|
||||
@@ -451,7 +456,7 @@ unsigned int utils_ticksdiff(unsigned int present, unsigned int past)
|
||||
}
|
||||
|
||||
/* Copy of php_resolve_path from PHP 5.3 branch for use in PHP 5.2 */
|
||||
char * utils_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC)
|
||||
char * utils_resolve_path(const char *filename, size_t filename_length, const char *path)
|
||||
{
|
||||
char resolved_path[MAXPATHLEN];
|
||||
char trypath[MAXPATHLEN];
|
||||
@@ -466,9 +471,9 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
/* Don't resolve paths which contain protocol (except of file://) */
|
||||
for (p = filename; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
|
||||
if ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')) {
|
||||
wrapper = php_stream_locate_url_wrapper(filename, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
|
||||
wrapper = php_stream_locate_url_wrapper(filename, &actual_path, STREAM_OPEN_FOR_INCLUDE);
|
||||
if (wrapper == &php_plain_files_wrapper) {
|
||||
if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) {
|
||||
if (tsrm_realpath(actual_path, resolved_path)) {
|
||||
return alloc_estrdup(resolved_path);
|
||||
}
|
||||
}
|
||||
@@ -492,7 +497,7 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
(IS_ABSOLUTE_PATH(filename, filename_length) || IS_SLASH(filename[0])) ||
|
||||
!path ||
|
||||
!*path) {
|
||||
if (tsrm_realpath(filename, resolved_path TSRMLS_CC)) {
|
||||
if (tsrm_realpath(filename, resolved_path)) {
|
||||
return alloc_estrdup(resolved_path);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -523,7 +528,7 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
memcpy(trypath+(end-ptr)+1, filename, filename_length+1);
|
||||
ptr = end+1;
|
||||
} else {
|
||||
int len = strlen(ptr);
|
||||
size_t len = strlen(ptr);
|
||||
|
||||
if (len + 1 + filename_length + 1 >= MAXPATHLEN) {
|
||||
break;
|
||||
@@ -535,30 +540,30 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
}
|
||||
actual_path = trypath;
|
||||
if (is_stream_wrapper) {
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE);
|
||||
if (!wrapper) {
|
||||
continue;
|
||||
} else if (wrapper != &php_plain_files_wrapper) {
|
||||
if (wrapper->wops->url_stat) {
|
||||
php_stream_statbuf ssb;
|
||||
|
||||
if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) {
|
||||
if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL)) {
|
||||
return alloc_estrdup(trypath);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) {
|
||||
if (tsrm_realpath(actual_path, resolved_path)) {
|
||||
return alloc_estrdup(resolved_path);
|
||||
}
|
||||
} /* end provided path */
|
||||
|
||||
/* check in calling scripts' current working directory as a fall back case
|
||||
*/
|
||||
if (zend_is_executing(TSRMLS_C)) {
|
||||
const char *exec_fname = zend_get_executed_filename(TSRMLS_C);
|
||||
int exec_fname_length = strlen(exec_fname);
|
||||
if (zend_is_executing()) {
|
||||
const char *exec_fname = zend_get_executed_filename();
|
||||
size_t exec_fname_length = strlen(exec_fname);
|
||||
|
||||
while ((--exec_fname_length >= 0) && !IS_SLASH(exec_fname[exec_fname_length]));
|
||||
if (exec_fname && exec_fname[0] != '[' &&
|
||||
@@ -571,14 +576,14 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
/* Check for stream wrapper */
|
||||
for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++);
|
||||
if ((*p == ':') && (p - trypath > 1) && (p[1] == '/') && (p[2] == '/')) {
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
|
||||
wrapper = php_stream_locate_url_wrapper(trypath, &actual_path, STREAM_OPEN_FOR_INCLUDE);
|
||||
if (!wrapper) {
|
||||
return NULL;
|
||||
} else if (wrapper != &php_plain_files_wrapper) {
|
||||
if (wrapper->wops->url_stat) {
|
||||
php_stream_statbuf ssb;
|
||||
|
||||
if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL TSRMLS_CC)) {
|
||||
if (SUCCESS == wrapper->wops->url_stat(wrapper, trypath, 0, &ssb, NULL)) {
|
||||
return alloc_estrdup(trypath);
|
||||
}
|
||||
}
|
||||
@@ -586,7 +591,7 @@ char * utils_resolve_path(const char *filename, int filename_length, const char
|
||||
}
|
||||
}
|
||||
|
||||
if (tsrm_realpath(actual_path, resolved_path TSRMLS_CC)) {
|
||||
if (tsrm_realpath(actual_path, resolved_path)) {
|
||||
return alloc_estrdup(resolved_path);
|
||||
}
|
||||
}
|
||||
@@ -1229,19 +1234,20 @@ void utils_get_filename_and_line(
|
||||
)
|
||||
{
|
||||
const char *error_filename;
|
||||
uint error_lineno;
|
||||
uint error_lineno = 0;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
error_filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
|
||||
} else if (EG(in_execution)) {
|
||||
error_filename = EG(active_op_array)?EG(active_op_array)->filename:NULL;
|
||||
error_lineno = EG(opline_ptr)?(*EG(opline_ptr))->lineno:0;
|
||||
if (zend_is_compiling()) {
|
||||
error_filename = ZSTR_VAL(zend_get_compiled_filename());
|
||||
error_lineno = zend_get_compiled_lineno();
|
||||
} else if (EG(current_execute_data) &&
|
||||
EG(current_execute_data)->func &&
|
||||
EG(current_execute_data)->func->type == ZEND_USER_FUNCTION) {
|
||||
error_filename = ZSTR_VAL(EG(current_execute_data)->func->op_array.filename);
|
||||
error_lineno = (EG(current_execute_data)->opline ? EG(current_execute_data)->opline->lineno : 0);
|
||||
} else {
|
||||
error_filename = NULL;
|
||||
error_lineno = 0;
|
||||
}
|
||||
|
||||
if (!error_filename) {
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
@@ -1250,3 +1256,48 @@ void utils_get_filename_and_line(
|
||||
*linenumber = error_lineno;
|
||||
}
|
||||
|
||||
const char * utils_get_typename(zend_uchar type)
|
||||
{
|
||||
const char *valuetype;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case IS_UNDEF:
|
||||
valuetype = "undef";
|
||||
break;
|
||||
case IS_NULL:
|
||||
valuetype = "null";
|
||||
break;
|
||||
case IS_TRUE:
|
||||
case IS_FALSE:
|
||||
valuetype = "bool";
|
||||
break;
|
||||
case IS_LONG:
|
||||
valuetype = "long";
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
valuetype = "double";
|
||||
break;
|
||||
case IS_STRING:
|
||||
valuetype = "string";
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
valuetype = "array";
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
valuetype = "object";
|
||||
break;
|
||||
case IS_REFERENCE:
|
||||
valuetype = "reference";
|
||||
break;
|
||||
case IS_CONSTANT:
|
||||
case IS_CONSTANT_AST:
|
||||
valuetype = "constant";
|
||||
break;
|
||||
default:
|
||||
valuetype = "unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return valuetype;
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
#ifndef _WINCACHE_UTILS_H_
|
||||
#define _WINCACHE_UTILS_H_
|
||||
|
||||
extern unsigned int utils_hashcalc(const char * str, unsigned int strlen);
|
||||
extern unsigned int utils_getindex(const char * filename, unsigned int numfiles);
|
||||
extern uint32_t utils_hashcalc(const char * str, size_t strlen);
|
||||
extern uint32_t utils_getindex(const char * filename, unsigned int numfiles);
|
||||
extern const char * utils_filepath(zend_file_handle * file_handle);
|
||||
extern char * utils_fullpath(const char * filename, int filename_len);
|
||||
extern int utils_cwdcexec(char * buffer, unsigned int length TSRMLS_DC);
|
||||
extern int utils_filefolder(const char * filepath, unsigned int flength, char * pbuffer, unsigned int length);
|
||||
extern int utils_apoolpid(TSRMLS_D);
|
||||
extern char * utils_fullpath(const char * filename, size_t filename_len);
|
||||
extern int utils_cwdcexec(char * buffer, size_t length);
|
||||
extern int utils_filefolder(const char * filepath, size_t flength, char * pbuffer, size_t length);
|
||||
extern int utils_apoolpid();
|
||||
extern unsigned int utils_ticksdiff(unsigned int present, unsigned int past);
|
||||
extern char * utils_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC);
|
||||
extern char * utils_resolve_path(const char *filename, size_t filename_length, const char *path);
|
||||
extern char * utils_build_temp_filename(char * suffix);
|
||||
extern void utils_get_filename_and_line(const char **filename, uint *linenumber);
|
||||
|
||||
@@ -69,4 +69,6 @@ utils_set_apppool_acl(
|
||||
extern int utils_revert_if_necessary(HANDLE *phOriginalToken);
|
||||
extern void utils_reimpersonate_if_necessary(HANDLE hOriginalToken);
|
||||
|
||||
extern const char * utils_get_typename(zend_uchar type);
|
||||
|
||||
#endif /* _WINCACHE_UTILS_H_ */
|
||||
|
||||
1176
wincache_zvcache.c
1176
wincache_zvcache.c
File diff suppressed because it is too large
Load Diff
@@ -34,62 +34,12 @@
|
||||
#ifndef _WINCACHE_ZVCACHE_H_
|
||||
#define _WINCACHE_ZVCACHE_H_
|
||||
|
||||
typedef struct zv_bucket
|
||||
typedef struct _zvcache_hashtable_pool_tracker zvcache_hashtable_pool_tracker;
|
||||
struct _zvcache_hashtable_pool_tracker
|
||||
{
|
||||
ulong h; /* Bucket hash */
|
||||
uint nKeyLength; /* Bucket key length */
|
||||
size_t pData; /* void *pData; Pointer to data */
|
||||
size_t pDataPtr; /* void *pDataPtr; Sometimes data itself */
|
||||
size_t pListNext; /* struct bucket *pListNext; Offset */
|
||||
size_t pListLast; /* struct bucket *pListLast; Offset */
|
||||
size_t pNext; /* struct bucket *pNext; Offset */
|
||||
size_t pLast; /* struct bucket *pLast; Offset */
|
||||
char arKey[1]; /* Must be last element */
|
||||
} zv_Bucket;
|
||||
|
||||
typedef struct _zv_hashtable
|
||||
{
|
||||
uint nTableSize; /* Bucket table size */
|
||||
uint nTableMask; /* Bucket table mask */
|
||||
uint nNumOfElements; /* Number of elements in hashtable */
|
||||
ulong nNextFreeElement; /* Next free element */
|
||||
size_t pInternalPointer; /* Bucket *pInternalPointer; Offset */
|
||||
size_t pListHead; /* Bucket *pListHead; Offset */
|
||||
size_t pListTail; /* Bucket *pListTail; Offset */
|
||||
size_t arBuckets; /* Bucket **arBuckets; Offset */
|
||||
dtor_func_t pDestructor; /* Destructor action */
|
||||
zend_bool persistent; /* Persistent allocation */
|
||||
unsigned char nApplyCount; /* Apply counter */
|
||||
zend_bool bApplyProtection; /* Apply protection */
|
||||
#if ZEND_DEBUG
|
||||
int inconsistent; /* Need not worry about this */
|
||||
#endif
|
||||
} zv_HashTable;
|
||||
|
||||
typedef union _zv_zvalue_value
|
||||
{
|
||||
long lval; /* long val */
|
||||
double dval; /* double val */
|
||||
struct
|
||||
{
|
||||
size_t val; /* char *val; Offset */
|
||||
int len; /* string val length */
|
||||
} str;
|
||||
struct
|
||||
{
|
||||
size_t val; /* Hashtable *ht; Offset */
|
||||
size_t hoff; /* Memory pool offset */
|
||||
} ht;
|
||||
zend_object_value obj; /* zend_object_value */
|
||||
} zv_zvalue_value;
|
||||
|
||||
typedef struct _zv_zval_struct
|
||||
{
|
||||
zv_zvalue_value value; /* union value */
|
||||
zend_uint refcount__gc; /* reference counter */
|
||||
zend_uchar type; /* type */
|
||||
zend_uchar is_ref__gc; /* is reference */
|
||||
} zv_zval;
|
||||
size_t val; /* Hashtable *ht; Offset */
|
||||
size_t hoff; /* Memory pool offset */
|
||||
};
|
||||
|
||||
typedef struct zvcache_value zvcache_value;
|
||||
struct zvcache_value
|
||||
@@ -97,7 +47,7 @@ struct zvcache_value
|
||||
size_t zvalue; /* Offset of zval value stored */
|
||||
size_t keystr; /* Offset of key string */
|
||||
unsigned short keylen; /* Length of key string */
|
||||
unsigned int sizeb; /* Memory allocated for zvalue in bytes */
|
||||
size_t sizeb; /* Memory allocated for zvalue in bytes */
|
||||
|
||||
unsigned int add_ticks; /* Tick count when entry was created */
|
||||
unsigned int use_ticks; /* Tick count when entry was last used */
|
||||
@@ -131,7 +81,7 @@ struct zvcopy_context
|
||||
void * palloc; /* Allocator for alloc_a* functions */
|
||||
char * pbaseadr; /* Base address of the segment */
|
||||
size_t hoffset; /* Offset of mpool_header */
|
||||
unsigned int allocsize; /* Amount of memory allocated */
|
||||
size_t allocsize; /* Amount of memory allocated */
|
||||
|
||||
fn_malloc fnmalloc; /* Function to use for malloc */
|
||||
fn_realloc fnrealloc; /* Function to use for realloc */
|
||||
@@ -143,10 +93,10 @@ typedef struct zvcache_context zvcache_context;
|
||||
struct zvcache_context
|
||||
{
|
||||
unsigned int id; /* unique identifier for cache */
|
||||
unsigned int issession; /* session cache or user cache */
|
||||
unsigned short islocal; /* is the cache local or shared */
|
||||
unsigned short cachekey; /* unique cache key used in names */
|
||||
HANDLE hinitdone; /* event indicating if memory is initialized */
|
||||
unsigned int issession; /* session cache or user cache */
|
||||
|
||||
zvcopy_context * incopy; /* zvcopy context to use for non-array copyin */
|
||||
zvcopy_context * outcopy; /* zvcopy context to use for all copyout */
|
||||
@@ -174,23 +124,33 @@ struct zvcache_info_entry
|
||||
char * key; /* cache item key */
|
||||
unsigned int ttl; /* ttl of this entry */
|
||||
unsigned int age; /* Age in seconds */
|
||||
unsigned short type; /* type of zval which is stored as value */
|
||||
unsigned int sizeb; /* memory allocated for zval in bytes */
|
||||
zend_uchar type; /* type of zval which is stored as value */
|
||||
size_t sizeb; /* memory allocated for zval in bytes */
|
||||
unsigned int hitcount; /* hitcount for this entry */
|
||||
};
|
||||
|
||||
extern int zvcache_create(zvcache_context ** ppcache);
|
||||
extern void zvcache_destroy(zvcache_context * pcache);
|
||||
extern int zvcache_initialize(zvcache_context * pcache, unsigned int issession, unsigned short islocal, unsigned short cachekey, unsigned int zvcount, unsigned int cachesize, char * shmfilepath TSRMLS_DC);
|
||||
|
||||
extern int zvcache_initialize(
|
||||
zvcache_context * pcache,
|
||||
unsigned int issession,
|
||||
unsigned short islocal,
|
||||
unsigned short cachekey,
|
||||
unsigned int zvcount,
|
||||
unsigned int cachesize,
|
||||
char * shmfilepath
|
||||
);
|
||||
|
||||
extern void zvcache_terminate(zvcache_context * pcache);
|
||||
|
||||
extern int zvcache_get(zvcache_context * pcache, const char * key, zval ** pvalue TSRMLS_DC);
|
||||
extern int zvcache_set(zvcache_context * pcache, const char * key, zval * pzval, unsigned int ttl, unsigned char isadd TSRMLS_DC);
|
||||
extern int zvcache_get(zvcache_context * pcache, const char * key, zval ** pvalue);
|
||||
extern int zvcache_set(zvcache_context * pcache, const char * key, zval * pzval, unsigned int ttl, unsigned char isadd);
|
||||
extern int zvcache_delete(zvcache_context * pcache, const char * key);
|
||||
extern int zvcache_clear(zvcache_context * pcache);
|
||||
extern int zvcache_exists(zvcache_context * pcache, const char * key, unsigned char * pexists);
|
||||
extern int zvcache_list(zvcache_context * pcache, zend_bool summaryonly, char * pkey, zvcache_info * pcinfo, zend_llist * plist);
|
||||
extern int zvcache_change(zvcache_context * pcache, const char * key, int delta, int * newvalue);
|
||||
extern int zvcache_compswitch(zvcache_context * pcache, const char * key, int oldvalue, int newvalue);
|
||||
extern int zvcache_change(zvcache_context * pcache, const char * key, zend_long delta, zend_long * newvalue);
|
||||
extern int zvcache_compswitch(zvcache_context * pcache, const char * key, zend_long oldvalue, zend_long newvalue);
|
||||
|
||||
#endif /* _WINCACHE_ZVCACHE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user