Changeset 259

Show
Ignore:
Timestamp:
07/30/06 16:56:41 (2 years ago)
Author:
bart
Message:

* Fixed detection of SysV IPC shared memory and made anonymous mmap
the first selected type. This makes the behaviour of rc1 the
default. anonymous mmap doens't have the problem of shmmax. SysVIPC is
still available!
* Fixed some of the detection test in the configure script that probably
never worked.

Files:

Legend:

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

    r258 r259  
    77        * Move some functions around to make more of them static, this reduces 
    88          the binary size and load times. 
    9                * Remove some leftovers from restoring encoded scripts which only create 
    10                  overhead without the loader. 
     9        * Remove some leftovers from restoring encoded scripts which only create 
     10          overhead without the loader. 
    1111        * Clean up the session handler, removed old code for php < 4.3.  
    12                    
     12        * Fixed detection of SysV IPC shared memory and made anonymous mmap  
     13          the first selected type. This makes the behaviour of rc1 the  
     14          default. anonymous mmap doens't have the problem of shmmax. SysVIPC is  
     15          still available! 
     16        * Fixed some of the detection test in the configure script that probably 
     17          never worked. 
     18 
    13192006-07-29  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    1420 
  • eaccelerator/trunk/config.m4

    r258 r259  
    1111]) 
    1212 
     13dnl  
     14dnl configure options for eAccelerator 
     15dnl  
    1316AC_ARG_WITH(eaccelerator,[],[enable_eaccelerator=$withval]) 
    1417 
     
    122125 
    123126  AC_REQUIRE_CPP() 
     127 
     128dnl 
     129dnl Do some tests for OS support 
     130dnl 
    124131 
    125132  AC_HAVE_HEADERS(unistd.h limits.h sys/param.h sched.h) 
     
    152159 
    153160 
     161dnl Test for union semun 
    154162  AC_MSG_CHECKING(whether union semun is defined in sys/sem.h) 
    155163  AC_TRY_COMPILE([ 
     
    171179  mm_shm_mmap_posix=no 
    172180 
     181dnl sysvipc shared memory 
    173182  AC_MSG_CHECKING(for sysvipc shared memory support) 
    174183  AC_TRY_RUN([#define MM_SEM_NONE 
     
    182191  EA_REMOVE_IPC_TEST() 
    183192 
     193dnl mmap shared memory 
    184194  AC_MSG_CHECKING(for mmap shared memory support) 
    185195  AC_TRY_RUN([#define MM_SEM_NONE 
     
    192202  AC_MSG_RESULT([$msg]) 
    193203 
     204dnl mmap zero shared memory 
    194205  AC_MSG_CHECKING(for mmap on /dev/zero shared memory support) 
    195206  AC_TRY_RUN([#define MM_SEM_NONE 
     
    202213  AC_MSG_RESULT([$msg]) 
    203214 
     215dnl mmap anonymous shared memory 
    204216  AC_MSG_CHECKING(for anonymous mmap shared memory support) 
    205217  AC_TRY_RUN([#define MM_SEM_NONE 
     
    212224  AC_MSG_RESULT([$msg]) 
    213225 
     226dnl posix mmap shared memory support 
    214227  AC_MSG_CHECKING(for posix mmap shared memory support) 
    215228  AC_TRY_RUN([#define MM_SEM_NONE 
     
    222235  AC_MSG_RESULT([$msg]) 
    223236 
     237dnl determine the best type 
    224238  AC_MSG_CHECKING(for best shared memory type) 
    225239  if test "$mm_shm_ipc" = "yes"; then 
     
    243257  AC_MSG_RESULT([$msg]) 
    244258  if test "$msg" = "no" ; then 
    245     AC_MSG_WARN([eaccelerator cannot detect shared memory type, which is required]) 
    246   fi 
    247  
     259    AC_MSG_ERROR([eaccelerator couldn't detect the shared memory type]) 
     260  fi 
     261 
     262dnl 
     263dnl 
     264 
     265dnl spinlock test 
    248266  AC_MSG_CHECKING(for spinlock semaphores support) 
    249267  AC_TRY_RUN([#define MM_SEM_SPINLOCK 
     
    255273  AC_MSG_RESULT([$msg]) 
    256274 
     275oldLIBS="$LIBS" 
     276LIBS="-lpthread" 
     277dnl pthread support 
    257278  AC_MSG_CHECKING(for pthread semaphores support) 
    258279  AC_TRY_RUN([#define MM_SEM_PTHREAD 
     
    264285  AC_MSG_RESULT([$msg]) 
    265286 
     287dnl posix semaphore support 
    266288  AC_MSG_CHECKING(for posix semaphores support) 
    267289  AC_TRY_RUN([#define MM_SEM_POSIX 
     
    273295  AC_MSG_RESULT([$msg]) 
    274296 
     297LIBS="$oldLIBS" 
     298dnl sysvipc semaphore support 
    275299  AC_MSG_CHECKING(for sysvipc semaphores support) 
    276300  AC_TRY_RUN([#define MM_SEM_IPC 
     
    283307  EA_REMOVE_IPC_TEST() 
    284308 
     309dnl fnctl semaphore support 
    285310  AC_MSG_CHECKING(for fcntl semaphores support) 
    286311  AC_TRY_RUN([#define MM_SEM_FCNTL 
     
    292317  AC_MSG_RESULT([$msg]) 
    293318 
     319dnl flock semaphore support 
    294320  AC_MSG_CHECKING(for flock semaphores support) 
    295321  AC_TRY_RUN([#define MM_SEM_FLOCK 
     
    301327  AC_MSG_RESULT([$msg]) 
    302328 
     329dnl Determine the best type 
    303330  AC_MSG_CHECKING(for best semaphores type) 
    304331  if test "$mm_sem_spinlock" = "yes"; then 
     
    329356  AC_MSG_RESULT([$msg]) 
    330357  if test "$msg" = "no" ; then 
    331     AC_MSG_WARN([eaccelerator cannot semaphores type, which is required]) 
     358    AC_MSG_ERROR([eaccelerator cannot semaphores type, which is required]) 
    332359  fi 
    333360 
  • eaccelerator/trunk/mm.c

    r230 r259  
    194194} mm_mutex; 
    195195 
    196 /* not used  
    197 static int mm_attach_lock(const char* key, mm_mutex* lock) { 
    198   return 1; 
    199 } 
    200 */ 
    201  
    202196static int mm_init_lock(const char* key, mm_mutex* lock) { 
    203197  spinlock_init(&lock->spinlock); 
     
    266260#elif defined(MM_SEM_POSIX) 
    267261 
    268 /* not tested */ 
     262/* this one doesn't work! */ 
    269263 
    270264#define MM_SEM_TYPE "posix" 
     
    275269 
    276270static int mm_init_lock(const char* key, mm_mutex* lock) { 
     271  int fd; 
    277272#ifdef SEM_NAME_LEN 
    278273  char s[SEM_NAME_LEN]; 
    279274 
    280   strncpy(s,key,SEM_NAME_LEN-1); 
    281   strxcat(s,".sem.XXXXXX",SEM_NAME_LEN); 
     275  strncpy(s, key, SEM_NAME_LEN - 1); 
     276  strxcat(s, ".sem.XXXXXX", SEM_NAME_LEN); 
    282277#else 
    283278  char s[MAXPATHLEN]; 
    284279 
    285   strncpy(s,key,MAXPATHLEN-1); 
    286   strxcat(s,".sem.XXXXXX",MAXPATHLEN); 
    287 #endif 
    288   if (mktemp(s) == NULL) return 0; 
     280  strncpy(s, key, MAXPATHLEN - 1); 
     281  strxcat(s, ".sem.XXXXXX", MAXPATHLEN); 
     282#endif 
     283  if (mkstemp(s) == NULL) { 
     284    perror(s); 
     285    return 0; 
     286  } 
    289287  if ((lock->sem = sem_open(s, O_CREAT, S_IRUSR | S_IWUSR, 1)) == (sem_t*)SEM_FAILED) { 
     288    perror(s); 
    290289    return 0; 
    291290  } 
     
    707706    while ((fd = shmget(IPC_PRIVATE, seg_size, (IPC_CREAT | SHM_R | SHM_W))) == -1) { 
    708707      if (seg_size <= 1024*1024) { 
     708#if !defined(MM_TEST_SEM) && !defined(MM_TEST_SHM) 
    709709        ea_debug_error("eAccelerator: shmmax should be at least 2MB"); 
     710#endif 
    710711        return (MM*)-1; 
    711712      } 
    712713      seg_size /= 2; 
    713714    } 
     715#if !defined(MM_TEST_SEM) && !defined(MM_TEST_SHM) 
    714716    ea_debug_error("eAccelerator: Could not allocate %d bytes, the maximum size the kernel allows is %d bytes. " 
    715717            "Lower the amount of memory request or increase the limit in /proc/sys/kernel/shmmax.\n", size, seg_size); 
     718#endif 
    716719 
    717720    /* bart: Removed the code that tried to allocate more then one segment  
     
    799802  strncpy(s,key,MAXPATHLEN-1); 
    800803  strxcat(s,".shm.XXXXXX",MAXPATHLEN); 
    801   if (mktemp(s) == NULL) { 
     804  if (mkstemp(s) == -1) { 
    802805    return (MM*)-1; 
    803806  }