Changeset 73
- Timestamp:
- 05/05/05 10:53:05 (3 years ago)
- Files:
-
- eaccelerator/trunk/config.m4 (modified) (13 diffs)
- eaccelerator/trunk/eaccelerator.c (modified) (4 diffs)
- eaccelerator/trunk/eaccelerator.h (modified) (6 diffs)
- eaccelerator/trunk/mm.c (modified) (2 diffs)
- eaccelerator/trunk/webui.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/config.m4
r64 r73 1 AC_DEFUN([EA_REMOVE_IPC_TEST], [ 2 # for cygwin ipc error 3 if test -f conftest* ; then 4 echo $ECHO_N "Wait for conftest* to exit$ECHO_C" 5 while ! rm -f conftest* 2>/dev/null ; do 6 echo $ECHO_N ".$ECHO_C" 7 sleep 1 8 done 9 echo 10 fi 11 ]) 12 1 13 AC_ARG_WITH(eaccelerator,[],[enable_eaccelerator=$withval]) 2 14 … … 148 160 #define MM_SHM_IPC 149 161 #define MM_TEST_SHM 150 #include " mm.c"162 #include "$ext_srcdir/mm.c" 151 163 ],dnl 152 164 mm_shm_ipc=yes 153 165 msg=yes,msg=no,msg=no) 154 166 AC_MSG_RESULT([$msg]) 167 EA_REMOVE_IPC_TEST() 155 168 156 169 AC_MSG_CHECKING(for mmap shared memory support) … … 158 171 #define MM_SHM_MMAP_FILE 159 172 #define MM_TEST_SHM 160 #include " mm.c"173 #include "$ext_srcdir/mm.c" 161 174 ],dnl 162 175 mm_shm_mmap_file=yes … … 168 181 #define MM_SHM_MMAP_ZERO 169 182 #define MM_TEST_SHM 170 #include " mm.c"183 #include "$ext_srcdir/mm.c" 171 184 ],dnl 172 185 mm_shm_mmap_zero=yes … … 178 191 #define MM_SHM_MMAP_ANON 179 192 #define MM_TEST_SHM 180 #include " mm.c"193 #include "$ext_srcdir/mm.c" 181 194 ],dnl 182 195 mm_shm_mmap_anon=yes … … 188 201 #define MM_SHM_MMAP_POSIX 189 202 #define MM_TEST_SHM 190 #include " mm.c"203 #include "$ext_srcdir/mm.c" 191 204 ],dnl 192 205 mm_shm_mmap_posix=yes … … 210 223 AC_DEFINE(MM_SHM_MMAP_FILE, 1, [Define if you like to use mmap on temporary file shared memory]) 211 224 msg="mmap" 212 fi 213 AC_MSG_RESULT([$msg]) 225 else 226 msg="no" 227 fi 228 AC_MSG_RESULT([$msg]) 229 if test "$msg" = "no" ; then 230 AC_MSG_WARN([eaccelerator cannot detect shared memory type, which is required]) 231 fi 214 232 215 233 AC_MSG_CHECKING(for spinlock semaphores support) 216 234 AC_TRY_RUN([#define MM_SEM_SPINLOCK 217 235 #define MM_TEST_SEM 218 #include " mm.c"236 #include "$ext_srcdir/mm.c" 219 237 ],dnl 220 238 mm_sem_spinlock=yes … … 225 243 AC_TRY_RUN([#define MM_SEM_PTHREAD 226 244 #define MM_TEST_SEM 227 #include " mm.c"245 #include "$ext_srcdir/mm.c" 228 246 ],dnl 229 247 mm_sem_pthread=yes … … 234 252 AC_TRY_RUN([#define MM_SEM_POSIX 235 253 #define MM_TEST_SEM 236 #include " mm.c"254 #include "$ext_srcdir/mm.c" 237 255 ],dnl 238 256 mm_sem_posix=yes … … 243 261 AC_TRY_RUN([#define MM_SEM_IPC 244 262 #define MM_TEST_SEM 245 #include " mm.c"263 #include "$ext_srcdir/mm.c" 246 264 ],dnl 247 265 mm_sem_ipc=yes 248 266 msg=yes,msg=no,msg=no) 249 267 AC_MSG_RESULT([$msg]) 268 EA_REMOVE_IPC_TEST() 250 269 251 270 AC_MSG_CHECKING(for fcntl semaphores support) 252 271 AC_TRY_RUN([#define MM_SEM_FCNTL 253 272 #define MM_TEST_SEM 254 #include " mm.c"273 #include "$ext_srcdir/mm.c" 255 274 ],dnl 256 275 mm_sem_fcntl=yes … … 261 280 AC_TRY_RUN([#define MM_SEM_FLOCK 262 281 #define MM_TEST_SEM 263 #include " mm.c"282 #include "$ext_srcdir/mm.c" 264 283 ],dnl 265 284 mm_sem_flock=yes … … 286 305 AC_DEFINE(MM_SEM_POSIX, 1, [Define if you like to use posix based semaphores]) 287 306 msg="posix" 288 fi 289 AC_MSG_RESULT([$msg]) 307 else 308 msg="no" 309 fi 310 AC_MSG_RESULT([$msg]) 311 if test "$msg" = "no" ; then 312 AC_MSG_WARN([eaccelerator cannot semaphores type, which is required]) 313 fi 290 314 291 315 AC_CHECK_FUNC(sched_yield,[ … … 298 322 299 323 old_cppflags="$CPPFLAGS" 300 CPPFLAGS="$CPPFLAGS $INCLUDES "324 CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir" 301 325 AC_MSG_CHECKING(for ext/session/php_session.h) 302 326 AC_TRY_CPP([#include "ext/session/php_session.h"],msg="yes",msg="no") eaccelerator/trunk/eaccelerator.c
r71 r73 70 70 */ 71 71 72 #ifdef ZEND_WIN3273 # include <process.h>74 # ifndef S_ISREG75 # define S_ISREG(mode) (((mode)&S_IFMT) & S_IFREG)76 # endif77 # ifndef S_IRUSR78 # define S_IRUSR S_IREAD79 # endif80 # ifndef S_IWUSR81 # define S_IWUSR S_IWRITE82 # endif83 #else84 # include <dirent.h>85 #endif86 87 72 #include "php.h" 88 73 #include "php_ini.h" … … 120 105 static int eaccelerator_is_extension = 0; 121 106 static zend_extension* ZendOptimizer = NULL; 122 #ifdef ZTS123 static MUTEX_T mm_mutex;124 #endif125 107 126 108 static HashTable eaccelerator_global_function_table; … … 142 124 /* external declarations */ 143 125 PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); 144 PHPAPI char *php_get_uname();145 126 146 127 ZEND_DLEXPORT zend_op_array* eaccelerator_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); … … 950 931 return ret; 951 932 } 952 953 typedef union align_union {954 double d;955 void *v;956 int (*func)(int);957 long l;958 } align_union;959 960 #if (defined (__GNUC__) && __GNUC__ >= 2)961 #define EACCELERATOR_PLATFORM_ALIGNMENT (__alignof__ (align_test))962 #else963 #define EACCELERATOR_PLATFORM_ALIGNMENT (sizeof(align_union))964 #endif965 966 #define EACCELERATOR_ALIGN(n) (n) = (void*)((((size_t)(n)-1) & ~(EACCELERATOR_PLATFORM_ALIGNMENT-1)) + EACCELERATOR_PLATFORM_ALIGNMENT)967 933 968 934 /******************************************************************************/ eaccelerator/trunk/eaccelerator.h
r64 r73 45 45 #endif 46 46 47 #if ndef ZEND_WIN3247 #if !defined(ZEND_WIN32) && defined(HAVE_CONFIG_H) 48 48 # if ZEND_MODULE_API_NO >= 20001222 49 49 # include "config.h" … … 51 51 # include "php_config.h" 52 52 # endif 53 #endif 54 55 /* needed to compile eA as a static php module */ 56 extern zend_module_entry eaccelerator_module_entry; 57 #define phpext_eaccelerator_ptr &eaccelerator_module_entry 58 59 /* fixes compile errors on php5.1 */ 60 #ifdef STR_EMPTY_ALLOC 61 #define empty_string STR_EMPTY_ALLOC() 53 62 #endif 54 63 … … 89 98 # ifndef ZEND_WIN32 90 99 # ifdef HAVE_FLOCK 100 # include <sys/file.h> 91 101 # define EACCELERATOR_FLOCK(FILE,OP) flock((FILE),(OP)) 92 102 # else … … 119 129 #endif 120 130 131 #ifdef ZEND_WIN32 132 # include <process.h> 133 # ifndef S_ISREG 134 # define S_ISREG(mode) (((mode)&S_IFMT) & S_IFREG) 135 # endif 136 # ifndef S_IRUSR 137 # define S_IRUSR S_IREAD 138 # endif 139 # ifndef S_IWUSR 140 # define S_IWUSR S_IWRITE 141 # endif 142 #else 143 # include <dirent.h> 144 #endif 145 121 146 #ifdef ZTS 122 147 # define ZTS_LOCK() tsrm_mutex_lock(mm_mutex) … … 164 189 #define MAX_DUP_STR_LEN 256 165 190 166 #define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld)) 191 #ifndef offsetof 192 # define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld)) 193 #endif 167 194 168 195 #define EACCELERATOR_EXTENSION_NAME "eAccelerator" … … 377 404 } mm_cond_entry; 378 405 406 typedef union align_union { 407 double d; 408 void *v; 409 int (*func)(int); 410 long l; 411 } align_union; 412 379 413 /******************************************************************************/ 414 415 #ifdef ZTS 416 MUTEX_T mm_mutex; 417 #endif 380 418 381 419 void format_size (char *s, unsigned int size, int legend); eaccelerator/trunk/mm.c
r63 r73 1 1 /* libmm replacement */ 2 2 3 #ifdef HAVE_CONFIG_H 3 #if !defined(MM_TEST_SHM) && !defined(MM_TEST_SEM) 4 # ifdef HAVE_CONFIG_H 4 5 # include "config.h" 6 # endif 7 # include "php.h" 5 8 #endif 6 9 … … 580 583 581 584 #define MM_SHM_TYPE "sysvipc" 585 586 #ifndef SHM_R 587 # define SHM_R 0444 /* read permission */ 588 #endif 589 #ifndef SHM_W 590 # define SHM_W 0222 /* write permission */ 591 #endif 582 592 583 593 static MM* mm_create_shm(const char* key, size_t size) { eaccelerator/trunk/webui.c
r64 r73 61 61 62 62 extern eaccelerator_mm *eaccelerator_mm_instance; 63 PHPAPI char *php_get_uname(); 63 64 64 65 /******************************************************************************/ … … 283 284 }; 284 285 285 static char *color (int num)286 static char const *color (int num) 286 287 { 287 288 return color_list[num % (sizeof (color_list) / sizeof (char *))];