summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi16
-rw-r--r--include/my_pthread.h1
-rw-r--r--mysys/my_thr_init.c15
-rw-r--r--mysys/my_winthread.c8
-rw-r--r--mysys/thr_mutex.c5
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_table.cc2
-rw-r--r--support-files/Makefile.am3
-rw-r--r--support-files/magic14
9 files changed, 46 insertions, 21 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 0c7e83a78e9..722cf0356c0 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -1385,14 +1385,14 @@ and PHP's @strong{MySQL}-related functions
@item Price @tab $34.95
@end multitable
-This book teaches you how to use @strong{MySQL} and @code{mSQL}, two popular and
-robust database products that support key subsets of SQL on both Linux
-and UNIX systems. Anyone who knows basic C, Java, Perl, or Python can
-write a program to interact with a database, either as a stand-alone
-application or through a Web page. This book takes you through the
-whole process, from installation and configuration to programming
-interfaces and basic administration. Includes ample tutorial
-material.
+This book teaches you how to use @strong{MySQL} and @code{mSQL}, two
+popular and robust database products that support key subsets of SQL on
+both Linux and UNIX systems. Anyone who knows basic C, Java, Perl, or
+Python can write a program to interact with a database, either as a
+stand-alone application or through a Web page. This book takes you
+through the whole process, from installation and configuration to
+programming interfaces and basic administration. Includes ample
+tutorial material.
@multitable @columnfractions .3 .7
@item Title @tab @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0672319144,Sams Teach Yourself MySQL in 21 Days}
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d5f3fa735b2..71ad5e42bf2 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -85,6 +85,7 @@ void pthread_exit(unsigned A); /* was #define pthread_exit(A) ExitThread(A)*/
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE
#ifdef USE_TLS /* For LIBMYSQL.DLL */
+#undef SAFE_MUTEX /* This will cause conflicts */
#define pthread_key(T,V) DWORD V
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
#define pthread_getspecific(A) (TlsGetValue(A))
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index d879da8e65d..6b75444f3fc 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -77,10 +77,19 @@ void my_thread_global_end(void)
static long thread_id=0;
+/*
+ We can't use mutex_locks here if we re using windows as
+ we may have compiled the program with SAFE_MUTEX, in which
+ case the checking of mutex_locks will not work until
+ the pthread_self thread specific variable is initialized.
+*/
+
my_bool my_thread_init(void)
{
struct st_my_thread_var *tmp;
+#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_lock(&THR_LOCK_lock);
+#endif
#if !defined(__WIN__) || defined(USE_TLS)
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
{
@@ -98,9 +107,11 @@ my_bool my_thread_init(void)
pthread_setspecific(THR_KEY_mysys,tmp);
#else
- if (THR_KEY_mysys.id) /* Allready initialized */
+ if (THR_KEY_mysys.id) /* Already initialized */
{
+#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
+#endif
return 0;
}
tmp= &THR_KEY_mysys;
@@ -108,7 +119,9 @@ my_bool my_thread_init(void)
tmp->id= ++thread_id;
pthread_mutex_init(&tmp->mutex,NULL);
pthread_cond_init(&tmp->suspend, NULL);
+#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
+#endif
return 0;
}
diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c
index 7a1e1365325..e410121af98 100644
--- a/mysys/my_winthread.c
+++ b/mysys/my_winthread.c
@@ -48,13 +48,13 @@ static pthread_handler_decl(pthread_start,param)
{
pthread_handler func=((struct pthread_map *) param)->func;
void *func_param=((struct pthread_map *) param)->param;
- my_thread_init();
- pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beingthread to return */
+ my_thread_init(); /* Will always succeed in windows */
+ pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
win_pthread_self=((struct pthread_map *) param)->pthreadself;
pthread_mutex_unlock(&THR_LOCK_thread);
- free((char*) param);
+ free((char*) param); /* Free param from create */
pthread_exit((*func)(func_param));
- return 0;
+ return 0; /* Safety */
}
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 9d9c3a1ce08..73d1d24d9a4 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -218,9 +218,8 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
pthread_mutex_destroy(&mp->global);
pthread_mutex_destroy(&mp->mutex);
#else
- if (pthread_mutex_destroy(&mp->global) ||
- pthread_mutex_destroy(&mp->mutex))
- error=1;
+ error= (int) (pthread_mutex_destroy(&mp->global) ||
+ pthread_mutex_destroy(&mp->mutex));
#endif
return error;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index cb82c2782da..9cb5644fe7b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1872,9 +1872,6 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
struct sockaddr_in cAddr;
int ip_flags=0,socket_flags=0,flags;
Vio *vio_tmp;
-#ifdef __WIN__
- my_thread_init();
-#endif
DBUG_ENTER("handle_connections_sockets");
LINT_INIT(new_sock);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 27072a501aa..093f305fded 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1024,7 +1024,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
strmov(new_name_buff,new_name);
fn_same(new_name_buff,table_name,3);
#ifdef FN_LOWER_CASE
- if (!strcasecmp(new_name_buff,table_name)) // Check if name changed
+ if (!my_strcasecmp(new_name_buff,table_name))// Check if name changed
#else
if (!strcmp(new_name_buff,table_name)) // Check if name changed
#endif
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index 923bd7f2f20..a9d5aac7f9e 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -24,7 +24,8 @@ EXTRA_DIST = mysql.spec.sh \
my-huge.cnf.sh \
mysql-log-rotate.sh \
mysql.server.sh \
- binary-configure.sh
+ binary-configure.sh \
+ magic
pkgdata_DATA = my-small.cnf \
my-medium.cnf \
diff --git a/support-files/magic b/support-files/magic
new file mode 100644
index 00000000000..e209599ccf8
--- /dev/null
+++ b/support-files/magic
@@ -0,0 +1,14 @@
+#
+# Add the following to the end of your /etc/magic file to get the 'file'
+# command to recognize some MySQL files.
+#
+0 beshort 0xfe01 MySQL table definition file
+>2 byte x Version %d
+0 belong&0xffffff00 0xfefe0300 MySQL MISAM index file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0700 MySQL MISAM compressed data file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0500 MySQL ISAM index file
+>3 byte x Version %d
+0 belong&0xffffff00 0xfefe0600 MySQL ISAM compressed data file
+>3 byte x Version %d