summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /include
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt5
-rw-r--r--include/Makefile.am111
-rw-r--r--include/atomic/x86-gcc.h14
-rw-r--r--include/decimal.h22
-rw-r--r--include/heap.h12
-rw-r--r--include/m_ctype.h85
-rw-r--r--include/m_string.h19
-rw-r--r--include/my_base.h20
-rw-r--r--include/my_bit.h22
-rw-r--r--include/my_bitmap.h13
-rw-r--r--include/my_compare.h (renamed from include/my_handler.h)84
-rw-r--r--include/my_compiler.h26
-rw-r--r--include/my_dbug.h39
-rw-r--r--include/my_getopt.h15
-rw-r--r--include/my_global.h77
-rw-r--r--include/my_net.h34
-rw-r--r--include/my_no_pthread.h72
-rw-r--r--include/my_pthread.h206
-rw-r--r--include/my_stacktrace.h2
-rw-r--r--include/my_sys.h57
-rw-r--r--include/my_time.h13
-rw-r--r--include/my_valgrind.h37
-rw-r--r--include/myisam.h13
-rw-r--r--include/myisamchk.h2
-rw-r--r--include/mysql.h11
-rw-r--r--include/mysql.h.pp9
-rw-r--r--include/mysql/client_plugin.h30
-rw-r--r--include/mysql/client_plugin.h.pp8
-rw-r--r--include/mysql/innodb_priv.h1
-rw-r--r--include/mysql/plugin_audit.h59
-rw-r--r--include/mysql/plugin_audit.h.pp44
-rw-r--r--include/mysql/plugin_auth.h47
-rw-r--r--include/mysql/plugin_auth.h.pp53
-rw-r--r--include/mysql/plugin_auth_common.h1
-rw-r--r--include/mysql/plugin_ftparser.h.pp17
-rw-r--r--include/mysql/psi/mysql_file.h2
-rw-r--r--include/mysql/psi/mysql_thread.h88
-rw-r--r--include/mysql/service_thd_wait.h30
-rw-r--r--include/mysql/thread_pool_priv.h121
-rw-r--r--include/mysql_com.h12
-rw-r--r--include/mysql_embed.h2
-rw-r--r--include/mysys_err.h4
-rw-r--r--include/thr_alarm.h2
-rw-r--r--include/typelib.h18
-rw-r--r--include/violite.h10
-rw-r--r--include/welcome_copyright_notice.h30
46 files changed, 830 insertions, 769 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 5334fc0f5ae..d8bac7532cc 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -40,7 +40,6 @@ SET(HEADERS
my_xml.h
mysql_embed.h
my_pthread.h
- my_no_pthread.h
decimal.h
errmsg.h
my_global.h
@@ -59,6 +58,4 @@ SET(HEADERS
)
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
-INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development FILES_MATCHING PATTERN "*.h" )
-
-
+INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR}/mysql COMPONENT Development FILES_MATCHING PATTERN "*.h")
diff --git a/include/Makefile.am b/include/Makefile.am
deleted file mode 100644
index 4282acb0c99..00000000000
--- a/include/Makefile.am
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-pkgpsiincludedir = $(pkgincludedir)/psi
-
-BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h
-HEADERS_GEN_CONFIGURE = mysql_version.h
-HEADERS_GEN_MAKE = my_config.h
-HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
- my_list.h my_alloc.h typelib.h mysql/plugin.h \
- mysql/plugin_audit.h mysql/plugin_ftparser.h
-pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
- my_xml.h mysql_embed.h mysql/services.h \
- mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
- mysql/service_thread_scheduler.h \
- mysql/service_thd_wait.h \
- my_pthread.h my_no_pthread.h \
- mysql/plugin_auth.h mysql/client_plugin.h \
- mysql/plugin_auth_common.h \
- decimal.h errmsg.h my_global.h my_valgrind.h my_net.h \
- my_getopt.h sslopt-longopts.h my_dir.h \
- sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
- m_ctype.h my_attribute.h my_compiler.h \
- $(HEADERS_GEN_CONFIGURE) $(HEADERS_GEN_MAKE) \
- probes_mysql.h probes_mysql_nodtrace.h
-
-noinst_HEADERS = lf.h my_bit.h password.h \
- heap.h maria.h myisamchk.h my_bitmap.h my_uctype.h \
- myisam.h myisampack.h myisammrg.h ft_global.h\
- mysys_err.h my_base.h \
- my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \
- my_aes.h my_tree.h hash.h thr_alarm.h \
- thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
- my_handler.h my_time.h service_versions.h \
- my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.h \
- my_user.h my_atomic.h atomic/nolock.h \
- atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
- atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
- atomic/solaris.h mysql/innodb_priv.h \
- wqueue.h waiting_threads.h
-
-EXTRA_DIST = mysql.h.pp probes_mysql.d.base \
- CMakeLists.txt \
- mysql/plugin_auth.h.pp mysql/client_plugin.h.pp \
- mysql/plugin_audit.h.pp mysql/plugin_ftparser.h.pp \
- mysql/psi/psi_abi_v1.h.pp \
- mysql/psi/psi_abi_v2.h.pp
-
-pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \
- mysql/psi/mysql_file.h
-
-# Remove built files and the symlinked directories
-CLEANFILES = $(BUILT_SOURCES) readline openssl probes_mysql.d probes_mysql_nodtrace.h
-
-
-# Some include files that may be moved and patched by configure
-DISTCLEANFILES = sched.h $(CLEANFILES) $(HEADERS_GEN_CONFIGURE)
-
-link_sources:
- -$(RM) -f readline openssl
- @readline_h_ln_cmd@
- @yassl_h_ln_cmd@
- echo timestamp > link_sources
-
-# We want both "my_config.h" and "config.h" that are identical, as
-# MySQL sources assumes the name "my_config.h", and 3rd party sources
-# assumes the name "config.h".
-# Normally this is generated by configure; This rule is left here in case
-# someone deletes my_config.h and expect it to be generated by make
-my_config.h: config.h
- $(CP) config.h my_config.h
-
-# These files should not be included in distributions since they are
-# generated by configure from the .h.in files
-dist-hook:
- $(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h
-
-probes_mysql.d:
- if ! test -f probes_mysql.d ; then \
- $(CP) -f $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d; \
- fi
-
-DTRACEPROVIDER = probes_mysql.d
-if HAVE_DTRACE
-BUILT_SOURCES += probes_mysql_dtrace.h
-CLEANFILES += $(DTRACEPROVIDER)
-
-# Fake for creating the probes file. If we are building a separate directory
-# then we copy the probes from the source location and use that
-# If we are building in the same directory as the source, we do not copy
-
-probes_mysql_dtrace.h: $(DTRACEPROVIDER)
- $(DTRACE) $(DTRACEFLAGS) -h -s $(DTRACEPROVIDER) -o $@
-endif
-
-probes_mysql_nodtrace.h: $(DTRACEPROVIDER)
- @PERL@ $(top_srcdir)/scripts/dheadgen.pl -f $(DTRACEPROVIDER) > $@
diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h
index 90602ef900c..ea3202aa9c9 100644
--- a/include/atomic/x86-gcc.h
+++ b/include/atomic/x86-gcc.h
@@ -78,15 +78,15 @@
: "memory")
/*
- Actually 32-bit reads/writes are always atomic on x86
- But we add LOCK_prefix here anyway to force memory barriers
+ Actually 32/64-bit reads/writes are always atomic on x86_64,
+ nonetheless issue memory barriers as appropriate.
*/
#define make_atomic_load_body(S) \
- ret=0; \
- asm volatile (LOCK_prefix "; cmpxchg %2, %0" \
- : "=m" (*a), "=a" (ret) \
- : "r" (ret), "m" (*a) \
- : "memory")
+ /* Serialize prior load and store operations. */ \
+ asm volatile ("mfence" ::: "memory"); \
+ ret= *a; \
+ /* Prevent compiler from reordering instructions. */ \
+ asm volatile ("" ::: "memory")
#define make_atomic_store_body(S) \
asm volatile ("; xchg %0, %1;" \
: "=m" (*a), "+r" (v) \
diff --git a/include/decimal.h b/include/decimal.h
index 530ed9e1757..90946f65ac6 100644
--- a/include/decimal.h
+++ b/include/decimal.h
@@ -29,14 +29,14 @@ typedef struct st_decimal_t {
int internal_str2dec(const char *from, decimal_t *to, char **end,
my_bool fixed);
-int decimal2string(decimal_t *from, char *to, int *to_len,
+int decimal2string(const decimal_t *from, char *to, int *to_len,
int fixed_precision, int fixed_decimals,
char filler);
int decimal2ulonglong(decimal_t *from, ulonglong *to);
int ulonglong2decimal(ulonglong from, decimal_t *to);
int decimal2longlong(decimal_t *from, longlong *to);
int longlong2decimal(longlong from, decimal_t *to);
-int decimal2double(decimal_t *from, double *to);
+int decimal2double(const decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
int decimal_actual_fraction(decimal_t *from);
int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
@@ -47,17 +47,17 @@ int decimal_bin_size(int precision, int scale);
int decimal_result_size(decimal_t *from1, decimal_t *from2, char op,
int param);
-int decimal_intg(decimal_t *from);
-int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_cmp(decimal_t *from1, decimal_t *from2);
-int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to,
+int decimal_intg(const decimal_t *from);
+int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_cmp(const decimal_t *from1, const decimal_t *from2);
+int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to,
int scale_incr);
-int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_round(decimal_t *from, decimal_t *to, int new_scale,
+int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_round(const decimal_t *from, decimal_t *to, int new_scale,
decimal_round_mode mode);
-int decimal_is_zero(decimal_t *from);
+int decimal_is_zero(const decimal_t *from);
void max_decimal(int precision, int frac, decimal_t *to);
#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)
diff --git a/include/heap.h b/include/heap.h
index a585371e18f..74851c7b454 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc
+/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
+ reserved
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
@@ -25,12 +26,11 @@ extern "C" {
#ifndef _my_base_h
#include <my_base.h>
#endif
-#ifdef THREAD
+
#include <my_pthread.h>
#include <thr_lock.h>
-#endif
-#include "my_handler.h"
+#include "my_compare.h"
#include "my_tree.h"
/* defines used by heap-funktions */
@@ -146,10 +146,8 @@ typedef struct st_heap_share
uint open_count;
uchar *del_link; /* Link to next block with del. rec */
char * name; /* Name of "memory-file" */
-#ifdef THREAD
THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */
-#endif
my_bool delete_on_close;
LIST open_list;
uint auto_key;
@@ -175,9 +173,7 @@ typedef struct st_heap_info
TREE_ELEMENT **last_pos;
uint lastkey_len;
my_bool implicit_emptied;
-#ifdef THREAD
THR_LOCK_DATA lock;
-#endif
LIST open_list;
} HP_INFO;
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 6332962f000..009db46bcd2 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -71,23 +71,6 @@ struct unicase_info_st
extern MY_UNICASE_INFO *const my_unicase_default[256];
extern MY_UNICASE_INFO *const my_unicase_turkish[256];
-#define MY_UCA_MAX_CONTRACTION 4
-#define MY_UCA_MAX_WEIGHT_SIZE 8
-
-typedef struct my_contraction_t
-{
- my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */
- uint16 weight[MY_UCA_MAX_WEIGHT_SIZE];/* Its weight string, 0-terminated */
-} MY_CONTRACTION;
-
-
-typedef struct my_contraction_list_t
-{
- size_t nitems; /* Number of items in the list */
- MY_CONTRACTION *item; /* List of contractions */
- char *flags; /* Character flags, e.g. "is contraction head") */
-} MY_CONTRACTIONS;
-
struct uni_ctype_st
{
uchar pctype;
@@ -300,7 +283,7 @@ struct charset_info_st
const uchar *to_lower;
const uchar *to_upper;
const uchar *sort_order;
- const MY_CONTRACTIONS *contractions;
+ uint16 *contractions;
const uint16 *const *sort_order_big;
const uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
@@ -326,6 +309,7 @@ struct charset_info_st
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8_general_ci;
extern struct charset_info_st my_charset_big5_bin;
extern struct charset_info_st my_charset_big5_chinese_ci;
@@ -359,14 +343,40 @@ extern struct charset_info_st my_charset_utf32_bin;
extern struct charset_info_st my_charset_utf32_general_ci;
extern struct charset_info_st my_charset_utf32_unicode_ci;
extern struct charset_info_st my_charset_utf8_bin;
-extern struct charset_info_st my_charset_utf8_general_ci;
extern struct charset_info_st my_charset_utf8_unicode_ci;
extern struct charset_info_st my_charset_utf8mb4_bin;
extern struct charset_info_st my_charset_utf8mb4_general_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_ci;
+
#define MY_UTF8MB3 "utf8"
#define MY_UTF8MB4 "utf8mb4"
+/* Helper functions to handle contraction */
+static inline my_bool
+my_cs_have_contractions(CHARSET_INFO *cs)
+{
+ return cs->contractions != NULL;
+}
+
+static inline my_bool
+my_cs_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return ((const char *)cs->contractions)[0x40*0x40 + (wc & 0xFF)];
+}
+
+static inline my_bool
+my_cs_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return ((const char *)cs->contractions)[0x40*0x40 + (wc & 0xFF)];
+}
+
+static inline uint16*
+my_cs_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
+{
+ return &cs->contractions[(wc1 - 0x40) * 0x40 + wc2 - 0x40];
+}
+
+
/* declarations for simple charsets */
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
const uchar *, size_t);
@@ -441,6 +451,7 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill);
+/* For 8-bit character set */
my_bool my_like_range_simple(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
@@ -448,6 +459,7 @@ my_bool my_like_range_simple(CHARSET_INFO *cs,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
+/* For ASCII-based multi-byte character sets with mbminlen=1 */
my_bool my_like_range_mb(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
@@ -455,26 +467,13 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
-my_bool my_like_range_ucs2(CHARSET_INFO *cs,
- const char *ptr, size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str, char *max_str,
- size_t *min_length, size_t *max_length);
-
-my_bool my_like_range_utf16(CHARSET_INFO *cs,
- const char *ptr, size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str, char *max_str,
- size_t *min_length, size_t *max_length);
-
-my_bool my_like_range_utf32(CHARSET_INFO *cs,
- const char *ptr, size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str, char *max_str,
- size_t *min_length, size_t *max_length);
+/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */
+my_bool my_like_range_generic(CHARSET_INFO *cs,
+ const char *ptr, size_t ptr_length,
+ pbool escape, pbool w_one, pbool w_many,
+ size_t res_length,
+ char *min_str, char *max_str,
+ size_t *min_length, size_t *max_length);
int my_wildcmp_8bit(CHARSET_INFO *,
const char *str,const char *str_end,
@@ -565,6 +564,8 @@ extern my_bool my_parse_charset_xml(const char *bug, size_t len,
int (*add)(struct charset_info_st *cs));
extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
pchar c);
+extern size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *end,
+ const char *accept);
my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len);
@@ -577,12 +578,6 @@ uint my_charset_repertoire(CHARSET_INFO *cs);
my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs);
-my_bool my_uca_have_contractions(CHARSET_INFO *cs);
-my_bool my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc);
-my_bool my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc);
-const uint16 *my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1,
- my_wc_t wc2);
-
extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap);
diff --git a/include/m_string.h b/include/m_string.h
index e2d649d0bcd..9eb0e1e13ff 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -52,8 +52,6 @@
# define memmove(d, s, n) bmove ((d), (s), (n))
#elif defined(HAVE_MEMMOVE)
# define bmove(d, s, n) memmove((d), (s), (n))
-#else
-# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
#endif
/* Unixware 7 */
@@ -80,7 +78,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY)
+#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
+#define strmov(A,B) __builtin_stpcpy((A),(B))
+#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#endif
@@ -92,14 +92,6 @@ extern char *strmov_overlapp(char *dest, const char *src);
/* Prototypes for string functions */
-#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(uchar *dst,size_t len,pchar fill);
-#endif
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(uuchar *dst, const uchar *src,size_t len);
-#endif
-
extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
extern void bchange(uchar *dst,size_t old_len,const uchar *src,
size_t new_len,size_t tot_len);
@@ -122,11 +114,6 @@ extern char *strxnmov(char *dst, size_t len, const char *src, ...);
extern size_t strnlen(const char *s, size_t n);
#endif
-#if !defined(__cplusplus)
-#ifndef HAVE_STRSTR
-extern char *strstr(const char *, const char *);
-#endif
-#endif
extern int is_prefix(const char *, const char *);
/* Conversion routines */
diff --git a/include/my_base.h b/include/my_base.h
index 75deb89a08d..408a57a7d70 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
+ reserved
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
@@ -30,9 +31,6 @@
#define EOVERFLOW 84
#endif
-#if !defined(USE_MY_FUNC) && !defined(THREAD)
-#include <my_nosys.h> /* For faster code, after test */
-#endif /* USE_MY_FUNC */
#endif /* stdin */
#include <my_list.h>
@@ -365,7 +363,7 @@ enum ha_base_keytype {
/*
update the 'variable' part of the info:
handler::records, deleted, data_file_length, index_file_length,
- delete_length, check_time, mean_rec_length
+ check_time, mean_rec_length
*/
#define HA_STATUS_VARIABLE 16
/*
@@ -378,6 +376,11 @@ enum ha_base_keytype {
update handler::auto_increment_value
*/
#define HA_STATUS_AUTO 64
+/*
+ Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it also
+ when only HA_STATUS_VARIABLE but it won't be used.
+*/
+#define HA_STATUS_VARIABLE_EXTRA 128
/*
Errorcodes given by handler functions
@@ -455,9 +458,10 @@ enum ha_base_keytype {
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
-#define HA_ERR_ROW_NOT_VISIBLE 177
-#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 178 /*Too many active concurrent transactions */
-#define HA_ERR_LAST 178 /* Copy of last error nr */
+#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
+#define HA_ERR_INDEX_COL_TOO_LONG 178 /* Index column length exceeds limit */
+#define HA_ERR_ROW_NOT_VISIBLE 179
+#define HA_ERR_LAST 179 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
diff --git a/include/my_bit.h b/include/my_bit.h
index 7e733d9d581..50dd7eb438a 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -1,3 +1,18 @@
+/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
#ifndef MY_BIT_INCLUDED
#define MY_BIT_INCLUDED
@@ -46,9 +61,12 @@ static inline uint my_count_bits(ulonglong v)
#endif
}
-static inline uint my_count_bits_ushort(ushort v)
+static inline uint my_count_bits_uint32(uint32 v)
{
- return _my_bits_nbits[v];
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
}
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index c92f28630e2..2b173e7627c 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -19,9 +19,7 @@
#define MY_BIT_NONE (~(uint) 0)
#include <m_string.h>
-#ifdef THREAD
#include <my_pthread.h>
-#endif
typedef uint32 my_bitmap_map;
@@ -34,9 +32,7 @@ typedef struct st_bitmap
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
acquiring the mutex
*/
-#ifdef THREAD
mysql_mutex_t *mutex;
-#endif
my_bitmap_map last_word_mask;
uint32 n_bits; /* number of bits occupied by the above */
} MY_BITMAP;
@@ -132,9 +128,10 @@ bitmap_is_set(const MY_BITMAP *map,uint bit)
static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
- *(map1)->last_word_ptr|= (map1)->last_word_mask;
- *(map2)->last_word_ptr|= (map2)->last_word_mask;
- return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0;
+ if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
+ return FALSE;
+ return ((*map1->last_word_ptr | map1->last_word_mask) ==
+ (*map2->last_word_ptr | map2->last_word_mask));
}
#define bitmap_clear_all(MAP) \
diff --git a/include/my_handler.h b/include/my_compare.h
index 970e74d2ace..363d46b8162 100644
--- a/include/my_handler.h
+++ b/include/my_compare.h
@@ -1,25 +1,22 @@
-/* Copyright (C) 2002-2006 MySQL AB
+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; version 2
- of the License.
+ 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
+ the Free Software Foundation; version 2 of the License.
- This library is distributed in the hope that it will be useful,
+ This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef _my_handler_h
-#define _my_handler_h
+#ifndef _my_compare_h
+#define _my_compare_h
#include "myisampack.h"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -39,15 +36,14 @@ extern "C" {
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
/*
The following defines can be increased if necessary.
- But beware the dependency of HA_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
*/
#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
-#define HA_MAX_KEY_SEG 32 /* Max segments for key */
+#define HA_MAX_KEY_SEG 16 /* Max segments for key */
-#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
+#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
-#define HA_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
typedef struct st_HA_KEYSEG /* Key-portion */
{
@@ -65,22 +61,22 @@ typedef struct st_HA_KEYSEG /* Key-portion */
} HA_KEYSEG;
#define get_key_length(length,key) \
-{ if (*(const uchar*) (key) != 255) \
- length= (uint) *(const uchar*) ((key)++); \
+{ if (*(uchar*) (key) != 255) \
+ length= (uint) *(uchar*) ((key)++); \
else \
{ length= mi_uint2korr((key)+1); (key)+=3; } \
}
#define get_key_length_rdonly(length,key) \
-{ if (*(const uchar*) (key) != 255) \
- length= ((uint) *(const uchar*) ((key))); \
+{ if (*(uchar*) (key) != 255) \
+ length= ((uint) *(uchar*) ((key))); \
else \
{ length= mi_uint2korr((key)+1); } \
}
#define get_key_pack_length(length,length_pack,key) \
-{ if (*(const uchar*) (key) != 255) \
- { length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
+{ if (*(uchar*) (key) != 255) \
+ { length= (uint) *(uchar*) ((key)++); length_pack= 1; }\
else \
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
}
@@ -110,45 +106,21 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
-extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint , my_bool, my_bool);
-extern int ha_key_cmp(register HA_KEYSEG *keyseg, register const uchar *a,
- register const uchar *b, uint key_length,
- uint32 nextflag, uint *diff_pos);
-
+extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
+ my_bool, my_bool);
+extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
+ register uchar *b, uint key_length, uint nextflag,
+ uint *diff_pos);
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
-extern void my_handler_error_register(void);
-extern void my_handler_error_unregister(void);
+
/*
Inside an in-memory data record, memory pointers to pieces of the
record (like BLOBs) are stored in their native byte order and in
this amount of bytes.
*/
#define portable_sizeof_char_ptr 8
-
-/**
- Return values of index_cond_func_xxx functions.
-
- 0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the
- engine should discard the tuple and go to the next one)
- 1=ICP_MATCH - index tuple satisfies the pushed index condition (the engine
- should fetch and return the record)
- 2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this
- if we're scanning "t.key BETWEEN 10 AND 20" and got a
- "t.key=21" tuple (the engine should stop scanning and return
- HA_ERR_END_OF_FILE right away).
-*/
-
-typedef enum icp_result {
- ICP_ERROR=-1,
- ICP_NO_MATCH=0,
- ICP_MATCH=1,
- ICP_OUT_OF_RANGE=2
-} ICP_RESULT;
-
-
#ifdef __cplusplus
}
#endif
-#endif /* _my_handler_h */
+#endif /* _my_compare_h */
diff --git a/include/my_compiler.h b/include/my_compiler.h
index 1cd46ff4260..e3ff80fad40 100644
--- a/include/my_compiler.h
+++ b/include/my_compiler.h
@@ -32,8 +32,15 @@
/* GNU C/C++ */
#if defined __GNUC__
+/* Convenience macro to test the minimum required GCC version. */
+# define MY_GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
/* Any after 2.95... */
# define MY_ALIGN_EXT
+/* Comunicate to the compiler the unreachability of the code. */
+# if MY_GNUC_PREREQ(4,5)
+# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
+# endif
/* Microsoft Visual C++ */
#elif defined _MSC_VER
@@ -67,8 +74,13 @@
#endif
/**
- Generic compiler-dependent features.
+ Generic (compiler-independent) features.
*/
+
+#ifndef MY_GNUC_PREREQ
+# define MY_GNUC_PREREQ(maj, min) (0)
+#endif
+
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
@@ -79,6 +91,10 @@
# endif
#endif
+#ifndef MY_ASSERT_UNREACHABLE
+# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
+#endif
+
/**
C++ Type Traits
*/
@@ -124,6 +140,14 @@ struct my_aligned_storage
#endif /* __cplusplus */
+# ifndef MY_ALIGNED
+/*
+ Make sure MY_ALIGNED can be used also on platforms where we don't
+ have a way of aligning data structures.
+*/
+#define MY_ALIGNED(size)
+#endif
+
#include <my_attribute.h>
#endif /* MY_COMPILER_INCLUDED */
diff --git a/include/my_dbug.h b/include/my_dbug.h
index ab02433ec4e..c397fbcf959 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB & 2009 Monty Program Ab
+/* Copyright (c) 2000 MySQL AB & 2009 Monty Program Ab
+ Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -13,8 +14,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef _dbug_h
-#define _dbug_h
+#ifndef MY_DBUG_INCLUDED
+#define MY_DBUG_INCLUDED
+
+#ifndef __WIN__
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#endif /* not __WIN__ */
#ifdef __cplusplus
extern "C" {
@@ -111,6 +122,22 @@ extern const char* _db_get_func_(void);
DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return")
#define DBUG_CRASH_VOID_RETURN \
DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return")
+
+/*
+ Make the program fail, without creating a core file.
+ abort() will send SIGABRT which (most likely) generates core.
+ Use SIGKILL instead, which cannot be caught.
+ We also pause the current thread, until the signal is actually delivered.
+ An alternative would be to use _exit(EXIT_FAILURE),
+ but then valgrind would report lots of memory leaks.
+ */
+#ifdef __WIN__
+#define DBUG_SUICIDE() DBUG_ABORT()
+#else
+extern void _db_suicide_();
+#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
+#endif
+
#else /* No debugger */
#define DBUG_ENTER(a1)
@@ -140,10 +167,11 @@ extern const char* _db_get_func_(void);
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define DEBUGGER_OFF do { } while(0)
#define DEBUGGER_ON do { } while(0)
-#define DBUG_ABORT() abort()
+#define DBUG_ABORT() do { } while(0)
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
+#define DBUG_SUICIDE() do { } while(0)
#endif
@@ -165,4 +193,5 @@ void debug_sync_point(const char* lock_name, uint lock_timeout);
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* MY_DBUG_INCLUDED */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 5eb0004e9c3..6c1db277db8 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004 MySQL AB
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _my_getopt_h
#define _my_getopt_h
@@ -39,6 +39,13 @@ C_MODE_START
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
+/**
+ Enumeration of the my_option::arg_type attributes.
+ It should be noted that for historical reasons variables with the combination
+ arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts
+ arguments. This is someone counter intuitive and care should be taken
+ if the code is refactored.
+*/
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
struct st_typelib;
@@ -79,7 +86,9 @@ struct my_option
typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
-typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
+ ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
+
/**
Used to retrieve a reference to the object (variable) that holds the value
for the given option. For example, if var_type is GET_UINT, the function
diff --git a/include/my_global.h b/include/my_global.h
index 5d874d9f5f8..4a7535e1c4d 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -232,13 +232,6 @@
#include <sys/types.h>
#endif
-/* The client defines this to avoid all thread code */
-#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK)
-#undef THREAD
-#undef HAVE_LINUXTHREADS
-#undef HAVE_NPTL
-#endif
-
#ifdef HAVE_THREADS_WITHOUT_SOCKETS
/* MIT pthreads does not work with unix sockets */
#undef HAVE_SYS_UN_H
@@ -281,7 +274,7 @@
#endif
#endif
-#if defined(THREAD) && !defined(__WIN__)
+#if !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif
@@ -302,7 +295,7 @@ C_MODE_END
#if !defined(SCO) && !defined(_REENTRANT)
#define _REENTRANT 1 /* Threads requires reentrant code */
#endif
-#endif /* THREAD */
+#endif /* !defined(__WIN__) */
/* Go around some bugs in different OS and compilers */
#ifdef _AIX /* By soren@t.dk */
@@ -312,7 +305,7 @@ C_MODE_END
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
-double my_ulonglong2double(unsigned long long A);
+inline double my_ulonglong2double(unsigned long long A) { return (double A); }
C_MODE_END
#endif /* _AIX */
@@ -328,9 +321,6 @@ C_MODE_END
#undef HAVE_PWRITE
#endif
-#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
-#undef HAVE_GETHOSTBYNAME_R
-#endif
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
@@ -438,7 +428,7 @@ C_MODE_END
#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
#define HAVE_ULONG
#endif
-#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)
+#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE)
/* Fix bug in setrlimit */
#undef setrlimit
#define setrlimit cma_setrlimit64
@@ -475,6 +465,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define LINT_INIT(var)
#endif
+#ifndef SO_EXT
#ifdef _WIN32
#define SO_EXT ".dll"
#elif defined(__APPLE__)
@@ -482,6 +473,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#else
#define SO_EXT ".so"
#endif
+#endif
/*
Suppress uninitialized variable warning without generating code.
@@ -633,6 +625,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#ifdef _WIN32
#define FN_LIBCHAR '\\'
#define FN_LIBCHAR2 '/'
+#define FN_DIRSEP "/\\" /* Valid directory separators */
#define FN_ROOTDIR "\\"
#define FN_DEVCHAR ':'
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
@@ -640,6 +633,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#else
#define FN_LIBCHAR '/'
#define FN_LIBCHAR2 '/'
+#define FN_DIRSEP "/" /* Valid directory separators */
#define FN_ROOTDIR "/"
#endif
@@ -1377,28 +1371,6 @@ do { doubleget_union _tmp; \
#endif /* WORDS_BIGENDIAN */
-/* sprintf does not always return the number of bytes :- */
-#ifdef SPRINTF_RETURNS_INT
-#define my_sprintf(buff,args) sprintf args
-#else
-#ifdef SPRINTF_RETURNS_PTR
-#define my_sprintf(buff,args) ((int)(sprintf args - buff))
-#else
-#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
-#endif
-#endif
-
-#ifndef THREAD
-#define thread_safe_increment(V,L) (V)++
-#define thread_safe_decrement(V,L) (V)--
-#define thread_safe_add(V,C,L) (V)+=(C)
-#define thread_safe_sub(V,C,L) (V)-=(C)
-#define statistic_increment(V,L) (V)++
-#define statistic_decrement(V,L) (V)--
-#define statistic_add(V,C,L) (V)+=(C)
-#define statistic_sub(V,C,L) (V)-=(C)
-#endif
-
#ifdef HAVE_CHARSET_utf8
#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
#else
@@ -1413,21 +1385,28 @@ do { doubleget_union _tmp; \
#define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name)
#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
#define dlclose(lib) FreeLibrary((HMODULE)lib)
+#ifndef HAVE_DLOPEN
#define HAVE_DLOPEN
#endif
+#endif
-#ifdef HAVE_DLOPEN
-# if defined(HAVE_DLFCN_H)
-# include <dlfcn.h>
-# endif
-# ifndef HAVE_DLERROR
-# define dlerror() ""
-# endif
+#if defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+#endif
+
+#ifndef HAVE_DLERROR
+#ifdef _WIN32
+static inline char *dlerror(void)
+{
+ static char win_errormsg[2048];
+ if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ 0, GetLastError(), 0, win_errormsg, 2048, NULL))
+ return win_errormsg;
+ return "";
+}
#else
-# define dlerror() "No support for dynamic loading (static build?)"
-# define dlopen(A,B) 0
-# define dlsym(A,B) 0
-# define dlclose(A) 0
+#define dlerror() "No support for dynamic loading (static build?)"
+#endif
#endif
/*
@@ -1546,10 +1525,8 @@ static inline double rint(double x)
/* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
-#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */
-#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
#endif /* EMBEDDED_LIBRARY */
diff --git a/include/my_net.h b/include/my_net.h
index 5762f5da06e..ce2ee6ce8ca 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -73,38 +73,6 @@ C_MODE_START
#define in_addr_t uint32
#endif
-/*
- Handling of gethostbyname_r()
-*/
-
-#if !defined(HAVE_GETHOSTBYNAME_R)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-void my_gethostbyname_r_free();
-#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#define my_gethostbyname_r_free()
-#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10)
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#define my_gethostbyname_r_free()
-#else
-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
-#define my_gethostbyname_r_free()
-#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
-
-#ifndef GETHOSTBYNAME_BUFF_SIZE
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#endif
C_MODE_END
#endif
diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h
deleted file mode 100644
index 633a5b94a6c..00000000000
--- a/include/my_no_pthread.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef MY_NO_PTHREAD_INCLUDED
-#define MY_NO_PTHREAD_INCLUDED
-
-/* 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-
-#ifndef THREAD
-
-/*
- This block is to access some thread-related type definitions
- even in builds which do not need thread functions,
- as some variables (based on these types) are declared
- even in non-threaded builds.
- Case in point: 'mf_keycache.c'
-*/
-#if defined(__WIN__)
-#else /* Normal threads */
-#include <pthread.h>
-
-#endif /* defined(__WIN__) */
-
-
-/*
- This undefs some pthread mutex locks when one isn't using threads
- to make thread safe code, that should also work in single thread
- environment, easier to use.
-*/
-#define pthread_mutex_init(A,B)
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#define pthread_mutex_destroy(A)
-#define my_rwlock_init(A,B)
-#define rw_rdlock(A)
-#define rw_wrlock(A)
-#define rw_unlock(A)
-#define rwlock_destroy(A)
-#define safe_mutex_assert_owner(mp)
-
-#define mysql_mutex_init(A, B, C) do {} while (0)
-#define mysql_mutex_lock(A) do {} while (0)
-#define mysql_mutex_unlock(A) do {} while (0)
-#define mysql_mutex_destroy(A) do {} while (0)
-
-#define mysql_rwlock_init(A, B, C) do {} while (0)
-#define mysql_rwlock_rdlock(A) do {} while (0)
-#define mysql_rwlock_wrlock(A) do {} while (0)
-#define mysql_rwlock_unlock(A) do {} while (0)
-#define mysql_rwlock_destroy(A) do {} while (0)
-
-typedef int my_pthread_once_t;
-#define MY_PTHREAD_ONCE_INIT 0
-#define MY_PTHREAD_ONCE_DONE 1
-
-#define my_pthread_once(C,F) do { \
- if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
- } while(0)
-
-#endif
-#endif /* MY_NO_PTHREAD_INCLUDED */
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 8a7976bb334..c0321cde6ed 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -48,19 +48,30 @@ typedef struct st_pthread_link {
struct st_pthread_link *next;
} pthread_link;
-typedef struct {
- uint32 waiting;
- CRITICAL_SECTION lock_waiting;
-
- enum {
- SIGNAL= 0,
- BROADCAST= 1,
- MAX_EVENTS= 2
- } EVENTS;
-
- HANDLE events[MAX_EVENTS];
- HANDLE broadcast_block_event;
-
+/**
+ Implementation of Windows condition variables.
+ We use native conditions on Vista and later, and fallback to own
+ implementation on earlier OS version.
+*/
+typedef union
+{
+ /* Native condition (used on Vista and later) */
+ CONDITION_VARIABLE native_cond;
+
+ /* Own implementation (used on XP) */
+ struct
+ {
+ uint32 waiting;
+ CRITICAL_SECTION lock_waiting;
+ enum
+ {
+ SIGNAL= 0,
+ BROADCAST= 1,
+ MAX_EVENTS= 2
+ } EVENTS;
+ HANDLE events[MAX_EVENTS];
+ HANDLE broadcast_block_event;
+ };
} pthread_cond_t;
@@ -206,7 +217,11 @@ int pthread_cancel(pthread_t thread);
typedef void *(* pthread_handler)(void *);
#define my_pthread_once_t pthread_once_t
+#if defined(PTHREAD_ONCE_INITIALIZER)
+#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INITIALIZER
+#else
#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#endif
#define my_pthread_once(C,F) pthread_once(C,F)
/* Test first for RTS or FSU threads */
@@ -488,7 +503,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime, const char *file, uint line);
+ const struct timespec *abstime,
+ const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
void safe_mutex_free_deadlock_data(safe_mutex_t *mp);
@@ -598,7 +614,7 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
/* Use our own version of read/write locks */
#define NEED_MY_RW_LOCK 1
#define rw_lock_t my_rw_lock_t
-#define my_rwlock_init(A,B) my_rw_init((A), 0)
+#define my_rwlock_init(A,B) my_rw_init((A))
#define rw_rdlock(A) my_rw_rdlock((A))
#define rw_wrlock(A) my_rw_wrlock((A))
#define rw_tryrdlock(A) my_rw_tryrdlock((A))
@@ -610,49 +626,123 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
-/*
- Portable read-write locks which prefer readers.
-
- Required by some algorithms in order to provide correctness.
+/**
+ Portable implementation of special type of read-write locks.
+
+ These locks have two properties which are unusual for rwlocks:
+ 1) They "prefer readers" in the sense that they do not allow
+ situations in which rwlock is rd-locked and there is a
+ pending rd-lock which is blocked (e.g. due to pending
+ request for wr-lock).
+ This is a stronger guarantee than one which is provided for
+ PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux.
+ MDL subsystem deadlock detector relies on this property for
+ its correctness.
+ 2) They are optimized for uncontended wr-lock/unlock case.
+ This is scenario in which they are most oftenly used
+ within MDL subsystem. Optimizing for it gives significant
+ performance improvements in some of tests involving many
+ connections.
+
+ Another important requirement imposed on this type of rwlock
+ by the MDL subsystem is that it should be OK to destroy rwlock
+ object which is in unlocked state even though some threads might
+ have not yet fully left unlock operation for it (of course there
+ is an external guarantee that no thread will try to lock rwlock
+ which is destroyed).
+ Putting it another way the unlock operation should not access
+ rwlock data after changing its state to unlocked.
+
+ TODO/FIXME: We should consider alleviating this requirement as
+ it blocks us from doing certain performance optimizations.
*/
-#if defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
-/*
- On systems which have a way to specify that readers should
- be preferred through attribute mechanism (e.g. Linux) we use
- system implementation of read/write locks.
-*/
-#define rw_pr_lock_t pthread_rwlock_t
+typedef struct st_rw_pr_lock_t {
+ /**
+ Lock which protects the structure.
+ Also held for the duration of wr-lock.
+ */
+ pthread_mutex_t lock;
+ /**
+ Condition variable which is used to wake-up
+ writers waiting for readers to go away.
+ */
+ pthread_cond_t no_active_readers;
+ /** Number of active readers. */
+ uint active_readers;
+ /** Number of writers waiting for readers to go away. */
+ uint writers_waiting_readers;
+ /** Indicates whether there is an active writer. */
+ my_bool active_writer;
+#ifdef SAFE_MUTEX
+ /** Thread holding wr-lock (for debug purposes only). */
+ pthread_t writer_thread;
+#endif
+} rw_pr_lock_t;
+
extern int rw_pr_init(rw_pr_lock_t *);
-#define rw_pr_rdlock(A) pthread_rwlock_rdlock(A)
-#define rw_pr_wrlock(A) pthread_rwlock_wrlock(A)
-#define rw_pr_tryrdlock(A) pthread_rwlock_tryrdlock(A)
-#define rw_pr_trywrlock(A) pthread_rwlock_trywrlock(A)
-#define rw_pr_unlock(A) pthread_rwlock_unlock(A)
-#define rw_pr_destroy(A) pthread_rwlock_destroy(A)
+extern int rw_pr_rdlock(rw_pr_lock_t *);
+extern int rw_pr_wrlock(rw_pr_lock_t *);
+extern int rw_pr_unlock(rw_pr_lock_t *);
+extern int rw_pr_destroy(rw_pr_lock_t *);
+#ifdef SAFE_MUTEX
+#define rw_pr_lock_assert_write_owner(A) \
+ DBUG_ASSERT((A)->active_writer && pthread_equal(pthread_self(), \
+ (A)->writer_thread))
+#define rw_pr_lock_assert_not_write_owner(A) \
+ DBUG_ASSERT(! (A)->active_writer || ! pthread_equal(pthread_self(), \
+ (A)->writer_thread))
+#else
#define rw_pr_lock_assert_write_owner(A)
#define rw_pr_lock_assert_not_write_owner(A)
-#else
-/* Otherwise we have to use our own implementation of read/write locks. */
-#define NEED_MY_RW_LOCK 1
-struct st_my_rw_lock_t;
-#define rw_pr_lock_t my_rw_lock_t
-extern int rw_pr_init(struct st_my_rw_lock_t *);
-#define rw_pr_rdlock(A) my_rw_rdlock((A))
-#define rw_pr_wrlock(A) my_rw_wrlock((A))
-#define rw_pr_tryrdlock(A) my_rw_tryrdlock((A))
-#define rw_pr_trywrlock(A) my_rw_trywrlock((A))
-#define rw_pr_unlock(A) my_rw_unlock((A))
-#define rw_pr_destroy(A) my_rw_destroy((A))
-#define rw_pr_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A))
-#define rw_pr_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A))
-#endif /* defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) */
+#endif /* SAFE_MUTEX */
#ifdef NEED_MY_RW_LOCK
+
+#ifdef _WIN32
+
+/**
+ Implementation of Windows rwlock.
+
+ We use native (slim) rwlocks on Win7 and later, and fallback to portable
+ implementation on earlier Windows.
+
+ slim rwlock are also available on Vista/WS2008, but we do not use it
+ ("trylock" APIs are missing on Vista)
+*/
+typedef union
+{
+ /* Native rwlock (is_srwlock == TRUE) */
+ struct
+ {
+ SRWLOCK srwlock; /* native reader writer lock */
+ BOOL have_exclusive_srwlock; /* used for unlock */
+ };
+
+ /*
+ Portable implementation (is_srwlock == FALSE)
+ Fields are identical with Unix my_rw_lock_t fields.
+ */
+ struct
+ {
+ pthread_mutex_t lock; /* lock for structure */
+ pthread_cond_t readers; /* waiting readers */
+ pthread_cond_t writers; /* waiting writers */
+ int state; /* -1:writer,0:free,>0:readers */
+ int waiters; /* number of waiting writers */
+#ifdef SAFE_MUTEX
+ pthread_t write_thread;
+#endif
+ };
+} my_rw_lock_t;
+
+
+#else /* _WIN32 */
+
/*
- On systems which don't support native read/write locks, or don't support
- read/write locks which prefer readers we have to use own implementation.
+ On systems which don't support native read/write locks we have
+ to use own implementation.
*/
typedef struct st_my_rw_lock_t {
pthread_mutex_t lock; /* lock for structure */
@@ -660,13 +750,14 @@ typedef struct st_my_rw_lock_t {
pthread_cond_t writers; /* waiting writers */
int state; /* -1:writer,0:free,>0:readers */
int waiters; /* number of waiting writers */
- my_bool prefer_readers;
#ifdef SAFE_MUTEX
pthread_t write_thread;
#endif
} my_rw_lock_t;
-extern int my_rw_init(my_rw_lock_t *, my_bool *);
+#endif /*! _WIN32 */
+
+extern int my_rw_init(my_rw_lock_t *);
extern int my_rw_destroy(my_rw_lock_t *);
extern int my_rw_rdlock(my_rw_lock_t *);
extern int my_rw_wrlock(my_rw_lock_t *);
@@ -720,8 +811,7 @@ typedef ulong my_thread_id;
extern void my_threadattr_global_init(void);
extern my_bool my_thread_global_init(void);
-extern my_bool my_thread_basic_global_init(void);
-extern void my_thread_basic_global_reinit(void);
+extern void my_thread_global_reinit(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
extern void my_thread_end(void);
@@ -800,12 +890,6 @@ extern uint thd_lib_detected;
to use my_atomic operations instead.
*/
-/*
- Warning:
- When compiling without threads, this file is not included.
- See the *other* declarations of thread_safe_xxx in include/my_global.h
-*/
-#ifdef THREAD
#ifndef thread_safe_increment
#ifdef _WIN32
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
@@ -829,7 +913,7 @@ extern uint thd_lib_detected;
(mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L)))
#endif
#endif
-#endif
+
/*
statistics_xxx functions are for non critical statistic,
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 78e3dbca577..8c2c97c68e5 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -45,7 +45,7 @@ C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
-void my_safe_print_str(const char* name, const char* val, int max_len);
+void my_safe_print_str(const char* val, int max_len);
void my_write_core(int sig);
#if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status);
diff --git a/include/my_sys.h b/include/my_sys.h
index ecb478818ac..4dfe425dc30 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -29,12 +29,27 @@ typedef struct my_aio_result {
} my_aio_result;
#endif
-#ifndef THREAD
-extern int my_errno; /* Last error in mysys */
+#ifdef HAVE_valgrind
+#define IF_VALGRIND(A,B) A
#else
-#include <my_pthread.h>
+#define IF_VALGRIND(A,B) B
#endif
+#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H)
+# include <valgrind/memcheck.h>
+# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
+# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
+# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) bfill(a, len, 0x8F)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
+#include <my_pthread.h>
+
#include <m_ctype.h> /* for CHARSET_INFO */
#include <stdarg.h>
#include <typelib.h>
@@ -98,7 +113,7 @@ extern int my_errno; /* Last error in mysys */
#define ME_HOLDTANG 8 /* Don't delete last keys */
#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
#define ME_WAITTANG 32 /* Wait for a user action */
-#define ME_NOREFRESH 64 /* Dont refresh screen */
+#define ME_NOREFRESH 64 /* Write the error message to error log */
#define ME_NOINPUT 128 /* Dont use the input libary */
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
@@ -254,7 +269,7 @@ extern my_bool my_disable_sync;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
/* from default.c */
-extern char *my_defaults_extra_file;
+extern const char *my_defaults_extra_file;
extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
@@ -318,7 +333,7 @@ struct st_my_file_info
int oflag; /* open flags, e.g O_APPEND */
#endif
enum file_type type;
-#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
+#if !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_t mutex;
#endif
};
@@ -338,9 +353,7 @@ typedef struct st_my_tmpdir
DYNAMIC_ARRAY full_list;
char **list;
uint cur, max;
-#ifdef THREAD
mysql_mutex_t mutex;
-#endif
} MY_TMPDIR;
typedef struct st_dynamic_string
@@ -352,7 +365,6 @@ typedef struct st_dynamic_string
struct st_io_cache;
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
-#ifdef THREAD
typedef struct st_io_cache_share
{
mysql_mutex_t mutex; /* To sync on reads into buffer. */
@@ -372,7 +384,6 @@ typedef struct st_io_cache_share
my_bool alloced;
#endif
} IO_CACHE_SHARE;
-#endif
typedef struct st_io_cache /* Used when cacheing files */
{
@@ -413,7 +424,7 @@ typedef struct st_io_cache /* Used when cacheing files */
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
uchar **current_pos, **current_end;
-#ifdef THREAD
+
/*
The lock is for append buffer used in SEQ_READ_APPEND cache
need mutex copying from append buffer to read buffer.
@@ -427,7 +438,7 @@ typedef struct st_io_cache /* Used when cacheing files */
READ_CACHE mode is supported.
*/
IO_CACHE_SHARE *share;
-#endif
+
/*
A caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with
@@ -460,7 +471,8 @@ typedef struct st_io_cache /* Used when cacheing files */
IO_CACHE_CALLBACK pre_close;
/*
Counts the number of times, when we were forced to use disk. We use it to
- increase the binlog_cache_disk_use status variable.
+ increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
+ variables.
*/
ulong disk_writes;
void* arg; /* for use by pre/post_read */
@@ -635,10 +647,13 @@ extern const char** get_global_errmsgs();
extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
+extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_chmod(const char *name, mode_t mode, myf my_flags);
+extern void thr_set_sync_wait_callback(void (*before_sync)(void),
+ void (*after_sync)(void));
extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
@@ -653,21 +668,12 @@ extern int my_error_register(const char** (*get_errmsgs) (),
extern const char **my_error_unregister(int first, int last);
extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
-extern my_bool my_basic_init(void);
extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags);
extern char * my_filename(File fd);
-#ifndef THREAD
-extern void dont_break(void);
-extern void allow_break(void);
-#else
-#define dont_break()
-#define allow_break()
-#endif
-
#ifdef EXTRA_DEBUG
void my_print_open_files(void);
#else
@@ -740,12 +746,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
pbool clear_cache);
extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
-#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
IO_CACHE *write_cache, uint num_threads);
extern void remove_io_thread(IO_CACHE *info);
-#endif
extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_get(IO_CACHE *info);
@@ -839,7 +843,8 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
-extern const char *args_separator;
+extern my_bool my_getopt_use_args_separator;
+extern my_bool my_getopt_is_args_separator(const char* arg);
extern int my_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,
diff --git a/include/my_time.h b/include/my_time.h
index fdfe130c45f..68f9c2e739f 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -50,6 +50,19 @@ typedef long my_time_t;
/* two-digit years < this are 20..; >= this are 19.. */
#define YY_PART_YEAR 70
+/*
+ check for valid times only if the range of time_t is greater than
+ the range of my_time_t
+*/
+#if SIZEOF_TIME_T > 4 || defined(TIME_T_UNSIGNED)
+# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
+ ((x) <= TIMESTAMP_MAX_VALUE && \
+ (x) >= TIMESTAMP_MIN_VALUE)
+#else
+# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
+ ((x) >= TIMESTAMP_MIN_VALUE)
+#endif
+
/* Flags to str_to_datetime */
#define TIME_FUZZY_DATE 1
#define TIME_DATETIME_ONLY 2
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
deleted file mode 100644
index dd8f4b22e21..00000000000
--- a/include/my_valgrind.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 2010 Monty Program 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-
-/* Some defines to make it easier to use valgrind */
-
-#ifdef HAVE_valgrind
-#define IF_VALGRIND(A,B) (A)
-#else
-#define IF_VALGRIND(A,B) (B)
-#endif
-
-#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H)
-#include <valgrind/memcheck.h>
-#define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
-#define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
-#define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
-#define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
-#else /* HAVE_VALGRIND */
-# define MEM_UNDEFINED(a,len) bfill(a, len, 0x8F)
-# define MEM_NOACCESS(a,len) ((void) 0)
-# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
-# define MEM_CHECK_DEFINED(a,len) ((void) 0)
-#endif /* HAVE_VALGRIND */
-
diff --git a/include/myisam.h b/include/myisam.h
index b54950fa1cc..fb4f2e260e6 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
+ reserved
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
@@ -21,16 +22,10 @@
extern "C" {
#endif
-#ifndef _my_base_h
#include <my_base.h>
-#endif
-#ifndef _m_ctype_h
#include <m_ctype.h>
-#endif
-#ifndef _keycache_h
#include "keycache.h"
-#endif
-#include "my_handler.h"
+#include "my_compare.h"
#include <myisamchk.h>
#include <mysql/plugin.h>
@@ -315,11 +310,9 @@ typedef struct st_mi_bit_buff
typedef struct st_sort_info
{
-#ifdef THREAD
/* sync things */
mysql_mutex_t mutex;
mysql_cond_t cond;
-#endif
MI_INFO *info;
HA_CHECK *param;
uchar *buff;
diff --git a/include/myisamchk.h b/include/myisamchk.h
index ca81c689f3d..57a015238e0 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -154,10 +154,8 @@ typedef struct st_handler_check_param
char temp_filename[FN_REFLEN];
IO_CACHE read_cache;
enum_handler_stats_method stats_method;
-#ifdef THREAD
mysql_mutex_t print_msg_mutex;
my_bool need_print_msg_lock;
-#endif
} HA_CHECK;
diff --git a/include/mysql.h b/include/mysql.h
index cfaf1c7881b..28def52e422 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -17,11 +17,10 @@
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
- The ABI should never be changed in a released product of MySQL
+ The ABI should never be changed in a released product of MySQL,
thus you need to take great care when changing the file. In case
- the file is changed so the ABI is broken, you must also
- update the SHAREDLIB_MAJOR_VERSION in configure.in .
-
+ the file is changed so the ABI is broken, you must also update
+ the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
*/
#ifndef _mysql_h
@@ -576,6 +575,8 @@ typedef struct st_mysql_bind
} MYSQL_BIND;
+struct st_mysql_stmt_extension;
+
/* statement handler */
typedef struct st_mysql_stmt
{
@@ -621,7 +622,7 @@ typedef struct st_mysql_stmt
metadata fields when doing mysql_stmt_store_result.
*/
my_bool update_max_length;
- void *extension;
+ struct st_mysql_stmt_extension *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 31c4f5e5781..821e7b26454 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -224,9 +224,9 @@ typedef struct st_typelib {
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
-extern uint find_type_or_exit(const char *x, TYPELIB *typelib,
- const char *option);
-extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+extern int find_type_or_exit(const char *x, TYPELIB *typelib,
+ const char *option);
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
@@ -513,6 +513,7 @@ typedef struct st_mysql_bind
my_bool is_null_value;
void *extension;
} MYSQL_BIND;
+struct st_mysql_stmt_extension;
typedef struct st_mysql_stmt
{
MEM_ROOT mem_root;
@@ -542,7 +543,7 @@ typedef struct st_mysql_stmt
unsigned char bind_result_done;
my_bool unbuffered_fetch_cancelled;
my_bool update_max_length;
- void *extension;
+ struct st_mysql_stmt_extension *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type
{
diff --git a/include/mysql/client_plugin.h b/include/mysql/client_plugin.h
index 9c7b1aee9f9..6af0d226ea2 100644
--- a/include/mysql/client_plugin.h
+++ b/include/mysql/client_plugin.h
@@ -38,7 +38,7 @@
#define MYSQL_CLIENT_MAX_PLUGINS 3
#define mysql_declare_client_plugin(X) \
- struct st_mysql_client_plugin_ ## X \
+ MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_ ## X ## _PLUGIN, \
MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION,
@@ -52,8 +52,11 @@
const char *author; \
const char *desc; \
unsigned int version[3]; \
+ const char *license; \
+ void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
- int (*deinit)();
+ int (*deinit)(); \
+ int (*options)(const char *option, const void *);
struct st_mysql_client_plugin
{
@@ -94,8 +97,7 @@ typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
/**
loads a plugin and initializes it
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
@@ -115,8 +117,7 @@ mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
@@ -133,8 +134,7 @@ mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
/**
finds an already loaded plugin by name, or loads it, if necessary
- @param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
- and last_errno/last_error, for error reporting
+ @param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded
@@ -162,5 +162,19 @@ struct st_mysql_client_plugin *
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
+/**
+ set plugin options
+
+ Can be used to set extra options and affect behavior for a plugin.
+ This function may be called multiple times to set several options
+
+ @param plugin an st_mysql_client_plugin structure
+ @param option a string which specifies the option to set
+ @param value value for the option.
+
+ @retval 0 on success, 1 in case of failure
+**/
+int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
+ const char *option, const void *value);
#endif
diff --git a/include/mysql/client_plugin.h.pp b/include/mysql/client_plugin.h.pp
index ca477d83bb2..93eaff7501e 100644
--- a/include/mysql/client_plugin.h.pp
+++ b/include/mysql/client_plugin.h.pp
@@ -1,6 +1,6 @@
struct st_mysql_client_plugin
{
- int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; int (*init)(char *, size_t, int, va_list); int (*deinit)();
+ int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
};
struct st_mysql;
#include <mysql/plugin_auth_common.h>
@@ -21,11 +21,9 @@ typedef struct st_plugin_vio
} MYSQL_PLUGIN_VIO;
struct st_mysql_client_plugin_AUTHENTICATION
{
- int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; int (*init)(char *, size_t, int, va_list); int (*deinit)();
+ int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *);
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
-typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql,
- int type, const char *prompt, char *buf, int buf_len);
struct st_mysql_client_plugin *
mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
int argc, ...);
@@ -37,3 +35,5 @@ mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
struct st_mysql_client_plugin *
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
+int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
+ const char *option, const void *value);
diff --git a/include/mysql/innodb_priv.h b/include/mysql/innodb_priv.h
index 993dad7cf99..5406c292b18 100644
--- a/include/mysql/innodb_priv.h
+++ b/include/mysql/innodb_priv.h
@@ -22,7 +22,6 @@
class THD;
-uint filename_to_tablename(const char *from, char *to, uint to_length);
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
bool schema_table_store_record(THD *thd, TABLE *table);
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
diff --git a/include/mysql/plugin_audit.h b/include/mysql/plugin_audit.h
index 41505da64af..5072ad2b44c 100644
--- a/include/mysql/plugin_audit.h
+++ b/include/mysql/plugin_audit.h
@@ -24,16 +24,7 @@
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
-#define MYSQL_AUDIT_INTERFACE_VERSION 0x0200
-
-/*
- The first word in every event class struct indicates the specific
- class of the event.
-*/
-struct mysql_event
-{
- unsigned int event_class;
-};
+#define MYSQL_AUDIT_INTERFACE_VERSION 0x0300
/*************************************************************************
@@ -42,6 +33,8 @@ struct mysql_event
LOG events occurs before emitting to the general query log.
ERROR events occur before transmitting errors to the user.
RESULT events occur after transmitting a resultset to the user.
+ STATUS events occur after transmitting a resultset or errors
+ to the user.
*/
#define MYSQL_AUDIT_GENERAL_CLASS 0
@@ -49,10 +42,10 @@ struct mysql_event
#define MYSQL_AUDIT_GENERAL_LOG 0
#define MYSQL_AUDIT_GENERAL_ERROR 1
#define MYSQL_AUDIT_GENERAL_RESULT 2
+#define MYSQL_AUDIT_GENERAL_STATUS 3
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -68,6 +61,42 @@ struct mysql_event_general
};
+/*
+ AUDIT CLASS : CONNECTION
+
+ CONNECT occurs after authentication phase is completed.
+ DISCONNECT occurs after connection is terminated.
+ CHANGE_USER occurs after COM_CHANGE_USER RPC is completed.
+*/
+
+#define MYSQL_AUDIT_CONNECTION_CLASS 1
+#define MYSQL_AUDIT_CONNECTION_CLASSMASK (1 << MYSQL_AUDIT_CONNECTION_CLASS)
+#define MYSQL_AUDIT_CONNECTION_CONNECT 0
+#define MYSQL_AUDIT_CONNECTION_DISCONNECT 1
+#define MYSQL_AUDIT_CONNECTION_CHANGE_USER 2
+
+struct mysql_event_connection
+{
+ unsigned int event_subclass;
+ int status;
+ unsigned long thread_id;
+ const char *user;
+ unsigned int user_length;
+ const char *priv_user;
+ unsigned int priv_user_length;
+ const char *external_user;
+ unsigned int external_user_length;
+ const char *proxy_user;
+ unsigned int proxy_user_length;
+ const char *host;
+ unsigned int host_length;
+ const char *ip;
+ unsigned int ip_length;
+ const char *database;
+ unsigned int database_length;
+};
+
+
/*************************************************************************
Here we define the descriptor structure, that is referred from
st_mysql_plugin.
@@ -78,9 +107,9 @@ struct mysql_event_general
waiting for the next query from the client.
event_notify() is invoked whenever an event occurs which is of any
- class for which the plugin has interest. The first word of the
- mysql_event argument indicates the specific event class and the
- remainder of the structure is as required for that class.
+ class for which the plugin has interest. The second argument
+ indicates the specific event class and the third argument is data
+ as required for that class.
class_mask is an array of bits used to indicate what event classes
that this plugin wants to receive.
@@ -90,7 +119,7 @@ struct st_mysql_audit
{
int interface_version;
void (*release_thd)(MYSQL_THD);
- void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+ void (*event_notify)(MYSQL_THD, unsigned int, const void *);
unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
};
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index ad8ca389d34..42d44b9dae0 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -33,16 +33,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
@@ -205,13 +212,8 @@ void mysql_query_cache_invalidate4(void* thd,
void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
void thd_set_ha_data(void* thd, const struct handlerton *hton,
const void *ha_data);
-struct mysql_event
-{
- unsigned int event_class;
-};
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -225,10 +227,30 @@ struct mysql_event_general
unsigned long long general_time;
unsigned long long general_rows;
};
+struct mysql_event_connection
+{
+ unsigned int event_subclass;
+ int status;
+ unsigned long thread_id;
+ const char *user;
+ unsigned int user_length;
+ const char *priv_user;
+ unsigned int priv_user_length;
+ const char *external_user;
+ unsigned int external_user_length;
+ const char *proxy_user;
+ unsigned int proxy_user_length;
+ const char *host;
+ unsigned int host_length;
+ const char *ip;
+ unsigned int ip_length;
+ const char *database;
+ unsigned int database_length;
+};
struct st_mysql_audit
{
int interface_version;
void (*release_thd)(void*);
- void (*event_notify)(void*, const struct mysql_event *);
+ void (*event_notify)(void*, unsigned int, const void *);
unsigned long class_mask[1];
};
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index 2b84a6c73af..fcfd1bc6f0b 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -1,5 +1,6 @@
#ifndef MYSQL_PLUGIN_AUTH_INCLUDED
/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab
+ Copyright (C) 2010 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
@@ -30,6 +31,13 @@
#include <mysql/plugin_auth_common.h>
+/* defines for MYSQL_SERVER_AUTH_INFO.password_used */
+
+#define PASSWORD_USED_NO 0
+#define PASSWORD_USED_YES 1
+#define PASSWORD_USED_NO_MENTION 2
+
+
/**
Provides server plugin access to authentication information
*/
@@ -39,7 +47,13 @@ typedef struct st_mysql_server_auth_info
User name as sent by the client and shown in USER().
NULL if the client packet with the user name was not received yet.
*/
- const char *user_name;
+ char *user_name;
+
+ /**
+ Length of user_name
+ */
+ unsigned int user_name_length;
+
/**
A corresponding column value from the mysql.user table for the
matching account name
@@ -47,17 +61,46 @@ typedef struct st_mysql_server_auth_info
const char *auth_string;
/**
+ Length of auth_string
+ */
+ unsigned long auth_string_length;
+
+ /**
Matching account name as found in the mysql.user table.
A plugin can override it with another name that will be
used by MySQL for authorization, and shown in CURRENT_USER()
*/
char authenticated_as[MYSQL_USERNAME_LENGTH+1];
+
+
+ /**
+ The unique user name that was used by the plugin to authenticate.
+ Not used by the server.
+ Available through the @@EXTERNAL_USER variable.
+ */
+ char external_user[512];
+
/**
This only affects the "Authentication failed. Password used: %s"
- error message. If set, %s will be YES, otherwise - NO.
+ error message. has the following values :
+ 0 : %s will be NO.
+ 1 : %s will be YES.
+ 2 : there will be no %s.
Set it as appropriate or ignore at will.
*/
int password_used;
+
+ /**
+ Set to the name of the connected client host, if it can be resolved,
+ or to its IP address otherwise.
+ */
+ const char *host_or_ip;
+
+ /**
+ Length of host_or_ip
+ */
+ unsigned int host_or_ip_length;
+
} MYSQL_SERVER_AUTH_INFO;
/**
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index bbd91a84f33..e65278c518e 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -33,16 +33,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
@@ -95,22 +102,6 @@ struct st_mysql_plugin
struct st_mysql_sys_var **system_vars;
void * __reserved1;
};
-struct st_maria_plugin
-{
- int type;
- void *info;
- const char *name;
- const char *author;
- const char *descr;
- int license;
- int (*init)(void *);
- int (*deinit)(void *);
- unsigned int version;
- struct st_mysql_show_var *status_vars;
- struct st_mysql_sys_var **system_vars;
- const char *version_info;
- unsigned int maturity;
-};
#include "plugin_ftparser.h"
#include "plugin.h"
enum enum_ftparser_mode
@@ -140,16 +131,16 @@ typedef struct st_mysql_ftparser_boolean_info
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const char *doc, int doc_len);
+ char *doc, int doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const char *word, int word_len,
+ char *word, int word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
- const struct charset_info_st *cs;
- const char *doc;
+ struct charset_info_st *cs;
+ char *doc;
int length;
- unsigned int flags;
+ int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
struct st_mysql_ftparser
@@ -187,14 +178,13 @@ int thd_in_lock_tables(const void* thd);
int thd_tablespace_op(const void* thd);
long long thd_test_options(const void* thd, long long test_options);
int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
void **thd_ha_data(const void* thd, const struct handlerton *hton);
void thd_storage_lock_wait(void* thd, long long value);
int thd_tx_isolation(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, const unsigned int line);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
@@ -223,10 +213,15 @@ typedef struct st_plugin_vio
} MYSQL_PLUGIN_VIO;
typedef struct st_mysql_server_auth_info
{
- const char *user_name;
+ char *user_name;
+ unsigned int user_name_length;
const char *auth_string;
+ unsigned long auth_string_length;
char authenticated_as[48 +1];
+ char external_user[512];
int password_used;
+ const char *host_or_ip;
+ unsigned int host_or_ip_length;
} MYSQL_SERVER_AUTH_INFO;
struct st_mysql_auth
{
diff --git a/include/mysql/plugin_auth_common.h b/include/mysql/plugin_auth_common.h
index b71591d6eb6..3c87fe7e094 100644
--- a/include/mysql/plugin_auth_common.h
+++ b/include/mysql/plugin_auth_common.h
@@ -1,5 +1,6 @@
#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab
+ Copyright (C) 2010 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/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 0d6a70ec19c..0067732d4fc 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -33,16 +33,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index de145f642e1..6fc6689c47d 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -16,6 +16,8 @@
#ifndef MYSQL_FILE_H
#define MYSQL_FILE_H
+#include <my_global.h>
+
/* For strlen() */
#include <string.h>
/* For MY_STAT */
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index 389c73d09e9..d20e89a26fd 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -141,9 +141,7 @@ typedef struct st_mysql_rwlock mysql_rwlock_t;
@c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t.
@sa mysql_prlock_init
@sa mysql_prlock_rdlock
- @sa mysql_prlock_tryrdlock
@sa mysql_prlock_wrlock
- @sa mysql_prlock_trywrlock
@sa mysql_prlock_unlock
@sa mysql_prlock_destroy
*/
@@ -421,20 +419,6 @@ typedef struct st_mysql_cond mysql_cond_t;
#endif
/**
- @def mysql_prlock_tryrdlock(RW)
- Instrumented rw_pr_tryrdlock.
- @c mysql_prlock_tryrdlock is a drop-in replacement
- for @c rw_pr_tryrdlock.
-*/
-#ifdef HAVE_PSI_INTERFACE
- #define mysql_prlock_tryrdlock(RW) \
- inline_mysql_prlock_tryrdlock(RW, __FILE__, __LINE__)
-#else
- #define mysql_prlock_tryrdlock(RW) \
- inline_mysql_prlock_tryrdlock(RW)
-#endif
-
-/**
@def mysql_rwlock_trywrlock(RW)
Instrumented rwlock_trywrlock.
@c mysql_rwlock_trywrlock is a drop-in replacement
@@ -449,20 +433,6 @@ typedef struct st_mysql_cond mysql_cond_t;
#endif
/**
- @def mysql_prlock_trywrlock(RW)
- Instrumented rw_pr_trywrlock.
- @c mysql_prlock_trywrlock is a drop-in replacement
- for @c rw_pr_trywrlock.
-*/
-#ifdef HAVE_PSI_INTERFACE
- #define mysql_prlock_trywrlock(RW) \
- inline_mysql_prlock_trywrlock(RW, __FILE__, __LINE__)
-#else
- #define mysql_prlock_trywrlock(RW) \
- inline_mysql_prlock_trywrlock(RW)
-#endif
-
-/**
@def mysql_rwlock_unlock(RW)
Instrumented rwlock_unlock.
@c mysql_rwlock_unlock is a drop-in replacement
@@ -905,35 +875,6 @@ static inline int inline_mysql_rwlock_tryrdlock(
return result;
}
-#ifndef DISABLE_MYSQL_PRLOCK_H
-static inline int inline_mysql_prlock_tryrdlock(
- mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
- , const char *src_file, uint src_line
-#endif
- )
-{
- int result;
-#ifdef HAVE_PSI_INTERFACE
- struct PSI_rwlock_locker *locker= NULL;
- PSI_rwlock_locker_state state;
- if (likely(PSI_server && that->m_psi))
- {
- locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
- PSI_RWLOCK_TRYREADLOCK);
- if (likely(locker != NULL))
- PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
- }
-#endif
- result= rw_pr_tryrdlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
- if (likely(locker != NULL))
- PSI_server->end_rwlock_rdwait(locker, result);
-#endif
- return result;
-}
-#endif
-
static inline int inline_mysql_rwlock_trywrlock(
mysql_rwlock_t *that
#ifdef HAVE_PSI_INTERFACE
@@ -961,35 +902,6 @@ static inline int inline_mysql_rwlock_trywrlock(
return result;
}
-#ifndef DISABLE_MYSQL_PRLOCK_H
-static inline int inline_mysql_prlock_trywrlock(
- mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
- , const char *src_file, uint src_line
-#endif
- )
-{
- int result;
-#ifdef HAVE_PSI_INTERFACE
- struct PSI_rwlock_locker *locker= NULL;
- PSI_rwlock_locker_state state;
- if (likely(PSI_server && that->m_psi))
- {
- locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
- PSI_RWLOCK_TRYWRITELOCK);
- if (likely(locker != NULL))
- PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
- }
-#endif
- result= rw_pr_trywrlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
- if (likely(locker != NULL))
- PSI_server->end_rwlock_wrwait(locker, result);
-#endif
- return result;
-}
-#endif
-
static inline int inline_mysql_rwlock_unlock(
mysql_rwlock_t *that)
{
diff --git a/include/mysql/service_thd_wait.h b/include/mysql/service_thd_wait.h
index 2a8f5e610a3..f5d2a75f5fc 100644
--- a/include/mysql/service_thd_wait.h
+++ b/include/mysql/service_thd_wait.h
@@ -50,15 +50,35 @@
extern "C" {
#endif
+/*
+ One should only report wait events that could potentially block for a
+ long time. A mutex wait is too short of an event to report. The reason
+ is that an event which is reported leads to a new thread starts
+ executing a query and this has a negative impact of usage of CPU caches
+ and thus the expected gain of starting a new thread must be higher than
+ the expected cost of lost performance due to starting a new thread.
+
+ Good examples of events that should be reported are waiting for row locks
+ that could easily be for many milliseconds or even seconds and the same
+ holds true for global read locks, table locks and other meta data locks.
+ Another event of interest is going to sleep for an extended time.
+*/
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type);
+ void (*thd_wait_begin_func)(MYSQL_THD, int);
void (*thd_wait_end_func)(MYSQL_THD);
} *thd_wait_service;
@@ -70,7 +90,7 @@ extern struct thd_wait_service_st {
#else
-void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type);
+void thd_wait_begin(MYSQL_THD thd, int wait_type);
void thd_wait_end(MYSQL_THD thd);
#endif
diff --git a/include/mysql/thread_pool_priv.h b/include/mysql/thread_pool_priv.h
new file mode 100644
index 00000000000..fc9a2bc6424
--- /dev/null
+++ b/include/mysql/thread_pool_priv.h
@@ -0,0 +1,121 @@
+/*
+ Copyright (C) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef THREAD_POOL_PRIV_INCLUDED
+#define THREAD_POOL_PRIV_INCLUDED
+
+/*
+ The thread pool requires access to some MySQL server error codes, this is
+ accessed from mysqld_error.h.
+ We need access to the struct that defines the thread pool plugin interface
+ which is accessed through scheduler.h.
+ All accesses to THD variables and functions are defined in this header file.
+ A thread pool can also use DEBUG_SYNC and must thus include
+ debug_sync.h
+ To handle definitions of Information Schema plugins it is also required
+ to include sql_profile.h and table.h.
+*/
+#include <mysqld_error.h> /* To get ER_ERROR_ON_READ */
+#define MYSQL_SERVER 1
+#include <scheduler.h>
+#include <debug_sync.h>
+#include <sql_profile.h>
+#include <table.h>
+
+/* Needed to get access to scheduler variables */
+void* thd_get_scheduler_data(THD *thd);
+void thd_set_scheduler_data(THD *thd, void *data);
+PSI_thread* thd_get_psi(THD *thd);
+void thd_set_psi(THD *thd, PSI_thread *psi);
+
+/* Interface to THD variables and functions */
+void thd_set_killed(THD *thd);
+void thd_clear_errors(THD *thd);
+void thd_set_thread_stack(THD *thd, char *stack_start);
+void thd_lock_thread_count(THD *thd);
+void thd_unlock_thread_count(THD *thd);
+void thd_close_connection(THD *thd);
+THD *thd_get_current_thd();
+void thd_new_connection_setup(THD *thd, char *stack_start);
+void thd_lock_data(THD *thd);
+void thd_unlock_data(THD *thd);
+bool thd_is_transaction_active(THD *thd);
+int thd_connection_has_data(THD *thd);
+void thd_set_net_read_write(THD *thd, uint val);
+void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
+my_socket thd_get_fd(THD *thd);
+
+/* Print to the MySQL error log */
+void sql_print_error(const char *format, ...);
+
+/* Store a table record */
+bool schema_table_store_record(THD *thd, TABLE *table);
+
+/*
+ The thread pool must be able to execute statements using the connection
+ state in THD object. This is the main objective of the thread pool to
+ schedule the start of these commands.
+*/
+bool do_command(THD *thd);
+
+/*
+ The thread pool requires an interface to the connection logic in the
+ MySQL Server since the thread pool will maintain the event logic on
+ the TCP connection of the MySQL Server. Thus new connections, dropped
+ connections will be discovered by the thread pool and it needs to
+ ensure that the proper MySQL Server logic attached to these events is
+ executed.
+*/
+/* Initialise a new connection handler thread */
+bool init_new_connection_handler_thread();
+/* Set up connection thread before use as execution thread */
+bool setup_connection_thread_globals(THD *thd);
+/* Prepare connection as part of connection set-up */
+bool thd_prepare_connection(THD *thd);
+/* Release auditing before executing statement */
+void mysql_audit_release(THD *thd);
+/* Check if connection is still alive */
+bool thd_is_connection_alive(THD *thd);
+/* Close connection with possible error code */
+void close_connection(THD *thd, uint errcode);
+/* End the connection before closing it */
+void end_connection(THD *thd);
+/* Cleanup the THD object */
+void thd_cleanup(THD *thd);
+/* Decrement connection counter */
+void dec_connection_count();
+/* Destroy THD object */
+void delete_thd(THD *thd);
+
+/*
+ thread_created is maintained by thread pool when activated since
+ user threads are created by the thread pool (and also special
+ threads to maintain the thread pool). This is done through
+ inc_thread_created.
+
+ max_connections is needed to calculate the maximum number of threads
+ that is allowed to be started by the thread pool. The method
+ get_max_connections() gets reference to this variable.
+
+ connection_attrib is the thread attributes for connection threads,
+ the method get_connection_attrib provides a reference to these
+ attributes.
+*/
+void inc_thread_created(void);
+ulong get_max_connections(void);
+pthread_attr_t *get_connection_attrib(void);
+#endif
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 4154b620208..7f2b4d53ec0 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -120,6 +120,10 @@ enum enum_server_command
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
+#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23,
+ reserved by MySQL Cluster */
+#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25,
+ reserved by MySQL Cluster */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
@@ -267,7 +271,11 @@ enum enum_server_command
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
SERVER_QUERY_NO_INDEX_USED|\
SERVER_MORE_RESULTS_EXISTS|\
- SERVER_STATUS_METADATA_CHANGED)
+ SERVER_STATUS_METADATA_CHANGED |\
+ SERVER_QUERY_WAS_SLOW |\
+ SERVER_STATUS_DB_DROPPED |\
+ SERVER_STATUS_CURSOR_EXISTS|\
+ SERVER_STATUS_LAST_ROW_SENT)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index ae70b9723f8..3b6f851bd6f 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -23,10 +23,8 @@
/* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
-#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_SMEM /* No shared memory */
-#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_EMBED_INCLUDED */
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 8b6a12ba36e..620b43bb317 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -65,8 +65,8 @@ extern const char *globerrs[]; /* my_error_messages is here */
#define EE_FILE_NOT_CLOSED 30
#define EE_CHANGE_OWNERSHIP 31
#define EE_CHANGE_PERMISSIONS 32
-#define EE_CANT_CHMOD 33
-#define EE_CANT_SEEK 34
+#define EE_CANT_SEEK 33
+#define EE_CANT_CHMOD 34
#define EE_CANT_COPY_OWNERSHIP 35
#define EE_ERROR_LAST 35 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 2ff975607cd..351041ac042 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -41,7 +41,7 @@ typedef struct st_alarm_info
void thr_alarm_info(ALARM_INFO *info);
-#if defined(DONT_USE_THR_ALARM) || !defined(THREAD)
+#if defined(DONT_USE_THR_ALARM)
#define USE_ALARM_THREAD
#undef USE_ONE_SIGNAL_HAND
diff --git a/include/typelib.h b/include/typelib.h
index 2879c745a3f..2cfe5e6c0da 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -29,9 +29,19 @@ typedef struct st_typelib { /* Different types saved here */
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
-extern uint find_type_or_exit(const char *x, TYPELIB *typelib,
- const char *option);
-extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+extern int find_type_or_exit(const char *x, TYPELIB *typelib,
+ const char *option);
+#define FIND_TYPE_BASIC 0
+/** makes @c find_type() require the whole name, no prefix */
+#define FIND_TYPE_NO_PREFIX (1 << 0)
+/** always implicitely on, so unused, but old code may pass it */
+#define FIND_TYPE_NO_OVERWRITE (1 << 1)
+/** makes @c find_type() accept a number */
+#define FIND_TYPE_ALLOW_NUMBER (1 << 2)
+/** makes @c find_type() treat ',' as terminator */
+#define FIND_TYPE_COMMA_TERM (1 << 3)
+
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
diff --git a/include/violite.h b/include/violite.h
index 896b024c8b7..ba057028ed2 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -93,6 +93,8 @@ ssize_t vio_pending(Vio *vio);
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
char *ip_string, size_t ip_string_size);
+my_bool vio_is_no_name_error(int err_code);
+
int vio_getnameinfo(const struct sockaddr *sa,
char *hostname, size_t hostname_size,
char *port, size_t port_size,
@@ -132,13 +134,13 @@ struct st_VioSSLFd
SSL_CTX *ssl_context;
};
-int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, char *error_string);
-int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, char *error_string);
+int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
+int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
struct st_VioSSLFd
*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
const char *ca_file, const char *ca_path,
- const char *cipher);
+ const char *cipher, enum enum_ssl_init_error* error);
struct st_VioSSLFd
*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
const char *ca_file,const char *ca_path,
diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h
new file mode 100644
index 00000000000..b4a2828f4a8
--- /dev/null
+++ b/include/welcome_copyright_notice.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef _welcome_copyright_notice_h_
+#define _welcome_copyright_notice_h_
+
+/*
+ This define specifies copyright notice which is displayed by every MySQL
+ program on start, or on help screen.
+*/
+#define ORACLE_WELCOME_COPYRIGHT_NOTICE(years) \
+ "Copyright (c) " years ", Oracle and/or its affiliates. All rights reserved.\n" \
+ "2009-2011 Monty Program Ab\n" \
+ "\n" \
+ "This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" \
+ "and you are welcome to modify and redistribute it under the GPL license\n"
+
+#endif /* _welcome_copyright_notice_h_ */