MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jani Date:January 22 2007 1:34am
Subject:bk commit into 4.1 tree (jani:1.2607)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-22 03:33:59+02:00, jani@stripped +14 -0
  Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-4.0
  into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-4.1
  MERGE: 1.1346.890.1

  BUILD/SETUP.sh@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -2
    Merged from 4.0
    MERGE: 1.17.3.2

  BUILD/SETUP.sh@stripped, 2007-01-22 03:24:13+02:00, jani@stripped +0 -0
    Change mode to -rwxrwxr-x

  BUILD/SETUP.sh.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +19 -0
    Merged from 4.0
    

  BUILD/SETUP.sh.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

  configure.in@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +6 -58
    Merged from 4.0
    MERGE: 1.191.1.150

  configure.in.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +299 -0
    Merged from 4.0
    

  configure.in.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

  include/my_global.h@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -1
    Merged from 4.0
    MERGE: 1.34.1.42

  include/my_global.h.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +17 -0
    Merged from 4.0
    

  include/my_global.h.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

  include/my_pthread.h@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -23
    Merged from 4.0
    MERGE: 1.57.1.10

  include/my_pthread.h.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +80 -0
    Merged from 4.0
    

  include/my_pthread.h.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

  include/thr_alarm.h@stripped, 2007-01-22 03:24:13+02:00, jani@stripped +0 -0
    Auto merged
    MERGE: 1.13.1.4

  mysys/my_pthread.c@stripped, 2007-01-22 03:24:13+02:00, jani@stripped +0 -0
    Auto merged
    MERGE: 1.35.1.5

  mysys/thr_alarm.c@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +7 -11
    Merged from 4.0
    MERGE: 1.41.1.1

  mysys/thr_alarm.c.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +220 -0
    Merged from 4.0
    

  mysys/thr_alarm.c.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

  sql/mysqld.cc@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +5 -8
    Merged from 4.0
    MERGE: 1.297.51.9

  sql/mysqld.cc.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +161 -0
    Merged from 4.0
    

  sql/mysqld.cc.rej@stripped, 2007-01-22 03:33:57+02:00, jani@stripped +0 -0

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jani
# Host:	a88-113-38-195.elisa-laajakaista.fi
# Root:	/home/my/bk/mysql-4.1/RESYNC

--- 1.82/include/my_pthread.h	2006-05-19 14:07:20 +03:00
+++ 1.83/include/my_pthread.h	2007-01-22 03:33:57 +02:00
@@ -28,6 +28,14 @@
 extern "C" {
 #endif /* __cplusplus */ 
 
+/* Thread library */
+
+#define THD_LIB_OTHER 1
+#define THD_LIB_NPTL  2
+#define THD_LIB_LT    4
+
+extern uint thd_lib_detected;
+
 #if defined(__WIN__) || defined(OS2)
 
 #ifdef OS2

--- 1.17/include/thr_alarm.h	2004-05-25 22:26:06 +03:00
+++ 1.18/include/thr_alarm.h	2007-01-22 03:24:13 +02:00
@@ -25,11 +25,6 @@
 #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

--- 1.43/mysys/my_pthread.c	2005-10-11 19:12:09 +03:00
+++ 1.44/mysys/my_pthread.c	2007-01-22 03:24:13 +02:00
@@ -30,6 +30,8 @@
 #define SCHED_POLICY SCHED_OTHER
 #endif
 
+uint thd_lib_detected;
+
 #ifndef my_pthread_setprio
 void my_pthread_setprio(pthread_t thread_id,int prior)
 {
@@ -336,7 +338,7 @@
       sigaction(i, &sact, (struct sigaction*) 0);
     }
   }
-  sigaddset(set,THR_CLIENT_ALARM);
+  sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1);
   pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
   alarm_thread=pthread_self();			/* For thr_alarm */
 

--- 1.46/mysys/thr_alarm.c	2005-10-11 19:12:09 +03:00
+++ 1.47/mysys/thr_alarm.c	2007-01-22 03:33:57 +02:00
@@ -58,9 +58,7 @@
 #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)
@@ -79,9 +77,13 @@
   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);
+#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();
@@ -99,10 +101,12 @@
   }
 #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(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);
@@ -153,7 +157,7 @@
 
   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"));
@@ -273,18 +277,18 @@
   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\n"); fflush(stdout);
+    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(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
+              process_alarm);	/* int. thread system calls */
 #endif
     return;
   }
-#endif
 
   /*
     We have to do do the handling of the alarm in a sub function,
@@ -328,7 +332,8 @@
 	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,
+			 thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1))
 	{
 #ifdef MAIN
 	  printf("Warning: pthread_kill couldn't find thread!!!\n");
@@ -352,7 +357,8 @@
 	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,
+			 thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1))
 	{
 #ifdef MAIN
 	  printf("Warning: pthread_kill couldn't find thread!!!\n");
@@ -429,16 +435,13 @@
 	if (error == ETIME || error == ETIMEDOUT)
 	  break;				/* Don't wait forever */
       }
-      if (!alarm_queue.elements)
+      delete_queue(&alarm_queue);
+      alarm_aborted= 1;
+      pthread_mutex_unlock(&LOCK_alarm);
+      if (!alarm_thread_running)		/* Safety */
       {
-	delete_queue(&alarm_queue);
-	alarm_aborted= 1;
-	pthread_mutex_unlock(&LOCK_alarm);
-	if (!alarm_thread_running)		/* Safety */
-	{
-	  pthread_mutex_destroy(&LOCK_alarm);
-	  pthread_cond_destroy(&COND_alarm);
-	}
+        pthread_mutex_destroy(&LOCK_alarm);
+        pthread_cond_destroy(&COND_alarm);
       }
     }
     else
@@ -495,7 +498,7 @@
   ARGSUSED
 */
 
-#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
+
 static sig_handler thread_alarm(int sig)
 {
 #ifdef MAIN
@@ -505,7 +508,6 @@
   my_sigset(sig,thread_alarm);		/* int. thread system calls */
 #endif
 }
-#endif
 
 
 #ifdef HAVE_TIMESPEC_TS_SEC
@@ -933,9 +935,7 @@
   sigaddset(&set,SIGINT);
   sigaddset(&set,SIGQUIT);
   sigaddset(&set,SIGTERM);
-#if THR_CLIENT_ALARM != SIGHUP
   sigaddset(&set,SIGHUP);
-#endif
 #ifdef SIGTSTP
   sigaddset(&set,SIGTSTP);
 #endif
@@ -947,7 +947,7 @@
 #endif
 #endif /* OS2 */
   printf("server alarm: %d  thread alarm: %d\n",
-	 THR_SERVER_ALARM,THR_CLIENT_ALARM);
+	 THR_SERVER_ALARM, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1);
   DBUG_PRINT("info",("Starting signal and alarm handling thread"));
   for(;;)
   {
@@ -1019,11 +1019,11 @@
   sigaddset(&set,SIGTSTP);
 #endif
   sigaddset(&set,THR_SERVER_ALARM);
-  sigdelset(&set,THR_CLIENT_ALARM);
+  sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1);
   (void) pthread_sigmask(SIG_SETMASK,&set,NULL);
 #ifdef NOT_USED
   sigemptyset(&set);
-  sigaddset(&set,THR_CLIENT_ALARM);
+  sigaddset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1);
   VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0));
 #endif
 #endif /* OS2 */
@@ -1073,8 +1073,8 @@
     }
   }
   pthread_mutex_unlock(&LOCK_thread_count);
-  end_thr_alarm(1);
   thr_alarm_info(&alarm_info);
+  end_thr_alarm(1);
   printf("Main_thread:  Alarms: %u  max_alarms: %u  next_alarm_time: %lu\n",
 	 alarm_info.active_alarms, alarm_info.max_used_alarms,
 	 alarm_info.next_alarm_time);

--- 1.622/sql/mysqld.cc	2007-01-10 10:57:02 +02:00
+++ 1.623/sql/mysqld.cc	2007-01-22 03:33:57 +02:00
@@ -210,12 +210,6 @@
 
 } /* 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
@@ -587,6 +581,7 @@
 static void wait_for_signal_thread_to_end(void);
 static int test_if_case_insensitive(const char *dir_name);
 static void create_pid_file();
+static uint get_thread_lib(void);
 
 #ifndef EMBEDDED_LIBRARY
 /****************************************************************************
@@ -626,7 +621,8 @@
     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,
+                     thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1))
       break;					// allready dead
 #endif
     set_timespec(abstime, 2);
@@ -2049,7 +2045,10 @@
   DBUG_ENTER("init_signals");
 
   if (test_flags & TEST_SIGINT)
-    my_sigset(THR_KILL_SIGNAL,end_thread_signal);
+  {
+    my_sigset(thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2,
+              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))
@@ -2106,8 +2105,12 @@
 #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, thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2);
+  }
+  // For alarms
+  sigdelset(&set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1);
   sigprocmask(SIG_SETMASK,&set,NULL);
   pthread_sigmask(SIG_SETMASK,&set,NULL);
   DBUG_VOID_RETURN;
@@ -2163,24 +2166,20 @@
   */
   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);
 
@@ -3148,6 +3147,7 @@
   }
 #endif
 
+  thd_lib_detected= get_thread_lib();
   if (init_common_variables(MYSQL_CONFIG_NAME,
 			    argc, argv, load_default_groups))
     unireg_abort(1);				// Will do exit
@@ -7021,6 +7021,22 @@
   }
   sql_perror("Can't start server: can't create PID file");
   exit(1);  
+}
+
+
+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;
+  else if (!strncasecmp(buff, "linuxthreads", 12))
+    return THD_LIB_LT;
+#endif
+  return THD_LIB_OTHER;
 }
 
 
--- New file ---
+++ BUILD/SETUP.sh.rej	07/01/22 03:33:57
***************
*** 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

--- New file ---
+++ configure.in.rej	07/01/22 03:33:57
***************
*** 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]

--- New file ---
+++ include/my_global.h.rej	07/01/22 03:33:57
***************
*** 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

--- New file ---
+++ include/my_pthread.h.rej	07/01/22 03:33:57
***************
*** 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)

--- New file ---
+++ mysys/thr_alarm.c.rej	07/01/22 03:33:57
***************
*** 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)

--- New file ---
+++ sql/mysqld.cc.rej	07/01/22 03:33:57
***************
*** 177,188 ****
  } /* cplusplus */
  
  
- #if defined(HAVE_LINUXTHREADS)
- #define THR_KILL_SIGNAL SIGINT
- #else
- #define THR_KILL_SIGNAL SIGUSR2		// Can't use this with LinuxThreads
- #endif
- 
  #ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
  #include <sys/types.h>
  #else
--- 177,182 ----
  } /* cplusplus */
  
  
  #ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
  #include <sys/types.h>
  #else
***************
*** 505,510 ****
  static void clean_up_mutexes(void);
  static int test_if_case_insensitive(const char *dir_name);
  static void create_pid_file();
  
  /****************************************************************************
  ** Code to end mysqld
--- 499,505 ----
  static void clean_up_mutexes(void);
  static int test_if_case_insensitive(const char *dir_name);
  static void create_pid_file();
+ static uint get_thread_lib(void);
  
  /****************************************************************************
  ** Code to end mysqld
***************
*** 544,550 ****
      DBUG_PRINT("info",("Waiting for select_thread"));
  
  #ifndef DONT_USE_THR_ALARM
!     if (pthread_kill(select_thread,THR_CLIENT_ALARM))
        break;					// allready dead
  #endif
      set_timespec(abstime, 2);
--- 539,546 ----
      DBUG_PRINT("info",("Waiting for select_thread"));
  
  #ifndef DONT_USE_THR_ALARM
!     if (pthread_kill(select_thread,
! 		     thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1))
        break;					// allready dead
  #endif
      set_timespec(abstime, 2);
***************
*** 844,850 ****
  		      sig,my_thread_id());
    }
  #ifdef DONT_REMEMBER_SIGNAL
!   sigset(sig,print_signal_warning);		/* int. thread system calls */
  #endif
  #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
    if (sig == SIGALRM)
--- 840,846 ----
  		      sig,my_thread_id());
    }
  #ifdef DONT_REMEMBER_SIGNAL
!   my_sigset(sig, print_signal_warning);         /* int. thread system calls */
  #endif
  #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
    if (sig == SIGALRM)
***************
*** 1841,1848 ****
    DBUG_ENTER("init_signals");
  
    if (test_flags & TEST_SIGINT)
!     sigset(THR_KILL_SIGNAL,end_thread_signal);
!   sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
  
    if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
    {
--- 1837,1847 ----
    DBUG_ENTER("init_signals");
  
    if (test_flags & TEST_SIGINT)
!   {
!     my_sigset(thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2,
!               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))
    {
***************
*** 1877,1883 ****
  #endif
    (void) sigemptyset(&set);
  #ifdef THREAD_SPECIFIC_SIGPIPE
!   sigset(SIGPIPE,abort_thread);
    sigaddset(&set,SIGPIPE);
  #else
    (void) signal(SIGPIPE,SIG_IGN);		// Can't know which thread
--- 1876,1882 ----
  #endif
    (void) sigemptyset(&set);
  #ifdef THREAD_SPECIFIC_SIGPIPE
!   my_sigset(SIGPIPE, abort_thread);
    sigaddset(&set,SIGPIPE);
  #else
    (void) signal(SIGPIPE,SIG_IGN);		// Can't know which thread
***************
*** 2237,2244 ****
    MY_INIT(argv[0]);		// init my_sys library & pthreads
    tzset();			// Set tzname
  
    start_time=time((time_t*) 0);
- 
  #ifdef OS2
    {
      // fix timezone for daylight saving
--- 2236,2243 ----
    MY_INIT(argv[0]);		// init my_sys library & pthreads
    tzset();			// Set tzname
  
+   thd_lib_detected= get_thread_lib();
    start_time=time((time_t*) 0);
  #ifdef OS2
    {
      // fix timezone for daylight saving
***************
*** 5547,5552 ****
      (void) my_write(file, (byte*) buff, (uint) (end-buff),MYF(MY_WME));
      (void) my_close(file, MYF(0));
    }
  }
  
  
--- 5546,5567 ----
      (void) my_write(file, (byte*) buff, (uint) (end-buff),MYF(MY_WME));
      (void) my_close(file, MYF(0));
    }
+ }
+ 
+ 
+ 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;
+   else if (!strncasecmp(buff, "linuxthreads", 12))
+     return THD_LIB_LT;
+ #endif
+   return THD_LIB_OTHER;
  }
  
  


--- 1.111/include/my_global.h	2007-01-05 00:16:45 +02:00
+++ 1.112/include/my_global.h	2007-01-22 03:33:57 +02:00
@@ -138,7 +138,7 @@
 
 
 /* Fix problem with S_ISLNK() on Linux */
-#if defined(TARGET_OS_LINUX)
+#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
 #undef  _GNU_SOURCE
 #define _GNU_SOURCE 1
 #endif
@@ -415,7 +415,10 @@
 #endif
 
 /* Define some useful general macros */
-#if !defined(max)
+#if defined(__cplusplus) && defined(__GNUC__)
+#define max(a, b)     ((a) >? (b))
+#define min(a, b)     ((a) <? (b))
+#elif !defined(max)
 #define max(a, b)	((a) > (b) ? (a) : (b))
 #define min(a, b)	((a) < (b) ? (a) : (b))
 #endif

--- 1.17.3.1/BUILD/SETUP.sh	2007-01-22 02:32:06 +02:00
+++ 1.40/BUILD/SETUP.sh	2007-01-22 03:33:57 +02:00
@@ -1,27 +1,36 @@
-if ! test -f sql/mysqld.cc
+#!/bin/sh
+
+if test ! -f sql/mysqld.cc
 then
   echo "You must run this script from the MySQL top-level directory"
   exit 1
 fi
 
-nonono=
+prefix_configs="--prefix=/usr/local/mysql"
+just_print=
 just_configure=
+full_debug=
 while test $# -gt 0
 do
   case "$1" in
+  --prefix=* ) prefix_configs="$1"; shift ;;
+  --with-debug=full ) full_debug="=full"; shift ;;
   -c | --just-configure ) just_configure=1; shift ;;
-  -n | --just-print | --print ) nonono=1; shift ;;
+  -n | --just-print | --print ) just_print=1; shift ;;
   -h | --help ) cat <<EOF; exit 0 ;;
 Usage: $0 [-h|-n] [configure-options]
   -h, --help              Show this help message.
   -n, --just-print        Don't actually run any commands; just print them.
   -c, --just-configure    Stop after running configure.
-
-Any other options will be passed directly to configure.
+  --with-debug=full       Build with full debug.
+  --prefix=path           Build with prefix 'path'.
 
 Note:  this script is intended for internal use by MySQL developers.
 EOF
-  * ) break ;;
+  * )
+    echo "Unknown option '$1'"
+    exit 1
+    break ;;
   esac
 done
 
@@ -39,8 +48,19 @@
 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"
+base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio"
+max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server"
+max_no_es_configs="$max_leave_isam_configs --without-isam"
+max_configs="$max_no_es_configs --with-embedded-server"
+
+path=`dirname $0`
+. "$path/check-cpu"
+
+alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
+amd64_cflags="$check_cpu_cflags -DBIG_TABLES"
+pentium_cflags="$check_cpu_cflags"
+pentium64_cflags="$check_cpu_cflags -m64"
+ppc_cflags="$check_cpu_cflags"
 sparc_cflags=""
 
 # be as fast as we can be without losing our ability to backtrace
@@ -48,12 +68,16 @@
 # this is one is for someone who thinks 1% speedup is worth not being
 # able to backtrace
 reckless_cflags="-O3 -fomit-frame-pointer "
-debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized"
+
+debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
+debug_extra_cflags="-O1 -Wuninitialized"
 
 base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
+amd64_cxxflags="-DBIG_TABLES"
 
-base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client"
+base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
 static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
+amd64_configs=""
 alpha_configs=""	# Not used yet
 pentium_configs=""
 sparc_configs=""
@@ -62,7 +86,11 @@
 # and unset local_infile_configs
 local_infile_configs="--enable-local-infile"
 
-debug_configs="--with-debug"
+debug_configs="--with-debug$full_debug"
+if [ -z "$full_debug" ]
+then
+  debug_cflags="$debug_cflags $debug_extra_cflags"
+fi
 
 if gmake --version > /dev/null 2>&1
 then
@@ -81,12 +109,6 @@
 # (returns 0 if finds lines)
 if ccache -V > /dev/null 2>&1
 then
-  if ! (echo "$CC" | grep "ccache" > /dev/null)
-  then
-    CC="ccache $CC"
-  fi
-  if ! (echo "$CXX" | grep "ccache" > /dev/null)
-  then
-    CXX="ccache $CXX"
-  fi
+  echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
+  echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
 fi
Thread
bk commit into 4.1 tree (jani:1.2607)jani22 Jan