8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

1. Solaric/Sparc SunProCC port.

2. Cleanup SOLARIS_MT threading model.
This commit is contained in:
alexpeshkoff 2009-05-05 08:06:37 +00:00
parent 3b36446638
commit cef41b3286
27 changed files with 155 additions and 666 deletions

View File

@ -20,7 +20,7 @@
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
WARNINGS=-Wall -W -Wno-unused -Wno-parentheses -Wno-switch -Wwrite-strings
COMM_SOLX_FLAGS:=-DSOLARIS -DSOLARIS_MT -DSOLX86 -DBSD_COMP -fno-omit-frame-pointer -fmessage-length=0 -MMD -fPIC
COMM_SOLX_FLAGS:=-DSOLARIS -DBSD_COMP -fno-omit-frame-pointer -fmessage-length=0 -MMD -fPIC
SFIO=@SFIO_DIR@
SFIO_LDFLAGS=@SFIO_LDFLAGS@

View File

@ -1,54 +1,108 @@
#
# Compiler settings for Solaris (Sparc)
#
# This file is processed by configure and the output written to
# gen/make.platform which is included in src directory makefiles
# before other common make files ie: make.[rules|defaults|shared.variables]
#
# Compiler settings for Solaris with Sun Studio 12, CC
# Works for all hosts that SS Pro supports (e.g. sparc, amd64, i386)
# Works for 32/64 bit builds, depends on CFLAGS/CXXFLAGS
# Before attempting the Solaris build, you must export necessary
# CFLAGS and CXXFLAGS to be picked up by the configure process and
# subsequent build. Make sure CC is in the path!
#
# for typical 64-bit build
# export CC=cc
# export CXX=CC
# export CFLAGS="-m64"
# export CXXFLAGS=$CFLAGS
# History
# 30-Dec-2002 nmcc FB2 initial working build on Solaris8 with gcc 3.2.1
# 18-apr-2005 kkuznetsov FB2 Solaris 32 bits update (only gcc) as Ray Holme story talks
# Firebird defines specific to Solaris (and x86) build
CFLAGS_COMMON= -DSOLARIS -DSOLARIS_MT -DBSD_COMP -Dsparc
# 07-Apr-2005 kkuznetsov starting moving to sparc 64
# 20-Mar-2009 wbo refresh for Sun Studio C++ 5.9, Solaris 9+
# compile flags for GCC compiler
COMMON_GCC_FLAGS= -MMD -fPIC -m32
# Useful predefined macros from Sun Studio
# __SUNPRO_CC, indicates the release number of the compiler, e.g. 0x590
DEBUG_GCC_FLAGS= -ggdb -g3 -Wall -Wno-switch -Wcast-align
PROD_GCC_FLAGS= -mcpu=ultrasparc -mtune=ultrasparc -O2 -DNDEBUG
# These macros are predefined by both Sun Studio and g++ when appropriate.
# No need to define again.
# __amd64
# __i386
# __sparc
# __sun
# __unix
# set Instruction Set Architecture, and add any processor specific flags
ISA=$(shell isainfo -k)
ifeq ($(ISA),sparcv9)
# -xcheck=%all, SPARC only, add run time check for stack overflow
ISA_DEV_FLAGS=-xcheck=%all
ISA_COMMON_FLAGS=-xarch=sparcvis2
endif
# compile flags for SUNWspro/Forte compiler - untested nmcc dec2002
COMMON_FORTE_FLAGS= -Xt -xstrconst -mt -K PIC
DEBUG_FORTE_FLAGS= -v -g
PROD_FORTE_FLAGS= -O2 -w
ifeq ($(ISA),amd64)
ISA_COMMON_FLAGS=-xarch=sse2
endif
# Flags shared by production and debug build
# -m32 | -m64, specify memory model. -m64 means LP64, -m32 means ILP32
# -m64 is default on Intel/AMD architecture, -m32 default on sparc
# -m64 is sufficient to create 64-bit targets on most(?) platforms
# -KPIC, use to compile source files when building a shared library
# -bBinding, specify library binding for linking. Can be symbolic, dynamic, or static
# -features=extensions, allow non-standard C++ commonly accepted by other compilers
# -D_POSIX_C_SOURCE, we are conformant to this posix version
# -D__EXTENSIONS__, access all interfaces and headers not in conflict with posix version
# -D_POSIX_THREAD_SEMANTICS, enable threading extensions
# -erroff=nothrowneww, suppress warning for redefined new with different
# exception specification
# -D_REENTRANT is added by -mt switch, explicit definition not needed
COMMON_FLAGS= -DSOLARIS -DBSD_COMP -DSUNCC -D__EXTENSIONS__ \
-D_POSIX_THREAD_SEMANTICS -D_POSIX_THREAD_PRIO_INHERIT -D_POSIX_C_SOURCE=199506L -mt -KPIC \
-erroff=nothrowneww -DUSE_POSIX_THREADS $(ISA_COMMON_FLAGS)
# if we keep sfio this needs to be set by configure (or move in to extern directory)
# must use full sfio not stdio emulation to get file handle number fix
#SFIO_DIR=$(SRC_ROOT)/../../../sfio/sfio_2002
#SFIO_DIR=/data01/fb-dev/sfio/sfio_2002
#SFIO_FLAGS= -DSFIO -I$(SFIO_DIR)/include
#SFIO_LDFLAGS= -L$(SFIO)/lib
#these come from configure --with-sfio=/path/to/sfio
SFIO_DIR=@SFIO_DIR@
SFIO_FLAGS=@SFIO_FLAGS@
SFIO_LDFLAGS=@SFIO_LDFLAGS@
PROD_FLAGS= $(CFLAGS_COMMON) $(SFIO_FLAGS) $(COMMON_GCC_FLAGS) $(PROD_GCC_FLAGS) \
$(LOCAL_CFLAGS)
# Production flags
# -fast, provides near-maximum performance. **includes** -O5, -libmil, and more!
# -fast must come first, and must be present in compile and link!
# -libmil, use the intrinsic library functions like strlen
# -O, optimize, implies -O3 in Sun Studio 12
PROD_FLAGS= -fast -O -DNDEBUG \
$(COMMON_FLAGS) $(SFIO_FLAGS)
DEV_FLAGS= $(CFLAGS_COMMON) $(SFIO_FLAGS) $(COMMON_GCC_FLAGS) $(DEBUG_GCC_FLAGS) \
$(LOCAL_CFLAGS)
# Debug flags
# -xport64, warn about 32-bit to 64-bit funny stuff, like sign extension
# -w, warn about code that may have "unintended consequences." How nice!
DEV_FLAGS= -g -xs \
$(COMMON_FLAGS) $(SFIO_FLAGS) $(ISA_DEV_FLAGS)
LOCKPRINT_Other_Sources= jrd/ThreadData.cpp
Server_main_dummy = os/sun/server_main_dummy.cpp
OS_ServerFiles=inet_server.cpp
Server_main_dummy= os/sun/server_main_dummy.cpp
LIB_LINK_OPTIONS= -G
LIB_PLATFORM_RPATH=-R $(1)
LIB_LINK_SONAME=-h $(1)
LIB_LINK_MAPFILE= -Xlinker -M
LIB_PLATFORM_RPATH= -R $(1)
LIB_LINK_SONAME= -h $(1)
LIB_LINK_MAPFILE= -M
# link options for Solaris linker, /usr/ccs/bin/ld
#LINK_OPTS= $(LDFLAGS) $(THR_FLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS)
#LIB_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) -shared
EMBED_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp
LD=g++
LDFLAGS=-m32
LINK_OPTS:=$(LDFLAGS)
#LD=CC
LDFLAGS=-library=no%Cstd -mt
UNDEF_PLATFORM=

View File

@ -14,7 +14,7 @@
#
# Firebird defines specific to Solaris (sparc) build
CFLAGS_COMMON= -DSOLARIS -DSOLARIS_MT -DBSD_COMP -Dsparc -DSUNCC
CFLAGS_COMMON= -DSOLARIS -DBSD_COMP -Dsparc -DSUNCC
#-DSUNCC - correcting gnuc C++ extentions
# compile flags for SUNWspro/Forte/CC/Sun Studio compiler

View File

@ -13,7 +13,7 @@
#
# Firebird defines specific to Solaris (and x86) build
CFLAGS_COMMON= -DSOLARIS -DSOLARIS_MT -DBSD_COMP -Dsparc
CFLAGS_COMMON= -DSOLARIS -DBSD_COMP -Dsparc
# compile flags for GCC compiler
COMMON_GCC_FLAGS= -MMD -fPIC -m64 -D__sparcv9 -mptr64 -mstack-bias -mno-v8plus -mcpu=v9

View File

@ -26,7 +26,7 @@
#FirebirdInstallPrefix = @prefix@
WARNINGS=+w2
COMM_SOLX_FLAGS:= -DSOLARIS -DSOLARIS26 -DSOLARIS_MT -DSOLX86 -DBSD_COMP -KPIC -features=no%conststrings #,extensions
COMM_SOLX_FLAGS:= -DSOLARIS -DSOLARIS26 -DSOLX86 -DBSD_COMP -KPIC -features=no%conststrings #,extensions
#SFIO= /export/home/interbase/SfIO
#SfIO is a pretty portable stdIO

View File

@ -30,7 +30,7 @@
# LINK_LIBS and STATICLINK_LIBS e.g. -lncurses -leditline
WARNINGS=-Wall -Wno-switch -Wno-parentheses -Wno-unused-variable
COMM_SOLX_FLAGS:=-DSOLARIS -DSOLARIS_MT -DBSD_COMP -DAMD64 -pipe -fmessage-length=0 -MMD -fPIC
COMM_SOLX_FLAGS:=-DSOLARIS -DBSD_COMP -DAMD64 -pipe -fmessage-length=0 -MMD -fPIC
SFIO=@SFIO_DIR@
SFIO_FLAGS=@SFIO_FLAGS@

View File

@ -77,7 +77,7 @@ dnl CPU_TYPE=ppc64
powerpc-*-aix*)
dnl ibm xlC has many invocations, like xlC, xlc++, or xlc_r7
comp=$(echo "$CXX" | cut -c1-3 | dd conv=lcase 2>/dev/null)
comp=`echo "$CXX" | cut -c1-3 | dd conv=lcase 2>/dev/null`
if test "$comp" = "xlc"; then
MAKEFILE_PREFIX=aix_powerpc_xlc
else
@ -242,44 +242,42 @@ dnl ICU_PLATFORM=AIXPPCXLC
;;
i386-pc-solaris*)
MAKEFILE_PREFIX=solx86gcc
dnl detect native compiler, Sun Studio Pro
comp=`echo "$CXX" | cut -c1-2`
case $comp in
CC) MAKEFILE_PREFIX=solaris ;
ICU_PLATFORM=SOLARISX86 ;;
*) MAKEFILE_PREFIX=solx86gcc ;
ICU_PLATFORM=SOLARISX86GCC ;
PTHREAD_CFLAGS=-pthreads ;;
esac
dnl if this is amd64 system, we should install our libraries in /usr/lib/amd64
isa=`isainfo -k`
if test "$isa" = "amd64"; then
libdir=/usr/lib/amd64
fi
INSTALL_PREFIX=solaris
PLATFORM=solx86
AC_DEFINE(solx86, 1, [Define this if OS is Solarix x86])
EDITLINE_FLG=Y
SHRLIB_EXT=so
PTHREAD_CFLAGS=-threads
PTHREAD_LIBS=-lthread
ICU_PLATFORM=SOLARISX86GCC
RT_LIB_CHECK=true
;;
x86_64-pc-solaris*)
MAKEFILE_PREFIX=solx86gcc_64
INSTALL_PREFIX=solaris
PLATFORM=solx86
AC_DEFINE(solx86, 1, [Define this if OS is Solarix x86])
AC_DEFINE(AMD64, 1, [Define this if CPU is amd64])
EDITLINE_FLG=Y
SHRLIB_EXT=so
PTHREAD_CFLAGS=-threads
PTHREAD_LIBS=-lthread
ICU_PLATFORM=SOLARISX86GCC
service_thread_CS=true
libdir=/usr/lib/amd64
CPU_TYPE=amd64
RT_LIB_CHECK=true
;;
sparc-sun-solaris*)
MAKEFILE_PREFIX=solaris
dnl detect native compiler, Sun Studio Pro
comp=`echo "$CXX" | cut -c1-3`
case $comp in
CC) MAKEFILE_PREFIX=solaris ;
ICU_PLATFORM=SOLARISCC ;;
*) MAKEFILE_PREFIX=solaris-64gcc ;
ICU_PLATFORM=SOLARISGCC ;;
esac
INSTALL_PREFIX=solaris
PLATFORM=SOLARIS
AC_DEFINE(SOLARIS, 1, [Define this if OS is Solaris Sparc])
EDITLINE_FLG=Y
SHRLIB_EXT=so
PTHREAD_CFLAGS=-threads
PTHREAD_LIBS=-lthread
ICU_PLATFORM=SOLARISGCC
RT_LIB_CHECK=true
;;
@ -485,14 +483,7 @@ AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(libio.h)
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(math.h)
case "$PLATFORM" in
SOLARIS|solx86)
AC_CHECK_HEADERS(thread.h)
;;
*)
AC_CHECK_HEADERS(pthread.h)
;;
esac
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(sys/uio.h)
@ -519,7 +510,8 @@ if test "$ac_cv_header_unistd_h" = "yes"; then
dnl http://www.opengroup.org/onlinepubs/007904975/basedefs/unistd.h.html
dnl http://people.redhat.com/drepper/posix-option-groups.html
AC_MSG_CHECKING(if POSIX threads are available)
AC_TRY_RUN([#include <unistd.h>
AC_TRY_RUN([#define _XOPEN_SOURCE 600
#include <unistd.h>
main () {
#if defined(_POSIX_THREADS) && _POSIX_THREADS >= 200112L
exit(0);
@ -796,12 +788,8 @@ case "$PLATFORM" in
;;
SOLARIS|solx86)
dnl kkuznetsov: Solaris always check for -lnsl and use Sun thread (!not posix)
AC_CHECK_LIB(nsl, gethostname, XE_APPEND(-lnsl,LIBS))
AC_CHECK_LIB(thread, thr_create, XE_PREPEND(-lthread,LIBS))
if test "$EDITLINE_FLG" = "Y"; then
AC_CHECK_LIB(termcap, main, XE_APPEND(-ltermcap,EDITLINE_A))
AC_CHECK_LIB(termcap, main, XE_APPEND(-ltermcap,EDITLINE_A))
fi
AC_CHECK_TYPES([caddr_t])

View File

@ -13,7 +13,16 @@ GEN_DEPS.c= $(CC) -xM $(DEFS) $(CPPFLAGS)
GEN_DEPS.cc= $(CXX) -xM $(DEFS) $(CPPFLAGS)
# -libmil means use the intrinsic library functions like strlen
CPPFLAGS += -libmil -xarch=v9
CPPFLAGS += -libmil
# add any desired instruction set architecture flags
ISA=$(shell isainfo -k)
ifeq ($(ISA),sparcv9)
CPPFLAGS+= -xarch=sparcvis2
endif
ifeq ($(ISA),amd64)
CPPFLAGS+= -xarch=sse2
endif
# -mt means 'compiles and links a multithreaded program'
THREADSCFLAGS += -mt
@ -29,10 +38,10 @@ SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -G
SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -G
## Compiler switch to embed a runtime search path
LD=CC
LD=cc
LD_RPATH= -R
LD_RPATH_PRE=
LDFLAGS+= -xarch=v9
LDFLAGS+= -mt
## Compiler switch to embed a library name
LD_SONAME = -h $(notdir $(MIDDLE_SO_TARGET))
@ -47,31 +56,31 @@ STATIC_O = o
## Compilation rules
%.$(STATIC_O): $(srcdir)/%.c
$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
%.o: $(srcdir)/%.c
$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
%.$(STATIC_O): $(srcdir)/%.cpp
$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
%.o: $(srcdir)/%.cpp
$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
## Dependency rules
%.d : $(srcdir)/%.c
@echo "generating dependency information for $<"
@$(GEN_DEPS.c) $< > $@
@echo "generating dependency information for $<"
@$(GEN_DEPS.c) $< > $@
%.d : $(srcdir)/%.cpp
@echo "generating dependency information for $<"
@$(GEN_DEPS.cc) $< > $@
@echo "generating dependency information for $<"
@$(GEN_DEPS.cc) $< > $@
## Versioned libraries rules
%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
$(RM) $@ && ln -s ${<F} $@
$(RM) $@ && ln -s ${<F} $@
%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
#
ifeq (strip $(GENCCODE_ASSEMBLY),)

View File

@ -49,7 +49,7 @@
stdlib.h (EKU) */
#endif
#ifdef _MSC_VER
#if defined (_MSC_VER) || defined (__SUNPRO_CC)
#define THROW_BAD_ALLOC
#else
#define THROW_BAD_ALLOC throw (Firebird::BadAlloc)

View File

@ -124,11 +124,6 @@ public:
#else // WIN_NT
// This implementation will NOT work with FB > 2.1
#ifdef SOLARIS
#error Mutex/Condition based semaphore is NOT OK for Solaris
#endif
#include <pthread.h>
#include <errno.h>

View File

@ -102,15 +102,12 @@ private:
//# define TLS_SET(NAME, VALUE) NAME = (VALUE)
#else
#ifndef SOLARIS_MT
#include "../common/classes/init.h"
#include <pthread.h>
namespace Firebird {
template <typename T>
class TlsValue : private InstanceControl
{
@ -159,55 +156,6 @@ private:
bool keySet; // This is used to avoid conflicts when destroying global variables
#endif
};
#else //SOLARIS_MT
#include <thread.h>
#include <string.h>
namespace Firebird {
template <typename T>
class TlsValue
{
public:
static void TlsV_on_thread_exit (void * pval)
{
// Usually should delete pval like this
// T* ptempT = (T*) pval;
// delete ptempT;
}
TlsValue()
{
if (thr_keycreate(&key, TlsV_on_thread_exit))
system_call_failed::raise("thr_key_create");
}
const T get()
{
// We use double C-style cast to allow using scalar datatypes
// with sizes up to size of pointer without warnings
T* valuep;
if (thr_getspecific(key, (void**) &valuep) == 0)
return (T)(IPTR) valuep;
system_call_failed::raise("thr_getspecific");
return (T) NULL;
}
void set(const T value)
{
if (thr_setspecific(key, (void*)(IPTR) value))
system_call_failed::raise("thr_setspecific");
}
~TlsValue()
{
// Do nothing if no pthread_key_delete
}
private:
thread_key_t key;
};
#endif //SOLARIS_MT
} // namespace Firebird

View File

@ -79,10 +79,6 @@ void Spinlock::init()
SetCriticalSectionSpinCount(&spinlock, 4000);
}
#elif defined(SOLARIS_MT)
// no support needed for solaris threads
#else //posix mutex
pthread_mutexattr_t Mutex::attr;

View File

@ -37,12 +37,7 @@
// in thd.h ? This is Windows platform maintainers choice
#include <windows.h>
#else
#ifndef SOLARIS_MT
#include <pthread.h>
#else
#include <thread.h>
#include <synch.h>
#endif
#include <errno.h>
#endif
@ -154,59 +149,6 @@ public:
#else //WIN_NT
#ifdef SOLARIS_MT
class Mutex
{
private:
mutex_t mlock;
void init()
{
int rc = mutex_init(&mlock, USYNC_THREAD | LOCK_RECURSIVE, NULL);
if (rc)
system_call_failed::raise("mutex_init", rc);
}
public:
Mutex() { init(); }
explicit Mutex(MemoryPool&) { init(); }
~Mutex()
{
int rc = mutex_destroy(&mlock);
if (rc)
system_call_failed::raise("mutex_destroy", rc);
}
void enter()
{
int rc = mutex_lock(&mlock);
if (rc)
system_call_failed::raise("mutex_lock", rc);
}
bool tryEnter()
{
int rc = mutex_trylock(&mlock);
if (rc == EBUSY)
return false;
if (rc)
system_call_failed::raise("mutex_trylock", rc);
return true;
}
void leave()
{
int rc = mutex_unlock(&mlock);
if (rc)
system_call_failed::raise("mutex_unlock", rc);
}
public:
static void initMutexes() { }
};
typedef Mutex Spinlock;
#else //SOLARIS_MT
// Pthreads version of the class
class Mutex
{
@ -294,8 +236,6 @@ public:
typedef Mutex Spinlock;
#endif // have spinlocks
#endif //SOLARIS_MT
#endif //WIN_NT

View File

@ -172,85 +172,6 @@ public:
} // namespace Firebird
#else
#ifdef SOLARIS_MT
#include <thread.h>
#include <synch.h>
#include <errno.h>
namespace Firebird
{
class RWLock
{
private:
rwlock_t lock;
// Forbid copy constructor
RWLock(const RWLock& source);
void init()
{
if (rwlock_init(&lock, USYNC_PROCESS, NULL))
{
system_call_failed::raise("rwlock_init");
}
}
public:
RWLock() { init(); }
explicit RWLock(Firebird::MemoryPool&) { init(); }
~RWLock()
{
if (rwlock_destroy(&lock))
system_call_failed::raise("rwlock_destroy");
}
void beginRead()
{
if (rw_rdlock(&lock))
system_call_failed::raise("rw_rdlock");
}
bool tryBeginRead()
{
const int code = rw_tryrdlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise("rw_tryrdlock");
return true;
}
void endRead()
{
if (rw_unlock(&lock))
system_call_failed::raise("rw_unlock");
}
bool tryBeginWrite()
{
const int code = rw_trywrlock(&lock);
if (code == EBUSY)
return false;
if (code)
system_call_failed::raise("rw_trywrlock");
return true;
}
void beginWrite()
{
if (rw_wrlock(&lock))
system_call_failed::raise("rw_wrlock");
}
void endWrite()
{
if (rw_unlock(&lock))
system_call_failed::raise("rw_unlock");
}
};
} // namespace Firebird
#else
#include <pthread.h>
@ -336,8 +257,6 @@ public:
} // namespace Firebird
#endif // solaris threading (not posix)
#endif // !WIN_NT
namespace Firebird {

View File

@ -55,11 +55,6 @@
# endif
#endif
#ifdef SOLARIS_MT
#include <thread.h>
#include <signal.h>
#endif
#ifdef USE_POSIX_THREADS
#include <pthread.h>
#endif
@ -81,10 +76,6 @@ FB_THREAD_ID getThreadId()
id = GetCurrentThreadId();
#endif
#ifdef SOLARIS_MT
id = thr_self();
#endif
#ifdef USE_POSIX_THREADS
id = (FB_THREAD_ID) pthread_self();
#endif
@ -157,10 +148,6 @@ void THD_yield()
#endif // _POSIX_PRIORITY_SCHEDULING
#endif
#ifdef SOLARIS_MT
thr_yield();
#endif
#ifdef WIN_NT
SleepEx(0, FALSE);
#endif

View File

@ -865,7 +865,7 @@ enum dbb_flags_valss {
DBB_sqlca = 2, // Created as default for a sqlca
DBB_in_trans = 4, // included in this transaction
// DBB_drop_log = 8,
DBB_log_serial = 16,
DBB_log_serial = 16
// DBB_log_default = 32,
// DBB_cascade = 64, // only set but not used
// DBB_drop_cache = 128, // only set but not used

View File

@ -3133,7 +3133,7 @@ dsc* evlUuidToChar(Jrd::thread_db* tdbb, const SysFunction* function, Jrd::jrd_n
#ifdef _MSC_VER
#if defined (_MSC_VER) || defined (__SUNPRO_CC)
typedef StdMathFunc VoidPtrStdMathFunc;
#else
typedef void* VoidPtrStdMathFunc;

View File

@ -82,10 +82,6 @@ public:
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN void*
#define THREAD_ENTRY_CALL
#elif defined(SOLARIS_MT)
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN void *
#define THREAD_ENTRY_CALL
#else
// Define correct types for other platforms
#define THREAD_ENTRY_PARAM void*

View File

@ -47,11 +47,6 @@
#include <unistd.h>
#endif
#ifdef SOLARIS_MT
#include <thread.h>
#include <signal.h>
#endif
#include "../common/classes/locks.h"
#include "../common/classes/rwlock.h"
@ -239,54 +234,6 @@ void THD_wait_for_completion(ThreadHandle& thread)
#endif /* USE_POSIX_THREADS */
#ifdef SOLARIS_MT
#define START_THREAD
void ThreadStart::start(ThreadEntryPoint* routine,
void* arg,
int priority_arg,
void* thd_id)
{
/**************************************
*
* t h r e a d _ s t a r t ( S o l a r i s )
*
**************************************
*
* Functional description
* Start a new thread. Return 0 if successful,
* status if not.
*
**************************************/
int rval;
thread_t thread_id;
sigset_t new_mask, orig_mask;
sigfillset(&new_mask);
sigdelset(&new_mask, SIGALRM);
if (rval = thr_sigsetmask(SIG_SETMASK, &new_mask, &orig_mask))
Firebird::system_call_failed::raise("thr_sigsetmask", rval);
rval = thr_create(NULL, 0, THREAD_ENTRYPOINT, THREAD_ARG,
(thd_id ? 0 : THR_DETACHED) | THR_NEW_LWP, &thread_id);
thr_sigsetmask(SIG_SETMASK, &orig_mask, NULL);
if (rval)
Firebird::system_call_failed::raise("thr_create", rval);
if (thd_id)
{
*static_cast<thread_t*>(thd_id) = thread_id;
}
}
void THD_wait_for_completion(ThreadHandle& thread)
{
int state = thr_join(thread, NULL, NULL);
if (state)
Firebird::system_call_failed::raise("thread_join", state);
}
#endif // SOLARIS_MT
#ifdef WIN_NT
#define START_THREAD
void ThreadStart::start(ThreadEntryPoint* routine,

View File

@ -68,9 +68,6 @@ typedef HANDLE ThreadHandle;
#ifdef USE_POSIX_THREADS
typedef pthread_t ThreadHandle;
#endif
#ifdef SOLARIS_MT
typedef thread_t ThreadHandle;
#endif
void THD_wait_for_completion(ThreadHandle& handle);

View File

@ -269,12 +269,6 @@
#ifdef SOLARIS
/* This is NOT defined when building the special shared-pipe library
* which customers can use to avoid the problems with signals & threads
* in Solaris
*/
#define SOLARIS_MT
/* Define the following only on platforms whose standard I/O
* implementation is so weak that we wouldn't be able to fopen
* a file whose underlying file descriptor would be > 255.

View File

@ -227,7 +227,7 @@ static void stuff_stack_trace(const jrd_req*);
/* macro definitions */
#if (defined SUPERSERVER) && (defined WIN_NT || defined SOLARIS_MT)
#if (defined SUPERSERVER) && (defined WIN_NT)
const int MAX_CLONES = 750;
#else
const int MAX_CLONES = 1000;

View File

@ -40,22 +40,7 @@
#ifdef UNIX
#if defined(SOLARIS_MT)
#include <thread.h>
struct mtx
{
mutex_t mtx_mutex[1];
};
struct event_t
{
SLONG event_count;
mutex_t event_mutex[1];
cond_t event_cond[1];
};
#elif defined(USE_POSIX_THREADS)
#if defined(USE_POSIX_THREADS)
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP)

View File

@ -738,161 +738,6 @@ static bool event_blocked(const event_t* event, const SLONG value)
return true;
}
#ifdef SOLARIS_MT
SLONG ISC_event_clear(event_t* event)
{
/**************************************
*
* I S C _ e v e n t _ c l e a r ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Clear an event preparatory to waiting on it. The order of
* battle for event synchronization is:
*
* 1. Clear event.
* 2. Test data structure for event already completed
* 3. Wait on event.
*
**************************************/
mutex_lock(event->event_mutex);
const SLONG ret = event->event_count + 1;
mutex_unlock(event->event_mutex);
return ret;
}
void ISC_event_fini(event_t* event)
{
/**************************************
*
* I S C _ e v e n t _ f i n i ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Discard an event object.
*
**************************************/
/* Inter-Process event's are destroyed only */
mutex_destroy(event->event_mutex);
cond_destroy(event->event_cond);
}
int ISC_event_init(event_t* event)
{
/**************************************
*
* I S C _ e v e n t _ i n i t ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Prepare an event object for use.
*
**************************************/
event->event_count = 0;
mutex_init(event->event_mutex, USYNC_PROCESS, NULL);
cond_init(event->event_cond, USYNC_PROCESS, NULL);
return FB_SUCCESS;
}
int ISC_event_post(event_t* event)
{
/**************************************
*
* I S C _ e v e n t _ p o s t ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Post an event to wake somebody else up.
*
**************************************/
/* For Solaris, we use cond_broadcast rather than cond_signal so that
all waiters on the event are notified and awakened */
mutex_lock(event->event_mutex);
++event->event_count;
const int ret = cond_broadcast(event->event_cond);
mutex_unlock(event->event_mutex);
if (ret) {
gds__log("ISC_event_post: cond_broadcast failed with errno = %d", ret);
return FB_FAILURE;
}
return FB_SUCCESS;
}
int ISC_event_wait(event_t* event,
const SLONG value,
const SLONG micro_seconds)
{
/**************************************
*
* I S C _ e v e n t _ w a i t ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Wait on an event. If timeout limit specified, return
* anyway after the timeout even if no event has
* happened. If returning due to timeout, return
* FB_FAILURE else return FB_SUCCESS.
*
**************************************/
/* If we're not blocked, the rest is a gross waste of time */
if (!event_blocked(event, value))
return FB_SUCCESS;
/* Set up timers if a timeout period was specified. */
timestruc_t timer;
if (micro_seconds > 0) {
timer.tv_sec = time(NULL);
timer.tv_sec += micro_seconds / 1000000;
timer.tv_nsec = 1000 * (micro_seconds % 1000000);
}
int ret = FB_SUCCESS;
mutex_lock(event->event_mutex);
for (;;) {
if (!event_blocked(event, value)) {
ret = FB_SUCCESS;
break;
}
/* The Solaris cond_wait & cond_timedwait calls atomically release
the mutex and start a wait. The mutex is reacquired before the
call returns. */
if (micro_seconds > 0)
ret = cond_timedwait(event->event_cond, event->event_mutex, &timer);
else
ret = cond_wait(event->event_cond, event->event_mutex);
if (micro_seconds > 0 && (ret == ETIME)) {
/* The timer expired - see if the event occured and return
FB_SUCCESS or FB_FAILURE accordingly. */
ret = event_blocked(event, value) ? FB_FAILURE : FB_SUCCESS;
break;
}
}
mutex_unlock(event->event_mutex);
return ret;
}
#endif /* SOLARIS_MT */
#ifdef USE_POSIX_THREADS
@ -2817,116 +2662,6 @@ void ISC_unmap_object(ISC_STATUS* status_vector,
#endif
#ifdef SOLARIS_MT
int ISC_mutex_init(struct mtx* mutex)
{
/**************************************
*
* I S C _ m u t e x _ i n i t ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Initialize a mutex.
*
**************************************/
memset(mutex->mtx_mutex, 0, sizeof(mutex_t));
return mutex_init(mutex->mtx_mutex, USYNC_PROCESS | LOCK_ROBUST, NULL);
}
void ISC_mutex_fini(struct mtx *mutex)
{
/**************************************
*
* m u t e x _ f i n i ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Destroy a mutex.
*
**************************************/
// no-op for Solaris threads semaphores
}
int ISC_mutex_lock(struct mtx* mutex)
{
/**************************************
*
* I S C _ m u t e x _ l o c k ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Seize a mutex.
*
**************************************/
for (;;) {
int state = mutex_lock(mutex->mtx_mutex);
if (!state)
break;
if (!SYSCALL_INTERRUPTED(state))
return state;
}
return 0;
}
int ISC_mutex_lock_cond(struct mtx* mutex)
{
/**************************************
*
* I S C _ m u t e x _ l o c k _ c o n d ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Conditionally seize a mutex.
*
**************************************/
for (;;) {
int state = mutex_trylock(mutex->mtx_mutex);
if (!state)
break;
if (!SYSCALL_INTERRUPTED(state))
return state;
}
return 0;
}
int ISC_mutex_unlock(struct mtx* mutex)
{
/**************************************
*
* I S C _ m u t e x _ u n l o c k ( S O L A R I S _ M T )
*
**************************************
*
* Functional description
* Release a mutex.
*
**************************************/
for (;;) {
/* Note use of undocumented lwp_mutex_unlock call
* due to Solaris 2.4 bug */
int state = _lwp_mutex_unlock(mutex->mtx_mutex);
if (!state)
break;
if (!SYSCALL_INTERRUPTED(state))
return state;
}
return 0;
}
#endif /* SOLARIS_MT */
#ifdef USE_POSIX_THREADS
#ifdef USE_SYS5SEMAPHORE

View File

@ -5291,7 +5291,14 @@ static const PTR get_entrypoint(int proc, int implementation)
**************************************/
const PTR* const entry = entrypoints + implementation * PROC_count + proc;
return *entry ? *entry : &no_entrypoint;
// static qualifier on &noentrypoint disallows use of conditional operator on Solaris
// return *entry ? *entry : &no_entrypoint;
if (*entry)
return *entry;
else
return &no_entrypoint;
}

View File

@ -22,10 +22,6 @@
*/
#include "firebird.h"
#ifdef SOLARIS_MT
#include <thread.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -105,7 +101,7 @@ pid_t UTIL_start_process(const char* process, const char* process2, char** argv,
/* add place in argv for visibility to "ps" */
strcpy(argv[0], string);
#if (defined SOLARIS_MT)
#if (defined SOLARIS)
pid_t pid = fork1();
if (!pid) {
if (execv(string, argv) == -1) {

View File

@ -23,10 +23,6 @@
*/
#include "firebird.h"
#ifdef SOLARIS_MT
#include <thread.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -515,7 +511,7 @@ static bool start_server( ibmgr_data_t* data)
#endif
pid_t pid;
#if (defined SOLARIS_MT)
#if (defined SOLARIS)
/* Accoding Sun's documentation vfork() is not MT-safe
while linking with libthreads, fork1 - fork one thread
*/
@ -560,7 +556,7 @@ static bool start_server( ibmgr_data_t* data)
0 if an exit status of a child process is unavailable (that
means in our case that the server is running).
*/
#if (defined SOLARIS_MT)
#if (defined SOLARIS)
// Trying to understand why it died
if (ret_value == pid &&
(WIFEXITED(exit_status) || WCOREDUMP(exit_status) || WIFSIGNALED(exit_status)))
@ -579,7 +575,7 @@ static bool start_server( ibmgr_data_t* data)
break;
}
#endif /* SOLARIS_MT */
#endif /* SOLARIS */
#ifdef DEBUG
else if (ret_value == -1) {