summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/SETUP.sh10
-rw-r--r--BUILD/SETUP.sh.rej19
-rw-r--r--client/mysql.cc6
-rw-r--r--cmd-line-utils/libedit/readline.c11
-rw-r--r--cmd-line-utils/libedit/readline/readline.h2
-rw-r--r--configure.in20
-rw-r--r--configure.in.rej299
-rw-r--r--include/my_global.h.rej17
-rw-r--r--include/my_pthread.h10
-rw-r--r--include/my_pthread.h.rej80
-rw-r--r--include/thr_alarm.h7
-rw-r--r--mysql-test/Makefile.am1
-rw-r--r--mysys/my_pthread.c7
-rw-r--r--mysys/my_thr_init.c25
-rw-r--r--mysys/thr_alarm.c47
-rw-r--r--mysys/thr_alarm.c.rej220
-rw-r--r--scripts/msql2mysql.sh24
-rw-r--r--sql/gen_lex_hash.cc22
-rw-r--r--sql/mysqld.cc30
-rw-r--r--support-files/Makefile.am4
-rw-r--r--support-files/RHEL4-SElinux/Makefile.am23
-rw-r--r--support-files/RHEL4-SElinux/mysql.fc25
-rw-r--r--support-files/RHEL4-SElinux/mysql.te132
-rw-r--r--support-files/mysql.spec.sh40
24 files changed, 994 insertions, 87 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 274676e0ead..3316b1dd525 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -139,9 +139,17 @@ fi
#
base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex "
-base_configs="$base_configs --enable-thread-safe-client --with-readline "
+base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables"
+if test -d "$path/../cmd-line-utils/readline"
+then
+ base_configs="$base_configs --with-readline"
+elif test -d "$path/../cmd-line-utils/libedit"
+then
+ base_configs="$base_configs --with-libedit"
+fi
+
static_link="--with-mysqld-ldflags=-all-static "
static_link="$static_link --with-client-ldflags=-all-static"
# we need local-infile in all binaries for rpl000001
diff --git a/BUILD/SETUP.sh.rej b/BUILD/SETUP.sh.rej
new file mode 100644
index 00000000000..ccbcaa4404f
--- /dev/null
+++ b/BUILD/SETUP.sh.rej
@@ -0,0 +1,19 @@
+***************
+*** 39,46 ****
+ c_warnings="$global_warnings -Wunused"
+ cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
+
+! alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
+! pentium_cflags="-mcpu=pentiumpro"
+ sparc_cflags=""
+
+ # be as fast as we can be without losing our ability to backtrace
+--- 39,46 ----
+ c_warnings="$global_warnings -Wunused"
+ cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
+
+! #alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
+! #pentium_cflags="-mcpu=pentiumpro"
+ sparc_cflags=""
+
+ # be as fast as we can be without losing our ability to backtrace
diff --git a/client/mysql.cc b/client/mysql.cc
index 28930205635..af782d872e5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1408,7 +1408,7 @@ static char **new_mysql_completion (const char *text, int start, int end);
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
char *no_completion(const char*,int)
#else
-int no_completion()
+char *no_completion()
#endif
{
return 0; /* No filename completion */
@@ -1496,10 +1496,10 @@ static void initialize_readline (char *name)
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
- rl_completion_entry_function= (Function*)&no_completion;
+ rl_completion_entry_function= &no_completion;
#else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
- rl_completion_entry_function= (Function*)&no_completion;
+ rl_completion_entry_function= &no_completion;
#endif
}
diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c
index 8c09a6f39d5..004fcf7d183 100644
--- a/cmd-line-utils/libedit/readline.c
+++ b/cmd-line-utils/libedit/readline.c
@@ -112,7 +112,7 @@ int rl_attempted_completion_over = 0;
char *rl_basic_word_break_characters = break_chars;
char *rl_completer_word_break_characters = NULL;
char *rl_completer_quote_characters = NULL;
-Function *rl_completion_entry_function = NULL;
+CPFunction *rl_completion_entry_function = NULL;
CPPFunction *rl_attempted_completion_function = NULL;
Function *rl_pre_input_hook = NULL;
Function *rl_startup1_hook = NULL;
@@ -1724,7 +1724,7 @@ rl_display_match_list (matches, len, max)
static int
_rl_complete_internal(int what_to_do)
{
- Function *complet_func;
+ CPFunction *complet_func;
const LineInfo *li;
char *temp, **matches;
const char *ctemp;
@@ -1737,7 +1737,7 @@ _rl_complete_internal(int what_to_do)
complet_func = rl_completion_entry_function;
if (!complet_func)
- complet_func = (Function *)(void *)filename_completion_function;
+ complet_func = filename_completion_function;
/* We now look backwards for the start of a filename/variable word */
li = el_line(e);
@@ -1764,7 +1764,7 @@ _rl_complete_internal(int what_to_do)
} else
matches = 0;
if (!rl_attempted_completion_function || !matches)
- matches = completion_matches(temp, (CPFunction *)complet_func);
+ matches = completion_matches(temp, complet_func);
if (matches) {
int i, retval = CC_REFRESH;
@@ -1789,8 +1789,7 @@ _rl_complete_internal(int what_to_do)
* object is a directory.
*/
size_t alen = strlen(matches[0]);
- if ((complet_func !=
- (Function *)filename_completion_function
+ if ((complet_func != filename_completion_function
|| (alen > 0 && (matches[0])[alen - 1] != '/'))
&& rl_completion_append_character) {
char buf[2];
diff --git a/cmd-line-utils/libedit/readline/readline.h b/cmd-line-utils/libedit/readline/readline.h
index c43f71fb51d..6b1fa186512 100644
--- a/cmd-line-utils/libedit/readline/readline.h
+++ b/cmd-line-utils/libedit/readline/readline.h
@@ -102,7 +102,7 @@ extern int max_input_history;
extern char *rl_basic_word_break_characters;
extern char *rl_completer_word_break_characters;
extern char *rl_completer_quote_characters;
-extern Function *rl_completion_entry_function;
+extern CPFunction *rl_completion_entry_function;
extern CPPFunction *rl_attempted_completion_function;
extern int rl_completion_type;
extern int rl_completion_query_items;
diff --git a/configure.in b/configure.in
index 0665362085c..a3eb0ceb713 100644
--- a/configure.in
+++ b/configure.in
@@ -2354,6 +2354,7 @@ readline_basedir=""
readline_dir=""
readline_h_ln_cmd=""
readline_link=""
+want_to_use_readline="no"
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
then
@@ -2379,6 +2380,7 @@ then
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
compile_readline=yes
+ want_to_use_readline="yes"
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
else
# Use system readline library
@@ -2388,10 +2390,12 @@ else
MYSQL_CHECK_NEW_RL_INTERFACE
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
AC_LANG_RESTORE
- if [test "$mysql_cv_new_rl_interface" = "yes"]
+ if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "./cmd-line-utils/readline"]
then
- # Use the new readline interface
+ # Use the new readline interface, but only if the package includes a bundled libreadline
+ # this way we avoid linking commercial source with GPL readline
readline_link="-lreadline"
+ want_to_use_readline="yes"
elif [test "$mysql_cv_libedit_interface" = "yes"]
then
# Use libedit
@@ -2402,6 +2406,15 @@ else
versions of libedit or readline])
fi
fi
+
+# if there is no readline, but we want to build with readline, we fail
+if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"]
+then
+ AC_MSG_ERROR([This commercially licensed MySQL source package can't
+ be built with libreadline. Please use --with-libedit to use
+ the bundled version of libedit instead.])
+fi
+
#
# if either readline or libedit is enabled - generate Makefile's for both
# (to make sure both are included in 'make dist')
@@ -2531,7 +2544,8 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
sql/sql_builtin.cc sql-common/Makefile dnl
dbug/Makefile scripts/Makefile include/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl
- support-files/MacOSX/Makefile mysql-test/Makefile dnl
+ support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
+ mysql-test/Makefile dnl
mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile)
diff --git a/configure.in.rej b/configure.in.rej
new file mode 100644
index 00000000000..46fbf83b198
--- /dev/null
+++ b/configure.in.rej
@@ -0,0 +1,299 @@
+***************
+*** 388,402 ****
+ if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
+ then
+ MYSQLD_DEFAULT_SWITCHES="--skip-locking"
+! IS_LINUX="true"
+ AC_MSG_RESULT("yes");
+ else
+ MYSQLD_DEFAULT_SWITCHES=""
+! IS_LINUX="false"
+ AC_MSG_RESULT("no");
+ fi
+ AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
+! AC_SUBST(IS_LINUX)
+
+ dnl Find paths to some shell programs
+ AC_PATH_PROG(LN, ln, ln)
+--- 388,403 ----
+ if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
+ then
+ MYSQLD_DEFAULT_SWITCHES="--skip-locking"
+! TARGET_LINUX="true"
+ AC_MSG_RESULT("yes");
++ AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
+ else
+ MYSQLD_DEFAULT_SWITCHES=""
+! TARGET_LINUX="false"
+ AC_MSG_RESULT("no");
+ fi
+ AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
+! AC_SUBST(TARGET_LINUX)
+
+ dnl Find paths to some shell programs
+ AC_PATH_PROG(LN, ln, ln)
+***************
+*** 576,582 ****
+ # (this is true on the MySQL build machines to avoid NSS problems)
+ #
+
+! if test "$IS_LINUX" = "true" -a "$static_nss" = ""
+ then
+ tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
+ if test -n "$tmp"
+--- 577,583 ----
+ # (this is true on the MySQL build machines to avoid NSS problems)
+ #
+
+! if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
+ then
+ tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
+ if test -n "$tmp"
+***************
+*** 827,833 ****
+ ])
+ AC_SUBST(WRAPLIBS)
+
+! if test "$IS_LINUX" = "true"; then
+ AC_MSG_CHECKING([for atomic operations])
+
+ AC_LANG_SAVE
+--- 828,834 ----
+ ])
+ AC_SUBST(WRAPLIBS)
+
+! if test "$TARGET_LINUX" = "true"; then
+ AC_MSG_CHECKING([for atomic operations])
+
+ AC_LANG_SAVE
+***************
+*** 870,876 ****
+ [ USE_PSTACK=no ])
+ pstack_libs=
+ pstack_dirs=
+! if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
+ then
+ have_libiberty= have_libbfd=
+ my_save_LIBS="$LIBS"
+--- 871,877 ----
+ [ USE_PSTACK=no ])
+ pstack_libs=
+ pstack_dirs=
+! if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
+ then
+ have_libiberty= have_libbfd=
+ my_save_LIBS="$LIBS"
+***************
+*** 1239,1301 ****
+ # Hack for DEC-UNIX (OSF1)
+ if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
+ then
+! # Look for LinuxThreads.
+! AC_MSG_CHECKING("LinuxThreads")
+! grepres=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
+! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS | wc -l || echo 0`
+! if test "$grepres" -gt 0 -o "$getconfres" -gt 0
+ then
+! AC_MSG_RESULT("Found")
+! AC_DEFINE(HAVE_LINUXTHREADS)
+! # Linux 2.0 sanity check
+! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
+! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
+! # RedHat 5.0 does not work with dynamic linking of this. -static also
+! # gives a speed increase in linux so it does not hurt on other systems.
+! with_named_thread="-lpthread"
+! else
+! AC_MSG_RESULT("Not found")
+! # If this is a linux machine we should barf
+! AC_MSG_CHECKING("NPTL")
+! if test "$IS_LINUX" = "true"
+! then
+! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL | wc -l || echo 0`
+! if test "$getconfres" -gt 0
+ then
+! AC_DEFINE(HAVE_LINUXTHREADS) dnl All this code predates NPTL, so "have linuxthreads" is a poor name.
+! with_named_thread="-lpthread"
+ else
+! AC_MSG_ERROR([This is a Linux system and neither Linuxthreads nor NPTL were
+! found. Please install Linuxthreads or a new glibc and try
+! again. See the Installation chapter in the Reference Manual for
+! more information.])
+ fi
+! else
+! AC_MSG_CHECKING("DEC threads")
+! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
+! then
+! with_named_thread="-lpthread -lmach -lexc"
+! CFLAGS="$CFLAGS -D_REENTRANT"
+! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
+! AC_DEFINE(HAVE_DEC_THREADS)
+! AC_MSG_RESULT("yes")
+! else
+! AC_MSG_RESULT("no")
+! AC_MSG_CHECKING("DEC 3.2 threads")
+! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
+! then
+! with_named_thread="-lpthreads -lmach -lc_r"
+! AC_DEFINE(HAVE_DEC_THREADS)
+! AC_DEFINE(HAVE_DEC_3_2_THREADS)
+! with_osf32_threads="yes"
+! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
+! AC_MSG_RESULT("yes")
+! else
+! AC_MSG_RESULT("no")
+! fi
+! fi
+! fi
+! fi
+ fi
+
+
+--- 1240,1337 ----
+ # Hack for DEC-UNIX (OSF1)
+ if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
+ then
+! AC_MSG_CHECKING("Linux threads")
+! if test "$TARGET_LINUX" = "true"
+ then
+! AC_MSG_RESULT("starting")
+! # use getconf to check glibc contents
+! AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
+! case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
+! NPTL* )
+! AC_MSG_RESULT("NPTL")
+! AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
+! with_named_thread="-lpthread"
+! ;;
+! LINUXTHREADS* )
+! AC_MSG_RESULT("Linuxthreads")
+! AC_DEFINE([HAVE_LINUXTHREADS], [1],
+! [Whether we are using Xavier Leroy's LinuxThreads])
+! with_named_thread="-lpthread"
+! ;;
+! * )
+! AC_MSG_RESULT("unknown")
+! ;;
+! esac
+! if test "$with_named_thread" = "no"
+ then
+! # old method, check headers
+! # Look for LinuxThreads.
+! AC_MSG_CHECKING("LinuxThreads in header file comment")
+! res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
+! if test "$res" -gt 0
+! then
+! AC_MSG_RESULT("Found")
+! AC_DEFINE([HAVE_LINUXTHREADS], [1],
+! [Whether we are using Xavier Leroy's LinuxThreads])
+! # Linux 2.0 sanity check
+! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
+! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
+! # RedHat 5.0 does not work with dynamic linking of this. -static also
+! # gives a speed increase in linux so it does not hurt on other systems.
+! with_named_thread="-lpthread"
+! else
+! AC_MSG_RESULT("Not found")
+! # If this is a linux machine we should barf
+! AC_MSG_ERROR([This is a Linux system without a working getconf,
+! and Linuxthreads was not found. Please install it (or a new glibc) and try again.
+! See the Installation chapter in the Reference Manual for more information.])
+! fi
+ else
+! AC_MSG_RESULT("no need to check headers")
+ fi
+! AC_MSG_CHECKING("for pthread_create in -lpthread");
+! ac_save_LIBS="$LIBS"
+! LIBS="$LIBS -lpthread"
+! AC_TRY_LINK( [#include <pthread.h>],
+! [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
+! AC_MSG_RESULT("yes"),
+! [ AC_MSG_RESULT("no")
+! AC_MSG_ERROR([
+! This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
+! Please install one of these (or a new glibc) and try again.
+! See the Installation chapter in the Reference Manual for more information.]) ]
+! )
+! LIBS="$ac_save_LIBS"
+! else
+! AC_MSG_RESULT("no")
+! fi # "$TARGET_LINUX"
+! fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
+!
+! if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
+! then
+! AC_MSG_CHECKING("DEC threads")
+! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
+! then
+! with_named_thread="-lpthread -lmach -lexc"
+! CFLAGS="$CFLAGS -D_REENTRANT"
+! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
+! AC_DEFINE(HAVE_DEC_THREADS)
+! AC_MSG_RESULT("yes")
+! else
+! AC_MSG_RESULT("no")
+! AC_MSG_CHECKING("DEC 3.2 threads")
+! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
+! then
+! with_named_thread="-lpthreads -lmach -lc_r"
+! AC_DEFINE(HAVE_DEC_THREADS)
+! AC_DEFINE(HAVE_DEC_3_2_THREADS)
+! with_osf32_threads="yes"
+! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
+! AC_MSG_RESULT("yes")
+! else
+! AC_MSG_RESULT("no")
+! fi
+! fi
+ fi
+
+
+***************
+*** 1720,1726 ****
+ AC_SUBST(COMPILATION_COMMENT)
+
+ AC_MSG_CHECKING("need of special linking flags")
+! if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
+ then
+ LDFLAGS="$LDFLAGS -rdynamic"
+ AC_MSG_RESULT("-rdynamic")
+--- 1756,1762 ----
+ AC_SUBST(COMPILATION_COMMENT)
+
+ AC_MSG_CHECKING("need of special linking flags")
+! if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
+ then
+ LDFLAGS="$LDFLAGS -rdynamic"
+ AC_MSG_RESULT("-rdynamic")
+***************
+*** 1873,1878 ****
+ tell atod memcpy memmove \
+ setupterm strcasecmp sighold vidattr lrand48 localtime_r \
+ sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
+ pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
+ pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
+ pthread_attr_getstacksize pthread_key_delete \
+--- 1909,1915 ----
+ tell atod memcpy memmove \
+ setupterm strcasecmp sighold vidattr lrand48 localtime_r \
+ sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
++ sigaction sigemptyset sigaddset \
+ pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
+ pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
+ pthread_attr_getstacksize pthread_key_delete \
+***************
+*** 1884,1890 ****
+ # Sanity check: We chould not have any fseeko symbol unless
+ # large_file_support=yes
+ AC_CHECK_FUNCS(fseeko,
+! [if test "$large_file_support" = no -a "$IS_LINUX" = "true";
+ then
+ AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
+ fi]
+--- 1921,1927 ----
+ # Sanity check: We chould not have any fseeko symbol unless
+ # large_file_support=yes
+ AC_CHECK_FUNCS(fseeko,
+! [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
+ then
+ AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
+ fi]
diff --git a/include/my_global.h.rej b/include/my_global.h.rej
new file mode 100644
index 00000000000..f2953d169e7
--- /dev/null
+++ b/include/my_global.h.rej
@@ -0,0 +1,17 @@
+***************
+*** 97,103 ****
+
+
+ /* Fix problem with S_ISLNK() on Linux */
+! #if defined(HAVE_LINUXTHREADS)
+ #undef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
+--- 97,103 ----
+
+
+ /* Fix problem with S_ISLNK() on Linux */
+! #if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
+ #undef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 8ae8e7f9512..66a28ec5654 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -690,6 +690,16 @@ extern uint my_thread_end_wait_time;
Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
*/
+
+/* Which kind of thread library is in use */
+
+#define THD_LIB_OTHER 1
+#define THD_LIB_NPTL 2
+#define THD_LIB_LT 4
+
+extern uint thd_lib_detected;
+extern uint thr_client_alarm;
+
/* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment
diff --git a/include/my_pthread.h.rej b/include/my_pthread.h.rej
new file mode 100644
index 00000000000..1f73655b0bd
--- /dev/null
+++ b/include/my_pthread.h.rej
@@ -0,0 +1,80 @@
+***************
+*** 286,293 ****
+ #undef HAVE_PTHREAD_RWLOCK_RDLOCK
+ #undef HAVE_SNPRINTF
+
+! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
+! #define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
+ #define my_pthread_attr_setprio(A,B)
+ #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
+
+--- 294,301 ----
+ #undef HAVE_PTHREAD_RWLOCK_RDLOCK
+ #undef HAVE_SNPRINTF
+
+! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
+! #define my_signal(A,B) pthread_signal((A),(void (*)(int)) (B))
+ #define my_pthread_attr_setprio(A,B)
+ #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
+
+***************
+*** 324,337 ****
+ #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
+ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
+ #endif
+! #if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
+! #define sigset(A,B) do { struct sigaction s; sigset_t set; \
+! sigemptyset(&set); \
+! s.sa_handler = (B); \
+! s.sa_mask = set; \
+! s.sa_flags = 0; \
+! sigaction((A), &s, (struct sigaction *) NULL); \
+ } while (0)
+ #endif
+
+ #ifndef my_pthread_setprio
+--- 332,358 ----
+ #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
+ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
+ #endif
+!
+! /*
+! We define my_sigset() and use that instead of the system sigset() so that
+! we can favor an implementation based on sigaction(). On some systems, such
+! as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
+! we want to make sure that no such flags are set.
+! */
+! #if defined(HAVE_SIGACTION) && !defined(my_sigset)
+! #define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
+! DBUG_ASSERT((A) != 0); \
+! sigemptyset(&set); \
+! s.sa_handler = (B); \
+! s.sa_mask = set; \
+! s.sa_flags = 0; \
+! rc= sigaction((A), &s, (struct sigaction *) NULL); \
+! DBUG_ASSERT(rc == 0); \
+ } while (0)
++ #elif defined(HAVE_SIGSET) && !defined(my_sigset)
++ #define my_sigset(A,B) sigset((A),(B))
++ #elif !defined(my_sigset)
++ #define my_sigset(A,B) signal((A),(B))
+ #endif
+
+ #ifndef my_pthread_setprio
+***************
+*** 416,422 ****
+ #undef pthread_detach_this_thread
+ #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
+ #undef sigset
+! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
+ #endif
+
+ #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
+--- 437,443 ----
+ #undef pthread_detach_this_thread
+ #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
+ #undef sigset
+! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
+ #endif
+
+ #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 90f785c022f..f5e73fc2b7a 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -24,11 +24,6 @@ extern "C" {
#ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
#endif
-#ifdef HAVE_LINUXTHREADS
-#define THR_CLIENT_ALARM SIGALRM
-#else
-#define THR_CLIENT_ALARM SIGUSR1
-#endif
#ifdef HAVE_rts_threads
#undef USE_ONE_SIGNAL_HAND
#define USE_ALARM_THREAD
@@ -89,6 +84,8 @@ typedef struct st_alarm {
my_bool malloced;
} ALARM;
+extern uint thr_client_alarm;
+
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index ede012c1870..678e6bdfd5c 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -35,7 +35,6 @@ CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
-
dist-hook:
mkdir -p \
$(distdir)/t \
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 844112991f6..a7bb75d25a8 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -29,6 +29,9 @@
#define SCHED_POLICY SCHED_OTHER
#endif
+uint thd_lib_detected;
+uint thr_client_alarm;
+
#ifndef my_pthread_setprio
void my_pthread_setprio(pthread_t thread_id,int prior)
{
@@ -332,7 +335,9 @@ void *sigwait_thread(void *set_arg)
sigaction(i, &sact, (struct sigaction*) 0);
}
}
- sigaddset(set,THR_CLIENT_ALARM);
+ /* Ensure that init_thr_alarm() is called */
+ DBUG_ASSERT(thr_client_alarm);
+ sigaddset(set, thr_client_alarm);
pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
alarm_thread=pthread_self(); /* For thr_alarm */
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 853a2761224..9d706883869 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -20,6 +20,7 @@
#include "mysys_priv.h"
#include <m_string.h>
+#include <signal.h>
#ifdef THREAD
#ifdef USE_TLS
@@ -63,6 +64,8 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg)
#endif
+static uint get_thread_lib(void);
+
/*
initialize thread environment
@@ -76,6 +79,12 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg)
my_bool my_thread_global_init(void)
{
+ thd_lib_detected= get_thread_lib();
+ if (thd_lib_detected == THD_LIB_LT)
+ thr_client_alarm= SIGALRM;
+ else
+ thr_client_alarm= SIGUSR1;
+
if (pthread_key_create(&THR_KEY_mysys,0))
{
fprintf(stderr,"Can't initialize threads: error %d\n",errno);
@@ -392,4 +401,20 @@ const char *my_thread_name(void)
}
#endif /* DBUG_OFF */
+
+static uint get_thread_lib(void)
+{
+ char buff[64];
+
+#ifdef _CS_GNU_LIBPTHREAD_VERSION
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff));
+
+ if (!strncasecmp(buff, "NPTL", 4))
+ return THD_LIB_NPTL;
+ if (!strncasecmp(buff, "linuxthreads", 12))
+ return THD_LIB_LT;
+#endif
+ return THD_LIB_OTHER;
+}
+
#endif /* THREAD */
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 170ee8a1b73..9c92333d1bd 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -34,6 +34,7 @@
#define ETIME ETIMEDOUT
#endif
+uint thr_client_alarm;
static int alarm_aborted=1; /* No alarm thread */
my_bool thr_alarm_inited= 0;
volatile my_bool alarm_thread_running= 0;
@@ -56,9 +57,7 @@ static void *alarm_handler(void *arg);
#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
#endif
-#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
static sig_handler thread_alarm(int sig __attribute__((unused)));
-#endif
static int compare_ulong(void *not_used __attribute__((unused)),
byte *a_ptr,byte* b_ptr)
@@ -77,9 +76,16 @@ void init_thr_alarm(uint max_alarms)
sigfillset(&full_signal_set); /* Neaded to block signals */
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_alarm,NULL);
-#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
- my_sigset(THR_CLIENT_ALARM,thread_alarm);
+ if (thd_lib_detected == THD_LIB_LT)
+ thr_client_alarm= SIGALRM;
+ else
+ thr_client_alarm= SIGUSR1;
+#ifndef USE_ALARM_THREAD
+ if (thd_lib_detected != THD_LIB_LT)
#endif
+ {
+ my_sigset(thr_client_alarm, thread_alarm);
+ }
sigemptyset(&s);
sigaddset(&s, THR_SERVER_ALARM);
alarm_thread=pthread_self();
@@ -97,10 +103,11 @@ void init_thr_alarm(uint max_alarms)
}
#elif defined(USE_ONE_SIGNAL_HAND)
pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
-#if THR_SERVER_ALARM == THR_CLIENT_ALARM
- my_sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
- pthread_sigmask(SIG_UNBLOCK, &s, NULL);
-#endif
+ if (thd_lib_detected == THD_LIB_LT)
+ {
+ my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */
+ pthread_sigmask(SIG_UNBLOCK, &s, NULL);
+ }
#else
my_sigset(THR_SERVER_ALARM, process_alarm);
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
@@ -151,7 +158,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
now=(ulong) time((time_t*) 0);
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
- pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
+ pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
if (alarm_aborted > 0)
{ /* No signal thread */
DBUG_PRINT("info", ("alarm aborted"));
@@ -271,18 +278,17 @@ sig_handler process_alarm(int sig __attribute__((unused)))
This must be first as we can't call DBUG inside an alarm for a normal thread
*/
-#if THR_SERVER_ALARM == THR_CLIENT_ALARM
- if (!pthread_equal(pthread_self(),alarm_thread))
+ if (thd_lib_detected == THD_LIB_LT &&
+ !pthread_equal(pthread_self(),alarm_thread))
{
#if defined(MAIN) && !defined(__bsdi__)
printf("thread_alarm in process_alarm\n"); fflush(stdout);
#endif
#ifdef DONT_REMEMBER_SIGNAL
- my_sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
+ my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */
#endif
return;
}
-#endif
/*
We have to do do the handling of the alarm in a sub function,
@@ -326,7 +332,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data=(ALARM*) queue_element(&alarm_queue,i);
alarm_data->alarmed=1; /* Info to thread */
if (pthread_equal(alarm_data->thread,alarm_thread) ||
- pthread_kill(alarm_data->thread, THR_CLIENT_ALARM))
+ pthread_kill(alarm_data->thread, thr_client_alarm))
{
#ifdef MAIN
printf("Warning: pthread_kill couldn't find thread!!!\n");
@@ -350,7 +356,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
alarm_data->alarmed=1; /* Info to thread */
DBUG_PRINT("info",("sending signal to waiting thread"));
if (pthread_equal(alarm_data->thread,alarm_thread) ||
- pthread_kill(alarm_data->thread, THR_CLIENT_ALARM))
+ pthread_kill(alarm_data->thread, thr_client_alarm))
{
#ifdef MAIN
printf("Warning: pthread_kill couldn't find thread!!!\n");
@@ -487,7 +493,7 @@ void thr_alarm_info(ALARM_INFO *info)
ARGSUSED
*/
-#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
+
static sig_handler thread_alarm(int sig)
{
#ifdef MAIN
@@ -497,7 +503,6 @@ static sig_handler thread_alarm(int sig)
my_sigset(sig,thread_alarm); /* int. thread system calls */
#endif
}
-#endif
#ifdef HAVE_TIMESPEC_TS_SEC
@@ -783,9 +788,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
sigaddset(&set,SIGINT);
sigaddset(&set,SIGQUIT);
sigaddset(&set,SIGTERM);
-#if THR_CLIENT_ALARM != SIGHUP
sigaddset(&set,SIGHUP);
-#endif
#ifdef SIGTSTP
sigaddset(&set,SIGTSTP);
#endif
@@ -796,7 +799,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
puts("Starting signal handling thread");
#endif
printf("server alarm: %d thread alarm: %d\n",
- THR_SERVER_ALARM,THR_CLIENT_ALARM);
+ THR_SERVER_ALARM, thr_client_alarm);
DBUG_PRINT("info",("Starting signal and alarm handling thread"));
for(;;)
{
@@ -864,11 +867,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
sigaddset(&set,SIGTSTP);
#endif
sigaddset(&set,THR_SERVER_ALARM);
- sigdelset(&set,THR_CLIENT_ALARM);
+ sigdelset(&set, thr_client_alarm);
(void) pthread_sigmask(SIG_SETMASK,&set,NULL);
#ifdef NOT_USED
sigemptyset(&set);
- sigaddset(&set,THR_CLIENT_ALARM);
+ sigaddset(&set, thr_client_alarm);
VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0));
#endif
diff --git a/mysys/thr_alarm.c.rej b/mysys/thr_alarm.c.rej
new file mode 100644
index 00000000000..c991121052e
--- /dev/null
+++ b/mysys/thr_alarm.c.rej
@@ -0,0 +1,220 @@
+***************
+*** 76,96 ****
+ alarm_aborted=0;
+ init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
+ compare_ulong,NullS);
+! sigfillset(&full_signal_set); /* Neaded to block signals */
+ pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
+ pthread_cond_init(&COND_alarm,NULL);
+! #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
+! #if defined(HAVE_mit_thread)
+! sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */
+! #else
+ {
+! struct sigaction sact;
+! sact.sa_flags = 0;
+! sact.sa_handler = thread_alarm;
+! sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
+ }
+- #endif
+- #endif
+ sigemptyset(&s);
+ sigaddset(&s, THR_SERVER_ALARM);
+ alarm_thread=pthread_self();
+--- 74,89 ----
+ alarm_aborted=0;
+ init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
+ compare_ulong,NullS);
+! sigfillset(&full_signal_set); /* Needed to block signals */
+ pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
+ pthread_cond_init(&COND_alarm,NULL);
+! #ifndef USE_ALARM_THREAD
+! if (thd_lib_detected != THD_LIB_LT)
+! #endif
+ {
+! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
+! thread_alarm);
+ }
+ sigemptyset(&s);
+ sigaddset(&s, THR_SERVER_ALARM);
+ alarm_thread=pthread_self();
+***************
+*** 108,120 ****
+ }
+ #elif defined(USE_ONE_SIGNAL_HAND)
+ pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
+! #if THR_SERVER_ALARM == THR_CLIENT_ALARM
+! sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
+! pthread_sigmask(SIG_UNBLOCK, &s, NULL);
+! #endif
+ #else
+ pthread_sigmask(SIG_UNBLOCK, &s, NULL);
+- sigset(THR_SERVER_ALARM,process_alarm);
+ #endif
+ DBUG_VOID_RETURN;
+ }
+--- 101,115 ----
+ }
+ #elif defined(USE_ONE_SIGNAL_HAND)
+ pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
+! if (thd_lib_detected == THD_LIB_LT)
+! {
+! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
+! process_alarm); /* Linuxthreads */
+! pthread_sigmask(SIG_UNBLOCK, &s, NULL);
+! }
+ #else
++ my_sigset(THR_SERVER_ALARM, process_alarm);
+ pthread_sigmask(SIG_UNBLOCK, &s, NULL);
+ #endif
+ DBUG_VOID_RETURN;
+ }
+***************
+*** 240,246 ****
+ if (alarm_data->malloced)
+ my_free((gptr) alarm_data,MYF(0));
+ found++;
+! #ifndef DBUG_OFF
+ break;
+ #endif
+ }
+--- 235,241 ----
+ if (alarm_data->malloced)
+ my_free((gptr) alarm_data,MYF(0));
+ found++;
+! #ifdef DBUG_OFF
+ break;
+ #endif
+ }
+***************
+*** 249,258 ****
+ if (!found)
+ {
+ if (*alarmed)
+! fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n",
+! (long) *alarmed, alarm_queue.elements);
+! DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
+! (long) *alarmed));
+ }
+ pthread_mutex_unlock(&LOCK_alarm);
+ pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+--- 244,254 ----
+ if (!found)
+ {
+ if (*alarmed)
+! fprintf(stderr,
+! "Warning: Didn't find alarm 0x%lx in queue of %d alarms\n",
+! (long) *alarmed, alarm_queue.elements);
+! DBUG_PRINT("warning",("Didn't find alarm 0x%lx in queue\n",
+! (long) *alarmed));
+ }
+ pthread_mutex_unlock(&LOCK_alarm);
+ pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+***************
+*** 274,291 ****
+ This must be first as we can't call DBUG inside an alarm for a normal thread
+ */
+
+! #if THR_SERVER_ALARM == THR_CLIENT_ALARM
+! if (!pthread_equal(pthread_self(),alarm_thread))
+ {
+ #if defined(MAIN) && !defined(__bsdi__)
+! printf("thread_alarm\n"); fflush(stdout);
+ #endif
+ #ifdef DONT_REMEMBER_SIGNAL
+! sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
+ #endif
+ return;
+ }
+- #endif
+
+ /*
+ We have to do do the handling of the alarm in a sub function,
+--- 270,287 ----
+ This must be first as we can't call DBUG inside an alarm for a normal thread
+ */
+
+! if (thd_lib_detected == THD_LIB_LT &&
+! !pthread_equal(pthread_self(),alarm_thread))
+ {
+ #if defined(MAIN) && !defined(__bsdi__)
+! printf("thread_alarm in process_alarm\n"); fflush(stdout);
+ #endif
+ #ifdef DONT_REMEMBER_SIGNAL
+! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
+! process_alarm); /* int. thread system calls */
+ #endif
+ return;
+ }
+
+ /*
+ We have to do do the handling of the alarm in a sub function,
+***************
+*** 301,307 ****
+ process_alarm_part2(sig);
+ #ifndef USE_ALARM_THREAD
+ #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
+! sigset(THR_SERVER_ALARM,process_alarm);
+ #endif
+ pthread_mutex_unlock(&LOCK_alarm);
+ pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+--- 297,303 ----
+ process_alarm_part2(sig);
+ #ifndef USE_ALARM_THREAD
+ #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
+! my_sigset(THR_SERVER_ALARM, process_alarm);
+ #endif
+ pthread_mutex_unlock(&LOCK_alarm);
+ pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
+***************
+*** 504,520 ****
+ ARGSUSED
+ */
+
+- #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
+ static sig_handler thread_alarm(int sig)
+ {
+ #ifdef MAIN
+ printf("thread_alarm\n"); fflush(stdout);
+ #endif
+ #ifdef DONT_REMEMBER_SIGNAL
+! sigset(sig,thread_alarm); /* int. thread system calls */
+ #endif
+ }
+- #endif
+
+
+ #ifdef HAVE_TIMESPEC_TS_SEC
+--- 499,513 ----
+ ARGSUSED
+ */
+
+ static sig_handler thread_alarm(int sig)
+ {
+ #ifdef MAIN
+ printf("thread_alarm\n"); fflush(stdout);
+ #endif
+ #ifdef DONT_REMEMBER_SIGNAL
+! my_sigset(sig, thread_alarm); /* int. thread system calls */
+ #endif
+ }
+
+
+ #ifdef HAVE_TIMESPEC_TS_SEC
+***************
+*** 915,921 ****
+ printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
+ fflush(stdout);
+ #ifdef DONT_REMEMBER_SIGNAL
+! sigset(sig,print_signal_warning); /* int. thread system calls */
+ #endif
+ #ifndef OS2
+ if (sig == SIGALRM)
+--- 908,914 ----
+ printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
+ fflush(stdout);
+ #ifdef DONT_REMEMBER_SIGNAL
+! my_sigset(sig, print_signal_warning); /* int. thread system calls */
+ #endif
+ #ifndef OS2
+ if (sig == SIGALRM)
diff --git a/scripts/msql2mysql.sh b/scripts/msql2mysql.sh
index 89a1fcea959..3c802d63705 100644
--- a/scripts/msql2mysql.sh
+++ b/scripts/msql2mysql.sh
@@ -1,16 +1,18 @@
#!/bin/sh
-# Copyright (C) 1979-1996 TcX AB & Monty Program KB & Detron HB
+# Copyright (C) 1979-2007 MySQL AB
#
-# This software is distributed with NO WARRANTY OF ANY KIND. No author or
-# distributor accepts any responsibility for the consequences of using it, or
-# for whether it serves any particular purpose or works at all, unless he or
-# she says so in writing. Refer to the Free Public License (the "License")
-# for full details.
+# 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
+# the Free Software Foundation; version 2 of the License.
#
-# Every copy of this file must include a copy of the License, normally in a
-# plain ASCII text file named PUBLIC. The License grants you the right to
-# copy, modify and redistribute this file, but only under certain conditions
-# described in the License. Among other things, the License requires that
-# the copyright notice and this notice be preserved on all copies.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
+# MA 02110-1301 USA.
@bindir@/replace msqlConnect mysql_connect msqlListDBs mysql_list_dbs msqlNumRows mysql_num_rows msqlFetchRow mysql_fetch_row msqlFetchField mysql_fetch_field msqlFreeResult mysql_free_result msqlListFields mysql_list_fields msqlListTables mysql_list_tables msqlErrMsg 'mysql_error(mysql)' msqlStoreResult mysql_store_result msqlQuery mysql_query msqlField mysql_field msqlSelect mysql_select msqlSelectDB mysql_select_db msqlNumFields mysql_num_fields msqlClose mysql_close msqlDataSeek mysql_data_seek m_field MYSQL_FIELD m_result MYSQL_RES m_row MYSQL_ROW msql mysql mSQL mySQL MSQL MYSQL msqlCreateDB mysql_create_db msqlDropDB mysql_drop_db msqlFieldSeek mysql_field_seek -- $*
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 7abdb5f488c..2d78999017a 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -445,10 +445,24 @@ int main(int argc,char **argv)
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
- printf("/* Copyright (C) 2001-2004 MySQL AB\n\
- This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
- and you are welcome to modify and redistribute it under the GPL license\n\
- \n*/\n\n");
+ printf("\
+/* Copyright (C) 2001-2004 MySQL AB\n\
+\n\
+ This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; version 2 of the License.\n\
+\n\
+ This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details.\n\
+\n\
+ You should have received a copy of the GNU General Public License\n\
+ along with this program; see the file COPYING. If not, write to the\n\
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston\n\
+ MA 02110-1301 USA. */\n\
+\n\
+");
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/* Do " "not " "edit " "this " "file! This is generated by "
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6375bb51220..88f1b336043 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -199,12 +199,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
@@ -595,6 +589,7 @@ pthread_mutex_t LOCK_server_started;
pthread_cond_t COND_server_started;
int mysqld_server_started= 0;
+static uint thr_kill_signal;
File_parser_dummy_hook file_parser_dummy_hook;
@@ -768,7 +763,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);
@@ -2188,7 +2183,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))
@@ -2245,8 +2242,12 @@ static void init_signals(void)
#endif
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);
+ }
+ // For alarms
+ sigdelset(&set, thr_client_alarm);
sigprocmask(SIG_SETMASK,&set,NULL);
pthread_sigmask(SIG_SETMASK,&set,NULL);
DBUG_VOID_RETURN;
@@ -2310,24 +2311,20 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
*/
init_thr_alarm(max_connections +
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);
@@ -3481,6 +3478,9 @@ int main(int argc, char **argv)
exit(1);
}
+ /* Set signal used to kill MySQL */
+ thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
+
/*
Perform basic logger initialization logger. Should be called after
MY_INIT, as it initializes mutexes. Log tables are inited later.
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index da8c25ccb1e..f2533100117 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -30,13 +30,13 @@ EXTRA_DIST = mysql.spec.sh \
MySQL-shared-compat.spec.sh \
ndb-config-2-node.ini.sh
-SUBDIRS = MacOSX
+SUBDIRS = MacOSX RHEL4-SElinux
pkgdata_DATA = my-small.cnf \
my-medium.cnf \
my-large.cnf \
my-huge.cnf \
- my-innodb-heavy-4G.cnf \
+ my-innodb-heavy-4G.cnf \
mysql-log-rotate \
binary-configure \
ndb-config-2-node.ini
diff --git a/support-files/RHEL4-SElinux/Makefile.am b/support-files/RHEL4-SElinux/Makefile.am
new file mode 100644
index 00000000000..52292136877
--- /dev/null
+++ b/support-files/RHEL4-SElinux/Makefile.am
@@ -0,0 +1,23 @@
+# Copyright (C) 2000-2001, 2003-2006 MySQL AB
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+
+## Process this file with automake to create Makefile.in
+
+EXTRA_DIST = mysql.fc mysql.te
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/support-files/RHEL4-SElinux/mysql.fc b/support-files/RHEL4-SElinux/mysql.fc
new file mode 100644
index 00000000000..0db0ccf6e68
--- /dev/null
+++ b/support-files/RHEL4-SElinux/mysql.fc
@@ -0,0 +1,25 @@
+# MySQL Database Server
+
+#
+# /etc
+#
+/etc/my\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0)
+/etc/mysql(/.*)? gen_context(system_u:object_r:mysqld_etc_t,s0)
+
+#
+# /usr
+# Red Hat compatibility
+/usr/libexec/mysqld -- gen_context(system_u:object_r:mysqld_exec_t,s0)
+
+# MySQL AB compatibility
+/usr/sbin/mysqld(-max)? -- gen_context(system_u:object_r:mysqld_exec_t,s0)
+
+#
+# /var
+#
+/var/lib/mysql(/.*)? gen_context(system_u:object_r:mysqld_db_t,s0)
+/var/lib/mysql/mysql\.sock -s gen_context(system_u:object_r:mysqld_var_run_t,s0)
+
+/var/log/mysql.* -- gen_context(system_u:object_r:mysqld_log_t,s0)
+
+/var/run/mysqld(/.*)? gen_context(system_u:object_r:mysqld_var_run_t,s0)
diff --git a/support-files/RHEL4-SElinux/mysql.te b/support-files/RHEL4-SElinux/mysql.te
new file mode 100644
index 00000000000..b050fa7b1a6
--- /dev/null
+++ b/support-files/RHEL4-SElinux/mysql.te
@@ -0,0 +1,132 @@
+
+policy_module(mysql,1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type mysqld_t;
+type mysqld_exec_t;
+init_daemon_domain(mysqld_t,mysqld_exec_t)
+
+type mysqld_var_run_t;
+files_pid_file(mysqld_var_run_t)
+
+type mysqld_db_t;
+files_type(mysqld_db_t)
+
+type mysqld_etc_t alias etc_mysqld_t;
+files_config_file(mysqld_etc_t)
+
+type mysqld_log_t;
+logging_log_file(mysqld_log_t)
+
+type mysqld_tmp_t;
+files_tmp_file(mysqld_tmp_t)
+
+########################################
+#
+# Local policy
+#
+
+allow mysqld_t self:capability { dac_override setgid setuid sys_resource net_bind_service };
+dontaudit mysqld_t self:capability sys_tty_config;
+allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh };
+allow mysqld_t self:fifo_file { read write };
+allow mysqld_t self:unix_stream_socket create_stream_socket_perms;
+allow mysqld_t self:tcp_socket create_stream_socket_perms;
+allow mysqld_t self:udp_socket create_socket_perms;
+
+allow mysqld_t mysqld_db_t:dir create_dir_perms;
+allow mysqld_t mysqld_db_t:file create_file_perms;
+allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms;
+files_var_lib_filetrans(mysqld_t,mysqld_db_t,{ dir file })
+
+allow mysqld_t mysqld_etc_t:file { getattr read };
+allow mysqld_t mysqld_etc_t:lnk_file { getattr read };
+allow mysqld_t mysqld_etc_t:dir list_dir_perms;
+
+allow mysqld_t mysqld_log_t:file create_file_perms;
+logging_log_filetrans(mysqld_t,mysqld_log_t,file)
+
+allow mysqld_t mysqld_tmp_t:dir create_dir_perms;
+allow mysqld_t mysqld_tmp_t:file create_file_perms;
+files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir })
+
+allow mysqld_t mysqld_var_run_t:dir rw_dir_perms;
+allow mysqld_t mysqld_var_run_t:sock_file create_file_perms;
+allow mysqld_t mysqld_var_run_t:file create_file_perms;
+files_pid_filetrans(mysqld_t,mysqld_var_run_t,file)
+
+kernel_read_system_state(mysqld_t)
+kernel_read_kernel_sysctls(mysqld_t)
+
+corenet_non_ipsec_sendrecv(mysqld_t)
+corenet_tcp_sendrecv_all_if(mysqld_t)
+corenet_udp_sendrecv_all_if(mysqld_t)
+corenet_tcp_sendrecv_all_nodes(mysqld_t)
+corenet_udp_sendrecv_all_nodes(mysqld_t)
+corenet_tcp_sendrecv_all_ports(mysqld_t)
+corenet_udp_sendrecv_all_ports(mysqld_t)
+corenet_tcp_bind_all_nodes(mysqld_t)
+corenet_tcp_bind_mysqld_port(mysqld_t)
+corenet_tcp_connect_mysqld_port(mysqld_t)
+corenet_sendrecv_mysqld_client_packets(mysqld_t)
+corenet_sendrecv_mysqld_server_packets(mysqld_t)
+
+dev_read_sysfs(mysqld_t)
+
+fs_getattr_all_fs(mysqld_t)
+fs_search_auto_mountpoints(mysqld_t)
+
+term_dontaudit_use_console(mysqld_t)
+
+domain_use_interactive_fds(mysqld_t)
+
+files_getattr_var_lib_dirs(mysqld_t)
+files_read_etc_runtime_files(mysqld_t)
+files_read_etc_files(mysqld_t)
+files_read_usr_files(mysqld_t)
+files_search_var_lib(mysqld_t)
+
+auth_use_nsswitch(mysqld_t)
+
+init_use_fds(mysqld_t)
+init_use_script_ptys(mysqld_t)
+
+libs_use_ld_so(mysqld_t)
+libs_use_shared_libs(mysqld_t)
+
+logging_send_syslog_msg(mysqld_t)
+
+miscfiles_read_localization(mysqld_t)
+
+sysnet_read_config(mysqld_t)
+
+userdom_dontaudit_use_unpriv_user_fds(mysqld_t)
+# for /root/.my.cnf - should not be needed:
+userdom_read_sysadm_home_content_files(mysqld_t)
+
+ifdef(`distro_redhat',`
+ # because Fedora has the sock_file in the database directory
+ type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t;
+')
+
+ifdef(`targeted_policy',`
+ term_dontaudit_use_unallocated_ttys(mysqld_t)
+ term_dontaudit_use_generic_ptys(mysqld_t)
+ files_dontaudit_read_root_files(mysqld_t)
+')
+
+optional_policy(`
+ daemontools_service_domain(mysqld_t, mysqld_exec_t)
+')
+
+optional_policy(`
+ seutil_sigchld_newrole(mysqld_t)
+')
+
+optional_policy(`
+ udev_read_db(mysqld_t)
+')
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 85a43f31efc..893baba178b 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -1,3 +1,18 @@
+# Copyright (C) 2000-2007 MySQL AB
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
+# MA 02110-1301 USA.
%define mysql_version @VERSION@
@@ -71,12 +86,9 @@ is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
-The MySQL software has Dual Licensing, which means you can use the MySQL
-software free of charge under the GNU General Public License
-(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
-licenses from MySQL AB if you do not wish to be bound by the terms of
-the GPL. See the chapter "Licensing and Support" in the manual for
-further info.
+Copyright (C) 2000-2007 MySQL AB
+This software comes with ABSOLUTELY NO WARRANTY. This is free software,
+and you are welcome to modify and redistribute it under the GPL license.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
@@ -96,12 +108,9 @@ is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
-The MySQL software has Dual Licensing, which means you can use the MySQL
-software free of charge under the GNU General Public License
-(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
-licenses from MySQL AB if you do not wish to be bound by the terms of
-the GPL. See the chapter "Licensing and Support" in the manual for
-further info.
+Copyright (C) 2000-2007 MySQL AB
+This software comes with ABSOLUTELY NO WARRANTY. This is free software,
+and you are welcome to modify and redistribute it under the GPL license.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
@@ -329,6 +338,7 @@ then
fi
(cd mysql-debug-%{mysql_version}/mysql-test ; \
+ MTR_BUILD_THREAD=auto ; export MTR_BUILD_THREAD ; \
./mysql-test-run.pl --comment=debug --skip-rpl --skip-ndbcluster --force --report-features ; \
true)
@@ -360,6 +370,8 @@ then
fi
cd mysql-release-%{mysql_version}/mysql-test
+MTR_BUILD_THREAD=auto
+export MTR_BUILD_THREAD
./mysql-test-run.pl --comment=normal --force --skip-ndbcluster --timer --report-features || true
./mysql-test-run.pl --comment=ps --ps-protocol --force --skip-ndbcluster --timer || true
./mysql-test-run.pl --comment=normal+rowrepl --mysqld=--binlog-format=row --force --skip-ndbcluster --timer || true
@@ -705,6 +717,10 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
+* Wed Jan 31 2007 Daniel Fischer <df@mysql.com>
+
+- add MTR_BUILD_THREAD=auto to test runs.
+
* Fri Jan 05 2007 Kent Boortz <kent@mysql.com>
- Put back "libmygcc.a", found no real reason it was removed.