Changeset 134

Show
Ignore:
Timestamp:
11/20/05 18:53:43 (3 years ago)
Author:
zoeloelip
Message:

* Removed executor hooks, they weren't used anyway.
* Check if eA has a valid cache directory.
* Make the init of php fail if the initialisation of the shared memory

or cache directory failes.

* set shared memory size in eaccelerator.ini to 0 so the default OS

size is used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r133 r134  
     12005-11-20 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Removed executor hooks, they weren't used anyway. 
     4        * Check if eA has a valid cache directory. 
     5        * Make the init of php fail if the initialisation of the shared memory 
     6          or cache directory failes. 
     7        * set shared memory size in eaccelerator.ini to 0 so the default OS 
     8          size is used. 
     9 
    1102005-11-17 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    211 
  • eaccelerator/trunk/Makefile.in

    r116 r134  
    11LTLIBRARY_NAME        = libeaccelerator.la 
    2 LTLIBRARY_SOURCES     = eaccelerator.c optimize.c execute.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c 
     2LTLIBRARY_SOURCES     = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c 
    33LTLIBRARY_SHARED_NAME = eaccelerator.la 
    44 
  • eaccelerator/trunk/config.m4

    r113 r134  
    7979]) 
    8080 
    81 AC_ARG_WITH(eaccelerator-executor, 
    82 [  --with-eaccelerator-executor            Include optimized executor (not implemented yet)],[ 
    83   eaccelerator_executor=$withval 
    84 ],[ 
    85   eaccelerator_executor=no 
    86 ]) 
    87  
    8881AC_ARG_WITH(eaccelerator-use-inode, 
    8982[  --without-eaccelerator-use-inode            Don't use inodes to determine hash keys (never used on win32)],[ 
     
    131124  if test "$eaccelerator_disassembler" = "yes"; then 
    132125    AC_DEFINE(WITH_EACCELERATOR_DISASSEMBLER, 1, [Define if you like to explore Zend bytecode]) 
    133   fi 
    134   if test "$eaccelerator_executor" = "yes"; then 
    135     AC_DEFINE(WITH_EACCELERATOR_EXECUTOR, 1, [Define if you like use optimized executor (not implemented yet)]) 
    136126  fi 
    137127  if test "$eaccelerator_inode" = "yes"; then 
  • eaccelerator/trunk/eaccelerator.c

    r132 r134  
    111111static zend_op_array *(*mm_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); 
    112112 
    113 #if defined(DEBUG) || defined(WITH_EACCELERATOR_EXECUTOR) 
    114 static void (*mm_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC); 
    115 #endif 
    116  
    117113/* external declarations */ 
    118114PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); 
     
    253249} 
    254250 
     251/* check the cache dir */ 
     252static int check_cache_dir(char *cache_dir) { 
     253  struct stat buf; 
     254  int uid = 0; 
     255  int gid = 0; 
     256 
     257  if (stat(cache_dir, &buf) == -1) { 
     258    ea_debug_error("Cache dir does not exist (could not stat %s)\n", cache_dir); 
     259    return 0; 
     260  } 
     261  if (!(buf.st_mode & S_IFDIR)) { 
     262    ea_debug_error("%s is not a directory!\n", cache_dir); 
     263    return 0; 
     264  } 
     265#if 0 
     266  uid = getuid(); 
     267  gid = getgid(); 
     268  if (!((buf.st_uid == uid && (buf.st_mode & (S_IRUSR | S_IWUSR))) /* not root, owner and rw */ 
     269        || (buf.st_gid == gid && (buf.st_mode & (S_IRGRP | S_IWGRP))) /* not root, group and rw */ 
     270        || (buf.st_mode & (S_IROTH & S_IWOTH)))) { /* other and rw */ 
     271    ea_debug_error("%s hasn't got the right permissions!\n", cache_dir); 
     272    return 0; 
     273  } 
     274#endif 
     275  return 1; 
     276} 
     277 
    255278/* Initialise the shared memory */ 
    256279static int init_mm(TSRMLS_D) { 
     
    304327  eaccelerator_mm_instance->last_prune = time(0); 
    305328  EACCELERATOR_PROTECT(); 
     329 
     330  if (!check_cache_dir(EAG(cache_dir))) { 
     331    return FAILURE; 
     332  } 
     333   
    306334  return SUCCESS; 
    307335} 
     
    15421570  EAG(self_time)[EAG(profile_level)] = 0; 
    15431571  EAG(profile_level)++; 
    1544 #ifdef WITH_EACCELERATOR_EXECUTOR 
    1545   eaccelerator_execute(op_array TSRMLS_CC); 
    1546 #else 
    15471572  mm_saved_zend_execute(op_array TSRMLS_CC); 
    1548 #endif 
    15491573  usec = ea_debug_elapsed_time(&tv_start); 
    15501574  EAG(profile_level)--; 
     
    20002024    if (init_mm(TSRMLS_C) == FAILURE) { 
    20012025      zend_error(E_CORE_WARNING,"[%s] Can not create shared memory area", EACCELERATOR_EXTENSION_NAME); 
     2026      return FAILURE; 
    20022027    } 
    20032028 
     
    20102035#else 
    20112036    zend_compile_file = eaccelerator_compile_file; 
    2012 #ifdef WITH_EACCELERATOR_EXECUTOR 
    2013     mm_saved_zend_execute = zend_execute; 
    2014     zend_execute = eaccelerator_execute; 
    2015 #endif 
    20162037#endif 
    20172038  } 
     
    20392060  } 
    20402061  zend_compile_file = mm_saved_zend_compile_file; 
    2041 #if defined(DEBUG) || defined(WITH_EACCELERATOR_EXECUTOR) 
    2042   zend_execute = mm_saved_zend_execute; 
    2043 #endif 
    20442062#ifdef WITH_EACCELERATOR_CONTENT_CACHING 
    20452063  eaccelerator_content_cache_shutdown(); 
  • eaccelerator/trunk/eaccelerator.ini

    r113 r134  
    2222; The amount of shared memory (in megabytes) that eAccelerator will use. 
    2323; "0" means OS default. Default value is "0". 
    24 eaccelerator.shm_size = "64
     24eaccelerator.shm_size = "0
    2525 
    2626; The directory that is used for disk cache. eAccelerator stores precompiled