Commit: bfcbe7849b4b5a7cd4a3a5c8a950de621b67e9c3 Author: Dmitry Stogov <dmi...@zend.com> Thu, 14 Feb 2013 10:01:29 +0400 Parents: 7334835143cf3a3907337e5f8b718252d870ea74 Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bfcbe7849b4b5a7cd4a3a5c8a950de621b67e9c3 Log: Avoid compilation of unsupported SHM backends Changed paths: M shared_alloc_mmap.c M shared_alloc_posix.c M shared_alloc_shm.c M zend_shared_alloc.c M zend_shared_alloc.h Diff: diff --git a/shared_alloc_mmap.c b/shared_alloc_mmap.c index 7e23d4e..2a389c0 100644 --- a/shared_alloc_mmap.c +++ b/shared_alloc_mmap.c @@ -19,14 +19,16 @@ +----------------------------------------------------------------------+ */ +#include "zend_shared_alloc.h" + +#ifdef USE_MMAP + #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> -#include "zend_shared_alloc.h" - #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) # define MAP_ANONYMOUS MAP_ANON #endif @@ -68,3 +70,5 @@ zend_shared_memory_handlers zend_alloc_mmap_handlers = { detach_segment, segment_type_size }; + +#endif /* USE_MMAP */ diff --git a/shared_alloc_posix.c b/shared_alloc_posix.c index 5a0111c..75ea176 100644 --- a/shared_alloc_posix.c +++ b/shared_alloc_posix.c @@ -19,6 +19,10 @@ +----------------------------------------------------------------------+ */ +#include "zend_shared_alloc.h" + +#ifdef USE_SHM_OPEN + #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> @@ -27,8 +31,6 @@ #include <unistd.h> #include <stdlib.h> -#include "zend_shared_alloc.h" - typedef struct { zend_shared_segment common; int shm_fd; @@ -88,3 +90,5 @@ zend_shared_memory_handlers zend_alloc_posix_handlers = { (detach_segment_t)detach_segment, segment_type_size }; + +#endif /* USE_SHM_OPEN */ diff --git a/shared_alloc_shm.c b/shared_alloc_shm.c index 45fab7c..9d0256e 100644 --- a/shared_alloc_shm.c +++ b/shared_alloc_shm.c @@ -19,6 +19,10 @@ +----------------------------------------------------------------------+ */ +#include "zend_shared_alloc.h" + +#ifdef USE_SHM + #if defined(__FreeBSD__) # include <machine/param.h> #endif @@ -35,8 +39,6 @@ #include <sys/stat.h> #include <fcntl.h> -#include "zend_shared_alloc.h" - #ifndef MIN # define MIN(x, y) ((x) > (y)? (y) : (x)) #endif @@ -135,3 +137,5 @@ zend_shared_memory_handlers zend_alloc_shm_handlers = { (detach_segment_t)detach_segment, segment_type_size }; + +#endif /* USE_SHM */ diff --git a/zend_shared_alloc.c b/zend_shared_alloc.c index c0024c6..3b93d04 100644 --- a/zend_shared_alloc.c +++ b/zend_shared_alloc.c @@ -58,13 +58,13 @@ static char lockfile_name[sizeof(TMP_DIR)+sizeof(SEM_FILENAME_PREFIX)+8]; #endif static const zend_shared_memory_handler_entry handler_table[] = { -#if USE_MMAP +#ifdef USE_MMAP { "mmap", &zend_alloc_mmap_handlers }, #endif -#if USE_SHM +#ifdef USE_SHM { "shm", &zend_alloc_shm_handlers }, #endif -#if USE_SHM_OPEN +#ifdef USE_SHM_OPEN { "posix", &zend_alloc_posix_handlers }, #endif #ifdef ZEND_WIN32 diff --git a/zend_shared_alloc.h b/zend_shared_alloc.h index aa61514..12df673 100644 --- a/zend_shared_alloc.h +++ b/zend_shared_alloc.h @@ -23,23 +23,44 @@ #define ZEND_SHARED_ALLOC_H #include "zend.h" +#include "ZendAccelerator.h" #if defined(__APPLE__) && defined(__MACH__) /* darwin */ -# define USE_SHM_OPEN 1 -# define USE_MMAP 1 +# ifdef HAVE_SHM_MMAP_POSIX +# define USE_SHM_OPEN 1 +# endif +# ifdef HAVE_SHM_MMAP_ANON +# define USE_MMAP 1 +# endif #elif defined(__linux__) || defined(_AIX) -# define USE_SHM 1 -# define USE_MMAP 1 -#elif defined(__FreeBSD__) -# define USE_SHM_OPEN 1 -# define USE_MMAP 1 -# define USE_SHM 1 +# ifdef HAVE_SHM_IPC +# define USE_SHM 1 +# endif +# ifdef HAVE_SHM_MMAP_ANON +# define USE_MMAP 1 +# endif #elif defined(__sparc) || defined(__sun) -# define USE_SHM_OPEN 1 -# define USE_SHM 1 +# ifdef HAVE_SHM_MMAP_POSIX +# define USE_SHM_OPEN 1 +# endif +# ifdef HAVE_SHM_IPC +# define USE_SHM 1 +# endif # if defined(__i386) +# ifdef HAVE_SHM_MMAP_ANON +# define USE_MMAP 1 +# endif +# endif +#else +# ifdef HAVE_SHM_MMAP_POSIX +# define USE_SHM_OPEN 1 +# endif +# ifdef HAVE_SHM_MMAP_ANON # define USE_MMAP 1 # endif +# ifdef HAVE_SHM_IPC +# define USE_SHM 1 +# endif #endif #define ALLOC_FAILURE 0 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php