summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/big_endian.h82
-rw-r--r--include/byte_order_generic.h95
-rw-r--r--include/byte_order_generic_x86.h97
-rw-r--r--include/byte_order_generic_x86_64.h83
-rw-r--r--include/crypt_genhash_impl.h32
-rw-r--r--include/errmsg.h12
-rw-r--r--include/ft_global.h21
-rw-r--r--include/little_endian.h75
-rw-r--r--include/m_ctype.h4
-rw-r--r--include/my_base.h58
-rw-r--r--include/my_byteorder.h54
-rw-r--r--include/my_default.h50
-rw-r--r--include/my_getopt.h5
-rw-r--r--include/my_global.h304
-rw-r--r--include/my_handler_errors.h4
-rw-r--r--include/my_md5.h94
-rw-r--r--include/my_rnd.h32
-rw-r--r--include/my_sys.h65
-rw-r--r--include/my_time.h4
-rw-r--r--include/mysql/client_authentication.h13
-rw-r--r--include/mysql/plugin.h12
-rw-r--r--include/mysql/plugin_audit.h.pp2
-rw-r--r--include/mysql/plugin_auth.h.pp2
-rw-r--r--include/mysql/plugin_ftparser.h.pp2
-rw-r--r--include/mysql/psi/mysql_file.h249
-rw-r--r--include/mysql/psi/mysql_idle.h4
-rw-r--r--include/mysql/psi/mysql_socket.h178
-rw-r--r--include/mysql/psi/mysql_stage.h4
-rw-r--r--include/mysql/psi/mysql_statement.h33
-rw-r--r--include/mysql/psi/mysql_table.h69
-rw-r--r--include/mysql/psi/mysql_thread.h80
-rw-r--r--include/mysql/psi/psi.h120
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp28
-rw-r--r--include/mysql/service_debug_sync.h11
-rw-r--r--include/mysql/service_my_plugin_log.h64
-rw-r--r--include/mysql_com.h44
-rw-r--r--include/password.h2
-rw-r--r--include/sha1.h81
-rw-r--r--include/thread_pool_priv.h1
39 files changed, 1337 insertions, 833 deletions
diff --git a/include/big_endian.h b/include/big_endian.h
new file mode 100644
index 00000000000..021b6abc383
--- /dev/null
+++ b/include/big_endian.h
@@ -0,0 +1,82 @@
+/* Copyright (c) 2012, 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 02111-1307 USA */
+
+/*
+ Data in big-endian format.
+*/
+#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
+ *((T)+1)=(char) ((uchar *) &A)[2];\
+ *((T)+2)=(char) ((uchar *) &A)[1];\
+ *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
+
+#define float4get(V,M) do { float def_temp;\
+ ((uchar*) &def_temp)[0]=(M)[3];\
+ ((uchar*) &def_temp)[1]=(M)[2];\
+ ((uchar*) &def_temp)[2]=(M)[1];\
+ ((uchar*) &def_temp)[3]=(M)[0];\
+ (V)=def_temp; } while(0)
+
+#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
+ *((T)+1)=(char) ((uchar *) &V)[6];\
+ *((T)+2)=(char) ((uchar *) &V)[5];\
+ *((T)+3)=(char) ((uchar *) &V)[4];\
+ *((T)+4)=(char) ((uchar *) &V)[3];\
+ *((T)+5)=(char) ((uchar *) &V)[2];\
+ *((T)+6)=(char) ((uchar *) &V)[1];\
+ *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
+
+#define float8get(V,M) do { double def_temp;\
+ ((uchar*) &def_temp)[0]=(M)[7];\
+ ((uchar*) &def_temp)[1]=(M)[6];\
+ ((uchar*) &def_temp)[2]=(M)[5];\
+ ((uchar*) &def_temp)[3]=(M)[4];\
+ ((uchar*) &def_temp)[4]=(M)[3];\
+ ((uchar*) &def_temp)[5]=(M)[2];\
+ ((uchar*) &def_temp)[6]=(M)[1];\
+ ((uchar*) &def_temp)[7]=(M)[0];\
+ (V) = def_temp; } while(0)
+
+#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
+ ((uint16) ((uint16) (M)[0]) << 8)); } while(0)
+#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\
+ ((short) ((short) (M)[0]) << 8)); } while(0)
+#define longget(V,M) do { int32 def_temp;\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
+ (V)=def_temp; } while(0)
+#define ulongget(V,M) do { uint32 def_temp;\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
+ (V)=def_temp; } while(0)
+#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
+ *(((char*)T)+1)=(char)(def_temp); \
+ *(((char*)T)+0)=(char)(def_temp >> 8); } while(0)
+#define longstore(T,A) do { *(((char*)T)+3)=((A));\
+ *(((char*)T)+2)=(((A) >> 8));\
+ *(((char*)T)+1)=(((A) >> 16));\
+ *(((char*)T)+0)=(((A) >> 24)); } while(0)
+
+#define floatget(V,M) memcpy(&V, (M), sizeof(float))
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float))
+#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define doublestore(T,V) memcpy((T), (void*) &V, sizeof(double))
+#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
+#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
diff --git a/include/byte_order_generic.h b/include/byte_order_generic.h
new file mode 100644
index 00000000000..d4ac27eeb9c
--- /dev/null
+++ b/include/byte_order_generic.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2001, 2012, 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 02111-1307 USA */
+
+/*
+ Endianness-independent definitions for architectures other
+ than the x86 architecture.
+*/
+#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
+ ((int16) ((int16) (A)[1]) << 8))
+#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
+ (((uint32) 255L << 24) | \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])) : \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])))
+#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
+ (((int32) ((uchar) (A)[1]) << 8)) +\
+ (((int32) ((uchar) (A)[2]) << 16)) +\
+ (((int32) ((int16) (A)[3]) << 24)))
+#define sint8korr(A) (longlong) uint8korr(A)
+#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
+ ((uint16) ((uchar) (A)[1]) << 8))
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16))
+#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16) +\
+ (((uint32) ((uchar) (A)[3])) << 24))
+#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16) +\
+ (((uint32) ((uchar) (A)[3])) << 24)) +\
+ (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
+ (((uint32) ((uchar) (A)[1])) << 8) + \
+ (((uint32) ((uchar) (A)[2])) << 16) + \
+ (((uint32) ((uchar) (A)[3])) << 24)) + \
+ (((ulonglong) ((uchar) (A)[4])) << 32) + \
+ (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16) +\
+ (((uint32) ((uchar) (A)[3])) << 24)) +\
+ (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
+ (((uint32) ((uchar) (A)[5])) << 8) +\
+ (((uint32) ((uchar) (A)[6])) << 16) +\
+ (((uint32) ((uchar) (A)[7])) << 24))) <<\
+ 32))
+#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
+ *((uchar*) (T))= (uchar)(def_temp); \
+ *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
+ } while(0)
+#define int3store(T,A) do { /*lint -save -e734 */\
+ *((uchar*)(T))=(uchar) ((A));\
+ *((uchar*) (T)+1)=(uchar) (((A) >> 8));\
+ *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
+ /*lint -restore */} while(0)
+#define int4store(T,A) do { *((char *)(T))=(char) ((A));\
+ *(((char *)(T))+1)=(char) (((A) >> 8));\
+ *(((char *)(T))+2)=(char) (((A) >> 16));\
+ *(((char *)(T))+3)=(char) (((A) >> 24));\
+ } while(0)
+#define int5store(T,A) do { *((char *)(T))= (char)((A)); \
+ *(((char *)(T))+1)= (char)(((A) >> 8)); \
+ *(((char *)(T))+2)= (char)(((A) >> 16)); \
+ *(((char *)(T))+3)= (char)(((A) >> 24)); \
+ *(((char *)(T))+4)= (char)(((A) >> 32)); \
+ } while(0)
+#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
+ *(((char *)(T))+1)= (char)(((A) >> 8)); \
+ *(((char *)(T))+2)= (char)(((A) >> 16)); \
+ *(((char *)(T))+3)= (char)(((A) >> 24)); \
+ *(((char *)(T))+4)= (char)(((A) >> 32)); \
+ *(((char *)(T))+5)= (char)(((A) >> 40)); \
+ } while(0)
+#define int8store(T,A) do { uint def_temp= (uint) (A), \
+ def_temp2= (uint) ((A) >> 32); \
+ int4store((T),def_temp); \
+ int4store((T+4),def_temp2);\
+ } while(0)
diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h
new file mode 100644
index 00000000000..0a71a17829b
--- /dev/null
+++ b/include/byte_order_generic_x86.h
@@ -0,0 +1,97 @@
+/* Copyright (c) 2001, 2012, 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 02111-1307 USA */
+
+/*
+ Optimized function-like macros for the x86 architecture (_WIN32 included).
+*/
+#define sint2korr(A) (*((const int16 *) (A)))
+#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
+ (((uint32) 255L << 24) | \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])) : \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])))
+#define sint4korr(A) (*((const long *) (A)))
+#define uint2korr(A) (*((const uint16 *) (A)))
+
+/*
+ Attention: Please, note, uint3korr reads 4 bytes (not 3)!
+ It means, that you have to provide enough allocated space.
+*/
+#if defined(HAVE_valgrind) && !defined(_WIN32)
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16))
+#else
+#define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF)
+#endif
+
+#define uint4korr(A) (*((const uint32 *) (A)))
+#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16) +\
+ (((uint32) ((uchar) (A)[3])) << 24)) +\
+ (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
+ (((uint32) ((uchar) (A)[1])) << 8) + \
+ (((uint32) ((uchar) (A)[2])) << 16) + \
+ (((uint32) ((uchar) (A)[3])) << 24)) + \
+ (((ulonglong) ((uchar) (A)[4])) << 32) + \
+ (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A) (*((const ulonglong *) (A)))
+#define sint8korr(A) (*((const longlong *) (A)))
+
+#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
+#define int3store(T,A) do { *(T)= (uchar) ((A));\
+ *(T+1)=(uchar) (((uint) (A) >> 8));\
+ *(T+2)=(uchar) (((A) >> 16));\
+ } while (0)
+#define int4store(T,A) *((long *) (T))= (long) (A)
+#define int5store(T,A) do { *(T)= (uchar)((A));\
+ *((T)+1)=(uchar) (((A) >> 8));\
+ *((T)+2)=(uchar) (((A) >> 16));\
+ *((T)+3)=(uchar) (((A) >> 24));\
+ *((T)+4)=(uchar) (((A) >> 32));\
+ } while(0)
+#define int6store(T,A) do { *(T)= (uchar)((A)); \
+ *((T)+1)=(uchar) (((A) >> 8)); \
+ *((T)+2)=(uchar) (((A) >> 16)); \
+ *((T)+3)=(uchar) (((A) >> 24)); \
+ *((T)+4)=(uchar) (((A) >> 32)); \
+ *((T)+5)=(uchar) (((A) >> 40)); \
+ } while(0)
+#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
+typedef union {
+ double v;
+ long m[2];
+} doubleget_union;
+#define doubleget(V,M) \
+do { doubleget_union _tmp; \
+ _tmp.m[0] = *((const long*)(M)); \
+ _tmp.m[1] = *(((const long*) (M))+1); \
+ (V) = _tmp.v; } while(0)
+#define doublestore(T,V) \
+do { *((long *) T) = ((const doubleget_union *)&V)->m[0]; \
+ *(((long *) T)+1) = ((const doubleget_union *)&V)->m[1]; \
+ } while (0)
+#define float4get(V,M) \
+do { *((float *) &(V)) = *((const float*) (M)); } while(0)
+#define float8get(V,M) doubleget((V),(M))
+#define float4store(V,M) memcpy((uchar*)(V), (uchar*)(&M), sizeof(float))
+#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float))
+#define floatget(V,M) memcpy((uchar*)(&V),(uchar*) (M), sizeof(float))
+#define float8store(V,M) doublestore((V),(M))
diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h
new file mode 100644
index 00000000000..877c1574dfa
--- /dev/null
+++ b/include/byte_order_generic_x86_64.h
@@ -0,0 +1,83 @@
+/* Copyright (c) 2001, 2012, 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 02111-1307 USA */
+
+/*
+ Optimized function-like macros for the x86 architecture (_WIN32 included).
+*/
+#define sint2korr(A) (int16) (*((int16 *) (A)))
+#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
+ (((uint32) 255L << 24) | \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])) : \
+ (((uint32) (uchar) (A)[2]) << 16) |\
+ (((uint32) (uchar) (A)[1]) << 8) | \
+ ((uint32) (uchar) (A)[0])))
+#define sint4korr(A) (int32) (*((int32 *) (A)))
+#define uint2korr(A) (uint16) (*((uint16 *) (A)))
+/*
+ Attention: Please, note, uint3korr reads 4 bytes (not 3)!
+ It means, that you have to provide enough allocated space.
+*/
+#if defined(HAVE_purify) && !defined(_WIN32)
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16))
+#else
+#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF)
+#endif
+#define uint4korr(A) (uint32) (*((uint32 *) (A)))
+#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+ (((uint32) ((uchar) (A)[1])) << 8) +\
+ (((uint32) ((uchar) (A)[2])) << 16) +\
+ (((uint32) ((uchar) (A)[3])) << 24)) +\
+ (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
+ (((uint32) ((uchar) (A)[1])) << 8) + \
+ (((uint32) ((uchar) (A)[2])) << 16) + \
+ (((uint32) ((uchar) (A)[3])) << 24)) + \
+ (((ulonglong) ((uchar) (A)[4])) << 32) + \
+ (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A) (ulonglong) (*((ulonglong *) (A)))
+#define sint8korr(A) (longlong) (*((longlong *) (A)))
+
+#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
+ *((uint16*)(pT))= (uint16) (A);\
+ } while (0)
+
+#define int3store(T,A) do { *(T)= (uchar) ((A));\
+ *(T+1)=(uchar) (((uint) (A) >> 8));\
+ *(T+2)=(uchar) (((A) >> 16));\
+ } while (0)
+#define int4store(T,A) do { uchar *pT= (uchar*)(T);\
+ *((uint32 *) (pT))= (uint32) (A); \
+ } while (0)
+
+#define int5store(T,A) do { *(T)= (uchar)((A));\
+ *((T)+1)=(uchar) (((A) >> 8));\
+ *((T)+2)=(uchar) (((A) >> 16));\
+ *((T)+3)=(uchar) (((A) >> 24));\
+ *((T)+4)=(uchar) (((A) >> 32));\
+ } while(0)
+#define int6store(T,A) do { *(T)= (uchar)((A)); \
+ *((T)+1)=(uchar) (((A) >> 8)); \
+ *((T)+2)=(uchar) (((A) >> 16)); \
+ *((T)+3)=(uchar) (((A) >> 24)); \
+ *((T)+4)=(uchar) (((A) >> 32)); \
+ *((T)+5)=(uchar) (((A) >> 40)); \
+ } while(0)
+#define int8store(T,A) do { uchar *pT= (uchar*)(T);\
+ *((ulonglong *) (pT))= (ulonglong) (A);\
+ } while(0)
diff --git a/include/crypt_genhash_impl.h b/include/crypt_genhash_impl.h
new file mode 100644
index 00000000000..af5afd23e86
--- /dev/null
+++ b/include/crypt_genhash_impl.h
@@ -0,0 +1,32 @@
+/* defines and prototypes for using crypt_genhash_impl.cc */
+
+#ifndef CRYPT_HASHGEN_IMPL_H
+#define CRYPT_HASHGEN_IMPL_H
+#define ROUNDS_DEFAULT 5000
+#define ROUNDS_MIN 1000
+#define ROUNDS_MAX 999999999
+#define MIXCHARS 32
+#define CRYPT_SALT_LENGTH 20
+#define CRYPT_MAGIC_LENGTH 3
+#define CRYPT_PARAM_LENGTH 13
+#define SHA256_HASH_LENGTH 43
+#define CRYPT_MAX_PASSWORD_SIZE (CRYPT_SALT_LENGTH + \
+ SHA256_HASH_LENGTH + \
+ CRYPT_MAGIC_LENGTH + \
+ CRYPT_PARAM_LENGTH)
+
+int extract_user_salt(char **salt_begin,
+ char **salt_end);
+C_MODE_START
+char *
+my_crypt_genhash(char *ctbuffer,
+ size_t ctbufflen,
+ const char *plaintext,
+ int plaintext_len,
+ const char *switchsalt,
+ const char **params);
+void generate_user_salt(char *buffer, int buffer_len);
+void xor_string(char *to, int to_len, char *pattern, int pattern_len);
+
+C_MODE_END
+#endif
diff --git a/include/errmsg.h b/include/errmsg.h
index 64ec2df395c..b839060a881 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -16,8 +16,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-/* Error messages for MySQL clients */
-/* (Error messages for the daemon are in sql/share/errmsg.txt) */
+/*
+ Error messages numbers for MySQL clients.
+ The error messages itself are in libmysql/errmsg.c
+
+ Error messages for the mysqld daemon are in sql/share/errmsg.txt
+*/
#ifdef __cplusplus
extern "C" {
@@ -102,7 +106,9 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NEW_STMT_METADATA 2057
#define CR_ALREADY_CONNECTED 2058
#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
-#define CR_ERROR_LAST /*Copy last error nr:*/ 2059
+#define CR_DUPLICATE_CONNECTION_ATTR 2060
+#define CR_AUTH_PLUGIN_ERR 2061
+#define CR_ERROR_LAST /*Copy last error nr:*/ 2061
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
#endif /* ERRMSG_INCLUDED */
diff --git a/include/ft_global.h b/include/ft_global.h
index 8a1069d6e62..8a77cbca014 100644
--- a/include/ft_global.h
+++ b/include/ft_global.h
@@ -43,11 +43,32 @@ struct _ft_vft
void (*reinit_search)(FT_INFO *);
};
+typedef struct st_ft_info_ext FT_INFO_EXT;
+struct _ft_vft_ext
+{
+ uint (*get_version)(); // Extended API version
+ ulonglong (*get_flags)();
+ ulonglong (*get_docid)(FT_INFO_EXT *);
+ ulonglong (*count_matches)(FT_INFO_EXT *);
+};
+
+/* Flags for extended FT API */
+#define FTS_ORDERED_RESULT (LL(1) << 1)
+#define FTS_DOCID_IN_RESULT (LL(1) << 2)
+
+#define FTS_DOC_ID_COL_NAME "FTS_DOC_ID"
+
#ifndef FT_CORE
struct st_ft_info
{
struct _ft_vft *please; /* INTERCAL style :-) */
};
+
+struct st_ft_info_ext
+{
+ struct _ft_vft *please; /* INTERCAL style :-) */
+ struct _ft_vft_ext *could_you;
+};
#endif
extern const char *ft_stopword_file;
diff --git a/include/little_endian.h b/include/little_endian.h
new file mode 100644
index 00000000000..7223fea648f
--- /dev/null
+++ b/include/little_endian.h
@@ -0,0 +1,75 @@
+/* Copyright (c) 2012, 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 02111-1307 USA */
+
+/*
+ Data in little-endian format.
+*/
+
+#ifndef MY_BYTE_ORDER_ARCH_OPTIMIZED
+#define float4get(V,M) memcpy(&V, (M), sizeof(float))
+#define float4store(V,M) memcpy(V, (&M), sizeof(float))
+#define float8get(V,M) doubleget((V),(M))
+#define float8store(V,M) doublestore((V),(M))
+
+/* Bi-endian hardware.... */
+#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
+#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
+ *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
+ *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
+ *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
+ *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
+ *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
+ *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
+ *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
+ while(0)
+#define doubleget(V,M) do { double def_temp;\
+ ((uchar*) &def_temp)[0]=(M)[4];\
+ ((uchar*) &def_temp)[1]=(M)[5];\
+ ((uchar*) &def_temp)[2]=(M)[6];\
+ ((uchar*) &def_temp)[3]=(M)[7];\
+ ((uchar*) &def_temp)[4]=(M)[0];\
+ ((uchar*) &def_temp)[5]=(M)[1];\
+ ((uchar*) &def_temp)[6]=(M)[2];\
+ ((uchar*) &def_temp)[7]=(M)[3];\
+ (V) = def_temp; } while(0)
+#else /* Bi-endian hardware.... */
+
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define doublestore(T,V) memcpy((T), (void*) &V, sizeof(double))
+#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
+
+#endif /* Bi-endian hardware.... */
+
+#endif /* !MY_BYTE_ORDER_ARCH_OPTIMIZED */
+
+#define ushortget(V,M) do { uchar *pM= (uchar*)(M);V = uint2korr(pM);} while(0)
+#define shortget(V,M) do { uchar *pM= (uchar*)(M);V = sint2korr(pM);} while(0)
+#define longget(V,M) do { uchar *pM= (uchar*)(M);V = sint4korr(pM);} while(0)
+#define ulongget(V,M) do { uchar *pM= (uchar*)(M);V = uint4korr(pM);} while(0)
+#define shortstore(T,V) int2store(T,V)
+#define longstore(T,V) int4store(T,V)
+
+#ifndef floatstore
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float))
+#define floatget(V,M) memcpy(&V, (M), sizeof(float))
+#endif
+#ifndef doubleget
+#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
+#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
+#endif /* doubleget */
+
+#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
+#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 969cb0058ac..5d2a6f80b75 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -588,6 +588,10 @@ my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs);
extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap);
+uint32 my_convert(char *to, uint32 to_length, const CHARSET_INFO *to_cs,
+ const char *from, uint32 from_length,
+ const CHARSET_INFO *from_cs, uint *errors);
+
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */
diff --git a/include/my_base.h b/include/my_base.h
index 4cbcb00425b..18b75f88393 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -46,7 +46,8 @@
#define HA_OPEN_COPY 256 /* Open copy (for repair) */
/* Internal temp table, used for temporary results */
#define HA_OPEN_INTERNAL_TABLE 512
-#define HA_OPEN_MERGE_TABLE 1024
+#define HA_OPEN_NO_PSI_CALL 1024 /* Don't call/connect PSI */
+#define HA_OPEN_MERGE_TABLE 2048
/* The following is parameter to ha_rkey() how to use key */
@@ -194,6 +195,11 @@ enum ha_extra_function {
HA_EXTRA_ATTACH_CHILDREN,
HA_EXTRA_IS_ATTACHED_CHILDREN,
HA_EXTRA_DETACH_CHILDREN,
+ /*
+ Prepare table for export
+ (e.g. quiesce the table and write table metadata).
+ */
+ HA_EXTRA_EXPORT,
HA_EXTRA_DETACH_CHILD,
/* Inform handler we will force a close as part of flush */
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE
@@ -317,6 +323,23 @@ enum ha_base_keytype {
#define HA_OPTION_RELIES_ON_SQL_LAYER 512
#define HA_OPTION_NULL_FIELDS 1024
#define HA_OPTION_PAGE_CHECKSUM 2048
+/*
+ STATS_PERSISTENT=1 has been specified in the SQL command (either CREATE
+ or ALTER TABLE). Table and index statistics that are collected by the
+ storage engine and used by the optimizer for query optimization will be
+ stored on disk and will not change after a server restart.
+*/
+#define HA_OPTION_STATS_PERSISTENT 4096
+/*
+ STATS_PERSISTENT=0 has been specified in CREATE/ALTER TABLE. Statistics
+ for the table will be wiped away on server shutdown and new ones recalculated
+ after the server is started again. If none of HA_OPTION_STATS_PERSISTENT or
+ HA_OPTION_NO_STATS_PERSISTENT is set, this means that the setting is not
+ explicitly set at table level and the corresponding table will use whatever
+ is the global server default.
+*/
+#define HA_OPTION_NO_STATS_PERSISTENT 8192
+
/* .frm has extra create options in linked-list format */
#define HA_OPTION_TEXT_CREATE_OPTIONS (1L << 14)
#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */
@@ -334,7 +357,7 @@ enum ha_base_keytype {
#define HA_CREATE_PAGE_CHECKSUM 32
#define HA_CREATE_DELAY_KEY_WRITE 64
#define HA_CREATE_RELIES_ON_SQL_LAYER 128
-
+#define HA_CREATE_INTERNAL_TABLE 256
/* Flags used by start_bulk_insert */
@@ -458,7 +481,8 @@ enum ha_base_keytype {
/* It is not possible to log this statement */
#define HA_ERR_LOGGING_IMPOSSIBLE 170
/* The event was corrupt, leading to illegal data being read */
-#define HA_ERR_CORRUPT_EVENT 171
+#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to
+ illegal data being read */
#define HA_ERR_NEW_FILE 172 /* New file format */
/* The event could not be processed no other handler error happened */
#define HA_ERR_ROWS_EVENT_APPLY 173
@@ -466,16 +490,19 @@ enum ha_base_keytype {
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
+/* There's no explicitly listed partition in table for the given value */
#define HA_ERR_NOT_IN_LOCK_PARTITIONS 178
#define HA_ERR_INDEX_COL_TOO_LONG 179 /* Index column length exceeds limit */
#define HA_ERR_INDEX_CORRUPT 180 /* Index corrupted */
#define HA_ERR_UNDO_REC_TOO_BIG 181 /* Undo log record too big */
-#define HA_ERR_TABLE_IN_FK_CHECK 182 /* Table being used in foreign key check */
-#define HA_FTS_INVALID_DOCID 183 /* Invalid InnoDB Doc ID */
-#define HA_ERR_ROW_NOT_VISIBLE 184
-#define HA_ERR_ABORTED_BY_USER 185
-#define HA_ERR_DISK_FULL 186
-#define HA_ERR_LAST 186 /* Copy of last error nr */
+#define HA_FTS_INVALID_DOCID 182 /* Invalid InnoDB Doc ID */
+#define HA_ERR_TABLE_IN_FK_CHECK 183 /* Table being used in foreign key check */
+#define HA_ERR_TABLESPACE_EXISTS 184 /* The tablespace existed in storage engine */
+#define HA_ERR_TOO_MANY_FIELDS 185 /* Table has too many columns */
+#define HA_ERR_ROW_NOT_VISIBLE 186
+#define HA_ERR_ABORTED_BY_USER 187
+#define HA_ERR_DISK_FULL 188
+#define HA_ERR_LAST 188 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
@@ -608,4 +635,17 @@ C_MODE_START
typedef void (* invalidator_by_filename)(const char * filename);
C_MODE_END
+
+enum durability_properties
+{
+ /*
+ Preserves the durability properties defined by the engine */
+ HA_REGULAR_DURABILITY= 0,
+ /*
+ Ignore the durability properties defined by the engine and
+ write only in-memory entries.
+ */
+ HA_IGNORE_DURABILITY= 1
+};
+
#endif /* _my_base_h */
diff --git a/include/my_byteorder.h b/include/my_byteorder.h
new file mode 100644
index 00000000000..1f29248bfb2
--- /dev/null
+++ b/include/my_byteorder.h
@@ -0,0 +1,54 @@
+#ifndef MY_BYTEORDER_INCLUDED
+#define MY_BYTEORDER_INCLUDED
+
+/* Copyright (c) 2001, 2012, 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 */
+
+
+/*
+ Macro for reading 32-bit integer from network byte order (big-endian)
+ from an unaligned memory location.
+*/
+#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) | \
+ (((uint32) ((uchar) (A)[2])) << 8) | \
+ (((uint32) ((uchar) (A)[1])) << 16) | \
+ (((uint32) ((uchar) (A)[0])) << 24))
+
+/*
+ Function-like macros for reading and storing in machine independent
+ format (low byte first). There are 'korr' (assume 'corrector') variants
+ for integer types, but 'get' (assume 'getter') for floating point types.
+*/
+#if defined(__i386__) || defined(_WIN32)
+#define MY_BYTE_ORDER_ARCH_OPTIMIZED
+#include "byte_order_generic_x86.h"
+#elif defined(__x86_64__)
+#include "byte_order_generic_x86_64.h"
+#else
+#include "byte_order_generic.h"
+#endif
+
+/*
+ Function-like macros for reading and storing in machine format from/to
+ short/long to/from some place in memory V should be a variable (not on
+ a register) and M a pointer to byte.
+*/
+#ifdef WORDS_BIGENDIAN
+#include "big_endian.h"
+#else
+#include "little_endian.h"
+#endif
+
+#endif /* MY_BYTEORDER_INCLUDED */
diff --git a/include/my_default.h b/include/my_default.h
new file mode 100644
index 00000000000..1d556de69ee
--- /dev/null
+++ b/include/my_default.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 2013 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 */
+
+/* Definitions for mysys/my_default.c */
+
+#ifndef MY_DEFAULT_INCLUDED
+#define MY_DEFAULT_INCLUDED
+
+C_MODE_START
+
+extern const char *my_defaults_extra_file;
+extern const char *my_defaults_group_suffix;
+extern const char *my_defaults_file;
+extern my_bool my_getopt_use_args_separator;
+extern my_bool my_getopt_is_args_separator(const char* arg);
+
+/* Define the type of function to be passed to process_default_option_files */
+typedef int (*Process_option_func)(void *ctx, const char *group_name,
+ const char *option);
+
+extern int get_defaults_options(int argc, char **argv,
+ char **defaults, char **extra_defaults,
+ char **group_suffix);
+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,
+ int *argc, char ***argv);
+extern int my_search_option_files(const char *conf_file, int *argc,
+ char ***argv, uint *args_used,
+ Process_option_func func, void *func_ctx,
+ const char **default_directories);
+extern void free_defaults(char **argv);
+extern void my_print_default_files(const char *conf_file);
+extern void print_defaults(const char *conf_file, const char **groups);
+
+C_MODE_END
+
+#endif /* MY_DEFAULT_INCLUDED */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 589d9c9880c..2cbbca9cab9 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -17,7 +17,9 @@
#ifndef _my_getopt_h
#define _my_getopt_h
-#include "my_sys.h" /* loglevel */
+#include "my_sys.h" /* loglevel */
+/* my_getopt and my_default are almost always used together */
+#include <my_default.h>
C_MODE_START
@@ -85,7 +87,6 @@ struct my_option
void *app_type; /**< To be used by an application */
};
-
typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
/**
diff --git a/include/my_global.h b/include/my_global.h
index 7c133268f59..db71a60238f 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -49,11 +49,6 @@
#define _POSIX_THREAD_CPUTIME
#endif /* __CYGWIN__ */
-/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#define USE_PRAGMA_INTERFACE
-#endif
-
#if defined(__OpenBSD__) && (OpenBSD >= 200411)
#define HAVE_ERRNO_AS_DEFINE
#endif
@@ -117,6 +112,7 @@
/* Define missing access() modes. */
#define F_OK 0
#define W_OK 2
+#define R_OK 4 /* Test for read permission. */
/* Define missing file locking constants. */
#define F_RDLCK 1
@@ -335,6 +331,9 @@ C_MODE_END
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_SYS_TIMEB_H
+#include <sys/timeb.h> /* Avoid warnings on SCO */
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -1047,296 +1046,7 @@ typedef char my_bool; /* Small bool */
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
#define MY_HOW_OFTEN_TO_WRITE 10000 /* How often we want info on screen */
-/*
- Define-funktions for reading and storing in machine independent format
- (low byte first)
-*/
-
-/* Optimized store functions for Intel x86 */
-#if defined(__i386__) || defined(_WIN32)
-#define sint2korr(A) (*((const int16 *) (A)))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (*((const long *) (A)))
-#define uint2korr(A) (*((const uint16 *) (A)))
-#if defined(HAVE_valgrind) && !defined(_WIN32)
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16))
-#else
-/*
- ATTENTION !
-
- Please, note, uint3korr reads 4 bytes (not 3) !
- It means, that you have to provide enough allocated space !
-*/
-#define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF)
-#endif /* HAVE_valgrind && !_WIN32 */
-#define uint4korr(A) (*((const uint32 *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
- (((uint32) ((uchar) (A)[1])) << 8) + \
- (((uint32) ((uchar) (A)[2])) << 16) + \
- (((uint32) ((uchar) (A)[3])) << 24)) + \
- (((ulonglong) ((uchar) (A)[4])) << 32) + \
- (((ulonglong) ((uchar) (A)[5])) << 40))
-#define uint8korr(A) (*((const ulonglong *) (A)))
-#define sint8korr(A) (*((const longlong *) (A)))
-#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
-#define int3store(T,A) do { *(T)= (uchar) ((A));\
- *(T+1)=(uchar) (((uint) (A) >> 8));\
- *(T+2)=(uchar) (((A) >> 16)); } while (0)
-#define int4store(T,A) *((long *) (T))= (long) (A)
-#define int5store(T,A) do { *(T)= (uchar)((A));\
- *((T)+1)=(uchar) (((A) >> 8));\
- *((T)+2)=(uchar) (((A) >> 16));\
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); } while(0)
-#define int6store(T,A) do { *(T)= (uchar)((A)); \
- *((T)+1)=(uchar) (((A) >> 8)); \
- *((T)+2)=(uchar) (((A) >> 16)); \
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); \
- *((T)+5)=(uchar) (((A) >> 40)); } while(0)
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
-
-typedef union {
- double v;
- long m[2];
-} doubleget_union;
-#define doubleget(V,M) \
-do { doubleget_union _tmp; \
- _tmp.m[0] = *((const long*)(M)); \
- _tmp.m[1] = *(((const long*) (M))+1); \
- (V) = _tmp.v; } while(0)
-#define doublestore(T,V) do { *((long *) T) = ((const doubleget_union *)&V)->m[0]; \
- *(((long *) T)+1) = ((const doubleget_union *)&V)->m[1]; \
- } while (0)
-#define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0)
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
-#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
-#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-#else
-
-/*
- We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines
- were done before)
-*/
-#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
- ((int16) ((int16) (A)[1]) << 8))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
- (((int32) ((uchar) (A)[1]) << 8)) +\
- (((int32) ((uchar) (A)[2]) << 16)) +\
- (((int32) ((int16) (A)[3]) << 24)))
-#define sint8korr(A) (longlong) uint8korr(A)
-#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
- ((uint16) ((uchar) (A)[1]) << 8))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16))
-#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
- (((uint32) ((uchar) (A)[1])) << 8) + \
- (((uint32) ((uchar) (A)[2])) << 16) + \
- (((uint32) ((uchar) (A)[3])) << 24)) + \
- (((ulonglong) ((uchar) (A)[4])) << 32) + \
- (((ulonglong) ((uchar) (A)[5])) << 40))
-#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
- (((uint32) ((uchar) (A)[5])) << 8) +\
- (((uint32) ((uchar) (A)[6])) << 16) +\
- (((uint32) ((uchar) (A)[7])) << 24))) <<\
- 32))
-#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
- *((uchar*) (T))= (uchar)(def_temp); \
- *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
- } while(0)
-#define int3store(T,A) do { /*lint -save -e734 */\
- *((uchar*)(T))=(uchar) ((A));\
- *((uchar*) (T)+1)=(uchar) (((A) >> 8));\
- *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
- /*lint -restore */} while(0)
-#define int4store(T,A) do { *((char *)(T))=(char) ((A));\
- *(((char *)(T))+1)=(char) (((A) >> 8));\
- *(((char *)(T))+2)=(char) (((A) >> 16));\
- *(((char *)(T))+3)=(char) (((A) >> 24)); } while(0)
-#define int5store(T,A) do { *((char *)(T))= (char)((A)); \
- *(((char *)(T))+1)= (char)(((A) >> 8)); \
- *(((char *)(T))+2)= (char)(((A) >> 16)); \
- *(((char *)(T))+3)= (char)(((A) >> 24)); \
- *(((char *)(T))+4)= (char)(((A) >> 32)); \
- } while(0)
-#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
- *(((char *)(T))+1)= (char)(((A) >> 8)); \
- *(((char *)(T))+2)= (char)(((A) >> 16)); \
- *(((char *)(T))+3)= (char)(((A) >> 24)); \
- *(((char *)(T))+4)= (char)(((A) >> 32)); \
- *(((char *)(T))+5)= (char)(((A) >> 40)); \
- } while(0)
-#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
- int4store((T),def_temp); \
- int4store((T+4),def_temp2); } while(0)
-#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
- *((T)+1)=(char) ((uchar *) &A)[2];\
- *((T)+2)=(char) ((uchar *) &A)[1];\
- *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
-
-#define float4get(V,M) do { float def_temp;\
- ((uchar*) &def_temp)[0]=(M)[3];\
- ((uchar*) &def_temp)[1]=(M)[2];\
- ((uchar*) &def_temp)[2]=(M)[1];\
- ((uchar*) &def_temp)[3]=(M)[0];\
- (V)=def_temp; } while(0)
-#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
- *((T)+1)=(char) ((uchar *) &V)[6];\
- *((T)+2)=(char) ((uchar *) &V)[5];\
- *((T)+3)=(char) ((uchar *) &V)[4];\
- *((T)+4)=(char) ((uchar *) &V)[3];\
- *((T)+5)=(char) ((uchar *) &V)[2];\
- *((T)+6)=(char) ((uchar *) &V)[1];\
- *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
-
-#define float8get(V,M) do { double def_temp;\
- ((uchar*) &def_temp)[0]=(M)[7];\
- ((uchar*) &def_temp)[1]=(M)[6];\
- ((uchar*) &def_temp)[2]=(M)[5];\
- ((uchar*) &def_temp)[3]=(M)[4];\
- ((uchar*) &def_temp)[4]=(M)[3];\
- ((uchar*) &def_temp)[5]=(M)[2];\
- ((uchar*) &def_temp)[6]=(M)[1];\
- ((uchar*) &def_temp)[7]=(M)[0];\
- (V) = def_temp; } while(0)
-#else
-#define float4get(V,M) memcpy(&V, (M), sizeof(float))
-#define float4store(V,M) memcpy(V, (&M), sizeof(float))
-
-#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
- *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
- *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
- *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
- *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
- *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
- *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
- *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
- while(0)
-#define doubleget(V,M) do { double def_temp;\
- ((uchar*) &def_temp)[0]=(M)[4];\
- ((uchar*) &def_temp)[1]=(M)[5];\
- ((uchar*) &def_temp)[2]=(M)[6];\
- ((uchar*) &def_temp)[3]=(M)[7];\
- ((uchar*) &def_temp)[4]=(M)[0];\
- ((uchar*) &def_temp)[5]=(M)[1];\
- ((uchar*) &def_temp)[6]=(M)[2];\
- ((uchar*) &def_temp)[7]=(M)[3];\
- (V) = def_temp; } while(0)
-#endif /* __FLOAT_WORD_ORDER */
-
-#define float8get(V,M) doubleget((V),(M))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* WORDS_BIGENDIAN */
-
-#endif /* __i386__ OR _WIN32 */
-
-/*
- Macro for reading 32-bit integer from network byte order (big-endian)
- from unaligned memory location.
-*/
-#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) |\
- (((uint32) ((uchar) (A)[2])) << 8) |\
- (((uint32) ((uchar) (A)[1])) << 16) |\
- (((uint32) ((uchar) (A)[0])) << 24))
-/*
- Define-funktions for reading and storing in machine format from/to
- short/long to/from some place in memory V should be a (not
- register) variable, M is a pointer to byte
-*/
-
-#ifdef WORDS_BIGENDIAN
-
-#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
- ((uint16) ((uint16) (M)[0]) << 8)); } while(0)
-#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\
- ((short) ((short) (M)[0]) << 8)); } while(0)
-#define longget(V,M) do { int32 def_temp;\
- ((uchar*) &def_temp)[0]=(M)[0];\
- ((uchar*) &def_temp)[1]=(M)[1];\
- ((uchar*) &def_temp)[2]=(M)[2];\
- ((uchar*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; } while(0)
-#define ulongget(V,M) do { uint32 def_temp;\
- ((uchar*) &def_temp)[0]=(M)[0];\
- ((uchar*) &def_temp)[1]=(M)[1];\
- ((uchar*) &def_temp)[2]=(M)[2];\
- ((uchar*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; } while(0)
-#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
- *(((char*)T)+1)=(char)(def_temp); \
- *(((char*)T)+0)=(char)(def_temp >> 8); } while(0)
-#define longstore(T,A) do { *(((char*)T)+3)=((A));\
- *(((char*)T)+2)=(((A) >> 8));\
- *(((char*)T)+1)=(((A) >> 16));\
- *(((char*)T)+0)=(((A) >> 24)); } while(0)
-
-#define floatget(V,M) memcpy(&V, (M), sizeof(float))
-#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float))
-#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
-#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
-#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
-
-#else
-
-#define ushortget(V,M) do { V = uint2korr(M); } while(0)
-#define shortget(V,M) do { V = sint2korr(M); } while(0)
-#define longget(V,M) do { V = sint4korr(M); } while(0)
-#define ulongget(V,M) do { V = uint4korr(M); } while(0)
-#define shortstore(T,V) int2store(T,V)
-#define longstore(T,V) int4store(T,V)
-#ifndef floatstore
-#define floatstore(T,V) memcpy((T), (void *) (&V), sizeof(float))
-#define floatget(V,M) memcpy(&V, (M), sizeof(float))
-#endif
-#ifndef doubleget
-#define doubleget(V,M) memcpy(&V, (M), sizeof(double))
-#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
-#endif /* doubleget */
-#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
-
-#endif /* WORDS_BIGENDIAN */
+#include <my_byteorder.h>
#ifdef HAVE_CHARSET_utf8
#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"
@@ -1397,10 +1107,6 @@ static inline char *dlerror(void)
#endif
/* Define some useful general macros (should be done after all headers). */
-#if !defined(max)
-#define max(a, b) ((a) > (b) ? (a) : (b))
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
#define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h
index f2c51773e83..24b977c38ce 100644
--- a/include/my_handler_errors.h
+++ b/include/my_handler_errors.h
@@ -84,8 +84,10 @@ static const char *handler_error_messages[]=
"Index column length exceeds limit",
"Index corrupted",
"Undo record too big",
- "Table is being used in foreign key check",
"Invalid InnoDB FTS Doc ID",
+ "Table is being used in foreign key check",
+ "Tablespace already exists",
+ "Too many columns",
"Row is not visible by the current transaction",
"Operation was interrupted by end user (probably kill command?)",
"Disk full"
diff --git a/include/my_md5.h b/include/my_md5.h
index 4f90541067b..5a0c60e7bfa 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -1,7 +1,8 @@
#ifndef MY_MD5_INCLUDED
#define MY_MD5_INCLUDED
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2013 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
@@ -16,79 +17,36 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* See md5.c for explanation and copyright information. */
+#include "m_string.h"
-/*
- * $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
- */
+#define MD5_HASH_SIZE 16 /* Hash size in bytes */
-#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
/*
- Use MD5 implementation provided by the SSL libraries.
+ Wrapper function for MD5 implementation.
*/
-
-#if defined(HAVE_YASSL)
-
-C_MODE_START
-
-void my_md5_hash(char *digest, const char *buf, int len);
-
-C_MODE_END
-
-#else /* HAVE_YASSL */
-
-#include <openssl/md5.h>
-
-#define MY_MD5_HASH(digest, buf, len) \
-do { \
- MD5_CTX ctx; \
- MD5_Init (&ctx); \
- MD5_Update (&ctx, buf, len); \
- MD5_Final (digest, &ctx); \
-} while (0)
-
-#endif /* HAVE_YASSL */
-
-#else /* HAVE_YASSL || HAVE_OPENSSL */
-/* Fallback to the MySQL's implementation. */
-
-/* Unlike previous versions of this code, uint32 need not be exactly
- 32 bits, merely 32 bits or more. Choosing a data type which is 32
- bits instead of 64 is not important; speed is considerably more
- important. ANSI guarantees that "unsigned long" will be big enough,
- and always using it seems to have few disadvantages. */
-typedef uint32 cvs_uint32;
-
-typedef struct {
- cvs_uint32 buf[4];
- cvs_uint32 bits[2];
- unsigned char in[64];
-} my_MD5Context;
-
-C_MODE_START
-
-void my_MD5Init (my_MD5Context *context);
-void my_MD5Update (my_MD5Context *context,
- unsigned char const *buf, unsigned len);
-void my_MD5Final (unsigned char digest[16],
- my_MD5Context *context);
-
-C_MODE_END
-
-#define MY_MD5_HASH(digest,buf,len) \
-do { \
- my_MD5Context ctx; \
- my_MD5Init (&ctx); \
- my_MD5Update (&ctx, buf, len); \
- my_MD5Final (digest, &ctx); \
-} while (0)
-
-#endif /* defined(HAVE_YASSL) || defined(HAVE_OPENSSL) */
-
-C_MODE_START
+#ifdef __cplusplus
+extern "C" {
+#endif
void compute_md5_hash(char *digest, const char *buf, int len);
-C_MODE_END
+/*
+ Convert an array of bytes to a hexadecimal representation.
+
+ Used to generate a hexadecimal representation of a message digest.
+*/
+static inline void array_to_hex(char *to, const unsigned char *str, uint len)
+{
+ const unsigned char *str_end= str + len;
+ for (; str != str_end; ++str)
+ {
+ *to++= _dig_vec_lower[((uchar) *str) >> 4];
+ *to++= _dig_vec_lower[((uchar) *str) & 0x0F];
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
#endif /* MY_MD5_INCLUDED */
diff --git a/include/my_rnd.h b/include/my_rnd.h
new file mode 100644
index 00000000000..b4a5d735811
--- /dev/null
+++ b/include/my_rnd.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2013 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 or later 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 _my_rnd_h
+#define _my_rnd_h
+
+C_MODE_START
+
+struct my_rnd_struct {
+ unsigned long seed1,seed2,max_value;
+ double max_value_dbl;
+};
+
+void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2);
+double my_rnd(struct my_rnd_struct *rand_st);
+double my_rnd_ssl(struct my_rnd_struct *rand_st);
+
+C_MODE_END
+
+#endif /* _my_rnd_h */
diff --git a/include/my_sys.h b/include/my_sys.h
index 42ee9c915da..1a9c5f887a8 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -173,8 +173,6 @@ extern void *my_memdup(const void *from,size_t length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strndup(const char *from, size_t length, myf MyFlags);
-extern int sf_leaking_memory; /* set to 1 to disable memleak detection */
-
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
extern uchar * my_large_malloc(size_t size, myf my_flags);
@@ -198,14 +196,18 @@ extern void my_large_free(uchar *ptr);
#endif /* GNUC */
#define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) ((void)0)
+#define my_safe_alloca(size, max_alloca_sz) ((size <= max_alloca_sz) ? \
+ my_alloca(size) : \
+ my_malloc(size, MYF(0)))
+#define my_safe_afree(ptr, size, max_alloca_sz) if (size > max_alloca_sz) \
+ my_free(ptr)
#else
#define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE))
#define my_afree(PTR) my_free(PTR)
+#define my_safe_alloca(size, max_alloca_sz) my_alloca(size)
+#define my_safe_afree(ptr, size, max_alloca_sz) my_afree(ptr)
#endif /* HAVE_ALLOCA */
-#define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : my_malloc(size,MYF(MY_FAE)))
-#define my_safe_afree(ptr, size, min_length) ((size <= min_length) ? my_afree(ptr) : my_free(ptr))
-
#ifndef errno /* did we already get it? */
#ifdef HAVE_ERRNO_AS_DEFINE
#include <errno.h> /* errno is a define */
@@ -222,6 +224,7 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
extern uint my_file_limit;
extern ulonglong my_thread_stack_size;
+extern int sf_leaking_memory; /* set to 1 to disable memleak detection */
extern void (*proc_info_hook)(void *, const PSI_stage_info *, PSI_stage_info *,
const char *, const char *, const unsigned int);
@@ -264,11 +267,6 @@ extern my_bool my_disable_locking, my_disable_async_io,
extern my_bool my_disable_sync;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
-/* from default.c */
-extern const char *my_defaults_extra_file;
-extern const char *my_defaults_group_suffix;
-extern const char *my_defaults_file;
-
extern my_bool timed_mutexes;
enum loglevel {
@@ -565,13 +563,8 @@ my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
typedef uint32 ha_checksum;
extern ulong my_crc_dbug_check;
-/* Define the type of function to be passed to process_default_option_files */
-typedef int (*Process_option_func)(void *ctx, const char *group_name,
- const char *option);
-
#include <my_alloc.h>
-
/* Prototypes for mysys and my_func functions */
extern int my_copy(const char *from,const char *to,myf MyFlags);
@@ -630,6 +623,13 @@ extern int my_access(const char *path, int amode);
extern int check_if_legal_filename(const char *path);
extern int check_if_legal_tablename(const char *path);
+#ifdef __WIN__
+extern my_bool is_filename_allowed(const char *name, size_t length,
+ my_bool allow_current_dir);
+#else /* __WIN__ */
+# define is_filename_allowed(name, length, allow_cwd) (TRUE)
+#endif /* __WIN__ */
+
#ifdef _WIN32
extern int nt_share_delete(const char *name,myf MyFlags);
#define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags))
@@ -662,15 +662,16 @@ extern void thr_set_sync_wait_callback(void (*before_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);
-extern void my_error(int nr,myf MyFlags, ...);
+extern const char *my_get_err_msg(uint nr);
+extern void my_error(uint nr,myf MyFlags, ...);
extern void my_printf_error(uint my_err, const char *format,
myf MyFlags, ...)
ATTRIBUTE_FORMAT(printf, 2, 4);
extern void my_printv_error(uint error, const char *format, myf MyFlags,
va_list ap);
extern int my_error_register(const char** (*get_errmsgs) (),
- int first, int last);
-extern const char **my_error_unregister(int first, int last);
+ uint first, uint last);
+extern const char **my_error_unregister(uint first, uint 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_init(void);
@@ -781,7 +782,8 @@ extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
extern my_off_t my_b_filelength(IO_CACHE *info);
extern size_t my_b_write_backtick_quote(IO_CACHE *info, const char *str,
size_t len);
-extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...);
+extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...)
+ ATTRIBUTE_FORMAT(printf, 2, 3);
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
const char *prefix, size_t cache_size,
@@ -860,22 +862,6 @@ static inline char *safe_strdup_root(MEM_ROOT *root, const char *str)
}
extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len);
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 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,
- int *argc, char ***argv);
-extern int my_search_option_files(const char *conf_file, int *argc,
- char ***argv, uint *args_used,
- Process_option_func func, void *func_ctx,
- const char **default_directories);
-extern void free_defaults(char **argv);
-extern void my_print_default_files(const char *conf_file);
-extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(uchar *, size_t *, size_t *);
extern my_bool my_uncompress(uchar *, size_t , size_t *);
extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
@@ -967,14 +953,6 @@ void my_uuid(uchar *guid);
void my_uuid2str(const uchar *guid, char *s);
void my_uuid_end();
-struct my_rnd_struct {
- unsigned long seed1,seed2,max_value;
- double max_value_dbl;
-};
-
-void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2);
-double my_rnd(struct my_rnd_struct *rand_st);
-
/* character sets */
extern uint get_charset_number(const char *cs_name, uint cs_flags);
extern uint get_collation_number(const char *name);
@@ -1037,6 +1015,5 @@ void my_init_mysys_psi_keys(void);
struct st_mysql_file;
extern struct st_mysql_file *mysql_stdin;
-
C_MODE_END
#endif /* _my_sys_h */
diff --git a/include/my_time.h b/include/my_time.h
index 9bd545bb850..c7a3e17d236 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -138,8 +138,8 @@ void my_init_time(void);
estimate.
RETURN VALUES
- FALSE The value seems sane
- TRUE The MYSQL_TIME value is definitely out of range
+ TRUE The value seems sane
+ FALSE The MYSQL_TIME value is definitely out of range
*/
static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
diff --git a/include/mysql/client_authentication.h b/include/mysql/client_authentication.h
new file mode 100644
index 00000000000..2bd2fc98bac
--- /dev/null
+++ b/include/mysql/client_authentication.h
@@ -0,0 +1,13 @@
+#ifndef CLIENT_AUTHENTICATION_H
+#define CLIENT_AUTHENTICATION_H
+#include "mysql.h"
+#include "mysql/client_plugin.h"
+
+C_MODE_START
+int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
+int sha256_password_init(char *, size_t, int, va_list);
+int sha256_password_deinit(void);
+C_MODE_END
+
+#endif
+
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 38573180232..4220e73ee11 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -45,6 +45,8 @@ class Item;
#define MYSQL_THD void*
#endif
+typedef void * MYSQL_PLUGIN;
+
#include <mysql/services.h>
#define MYSQL_XIDDATASIZE 128
@@ -69,10 +71,10 @@ typedef struct st_mysql_xid MYSQL_XID;
*/
/* MySQL plugin interface version */
-#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
+#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x0104
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x0105
/*
The allowable types of plugins
@@ -85,7 +87,8 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
-#define MYSQL_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
+#define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */
+#define MYSQL_MAX_PLUGIN_TYPE_NUM 9 /* The number of plugin types */
/* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0
@@ -558,7 +561,7 @@ struct handlerton;
/*
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
*/
- #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100
+ #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0200
/**
Replication plugin descriptor
@@ -606,6 +609,7 @@ int thd_sql_command(const MYSQL_THD thd);
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
int thd_tx_isolation(const MYSQL_THD thd);
+int thd_tx_is_read_only(const MYSQL_THD thd);
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
unsigned int max_query_len);
/* Increments the row counter, see THD::row_count */
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index fbd4ec2dd3f..c3ba7eec0d6 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -1,4 +1,5 @@
#include "plugin.h"
+typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -232,6 +233,7 @@ int thd_sql_command(const void* thd);
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);
+int thd_tx_is_read_only(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);
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 46811825142..4f04d51cb52 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -1,4 +1,5 @@
#include <mysql/plugin.h>
+typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -232,6 +233,7 @@ int thd_sql_command(const void* thd);
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);
+int thd_tx_is_read_only(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);
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 49cf7e5b931..3a978645c24 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,4 +1,5 @@
#include "plugin.h"
+typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -185,6 +186,7 @@ int thd_sql_command(const void* thd);
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);
+int thd_tx_is_read_only(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);
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index 816ac713631..c226258f462 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -518,7 +518,7 @@ static inline void inline_mysql_file_register(
)
{
#ifdef HAVE_PSI_FILE_INTERFACE
- PSI_CALL(register_file)(category, info, count);
+ PSI_FILE_CALL(register_file)(category, info, count);
#endif
}
@@ -533,13 +533,13 @@ inline_mysql_file_fgets(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_READ);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
result= fgets(str, size, file->m_file);
- PSI_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
+ PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
return result;
}
#endif
@@ -559,13 +559,13 @@ inline_mysql_file_fgetc(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_READ);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
result= fgetc(file->m_file);
- PSI_CALL(end_file_wait)(locker, (size_t) 1);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
return result;
}
#endif
@@ -586,14 +586,14 @@ inline_mysql_file_fputs(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
bytes= str ? strlen(str) : 0;
- PSI_CALL(start_file_wait)(locker, bytes, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line);
result= fputs(str, file->m_file);
- PSI_CALL(end_file_wait)(locker, bytes);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes);
return result;
}
#endif
@@ -613,13 +613,13 @@ inline_mysql_file_fputc(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
result= fputc(c, file->m_file);
- PSI_CALL(end_file_wait)(locker, (size_t) 1);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
return result;
}
#endif
@@ -639,15 +639,15 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...)
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
va_start(args, format);
result= vfprintf(file->m_file, format, args);
va_end(args);
- PSI_CALL(end_file_wait)(locker, (size_t) result);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
return result;
}
#endif
@@ -669,13 +669,13 @@ inline_mysql_file_vfprintf(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= vfprintf(file->m_file, format, args);
- PSI_CALL(end_file_wait)(locker, (size_t) result);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
return result;
}
#endif
@@ -695,13 +695,13 @@ inline_mysql_file_fflush(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_FLUSH);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_FLUSH);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= fflush(file->m_file);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -727,13 +727,13 @@ inline_mysql_file_fstat(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, filenr,
- PSI_FILE_FSTAT);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, filenr, PSI_FILE_FSTAT);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_fstat(filenr, stat_area, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -753,14 +753,13 @@ inline_mysql_file_stat(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state,
- key, PSI_FILE_STAT,
- path, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_STAT, path, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
result= my_stat(path, stat_area, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_open_wait)(locker, result);
return result;
}
#endif
@@ -780,14 +779,14 @@ inline_mysql_file_chsize(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
- PSI_FILE_CHSIZE);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_CHSIZE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
src_line);
result= my_chsize(file, newlength, filler, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) newlength);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength);
return result;
}
#endif
@@ -810,14 +809,14 @@ inline_mysql_file_fopen(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_STREAM_OPEN, filename, that);
if (likely(locker != NULL))
{
- that->m_psi= PSI_CALL(start_file_open_wait)(locker, src_file,
- src_line);
+ PSI_FILE_CALL(start_file_open_wait)
+ (locker, src_file, src_line);
that->m_file= my_fopen(filename, flags, myFlags);
- PSI_CALL(end_file_open_wait)(locker);
+ that->m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file);
if (unlikely(that->m_file == NULL))
{
my_free(that);
@@ -851,13 +850,13 @@ inline_mysql_file_fclose(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_STREAM_CLOSE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_STREAM_CLOSE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_fclose(file->m_file, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
my_free(file);
return result;
}
@@ -881,17 +880,17 @@ inline_mysql_file_fread(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_READ);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_fread(file->m_file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_read);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -912,17 +911,17 @@ inline_mysql_file_fwrite(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_fwrite(file->m_file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_written);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -942,13 +941,13 @@ inline_mysql_file_fseek(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_SEEK);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_SEEK);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_fseek(file->m_file, pos, whence, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -968,13 +967,13 @@ inline_mysql_file_ftell(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
- PSI_FILE_TELL);
+ locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+ (&state, file->m_psi, PSI_FILE_TELL);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_ftell(file->m_file, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -994,13 +993,13 @@ inline_mysql_file_create(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
- filename, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_CREATE, filename, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_create(filename, create_flags, access_flags, myFlags);
- PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1024,7 +1023,7 @@ inline_mysql_file_create_temp(
*/
file= create_temp_file(to, dir, pfx, mode, myFlags);
#ifdef HAVE_PSI_FILE_INTERFACE
- PSI_CALL(create_file)(key, to, file);
+ PSI_FILE_CALL(create_file)(key, to, file);
#endif
return file;
}
@@ -1040,13 +1039,13 @@ inline_mysql_file_open(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_OPEN,
- filename, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_OPEN, filename, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_open(filename, flags, myFlags);
- PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1066,13 +1065,13 @@ inline_mysql_file_close(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
- PSI_FILE_CLOSE);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_CLOSE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_close(file, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1093,17 +1092,17 @@ inline_mysql_file_read(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
- PSI_FILE_READ);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_read(file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_read);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -1124,17 +1123,17 @@ inline_mysql_file_write(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_write(file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_written);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -1155,16 +1154,17 @@ inline_mysql_file_pread(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_pread(file, buffer, count, offset, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_read);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -1185,17 +1185,17 @@ inline_mysql_file_pwrite(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
- PSI_FILE_WRITE);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_pwrite(file, buffer, count, offset, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
- PSI_CALL(end_file_wait)(locker, bytes_written);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -1215,12 +1215,13 @@ inline_mysql_file_seek(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_SEEK);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_SEEK);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_seek(file, pos, whence, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1240,12 +1241,13 @@ inline_mysql_file_tell(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_TELL);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, file, PSI_FILE_TELL);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_tell(file, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1265,13 +1267,13 @@ inline_mysql_file_delete(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
- name, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete(name, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1291,13 +1293,13 @@ inline_mysql_file_rename(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
- to, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_RENAME, to, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename(from, to, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1318,14 +1320,14 @@ inline_mysql_file_create_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
- filename, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_CREATE, filename, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
flags);
- PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1346,13 +1348,13 @@ inline_mysql_file_delete_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
- name, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete_with_symlink(name, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1372,13 +1374,13 @@ inline_mysql_file_rename_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
- to, &locker);
+ locker= PSI_FILE_CALL(get_thread_file_name_locker)
+ (&state, key, PSI_FILE_RENAME, to, &locker);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename_with_symlink(from, to, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1398,12 +1400,13 @@ inline_mysql_file_sync(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
- locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, fd, PSI_FILE_SYNC);
+ locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+ (&state, fd, PSI_FILE_SYNC);
if (likely(locker != NULL))
{
- PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_sync(fd, flags);
- PSI_CALL(end_file_wait)(locker, (size_t) 0);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
diff --git a/include/mysql/psi/mysql_idle.h b/include/mysql/psi/mysql_idle.h
index 7a3fccfdb8c..c53d0ceb8c7 100644
--- a/include/mysql/psi/mysql_idle.h
+++ b/include/mysql/psi/mysql_idle.h
@@ -70,7 +70,7 @@ inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
const char *src_file, int src_line)
{
struct PSI_idle_locker *locker;
- locker= PSI_CALL(start_idle_wait)(state, src_file, src_line);
+ locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
return locker;
}
@@ -82,7 +82,7 @@ static inline void
inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
{
if (likely(locker != NULL))
- PSI_CALL(end_idle_wait)(locker);
+ PSI_IDLE_CALL(end_idle_wait)(locker);
}
#endif
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index c908032883a..e1d56539f85 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
#ifdef __WIN__
#include <ws2def.h>
#include <winsock2.h>
+ #include <MSWSock.h>
#define SOCKBUF_T char
#else
#include <netinet/in.h>
@@ -121,7 +122,7 @@ mysql_socket_set_address(
{
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (socket.m_psi != NULL)
- PSI_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
+ PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
#endif
}
@@ -141,7 +142,7 @@ MYSQL_SOCKET socket __attribute__ ((unused))
{
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (socket.m_psi != NULL)
- PSI_CALL(set_socket_thread_owner)(socket.m_psi);
+ PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi);
#endif
}
@@ -247,8 +248,8 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
struct PSI_socket_locker *locker;
if (mysql_socket.m_psi != NULL)
{
- locker= PSI_CALL(start_socket_wait)(state, mysql_socket.m_psi, op,
- byte_count, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (state, mysql_socket.m_psi, op, byte_count, src_file, src_line);
}
else
locker= NULL;
@@ -263,7 +264,7 @@ static inline void
inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count)
{
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, byte_count);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count);
}
/**
@@ -276,7 +277,7 @@ static inline void
inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
{
if (socket.m_psi != NULL)
- PSI_CALL(set_socket_state)(socket.m_psi, state);
+ PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state);
}
#endif /* HAVE_PSI_SOCKET_INTERFACE */
@@ -537,7 +538,7 @@ static inline void inline_mysql_socket_register(
PSI_socket_info *info,
int count)
{
- PSI_CALL(register_socket)(category, info, count);
+ PSI_SOCKET_CALL(register_socket)(category, info, count);
}
#endif
@@ -551,16 +552,15 @@ inline_mysql_socket_socket
#endif
int domain, int type, int protocol)
{
- MYSQL_SOCKET mysql_socket;
+ MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET;
mysql_socket.fd= socket(domain, type, protocol);
#ifdef HAVE_PSI_SOCKET_INTERFACE
- mysql_socket.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd);
-
- if (likely(mysql_socket.fd != INVALID_SOCKET && mysql_socket.m_psi != NULL))
- PSI_CALL(set_socket_info)(mysql_socket.m_psi, &mysql_socket.fd, NULL, 0);
-#else
- mysql_socket.m_psi= NULL;
+ if (likely(mysql_socket.fd != INVALID_SOCKET))
+ {
+ mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket)
+ (key, (const my_socket*)&mysql_socket.fd, NULL, 0);
+ }
#endif
return mysql_socket;
}
@@ -583,17 +583,18 @@ inline_mysql_socket_bind
/* Instrumentation start */
PSI_socket_locker_state state;
PSI_socket_locker *locker;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= bind(mysql_socket.fd, addr, len);
/* Instrumentation end */
- PSI_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
+ if (result == 0)
+ PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -622,15 +623,15 @@ inline_mysql_socket_getsockname
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getsockname(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -660,15 +661,15 @@ inline_mysql_socket_connect
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= connect(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -698,15 +699,15 @@ inline_mysql_socket_getpeername
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getpeername(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -736,18 +737,18 @@ inline_mysql_socket_send
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_SEND, n, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
/* Instrumented code */
- result= send(mysql_socket.fd, buf, n, flags);
+ result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_written;
bytes_written= (result > -1) ? result : 0;
- PSI_CALL(end_socket_wait)(locker, bytes_written);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
return result;
@@ -755,7 +756,7 @@ inline_mysql_socket_send
#endif
/* Non instrumented code */
- result= send(mysql_socket.fd, buf, n, flags);
+ result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
return result;
}
@@ -778,18 +779,18 @@ inline_mysql_socket_recv
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
/* Instrumented code */
- result= recv(mysql_socket.fd, buf, n, flags);
+ result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_read;
bytes_read= (result > -1) ? result : 0;
- PSI_CALL(end_socket_wait)(locker, bytes_read);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
return result;
@@ -797,7 +798,7 @@ inline_mysql_socket_recv
#endif
/* Non instrumented code */
- result= recv(mysql_socket.fd, buf, n, flags);
+ result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
return result;
}
@@ -820,18 +821,18 @@ inline_mysql_socket_sendto
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_SEND, n, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
/* Instrumented code */
- result= sendto(mysql_socket.fd, buf, n, flags, addr, addr_len);
+ result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_written;
bytes_written = (result > -1) ? result : 0;
- PSI_CALL(end_socket_wait)(locker, bytes_written);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
return result;
@@ -839,7 +840,7 @@ inline_mysql_socket_sendto
#endif
/* Non instrumented code */
- result= sendto(mysql_socket.fd, buf, n, flags, addr, addr_len);
+ result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
return result;
}
@@ -863,18 +864,18 @@ inline_mysql_socket_recvfrom
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
/* Instrumented code */
- result= recvfrom(mysql_socket.fd, buf, n, flags, addr, addr_len);
+ result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_read;
bytes_read = (result > -1) ? result : 0;
- PSI_CALL(end_socket_wait)(locker, bytes_read);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
return result;
@@ -882,7 +883,7 @@ inline_mysql_socket_recvfrom
#endif
/* Non instrumented code */
- result= recvfrom(mysql_socket.fd, buf, n, flags, addr, addr_len);
+ result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
return result;
}
@@ -905,15 +906,15 @@ inline_mysql_socket_getsockopt
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getsockopt(mysql_socket.fd, level, optname, optval, optlen);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -944,15 +945,15 @@ inline_mysql_socket_setsockopt
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= setsockopt(mysql_socket.fd, level, optname, optval, optlen);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -982,15 +983,15 @@ inline_mysql_socket_listen
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= listen(mysql_socket.fd, backlog);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -1021,15 +1022,15 @@ inline_mysql_socket_accept
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, socket_listen.m_psi,
- PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
}
else
#endif
@@ -1039,14 +1040,12 @@ inline_mysql_socket_accept
}
#ifdef HAVE_PSI_SOCKET_INTERFACE
- /* Initialize the instrument with the new socket descriptor and address */
- socket_accept.m_psi=
- PSI_CALL(init_socket)(key, (const my_socket*)&socket_accept.fd);
-
- /* FIXME: simplify this with just 1 call to init_socket(). */
- if (socket_accept.m_psi != NULL)
- PSI_CALL(set_socket_info)(socket_accept.m_psi, &socket_accept.fd, addr,
- addr_length);
+ if (likely(socket_accept.fd != INVALID_SOCKET))
+ {
+ /* Initialize the instrument with the new socket descriptor and address */
+ socket_accept.m_psi= PSI_SOCKET_CALL(init_socket)
+ (key, (const my_socket*)&socket_accept.fd, addr, addr_length);
+ }
#endif
return socket_accept;
@@ -1070,18 +1069,18 @@ inline_mysql_socket_close
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
/* Instrumented code */
result= closesocket(mysql_socket.fd);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
/* Remove the instrumentation for this socket. */
if (mysql_socket.m_psi != NULL)
- PSI_CALL(destroy_socket)(mysql_socket.m_psi);
+ PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi);
return result;
}
@@ -1105,28 +1104,53 @@ inline_mysql_socket_shutdown
{
int result;
- /* Instrumentation start */
+#ifdef __WIN__
+ static LPFN_DISCONNECTEX DisconnectEx = NULL;
+ if (DisconnectEx == NULL)
+ {
+ DWORD dwBytesReturned;
+ GUID guidDisconnectEx = WSAID_DISCONNECTEX;
+ WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER,
+ &guidDisconnectEx, sizeof(GUID),
+ &DisconnectEx, sizeof(DisconnectEx),
+ &dwBytesReturned, NULL, NULL);
+ }
+#endif
+
+/* Instrumentation start */
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
{
PSI_socket_locker *locker;
PSI_socket_locker_state state;
- locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
- PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
+ locker= PSI_SOCKET_CALL(start_socket_wait)
+ (&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
/* Instrumented code */
- result= shutdown(mysql_socket.fd, how);
+#ifdef __WIN__
+ if (DisconnectEx)
+ result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
+ (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
+ else
+#endif
+ result= shutdown(mysql_socket.fd, how);
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_socket_wait)(locker, (size_t)0);
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
#endif
/* Non instrumented code */
- result= shutdown(mysql_socket.fd, how);
+#ifdef __WIN__
+ if (DisconnectEx)
+ result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
+ (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
+ else
+#endif
+ result= shutdown(mysql_socket.fd, how);
return result;
}
diff --git a/include/mysql/psi/mysql_stage.h b/include/mysql/psi/mysql_stage.h
index dc44e9b0bed..61bfdbb7d59 100644
--- a/include/mysql/psi/mysql_stage.h
+++ b/include/mysql/psi/mysql_stage.h
@@ -53,7 +53,7 @@
static inline void inline_mysql_stage_register(
const char *category, PSI_stage_info **info, int count)
{
- PSI_CALL(register_stage)(category, info, count);
+ PSI_STAGE_CALL(register_stage)(category, info, count);
}
#endif
@@ -62,7 +62,7 @@ static inline void
inline_mysql_set_stage(PSI_stage_key key,
const char *src_file, int src_line)
{
- PSI_CALL(start_stage)(key, src_file, src_line);
+ PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
}
#endif
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index 1b065065e57..d7a76ee25e4 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2012, 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
@@ -63,10 +63,10 @@
#endif
#ifdef HAVE_PSI_STATEMENT_INTERFACE
- #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
- inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
+ #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
+ inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, __FILE__, __LINE__)
#else
- #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
+ #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
NULL
#endif
@@ -122,7 +122,7 @@
static inline void inline_mysql_statement_register(
const char *category, PSI_statement_info *info, int count)
{
- PSI_CALL(register_statement)(category, info, count);
+ PSI_STATEMENT_CALL(register_statement)(category, info, count);
}
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
@@ -132,7 +132,7 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
PSI_digest_locker* digest_locker= NULL;
if (likely(locker != NULL))
- digest_locker= PSI_CALL(digest_start)(locker);
+ digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
return digest_locker;
}
#endif
@@ -143,7 +143,7 @@ inline_mysql_add_token(PSI_digest_locker *locker, uint token,
void *yylval)
{
if (likely(locker != NULL))
- locker= PSI_CALL(digest_add_token)(locker, token,
+ locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
(OPAQUE_LEX_YYSTYPE*)yylval);
return locker;
}
@@ -153,12 +153,13 @@ static inline struct PSI_statement_locker *
inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
const char *db, uint db_len,
+ const CHARSET_INFO *charset,
const char *src_file, int src_line)
{
PSI_statement_locker *locker;
- locker= PSI_CALL(get_thread_statement_locker)(state, key);
+ locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
if (likely(locker != NULL))
- PSI_CALL(start_statement)(locker, db, db_len, src_file, src_line);
+ PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
return locker;
}
@@ -168,7 +169,7 @@ inline_mysql_refine_statement(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
- locker= PSI_CALL(refine_statement)(locker, key);
+ locker= PSI_STATEMENT_CALL(refine_statement)(locker, key);
}
return locker;
}
@@ -179,7 +180,7 @@ inline_mysql_set_statement_text(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
- PSI_CALL(set_statement_text)(locker, text, text_len);
+ PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
}
}
@@ -189,7 +190,7 @@ inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
- PSI_CALL(set_statement_lock_time)(locker, count);
+ PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
}
}
@@ -199,7 +200,7 @@ inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
- PSI_CALL(set_statement_rows_sent)(locker, count);
+ PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
}
}
@@ -209,7 +210,7 @@ inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
- PSI_CALL(set_statement_rows_examined)(locker, count);
+ PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
}
}
@@ -217,9 +218,9 @@ static inline void
inline_mysql_end_statement(struct PSI_statement_locker *locker,
Diagnostics_area *stmt_da)
{
- PSI_CALL(end_stage)();
+ PSI_STAGE_CALL(end_stage)();
if (likely(locker != NULL))
- PSI_CALL(end_statement)(locker, stmt_da);
+ PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
}
#endif
diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h
index 1796943096e..815313e654b 100644
--- a/include/mysql/psi/mysql_table.h
+++ b/include/mysql/psi/mysql_table.h
@@ -60,22 +60,22 @@
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
- #define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
- { \
- if (PSI != NULL) \
- { \
- PSI_table_locker *locker; \
- PSI_table_locker_state state; \
- locker= PSI_CALL(start_table_io_wait)(& state, PSI, OP, INDEX, \
- __FILE__, __LINE__); \
- PAYLOAD \
- if (locker != NULL) \
- PSI_CALL(end_table_io_wait)(locker); \
- } \
- else \
- { \
- PAYLOAD \
- } \
+ #define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
+ { \
+ if (PSI != NULL) \
+ { \
+ PSI_table_locker *locker; \
+ PSI_table_locker_state state; \
+ locker= PSI_TABLE_CALL(start_table_io_wait) \
+ (& state, PSI, OP, INDEX, __FILE__, __LINE__); \
+ PAYLOAD \
+ if (locker != NULL) \
+ PSI_TABLE_CALL(end_table_io_wait)(locker); \
+ } \
+ else \
+ { \
+ PAYLOAD \
+ } \
}
#else
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
@@ -93,22 +93,22 @@
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
- #define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
- { \
- if (PSI != NULL) \
- { \
- PSI_table_locker *locker; \
- PSI_table_locker_state state; \
- locker= PSI_CALL(start_table_lock_wait)(& state, PSI, OP, FLAGS, \
- __FILE__, __LINE__); \
- PAYLOAD \
- if (locker != NULL) \
- PSI_CALL(end_table_lock_wait)(locker); \
- } \
- else \
- { \
- PAYLOAD \
- } \
+ #define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
+ { \
+ if (PSI != NULL) \
+ { \
+ PSI_table_locker *locker; \
+ PSI_table_locker_state state; \
+ locker= PSI_TABLE_CALL(start_table_lock_wait) \
+ (& state, PSI, OP, FLAGS, __FILE__, __LINE__); \
+ PAYLOAD \
+ if (locker != NULL) \
+ PSI_TABLE_CALL(end_table_lock_wait)(locker); \
+ } \
+ else \
+ { \
+ PAYLOAD \
+ } \
}
#else
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
@@ -164,7 +164,8 @@ inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
if (psi != NULL)
{
struct PSI_table_locker *locker;
- locker= PSI_CALL(start_table_lock_wait)(state, psi, op, flags, src_file, src_line);
+ locker= PSI_TABLE_CALL(start_table_lock_wait)
+ (state, psi, op, flags, src_file, src_line);
return locker;
}
return NULL;
@@ -178,7 +179,7 @@ static inline void
inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
{
if (locker != NULL)
- PSI_CALL(end_table_lock_wait)(locker);
+ PSI_TABLE_CALL(end_table_lock_wait)(locker);
}
#endif
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index 78175196fa2..f0d88ff8ede 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -597,7 +597,7 @@ static inline void inline_mysql_mutex_register(
)
{
#ifdef HAVE_PSI_MUTEX_INTERFACE
- PSI_CALL(register_mutex)(category, info, count);
+ PSI_MUTEX_CALL(register_mutex)(category, info, count);
#endif
}
@@ -613,7 +613,7 @@ static inline int inline_mysql_mutex_init(
)
{
#ifdef HAVE_PSI_MUTEX_INTERFACE
- that->m_psi= PSI_CALL(init_mutex)(key, &that->m_mutex);
+ that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex);
#else
that->m_psi= NULL;
#endif
@@ -636,7 +636,7 @@ static inline int inline_mysql_mutex_destroy(
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
{
- PSI_CALL(destroy_mutex)(that->m_psi);
+ PSI_MUTEX_CALL(destroy_mutex)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -664,7 +664,7 @@ static inline int inline_mysql_mutex_lock(
/* Instrumentation start */
PSI_mutex_locker *locker;
PSI_mutex_locker_state state;
- locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
+ locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
PSI_MUTEX_LOCK, src_file, src_line);
/* Instrumented code */
@@ -678,7 +678,7 @@ static inline int inline_mysql_mutex_lock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_mutex_wait)(locker, result);
+ PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
return result;
}
@@ -711,7 +711,7 @@ static inline int inline_mysql_mutex_trylock(
/* Instrumentation start */
PSI_mutex_locker *locker;
PSI_mutex_locker_state state;
- locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
+ locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
PSI_MUTEX_TRYLOCK, src_file, src_line);
/* Instrumented code */
@@ -725,7 +725,7 @@ static inline int inline_mysql_mutex_trylock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_mutex_wait)(locker, result);
+ PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
return result;
}
@@ -754,7 +754,7 @@ static inline int inline_mysql_mutex_unlock(
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
- PSI_CALL(unlock_mutex)(that->m_psi);
+ PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
#endif
#ifdef SAFE_MUTEX
@@ -781,7 +781,7 @@ static inline void inline_mysql_rwlock_register(
)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
- PSI_CALL(register_rwlock)(category, info, count);
+ PSI_RWLOCK_CALL(register_rwlock)(category, info, count);
#endif
}
@@ -792,7 +792,7 @@ static inline int inline_mysql_rwlock_init(
mysql_rwlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
- that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_rwlock);
+ that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock);
#else
that->m_psi= NULL;
#endif
@@ -810,7 +810,7 @@ static inline int inline_mysql_prlock_init(
mysql_prlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
- that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_prlock);
+ that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock);
#else
that->m_psi= NULL;
#endif
@@ -824,7 +824,7 @@ static inline int inline_mysql_rwlock_destroy(
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
{
- PSI_CALL(destroy_rwlock)(that->m_psi);
+ PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -838,7 +838,7 @@ static inline int inline_mysql_prlock_destroy(
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
{
- PSI_CALL(destroy_rwlock)(that->m_psi);
+ PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -861,7 +861,7 @@ static inline int inline_mysql_rwlock_rdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_READLOCK, src_file, src_line);
/* Instrumented code */
@@ -869,7 +869,7 @@ static inline int inline_mysql_rwlock_rdlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_rdwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -897,7 +897,7 @@ static inline int inline_mysql_prlock_rdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_READLOCK, src_file, src_line);
/* Instrumented code */
@@ -905,7 +905,7 @@ static inline int inline_mysql_prlock_rdlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_rdwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -933,7 +933,7 @@ static inline int inline_mysql_rwlock_wrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -941,7 +941,7 @@ static inline int inline_mysql_rwlock_wrlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_wrwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -969,7 +969,7 @@ static inline int inline_mysql_prlock_wrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -977,7 +977,7 @@ static inline int inline_mysql_prlock_wrlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_wrwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -1005,7 +1005,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK, src_file, src_line);
/* Instrumented code */
@@ -1013,7 +1013,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_rdwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -1040,7 +1040,7 @@ static inline int inline_mysql_rwlock_trywrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
- locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+ locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -1048,7 +1048,7 @@ static inline int inline_mysql_rwlock_trywrlock(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_rwlock_wrwait)(locker, result);
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -1066,7 +1066,7 @@ static inline int inline_mysql_rwlock_unlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
- PSI_CALL(unlock_rwlock)(that->m_psi);
+ PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_unlock(&that->m_rwlock);
return result;
@@ -1079,7 +1079,7 @@ static inline int inline_mysql_prlock_unlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
- PSI_CALL(unlock_rwlock)(that->m_psi);
+ PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_pr_unlock(&that->m_prlock);
return result;
@@ -1099,7 +1099,7 @@ static inline void inline_mysql_cond_register(
)
{
#ifdef HAVE_PSI_COND_INTERFACE
- PSI_CALL(register_cond)(category, info, count);
+ PSI_COND_CALL(register_cond)(category, info, count);
#endif
}
@@ -1111,7 +1111,7 @@ static inline int inline_mysql_cond_init(
const pthread_condattr_t *attr)
{
#ifdef HAVE_PSI_COND_INTERFACE
- that->m_psi= PSI_CALL(init_cond)(key, &that->m_cond);
+ that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond);
#else
that->m_psi= NULL;
#endif
@@ -1124,7 +1124,7 @@ static inline int inline_mysql_cond_destroy(
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
{
- PSI_CALL(destroy_cond)(that->m_psi);
+ PSI_COND_CALL(destroy_cond)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -1147,7 +1147,7 @@ static inline int inline_mysql_cond_wait(
/* Instrumentation start */
PSI_cond_locker *locker;
PSI_cond_locker_state state;
- locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+ locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
PSI_COND_WAIT, src_file, src_line);
/* Instrumented code */
@@ -1155,7 +1155,7 @@ static inline int inline_mysql_cond_wait(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_cond_wait)(locker, result);
+ PSI_COND_CALL(end_cond_wait)(locker, result);
return result;
}
@@ -1184,7 +1184,7 @@ static inline int inline_mysql_cond_timedwait(
/* Instrumentation start */
PSI_cond_locker *locker;
PSI_cond_locker_state state;
- locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+ locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
PSI_COND_TIMEDWAIT, src_file, src_line);
/* Instrumented code */
@@ -1192,7 +1192,7 @@ static inline int inline_mysql_cond_timedwait(
/* Instrumentation end */
if (locker != NULL)
- PSI_CALL(end_cond_wait)(locker, result);
+ PSI_COND_CALL(end_cond_wait)(locker, result);
return result;
}
@@ -1210,7 +1210,7 @@ static inline int inline_mysql_cond_signal(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
- PSI_CALL(signal_cond)(that->m_psi);
+ PSI_COND_CALL(signal_cond)(that->m_psi);
#endif
result= pthread_cond_signal(&that->m_cond);
return result;
@@ -1222,7 +1222,7 @@ static inline int inline_mysql_cond_broadcast(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
- PSI_CALL(broadcast_cond)(that->m_psi);
+ PSI_COND_CALL(broadcast_cond)(that->m_psi);
#endif
result= pthread_cond_broadcast(&that->m_cond);
return result;
@@ -1241,7 +1241,7 @@ static inline void inline_mysql_thread_register(
)
{
#ifdef HAVE_PSI_THREAD_INTERFACE
- PSI_CALL(register_thread)(category, info, count);
+ PSI_THREAD_CALL(register_thread)(category, info, count);
#endif
}
@@ -1252,14 +1252,14 @@ static inline int inline_mysql_thread_create(
void *(*start_routine)(void*), void *arg)
{
int result;
- result= PSI_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
+ result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
return result;
}
static inline void inline_mysql_thread_set_psi_id(ulong id)
{
- struct PSI_thread *psi= PSI_CALL(get_thread)();
- PSI_CALL(set_thread_id)(psi, id);
+ struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
+ PSI_THREAD_CALL(set_thread_id)(psi, id);
}
#endif
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 8d5e6db7307..cc2057c630d 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -899,6 +899,10 @@ struct PSI_file_locker_state_v1
enum PSI_file_operation m_operation;
/** Current file. */
struct PSI_file *m_file;
+ /** Current file name. */
+ const char *m_name;
+ /** Current file class. */
+ void *m_class;
/** Current thread. */
struct PSI_thread *m_thread;
/** Operation number of bytes. */
@@ -958,6 +962,8 @@ struct PSI_digest_storage
{
my_bool m_full;
int m_byte_count;
+ /** Character set number. */
+ uint m_charset_number;
unsigned char m_token_array[PSI_MAX_DIGEST_STORAGE_SIZE];
};
typedef struct PSI_digest_storage PSI_digest_storage;
@@ -969,6 +975,9 @@ struct PSI_digest_locker_state
};
typedef struct PSI_digest_locker_state PSI_digest_locker_state;
+/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
+#define PSI_SCHEMA_NAME_LEN (64 * 3)
+
/**
State data storage for @c get_thread_statement_locker_v1_t,
@c get_thread_statement_locker_v1_t.
@@ -1029,6 +1038,10 @@ struct PSI_statement_locker_state_v1
ulong m_sort_scan;
/** Statement digest. */
PSI_digest_locker_state m_digest_state;
+ /** Current schema name. */
+ char m_schema_name[PSI_SCHEMA_NAME_LEN];
+ /** Length in bytes of @c m_schema_name. */
+ uint m_schema_name_length;
};
/**
@@ -1187,10 +1200,13 @@ typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
Socket instrumentation initialisation API.
@param key the registered mutex key
@param socket descriptor
+ @param addr the socket ip address
+ @param addr_len length of socket ip address
@return an instrumented socket
*/
typedef struct PSI_socket* (*init_socket_v1_t)
- (PSI_socket_key key, const my_socket *fd);
+ (PSI_socket_key key, const my_socket *fd,
+ const struct sockaddr *addr, socklen_t addr_len);
/**
socket instrumentation destruction API.
@@ -1290,7 +1306,7 @@ typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
@return an instrumented thread
*/
typedef struct PSI_thread* (*new_thread_v1_t)
- (PSI_thread_key key, const void *identity, ulong thread_id);
+ (PSI_thread_key key, const void *identity, ulonglong thread_id);
/**
Assign an id to an instrumented thread.
@@ -1298,7 +1314,7 @@ typedef struct PSI_thread* (*new_thread_v1_t)
@param id the id to assign
*/
typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
- unsigned long id);
+ ulonglong id);
/**
Get the instrumentation for the running thread.
@@ -1570,16 +1586,18 @@ typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
@param op the operation to perform
@param src_file the source file name
@param src_line the source line number
- @return an instrumented file handle
*/
-typedef struct PSI_file* (*start_file_open_wait_v1_t)
+typedef void (*start_file_open_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
/**
End a file instrumentation open operation, for file streams.
@param locker the file locker.
+ @param result the opened file (NULL indicates failure, non NULL success).
+ @return an instrumented file handle
*/
-typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker);
+typedef struct PSI_file* (*end_file_open_wait_v1_t)
+ (struct PSI_file_locker *locker, void *result);
/**
End a file instrumentation open operation, for non stream files.
@@ -1617,6 +1635,25 @@ typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
/**
+ Start a file instrumentation close operation.
+ @param locker the file locker
+ @param op the operation to perform
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef void (*start_file_close_wait_v1_t)
+ (struct PSI_file_locker *locker, const char *src_file, uint src_line);
+
+/**
+ End a file instrumentation close operation.
+ @param locker the file locker.
+ @param rc the close operation return code (0 for success).
+ @return an instrumented file handle
+*/
+typedef void (*end_file_close_wait_v1_t)
+ (struct PSI_file_locker *locker, int rc);
+
+/**
Start a new stage, and implicitly end the previous stage.
@param key the key of the new stage
@param src_file the source file name
@@ -1632,11 +1669,12 @@ typedef void (*end_stage_v1_t) (void);
Get a statement instrumentation locker.
@param state data storage for the locker
@param key the statement instrumentation key
+ @param charset client character set
@return a statement locker, or NULL
*/
typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
(struct PSI_statement_locker_state_v1 *state,
- PSI_statement_key key);
+ PSI_statement_key key, const void *charset);
/**
Refine a statement locker to a more specific key.
@@ -1871,6 +1909,19 @@ typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
/**
+ Stores an array of connection attributes
+ @param buffer char array of length encoded connection attributes
+ in network format
+ @param length legnth of the data in buffer
+ @param from_cs charset in which @buffer is encodded
+ @return state
+ @retval non-0 attributes truncated
+ @retval 0 stored the attribute
+*/
+typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
+ const void *from_cs);
+
+/**
Performance Schema Interface, version 1.
@since PSI_VERSION_1
*/
@@ -2005,6 +2056,10 @@ struct PSI_v1
start_file_wait_v1_t start_file_wait;
/** @sa end_file_wait_v1_t. */
end_file_wait_v1_t end_file_wait;
+ /** @sa start_file_close_wait_v1_t. */
+ start_file_close_wait_v1_t start_file_close_wait;
+ /** @sa end_file_close_wait_v1_t. */
+ end_file_close_wait_v1_t end_file_close_wait;
/** @sa start_stage_v1_t. */
start_stage_v1_t start_stage;
/** @sa end_stage_v1_t. */
@@ -2065,6 +2120,8 @@ struct PSI_v1
digest_start_v1_t digest_start;
/** @sa digest_add_token_v1_t. */
digest_add_token_v1_t digest_add_token;
+ /** @sa set_thread_connect_attrs_v1_t. */
+ set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
/** @} (end of group Group_PSI_v1) */
@@ -2318,7 +2375,54 @@ typedef struct PSI_stage_info_none PSI_stage_info;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
-#define PSI_CALL(M) PSI_server->M
+/*
+ Allow to override PSI_XXX_CALL at compile time
+ with more efficient implementations, if available.
+ If nothing better is available,
+ make a dynamic call using the PSI_server function pointer.
+*/
+
+#ifndef PSI_MUTEX_CALL
+#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_RWLOCK_CALL
+#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_COND_CALL
+#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_THREAD_CALL
+#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_FILE_CALL
+#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_SOCKET_CALL
+#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_STAGE_CALL
+#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_STATEMENT_CALL
+#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_TABLE_CALL
+#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_IDLE_CALL
+#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#define PSI_DYNAMIC_CALL(M) PSI_server->M
/** @} */
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index b0559213998..f2037c5b724 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -221,6 +221,8 @@ struct PSI_file_locker_state_v1
uint m_flags;
enum PSI_file_operation m_operation;
struct PSI_file *m_file;
+ const char *m_name;
+ void *m_class;
struct PSI_thread *m_thread;
size_t m_number_of_bytes;
ulonglong m_timer_start;
@@ -243,6 +245,7 @@ struct PSI_digest_storage
{
my_bool m_full;
int m_byte_count;
+ uint m_charset_number;
unsigned char m_token_array[1024];
};
typedef struct PSI_digest_storage PSI_digest_storage;
@@ -278,6 +281,8 @@ struct PSI_statement_locker_state_v1
ulong m_sort_rows;
ulong m_sort_scan;
PSI_digest_locker_state m_digest_state;
+ char m_schema_name[(64 * 3)];
+ uint m_schema_name_length;
};
struct PSI_socket_locker_state_v1
{
@@ -318,7 +323,8 @@ typedef struct PSI_cond* (*init_cond_v1_t)
(PSI_cond_key key, const void *identity);
typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
typedef struct PSI_socket* (*init_socket_v1_t)
- (PSI_socket_key key, const my_socket *fd);
+ (PSI_socket_key key, const my_socket *fd,
+ const struct sockaddr *addr, socklen_t addr_len);
typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
typedef struct PSI_table_share* (*get_table_share_v1_t)
(my_bool temporary, struct TABLE_SHARE *share);
@@ -340,9 +346,9 @@ typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
const pthread_attr_t *attr,
void *(*start_routine)(void*), void *arg);
typedef struct PSI_thread* (*new_thread_v1_t)
- (PSI_thread_key key, const void *identity, ulong thread_id);
+ (PSI_thread_key key, const void *identity, ulonglong thread_id);
typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
- unsigned long id);
+ ulonglong id);
typedef struct PSI_thread* (*get_thread_v1_t)(void);
typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len,
@@ -420,9 +426,10 @@ typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t)
ulong flags,
const char *src_file, uint src_line);
typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
-typedef struct PSI_file* (*start_file_open_wait_v1_t)
+typedef void (*start_file_open_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
-typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker);
+typedef struct PSI_file* (*end_file_open_wait_v1_t)
+ (struct PSI_file_locker *locker, void *result);
typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t)
(struct PSI_file_locker *locker, File file);
typedef void (*start_file_wait_v1_t)
@@ -430,12 +437,16 @@ typedef void (*start_file_wait_v1_t)
const char *src_file, uint src_line);
typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
+typedef void (*start_file_close_wait_v1_t)
+ (struct PSI_file_locker *locker, const char *src_file, uint src_line);
+typedef void (*end_file_close_wait_v1_t)
+ (struct PSI_file_locker *locker, int rc);
typedef void (*start_stage_v1_t)
(PSI_stage_key key, const char *src_file, int src_line);
typedef void (*end_stage_v1_t) (void);
typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
(struct PSI_statement_locker_state_v1 *state,
- PSI_statement_key key);
+ PSI_statement_key key, const void *charset);
typedef struct PSI_statement_locker* (*refine_statement_v1_t)
(struct PSI_statement_locker *locker,
PSI_statement_key key);
@@ -499,6 +510,8 @@ typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
+typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
+ const void *from_cs);
struct PSI_v1
{
register_mutex_v1_t register_mutex;
@@ -566,6 +579,8 @@ struct PSI_v1
end_file_open_wait_and_bind_to_descriptor;
start_file_wait_v1_t start_file_wait;
end_file_wait_v1_t end_file_wait;
+ start_file_close_wait_v1_t start_file_close_wait;
+ end_file_close_wait_v1_t end_file_close_wait;
start_stage_v1_t start_stage;
end_stage_v1_t end_stage;
get_thread_statement_locker_v1_t get_thread_statement_locker;
@@ -596,6 +611,7 @@ struct PSI_v1
set_socket_thread_owner_v1_t set_socket_thread_owner;
digest_start_v1_t digest_start;
digest_add_token_v1_t digest_add_token;
+ set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
typedef struct PSI_v1 PSI;
typedef struct PSI_mutex_info_v1 PSI_mutex_info;
diff --git a/include/mysql/service_debug_sync.h b/include/mysql/service_debug_sync.h
index bb1202c5e63..eee8e6bbe96 100644
--- a/include/mysql/service_debug_sync.h
+++ b/include/mysql/service_debug_sync.h
@@ -339,9 +339,16 @@ extern void (*debug_sync_C_callback_ptr)(MYSQL_THD, const char *, size_t);
if (debug_sync_service) \
debug_sync_service(thd, STRING_WITH_LEN(name)); \
} while(0)
+
+#define DEBUG_SYNC_C_IF_THD(thd, name) \
+ do { \
+ if (debug_sync_service && thd) \
+ debug_sync_service((MYSQL_THD) thd, STRING_WITH_LEN(name)); \
+ } while(0)
#else
-#define DEBUG_SYNC(thd,name) do { } while(0)
-#endif
+#define DEBUG_SYNC(thd,name) do { } while(0)
+#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { } while(0)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
/* compatibility macro */
#define DEBUG_SYNC_C(name) DEBUG_SYNC(NULL, name)
diff --git a/include/mysql/service_my_plugin_log.h b/include/mysql/service_my_plugin_log.h
new file mode 100644
index 00000000000..0cf7817573c
--- /dev/null
+++ b/include/mysql/service_my_plugin_log.h
@@ -0,0 +1,64 @@
+/* Copyright (c) 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 */
+
+/**
+ @file
+ This service provides functions to report error conditions and log to
+ mysql error log.
+*/
+
+#ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+#define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdarg.h>
+#endif
+
+/* keep in sync with the loglevel enum in my_sys.h */
+enum plugin_log_level
+{
+ MY_ERROR_LEVEL,
+ MY_WARNING_LEVEL,
+ MY_INFORMATION_LEVEL
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct my_plugin_log_service
+{
+ /** write a message to the log */
+ int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
+} *my_plugin_log_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
+
+#else
+
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+ const char *format, ...);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 63b95bb5295..f38cc5ed52e 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -45,6 +45,7 @@
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
+#define TABLE_PARTITION_COMMENT_MAXLEN 1024
/*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
@@ -119,13 +120,19 @@ enum enum_server_command
#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
#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 */
+
+/**
+ Intern: Field in TABLE object for new version of altered table,
+ which participates in a newly added index.
+*/
+#define FIELD_IN_ADD_INDEX (1 << 20)
#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 HAS_EXPLICIT_VALUE (1 << 26) /* An INSERT/UPDATE operation supplied
+#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */
+#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
+#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */
+#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
+#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */
+#define HAS_EXPLICIT_VALUE (1 << 27) /* An INSERT/UPDATE operation supplied
an explicit default value */
#define REFRESH_GRANT (1UL << 0) /* Refresh grant tables */
@@ -154,12 +161,12 @@ enum enum_server_command
#define REFRESH_QUERY_CACHE_FREE (1UL << 17) /* pack query cache */
#define REFRESH_DES_KEY_FILE (1UL << 18)
#define REFRESH_USER_RESOURCES (1UL << 19)
+#define REFRESH_FOR_EXPORT (1UL << 20) /* FLUSH TABLES ... FOR EXPORT */
-#define REFRESH_TABLE_STATS (1UL << 20) /* Refresh table stats hash table */
-#define REFRESH_INDEX_STATS (1UL << 21) /* Refresh index stats hash table */
-#define REFRESH_USER_STATS (1UL << 22) /* Refresh user stats hash table */
-#define REFRESH_CLIENT_STATS (1UL << 23) /* Refresh client stats hash table */
-
+#define REFRESH_TABLE_STATS (1UL << 27) /* Refresh table stats hash table */
+#define REFRESH_INDEX_STATS (1UL << 28) /* Refresh index stats hash table */
+#define REFRESH_USER_STATS (1UL << 29) /* Refresh user stats hash table */
+#define REFRESH_CLIENT_STATS (1UL << 30) /* Refresh client stats hash table */
#define REFRESH_FAST (1UL << 31) /* Intern flag */
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
@@ -183,8 +190,15 @@ enum enum_server_command
#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */
#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */
-#define CLIENT_PROGRESS (1UL << 29) /* Client support progress indicator */
+#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */
+#define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */
+/* Enable authentication response packet to be larger than 255 bytes. */
+#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21)
+/* Don't close the connection for a connection with expired password. */
+#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22)
+
+#define CLIENT_PROGRESS (1UL << 29) /* Client support progress indicator */
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
/*
It used to be that if mysql_real_connect() failed, it would delete any
@@ -229,6 +243,12 @@ enum enum_server_command
CLIENT_PLUGIN_AUTH)
/*
+ To be added later:
+ CLIENT_CONNECT_ATTRS, CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA,
+ CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
+*/
+
+/*
Switch off the flags that are optional and depending on build flags
If any of the optional flags is supported by the build it will be switched
on before sending to the client during the connection handshake.
diff --git a/include/password.h b/include/password.h
index 082f917e7c0..5dfea533546 100644
--- a/include/password.h
+++ b/include/password.h
@@ -24,6 +24,8 @@ void my_make_scrambled_password_323(char *to, const char *password,
size_t pass_len);
void my_make_scrambled_password(char *to, const char *password,
size_t pass_len);
+void my_make_scrambled_password_sha1(char *to, const char *password,
+ size_t pass_len);
void hash_password(ulong *result, const char *password, uint password_len);
diff --git a/include/sha1.h b/include/sha1.h
index c3469333c27..b20cc8f5026 100644
--- a/include/sha1.h
+++ b/include/sha1.h
@@ -18,88 +18,13 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- This is the header file for code which implements the Secure
- Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
- April 17, 1995.
-
- Many of the variable names in this code, especially the
- single character names, were used because those were the names
- used in the publication.
-
- Please read the file sha1.c for more information.
-
- Modified 2002 by Peter Zaitsev to better follow MySQL standards
-
- Original Source from: http://www.faqs.org/rfcs/rfc3174.html
-
- Copyright (C) The Internet Society (2001). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
- Acknowledgement
- Funding for the RFC Editor function is currently provided by the
- Internet Society.
-*/
-
-
-enum sha_result_codes
-{
- SHA_SUCCESS = 0,
- SHA_NULL, /* Null pointer parameter */
- SHA_INPUT_TOO_LONG, /* input data too long */
- SHA_STATE_ERROR /* called Input after Result */
-};
-
#define SHA1_HASH_SIZE 20 /* Hash size in bytes */
-/*
- This structure will hold context information for the SHA-1
- hashing operation
-*/
-
-typedef struct SHA1_CONTEXT
-{
- ulonglong Length; /* Message length in bits */
- uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */
- int Computed; /* Is the digest computed? */
- int Corrupted; /* Is the message digest corrupted? */
- int16 Message_Block_Index; /* Index into message block array */
- uint8 Message_Block[64]; /* 512-bit message blocks */
-} SHA1_CONTEXT;
-
-/*
- Function Prototypes
-*/
-
C_MODE_START
-int mysql_sha1_reset(SHA1_CONTEXT*);
-int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
-int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
-
+void compute_sha1_hash(uint8 *digest, const char *buf, int len);
+void compute_sha1_hash_multi(uint8 *digest, const char *buf1, int len1,
+ const char *buf2, int len2);
C_MODE_END
#endif /* SHA__INCLUDED */
diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h
index 78526894e21..95f7cd95493 100644
--- a/include/thread_pool_priv.h
+++ b/include/thread_pool_priv.h
@@ -49,7 +49,6 @@ 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_lock_data(THD *thd);