Changeset 259
- Timestamp:
- 07/30/06 16:56:41 (2 years ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/config.m4 (modified) (17 diffs)
- eaccelerator/trunk/mm.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r258 r259 7 7 * Move some functions around to make more of them static, this reduces 8 8 the binary size and load times. 9 * Remove some leftovers from restoring encoded scripts which only create10 overhead without the loader.9 * Remove some leftovers from restoring encoded scripts which only create 10 overhead without the loader. 11 11 * 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 13 19 2006-07-29 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 14 20 eaccelerator/trunk/config.m4
r258 r259 11 11 ]) 12 12 13 dnl 14 dnl configure options for eAccelerator 15 dnl 13 16 AC_ARG_WITH(eaccelerator,[],[enable_eaccelerator=$withval]) 14 17 … … 122 125 123 126 AC_REQUIRE_CPP() 127 128 dnl 129 dnl Do some tests for OS support 130 dnl 124 131 125 132 AC_HAVE_HEADERS(unistd.h limits.h sys/param.h sched.h) … … 152 159 153 160 161 dnl Test for union semun 154 162 AC_MSG_CHECKING(whether union semun is defined in sys/sem.h) 155 163 AC_TRY_COMPILE([ … … 171 179 mm_shm_mmap_posix=no 172 180 181 dnl sysvipc shared memory 173 182 AC_MSG_CHECKING(for sysvipc shared memory support) 174 183 AC_TRY_RUN([#define MM_SEM_NONE … … 182 191 EA_REMOVE_IPC_TEST() 183 192 193 dnl mmap shared memory 184 194 AC_MSG_CHECKING(for mmap shared memory support) 185 195 AC_TRY_RUN([#define MM_SEM_NONE … … 192 202 AC_MSG_RESULT([$msg]) 193 203 204 dnl mmap zero shared memory 194 205 AC_MSG_CHECKING(for mmap on /dev/zero shared memory support) 195 206 AC_TRY_RUN([#define MM_SEM_NONE … … 202 213 AC_MSG_RESULT([$msg]) 203 214 215 dnl mmap anonymous shared memory 204 216 AC_MSG_CHECKING(for anonymous mmap shared memory support) 205 217 AC_TRY_RUN([#define MM_SEM_NONE … … 212 224 AC_MSG_RESULT([$msg]) 213 225 226 dnl posix mmap shared memory support 214 227 AC_MSG_CHECKING(for posix mmap shared memory support) 215 228 AC_TRY_RUN([#define MM_SEM_NONE … … 222 235 AC_MSG_RESULT([$msg]) 223 236 237 dnl determine the best type 224 238 AC_MSG_CHECKING(for best shared memory type) 225 239 if test "$mm_shm_ipc" = "yes"; then … … 243 257 AC_MSG_RESULT([$msg]) 244 258 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 262 dnl 263 dnl 264 265 dnl spinlock test 248 266 AC_MSG_CHECKING(for spinlock semaphores support) 249 267 AC_TRY_RUN([#define MM_SEM_SPINLOCK … … 255 273 AC_MSG_RESULT([$msg]) 256 274 275 oldLIBS="$LIBS" 276 LIBS="-lpthread" 277 dnl pthread support 257 278 AC_MSG_CHECKING(for pthread semaphores support) 258 279 AC_TRY_RUN([#define MM_SEM_PTHREAD … … 264 285 AC_MSG_RESULT([$msg]) 265 286 287 dnl posix semaphore support 266 288 AC_MSG_CHECKING(for posix semaphores support) 267 289 AC_TRY_RUN([#define MM_SEM_POSIX … … 273 295 AC_MSG_RESULT([$msg]) 274 296 297 LIBS="$oldLIBS" 298 dnl sysvipc semaphore support 275 299 AC_MSG_CHECKING(for sysvipc semaphores support) 276 300 AC_TRY_RUN([#define MM_SEM_IPC … … 283 307 EA_REMOVE_IPC_TEST() 284 308 309 dnl fnctl semaphore support 285 310 AC_MSG_CHECKING(for fcntl semaphores support) 286 311 AC_TRY_RUN([#define MM_SEM_FCNTL … … 292 317 AC_MSG_RESULT([$msg]) 293 318 319 dnl flock semaphore support 294 320 AC_MSG_CHECKING(for flock semaphores support) 295 321 AC_TRY_RUN([#define MM_SEM_FLOCK … … 301 327 AC_MSG_RESULT([$msg]) 302 328 329 dnl Determine the best type 303 330 AC_MSG_CHECKING(for best semaphores type) 304 331 if test "$mm_sem_spinlock" = "yes"; then … … 329 356 AC_MSG_RESULT([$msg]) 330 357 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]) 332 359 fi 333 360 eaccelerator/trunk/mm.c
r230 r259 194 194 } mm_mutex; 195 195 196 /* not used197 static int mm_attach_lock(const char* key, mm_mutex* lock) {198 return 1;199 }200 */201 202 196 static int mm_init_lock(const char* key, mm_mutex* lock) { 203 197 spinlock_init(&lock->spinlock); … … 266 260 #elif defined(MM_SEM_POSIX) 267 261 268 /* not tested*/262 /* this one doesn't work! */ 269 263 270 264 #define MM_SEM_TYPE "posix" … … 275 269 276 270 static int mm_init_lock(const char* key, mm_mutex* lock) { 271 int fd; 277 272 #ifdef SEM_NAME_LEN 278 273 char s[SEM_NAME_LEN]; 279 274 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); 282 277 #else 283 278 char s[MAXPATHLEN]; 284 279 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 } 289 287 if ((lock->sem = sem_open(s, O_CREAT, S_IRUSR | S_IWUSR, 1)) == (sem_t*)SEM_FAILED) { 288 perror(s); 290 289 return 0; 291 290 } … … 707 706 while ((fd = shmget(IPC_PRIVATE, seg_size, (IPC_CREAT | SHM_R | SHM_W))) == -1) { 708 707 if (seg_size <= 1024*1024) { 708 #if !defined(MM_TEST_SEM) && !defined(MM_TEST_SHM) 709 709 ea_debug_error("eAccelerator: shmmax should be at least 2MB"); 710 #endif 710 711 return (MM*)-1; 711 712 } 712 713 seg_size /= 2; 713 714 } 715 #if !defined(MM_TEST_SEM) && !defined(MM_TEST_SHM) 714 716 ea_debug_error("eAccelerator: Could not allocate %d bytes, the maximum size the kernel allows is %d bytes. " 715 717 "Lower the amount of memory request or increase the limit in /proc/sys/kernel/shmmax.\n", size, seg_size); 718 #endif 716 719 717 720 /* bart: Removed the code that tried to allocate more then one segment … … 799 802 strncpy(s,key,MAXPATHLEN-1); 800 803 strxcat(s,".shm.XXXXXX",MAXPATHLEN); 801 if (mk temp(s) == NULL) {804 if (mkstemp(s) == -1) { 802 805 return (MM*)-1; 803 806 }