From b4fbb06ad88dee766d50323adaf5964fc01a8474 Mon Sep 17 00:00:00 2001
From: "monty@narttu.mysql.fi" <>
Date: Tue, 25 Feb 2003 21:43:24 +0200
Subject: [PATCH] Portability fix for HPUX10.20

---
 BUILD/compile-pentium-debug-max |  2 +-
 include/my_pthread.h            |  5 +++++
 mysys/my_pthread.c              | 12 +++++++++++-
 sql/mysqld.cc                   | 12 +++++-------
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max
index 1684686ce8..f71b849384 100755
--- a/BUILD/compile-pentium-debug-max
+++ b/BUILD/compile-pentium-debug-max
@@ -3,7 +3,7 @@
 path=`dirname $0`
 . "$path/SETUP.sh"
 
-extra_flags="$pentium_cflags $debug_cflags"
+extra_flags="$pentium_cflags $debug_cflags -DBIG_TABLES"
 c_warnings="$c_warnings $debug_extra_warnings"
 cxx_warnings="$cxx_warnings $debug_extra_warnings"
 extra_configs="$pentium_configs $debug_configs"
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 574198a064..a7fa38349d 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -443,6 +443,11 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 			      struct timespec *abstime);
 #endif
 
+#if defined(HPUX10)
+#define pthread_attr_getstacksize(A,B) my_pthread_attr_getstacksize(A,B)
+void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
+#endif
+
 #if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
 #undef pthread_mutex_trylock
 #define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 0de7041fae..7ad4852558 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000-2003 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
@@ -393,6 +393,7 @@ int pthread_signal(int sig, void (*func)())
 #undef pthread_cond_wait
 #undef pthread_cond_timedwait
 #undef pthread_cond_t
+#undef pthread_attr_getstacksize
 
 /*****************************************************************************
 ** Patches for AIX and DEC OSF/1 3.2
@@ -465,6 +466,15 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 }
 #endif
 
+#if defined(HPUX10)
+
+void my_pthread_attr_getstacksize(pthread_attr_t *connection_attrib,
+				  size_t *stack_size)
+{
+  *stack_size= pthread_attr_getstacksize(*connection_attrib);
+}
+#endif
+
 
 #ifdef HAVE_POSIX1003_4a_MUTEX
 /*
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 324355e6f1..72d3295dad 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -264,6 +264,9 @@ bool opt_large_files= sizeof(my_off_t) > 4;
 #define GET_HA_ROWS GET_ULONG
 #endif
 
+#ifdef HAVE_LIBWRAP
+char *libwrapName= NULL;
+#endif
 
 /*
   Variables to store startup options
@@ -1855,14 +1858,13 @@ struct utsname
   char nodename[FN_REFLEN];
 };
 
+
 int uname(struct utsname *a)
 {
   return -1;
 }
-#endif
 
 
-#ifdef __WIN__
 extern "C" pthread_handler_decl(handle_shutdown,arg)
 {
   MSG msg;
@@ -1878,7 +1880,7 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
   return 0;
 }
 
-int __stdcall handle_kill(ulong ctrl_type)
+int STDCALL handle_kill(ulong ctrl_type)
 {
   if (ctrl_type == CTRL_CLOSE_EVENT ||
       ctrl_type == CTRL_SHUTDOWN_EVENT)
@@ -1919,10 +1921,6 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
 
 const char *load_default_groups[]= { "mysqld","server",0 };
 
-#ifdef HAVE_LIBWRAP
-char *libwrapName=NULL;
-#endif
-
 bool open_log(MYSQL_LOG *log, const char *hostname,
 	      const char *opt_name, const char *extension,
 	      const char *index_file_name,
-- 
2.30.9