php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #51424
Patch membar-solaris.patch revision 2010-06-16 22:59 UTC by SRIRAM dot NATARAJAN at GMAIL dot COM
Patch Dead_lock_fix_attempt revision 2010-03-29 11:54 UTC by pajoye@php.net
Patch GDB-backtrace-proper revision 2010-03-29 11:27 UTC by laacz at laacz dot lv
Patch GDB-backtrace revision 2010-03-29 11:13 UTC by laacz at laacz dot lv

Patch membar-solaris.patch for Strings related Bug #51424

Patch version 2010-06-16 22:59 UTC

Return to Bug #51424 | Download this patch
Patch Revisions:

Developer: SRIRAM.NATARAJAN@GMAIL.COM

Index: ext/standard/config.m4
===================================================================
--- ext/standard/config.m4	(revision 300493)
+++ ext/standard/config.m4	(working copy)
@@ -567,6 +567,11 @@
 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 \
Index: ext/standard/php_crypt_r.c
===================================================================
--- ext/standard/php_crypt_r.c	(revision 300493)
+++ ext/standard/php_crypt_r.c	(working copy)
@@ -42,7 +42,11 @@
 # include <Wincrypt.h>
 #endif
 
+#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 @@
 {
 #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 @@
 		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();
 	}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC