diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/standard/config.m4 | 5 | ||||
| -rw-r--r-- | ext/standard/php_crypt_r.c | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 4e3db0ffe4..e28c351b5b 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -567,6 +567,11 @@ if test "$ac_cv_type_mbstate_t" = "yes"; then fi dnl +dnl Check for atomic operation API availability in Solaris +dnl +AC_CHECK_HEADERS([atomic.h]) + +dnl dnl Setup extension sources dnl PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \ diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index 4872c49599..cd47bfe123 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -42,7 +42,11 @@ # include <Wincrypt.h> #endif -#include <signal.h> +#ifdef HAVE_ATOMIC_H /* Solaris 10 defines atomic API within */ +# include <atomic.h> +#else +# include <signal.h> +#endif #include "php_crypt_r.h" #include "crypt_freesec.h" @@ -77,6 +81,8 @@ void _crypt_extended_init_r(void) { #ifdef PHP_WIN32 LONG volatile initialized = 0; +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + volatile unsigned int initialized = 0; #else static volatile sig_atomic_t initialized = 0; #endif @@ -90,6 +96,9 @@ void _crypt_extended_init_r(void) InterlockedIncrement(&initialized); #elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) __sync_fetch_and_add(&initialized, 1); +#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ + membar_producer(); + atomic_add_int(&initialized, 1); #endif _crypt_extended_init(); } |
