From: Pierre Joye Date: Thu, 17 Jun 2010 10:22:03 +0000 (+0000) Subject: - #51424, solaris part X-Git-Tag: php-5.4.0alpha1~191^2~1274 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=377ffeb50af09eed7cf2b9cf0a774ecfb3a2779b;p=php - #51424, solaris part --- 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 @@ -566,6 +566,11 @@ if test "$ac_cv_type_mbstate_t" = "yes"; then AC_DEFINE([HAVE_MBSTATE_T], 1, [Define if your system has mbstate_t in wchar.h]) fi +dnl +dnl Check for atomic operation API availability in Solaris +dnl +AC_CHECK_HEADERS([atomic.h]) + dnl dnl Setup extension sources dnl 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 #endif -#include +#ifdef HAVE_ATOMIC_H /* Solaris 10 defines atomic API within */ +# include +#else +# include +#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(); }