summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
committerGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
commit704b4845aa9ce51a6c5a9f5f42265e376db0dfb3 (patch)
tree73476f970c229f75846855edeeddfbc6fd87ed4b /mysys
parent2637dda66845868fe996e60e54996acf03f6c537 (diff)
parenta5e5b0180a6b86cce258eef232ef59d6e7c40bb0 (diff)
downloadmariadb-git-704b4845aa9ce51a6c5a9f5f42265e376db0dfb3.tar.gz
merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather copied mtr from 6.0-main here (at least this one knows how to run Maria tests). I also fixed suite/maria tests to be accepted by the new mtr. mysys/thr_mutex.c: adding DBUG_PRINT here, so that we can locate where the warning is issued.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/charset.c4
-rw-r--r--mysys/hash.c2
-rw-r--r--mysys/my_getopt.c14
-rw-r--r--mysys/my_init.c149
-rw-r--r--mysys/thr_mutex.c8
5 files changed, 96 insertions, 81 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 9bd8de4316a..8f47b4027ef 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -212,6 +212,8 @@ copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from)
to->max_sort_char= from->max_sort_char;
to->mbminlen= from->mbminlen;
to->mbmaxlen= from->mbmaxlen;
+ to->state|= MY_CS_AVAILABLE | MY_CS_LOADED |
+ MY_CS_STRNXFRM | MY_CS_UNICODE;
}
@@ -246,14 +248,12 @@ static int add_collation(CHARSET_INFO *cs)
{
#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci);
- newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else if (!strcmp(cs->csname, "utf8"))
{
#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
- newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else
diff --git a/mysys/hash.c b/mysys/hash.c
index ba606e835a8..63aad7d30ed 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
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
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 464b1d2e3cc..e579d8154db 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -974,24 +974,26 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
*((my_bool*) variable)= (my_bool) value;
break;
case GET_INT:
- *((int*) variable)= (int) value;
+ *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
break;
- case GET_UINT: /* Fall through */
case GET_ENUM:
*((uint*) variable)= (uint) value;
break;
+ case GET_UINT:
+ *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
+ break;
case GET_LONG:
- *((long*) variable)= (long) value;
+ *((long*) variable)= (long) getopt_ll_limit_value((long) value, option, NULL);
break;
case GET_ULONG:
- *((ulong*) variable)= (ulong) value;
+ *((ulong*) variable)= (ulong) getopt_ull_limit_value((ulong) value, option, NULL);
break;
case GET_LL:
- *((longlong*) variable)= (longlong) value;
+ *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL);
break;
case GET_ULL: /* Fall through */
case GET_SET:
- *((ulonglong*) variable)= (ulonglong) value;
+ *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL);
break;
case GET_DOUBLE:
*((double*) variable)= (double) value;
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 0c607af5d58..2401671687b 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -30,7 +30,6 @@
#endif
my_bool have_tcpip=0;
static void my_win_init(void);
-static my_bool win32_have_tcpip(void);
static my_bool win32_init_tcp_ip();
#else
#define my_win_init()
@@ -82,8 +81,12 @@ my_bool my_init(void)
if (my_progname)
my_progname_short= my_progname + dirname_length(my_progname);
-#if defined(THREAD) && defined(SAFE_MUTEX)
+#if defined(THREAD)
+ if (my_thread_global_init())
+ return 1;
+# if defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
+# endif
#endif
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
fastmutex_global_init(); /* Must be called early */
@@ -93,8 +96,6 @@ my_bool my_init(void)
#if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */
#endif
- if (my_thread_global_init())
- return 1;
#if !defined( __WIN__) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
@@ -253,29 +254,6 @@ void my_debug_put_break_here(void)
#ifdef __WIN__
-/*
- This code is specially for running MySQL, but it should work in
- other cases too.
-
- Inizializzazione delle variabili d'ambiente per Win a 32 bit.
-
- Vengono inserite nelle variabili d'ambiente (utilizzando cosi'
- le funzioni getenv e putenv) i valori presenti nelle chiavi
- del file di registro:
-
- HKEY_LOCAL_MACHINE\software\MySQL
-
- Se la kiave non esiste nonn inserisce nessun valore
-*/
-
-/* Crea la stringa d'ambiente */
-
-void setEnvString(char *ret, const char *name, const char *value)
-{
- DBUG_ENTER("setEnvString");
- strxmov(ret, name,"=",value,NullS);
- DBUG_VOID_RETURN ;
-}
/*
my_parameter_handler
@@ -325,17 +303,6 @@ int handle_rtc_failure(int err_type, const char *file, int line,
static void my_win_init(void)
{
- HKEY hSoftMysql ;
- DWORD dimName = 256 ;
- DWORD dimData = 1024 ;
- DWORD dimNameValueBuffer = 256 ;
- DWORD dimDataValueBuffer = 1024 ;
- DWORD indexValue = 0 ;
- long retCodeEnumValue ;
- char NameValueBuffer[256] ;
- char DataValueBuffer[1024] ;
- char EnvString[1271] ;
- const char *targetKey = "Software\\MySQL" ;
DBUG_ENTER("my_win_init");
#if defined(_MSC_VER)
@@ -361,6 +328,30 @@ static void my_win_init(void)
_tzset();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/* The following is used by time functions */
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
#define MS 10000000
@@ -385,43 +376,57 @@ static void my_win_init(void)
}
}
- /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0,
- KEY_READ,&hSoftMysql) != ERROR_SUCCESS)
- DBUG_VOID_RETURN;
-
- /*
- ** Ne legge i valori e li inserisce nell'ambiente
- ** suppone che tutti i valori letti siano di tipo stringa + '\0'
- ** Legge il valore con indice 0 e lo scarta
- */
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- (LPTSTR)NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
-
- while (retCodeEnumValue != ERROR_NO_MORE_ITEMS)
{
- char *my_env;
- /* Crea la stringa d'ambiente */
- setEnvString(EnvString, NameValueBuffer, DataValueBuffer) ;
-
- /* Inserisce i dati come variabili d'ambiente */
- my_env=strdup(EnvString); /* variable for putenv must be allocated ! */
- putenv(my_env) ;
-
- dimNameValueBuffer = dimName ;
- dimDataValueBuffer = dimData ;
+ /*
+ Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found
+ there as environment variables
+ */
+ HKEY key_handle;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL",
+ 0, KEY_READ, &key_handle) == ERROR_SUCCESS)
+ {
+ LONG ret;
+ DWORD index= 0;
+ DWORD type;
+ char key_name[256], key_data[1024];
+ DWORD key_name_len= sizeof(key_name) - 1;
+ DWORD key_data_len= sizeof(key_data) - 1;
+
+ while ((ret= RegEnumValue(key_handle, index++,
+ key_name, &key_name_len,
+ NULL, &type, (LPBYTE)&key_data,
+ &key_data_len)) != ERROR_NO_MORE_ITEMS)
+ {
+ char env_string[sizeof(key_name) + sizeof(key_data) + 2];
+
+ if (ret == ERROR_MORE_DATA)
+ {
+ /* Registry value larger than 'key_data', skip it */
+ DBUG_PRINT("error", ("Skipped registry value that was too large"));
+ }
+ else if (ret == ERROR_SUCCESS)
+ {
+ if (type == REG_SZ)
+ {
+ strxmov(env_string, key_name, "=", key_data, NullS);
+
+ /* variable for putenv must be allocated ! */
+ putenv(strdup(env_string)) ;
+ }
+ }
+ else
+ {
+ /* Unhandled error, break out of loop */
+ break;
+ }
+
+ key_name_len= sizeof(key_name) - 1;
+ key_data_len= sizeof(key_data) - 1;
+ }
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
+ RegCloseKey(key_handle) ;
+ }
}
-
- /* chiude la chiave */
- RegCloseKey(hSoftMysql) ;
-
DBUG_VOID_RETURN ;
}
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 4f19f5d79c4..2fdf3d25a5c 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -745,15 +745,23 @@ static void print_deadlock_warning(safe_mutex_t *new_mutex,
fprintf(stderr, "safe_mutex: Found wrong usage of mutex "
"'%s' and '%s'\n",
parent_mutex->name, new_mutex->name);
+ DBUG_PRINT("info", ("safe_mutex: Found wrong usage of mutex "
+ "'%s' and '%s'",
+ parent_mutex->name, new_mutex->name));
fprintf(stderr, "Mutex currently locked (in reverse order):\n");
+ DBUG_PRINT("info", ("Mutex currently locked (in reverse order):"));
fprintf(stderr, "%-32.32s %s line %u\n", new_mutex->name, new_mutex->file,
new_mutex->line);
+ DBUG_PRINT("info", ("%-32.32s %s line %u\n", new_mutex->name,
+ new_mutex->file, new_mutex->line));
for (mutex_root= *my_thread_var_mutex_in_use() ;
mutex_root;
mutex_root= mutex_root->next)
{
fprintf(stderr, "%-32.32s %s line %u\n", mutex_root->name,
mutex_root->file, mutex_root->line);
+ DBUG_PRINT("info", ("%-32.32s %s line %u", mutex_root->name,
+ mutex_root->file, mutex_root->line));
}
fflush(stderr);
DBUG_VOID_RETURN;