summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <jamppa@bk-internal.mysql.com>2007-03-29 16:11:29 +0200
committerunknown <jamppa@bk-internal.mysql.com>2007-03-29 16:11:29 +0200
commit019446f059fd04b2cc237578b944481df0f72ffa (patch)
treea5c6d6bb27fbcc3eee7a99ee1f8fe736e6c360e2 /sql
parent940eb733f7f4bbfd117d56fcd3f7f03dfe8b8912 (diff)
parentf4422bd4a4e397d2c3271ad8417c277f0e7c0dbe (diff)
downloadmariadb-git-019446f059fd04b2cc237578b944481df0f72ffa.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into bk-internal.mysql.com:/data0/bk/mysql-5.1-marvel client/client_priv.h: Auto merged client/mysqlslap.c: Auto merged sql/mysqld.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/authors.h1
-rw-r--r--sql/mysqld.cc35
-rw-r--r--sql/stacktrace.c19
-rw-r--r--sql/stacktrace.h2
4 files changed, 22 insertions, 35 deletions
diff --git a/sql/authors.h b/sql/authors.h
index 48b807c7884..dfe3b143e2f 100644
--- a/sql/authors.h
+++ b/sql/authors.h
@@ -66,6 +66,7 @@ struct show_table_authors_st show_table_authors[]= {
"Parser, port to OS/2, storage engines and some random stuff" },
{ "Yuri Dario", "", "OS/2 port" },
{ "Andrei Elkin", "Espoo, Finland", "Replication" },
+ { "Patrick Galbraith", "Sharon, NH", "Federated Engine, mysqlslap" },
{ "Sergei Golubchik", "Kerpen, Germany",
"Full-text search, precision math" },
{ "Lenz Grimmer", "Hamburg, Germany",
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 083f0eb1373..696937e4e55 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -195,12 +195,6 @@ inline void reset_floating_point_exceptions()
} /* cplusplus */
-
-#if defined(HAVE_LINUXTHREADS)
-#define THR_KILL_SIGNAL SIGINT
-#else
-#define THR_KILL_SIGNAL SIGUSR2 // Can't use this with LinuxThreads
-#endif
#define MYSQL_KILL_SIGNAL SIGTERM
#ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
@@ -638,6 +632,7 @@ struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
#ifndef EMBEDDED_LIBRARY
struct passwd *user_info;
static pthread_t select_thread;
+static uint thr_kill_signal;
#endif
/* OS specific variables */
@@ -790,7 +785,7 @@ static void close_connections(void)
DBUG_PRINT("info",("Waiting for select thread"));
#ifndef DONT_USE_THR_ALARM
- if (pthread_kill(select_thread,THR_CLIENT_ALARM))
+ if (pthread_kill(select_thread, thr_client_alarm))
break; // allready dead
#endif
set_timespec(abstime, 2);
@@ -2296,7 +2291,9 @@ static void init_signals(void)
DBUG_ENTER("init_signals");
if (test_flags & TEST_SIGINT)
- my_sigset(THR_KILL_SIGNAL,end_thread_signal);
+ {
+ my_sigset(thr_kill_signal, end_thread_signal);
+ }
my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
@@ -2351,10 +2348,13 @@ static void init_signals(void)
#ifdef SIGTSTP
sigaddset(&set,SIGTSTP);
#endif
- sigaddset(&set,THR_SERVER_ALARM);
+ if (thd_lib_detected != THD_LIB_LT)
+ sigaddset(&set,THR_SERVER_ALARM);
if (test_flags & TEST_SIGINT)
- sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT
- sigdelset(&set,THR_CLIENT_ALARM); // For alarms
+ {
+ // May be SIGINT
+ sigdelset(&set, thr_kill_signal);
+ }
sigprocmask(SIG_SETMASK,&set,NULL);
pthread_sigmask(SIG_SETMASK,&set,NULL);
DBUG_VOID_RETURN;
@@ -2417,24 +2417,20 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
*/
init_thr_alarm(thread_scheduler.max_threads +
global_system_variables.max_insert_delayed_threads + 10);
-#if SIGINT != THR_KILL_SIGNAL
- if (test_flags & TEST_SIGINT)
+ if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
{
(void) sigemptyset(&set); // Setup up SIGINT for debug
(void) sigaddset(&set,SIGINT); // For debugging
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
}
-#endif
(void) sigemptyset(&set); // Setup up SIGINT for debug
#ifdef USE_ONE_SIGNAL_HAND
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms
#endif
#ifndef IGNORE_SIGHUP_SIGQUIT
(void) sigaddset(&set,SIGQUIT);
-#if THR_CLIENT_ALARM != SIGHUP
(void) sigaddset(&set,SIGHUP);
#endif
-#endif
(void) sigaddset(&set,SIGTERM);
(void) sigaddset(&set,SIGTSTP);
@@ -3628,6 +3624,13 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); // init my_sys library & pthreads
/* nothing should come before this line ^^^ */
+ /* Set signal used to kill MySQL */
+#if defined(SIGUSR2)
+ thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
+#else
+ thr_kill_signal= SIGINT;
+#endif
+
/*
Perform basic logger initialization logger. Should be called after
MY_INIT, as it initializes mutexes. Log tables are inited later.
diff --git a/sql/stacktrace.c b/sql/stacktrace.c
index d8e9b7fd883..078f62c6b2b 100644
--- a/sql/stacktrace.c
+++ b/sql/stacktrace.c
@@ -53,21 +53,6 @@ void safe_print_str(const char* name, const char* val, int max_len)
#define SIGRETURN_FRAME_OFFSET 23
#endif
-static my_bool is_nptl;
-
-/* Check if we are using NPTL or LinuxThreads on Linux */
-void check_thread_lib(void)
-{
- char buf[5];
-
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
- confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));
- is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf));
-#else
- is_nptl = 0;
-#endif
-}
-
#if defined(__alpha__) && defined(__GNUC__)
/*
The only way to backtrace without a symbol table on alpha
@@ -173,8 +158,8 @@ terribly wrong...\n");
#endif /* __alpha__ */
/* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
- sigreturn_frame_count = is_nptl ? 1 : 2;
-
+ sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1;
+
while (fp < (uchar**) stack_bottom)
{
#if defined(__i386__) || defined(__x86_64__)
diff --git a/sql/stacktrace.h b/sql/stacktrace.h
index f5c92e54e1c..56b9877180a 100644
--- a/sql/stacktrace.h
+++ b/sql/stacktrace.h
@@ -27,11 +27,9 @@ extern char* heap_start;
#define init_stacktrace() do { \
heap_start = (char*) &__bss_start; \
- check_thread_lib(); \
} while(0);
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
-void check_thread_lib(void);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* TARGET_OS_LINUX */