mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:43:03 +01:00
Frontported porting issue - make it build on gcc/solaris/sparc again
This commit is contained in:
parent
cf375bee78
commit
0d5e37316e
@ -166,7 +166,6 @@ static bool event_blocked(const event_t* event, const SLONG value);
|
||||
|
||||
#ifdef UNIX
|
||||
|
||||
static TLS_DECLARE(sigjmp_buf*, sigjmp_ptr);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -2876,6 +2875,17 @@ int ISC_mutex_unlock(struct mtx* mutex)
|
||||
|
||||
#else // not USE_SYS5SEMAPHORE
|
||||
|
||||
#if (defined(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL) || defined(USE_ROBUST_MUTEX)) && defined(LINUX)
|
||||
// glibc in linux does not conform to the posix standard. When there is no RT kernel,
|
||||
// ENOTSUP is returned not by pthread_mutexattr_setprotocol(), but by
|
||||
// pthread_mutex_init(). Here is a hack to deal with this broken error reporting.
|
||||
#define BUGGY_LINUX_MUTEX
|
||||
#endif
|
||||
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
static volatile bool staticBugFlag = false;
|
||||
#endif
|
||||
|
||||
int ISC_mutex_init(struct mtx* mutex)
|
||||
{
|
||||
/**************************************
|
||||
@ -2888,11 +2898,7 @@ int ISC_mutex_init(struct mtx* mutex)
|
||||
* Initialize a mutex.
|
||||
*
|
||||
**************************************/
|
||||
#if defined(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL) || defined(USE_ROBUST_MUTEX)
|
||||
// glibc in linux does not conform to the posix standard. When there is no RT kernel,
|
||||
// ENOTSUP is returned not by pthread_mutexattr_setprotocol(), but by
|
||||
// pthread_mutex_init(). Here is a hack to deal with this broken error reporting.
|
||||
static volatile bool staticBugFlag = false;
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
do
|
||||
{
|
||||
bool bugFlag = staticBugFlag;
|
||||
@ -2908,22 +2914,30 @@ int ISC_mutex_init(struct mtx* mutex)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
if (!bugFlag)
|
||||
{
|
||||
#endif
|
||||
int protocolRc = pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT);
|
||||
if (protocolRc && (protocolRc != ENOTSUP))
|
||||
{
|
||||
iscLogStatus("Pthread Error", (Arg::Gds(isc_sys_request) <<
|
||||
"pthread_mutexattr_setprotocol" << Arg::Unix(protocolRc)).value());
|
||||
}
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_ROBUST_MUTEX
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
if (!bugFlag)
|
||||
{
|
||||
#endif
|
||||
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP));
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
memset(mutex->mtx_mutex, 0, sizeof(pthread_mutex_t));
|
||||
@ -2931,7 +2945,7 @@ int ISC_mutex_init(struct mtx* mutex)
|
||||
int state = pthread_mutex_init(mutex->mtx_mutex, &mattr);
|
||||
|
||||
if (state
|
||||
#if defined(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL) || defined(USE_ROBUST_MUTEX)
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
&& (state != ENOTSUP || bugFlag)
|
||||
#endif
|
||||
)
|
||||
@ -2942,7 +2956,7 @@ int ISC_mutex_init(struct mtx* mutex)
|
||||
|
||||
LOG_PTHREAD_ERROR(pthread_mutexattr_destroy(&mattr));
|
||||
|
||||
#if defined(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL) || defined(USE_ROBUST_MUTEX)
|
||||
#ifdef BUGGY_LINUX_MUTEX
|
||||
if (state == ENOTSUP && !bugFlag)
|
||||
{
|
||||
staticBugFlag = true;
|
||||
@ -3623,6 +3637,8 @@ UCHAR* ISC_remap_file(ISC_STATUS * status_vector,
|
||||
|
||||
|
||||
#ifdef UNIX
|
||||
static TLS_DECLARE(sigjmp_buf*, sigjmp_ptr);
|
||||
|
||||
void ISC_sync_signals_set(void* arg)
|
||||
{
|
||||
/**************************************
|
||||
|
Loading…
Reference in New Issue
Block a user