summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/charset.c3
-rw-r--r--mysys/default.c14
-rw-r--r--mysys/my_delete.c41
-rw-r--r--mysys/my_static.c28
-rw-r--r--mysys/my_winthread.c6
-rw-r--r--mysys/mysys_priv.h48
6 files changed, 120 insertions, 20 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 280b2ad6091..e216f665092 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -255,6 +255,9 @@ static int add_collation(CHARSET_INFO *cs)
{
#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
+ newcs->ctype= my_charset_utf8_unicode_ci.ctype;
+ if (init_state_maps(newcs))
+ return MY_XML_ERROR;
#endif
}
else
diff --git a/mysys/default.c b/mysys/default.c
index 6468cf2b35d..f7c18ed83eb 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -503,9 +503,13 @@ int my_load_defaults(const char *conf_file, const char **groups,
ctx.args= &args;
ctx.group= &group;
- error= my_search_option_files(conf_file, argc, argv, &args_used,
- handle_default_option, (void *) &ctx,
- dirs);
+ if ((error= my_search_option_files(conf_file, argc, argv, &args_used,
+ handle_default_option, (void *) &ctx,
+ dirs)))
+ {
+ free_root(&alloc,MYF(0));
+ DBUG_RETURN(error);
+ }
/*
Here error contains <> 0 only if we have a fully specified conf_file
or a forced default file
@@ -557,10 +561,10 @@ int my_load_defaults(const char *conf_file, const char **groups,
exit(0);
}
- if (error == 0 && default_directories)
+ if (default_directories)
*default_directories= dirs;
- DBUG_RETURN(error);
+ DBUG_RETURN(0);
err:
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index 3ab6ba399f9..edee1c4e875 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -37,7 +37,7 @@ int my_delete(const char *name, myf MyFlags)
} /* my_delete */
#if defined(__WIN__)
-/*
+/**
Delete file which is possibly not closed.
This function is intended to be used exclusively as a temporal solution
@@ -53,6 +53,20 @@ int my_delete(const char *name, myf MyFlags)
renamed to <name>.<num>.deleted where <name> - the initial name of the
file, <num> - a hexadecimal number chosen to make the temporal name to
be unique.
+
+ @param the name of the being deleted file
+ @param the flags instructing how to react on an error internally in
+ the function
+
+ @note The per-thread @c my_errno holds additional info for a caller to
+ decide how critical the error can be.
+
+ @retval
+ 0 ok
+ @retval
+ 1 error
+
+
*/
int nt_share_delete(const char *name, myf MyFlags)
{
@@ -63,6 +77,7 @@ int nt_share_delete(const char *name, myf MyFlags)
for (cnt= GetTickCount(); cnt; cnt--)
{
+ errno= 0;
sprintf(buf, "%s.%08X.deleted", name, cnt);
if (MoveFile(name, buf))
break;
@@ -78,15 +93,23 @@ int nt_share_delete(const char *name, myf MyFlags)
name, buf, errno));
break;
}
-
- if (DeleteFile(buf))
- DBUG_RETURN(0);
-
- my_errno= GetLastError();
+
+ if (errno == ERROR_FILE_NOT_FOUND)
+ {
+ my_errno= ENOENT; // marking, that `name' doesn't exist
+ }
+ else if (errno == 0)
+ {
+ if (DeleteFile(buf))
+ DBUG_RETURN(0);
+ else if ((my_errno= GetLastError()) == 0)
+ my_errno= ENOENT; // marking, that `buf' doesn't exist
+ } else
+ my_errno= errno;
+
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
- name, my_errno);
-
+ my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
+ name, my_errno);
DBUG_RETURN(-1);
}
#endif
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 62e6d402315..fb62e92dfd1 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -111,3 +111,31 @@ my_bool NEAR my_disable_async_io=0;
my_bool NEAR my_disable_flush_key_blocks=0;
my_bool NEAR my_disable_symlinks=0;
my_bool NEAR mysys_uses_curses=0;
+
+/*
+ Note that PSI_hook and PSI_server are unconditionally
+ (no ifdef HAVE_PSI_INTERFACE) defined.
+ This is to ensure binary compatibility between the server and plugins,
+ in the case when:
+ - the server is not compiled with HAVE_PSI_INTERFACE
+ - a plugin is compiled with HAVE_PSI_INTERFACE
+ See the doxygen documentation for the performance schema.
+*/
+
+/**
+ Hook for the instrumentation interface.
+ Code implementing the instrumentation interface should register here.
+*/
+struct PSI_bootstrap *PSI_hook= NULL;
+
+/**
+ Instance of the instrumentation interface for the MySQL server.
+ @todo This is currently a global variable, which is handy when
+ compiling instrumented code that is bundled with the server.
+ When dynamic plugin are truly supported, this variable will need
+ to be replaced by a macro, so that each XYZ plugin can have it's own
+ xyz_psi_server variable, obtained from PSI_bootstrap::get_interface()
+ with the version used at compile time for plugin XYZ.
+*/
+PSI *PSI_server= NULL;
+
diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c
index 9e8458b0799..f3d643975b3 100644
--- a/mysys/my_winthread.c
+++ b/mysys/my_winthread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000 MySQL AB, 2008-2009 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
@@ -63,8 +63,8 @@ static unsigned int __stdcall pthread_start(void *p)
}
-int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
- pthread_handler func, void *param)
+int pthread_create(pthread_t *thread_id, const pthread_attr_t *attr,
+ pthread_handler func, void *param)
{
uintptr_t handle;
struct thread_start_parameter *par;
diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h
index 4c4d6ea3598..5c5bd6c2908 100644
--- a/mysys/mysys_priv.h
+++ b/mysys/mysys_priv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000 MySQL AB, 2008-2009 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
@@ -26,12 +26,54 @@
#ifdef THREAD
#include <my_pthread.h>
+
+#ifdef HAVE_PSI_INTERFACE
+
+#if !defined(HAVE_PREAD) && !defined(_WIN32)
+extern PSI_mutex_key key_my_file_info_mutex;
+#endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */
+
+#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
+extern PSI_mutex_key key_LOCK_localtime_r;
+#endif /* !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) */
+
+#ifndef HAVE_GETHOSTBYNAME_R
+extern PSI_mutex_key key_LOCK_gethostbyname_r;
+#endif /* HAVE_GETHOSTBYNAME_R */
+
+extern PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
+ key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
+ key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
+ key_THR_LOCK_isam, key_THR_LOCK_lock, key_THR_LOCK_malloc,
+ key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
+ key_THR_LOCK_open, key_THR_LOCK_threads, key_THR_LOCK_time,
+ key_TMPDIR_mutex;
+
+extern PSI_cond_key key_COND_alarm, key_IO_CACHE_SHARE_cond,
+ key_IO_CACHE_SHARE_cond_writer, key_my_thread_var_suspend,
+ key_THR_COND_threads;
+
+#ifdef USE_ALARM_THREAD
+extern PSI_thread_key key_thread_alarm;
+#endif /* USE_ALARM_THREAD */
+
+#endif /* HAVE_PSI_INTERFACE */
+
extern pthread_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
extern pthread_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
extern pthread_mutex_t THR_LOCK_charset, THR_LOCK_time;
-#else
+#else /* THREAD */
#include <my_no_pthread.h>
-#endif
+#endif /* THREAD */
+
+#include <mysql/psi/mysql_file.h>
+
+#ifdef HAVE_PSI_INTERFACE
+#ifdef HUGETLB_USE_PROC_MEMINFO
+extern PSI_file_key key_file_proc_meminfo;
+#endif /* HUGETLB_USE_PROC_MEMINFO */
+extern PSI_file_key key_file_charset, key_file_cnf;
+#endif /* HAVE_PSI_INTERFACE */
/*
EDQUOT is used only in 3 C files only in mysys/. If it does not exist on