Dep/MySQL: Updated MySQL sources to version 5.5.9 (current GA)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,6 @@
|
||||
#define DONT_REMAP_PTHREAD_FUNCTIONS
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#ifdef THREAD
|
||||
#include <signal.h>
|
||||
#include <m_string.h>
|
||||
#include <thr_alarm.h>
|
||||
@@ -31,46 +30,6 @@
|
||||
|
||||
uint thd_lib_detected= 0;
|
||||
|
||||
#ifndef my_pthread_setprio
|
||||
void my_pthread_setprio(pthread_t thread_id,int prior)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
|
||||
struct sched_param tmp_sched_param;
|
||||
bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
|
||||
tmp_sched_param.sched_priority=prior;
|
||||
VOID(pthread_setschedparam(thread_id,SCHED_POLICY,&tmp_sched_param));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef my_pthread_getprio
|
||||
int my_pthread_getprio(pthread_t thread_id)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
|
||||
struct sched_param tmp_sched_param;
|
||||
int policy;
|
||||
if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param))
|
||||
{
|
||||
return tmp_sched_param.sched_priority;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef my_pthread_attr_setprio
|
||||
void my_pthread_attr_setprio(pthread_attr_t *attr, int priority)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
|
||||
struct sched_param tmp_sched_param;
|
||||
bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
|
||||
tmp_sched_param.sched_priority=priority;
|
||||
VOID(pthread_attr_setschedparam(attr,&tmp_sched_param));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* To allow use of pthread_getspecific with two arguments */
|
||||
|
||||
#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
|
||||
@@ -85,34 +44,6 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __NETWARE__
|
||||
/*
|
||||
Don't kill the LibC Reaper thread or the main thread
|
||||
*/
|
||||
#include <nks/thread.h>
|
||||
#undef pthread_exit
|
||||
void my_pthread_exit(void *status)
|
||||
{
|
||||
NXThreadId_t tid;
|
||||
NXContext_t ctx;
|
||||
char name[NX_MAX_OBJECT_NAME_LEN+1] = "";
|
||||
|
||||
tid= NXThreadGetId();
|
||||
if (tid == NX_INVALID_THREAD_ID || !tid)
|
||||
return;
|
||||
if (NXThreadGetContext(tid, &ctx) ||
|
||||
NXContextGetName(ctx, name, sizeof(name)-1))
|
||||
return;
|
||||
|
||||
/*
|
||||
"MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
|
||||
with a debug build of LibC the reaper can have different names
|
||||
*/
|
||||
if (!strindex(name, "\'s"))
|
||||
pthread_exit(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
|
||||
(and DEC OSF/1 3.2 too)
|
||||
@@ -136,7 +67,7 @@ int my_sigwait(const sigset_t *set,int *sig)
|
||||
|
||||
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
|
||||
|
||||
extern pthread_mutex_t LOCK_localtime_r;
|
||||
extern mysql_mutex_t LOCK_localtime_r;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -144,10 +75,10 @@ extern pthread_mutex_t LOCK_localtime_r;
|
||||
struct tm *localtime_r(const time_t *clock, struct tm *res)
|
||||
{
|
||||
struct tm *tmp;
|
||||
pthread_mutex_lock(&LOCK_localtime_r);
|
||||
mysql_mutex_lock(&LOCK_localtime_r);
|
||||
tmp=localtime(clock);
|
||||
*res= *tmp;
|
||||
pthread_mutex_unlock(&LOCK_localtime_r);
|
||||
mysql_mutex_unlock(&LOCK_localtime_r);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
@@ -161,10 +92,10 @@ struct tm *localtime_r(const time_t *clock, struct tm *res)
|
||||
struct tm *gmtime_r(const time_t *clock, struct tm *res)
|
||||
{
|
||||
struct tm *tmp;
|
||||
pthread_mutex_lock(&LOCK_localtime_r);
|
||||
mysql_mutex_lock(&LOCK_localtime_r);
|
||||
tmp= gmtime(clock);
|
||||
*res= *tmp;
|
||||
pthread_mutex_unlock(&LOCK_localtime_r);
|
||||
mysql_mutex_unlock(&LOCK_localtime_r);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
@@ -206,7 +137,7 @@ void sigwait_setup(sigset_t *set)
|
||||
|
||||
sact.sa_flags = 0;
|
||||
sact.sa_handler = px_handle_sig;
|
||||
memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
|
||||
memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */
|
||||
sigemptyset(&unblock_mask);
|
||||
pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set);
|
||||
|
||||
@@ -232,7 +163,7 @@ void sigwait_setup(sigset_t *set)
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy_fixed(&sigwait_set,set,sizeof(*set));
|
||||
memcpy(&sigwait_set, set, sizeof(*set));
|
||||
pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0);
|
||||
pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0);
|
||||
}
|
||||
@@ -308,7 +239,7 @@ void sigwait_handle_sig(int sig)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_sigwait);
|
||||
sigaddset(&pending_set, sig);
|
||||
VOID(pthread_cond_signal(&COND_sigwait)); /* inform sigwait() about signal */
|
||||
pthread_cond_signal(&COND_sigwait); /* inform sigwait() about signal */
|
||||
pthread_mutex_unlock(&LOCK_sigwait);
|
||||
}
|
||||
|
||||
@@ -320,7 +251,7 @@ void *sigwait_thread(void *set_arg)
|
||||
struct sigaction sact;
|
||||
sact.sa_flags = 0;
|
||||
sact.sa_handler = sigwait_handle_sig;
|
||||
memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
|
||||
memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */
|
||||
sigemptyset(&pending_set);
|
||||
|
||||
for (i = 1; i <= sizeof(pending_set)*8; i++)
|
||||
@@ -357,16 +288,15 @@ int sigwait(sigset_t *setp, int *sigp)
|
||||
pthread_t sigwait_thread_id;
|
||||
inited=1;
|
||||
sigemptyset(&pending_set);
|
||||
pthread_mutex_init(&LOCK_sigwait,MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&COND_sigwait,NULL);
|
||||
pthread_mutex_init(&LOCK_sigwait, MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&COND_sigwait, NULL);
|
||||
|
||||
pthread_attr_init(&thr_attr);
|
||||
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
|
||||
pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
|
||||
pthread_attr_setstacksize(&thr_attr,8196);
|
||||
my_pthread_attr_setprio(&thr_attr,100); /* Very high priority */
|
||||
VOID(pthread_create(&sigwait_thread_id,&thr_attr,sigwait_thread,setp));
|
||||
VOID(pthread_attr_destroy(&thr_attr));
|
||||
pthread_create(&sigwait_thread_id, &thr_attr, sigwait_thread, setp);
|
||||
pthread_attr_destroy(&thr_attr);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&LOCK_sigwait);
|
||||
@@ -392,7 +322,7 @@ int sigwait(sigset_t *setp, int *sigp)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
VOID(pthread_cond_wait(&COND_sigwait,&LOCK_sigwait));
|
||||
pthread_cond_wait(&COND_sigwait, &LOCK_sigwait);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -533,13 +463,7 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex)
|
||||
|
||||
/* Some help functions */
|
||||
|
||||
int pthread_no_free(void *not_used __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_dummy(int ret)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
#endif /* THREAD */
|
||||
|
||||
Reference in New Issue
Block a user