diff options
Diffstat (limited to 'dep/mysqllite/include/mysql')
| -rw-r--r-- | dep/mysqllite/include/mysql/client_plugin.h | 163 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/innodb_priv.h | 36 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/plugin.h | 633 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/plugin_audit.h | 138 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/plugin_auth.h | 125 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/plugin_auth_common.h | 105 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/plugin_ftparser.h | 211 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/psi/mysql_file.h | 1434 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/psi/mysql_thread.h | 1071 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/psi/psi.h | 1312 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/psi/psi_abi_v1.h | 26 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/psi/psi_abi_v2.h | 26 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/service_my_snprintf.h | 101 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/service_thd_alloc.h | 130 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/service_thd_wait.h | 83 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/service_thread_scheduler.h | 65 | ||||
| -rw-r--r-- | dep/mysqllite/include/mysql/services.h | 32 |
17 files changed, 0 insertions, 5691 deletions
diff --git a/dep/mysqllite/include/mysql/client_plugin.h b/dep/mysqllite/include/mysql/client_plugin.h deleted file mode 100644 index cc3f468040f..00000000000 --- a/dep/mysqllite/include/mysql/client_plugin.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED -/* Copyright (C) 2010 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - 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 */ - -/** - @file - - MySQL Client Plugin API - - This file defines the API for plugins that work on the client side -*/ -#define MYSQL_CLIENT_PLUGIN_INCLUDED - -#ifndef MYSQL_ABI_CHECK -#include <stdarg.h> -#include <stdlib.h> -#endif - -/* known plugin types */ -#define MYSQL_CLIENT_reserved1 0 -#define MYSQL_CLIENT_reserved2 1 -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2 - -#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100 - -#define MYSQL_CLIENT_MAX_PLUGINS 3 - -#define mysql_declare_client_plugin(X) \ - MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \ - _mysql_client_plugin_declaration_ = { \ - MYSQL_CLIENT_ ## X ## _PLUGIN, \ - MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, -#define mysql_end_client_plugin } - -/* generic plugin header structure */ -#define MYSQL_CLIENT_PLUGIN_HEADER \ - int type; \ - unsigned int interface_version; \ - const char *name; \ - const char *author; \ - const char *desc; \ - unsigned int version[3]; \ - const char *license; \ - void *mysql_api; \ - int (*init)(char *, size_t, int, va_list); \ - int (*deinit)(); \ - int (*options)(const char *option, const void *); - -struct st_mysql_client_plugin -{ - MYSQL_CLIENT_PLUGIN_HEADER -}; - -struct st_mysql; - -/******** authentication plugin specific declarations *********/ -#include <mysql/plugin_auth_common.h> - -struct st_mysql_client_plugin_AUTHENTICATION -{ - MYSQL_CLIENT_PLUGIN_HEADER - int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); -}; - -/******** using plugins ************/ - -/** - loads a plugin and initializes it - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param ... arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, - int argc, ...); - -/** - loads a plugin and initializes it, taking va_list as an argument - - This is the same as mysql_load_plugin, but take va_list instead of - a list of arguments. - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded, -1 to disable type check - @param argc number of arguments to pass to the plugin initialization - function - @param args arguments for the plugin initialization function - - @retval - a pointer to the loaded plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, - int argc, va_list args); - -/** - finds an already loaded plugin by name, or loads it, if necessary - - @param mysql MYSQL structure. - @param name a name of the plugin to load - @param type type of plugin that should be loaded - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); - -/** - adds a plugin structure to the list of loaded plugins - - This is useful if an application has the necessary functionality - (for example, a special load data handler) statically linked into - the application binary. It can use this function to register the plugin - directly, avoiding the need to factor it out into a shared object. - - @param mysql MYSQL structure. It is only used for error reporting - @param plugin an st_mysql_client_plugin structure to register - - @retval - a pointer to the plugin, or NULL in case of a failure -*/ -struct st_mysql_client_plugin * -mysql_client_register_plugin(struct st_mysql *mysql, - struct st_mysql_client_plugin *plugin); - -/** - set plugin options - - Can be used to set extra options and affect behavior for a plugin. - This function may be called multiple times to set several options - - @param plugin an st_mysql_client_plugin structure - @param option a string which specifies the option to set - @param value value for the option. - - @retval 0 on success, 1 in case of failure -**/ -int STDCALL mysql_plugin_options(struct st_mysql_client_plugin *plugin, - const char *option, - const void *value); -#endif - diff --git a/dep/mysqllite/include/mysql/innodb_priv.h b/dep/mysqllite/include/mysql/innodb_priv.h deleted file mode 100644 index 5406c292b18..00000000000 --- a/dep/mysqllite/include/mysql/innodb_priv.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef INNODB_PRIV_INCLUDED -#define INNODB_PRIV_INCLUDED - -/** @file Declaring server-internal functions that are used by InnoDB. */ - -#include <sql_priv.h> - -class THD; - -int get_quote_char_for_identifier(THD *thd, const char *name, uint length); -bool schema_table_store_record(THD *thd, TABLE *table); -void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); -bool check_global_access(THD *thd, ulong want_access); -uint strconvert(CHARSET_INFO *from_cs, const char *from, - CHARSET_INFO *to_cs, char *to, uint to_length, - uint *errors); -void sql_print_error(const char *format, ...); - - - -#endif /* INNODB_PRIV_INCLUDED */ diff --git a/dep/mysqllite/include/mysql/plugin.h b/dep/mysqllite/include/mysql/plugin.h deleted file mode 100644 index 7ec68ff5040..00000000000 --- a/dep/mysqllite/include/mysql/plugin.h +++ /dev/null @@ -1,633 +0,0 @@ -/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef _my_plugin_h -#define _my_plugin_h - -/* - On Windows, exports from DLL need to be declared - Also, plugin needs to be declared as extern "C" because MSVC - unlike other compilers, uses C++ mangling for variables not only - for functions. -*/ -#if defined(_MSC_VER) -#if defined(MYSQL_DYNAMIC_PLUGIN) - #ifdef __cplusplus - #define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) - #else - #define MYSQL_PLUGIN_EXPORT __declspec(dllexport) - #endif -#else /* MYSQL_DYNAMIC_PLUGIN */ - #ifdef __cplusplus - #define MYSQL_PLUGIN_EXPORT extern "C" - #else - #define MYSQL_PLUGIN_EXPORT - #endif -#endif /*MYSQL_DYNAMIC_PLUGIN */ -#else /*_MSC_VER */ -#define MYSQL_PLUGIN_EXPORT -#endif - -#ifdef __cplusplus -class THD; -class Item; -#define MYSQL_THD THD* -#else -#define MYSQL_THD void* -#endif - -#include <mysql/services.h> - -#define MYSQL_XIDDATASIZE 128 -/** - struct st_mysql_xid is binary compatible with the XID structure as - in the X/Open CAE Specification, Distributed Transaction Processing: - The XA Specification, X/Open Company Ltd., 1991. - http://www.opengroup.org/bookstore/catalog/c193.htm - - @see XID in sql/handler.h -*/ -struct st_mysql_xid { - long formatID; - long gtrid_length; - long bqual_length; - char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */ -}; -typedef struct st_mysql_xid MYSQL_XID; - -/************************************************************************* - Plugin API. Common for all plugin types. -*/ - -#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102 - -/* - The allowable types of plugins -*/ -#define MYSQL_UDF_PLUGIN 0 /* User-defined function */ -#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */ -#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ -#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ -#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ -#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 */ - -/* We use the following strings to define licenses for plugins */ -#define PLUGIN_LICENSE_PROPRIETARY 0 -#define PLUGIN_LICENSE_GPL 1 -#define PLUGIN_LICENSE_BSD 2 - -#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" -#define PLUGIN_LICENSE_GPL_STRING "GPL" -#define PLUGIN_LICENSE_BSD_STRING "BSD" - -/* - Macros for beginning and ending plugin declarations. Between - mysql_declare_plugin and mysql_declare_plugin_end there should - be a st_mysql_plugin struct for each plugin to be declared. -*/ - - -#ifndef MYSQL_DYNAMIC_PLUGIN -#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ -MYSQL_PLUGIN_EXPORT int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ -MYSQL_PLUGIN_EXPORT int PSIZE= sizeof(struct st_mysql_plugin); \ -MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[]= { -#else -#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ -MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ -MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ -MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= { -#endif - -#define mysql_declare_plugin(NAME) \ -__MYSQL_DECLARE_PLUGIN(NAME, \ - builtin_ ## NAME ## _plugin_interface_version, \ - builtin_ ## NAME ## _sizeof_struct_st_plugin, \ - builtin_ ## NAME ## _plugin) - -#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}} - -/* - declarations for SHOW STATUS support in plugins -*/ -enum enum_mysql_show_type -{ - SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, - SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, - SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_always_last -}; - -struct st_mysql_show_var { - const char *name; - char *value; - enum enum_mysql_show_type type; -}; - -#define SHOW_VAR_FUNC_BUFF_SIZE 1024 -typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *); - - -/* - declarations for server variables and command line options -*/ - - -#define PLUGIN_VAR_BOOL 0x0001 -#define PLUGIN_VAR_INT 0x0002 -#define PLUGIN_VAR_LONG 0x0003 -#define PLUGIN_VAR_LONGLONG 0x0004 -#define PLUGIN_VAR_STR 0x0005 -#define PLUGIN_VAR_ENUM 0x0006 -#define PLUGIN_VAR_SET 0x0007 -#define PLUGIN_VAR_UNSIGNED 0x0080 -#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ -#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ -#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */ -#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */ -#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */ -#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */ -#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */ -#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */ - -struct st_mysql_sys_var; -struct st_mysql_value; - -/* - SYNOPSIS - (*mysql_var_check_func)() - thd thread handle - var dynamic variable being altered - save pointer to temporary storage - value user provided value - RETURN - 0 user provided value is OK and the update func may be called. - any other value indicates error. - - This function should parse the user provided value and store in the - provided temporary storage any data as required by the update func. - There is sufficient space in the temporary storage to store a double. - Note that the update func may not be called if any other error occurs - so any memory allocated should be thread-local so that it may be freed - automatically at the end of the statement. -*/ - -typedef int (*mysql_var_check_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *save, struct st_mysql_value *value); - -/* - SYNOPSIS - (*mysql_var_update_func)() - thd thread handle - var dynamic variable being altered - var_ptr pointer to dynamic variable - save pointer to temporary storage - RETURN - NONE - - This function should use the validated value stored in the temporary store - and persist it in the provided pointer to the dynamic variable. - For example, strings may require memory to be allocated. -*/ -typedef void (*mysql_var_update_func)(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save); - - -/* the following declarations are for internal use only */ - - -#define PLUGIN_VAR_MASK \ - (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ - PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ - PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC) - -#define MYSQL_PLUGIN_VAR_HEADER \ - int flags; \ - const char *name; \ - const char *comment; \ - mysql_var_check_func check; \ - mysql_var_update_func update - -#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name -#define MYSQL_SYSVAR(name) \ - ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name))) - -/* - for global variables, the value pointer is the first - element after the header, the default value is the second. - for thread variables, the value offset is the first - element after the header, the default value is the second. -*/ - - -#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; \ - const type def_val; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; type def_val; \ - type min_val; type max_val; \ - type blk_sz; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - type *value; type def_val; \ - TYPELIB *typelib; \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_THDVAR_FUNC(type) \ - type *(*resolve)(MYSQL_THD thd, int offset) - -#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - const type def_val; \ - DECLARE_THDVAR_FUNC(type); \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - type def_val; type min_val; \ - type max_val; type blk_sz; \ - DECLARE_THDVAR_FUNC(type); \ -} MYSQL_SYSVAR_NAME(name) - -#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \ - MYSQL_PLUGIN_VAR_HEADER; \ - int offset; \ - type def_val; \ - DECLARE_THDVAR_FUNC(type); \ - TYPELIB *typelib; \ -} MYSQL_SYSVAR_NAME(name) - - -/* - the following declarations are for use by plugin implementors -*/ - -#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \ -DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \ - PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def} - -#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \ -DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \ - PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def} - -#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ - PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \ - PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \ - PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ - PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, typelib } - -#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ - PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, typelib } - -#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ -DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ - PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL} - -#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \ -DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \ - PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL} - -#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \ - PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, min, max, blk, NULL } - -#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \ - PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL, typelib } - -#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ -DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ - PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, -1, def, NULL, typelib } - -/* accessor macros */ - -#define SYSVAR(name) \ - (*(MYSQL_SYSVAR_NAME(name).value)) - -/* when thd == null, result points to global value */ -#define THDVAR(thd, name) \ - (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset))) - - -/* - Plugin description structure. -*/ - -struct st_mysql_plugin -{ - int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - void *info; /* pointer to type-specific plugin descriptor */ - const char *name; /* plugin name */ - const char *author; /* plugin author (for I_S.PLUGINS) */ - const char *descr; /* general descriptive text (for I_S.PLUGINS) */ - int license; /* the plugin license (PLUGIN_LICENSE_XXX) */ - int (*init)(void *); /* the function to invoke when plugin is loaded */ - int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ - unsigned int version; /* plugin version (for I_S.PLUGINS) */ - struct st_mysql_show_var *status_vars; - struct st_mysql_sys_var **system_vars; - void * __reserved1; /* reserved for dependency checking */ -}; - -/************************************************************************* - API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) -*/ -#include "plugin_ftparser.h" - -/************************************************************************* - API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_daemon -{ - int interface_version; -}; - - -/************************************************************************* - API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_information_schema -{ - int interface_version; -}; - - -/************************************************************************* - API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) -*/ - -/* handlertons of different MySQL releases are incompatible */ -#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) - -/* - The real API is in the sql/handler.h - Here we define only the descriptor structure, that is referred from - st_mysql_plugin. -*/ - -struct st_mysql_storage_engine -{ - int interface_version; -}; - -struct handlerton; - - -/* - API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) -*/ - #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100 - - /** - Replication plugin descriptor - */ - struct Mysql_replication { - int interface_version; - }; - -/************************************************************************* - st_mysql_value struct for reading values from mysqld. - Used by server variables framework to parse user-provided values. - Will be used for arguments when implementing UDFs. - - Note that val_str() returns a string in temporary memory - that will be freed at the end of statement. Copy the string - if you need it to persist. -*/ - -#define MYSQL_VALUE_TYPE_STRING 0 -#define MYSQL_VALUE_TYPE_REAL 1 -#define MYSQL_VALUE_TYPE_INT 2 - -struct st_mysql_value -{ - int (*value_type)(struct st_mysql_value *); - const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); - int (*val_real)(struct st_mysql_value *, double *realbuf); - int (*val_int)(struct st_mysql_value *, long long *intbuf); - int (*is_unsigned)(struct st_mysql_value *); -}; - - -/************************************************************************* - Miscellaneous functions for plugin implementors -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -int thd_in_lock_tables(const MYSQL_THD thd); -int thd_tablespace_op(const MYSQL_THD thd); -long long thd_test_options(const MYSQL_THD thd, long long test_options); -int thd_sql_command(const MYSQL_THD thd); -const char *thd_proc_info(MYSQL_THD thd, const char *info); -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); -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 */ -void thd_inc_row_count(MYSQL_THD thd); - -/** - Create a temporary file. - - @details - The temporary file is created in a location specified by the mysql - server configuration (--tmpdir option). The caller does not need to - delete the file, it will be deleted automatically. - - @param prefix prefix for temporary file name - @retval -1 error - @retval >= 0 a file handle that can be passed to dup or my_close -*/ -int mysql_tmpfile(const char *prefix); - -/** - Check the killed state of a connection - - @details - In MySQL support for the KILL statement is cooperative. The KILL - statement only sets a "killed" flag. This function returns the value - of that flag. A thread should check it often, especially inside - time-consuming loops, and gracefully abort the operation if it is - non-zero. - - @param thd user thread connection handle - @retval 0 the connection is active - @retval 1 the connection has been killed -*/ -int thd_killed(const MYSQL_THD thd); - - -/** - Return the thread id of a user thread - - @param thd user thread connection handle - @return thread id -*/ -unsigned long thd_get_thread_id(const MYSQL_THD thd); - -/** - Get the XID for this connection's transaction - - @param thd user thread connection handle - @param xid location where identifier is stored -*/ -void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid); - -/** - Invalidate the query cache for a given table. - - @param thd user thread connection handle - @param key databasename\\0tablename\\0 - @param key_length length of key in bytes, including the NUL bytes - @param using_trx flag: TRUE if using transactions, FALSE otherwise -*/ -void mysql_query_cache_invalidate4(MYSQL_THD thd, - const char *key, unsigned int key_length, - int using_trx); - - -/** - Provide a handler data getter to simplify coding -*/ -void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton); - - -/** - Provide a handler data setter to simplify coding - - @details - Set ha_data pointer (storage engine per-connection information). - - To avoid unclean deactivation (uninstall) of storage engine plugin - in the middle of transaction, additional storage engine plugin - lock is acquired. - - If ha_data is not null and storage engine plugin was not locked - by thd_set_ha_data() in this connection before, storage engine - plugin gets locked. - - If ha_data is null and storage engine plugin was locked by - thd_set_ha_data() in this connection before, storage engine - plugin lock gets released. - - If handlerton::close_connection() didn't reset ha_data, server does - it immediately after calling handlerton::close_connection(). -*/ -void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, - const void *ha_data); -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/dep/mysqllite/include/mysql/plugin_audit.h b/dep/mysqllite/include/mysql/plugin_audit.h deleted file mode 100644 index 8811c832949..00000000000 --- a/dep/mysqllite/include/mysql/plugin_audit.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (C) 2007 MySQL 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 */ - -#ifndef _my_audit_h -#define _my_audit_h - -/************************************************************************* - API for Audit plugin. (MYSQL_AUDIT_PLUGIN) -*/ - -#include "plugin.h" - -#define MYSQL_AUDIT_CLASS_MASK_SIZE 1 - -#define MYSQL_AUDIT_INTERFACE_VERSION 0x0200 - -/* - The first word in every event class struct indicates the specific - class of the event. -*/ -struct mysql_event -{ - unsigned int event_class; -}; - - -/************************************************************************* - AUDIT CLASS : GENERAL - - LOG events occurs before emitting to the general query log. - ERROR events occur before transmitting errors to the user. - RESULT events occur after transmitting a resultset to the user. - STATUS events occur after transmitting a resultset or errors - to the user. -*/ - -#define MYSQL_AUDIT_GENERAL_CLASS 0 -#define MYSQL_AUDIT_GENERAL_CLASSMASK (1 << MYSQL_AUDIT_GENERAL_CLASS) -#define MYSQL_AUDIT_GENERAL_LOG 0 -#define MYSQL_AUDIT_GENERAL_ERROR 1 -#define MYSQL_AUDIT_GENERAL_RESULT 2 -#define MYSQL_AUDIT_GENERAL_STATUS 3 - -struct mysql_event_general -{ - unsigned int event_class; - unsigned int event_subclass; - int general_error_code; - unsigned long general_thread_id; - const char *general_user; - unsigned int general_user_length; - const char *general_command; - unsigned int general_command_length; - const char *general_query; - unsigned int general_query_length; - struct charset_info_st *general_charset; - unsigned long long general_time; - unsigned long long general_rows; -}; - - -/* - AUDIT CLASS : CONNECTION - - CONNECT occurs after authentication phase is completed. - DISCONNECT occurs after connection is terminated. - CHANGE_USER occurs after COM_CHANGE_USER RPC is completed. -*/ - -#define MYSQL_AUDIT_CONNECTION_CLASS 1 -#define MYSQL_AUDIT_CONNECTION_CLASSMASK (1 << MYSQL_AUDIT_CONNECTION_CLASS) -#define MYSQL_AUDIT_CONNECTION_CONNECT 0 -#define MYSQL_AUDIT_CONNECTION_DISCONNECT 1 -#define MYSQL_AUDIT_CONNECTION_CHANGE_USER 2 - -struct mysql_event_connection -{ - unsigned int event_class; - unsigned int event_subclass; - int status; - unsigned long thread_id; - const char *user; - unsigned int user_length; - const char *priv_user; - unsigned int priv_user_length; - const char *external_user; - unsigned int external_user_length; - const char *proxy_user; - unsigned int proxy_user_length; - const char *host; - unsigned int host_length; - const char *ip; - unsigned int ip_length; - const char *database; - unsigned int database_length; -}; - - -/************************************************************************* - Here we define the descriptor structure, that is referred from - st_mysql_plugin. - - release_thd() event occurs when the event class consumer is to be - disassociated from the specified THD. This would typically occur - before some operation which may require sleeping - such as when - waiting for the next query from the client. - - event_notify() is invoked whenever an event occurs which is of any - class for which the plugin has interest. The first word of the - mysql_event argument indicates the specific event class and the - remainder of the structure is as required for that class. - - class_mask is an array of bits used to indicate what event classes - that this plugin wants to receive. -*/ - -struct st_mysql_audit -{ - int interface_version; - void (*release_thd)(MYSQL_THD); - void (*event_notify)(MYSQL_THD, const struct mysql_event *); - unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE]; -}; - - -#endif diff --git a/dep/mysqllite/include/mysql/plugin_auth.h b/dep/mysqllite/include/mysql/plugin_auth.h deleted file mode 100644 index 420eb3bb80f..00000000000 --- a/dep/mysqllite/include/mysql/plugin_auth.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef MYSQL_PLUGIN_AUTH_INCLUDED -/* Copyright (C) 2010 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - 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 */ - -/** - @file - - Authentication Plugin API. - - This file defines the API for server authentication plugins. -*/ - -#define MYSQL_PLUGIN_AUTH_INCLUDED - -#include <mysql/plugin.h> - -#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100 - -#include <mysql/plugin_auth_common.h> - -/* defines for MYSQL_SERVER_AUTH_INFO.password_used */ - -#define PASSWORD_USED_NO 0 -#define PASSWORD_USED_YES 1 -#define PASSWORD_USED_NO_MENTION 2 - - -/** - Provides server plugin access to authentication information -*/ -typedef struct st_mysql_server_auth_info -{ - /** - User name as sent by the client and shown in USER(). - NULL if the client packet with the user name was not received yet. - */ - char *user_name; - - /** - Length of user_name - */ - unsigned int user_name_length; - - /** - A corresponding column value from the mysql.user table for the - matching account name - */ - const char *auth_string; - - /** - Length of auth_string - */ - unsigned long auth_string_length; - - /** - Matching account name as found in the mysql.user table. - A plugin can override it with another name that will be - used by MySQL for authorization, and shown in CURRENT_USER() - */ - char authenticated_as[MYSQL_USERNAME_LENGTH+1]; - - - /** - The unique user name that was used by the plugin to authenticate. - Plugins should put null-terminated UTF-8 here. - Available through the @@EXTERNAL_USER variable. - */ - char external_user[512]; - - /** - This only affects the "Authentication failed. Password used: %s" - error message. has the following values : - 0 : %s will be NO. - 1 : %s will be YES. - 2 : there will be no %s. - Set it as appropriate or ignore at will. - */ - int password_used; - - /** - Set to the name of the connected client host, if it can be resolved, - or to its IP address otherwise. - */ - const char *host_or_ip; - - /** - Length of host_or_ip - */ - unsigned int host_or_ip_length; - -} MYSQL_SERVER_AUTH_INFO; - -/** - Server authentication plugin descriptor -*/ -struct st_mysql_auth -{ - int interface_version; /** version plugin uses */ - /** - A plugin that a client must use for authentication with this server - plugin. Can be NULL to mean "any plugin". - */ - const char *client_auth_plugin; - /** - Function provided by the plugin which should perform authentication (using - the vio functions if necessary) and return 0 if successful. The plugin can - also fill the info.authenticated_as field if a different username should be - used for authorization. - */ - int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); -}; -#endif - diff --git a/dep/mysqllite/include/mysql/plugin_auth_common.h b/dep/mysqllite/include/mysql/plugin_auth_common.h deleted file mode 100644 index 4ad92d01bfb..00000000000 --- a/dep/mysqllite/include/mysql/plugin_auth_common.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED -/* Copyright (C) 2010 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - 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 */ - -/** - @file - - This file defines constants and data structures that are the same for - both client- and server-side authentication plugins. -*/ -#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED - -/** the max allowed length for a user name */ -#define MYSQL_USERNAME_LENGTH 48 - -/** - return values of the plugin authenticate_user() method. -*/ - -/** - Authentication failed. Additionally, all other CR_xxx values - (libmysql error code) can be used too. - - The client plugin may set the error code and the error message directly - in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error - code was returned, an error message in the MYSQL structure will be - overwritten. If CR_ERROR is returned without setting the error in MYSQL, - CR_UNKNOWN_ERROR will be user. -*/ -#define CR_ERROR 0 -/** - Authentication (client part) was successful. It does not mean that the - authentication as a whole was successful, usually it only means - that the client was able to send the user name and the password to the - server. If CR_OK is returned, the libmysql reads the next packet expecting - it to be one of OK, ERROR, or CHANGE_PLUGIN packets. -*/ -#define CR_OK -1 -/** - Authentication was successful. - It means that the client has done its part successfully and also that - a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). - In this case, libmysql will not read a packet from the server, - but it will use the data at mysql->net.read_pos. - - A plugin may return this value if the number of roundtrips in the - authentication protocol is not known in advance, and the client plugin - needs to read one packet more to determine if the authentication is finished - or not. -*/ -#define CR_OK_HANDSHAKE_COMPLETE -2 - -typedef struct st_plugin_vio_info -{ - enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, - MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; - int socket; /**< it's set, if the protocol is SOCKET or TCP */ -#ifdef _WIN32 - HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */ -#endif -} MYSQL_PLUGIN_VIO_INFO; - -/** - Provides plugin access to communication channel -*/ -typedef struct st_plugin_vio -{ - /** - Plugin provides a pointer reference and this function sets it to the - contents of any incoming packet. Returns the packet length, or -1 if - the plugin should terminate. - */ - int (*read_packet)(struct st_plugin_vio *vio, - unsigned char **buf); - - /** - Plugin provides a buffer with data and the length and this - function sends it as a packet. Returns 0 on success, 1 on failure. - */ - int (*write_packet)(struct st_plugin_vio *vio, - const unsigned char *packet, - int packet_len); - - /** - Fills in a st_plugin_vio_info structure, providing the information - about the connection. - */ - void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); - -} MYSQL_PLUGIN_VIO; - -#endif - diff --git a/dep/mysqllite/include/mysql/plugin_ftparser.h b/dep/mysqllite/include/mysql/plugin_ftparser.h deleted file mode 100644 index 7f9bde3a6a0..00000000000 --- a/dep/mysqllite/include/mysql/plugin_ftparser.h +++ /dev/null @@ -1,211 +0,0 @@ -/* Copyright (C) 2005 MySQL 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 */ - -#ifndef _my_plugin_ftparser_h -#define _my_plugin_ftparser_h -#include "plugin.h" - -/************************************************************************* - API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) -*/ - -#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100 - -/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */ -enum enum_ftparser_mode -{ -/* - Fast and simple mode. This mode is used for indexing, and natural - language queries. - - The parser is expected to return only those words that go into the - index. Stopwords or too short/long words should not be returned. The - 'boolean_info' argument of mysql_add_word() does not have to be set. -*/ - MYSQL_FTPARSER_SIMPLE_MODE= 0, - -/* - Parse with stopwords mode. This mode is used in boolean searches for - "phrase matching." - - The parser is not allowed to ignore words in this mode. Every word - should be returned, including stopwords and words that are too short - or long. The 'boolean_info' argument of mysql_add_word() does not - have to be set. -*/ - MYSQL_FTPARSER_WITH_STOPWORDS= 1, - -/* - Parse in boolean mode. This mode is used to parse a boolean query string. - - The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO - structure in the 'boolean_info' argument to mysql_add_word(). - Usually that means that the parser should recognize boolean operators - in the parsing stream and set appropriate fields in - MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for - MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored. - Instead, use FT_TOKEN_STOPWORD for the token type of such a word. -*/ - MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 -}; - -/* - Token types for boolean mode searching (used for the type member of - MYSQL_FTPARSER_BOOLEAN_INFO struct) - - FT_TOKEN_EOF: End of data. - FT_TOKEN_WORD: Regular word. - FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression). - FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression). - FT_TOKEN_STOPWORD: Stopword. -*/ - -enum enum_ft_token_type -{ - FT_TOKEN_EOF= 0, - FT_TOKEN_WORD= 1, - FT_TOKEN_LEFT_PAREN= 2, - FT_TOKEN_RIGHT_PAREN= 3, - FT_TOKEN_STOPWORD= 4 -}; - -/* - This structure is used in boolean search mode only. It conveys - boolean-mode metadata to the MySQL search engine for every word in - the search query. A valid instance of this structure must be filled - in by the plugin parser and passed as an argument in the call to - mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM - structure) when a query is parsed in boolean mode. - - type: The token type. Should be one of the enum_ft_token_type values. - - yesno: Whether the word must be present for a match to occur: - >0 Must be present - <0 Must not be present - 0 Neither; the word is optional but its presence increases the relevance - With the default settings of the ft_boolean_syntax system variable, - >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator, - and 0 means neither operator was used. - - weight_adjust: A weighting factor that determines how much a match - for the word counts. Positive values increase, negative - decrease the - relative word's importance in the query. - - wasign: The sign of the word's weight in the query. If it's non-negative - the match for the word will increase document relevance, if it's - negative - decrease (the word becomes a "noise word", the less of it the - better). - - trunc: Corresponds to the '*' operator in the default setting of the - ft_boolean_syntax system variable. -*/ - -typedef struct st_mysql_ftparser_boolean_info -{ - enum enum_ft_token_type type; - int yesno; - int weight_adjust; - char wasign; - char trunc; - /* These are parser state and must be removed. */ - char prev; - char *quot; -} MYSQL_FTPARSER_BOOLEAN_INFO; - -/* - The following flag means that buffer with a string (document, word) - may be overwritten by the caller before the end of the parsing (that is - before st_mysql_ftparser::deinit() call). If one needs the string - to survive between two successive calls of the parsing function, she - needs to save a copy of it. The flag may be set by MySQL before calling - st_mysql_ftparser::parse(), or it may be set by a plugin before calling - st_mysql_ftparser_param::mysql_parse() or - st_mysql_ftparser_param::mysql_add_word(). -*/ -#define MYSQL_FTFLAGS_NEED_COPY 1 - -/* - An argument of the full-text parser plugin. This structure is - filled in by MySQL server and passed to the parsing function of the - plugin as an in/out parameter. - - mysql_parse: A pointer to the built-in parser implementation of the - server. It's set by the server and can be used by the parser plugin - to invoke the MySQL default parser. If plugin's role is to extract - textual data from .doc, .pdf or .xml content, it might extract - plaintext from the content, and then pass the text to the default - MySQL parser to be parsed. - - mysql_add_word: A server callback to add a new word. When parsing - a document, the server sets this to point at a function that adds - the word to MySQL full-text index. When parsing a search query, - this function will add the new word to the list of words to search - for. The boolean_info argument can be NULL for all cases except - when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. - - ftparser_state: A generic pointer. The plugin can set it to point - to information to be used internally for its own purposes. - - mysql_ftparam: This is set by the server. It is used by MySQL functions - called via mysql_parse() and mysql_add_word() callback. The plugin - should not modify it. - - cs: Information about the character set of the document or query string. - - doc: A pointer to the document or query string to be parsed. - - length: Length of the document or query string, in bytes. - - flags: See MYSQL_FTFLAGS_* constants above. - - mode: The parsing mode. With boolean operators, with stopwords, or - nothing. See enum_ftparser_mode above. -*/ - -typedef struct st_mysql_ftparser_param -{ - int (*mysql_parse)(struct st_mysql_ftparser_param *, - char *doc, int doc_len); - int (*mysql_add_word)(struct st_mysql_ftparser_param *, - char *word, int word_len, - MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); - void *ftparser_state; - void *mysql_ftparam; - struct charset_info_st *cs; - char *doc; - int length; - int flags; - enum enum_ftparser_mode mode; -} MYSQL_FTPARSER_PARAM; - -/* - Full-text parser descriptor. - - interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION. - The parsing, initialization, and deinitialization functions are - invoked per SQL statement for which the parser is used. -*/ - -struct st_mysql_ftparser -{ - int interface_version; - int (*parse)(MYSQL_FTPARSER_PARAM *param); - int (*init)(MYSQL_FTPARSER_PARAM *param); - int (*deinit)(MYSQL_FTPARSER_PARAM *param); -}; - - -#endif - diff --git a/dep/mysqllite/include/mysql/psi/mysql_file.h b/dep/mysqllite/include/mysql/psi/mysql_file.h deleted file mode 100644 index 6fc6689c47d..00000000000 --- a/dep/mysqllite/include/mysql/psi/mysql_file.h +++ /dev/null @@ -1,1434 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_FILE_H -#define MYSQL_FILE_H - -#include <my_global.h> - -/* For strlen() */ -#include <string.h> -/* For MY_STAT */ -#include <my_dir.h> -/* For my_chsize */ -#include <my_sys.h> - -/** - @file mysql/psi/mysql_file.h - Instrumentation helpers for mysys file io. - This header file provides the necessary declarations - to use the mysys file API with the performance schema instrumentation. - In some compilers (SunStudio), 'static inline' functions, when declared - but not used, are not optimized away (because they are unused) by default, - so that including a static inline function from a header file does - create unwanted dependencies, causing unresolved symbols at link time. - Other compilers, like gcc, optimize these dependencies by default. - - Since the instrumented APIs declared here are wrapper on top - of mysys file io APIs, including mysql/psi/mysql_file.h assumes that - the dependency on my_sys already exists. -*/ - -#include "mysql/psi/psi.h" - -/** - @defgroup File_instrumentation File Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - @def mysql_file_fgets(P1, P2, F) - Instrumented fgets. - @c mysql_file_fgets is a replacement for @c fgets. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fgets(P1, P2, F) \ - inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F) -#else - #define mysql_file_fgets(P1, P2, F) \ - inline_mysql_file_fgets(P1, P2, F) -#endif - -/** - @def mysql_file_fgetc(F) - Instrumented fgetc. - @c mysql_file_fgetc is a replacement for @c fgetc. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F) -#else - #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F) -#endif - -/** - @def mysql_file_fputs(P1, F) - Instrumented fputs. - @c mysql_file_fputs is a replacement for @c fputs. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fputs(P1, F) \ - inline_mysql_file_fputs(__FILE__, __LINE__, P1, F) -#else - #define mysql_file_fputs(P1, F)\ - inline_mysql_file_fputs(P1, F) -#endif - -/** - @def mysql_file_fputc(P1, F) - Instrumented fputc. - @c mysql_file_fputc is a replacement for @c fputc. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fputc(P1, F) \ - inline_mysql_file_fputc(__FILE__, __LINE__, P1, F) -#else - #define mysql_file_fputc(P1, F) \ - inline_mysql_file_fputc(P1, F) -#endif - -/** - @def mysql_file_fprintf - Instrumented fprintf. - @c mysql_file_fprintf is a replacement for @c fprintf. -*/ -#define mysql_file_fprintf inline_mysql_file_fprintf - -/** - @def mysql_file_vfprintf(F, P1, P2) - Instrumented vfprintf. - @c mysql_file_vfprintf is a replacement for @c vfprintf. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_vfprintf(F, P1, P2) \ - inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2) -#else - #define mysql_file_vfprintf(F, P1, P2) \ - inline_mysql_file_vfprintf(F, P1, P2) -#endif - -/** - @def mysql_file_fflush(F, P1, P2) - Instrumented fflush. - @c mysql_file_fflush is a replacement for @c fflush. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fflush(F) \ - inline_mysql_file_fflush(__FILE__, __LINE__, F) -#else - #define mysql_file_fflush(F) \ - inline_mysql_file_fflush(F) -#endif - -/** - @def mysql_file_feof(F) - Instrumented feof. - @c mysql_file_feof is a replacement for @c feof. -*/ -#define mysql_file_feof(F) inline_mysql_file_feof(F) - -/** - @def mysql_file_fstat(FN, S, FL) - Instrumented fstat. - @c mysql_file_fstat is a replacement for @c my_fstat. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fstat(FN, S, FL) \ - inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL) -#else - #define mysql_file_fstat(FN, S, FL) \ - inline_mysql_file_fstat(FN, S, FL) -#endif - -/** - @def mysql_file_stat(K, FN, S, FL) - Instrumented stat. - @c mysql_file_stat is a replacement for @c my_stat. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_stat(K, FN, S, FL) \ - inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL) -#else - #define mysql_file_stat(K, FN, S, FL) \ - inline_mysql_file_stat(FN, S, FL) -#endif - -/** - @def mysql_file_chsize(F, P1, P2, P3) - Instrumented chsize. - @c mysql_file_chsize is a replacement for @c my_chsize. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_chsize(F, P1, P2, P3) \ - inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3) -#else - #define mysql_file_chsize(F, P1, P2, P3) \ - inline_mysql_file_chsize(F, P1, P2, P3) -#endif - -/** - @def mysql_file_fopen(K, N, F1, F2) - Instrumented fopen. - @c mysql_file_fopen is a replacement for @c my_fopen. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fopen(K, N, F1, F2) \ - inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2) -#else - #define mysql_file_fopen(K, N, F1, F2) \ - inline_mysql_file_fopen(N, F1, F2) -#endif - -/** - @def mysql_file_fclose(FD, FL) - Instrumented fclose. - @c mysql_file_fclose is a replacement for @c my_fclose. - Without the instrumentation, this call will have the same behavior as the - undocumented and possibly platform specific my_fclose(NULL, ...) behavior. - With the instrumentation, mysql_fclose(NULL, ...) will safely return 0, - which is an extension compared to my_fclose and is therefore compliant. - mysql_fclose is on purpose *not* implementing - @code DBUG_ASSERT(file != NULL) @endcode, - since doing so could introduce regressions. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fclose(FD, FL) \ - inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL) -#else - #define mysql_file_fclose(FD, FL) \ - inline_mysql_file_fclose(FD, FL) -#endif - -/** - @def mysql_file_fread(FD, P1, P2, P3) - Instrumented fread. - @c mysql_file_fread is a replacement for @c my_fread. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fread(FD, P1, P2, P3) \ - inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3) -#else - #define mysql_file_fread(FD, P1, P2, P3) \ - inline_mysql_file_fread(FD, P1, P2, P3) -#endif - -/** - @def mysql_file_fwrite(FD, P1, P2, P3) - Instrumented fwrite. - @c mysql_file_fwrite is a replacement for @c my_fwrite. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fwrite(FD, P1, P2, P3) \ - inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3) -#else - #define mysql_file_fwrite(FD, P1, P2, P3) \ - inline_mysql_file_fwrite(FD, P1, P2, P3) -#endif - -/** - @def mysql_file_fseek(FD, P, W, F) - Instrumented fseek. - @c mysql_file_fseek is a replacement for @c my_fseek. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_fseek(FD, P, W, F) \ - inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F) -#else - #define mysql_file_fseek(FD, P, W, F) \ - inline_mysql_file_fseek(FD, P, W, F) -#endif - -/** - @def mysql_file_ftell(FD, F) - Instrumented ftell. - @c mysql_file_ftell is a replacement for @c my_ftell. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_ftell(FD, F) \ - inline_mysql_file_ftell(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_ftell(FD, F) \ - inline_mysql_file_ftell(FD, F) -#endif - -/** - @def mysql_file_create(K, N, F1, F2, F3) - Instrumented create. - @c mysql_file_create is a replacement for @c my_create. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_create(K, N, F1, F2, F3) \ - inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3) -#else - #define mysql_file_create(K, N, F1, F2, F3) \ - inline_mysql_file_create(N, F1, F2, F3) -#endif - -/** - @def mysql_file_create_temp(K, T, D, P, M, F) - Instrumented create_temp_file. - @c mysql_file_create_temp is a replacement for @c create_temp_file. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_create_temp(K, T, D, P, M, F) \ - inline_mysql_file_create_temp(K, T, D, P, M, F) -#else - #define mysql_file_create_temp(K, T, D, P, M, F) \ - inline_mysql_file_create_temp(T, D, P, M, F) -#endif - -/** - @def mysql_file_open(K, N, F1, F2) - Instrumented open. - @c mysql_file_open is a replacement for @c my_open. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_open(K, N, F1, F2) \ - inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2) -#else - #define mysql_file_open(K, N, F1, F2) \ - inline_mysql_file_open(N, F1, F2) -#endif - -/** - @def mysql_file_close(FD, F) - Instrumented close. - @c mysql_file_close is a replacement for @c my_close. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_close(FD, F) \ - inline_mysql_file_close(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_close(FD, F) \ - inline_mysql_file_close(FD, F) -#endif - -/** - @def mysql_file_read(FD, B, S, F) - Instrumented read. - @c mysql_read is a replacement for @c my_read. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_read(FD, B, S, F) \ - inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F) -#else - #define mysql_file_read(FD, B, S, F) \ - inline_mysql_file_read(FD, B, S, F) -#endif - -/** - @def mysql_file_write(FD, B, S, F) - Instrumented write. - @c mysql_file_write is a replacement for @c my_write. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_write(FD, B, S, F) \ - inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F) -#else - #define mysql_file_write(FD, B, S, F) \ - inline_mysql_file_write(FD, B, S, F) -#endif - -/** - @def mysql_file_pread(FD, B, S, O, F) - Instrumented pread. - @c mysql_pread is a replacement for @c my_pread. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_pread(FD, B, S, O, F) \ - inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F) -#else - #define mysql_file_pread(FD, B, S, O, F) \ - inline_mysql_file_pread(FD, B, S, O, F) -#endif - -/** - @def mysql_file_pwrite(FD, B, S, O, F) - Instrumented pwrite. - @c mysql_file_pwrite is a replacement for @c my_pwrite. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_pwrite(FD, B, S, O, F) \ - inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F) -#else - #define mysql_file_pwrite(FD, B, S, O, F) \ - inline_mysql_file_pwrite(FD, B, S, O, F) -#endif - -/** - @def mysql_file_seek(FD, P, W, F) - Instrumented seek. - @c mysql_file_seek is a replacement for @c my_seek. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_seek(FD, P, W, F) \ - inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F) -#else - #define mysql_file_seek(FD, P, W, F) \ - inline_mysql_file_seek(FD, P, W, F) -#endif - -/** - @def mysql_file_tell(FD, F) - Instrumented tell. - @c mysql_file_tell is a replacement for @c my_tell. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_tell(FD, F) \ - inline_mysql_file_tell(__FILE__, __LINE__, FD, F) -#else - #define mysql_file_tell(FD, F) \ - inline_mysql_file_tell(FD, F) -#endif - -/** - @def mysql_file_delete(K, P1, P2) - Instrumented delete. - @c mysql_file_delete is a replacement for @c my_delete. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_delete(K, P1, P2) \ - inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2) -#else - #define mysql_file_delete(K, P1, P2) \ - inline_mysql_file_delete(P1, P2) -#endif - -/** - @def mysql_file_rename(K, P1, P2, P3) - Instrumented rename. - @c mysql_file_rename is a replacement for @c my_rename. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_rename(K, P1, P2, P3) \ - inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3) -#else - #define mysql_file_rename(K, P1, P2, P3) \ - inline_mysql_file_rename(P1, P2, P3) -#endif - -/** - @def mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) - Instrumented create with symbolic link. - @c mysql_file_create_with_symlink is a replacement - for @c my_create_with_symlink. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ - inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \ - P1, P2, P3, P4, P5) -#else - #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ - inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5) -#endif - -/** - @def mysql_file_delete_with_symlink(K, P1, P2) - Instrumented delete with symbolic link. - @c mysql_file_delete_with_symlink is a replacement - for @c my_delete_with_symlink. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_delete_with_symlink(K, P1, P2) \ - inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2) -#else - #define mysql_file_delete_with_symlink(K, P1, P2) \ - inline_mysql_file_delete_with_symlink(P1, P2) -#endif - -/** - @def mysql_file_rename_with_symlink(K, P1, P2, P3) - Instrumented rename with symbolic link. - @c mysql_file_rename_with_symlink is a replacement - for @c my_rename_with_symlink. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) -#else - #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ - inline_mysql_file_rename_with_symlink(P1, P2, P3) -#endif - -/** - @def mysql_file_sync(P1, P2) - Instrumented file sync. - @c mysql_file_sync is a replacement for @c my_sync. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_file_sync(P1, P2) \ - inline_mysql_file_sync(__FILE__, __LINE__, P1, P2) -#else - #define mysql_file_sync(P1, P2) \ - inline_mysql_file_sync(P1, P2) -#endif - -/** - An instrumented FILE structure. - @sa MYSQL_FILE -*/ -struct st_mysql_file -{ - /** The real file. */ - FILE *m_file; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c MYSQL_FILE interface. - */ - struct PSI_file *m_psi; -}; - -/** - Type of an instrumented file. - @c MYSQL_FILE is a drop-in replacement for @c FILE. - @sa mysql_file_open -*/ -typedef struct st_mysql_file MYSQL_FILE; - -static inline char * -inline_mysql_file_fgets( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - char *str, int size, MYSQL_FILE *file) -{ - char *result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_READ); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line); - } -#endif - result= fgets(str, size, file->m_file); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, result ? strlen(result) : 0); -#endif - return result; -} - -static inline int -inline_mysql_file_fgetc( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_READ); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); - } -#endif - result= fgetc(file->m_file); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 1); -#endif - return result; -} - -static inline int -inline_mysql_file_fputs( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - const char *str, MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - size_t bytes= 0; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - { - bytes= str ? strlen(str) : 0; - PSI_server->start_file_wait(locker, bytes, src_file, src_line); - } - } -#endif - result= fputs(str, file->m_file); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, bytes); -#endif - return result; -} - -static inline int -inline_mysql_file_fputc( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - char c, MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); - } -#endif - result= fputc(c, file->m_file); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 1); -#endif - return result; -} - -static inline int -inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) -{ - /* - TODO: figure out how to pass src_file and src_line from the caller. - */ - int result; - va_list args; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__); - } -#endif - va_start(args, format); - result= vfprintf(file->m_file, format, args); - va_end(args); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) result); -#endif - return result; -} - -static inline int -inline_mysql_file_vfprintf( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, const char *format, va_list args) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= vfprintf(file->m_file, format, args); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) result); -#endif - return result; -} - -static inline int -inline_mysql_file_fflush( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_FLUSH); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= fflush(file->m_file); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int inline_mysql_file_feof(MYSQL_FILE *file) -{ - /* Not instrumented, there is no wait involved */ - return feof(file->m_file); -} - -static inline int -inline_mysql_file_fstat( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - int filenr, MY_STAT *stat_area, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr, - PSI_FILE_FSTAT); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_fstat(filenr, stat_area, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline MY_STAT * -inline_mysql_file_stat( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *path, MY_STAT *stat_area, myf flags) -{ - MY_STAT *result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, - key, PSI_FILE_STAT, - path, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_open_wait(locker, src_file, src_line); - } -#endif - result= my_stat(path, stat_area, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int -inline_mysql_file_chsize( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, my_off_t newlength, int filler, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, - PSI_FILE_CHSIZE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) newlength, src_file, - src_line); - } -#endif - result= my_chsize(file, newlength, filler, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) newlength); -#endif - return result; -} - -static inline MYSQL_FILE* -inline_mysql_file_fopen( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int flags, myf myFlags) -{ - MYSQL_FILE *that; - that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME)); - if (likely(that != NULL)) - { - that->m_psi= NULL; - { -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker - (&state, key, PSI_FILE_STREAM_OPEN, filename, that); - if (likely(locker != NULL)) - that->m_psi= PSI_server->start_file_open_wait(locker, src_file, - src_line); - } -#endif - that->m_file= my_fopen(filename, flags, myFlags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_open_wait(locker); -#endif - if (unlikely(that->m_file == NULL)) - { - my_free(that); - return NULL; - } - } - } - return that; -} - -static inline int -inline_mysql_file_fclose( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, myf flags) -{ - int result= 0; - if (likely(file != NULL)) - { -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - DBUG_ASSERT(file != NULL); - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_STREAM_CLOSE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_fclose(file->m_file, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - my_free(file); - } - return result; -} - -static inline size_t -inline_mysql_file_fread( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) -{ - size_t result= 0; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_READ); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_fread(file->m_file, buffer, count, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_read; - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_read); - } -#endif - return result; -} - -static inline size_t -inline_mysql_file_fwrite( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) -{ - size_t result= 0; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_fwrite(file->m_file, buffer, count, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_written; - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_written); - } -#endif - return result; -} - -static inline my_off_t -inline_mysql_file_fseek( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, my_off_t pos, int whence, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_SEEK); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_fseek(file->m_file, pos, whence, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline my_off_t -inline_mysql_file_ftell( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - MYSQL_FILE *file, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server && file->m_psi)) - { - locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, - PSI_FILE_TELL); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_ftell(file->m_file, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline File -inline_mysql_file_create( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int create_flags, int access_flags, myf myFlags) -{ - File file; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, - filename, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_open_wait(locker, src_file, src_line); - } -#endif - file= my_create(filename, create_flags, access_flags, myFlags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); -#endif - return file; -} - -static inline File -inline_mysql_file_create_temp( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, -#endif - char *to, const char *dir, const char *pfx, int mode, myf myFlags) -{ - File file; - /* - TODO: This event is instrumented, but not timed. - The problem is that the file name is now known - before the create_temp_file call. - */ - file= create_temp_file(to, dir, pfx, mode, myFlags); -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server != NULL)) - PSI_server->create_file(key, to, file); -#endif - return file; -} - -static inline File -inline_mysql_file_open( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *filename, int flags, myf myFlags) -{ - File file; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN, - filename, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_open_wait(locker, src_file, src_line); - } -#endif - file= my_open(filename, flags, myFlags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); -#endif - return file; -} - -static inline int -inline_mysql_file_close( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, - PSI_FILE_CLOSE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_close(file, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline size_t -inline_mysql_file_read( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, uchar *buffer, size_t count, myf flags) -{ - size_t result= 0; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, - PSI_FILE_READ); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_read(file, buffer, count, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_read; - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_read); - } -#endif - return result; -} - -static inline size_t -inline_mysql_file_write( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, const uchar *buffer, size_t count, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_write(file, buffer, count, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_written; - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_written); - } -#endif - return result; -} - -static inline size_t -inline_mysql_file_pread( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, uchar *buffer, size_t count, my_off_t offset, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_pread(file, buffer, count, offset, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_read; - if (flags & (MY_NABP | MY_FNABP)) - bytes_read= (result == 0) ? count : 0; - else - bytes_read= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_read); - } -#endif - return result; -} - -static inline size_t -inline_mysql_file_pwrite( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) -{ - size_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, - PSI_FILE_WRITE); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, count, src_file, src_line); - } -#endif - result= my_pwrite(file, buffer, count, offset, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - { - size_t bytes_written; - if (flags & (MY_NABP | MY_FNABP)) - bytes_written= (result == 0) ? count : 0; - else - bytes_written= (result != MY_FILE_ERROR) ? result : 0; - PSI_server->end_file_wait(locker, bytes_written); - } -#endif - return result; -} - -static inline my_off_t -inline_mysql_file_seek( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, my_off_t pos, int whence, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_seek(file, pos, whence, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline my_off_t -inline_mysql_file_tell( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File file, myf flags) -{ - my_off_t result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_tell(file, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int -inline_mysql_file_delete( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *name, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, - name, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_delete(name, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int -inline_mysql_file_rename( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *from, const char *to, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, - to, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_rename(from, to, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline File -inline_mysql_file_create_with_symlink( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *linkname, const char *filename, int create_flags, - int access_flags, myf flags) -{ - File file; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, - filename, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_open_wait(locker, src_file, src_line); - } -#endif - file= my_create_with_symlink(linkname, filename, create_flags, access_flags, - flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); -#endif - return file; -} - -static inline int -inline_mysql_file_delete_with_symlink( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *name, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, - name, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_delete_with_symlink(name, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int -inline_mysql_file_rename_with_symlink( -#ifdef HAVE_PSI_INTERFACE - PSI_file_key key, const char *src_file, uint src_line, -#endif - const char *from, const char *to, myf flags) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, - to, &locker); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_rename_with_symlink(from, to, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -static inline int -inline_mysql_file_sync( -#ifdef HAVE_PSI_INTERFACE - const char *src_file, uint src_line, -#endif - File fd, myf flags) -{ - int result= 0; -#ifdef HAVE_PSI_INTERFACE - struct PSI_file_locker *locker= NULL; - PSI_file_locker_state state; - if (likely(PSI_server != NULL)) - { - locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC); - if (likely(locker != NULL)) - PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); - } -#endif - result= my_sync(fd, flags); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_file_wait(locker, (size_t) 0); -#endif - return result; -} - -/** @} (end of group File_instrumentation) */ - -#endif - diff --git a/dep/mysqllite/include/mysql/psi/mysql_thread.h b/dep/mysqllite/include/mysql/psi/mysql_thread.h deleted file mode 100644 index 5b8ea3dc5dc..00000000000 --- a/dep/mysqllite/include/mysql/psi/mysql_thread.h +++ /dev/null @@ -1,1071 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_THREAD_H -#define MYSQL_THREAD_H - -/** - @file mysql/psi/mysql_thread.h - Instrumentation helpers for mysys threads, mutexes, - read write locks and conditions. - This header file provides the necessary declarations - to use the mysys thread API with the performance schema instrumentation. - In some compilers (SunStudio), 'static inline' functions, when declared - but not used, are not optimized away (because they are unused) by default, - so that including a static inline function from a header file does - create unwanted dependencies, causing unresolved symbols at link time. - Other compilers, like gcc, optimize these dependencies by default. - - Since the instrumented APIs declared here are wrapper on top - of my_pthread / safemutex / etc APIs, - including mysql/psi/mysql_thread.h assumes that - the dependency on my_pthread and safemutex already exists. -*/ -/* - Note: there are several orthogonal dimensions here. - - Dimension 1: Instrumentation - HAVE_PSI_INTERFACE is defined when the instrumentation is compiled in. - This may happen both in debug or production builds. - - Dimension 2: Debug - SAFE_MUTEX is defined when debug is compiled in. - This may happen both with and without instrumentation. - - Dimension 3: Platform - Mutexes are implemented with one of: - - the pthread library - - fast mutexes - - window apis - This is implemented by various macro definitions in my_pthread.h - - This causes complexity with '#ifdef'-ery that can't be avoided. -*/ - -#include "mysql/psi/psi.h" - -/** - @defgroup Thread_instrumentation Thread Instrumentation - @ingroup Instrumentation_interface - @{ -*/ - -/** - An instrumented mutex structure. - @sa mysql_mutex_t -*/ -struct st_mysql_mutex -{ - /** The real mutex. */ - pthread_mutex_t m_mutex; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_mutex_t interface. - */ - struct PSI_mutex *m_psi; -}; - -/** - Type of an instrumented mutex. - @c mysql_mutex_t is a drop-in replacement for @c pthread_mutex_t. - @sa mysql_mutex_assert_owner - @sa mysql_mutex_assert_not_owner - @sa mysql_mutex_init - @sa mysql_mutex_lock - @sa mysql_mutex_unlock - @sa mysql_mutex_destroy -*/ -typedef struct st_mysql_mutex mysql_mutex_t; - -/** - An instrumented rwlock structure. - @sa mysql_rwlock_t -*/ -struct st_mysql_rwlock -{ - /** The real rwlock */ - rw_lock_t m_rwlock; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_rwlock_t interface. - */ - struct PSI_rwlock *m_psi; -}; - -/** - An instrumented prlock structure. - @sa mysql_prlock_t -*/ -struct st_mysql_prlock -{ - /** The real prlock */ - rw_pr_lock_t m_prlock; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_rwlock_t interface. - */ - struct PSI_rwlock *m_psi; -}; - -/** - Type of an instrumented rwlock. - @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t. - @sa mysql_rwlock_init - @sa mysql_rwlock_rdlock - @sa mysql_rwlock_tryrdlock - @sa mysql_rwlock_wrlock - @sa mysql_rwlock_trywrlock - @sa mysql_rwlock_unlock - @sa mysql_rwlock_destroy -*/ -typedef struct st_mysql_rwlock mysql_rwlock_t; - -/** - Type of an instrumented prlock. - A prlock is a read write lock that 'prefers readers' (pr). - @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. - @sa mysql_prlock_init - @sa mysql_prlock_rdlock - @sa mysql_prlock_wrlock - @sa mysql_prlock_unlock - @sa mysql_prlock_destroy -*/ -typedef struct st_mysql_prlock mysql_prlock_t; - -/** - An instrumented cond structure. - @sa mysql_cond_t -*/ -struct st_mysql_cond -{ - /** The real condition */ - pthread_cond_t m_cond; - /** - The instrumentation hook. - Note that this hook is not conditionally defined, - for binary compatibility of the @c mysql_cond_t interface. - */ - struct PSI_cond *m_psi; -}; - -/** - Type of an instrumented condition. - @c mysql_cond_t is a drop-in replacement for @c pthread_cond_t. - @sa mysql_cond_init - @sa mysql_cond_wait - @sa mysql_cond_timedwait - @sa mysql_cond_signal - @sa mysql_cond_broadcast - @sa mysql_cond_destroy -*/ -typedef struct st_mysql_cond mysql_cond_t; - -/* - Consider the following code: - static inline void foo() { bar(); } - when foo() is never called. - - With gcc, foo() is a local static function, so the dependencies - are optimized away at compile time, and there is no dependency on bar(). - With other compilers (HP, Sun Studio), the function foo() implementation - is compiled, and bar() needs to be present to link. - - Due to the existing header dependencies in MySQL code, this header file - is sometime used when it is not needed, which in turn cause link failures - on some platforms. - The proper fix would be to cut these extra dependencies in the calling code. - DISABLE_MYSQL_THREAD_H is a work around to limit dependencies. - DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically - the prlock wrappers. -*/ -#ifndef DISABLE_MYSQL_THREAD_H - -/** - @def mysql_mutex_assert_owner(M) - Wrapper, to use safe_mutex_assert_owner with instrumented mutexes. - @c mysql_mutex_assert_owner is a drop-in replacement - for @c safe_mutex_assert_owner. -*/ -#define mysql_mutex_assert_owner(M) \ - safe_mutex_assert_owner(&(M)->m_mutex) - -/** - @def mysql_mutex_assert_not_owner(M) - Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. - @c mysql_mutex_assert_not_owner is a drop-in replacement - for @c safe_mutex_assert_not_owner. -*/ -#define mysql_mutex_assert_not_owner(M) \ - safe_mutex_assert_not_owner(&(M)->m_mutex) - -/** Wrappers for instrumented prlock objects. */ - -#define mysql_prlock_assert_write_owner(M) \ - rw_pr_lock_assert_write_owner(&(M)->m_prlock) - -#define mysql_prlock_assert_not_write_owner(M) \ - rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) - -/** - @def mysql_mutex_init(K, M, A) - Instrumented mutex_init. - @c mysql_mutex_init is a replacement for @c pthread_mutex_init. - @param K The PSI_mutex_key for this instrumented mutex - @param M The mutex to initialize - @param A Mutex attributes -*/ - -#ifdef HAVE_PSI_INTERFACE - #ifdef SAFE_MUTEX - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__) - #else - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(K, M, A) - #endif -#else - #ifdef SAFE_MUTEX - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(M, A, __FILE__, __LINE__) - #else - #define mysql_mutex_init(K, M, A) \ - inline_mysql_mutex_init(M, A) - #endif -#endif - -/** - @def mysql_mutex_destroy(M) - Instrumented mutex_destroy. - @c mysql_mutex_destroy is a drop-in replacement - for @c pthread_mutex_destroy. -*/ -#ifdef SAFE_MUTEX - #define mysql_mutex_destroy(M) \ - inline_mysql_mutex_destroy(M, __FILE__, __LINE__) -#else - #define mysql_mutex_destroy(M) \ - inline_mysql_mutex_destroy(M) -#endif - -/** - @def mysql_mutex_lock(M) - Instrumented mutex_lock. - @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock. - @param M The mutex to lock -*/ - -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) - #define mysql_mutex_lock(M) \ - inline_mysql_mutex_lock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_lock(M) \ - inline_mysql_mutex_lock(M) -#endif - -/** - @def mysql_mutex_trylock(M) - Instrumented mutex_lock. - @c mysql_mutex_trylock is a drop-in replacement - for @c pthread_mutex_trylock. -*/ - -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) - #define mysql_mutex_trylock(M) \ - inline_mysql_mutex_trylock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_trylock(M) \ - inline_mysql_mutex_trylock(M) -#endif - -/** - @def mysql_mutex_unlock(M) - Instrumented mutex_unlock. - @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock. -*/ -#ifdef SAFE_MUTEX - #define mysql_mutex_unlock(M) \ - inline_mysql_mutex_unlock(M, __FILE__, __LINE__) -#else - #define mysql_mutex_unlock(M) \ - inline_mysql_mutex_unlock(M) -#endif - -/** - @def mysql_rwlock_init(K, RW) - Instrumented rwlock_init. - @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init. - Note that pthread_rwlockattr_t is not supported in MySQL. - @param K The PSI_rwlock_key for this instrumented rwlock - @param RW The rwlock to initialize -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW) -#else - #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW) -#endif - -/** - @def mysql_prlock_init(K, RW) - Instrumented rw_pr_init. - @c mysql_prlock_init is a replacement for @c rw_pr_init. - @param K The PSI_rwlock_key for this instrumented prlock - @param RW The prlock to initialize -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW) -#else - #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW) -#endif - -/** - @def mysql_rwlock_destroy(RW) - Instrumented rwlock_destroy. - @c mysql_rwlock_destroy is a drop-in replacement - for @c pthread_rwlock_destroy. -*/ -#define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW) - -/** - @def mysql_prlock_destroy(RW) - Instrumented rw_pr_destroy. - @c mysql_prlock_destroy is a drop-in replacement - for @c rw_pr_destroy. -*/ -#define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW) - -/** - @def mysql_rwlock_rdlock(RW) - Instrumented rwlock_rdlock. - @c mysql_rwlock_rdlock is a drop-in replacement - for @c pthread_rwlock_rdlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_rwlock_rdlock(RW) \ - inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_rdlock(RW) \ - inline_mysql_rwlock_rdlock(RW) -#endif - -/** - @def mysql_prlock_rdlock(RW) - Instrumented rw_pr_rdlock. - @c mysql_prlock_rdlock is a drop-in replacement - for @c rw_pr_rdlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_prlock_rdlock(RW) \ - inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_rdlock(RW) \ - inline_mysql_prlock_rdlock(RW) -#endif - -/** - @def mysql_rwlock_wrlock(RW) - Instrumented rwlock_wrlock. - @c mysql_rwlock_wrlock is a drop-in replacement - for @c pthread_rwlock_wrlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_rwlock_wrlock(RW) \ - inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_wrlock(RW) \ - inline_mysql_rwlock_wrlock(RW) -#endif - -/** - @def mysql_prlock_wrlock(RW) - Instrumented rw_pr_wrlock. - @c mysql_prlock_wrlock is a drop-in replacement - for @c rw_pr_wrlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_prlock_wrlock(RW) \ - inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_wrlock(RW) \ - inline_mysql_prlock_wrlock(RW) -#endif - -/** - @def mysql_rwlock_tryrdlock(RW) - Instrumented rwlock_tryrdlock. - @c mysql_rwlock_tryrdlock is a drop-in replacement - for @c pthread_rwlock_tryrdlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_rwlock_tryrdlock(RW) \ - inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_tryrdlock(RW) \ - inline_mysql_rwlock_tryrdlock(RW) -#endif - -/** - @def mysql_rwlock_trywrlock(RW) - Instrumented rwlock_trywrlock. - @c mysql_rwlock_trywrlock is a drop-in replacement - for @c pthread_rwlock_trywrlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_rwlock_trywrlock(RW) \ - inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) -#else - #define mysql_rwlock_trywrlock(RW) \ - inline_mysql_rwlock_trywrlock(RW) -#endif - -/** - @def mysql_rwlock_unlock(RW) - Instrumented rwlock_unlock. - @c mysql_rwlock_unlock is a drop-in replacement - for @c pthread_rwlock_unlock. -*/ -#define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) - -/** - @def mysql_prlock_unlock(RW) - Instrumented rw_pr_unlock. - @c mysql_prlock_unlock is a drop-in replacement - for @c rw_pr_unlock. -*/ -#define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW) - -/** - @def mysql_cond_init(K, C, A) - Instrumented cond_init. - @c mysql_cond_init is a replacement for @c pthread_cond_init. - @param C The cond to initialize - @param K The PSI_cond_key for this instrumented cond - @param A Condition attributes -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_cond_init(K, C, A) inline_mysql_cond_init(K, C, A) -#else - #define mysql_cond_init(K, C, A) inline_mysql_cond_init(C, A) -#endif - -/** - @def mysql_cond_destroy(C) - Instrumented cond_destroy. - @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy. -*/ -#define mysql_cond_destroy(C) inline_mysql_cond_destroy(C) - -/** - @def mysql_cond_wait(C) - Instrumented cond_wait. - @c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_cond_wait(C, M) \ - inline_mysql_cond_wait(C, M, __FILE__, __LINE__) -#else - #define mysql_cond_wait(C, M) \ - inline_mysql_cond_wait(C, M) -#endif - -/** - @def mysql_cond_timedwait(C, M, W) - Instrumented cond_timedwait. - @c mysql_cond_timedwait is a drop-in replacement - for @c pthread_cond_timedwait. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_cond_timedwait(C, M, W) \ - inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) -#else - #define mysql_cond_timedwait(C, M, W) \ - inline_mysql_cond_timedwait(C, M, W) -#endif - -/** - @def mysql_cond_signal(C) - Instrumented cond_signal. - @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal. -*/ -#define mysql_cond_signal(C) inline_mysql_cond_signal(C) - -/** - @def mysql_cond_broadcast(C) - Instrumented cond_broadcast. - @c mysql_cond_broadcast is a drop-in replacement - for @c pthread_cond_broadcast. -*/ -#define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C) - - -/** - @def mysql_thread_create(K, P1, P2, P3, P4) - Instrumented pthread_create. - This function creates both the thread instrumentation and a thread. - @c mysql_thread_create is a replacement for @c pthread_create. - The parameter P4 (or, if it is NULL, P1) will be used as the - instrumented thread "indentity". - Providing a P1 / P4 parameter with a different value for each call - will on average improve performances, since this thread identity value - is used internally to randomize access to data and prevent contention. - This is optional, and the improvement is not guaranteed, only statistical. - @param K The PSI_thread_key for this instrumented thread - @param P1 pthread_create parameter 1 - @param P2 pthread_create parameter 2 - @param P3 pthread_create parameter 3 - @param P4 pthread_create parameter 4 -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_thread_create(K, P1, P2, P3, P4) \ - inline_mysql_thread_create(K, P1, P2, P3, P4) -#else - #define mysql_thread_create(K, P1, P2, P3, P4) \ - pthread_create(P1, P2, P3, P4) -#endif - -/** - @def mysql_thread_set_psi_id(I) - Set the thread indentifier for the instrumentation. - @param I The thread identifier -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I) -#else - #define mysql_thread_set_psi_id(I) do {} while (0) -#endif - -static inline int inline_mysql_mutex_init( -#ifdef HAVE_PSI_INTERFACE - PSI_mutex_key key, -#endif - mysql_mutex_t *that, - const pthread_mutexattr_t *attr -#ifdef SAFE_MUTEX - , const char *src_file, uint src_line -#endif - ) -{ -#ifdef HAVE_PSI_INTERFACE - that->m_psi= PSI_server ? PSI_server->init_mutex(key, &that->m_mutex) - : NULL; -#else - that->m_psi= NULL; -#endif -#ifdef SAFE_MUTEX - return safe_mutex_init(&that->m_mutex, attr, src_file, src_line); -#else - return pthread_mutex_init(&that->m_mutex, attr); -#endif -} - -static inline int inline_mysql_mutex_destroy( - mysql_mutex_t *that -#ifdef SAFE_MUTEX - , const char *src_file, uint src_line -#endif - ) -{ -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - { - PSI_server->destroy_mutex(that->m_psi); - that->m_psi= NULL; - } -#endif -#ifdef SAFE_MUTEX - return safe_mutex_destroy(&that->m_mutex, src_file, src_line); -#else - return pthread_mutex_destroy(&that->m_mutex); -#endif -} - -static inline int inline_mysql_mutex_lock( - mysql_mutex_t *that -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_mutex_locker *locker= NULL; - PSI_mutex_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK); - if (likely(locker != NULL)) - PSI_server->start_mutex_wait(locker, src_file, src_line); - } -#endif -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line); -#else - result= pthread_mutex_lock(&that->m_mutex); -#endif -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_mutex_wait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_mutex_trylock( - mysql_mutex_t *that -#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_mutex_locker *locker= NULL; - PSI_mutex_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK); - if (likely(locker != NULL)) - PSI_server->start_mutex_wait(locker, src_file, src_line); - } -#endif -#ifdef SAFE_MUTEX - result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line); -#else - result= pthread_mutex_trylock(&that->m_mutex); -#endif -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_mutex_wait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_mutex_unlock( - mysql_mutex_t *that -#ifdef SAFE_MUTEX - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - PSI_server->unlock_mutex(that->m_psi); -#endif -#ifdef SAFE_MUTEX - result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); -#else - result= pthread_mutex_unlock(&that->m_mutex); -#endif - return result; -} - -static inline int inline_mysql_rwlock_init( -#ifdef HAVE_PSI_INTERFACE - PSI_rwlock_key key, -#endif - mysql_rwlock_t *that) -{ -#ifdef HAVE_PSI_INTERFACE - that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_rwlock) - : NULL); -#else - that->m_psi= NULL; -#endif - /* - pthread_rwlockattr_t is not used in MySQL. - */ - return my_rwlock_init(&that->m_rwlock, NULL); -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_init( -#ifdef HAVE_PSI_INTERFACE - PSI_rwlock_key key, -#endif - mysql_prlock_t *that) -{ -#ifdef HAVE_PSI_INTERFACE - that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_prlock) - : NULL); -#else - that->m_psi= NULL; -#endif - return rw_pr_init(&that->m_prlock); -} -#endif - -static inline int inline_mysql_rwlock_destroy( - mysql_rwlock_t *that) -{ -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - { - PSI_server->destroy_rwlock(that->m_psi); - that->m_psi= NULL; - } -#endif - return rwlock_destroy(&that->m_rwlock); -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_destroy( - mysql_prlock_t *that) -{ -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - { - PSI_server->destroy_rwlock(that->m_psi); - that->m_psi= NULL; - } -#endif - return rw_pr_destroy(&that->m_prlock); -} -#endif - -static inline int inline_mysql_rwlock_rdlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_READLOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_rdwait(locker, src_file, src_line); - } -#endif - result= rw_rdlock(&that->m_rwlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_rdwait(locker, result); -#endif - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_rdlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_READLOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_rdwait(locker, src_file, src_line); - } -#endif - result= rw_pr_rdlock(&that->m_prlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_rdwait(locker, result); -#endif - return result; -} -#endif - -static inline int inline_mysql_rwlock_wrlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_WRITELOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_wrwait(locker, src_file, src_line); - } -#endif - result= rw_wrlock(&that->m_rwlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_wrwait(locker, result); -#endif - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_wrlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_WRITELOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_wrwait(locker, src_file, src_line); - } -#endif - result= rw_pr_wrlock(&that->m_prlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_wrwait(locker, result); -#endif - return result; -} -#endif - -static inline int inline_mysql_rwlock_tryrdlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_TRYREADLOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_rdwait(locker, src_file, src_line); - } -#endif - result= rw_tryrdlock(&that->m_rwlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_rdwait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_rwlock_trywrlock( - mysql_rwlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_TRYWRITELOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_wrwait(locker, src_file, src_line); - } -#endif - result= rw_trywrlock(&that->m_rwlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_wrwait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_rwlock_unlock( - mysql_rwlock_t *that) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - PSI_server->unlock_rwlock(that->m_psi); -#endif - result= rw_unlock(&that->m_rwlock); - return result; -} - -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_unlock( - mysql_prlock_t *that) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - PSI_server->unlock_rwlock(that->m_psi); -#endif - result= rw_pr_unlock(&that->m_prlock); - return result; -} -#endif - -static inline int inline_mysql_cond_init( -#ifdef HAVE_PSI_INTERFACE - PSI_cond_key key, -#endif - mysql_cond_t *that, - const pthread_condattr_t *attr) -{ -#ifdef HAVE_PSI_INTERFACE - that->m_psi= (PSI_server ? PSI_server->init_cond(key, &that->m_cond) - : NULL); -#else - that->m_psi= NULL; -#endif - return pthread_cond_init(&that->m_cond, attr); -} - -static inline int inline_mysql_cond_destroy( - mysql_cond_t *that) -{ -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - { - PSI_server->destroy_cond(that->m_psi); - that->m_psi= NULL; - } -#endif - return pthread_cond_destroy(&that->m_cond); -} - -static inline int inline_mysql_cond_wait( - mysql_cond_t *that, - mysql_mutex_t *mutex -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_cond_locker *locker= NULL; - PSI_cond_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, - PSI_COND_WAIT); - if (likely(locker != NULL)) - PSI_server->start_cond_wait(locker, src_file, src_line); - } -#endif - result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_cond_wait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_cond_timedwait( - mysql_cond_t *that, - mysql_mutex_t *mutex, - struct timespec *abstime -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_cond_locker *locker= NULL; - PSI_cond_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, - PSI_COND_TIMEDWAIT); - if (likely(locker != NULL)) - PSI_server->start_cond_wait(locker, src_file, src_line); - } -#endif - result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_cond_wait(locker, result); -#endif - return result; -} - -static inline int inline_mysql_cond_signal( - mysql_cond_t *that) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - PSI_server->signal_cond(that->m_psi); -#endif - result= pthread_cond_signal(&that->m_cond); - return result; -} - -static inline int inline_mysql_cond_broadcast( - mysql_cond_t *that) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - if (likely(PSI_server && that->m_psi)) - PSI_server->broadcast_cond(that->m_psi); -#endif - result= pthread_cond_broadcast(&that->m_cond); - return result; -} - -#ifdef HAVE_PSI_INTERFACE -static inline int inline_mysql_thread_create( - PSI_thread_key key, - pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine)(void*), void *arg) -{ - int result; - if (likely(PSI_server != NULL)) - result= PSI_server->spawn_thread(key, thread, attr, start_routine, arg); - else - result= pthread_create(thread, attr, start_routine, arg); - return result; -} - -static inline void inline_mysql_thread_set_psi_id(ulong id) -{ - if (likely(PSI_server != NULL)) - { - struct PSI_thread *psi= PSI_server->get_thread(); - if (likely(psi != NULL)) - PSI_server->set_thread_id(psi, id); - } -} -#endif - -#endif /* DISABLE_MYSQL_THREAD_H */ - -/** @} (end of group Thread_instrumentation) */ - -#endif - diff --git a/dep/mysqllite/include/mysql/psi/psi.h b/dep/mysqllite/include/mysql/psi/psi.h deleted file mode 100644 index 562e4a80fd5..00000000000 --- a/dep/mysqllite/include/mysql/psi/psi.h +++ /dev/null @@ -1,1312 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -#ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H -#define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H - -#ifndef _global_h -/* - Make sure a .c or .cc file contains an include to my_global.h first. - When this include is missing, all the #ifdef HAVE_XXX have no effect, - and the resulting binary won't build, or won't link, - or will crash at runtime - since various structures will have different binary definitions. -*/ -#error "You must include my_global.h in the code for the build to be correct." -#endif - -C_MODE_START - -/** - @file mysql/psi/psi.h - Performance schema instrumentation interface. - - @defgroup Instrumentation_interface Instrumentation Interface - @ingroup Performance_schema - @{ -*/ - -/** - Interface for an instrumented mutex. - This is an opaque structure. -*/ -struct PSI_mutex; - -/** - Interface for an instrumented rwlock. - This is an opaque structure. -*/ -struct PSI_rwlock; - -/** - Interface for an instrumented condition. - This is an opaque structure. -*/ -struct PSI_cond; - -/** - Interface for an instrumented table share. - This is an opaque structure. -*/ -struct PSI_table_share; - -/** - Interface for an instrumented table handle. - This is an opaque structure. -*/ -struct PSI_table; - -/** - Interface for an instrumented thread. - This is an opaque structure. -*/ -struct PSI_thread; - -/** - Interface for an instrumented file handle. - This is an opaque structure. -*/ -struct PSI_file; - -/** Entry point for the performance schema interface. */ -struct PSI_bootstrap -{ - /** - ABI interface finder. - Calling this method with an interface version number returns either - an instance of the ABI for this version, or NULL. - @param version the interface version number to find - @return a versioned interface (PSI_v1, PSI_v2 or PSI) - @sa PSI_VERSION_1 - @sa PSI_v1 - @sa PSI_VERSION_2 - @sa PSI_v2 - @sa PSI_CURRENT_VERSION - @sa PSI - */ - void* (*get_interface)(int version); -}; - -#ifdef HAVE_PSI_INTERFACE - -/** - @def PSI_VERSION_1 - Performance Schema Interface number for version 1. - This version is supported. -*/ -#define PSI_VERSION_1 1 - -/** - @def PSI_VERSION_2 - Performance Schema Interface number for version 2. - This version is not implemented, it's a placeholder. -*/ -#define PSI_VERSION_2 2 - -/** - @def PSI_CURRENT_VERSION - Performance Schema Interface number for the most recent version. - The most current version is @c PSI_VERSION_1 -*/ -#define PSI_CURRENT_VERSION 1 - -#ifndef USE_PSI_2 -#ifndef USE_PSI_1 -#define USE_PSI_1 -#endif -#endif - -/** - Interface for an instrumented mutex operation. - This is an opaque structure. -*/ -struct PSI_mutex_locker; - -/** - Interface for an instrumented rwlock operation. - This is an opaque structure. -*/ - -struct PSI_rwlock_locker; -/** - Interface for an instrumented condition operation. - This is an opaque structure. -*/ - -struct PSI_cond_locker; - -/** - Interface for an instrumented file operation. - This is an opaque structure. -*/ -struct PSI_file_locker; - -/** Operation performed on an instrumented mutex. */ -enum PSI_mutex_operation -{ - /** Lock. */ - PSI_MUTEX_LOCK= 0, - /** Lock attempt. */ - PSI_MUTEX_TRYLOCK= 1 -}; - -/** Operation performed on an instrumented rwlock. */ -enum PSI_rwlock_operation -{ - /** Read lock. */ - PSI_RWLOCK_READLOCK= 0, - /** Write lock. */ - PSI_RWLOCK_WRITELOCK= 1, - /** Read lock attempt. */ - PSI_RWLOCK_TRYREADLOCK= 2, - /** Write lock attempt. */ - PSI_RWLOCK_TRYWRITELOCK= 3 -}; - -/** Operation performed on an instrumented condition. */ -enum PSI_cond_operation -{ - /** Wait. */ - PSI_COND_WAIT= 0, - /** Wait, with timeout. */ - PSI_COND_TIMEDWAIT= 1 -}; - -/** Operation performed on an instrumented file. */ -enum PSI_file_operation -{ - /** File creation, as in @c create(). */ - PSI_FILE_CREATE= 0, - /** Temporary file creation, as in @c create_temp_file(). */ - PSI_FILE_CREATE_TMP= 1, - /** File open, as in @c open(). */ - PSI_FILE_OPEN= 2, - /** File open, as in @c fopen(). */ - PSI_FILE_STREAM_OPEN= 3, - /** File close, as in @c close(). */ - PSI_FILE_CLOSE= 4, - /** File close, as in @c fclose(). */ - PSI_FILE_STREAM_CLOSE= 5, - /** - Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(), - @c pread(). - */ - PSI_FILE_READ= 6, - /** - Generic file write, such as @c fputs(), @c fputc(), @c fprintf(), - @c vfprintf(), @c fwrite(), @c write(), @c pwrite(). - */ - PSI_FILE_WRITE= 7, - /** Generic file seek, such as @c fseek() or @c seek(). */ - PSI_FILE_SEEK= 8, - /** Generic file tell, such as @c ftell() or @c tell(). */ - PSI_FILE_TELL= 9, - /** File flush, as in @c fflush(). */ - PSI_FILE_FLUSH= 10, - /** File stat, as in @c stat(). */ - PSI_FILE_STAT= 11, - /** File stat, as in @c fstat(). */ - PSI_FILE_FSTAT= 12, - /** File chsize, as in @c my_chsize(). */ - PSI_FILE_CHSIZE= 13, - /** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */ - PSI_FILE_DELETE= 14, - /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */ - PSI_FILE_RENAME= 15, - /** File sync, as in @c fsync() or @c my_sync(). */ - PSI_FILE_SYNC= 16 -}; - -/** - Interface for an instrumented table operation. - This is an opaque structure. -*/ -struct PSI_table_locker; - -/** - Instrumented mutex key. - To instrument a mutex, a mutex key must be obtained using @c register_mutex. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_mutex_key; - -/** - Instrumented rwlock key. - To instrument a rwlock, a rwlock key must be obtained - using @c register_rwlock. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_rwlock_key; - -/** - Instrumented cond key. - To instrument a condition, a condition key must be obtained - using @c register_cond. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_cond_key; - -/** - Instrumented thread key. - To instrument a thread, a thread key must be obtained - using @c register_thread. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_thread_key; - -/** - Instrumented file key. - To instrument a file, a file key must be obtained using @c register_file. - Using a zero key always disable the instrumentation. -*/ -typedef unsigned int PSI_file_key; - -/** - @def USE_PSI_1 - Define USE_PSI_1 to use the interface version 1. -*/ - -/** - @def USE_PSI_2 - Define USE_PSI_2 to use the interface version 2. -*/ - -/** - @def HAVE_PSI_1 - Define HAVE_PSI_1 if the interface version 1 needs to be compiled in. -*/ - -/** - @def HAVE_PSI_2 - Define HAVE_PSI_2 if the interface version 2 needs to be compiled in. -*/ - -/** - Global flag. - This flag indicate that an instrumentation point is a global variable, - or a singleton. -*/ -#define PSI_FLAG_GLOBAL (1 << 0) - -#ifdef USE_PSI_1 -#define HAVE_PSI_1 -#endif - -#ifdef HAVE_PSI_1 - -/** - @defgroup Group_PSI_v1 Application Binary Interface, version 1 - @ingroup Instrumentation_interface - @{ -*/ - -/** - Mutex information. - @since PSI_VERSION_1 - This structure is used to register an instrumented mutex. -*/ -struct PSI_mutex_info_v1 -{ - /** - Pointer to the key assigned to the registered mutex. - */ - PSI_mutex_key *m_key; - /** - The name of the mutex to register. - */ - const char *m_name; - /** - The flags of the mutex to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; - -/** - Rwlock information. - @since PSI_VERSION_1 - This structure is used to register an instrumented rwlock. -*/ -struct PSI_rwlock_info_v1 -{ - /** - Pointer to the key assigned to the registered rwlock. - */ - PSI_rwlock_key *m_key; - /** - The name of the rwlock to register. - */ - const char *m_name; - /** - The flags of the rwlock to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; - -/** - Condition information. - @since PSI_VERSION_1 - This structure is used to register an instrumented cond. -*/ -struct PSI_cond_info_v1 -{ - /** - Pointer to the key assigned to the registered cond. - */ - PSI_cond_key *m_key; - /** - The name of the cond to register. - */ - const char *m_name; - /** - The flags of the cond to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; - -/** - Thread instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented thread. -*/ -struct PSI_thread_info_v1 -{ - /** - Pointer to the key assigned to the registered thread. - */ - PSI_thread_key *m_key; - /** - The name of the thread instrument to register. - */ - const char *m_name; - /** - The flags of the thread to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; - -/** - File instrument information. - @since PSI_VERSION_1 - This structure is used to register an instrumented file. -*/ -struct PSI_file_info_v1 -{ - /** - Pointer to the key assigned to the registered file. - */ - PSI_file_key *m_key; - /** - The name of the file instrument to register. - */ - const char *m_name; - /** - The flags of the file instrument to register. - @sa PSI_FLAG_GLOBAL - */ - int m_flags; -}; - -/** - State data storage for @c get_thread_mutex_locker_v1_t. - This structure provide temporary storage to a mutex locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_mutex_locker_v1_t -*/ -struct PSI_mutex_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current mutex. */ - struct PSI_mutex *m_mutex; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Current operation. */ - enum PSI_mutex_operation m_operation; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; - -/** - State data storage for @c get_thread_rwlock_locker_v1_t. - This structure provide temporary storage to a rwlock locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_rwlock_locker_v1_t -*/ -struct PSI_rwlock_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current rwlock. */ - struct PSI_rwlock *m_rwlock; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Current operation. */ - enum PSI_rwlock_operation m_operation; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; - -/** - State data storage for @c get_thread_cond_locker_v1_t. - This structure provide temporary storage to a condition locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_cond_locker_v1_t -*/ -struct PSI_cond_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current condition. */ - struct PSI_cond *m_cond; - /** Current mutex. */ - struct PSI_mutex *m_mutex; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Current operation. */ - enum PSI_cond_operation m_operation; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; - -/** - State data storage for @c get_thread_file_name_locker_v1_t. - This structure provide temporary storage to a file locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_file_name_locker_v1_t - @sa get_thread_file_stream_locker_v1_t - @sa get_thread_file_descriptor_locker_v1_t -*/ -struct PSI_file_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current file. */ - struct PSI_file *m_file; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Operation number of bytes. */ - size_t m_number_of_bytes; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /** Current operation. */ - enum PSI_file_operation m_operation; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; - -/** - State data storage for @c get_thread_table_locker_v1_t. - This structure provide temporary storage to a table locker. - The content of this structure is considered opaque, - the fields are only hints of what an implementation - of the psi interface can use. - This memory is provided by the instrumented code for performance reasons. - @sa get_thread_table_locker_v1_t -*/ -struct PSI_table_locker_state_v1 -{ - /** Internal state. */ - uint m_flags; - /** Current table handle. */ - struct PSI_table *m_table; - /** Current table share. */ - struct PSI_table_share *m_table_share; - /** Instrumentation class. */ - void *m_class; - /** Current thread. */ - struct PSI_thread *m_thread; - /** Timer start. */ - ulonglong m_timer_start; - /** Timer function. */ - ulonglong (*m_timer)(void); - /* Current operation (waiting for WL#4895). */ - /* enum PSI_table_operation m_operation; */ - /** Current table io index. */ - uint m_index; - /** Current table lock index. */ - uint m_lock_index; - /** Source file. */ - const char* m_src_file; - /** Source line number. */ - int m_src_line; - /** Internal data. */ - void *m_wait; -}; - -/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ - -/** - Mutex registration API. - @param category a category name (typically a plugin name) - @param info an array of mutex info to register - @param count the size of the info array -*/ -typedef void (*register_mutex_v1_t) - (const char *category, struct PSI_mutex_info_v1 *info, int count); - -/** - Rwlock registration API. - @param category a category name (typically a plugin name) - @param info an array of rwlock info to register - @param count the size of the info array -*/ -typedef void (*register_rwlock_v1_t) - (const char *category, struct PSI_rwlock_info_v1 *info, int count); - -/** - Cond registration API. - @param category a category name (typically a plugin name) - @param info an array of cond info to register - @param count the size of the info array -*/ -typedef void (*register_cond_v1_t) - (const char *category, struct PSI_cond_info_v1 *info, int count); - -/** - Thread registration API. - @param category a category name (typically a plugin name) - @param info an array of thread info to register - @param count the size of the info array -*/ -typedef void (*register_thread_v1_t) - (const char *category, struct PSI_thread_info_v1 *info, int count); - -/** - File registration API. - @param category a category name (typically a plugin name) - @param info an array of file info to register - @param count the size of the info array -*/ -typedef void (*register_file_v1_t) - (const char *category, struct PSI_file_info_v1 *info, int count); - -/** - Mutex instrumentation initialisation API. - @param key the registered mutex key - @param identity the address of the mutex itself - @return an instrumented mutex -*/ -typedef struct PSI_mutex* (*init_mutex_v1_t) - (PSI_mutex_key key, const void *identity); - -/** - Mutex instrumentation destruction API. - @param mutex the mutex to destroy -*/ -typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); - -/** - Rwlock instrumentation initialisation API. - @param key the registered rwlock key - @param identity the address of the rwlock itself - @return an instrumented rwlock -*/ -typedef struct PSI_rwlock* (*init_rwlock_v1_t) - (PSI_rwlock_key key, const void *identity); - -/** - Rwlock instrumentation destruction API. - @param rwlock the rwlock to destroy -*/ -typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); - -/** - Cond instrumentation initialisation API. - @param key the registered key - @param identity the address of the rwlock itself - @return an instrumented cond -*/ -typedef struct PSI_cond* (*init_cond_v1_t) - (PSI_cond_key key, const void *identity); - -/** - Cond instrumentation destruction API. - @param cond the rcond to destroy -*/ -typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); - -/** - Acquire a table info by name. - @param schema_name name of the table schema - @param schema_name_length length of schema_name - @param table_name name of the table - @param table_name_length length of table_name - @param identity table identity pointer, typically the table share - @return a table info, or NULL if the table is not instrumented -*/ -typedef struct PSI_table_share* (*get_table_share_v1_t) - (const char *schema_name, int schema_name_length, const char *table_name, - int table_name_length, const void *identity); - -/** - Release a table share. - @param info the table share to release -*/ -typedef void (*release_table_share_v1_t)(struct PSI_table_share *share); - -/** - Open an instrumentation table handle. - @param share the table to open - @param identity table handle identity - @return a table handle, or NULL -*/ -typedef struct PSI_table* (*open_table_v1_t) - (struct PSI_table_share *share, const void *identity); - -/** - Close an instrumentation table handle. - Note that the table handle is invalid after this call. - @param table the table handle to close -*/ -typedef void (*close_table_v1_t)(struct PSI_table *table); - -/** - Create a file instrumentation for a created file. - This method does not create the file itself, but is used to notify the - instrumentation interface that a file was just created. - @param key the file instrumentation key for this file - @param name the file name - @param file the file handle -*/ -typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, - File file); - -/** - Spawn a thread. - This method creates a new thread, with instrumentation. - @param key the instrumentation key for this thread - @param thread the resulting thread - @param attr the thread attributes - @param start_routine the thread start routine - @param arg the thread start routine argument -*/ -typedef int (*spawn_thread_v1_t)(PSI_thread_key key, - pthread_t *thread, - const pthread_attr_t *attr, - void *(*start_routine)(void*), void *arg); - -/** - Create instrumentation for a thread. - @param key the registered key - @param identity an address typical of the thread - @return an instrumented thread -*/ -typedef struct PSI_thread* (*new_thread_v1_t) - (PSI_thread_key key, const void *identity, ulong thread_id); - -/** - Assign an id to an instrumented thread. - @param thread the instrumented thread - @param id the id to assign -*/ -typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, - unsigned long id); - -/** - Get the instrumentation for the running thread. - For this function to return a result, - the thread instrumentation must have been attached to the - running thread using @c set_thread() - @return the instrumentation for the running thread -*/ -typedef struct PSI_thread* (*get_thread_v1_t)(void); - -/** - Attach a thread instrumentation to the running thread. - In case of thread pools, this method should be called when - a worker thread picks a work item and runs it. - Also, this method should be called if the instrumented code does not - keep the pointer returned by @c new_thread() and relies on @c get_thread() - instead. - @param thread the thread instrumentation -*/ -typedef void (*set_thread_v1_t)(struct PSI_thread *thread); - -/** Delete the current thread instrumentation. */ -typedef void (*delete_current_thread_v1_t)(void); - -/** Delete a thread instrumentation. */ -typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); - -/** - Get a mutex instrumentation locker. - @param state data storage for the locker - @param mutex the instrumented mutex to lock - @return a mutex locker, or NULL -*/ -typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex_locker_state_v1 *state, - struct PSI_mutex *mutex, - enum PSI_mutex_operation op); - -/** - Get a rwlock instrumentation locker. - @param state data storage for the locker - @param rwlock the instrumented rwlock to lock - @return a rwlock locker, or NULL -*/ -typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock_locker_state_v1 *state, - struct PSI_rwlock *rwlock, - enum PSI_rwlock_operation op); - -/** - Get a cond instrumentation locker. - @param state data storage for the locker - @param cond the instrumented condition to wait on - @param mutex the instrumented mutex associated with the condition - @return a condition locker, or NULL -*/ -typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond_locker_state_v1 *state, - struct PSI_cond *cond, struct PSI_mutex *mutex, - enum PSI_cond_operation op); - -/** - Get a table instrumentation locker. - @param state data storage for the locker - @param table the instrumented table to lock - @return a table locker, or NULL -*/ -typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table_locker_state_v1 *state, - struct PSI_table *table); - -/** - Get a file instrumentation locker, for opening or creating a file. - @param state data storage for the locker - @param key the file instrumentation key - @param op the operation to perform - @param name the file name - @param identity a pointer representative of this file. - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - PSI_file_key key, enum PSI_file_operation op, const char *name, - const void *identity); - -/** - Get a file stream instrumentation locker. - @param state data storage for the locker - @param file the file stream to access - @param op the operation to perform - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - struct PSI_file *file, enum PSI_file_operation op); - -/** - Get a file instrumentation locker. - @param state data storage for the locker - @param file the file descriptor to access - @param op the operation to perform - @return a file locker, or NULL -*/ -typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (struct PSI_file_locker_state_v1 *state, - File file, enum PSI_file_operation op); - -/** - Record a mutex instrumentation unlock event. - @param mutex the mutex instrumentation -*/ -typedef void (*unlock_mutex_v1_t) - (struct PSI_mutex *mutex); - -/** - Record a rwlock instrumentation unlock event. - @param rwlock the rwlock instrumentation -*/ -typedef void (*unlock_rwlock_v1_t) - (struct PSI_rwlock *rwlock); - -/** - Record a condition instrumentation signal event. - @param cond the cond instrumentation -*/ -typedef void (*signal_cond_v1_t) - (struct PSI_cond *cond); - -/** - Record a condition instrumentation broadcast event. - @param cond the cond instrumentation -*/ -typedef void (*broadcast_cond_v1_t) - (struct PSI_cond *cond); - -/** - Record a mutex instrumentation wait start event. - @param locker a thread locker for the running thread -*/ -typedef void (*start_mutex_wait_v1_t) - (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); - -/** - Record a mutex instrumentation wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_mutex_wait_v1_t) - (struct PSI_mutex_locker *locker, int rc); - -/** - Record a rwlock instrumentation read wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for lock, 0 for trylock -*/ -typedef void (*start_rwlock_rdwait_v1_t) - (struct PSI_rwlock_locker *locker, const char *src_file, uint src_line); - -/** - Record a rwlock instrumentation read wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_rwlock_rdwait_v1_t) - (struct PSI_rwlock_locker *locker, int rc); - -/** - Record a rwlock instrumentation write wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for lock, 0 for trylock -*/ -typedef void (*start_rwlock_wrwait_v1_t) - (struct PSI_rwlock_locker *locker, const char *src_file, uint src_line); - -/** - Record a rwlock instrumentation write wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_rwlock_wrwait_v1_t) - (struct PSI_rwlock_locker *locker, int rc); - -/** - Record a condition instrumentation wait start event. - @param locker a thread locker for the running thread - @param must must block: 1 for wait, 0 for timedwait -*/ -typedef void (*start_cond_wait_v1_t) - (struct PSI_cond_locker *locker, const char *src_file, uint src_line); - -/** - Record a condition instrumentation wait end event. - @param locker a thread locker for the running thread - @param rc the wait operation return code -*/ -typedef void (*end_cond_wait_v1_t) - (struct PSI_cond_locker *locker, int rc); - -/** - Record a table instrumentation wait start event. - @param locker a table locker for the running thread - @param file the source file name - @param line the source line number -*/ -typedef void (*start_table_wait_v1_t) - (struct PSI_table_locker *locker, const char *src_file, uint src_line); - -/** - Record a table instrumentation wait end event. - @param locker a table locker for the running thread -*/ -typedef void (*end_table_wait_v1_t)(struct PSI_table_locker *locker); - -/** - Start a file instrumentation open 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 - @return an instrumented file handle -*/ -typedef struct PSI_file* (*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. -*/ -typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker); - -/** - End a file instrumentation open operation, for non stream files. - @param locker the file locker. - @param file the file number assigned by open() or create() for this file. -*/ -typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) - (struct PSI_file_locker *locker, File file); - -/** - Record a file instrumentation start event. - @param locker a file locker for the running thread - @param op file operation to be performed - @param count the number of bytes requested, or 0 if not applicable - @param src_file the source file name - @param src_line the source line number -*/ -typedef void (*start_file_wait_v1_t) - (struct PSI_file_locker *locker, size_t count, - const char *src_file, uint src_line); - -/** - Record a file instrumentation end event. - Note that for file close operations, the instrumented file handle - associated with the file (which was provided to obtain a locker) - is invalid after this call. - @param locker a file locker for the running thread - @param count the number of bytes actually used in the operation, - or 0 if not applicable, or -1 if the operation failed - @sa get_thread_file_name_locker - @sa get_thread_file_stream_locker - @sa get_thread_file_descriptor_locker -*/ -typedef void (*end_file_wait_v1_t) - (struct PSI_file_locker *locker, size_t count); - -/** - Performance Schema Interface, version 1. - @since PSI_VERSION_1 -*/ -struct PSI_v1 -{ - /** @sa register_mutex_v1_t. */ - register_mutex_v1_t register_mutex; - /** @sa register_rwlock_v1_t. */ - register_rwlock_v1_t register_rwlock; - /** @sa register_cond_v1_t. */ - register_cond_v1_t register_cond; - /** @sa register_thread_v1_t. */ - register_thread_v1_t register_thread; - /** @sa register_file_v1_t. */ - register_file_v1_t register_file; - /** @sa init_mutex_v1_t. */ - init_mutex_v1_t init_mutex; - /** @sa destroy_mutex_v1_t. */ - destroy_mutex_v1_t destroy_mutex; - /** @sa init_rwlock_v1_t. */ - init_rwlock_v1_t init_rwlock; - /** @sa destroy_rwlock_v1_t. */ - destroy_rwlock_v1_t destroy_rwlock; - /** @sa init_cond_v1_t. */ - init_cond_v1_t init_cond; - /** @sa destroy_cond_v1_t. */ - destroy_cond_v1_t destroy_cond; - /** @sa get_table_share_v1_t. */ - get_table_share_v1_t get_table_share; - /** @sa release_table_share_v1_t. */ - release_table_share_v1_t release_table_share; - /** @sa open_table_v1_t. */ - open_table_v1_t open_table; - /** @sa close_table_v1_t. */ - close_table_v1_t close_table; - /** @sa create_file_v1_t. */ - create_file_v1_t create_file; - /** @sa spawn_thread_v1_t. */ - spawn_thread_v1_t spawn_thread; - /** @sa new_thread_v1_t. */ - new_thread_v1_t new_thread; - /** @sa set_thread_id_v1_t. */ - set_thread_id_v1_t set_thread_id; - /** @sa get_thread_v1_t. */ - get_thread_v1_t get_thread; - /** @sa set_thread_v1_t. */ - set_thread_v1_t set_thread; - /** @sa delete_current_thread_v1_t. */ - delete_current_thread_v1_t delete_current_thread; - /** @sa delete_thread_v1_t. */ - delete_thread_v1_t delete_thread; - /** @sa get_thread_mutex_locker_v1_t. */ - get_thread_mutex_locker_v1_t get_thread_mutex_locker; - /** @sa get_thread_rwlock_locker_v1_t. */ - get_thread_rwlock_locker_v1_t get_thread_rwlock_locker; - /** @sa get_thread_cond_locker_v1_t. */ - get_thread_cond_locker_v1_t get_thread_cond_locker; - /** @sa get_thread_table_locker_v1_t. */ - get_thread_table_locker_v1_t get_thread_table_locker; - /** @sa get_thread_file_name_locker_v1_t. */ - get_thread_file_name_locker_v1_t get_thread_file_name_locker; - /** @sa get_thread_file_stream_locker_v1_t. */ - get_thread_file_stream_locker_v1_t get_thread_file_stream_locker; - /** @sa get_thread_file_descriptor_locker_v1_t. */ - get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker; - /** @sa unlock_mutex_v1_t. */ - unlock_mutex_v1_t unlock_mutex; - /** @sa unlock_rwlock_v1_t. */ - unlock_rwlock_v1_t unlock_rwlock; - /** @sa signal_cond_v1_t. */ - signal_cond_v1_t signal_cond; - /** @sa broadcast_cond_v1_t. */ - broadcast_cond_v1_t broadcast_cond; - /** @sa start_mutex_wait_v1_t. */ - start_mutex_wait_v1_t start_mutex_wait; - /** @sa end_mutex_wait_v1_t. */ - end_mutex_wait_v1_t end_mutex_wait; - /** @sa start_rwlock_rdwait_v1_t. */ - start_rwlock_rdwait_v1_t start_rwlock_rdwait; - /** @sa end_rwlock_rdwait_v1_t. */ - end_rwlock_rdwait_v1_t end_rwlock_rdwait; - /** @sa start_rwlock_wrwait_v1_t. */ - start_rwlock_wrwait_v1_t start_rwlock_wrwait; - /** @sa end_rwlock_wrwait_v1_t. */ - end_rwlock_wrwait_v1_t end_rwlock_wrwait; - /** @sa start_cond_wait_v1_t. */ - start_cond_wait_v1_t start_cond_wait; - /** @sa end_cond_wait_v1_t. */ - end_cond_wait_v1_t end_cond_wait; - /** @sa start_table_wait_v1_t. */ - start_table_wait_v1_t start_table_wait; - /** @sa end_table_wait_v1_t. */ - end_table_wait_v1_t end_table_wait; - /** @sa start_file_open_wait_v1_t. */ - start_file_open_wait_v1_t start_file_open_wait; - /** @sa end_file_open_wait_v1_t. */ - end_file_open_wait_v1_t end_file_open_wait; - /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */ - end_file_open_wait_and_bind_to_descriptor_v1_t - end_file_open_wait_and_bind_to_descriptor; - /** @sa start_file_wait_v1_t. */ - start_file_wait_v1_t start_file_wait; - /** @sa end_file_wait_v1_t. */ - end_file_wait_v1_t end_file_wait; -}; - -/** @} (end of group Group_PSI_v1) */ - -#endif /* HAVE_PSI_1 */ - -#ifdef USE_PSI_2 -#define HAVE_PSI_2 -#endif - -#ifdef HAVE_PSI_2 - -/** - @defgroup Group_PSI_v2 Application Binary Interface, version 2 - @ingroup Instrumentation_interface - @{ -*/ - -/** - Performance Schema Interface, version 2. - This is a placeholder, this interface is not defined yet. - @since PSI_VERSION_2 -*/ -struct PSI_v2 -{ - /** Placeholder */ - int placeholder; - /* ... extended interface ... */ -}; - -/** Placeholder */ -struct PSI_mutex_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_rwlock_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_cond_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_thread_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** Placeholder */ -struct PSI_file_info_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_mutex_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_rwlock_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_cond_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_file_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -struct PSI_table_locker_state_v2 -{ - /** Placeholder */ - int placeholder; -}; - -/** @} (end of group Group_PSI_v2) */ - -#endif /* HAVE_PSI_2 */ - -/** - @typedef PSI - The instrumentation interface for the current version. - @sa PSI_CURRENT_VERSION -*/ - -/** - @typedef PSI_mutex_info - The mutex information structure for the current version. -*/ - -/** - @typedef PSI_rwlock_info - The rwlock information structure for the current version. -*/ - -/** - @typedef PSI_cond_info - The cond information structure for the current version. -*/ - -/** - @typedef PSI_thread_info - The thread information structure for the current version. -*/ - -/** - @typedef PSI_file_info - The file information structure for the current version. -*/ - -/* Export the required version */ -#ifdef USE_PSI_1 -typedef struct PSI_v1 PSI; -typedef struct PSI_mutex_info_v1 PSI_mutex_info; -typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; -typedef struct PSI_cond_info_v1 PSI_cond_info; -typedef struct PSI_thread_info_v1 PSI_thread_info; -typedef struct PSI_file_info_v1 PSI_file_info; -typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; -typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; -typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; -typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; -typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; -#endif - -#ifdef USE_PSI_2 -typedef struct PSI_v2 PSI; -typedef struct PSI_mutex_info_v2 PSI_mutex_info; -typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; -typedef struct PSI_cond_info_v2 PSI_cond_info; -typedef struct PSI_thread_info_v2 PSI_thread_info; -typedef struct PSI_file_info_v2 PSI_file_info; -typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; -typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; -typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; -typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; -typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; -#endif - -#else /* HAVE_PSI_INTERFACE */ - -/** - Dummy structure, used to declare PSI_server when no instrumentation - is available. - The content does not matter, since PSI_server will be NULL. -*/ -struct PSI_none -{ - int opaque; -}; -typedef struct PSI_none PSI; - -#endif /* HAVE_PSI_INTERFACE */ - -extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; - -/** @} */ - -C_MODE_END -#endif /* MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H */ - diff --git a/dep/mysqllite/include/mysql/psi/psi_abi_v1.h b/dep/mysqllite/include/mysql/psi/psi_abi_v1.h deleted file mode 100644 index 0f62291696f..00000000000 --- a/dep/mysqllite/include/mysql/psi/psi_abi_v1.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -/** - @file mysql/psi/psi_abi_v1.h - ABI check for mysql/psi/psi.h, when using PSI_VERSION_1. - This file is only used to automate detection of changes between versions. - Do not include this file, include mysql/psi/psi.h instead. -*/ -#define USE_PSI_1 -#define HAVE_PSI_INTERFACE -#define _global_h -#include "mysql/psi/psi.h" - diff --git a/dep/mysqllite/include/mysql/psi/psi_abi_v2.h b/dep/mysqllite/include/mysql/psi/psi_abi_v2.h deleted file mode 100644 index 08bca609b41..00000000000 --- a/dep/mysqllite/include/mysql/psi/psi_abi_v2.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ - -/** - @file mysql/psi/psi_abi_v1.h - ABI check for mysql/psi/psi.h, when using PSI_VERSION_2. - This file is only used to automate detection of changes between versions. - Do not include this file, include mysql/psi/psi.h instead. -*/ -#define USE_PSI_2 -#define HAVE_PSI_INTERFACE -#define _global_h -#include "mysql/psi/psi.h" - diff --git a/dep/mysqllite/include/mysql/service_my_snprintf.h b/dep/mysqllite/include/mysql/service_my_snprintf.h deleted file mode 100644 index f6b4aa39dc5..00000000000 --- a/dep/mysqllite/include/mysql/service_my_snprintf.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED -/* Copyright (C) 2009 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/** - @file - my_snprintf service - - Portable and limited vsnprintf() implementation. - - This is a portable, limited vsnprintf() implementation, with some - extra features. "Portable" means that it'll produce identical result - on all platforms (for example, on Windows and Linux system printf %e - formats the exponent differently, on different systems %p either - prints leading 0x or not, %s may accept null pointer or crash on - it). "Limited" means that it does not support all the C89 features. - But it supports few extensions, not in any standard. - - my_vsnprintf(to, n, fmt, ap) - - @param[out] to A buffer to store the result in - @param[in] n Store up to n-1 characters, followed by an end 0 - @param[in] fmt printf-like format string - @param[in] ap Arguments - - @return a number of bytes written to a buffer *excluding* terminating '\0' - - @post - The syntax of a format string is generally the same: - % <flag> <width> <precision> <length modifier> <format> - where everithing but the format is optional. - - Three one-character flags are recognized: - '0' has the standard zero-padding semantics; - '-' is parsed, but silently ignored; - '`' (backtick) is only supported for strings (%s) and means that the - string will be quoted according to MySQL identifier quoting rules. - - Both <width> and <precision> can be specified as numbers or '*'. - - <length modifier> can be 'l', 'll', or 'z'. - - Supported formats are 's' (null pointer is accepted, printed as - "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', - 'X', 'p' (works as 0x%x). - - Standard syntax for positional arguments $n is supported. - - Extensions: - - Flag '`' (backtick): see above. - - Format 'b': binary buffer, prints exactly <precision> bytes from the - argument, without stopping at '\0'. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MYSQL_ABI_CHECK -#include <stdarg.h> -#include <stdlib.h> -#endif - -extern struct my_snprintf_service_st { - size_t (*my_snprintf_type)(char*, size_t, const char*, ...); - size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); -} *my_snprintf_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_vsnprintf my_snprintf_service->my_vsnprintf_type -#define my_snprintf my_snprintf_service->my_snprintf_type - -#else - -size_t my_snprintf(char* to, size_t n, const char* fmt, ...); -size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED -#endif - diff --git a/dep/mysqllite/include/mysql/service_thd_alloc.h b/dep/mysqllite/include/mysql/service_thd_alloc.h deleted file mode 100644 index 7061c2bd4d5..00000000000 --- a/dep/mysqllite/include/mysql/service_thd_alloc.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef MYSQL_SERVICE_THD_ALLOC_INCLUDED -/* Copyright (C) 2009 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/** - @file - This service provdes functions to allocate memory in a connection local - memory pool. The memory allocated there will be automatically freed at the - end of the statement, don't use it for allocations that should live longer - than that. For short living allocations this is more efficient than - using my_malloc and friends, and automatic "garbage collection" allows not - to think about memory leaks. - - The pool is best for small to medium objects, don't use it for large - allocations - they are better served with my_malloc. -*/ - -#ifndef MYSQL_ABI_CHECK -#include <stdlib.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -struct st_mysql_lex_string -{ - char *str; - size_t length; -}; -typedef struct st_mysql_lex_string MYSQL_LEX_STRING; - -extern struct thd_alloc_service_st { - void *(*thd_alloc_func)(MYSQL_THD, unsigned int); - void *(*thd_calloc_func)(MYSQL_THD, unsigned int); - char *(*thd_strdup_func)(MYSQL_THD, const char *); - char *(*thd_strmake_func)(MYSQL_THD, const char *, unsigned int); - void *(*thd_memdup_func)(MYSQL_THD, const void*, unsigned int); - MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *, - const char *, unsigned int, int); -} *thd_alloc_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_alloc(thd,size) (thd_alloc_service->thd_alloc_func((thd), (size))) - -#define thd_calloc(thd,size) (thd_alloc_service->thd_calloc_func((thd), (size))) - -#define thd_strdup(thd,str) (thd_alloc_service->thd_strdup_func((thd), (str))) - -#define thd_strmake(thd,str,size) \ - (thd_alloc_service->thd_strmake_func((thd), (str), (size))) - -#define thd_memdup(thd,str,size) \ - (thd_alloc_service->thd_memdup_func((thd), (str), (size))) - -#define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \ - (thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \ - (size), (allocate_lex_string))) - -#else - -/** - Allocate memory in the connection's local memory pool - - @details - When properly used in place of @c my_malloc(), this can significantly - improve concurrency. Don't use this or related functions to allocate - large chunks of memory. Use for temporary storage only. The memory - will be freed automatically at the end of the statement; no explicit - code is required to prevent memory leaks. - - @see alloc_root() -*/ -void *thd_alloc(MYSQL_THD thd, unsigned int size); -/** - @see thd_alloc() -*/ -void *thd_calloc(MYSQL_THD thd, unsigned int size); -/** - @see thd_alloc() -*/ -char *thd_strdup(MYSQL_THD thd, const char *str); -/** - @see thd_alloc() -*/ -char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size); -/** - @see thd_alloc() -*/ -void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size); - -/** - Create a LEX_STRING in this connection's local memory pool - - @param thd user thread connection handle - @param lex_str pointer to LEX_STRING object to be initialized - @param str initializer to be copied into lex_str - @param size length of str, in bytes - @param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object, - instead of using lex_str value - @return NULL on failure, or pointer to the LEX_STRING object - - @see thd_alloc() -*/ -MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str, - const char *str, unsigned int size, - int allocate_lex_string); - -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_THD_ALLOC_INCLUDED -#endif - diff --git a/dep/mysqllite/include/mysql/service_thd_wait.h b/dep/mysqllite/include/mysql/service_thd_wait.h deleted file mode 100644 index 2a8f5e610a3..00000000000 --- a/dep/mysqllite/include/mysql/service_thd_wait.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED -#define MYSQL_SERVICE_THD_WAIT_INCLUDED - -/** - @file include/mysql/service_thd_wait.h - This service provides functions for plugins and storage engines to report - when they are going to sleep/stall. - - SYNOPSIS - thd_wait_begin() - call just before a wait begins - thd Thread object - Use NULL if the thd is NOT known. - wait_type Type of wait - 1 -- short wait (e.g. for mutex) - 2 -- medium wait (e.g. for disk io) - 3 -- large wait (e.g. for locked row/table) - NOTES - This is used by the threadpool to have better knowledge of which - threads that currently are actively running on CPUs. When a thread - reports that it's going to sleep/stall, the threadpool scheduler is - free to start another thread in the pool most likely. The expected wait - time is simply an indication of how long the wait is expected to - become, the real wait time could be very different. - - thd_wait_end() called immediately after the wait is complete - - thd_wait_end() MUST be called if thd_wait_begin() was called. - - Using thd_wait_...() service is optional but recommended. Using it will - improve performance as the thread pool will be more active at managing the - thread workload. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum _thd_wait_type_e { - THD_WAIT_MUTEX= 1, - THD_WAIT_DISKIO= 2, - THD_WAIT_ROW_TABLE_LOCK= 3, - THD_WAIT_GLOBAL_LOCK= 4 -} thd_wait_type; - -extern struct thd_wait_service_st { - void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type); - void (*thd_wait_end_func)(MYSQL_THD); -} *thd_wait_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define thd_wait_begin(_THD, _WAIT_TYPE) \ - thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE) -#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD) - -#else - -void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type); -void thd_wait_end(MYSQL_THD thd); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/dep/mysqllite/include/mysql/service_thread_scheduler.h b/dep/mysqllite/include/mysql/service_thread_scheduler.h deleted file mode 100644 index a4396b721bd..00000000000 --- a/dep/mysqllite/include/mysql/service_thread_scheduler.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED -#define SERVICE_THREAD_SCHEDULER_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -struct scheduler_functions; - -extern struct my_thread_scheduler_service { - int (*set)(struct scheduler_functions *scheduler); - int (*reset)(); -} *my_thread_scheduler_service; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F)) -#define my_thread_scheduler_reset() my_thread_scheduler_service->reset() - -#else - -/** - Set the thread scheduler to use for the server. - - @param scheduler Pointer to scheduler callbacks to use. - @retval 0 Scheduler installed correctly. - @retval 1 Invalid value (NULL) used for scheduler. -*/ -int my_thread_scheduler_set(struct scheduler_functions *scheduler); - -/** - Restore the previous thread scheduler. - - @note If no thread scheduler was installed previously with - thd_set_thread_scheduler, this function will report an error. - - @retval 0 Scheduler installed correctly. - @retval 1 No scheduler installed. -*/ -int my_thread_scheduler_reset(); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */ diff --git a/dep/mysqllite/include/mysql/services.h b/dep/mysqllite/include/mysql/services.h deleted file mode 100644 index 6c67a582fb8..00000000000 --- a/dep/mysqllite/include/mysql/services.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef MYSQL_SERVICES_INCLUDED -/* Copyright (C) 2009 Sun Microsystems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <mysql/service_my_snprintf.h> -#include <mysql/service_thd_alloc.h> -#include <mysql/service_thd_wait.h> -#include <mysql/service_thread_scheduler.h> - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICES_INCLUDED -#endif - |
