1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

10.0-monty merge

includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
This commit is contained in:
Sergei Golubchik
2013-07-21 16:39:19 +02:00
1378 changed files with 122105 additions and 45095 deletions

View File

@@ -0,0 +1,13 @@
#ifndef CLIENT_AUTHENTICATION_H
#define CLIENT_AUTHENTICATION_H
#include "mysql.h"
#include "mysql/client_plugin.h"
C_MODE_START
int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
int sha256_password_init(char *, size_t, int, va_list);
int sha256_password_deinit(void);
C_MODE_END
#endif

View File

@@ -46,6 +46,7 @@ class Item;
#endif
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
@@ -71,10 +72,10 @@ typedef struct st_mysql_xid MYSQL_XID;
*/
/* MySQL plugin interface version */
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0105
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0107
/*
The allowable types of plugins
@@ -87,7 +88,8 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
#define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 9 /* The number of plugin types */
/* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0
@@ -560,7 +562,7 @@ struct handlerton;
/*
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
*/
#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100
#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0200
/**
Replication plugin descriptor
@@ -608,6 +610,7 @@ int thd_sql_command(const MYSQL_THD thd);
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
int thd_tx_isolation(const MYSQL_THD thd);
int thd_tx_is_read_only(const MYSQL_THD thd);
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
unsigned int max_query_len);
/* Increments the row counter, see THD::row_count */

View File

@@ -1,5 +1,6 @@
#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -107,6 +108,13 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -247,6 +255,7 @@ int thd_sql_command(const void* thd);
void **thd_ha_data(const void* thd, const struct handlerton *hton);
void thd_storage_lock_wait(void* thd, long long value);
int thd_tx_isolation(const void* thd);
int thd_tx_is_read_only(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);

View File

@@ -1,5 +1,6 @@
#include <mysql/plugin.h>
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -107,6 +108,13 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -247,6 +255,7 @@ int thd_sql_command(const void* thd);
void **thd_ha_data(const void* thd, const struct handlerton *hton);
void thd_storage_lock_wait(void* thd, long long value);
int thd_tx_isolation(const void* thd);
int thd_tx_is_read_only(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);

View File

@@ -34,6 +34,27 @@
return values of the plugin authenticate_user() method.
*/
/**
Authentication failed, plugin internal error.
An error occurred in the authentication plugin itself.
These errors are reported in table performance_schema.host_cache,
column COUNT_AUTH_PLUGIN_ERRORS.
*/
#define CR_AUTH_PLUGIN_ERROR 3
/**
Authentication failed, client server handshake.
An error occurred during the client server handshake.
These errors are reported in table performance_schema.host_cache,
column COUNT_HANDSHAKE_ERRORS.
*/
#define CR_AUTH_HANDSHAKE 2
/**
Authentication failed, user credentials.
For example, wrong passwords.
These errors are reported in table performance_schema.host_cache,
column COUNT_AUTHENTICATION_ERRORS.
*/
#define CR_AUTH_USER_CREDENTIALS 1
/**
Authentication failed. Additionally, all other CR_xxx values
(libmysql error code) can be used too.

View File

@@ -1,5 +1,6 @@
#include "plugin.h"
typedef char my_bool;
typedef void * MYSQL_PLUGIN;
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -107,6 +108,13 @@ extern struct thd_timezone_service_st {
} *thd_timezone_service;
my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode);
void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
#include <mysql/service_sha1.h>
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -200,6 +208,7 @@ int thd_sql_command(const void* thd);
void **thd_ha_data(const void* thd, const struct handlerton *hton);
void thd_storage_lock_wait(void* thd, long long value);
int thd_tx_isolation(const void* thd);
int thd_tx_is_read_only(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);

View File

@@ -518,7 +518,7 @@ static inline void inline_mysql_file_register(
)
{
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_CALL(register_file)(category, info, count);
PSI_FILE_CALL(register_file)(category, info, count);
#endif
}
@@ -533,13 +533,13 @@ inline_mysql_file_fgets(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_READ);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
result= fgets(str, size, file->m_file);
PSI_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
return result;
}
#endif
@@ -559,13 +559,13 @@ inline_mysql_file_fgetc(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_READ);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
result= fgetc(file->m_file);
PSI_CALL(end_file_wait)(locker, (size_t) 1);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
return result;
}
#endif
@@ -586,14 +586,14 @@ inline_mysql_file_fputs(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
bytes= str ? strlen(str) : 0;
PSI_CALL(start_file_wait)(locker, bytes, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line);
result= fputs(str, file->m_file);
PSI_CALL(end_file_wait)(locker, bytes);
PSI_FILE_CALL(end_file_wait)(locker, bytes);
return result;
}
#endif
@@ -613,13 +613,13 @@ inline_mysql_file_fputc(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
result= fputc(c, file->m_file);
PSI_CALL(end_file_wait)(locker, (size_t) 1);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
return result;
}
#endif
@@ -639,15 +639,15 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...)
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
va_start(args, format);
result= vfprintf(file->m_file, format, args);
va_end(args);
PSI_CALL(end_file_wait)(locker, (size_t) result);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
return result;
}
#endif
@@ -669,13 +669,13 @@ inline_mysql_file_vfprintf(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= vfprintf(file->m_file, format, args);
PSI_CALL(end_file_wait)(locker, (size_t) result);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
return result;
}
#endif
@@ -695,13 +695,13 @@ inline_mysql_file_fflush(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_FLUSH);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_FLUSH);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= fflush(file->m_file);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -727,13 +727,13 @@ inline_mysql_file_fstat(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, filenr,
PSI_FILE_FSTAT);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, filenr, PSI_FILE_FSTAT);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_fstat(filenr, stat_area, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -753,14 +753,13 @@ inline_mysql_file_stat(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state,
key, PSI_FILE_STAT,
path, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_STAT, path, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
result= my_stat(path, stat_area, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_open_wait)(locker, result);
return result;
}
#endif
@@ -780,14 +779,14 @@ inline_mysql_file_chsize(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
PSI_FILE_CHSIZE);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_CHSIZE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
src_line);
result= my_chsize(file, newlength, filler, flags);
PSI_CALL(end_file_wait)(locker, (size_t) newlength);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength);
return result;
}
#endif
@@ -810,14 +809,14 @@ inline_mysql_file_fopen(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_STREAM_OPEN, filename, that);
if (likely(locker != NULL))
{
that->m_psi= PSI_CALL(start_file_open_wait)(locker, src_file,
src_line);
PSI_FILE_CALL(start_file_open_wait)
(locker, src_file, src_line);
that->m_file= my_fopen(filename, flags, myFlags);
PSI_CALL(end_file_open_wait)(locker);
that->m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file);
if (unlikely(that->m_file == NULL))
{
my_free(that);
@@ -851,13 +850,13 @@ inline_mysql_file_fclose(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_STREAM_CLOSE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_STREAM_CLOSE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_fclose(file->m_file, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
my_free(file);
return result;
}
@@ -881,17 +880,17 @@ inline_mysql_file_fread(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_READ);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_READ);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_fread(file->m_file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_read);
PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -912,17 +911,17 @@ inline_mysql_file_fwrite(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_fwrite(file->m_file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_written);
PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -942,13 +941,13 @@ inline_mysql_file_fseek(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_SEEK);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_SEEK);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_fseek(file->m_file, pos, whence, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -968,13 +967,13 @@ inline_mysql_file_ftell(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
PSI_FILE_TELL);
locker= PSI_FILE_CALL(get_thread_file_stream_locker)
(&state, file->m_psi, PSI_FILE_TELL);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_ftell(file->m_file, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -994,13 +993,13 @@ inline_mysql_file_create(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
filename, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_CREATE, filename, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_create(filename, create_flags, access_flags, myFlags);
PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1024,7 +1023,7 @@ inline_mysql_file_create_temp(
*/
file= create_temp_file(to, dir, pfx, mode, myFlags);
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_CALL(create_file)(key, to, file);
PSI_FILE_CALL(create_file)(key, to, file);
#endif
return file;
}
@@ -1040,13 +1039,13 @@ inline_mysql_file_open(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_OPEN,
filename, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_OPEN, filename, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_open(filename, flags, myFlags);
PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1066,13 +1065,13 @@ inline_mysql_file_close(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
PSI_FILE_CLOSE);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_CLOSE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_close(file, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1093,17 +1092,17 @@ inline_mysql_file_read(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
PSI_FILE_READ);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_read(file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_read);
PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -1124,17 +1123,17 @@ inline_mysql_file_write(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_write(file, buffer, count, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_written);
PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -1155,16 +1154,17 @@ inline_mysql_file_pread(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_read;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_pread(file, buffer, count, offset, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_read= (result == 0) ? count : 0;
else
bytes_read= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_read);
PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
return result;
}
#endif
@@ -1185,17 +1185,17 @@ inline_mysql_file_pwrite(
struct PSI_file_locker *locker;
PSI_file_locker_state state;
size_t bytes_written;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
PSI_FILE_WRITE);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_WRITE);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
result= my_pwrite(file, buffer, count, offset, flags);
if (flags & (MY_NABP | MY_FNABP))
bytes_written= (result == 0) ? count : 0;
else
bytes_written= (result != MY_FILE_ERROR) ? result : 0;
PSI_CALL(end_file_wait)(locker, bytes_written);
PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
return result;
}
#endif
@@ -1215,12 +1215,13 @@ inline_mysql_file_seek(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_SEEK);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_SEEK);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_seek(file, pos, whence, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1240,12 +1241,13 @@ inline_mysql_file_tell(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_TELL);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, file, PSI_FILE_TELL);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_tell(file, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1265,13 +1267,13 @@ inline_mysql_file_delete(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
name, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete(name, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1291,13 +1293,13 @@ inline_mysql_file_rename(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
to, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_RENAME, to, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename(from, to, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1318,14 +1320,14 @@ inline_mysql_file_create_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
filename, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_CREATE, filename, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
flags);
PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
return file;
}
#endif
@@ -1346,13 +1348,13 @@ inline_mysql_file_delete_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
name, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete_with_symlink(name, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
@@ -1372,13 +1374,13 @@ inline_mysql_file_rename_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
to, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_RENAME, to, &locker);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename_with_symlink(from, to, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif
@@ -1398,12 +1400,13 @@ inline_mysql_file_sync(
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, fd, PSI_FILE_SYNC);
locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
(&state, fd, PSI_FILE_SYNC);
if (likely(locker != NULL))
{
PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_sync(fd, flags);
PSI_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
return result;
}
#endif

View File

@@ -70,7 +70,7 @@ inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
const char *src_file, int src_line)
{
struct PSI_idle_locker *locker;
locker= PSI_CALL(start_idle_wait)(state, src_file, src_line);
locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
return locker;
}
@@ -82,7 +82,7 @@ static inline void
inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
{
if (likely(locker != NULL))
PSI_CALL(end_idle_wait)(locker);
PSI_IDLE_CALL(end_idle_wait)(locker);
}
#endif

View File

@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
#ifdef __WIN__
#include <ws2def.h>
#include <winsock2.h>
#include <MSWSock.h>
#define SOCKBUF_T char
#else
#include <netinet/in.h>
@@ -121,7 +122,7 @@ mysql_socket_set_address(
{
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (socket.m_psi != NULL)
PSI_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
#endif
}
@@ -141,7 +142,7 @@ MYSQL_SOCKET socket __attribute__ ((unused))
{
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (socket.m_psi != NULL)
PSI_CALL(set_socket_thread_owner)(socket.m_psi);
PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi);
#endif
}
@@ -247,8 +248,8 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
struct PSI_socket_locker *locker;
if (mysql_socket.m_psi != NULL)
{
locker= PSI_CALL(start_socket_wait)(state, mysql_socket.m_psi, op,
byte_count, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(state, mysql_socket.m_psi, op, byte_count, src_file, src_line);
}
else
locker= NULL;
@@ -263,7 +264,7 @@ static inline void
inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count)
{
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, byte_count);
PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count);
}
/**
@@ -276,7 +277,7 @@ static inline void
inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
{
if (socket.m_psi != NULL)
PSI_CALL(set_socket_state)(socket.m_psi, state);
PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state);
}
#endif /* HAVE_PSI_SOCKET_INTERFACE */
@@ -537,7 +538,7 @@ static inline void inline_mysql_socket_register(
PSI_socket_info *info,
int count)
{
PSI_CALL(register_socket)(category, info, count);
PSI_SOCKET_CALL(register_socket)(category, info, count);
}
#endif
@@ -551,16 +552,15 @@ inline_mysql_socket_socket
#endif
int domain, int type, int protocol)
{
MYSQL_SOCKET mysql_socket;
MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET;
mysql_socket.fd= socket(domain, type, protocol);
#ifdef HAVE_PSI_SOCKET_INTERFACE
mysql_socket.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd);
if (likely(mysql_socket.fd != INVALID_SOCKET && mysql_socket.m_psi != NULL))
PSI_CALL(set_socket_info)(mysql_socket.m_psi, &mysql_socket.fd, NULL, 0);
#else
mysql_socket.m_psi= NULL;
if (likely(mysql_socket.fd != INVALID_SOCKET))
{
mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket)
(key, (const my_socket*)&mysql_socket.fd, NULL, 0);
}
#endif
return mysql_socket;
}
@@ -583,17 +583,18 @@ inline_mysql_socket_bind
/* Instrumentation start */
PSI_socket_locker_state state;
PSI_socket_locker *locker;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= bind(mysql_socket.fd, addr, len);
/* Instrumentation end */
PSI_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
if (result == 0)
PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -622,15 +623,15 @@ inline_mysql_socket_getsockname
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getsockname(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -660,15 +661,15 @@ inline_mysql_socket_connect
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= connect(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -698,15 +699,15 @@ inline_mysql_socket_getpeername
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getpeername(mysql_socket.fd, addr, len);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -736,18 +737,18 @@ inline_mysql_socket_send
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_SEND, n, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
/* Instrumented code */
result= send(mysql_socket.fd, buf, n, flags);
result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_written;
bytes_written= (result > -1) ? result : 0;
PSI_CALL(end_socket_wait)(locker, bytes_written);
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
return result;
@@ -755,7 +756,7 @@ inline_mysql_socket_send
#endif
/* Non instrumented code */
result= send(mysql_socket.fd, buf, n, flags);
result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
return result;
}
@@ -778,18 +779,18 @@ inline_mysql_socket_recv
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
/* Instrumented code */
result= recv(mysql_socket.fd, buf, n, flags);
result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_read;
bytes_read= (result > -1) ? result : 0;
PSI_CALL(end_socket_wait)(locker, bytes_read);
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
return result;
@@ -797,7 +798,7 @@ inline_mysql_socket_recv
#endif
/* Non instrumented code */
result= recv(mysql_socket.fd, buf, n, flags);
result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
return result;
}
@@ -820,18 +821,18 @@ inline_mysql_socket_sendto
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_SEND, n, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
/* Instrumented code */
result= sendto(mysql_socket.fd, buf, n, flags, addr, addr_len);
result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_written;
bytes_written = (result > -1) ? result : 0;
PSI_CALL(end_socket_wait)(locker, bytes_written);
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
return result;
@@ -839,7 +840,7 @@ inline_mysql_socket_sendto
#endif
/* Non instrumented code */
result= sendto(mysql_socket.fd, buf, n, flags, addr, addr_len);
result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
return result;
}
@@ -863,18 +864,18 @@ inline_mysql_socket_recvfrom
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
/* Instrumented code */
result= recvfrom(mysql_socket.fd, buf, n, flags, addr, addr_len);
result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
/* Instrumentation end */
if (locker != NULL)
{
size_t bytes_read;
bytes_read = (result > -1) ? result : 0;
PSI_CALL(end_socket_wait)(locker, bytes_read);
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
return result;
@@ -882,7 +883,7 @@ inline_mysql_socket_recvfrom
#endif
/* Non instrumented code */
result= recvfrom(mysql_socket.fd, buf, n, flags, addr, addr_len);
result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
return result;
}
@@ -905,15 +906,15 @@ inline_mysql_socket_getsockopt
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= getsockopt(mysql_socket.fd, level, optname, optval, optlen);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -944,15 +945,15 @@ inline_mysql_socket_setsockopt
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= setsockopt(mysql_socket.fd, level, optname, optval, optlen);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -982,15 +983,15 @@ inline_mysql_socket_listen
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
result= listen(mysql_socket.fd, backlog);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
@@ -1021,15 +1022,15 @@ inline_mysql_socket_accept
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, socket_listen.m_psi,
PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
/* Instrumented code */
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
}
else
#endif
@@ -1039,14 +1040,12 @@ inline_mysql_socket_accept
}
#ifdef HAVE_PSI_SOCKET_INTERFACE
/* Initialize the instrument with the new socket descriptor and address */
socket_accept.m_psi=
PSI_CALL(init_socket)(key, (const my_socket*)&socket_accept.fd);
/* FIXME: simplify this with just 1 call to init_socket(). */
if (socket_accept.m_psi != NULL)
PSI_CALL(set_socket_info)(socket_accept.m_psi, &socket_accept.fd, addr,
addr_length);
if (likely(socket_accept.fd != INVALID_SOCKET))
{
/* Initialize the instrument with the new socket descriptor and address */
socket_accept.m_psi= PSI_SOCKET_CALL(init_socket)
(key, (const my_socket*)&socket_accept.fd, addr, addr_length);
}
#endif
return socket_accept;
@@ -1070,18 +1069,18 @@ inline_mysql_socket_close
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
/* Instrumented code */
result= closesocket(mysql_socket.fd);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
/* Remove the instrumentation for this socket. */
if (mysql_socket.m_psi != NULL)
PSI_CALL(destroy_socket)(mysql_socket.m_psi);
PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi);
return result;
}
@@ -1105,28 +1104,53 @@ inline_mysql_socket_shutdown
{
int result;
/* Instrumentation start */
#ifdef __WIN__
static LPFN_DISCONNECTEX DisconnectEx = NULL;
if (DisconnectEx == NULL)
{
DWORD dwBytesReturned;
GUID guidDisconnectEx = WSAID_DISCONNECTEX;
WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER,
&guidDisconnectEx, sizeof(GUID),
&DisconnectEx, sizeof(DisconnectEx),
&dwBytesReturned, NULL, NULL);
}
#endif
/* Instrumentation start */
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
{
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
/* Instrumented code */
result= shutdown(mysql_socket.fd, how);
#ifdef __WIN__
if (DisconnectEx)
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
else
#endif
result= shutdown(mysql_socket.fd, how);
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_socket_wait)(locker, (size_t)0);
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
#endif
/* Non instrumented code */
result= shutdown(mysql_socket.fd, how);
#ifdef __WIN__
if (DisconnectEx)
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
else
#endif
result= shutdown(mysql_socket.fd, how);
return result;
}

View File

@@ -53,7 +53,7 @@
static inline void inline_mysql_stage_register(
const char *category, PSI_stage_info **info, int count)
{
PSI_CALL(register_stage)(category, info, count);
PSI_STAGE_CALL(register_stage)(category, info, count);
}
#endif
@@ -62,7 +62,7 @@ static inline void
inline_mysql_set_stage(PSI_stage_key key,
const char *src_file, int src_line)
{
PSI_CALL(start_stage)(key, src_file, src_line);
PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
}
#endif

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -63,10 +63,10 @@
#endif
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, __FILE__, __LINE__)
#else
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
NULL
#endif
@@ -122,7 +122,7 @@
static inline void inline_mysql_statement_register(
const char *category, PSI_statement_info *info, int count)
{
PSI_CALL(register_statement)(category, info, count);
PSI_STATEMENT_CALL(register_statement)(category, info, count);
}
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
@@ -132,7 +132,7 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
PSI_digest_locker* digest_locker= NULL;
if (likely(locker != NULL))
digest_locker= PSI_CALL(digest_start)(locker);
digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
return digest_locker;
}
#endif
@@ -143,7 +143,7 @@ inline_mysql_add_token(PSI_digest_locker *locker, uint token,
void *yylval)
{
if (likely(locker != NULL))
locker= PSI_CALL(digest_add_token)(locker, token,
locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
(OPAQUE_LEX_YYSTYPE*)yylval);
return locker;
}
@@ -153,12 +153,13 @@ static inline struct PSI_statement_locker *
inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
const char *db, uint db_len,
const CHARSET_INFO *charset,
const char *src_file, int src_line)
{
PSI_statement_locker *locker;
locker= PSI_CALL(get_thread_statement_locker)(state, key);
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
if (likely(locker != NULL))
PSI_CALL(start_statement)(locker, db, db_len, src_file, src_line);
PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
return locker;
}
@@ -168,7 +169,7 @@ inline_mysql_refine_statement(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
locker= PSI_CALL(refine_statement)(locker, key);
locker= PSI_STATEMENT_CALL(refine_statement)(locker, key);
}
return locker;
}
@@ -179,7 +180,7 @@ inline_mysql_set_statement_text(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
PSI_CALL(set_statement_text)(locker, text, text_len);
PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
}
}
@@ -189,7 +190,7 @@ inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
PSI_CALL(set_statement_lock_time)(locker, count);
PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
}
}
@@ -199,7 +200,7 @@ inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
PSI_CALL(set_statement_rows_sent)(locker, count);
PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
}
}
@@ -209,7 +210,7 @@ inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
{
if (likely(locker != NULL))
{
PSI_CALL(set_statement_rows_examined)(locker, count);
PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
}
}
@@ -217,9 +218,9 @@ static inline void
inline_mysql_end_statement(struct PSI_statement_locker *locker,
Diagnostics_area *stmt_da)
{
PSI_CALL(end_stage)();
PSI_STAGE_CALL(end_stage)();
if (likely(locker != NULL))
PSI_CALL(end_statement)(locker, stmt_da);
PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
}
#endif

View File

@@ -30,18 +30,20 @@
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define PSI_CALL_unbind_table PSI_CALL(unbind_table)
#define PSI_CALL_rebind_table PSI_CALL(rebind_table)
#define PSI_CALL_open_table PSI_CALL(open_table)
#define PSI_CALL_close_table PSI_CALL(close_table)
#define PSI_CALL_get_table_share PSI_CALL(get_table_share)
#define PSI_CALL_drop_table_share PSI_CALL(drop_table_share)
#define PSI_CALL_unbind_table PSI_TABLE_CALL(unbind_table)
#define PSI_CALL_rebind_table PSI_TABLE_CALL(rebind_table)
#define PSI_CALL_open_table PSI_TABLE_CALL(open_table)
#define PSI_CALL_close_table PSI_TABLE_CALL(close_table)
#define PSI_CALL_get_table_share PSI_TABLE_CALL(get_table_share)
#define PSI_CALL_release_table_share PSI_TABLE_CALL(release_table_share)
#define PSI_CALL_drop_table_share PSI_TABLE_CALL(drop_table_share)
#else
#define PSI_CALL_unbind_table(A1) /* no-op */
#define PSI_CALL_rebind_table(A1,A2,A3) NULL
#define PSI_CALL_close_table(A1) /* no-op */
#define PSI_CALL_open_table(A1,A2) NULL
#define PSI_CALL_get_table_share(A1,A2) NULL
#define PSI_CALL_release_table_share(A1) /* no-op */
#define PSI_CALL_drop_table_share(A1,A2,A3,A4,A5) /* no-op */
#endif
@@ -76,22 +78,22 @@
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_CALL(start_table_io_wait)(& state, PSI, OP, INDEX, \
__FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_CALL(end_table_io_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_TABLE_CALL(start_table_io_wait) \
(& state, PSI, OP, INDEX, __FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_TABLE_CALL(end_table_io_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
}
#else
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
@@ -109,22 +111,22 @@
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_CALL(start_table_lock_wait)(& state, PSI, OP, FLAGS, \
__FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_CALL(end_table_lock_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_TABLE_CALL(start_table_lock_wait) \
(& state, PSI, OP, FLAGS, __FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_TABLE_CALL(end_table_lock_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
}
#else
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
@@ -180,7 +182,8 @@ inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
if (psi != NULL)
{
struct PSI_table_locker *locker;
locker= PSI_CALL(start_table_lock_wait)(state, psi, op, flags, src_file, src_line);
locker= PSI_TABLE_CALL(start_table_lock_wait)
(state, psi, op, flags, src_file, src_line);
return locker;
}
return NULL;
@@ -194,7 +197,7 @@ static inline void
inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
{
if (locker != NULL)
PSI_CALL(end_table_lock_wait)(locker);
PSI_TABLE_CALL(end_table_lock_wait)(locker);
}
#endif

View File

@@ -597,7 +597,7 @@ static inline void inline_mysql_mutex_register(
)
{
#ifdef HAVE_PSI_MUTEX_INTERFACE
PSI_CALL(register_mutex)(category, info, count);
PSI_MUTEX_CALL(register_mutex)(category, info, count);
#endif
}
@@ -613,7 +613,7 @@ static inline int inline_mysql_mutex_init(
)
{
#ifdef HAVE_PSI_MUTEX_INTERFACE
that->m_psi= PSI_CALL(init_mutex)(key, &that->m_mutex);
that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex);
#else
that->m_psi= NULL;
#endif
@@ -636,7 +636,7 @@ static inline int inline_mysql_mutex_destroy(
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
{
PSI_CALL(destroy_mutex)(that->m_psi);
PSI_MUTEX_CALL(destroy_mutex)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -664,7 +664,7 @@ static inline int inline_mysql_mutex_lock(
/* Instrumentation start */
PSI_mutex_locker *locker;
PSI_mutex_locker_state state;
locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
PSI_MUTEX_LOCK, src_file, src_line);
/* Instrumented code */
@@ -678,7 +678,7 @@ static inline int inline_mysql_mutex_lock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_mutex_wait)(locker, result);
PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
return result;
}
@@ -711,7 +711,7 @@ static inline int inline_mysql_mutex_trylock(
/* Instrumentation start */
PSI_mutex_locker *locker;
PSI_mutex_locker_state state;
locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
PSI_MUTEX_TRYLOCK, src_file, src_line);
/* Instrumented code */
@@ -725,7 +725,7 @@ static inline int inline_mysql_mutex_trylock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_mutex_wait)(locker, result);
PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
return result;
}
@@ -754,7 +754,7 @@ static inline int inline_mysql_mutex_unlock(
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
PSI_CALL(unlock_mutex)(that->m_psi);
PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
#endif
#ifdef SAFE_MUTEX
@@ -781,7 +781,7 @@ static inline void inline_mysql_rwlock_register(
)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
PSI_CALL(register_rwlock)(category, info, count);
PSI_RWLOCK_CALL(register_rwlock)(category, info, count);
#endif
}
@@ -792,7 +792,7 @@ static inline int inline_mysql_rwlock_init(
mysql_rwlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_rwlock);
that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock);
#else
that->m_psi= NULL;
#endif
@@ -810,7 +810,7 @@ static inline int inline_mysql_prlock_init(
mysql_prlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_prlock);
that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock);
#else
that->m_psi= NULL;
#endif
@@ -824,7 +824,7 @@ static inline int inline_mysql_rwlock_destroy(
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
{
PSI_CALL(destroy_rwlock)(that->m_psi);
PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -838,7 +838,7 @@ static inline int inline_mysql_prlock_destroy(
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
{
PSI_CALL(destroy_rwlock)(that->m_psi);
PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -861,7 +861,7 @@ static inline int inline_mysql_rwlock_rdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_READLOCK, src_file, src_line);
/* Instrumented code */
@@ -869,7 +869,7 @@ static inline int inline_mysql_rwlock_rdlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_rdwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -897,7 +897,7 @@ static inline int inline_mysql_prlock_rdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_READLOCK, src_file, src_line);
/* Instrumented code */
@@ -905,7 +905,7 @@ static inline int inline_mysql_prlock_rdlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_rdwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -933,7 +933,7 @@ static inline int inline_mysql_rwlock_wrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -941,7 +941,7 @@ static inline int inline_mysql_rwlock_wrlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_wrwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -969,7 +969,7 @@ static inline int inline_mysql_prlock_wrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -977,7 +977,7 @@ static inline int inline_mysql_prlock_wrlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_wrwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -1005,7 +1005,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK, src_file, src_line);
/* Instrumented code */
@@ -1013,7 +1013,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_rdwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
return result;
}
@@ -1040,7 +1040,7 @@ static inline int inline_mysql_rwlock_trywrlock(
/* Instrumentation start */
PSI_rwlock_locker *locker;
PSI_rwlock_locker_state state;
locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK, src_file, src_line);
/* Instrumented code */
@@ -1048,7 +1048,7 @@ static inline int inline_mysql_rwlock_trywrlock(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_rwlock_wrwait)(locker, result);
PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
return result;
}
@@ -1066,7 +1066,7 @@ static inline int inline_mysql_rwlock_unlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
PSI_CALL(unlock_rwlock)(that->m_psi);
PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_unlock(&that->m_rwlock);
return result;
@@ -1079,7 +1079,7 @@ static inline int inline_mysql_prlock_unlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
PSI_CALL(unlock_rwlock)(that->m_psi);
PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_pr_unlock(&that->m_prlock);
return result;
@@ -1099,7 +1099,7 @@ static inline void inline_mysql_cond_register(
)
{
#ifdef HAVE_PSI_COND_INTERFACE
PSI_CALL(register_cond)(category, info, count);
PSI_COND_CALL(register_cond)(category, info, count);
#endif
}
@@ -1111,7 +1111,7 @@ static inline int inline_mysql_cond_init(
const pthread_condattr_t *attr)
{
#ifdef HAVE_PSI_COND_INTERFACE
that->m_psi= PSI_CALL(init_cond)(key, &that->m_cond);
that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond);
#else
that->m_psi= NULL;
#endif
@@ -1124,7 +1124,7 @@ static inline int inline_mysql_cond_destroy(
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
{
PSI_CALL(destroy_cond)(that->m_psi);
PSI_COND_CALL(destroy_cond)(that->m_psi);
that->m_psi= NULL;
}
#endif
@@ -1147,7 +1147,7 @@ static inline int inline_mysql_cond_wait(
/* Instrumentation start */
PSI_cond_locker *locker;
PSI_cond_locker_state state;
locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
PSI_COND_WAIT, src_file, src_line);
/* Instrumented code */
@@ -1155,7 +1155,7 @@ static inline int inline_mysql_cond_wait(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_cond_wait)(locker, result);
PSI_COND_CALL(end_cond_wait)(locker, result);
return result;
}
@@ -1184,7 +1184,7 @@ static inline int inline_mysql_cond_timedwait(
/* Instrumentation start */
PSI_cond_locker *locker;
PSI_cond_locker_state state;
locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
PSI_COND_TIMEDWAIT, src_file, src_line);
/* Instrumented code */
@@ -1192,7 +1192,7 @@ static inline int inline_mysql_cond_timedwait(
/* Instrumentation end */
if (locker != NULL)
PSI_CALL(end_cond_wait)(locker, result);
PSI_COND_CALL(end_cond_wait)(locker, result);
return result;
}
@@ -1210,7 +1210,7 @@ static inline int inline_mysql_cond_signal(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
PSI_CALL(signal_cond)(that->m_psi);
PSI_COND_CALL(signal_cond)(that->m_psi);
#endif
result= pthread_cond_signal(&that->m_cond);
return result;
@@ -1222,7 +1222,7 @@ static inline int inline_mysql_cond_broadcast(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
PSI_CALL(broadcast_cond)(that->m_psi);
PSI_COND_CALL(broadcast_cond)(that->m_psi);
#endif
result= pthread_cond_broadcast(&that->m_cond);
return result;
@@ -1241,7 +1241,7 @@ static inline void inline_mysql_thread_register(
)
{
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_CALL(register_thread)(category, info, count);
PSI_THREAD_CALL(register_thread)(category, info, count);
#endif
}
@@ -1252,14 +1252,14 @@ static inline int inline_mysql_thread_create(
void *(*start_routine)(void*), void *arg)
{
int result;
result= PSI_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
return result;
}
static inline void inline_mysql_thread_set_psi_id(ulong id)
{
struct PSI_thread *psi= PSI_CALL(get_thread)();
PSI_CALL(set_thread_id)(psi, id);
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
PSI_THREAD_CALL(set_thread_id)(psi, id);
}
#endif

View File

@@ -899,6 +899,10 @@ struct PSI_file_locker_state_v1
enum PSI_file_operation m_operation;
/** Current file. */
struct PSI_file *m_file;
/** Current file name. */
const char *m_name;
/** Current file class. */
void *m_class;
/** Current thread. */
struct PSI_thread *m_thread;
/** Operation number of bytes. */
@@ -958,6 +962,8 @@ struct PSI_digest_storage
{
my_bool m_full;
int m_byte_count;
/** Character set number. */
uint m_charset_number;
unsigned char m_token_array[PSI_MAX_DIGEST_STORAGE_SIZE];
};
typedef struct PSI_digest_storage PSI_digest_storage;
@@ -969,6 +975,9 @@ struct PSI_digest_locker_state
};
typedef struct PSI_digest_locker_state PSI_digest_locker_state;
/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
#define PSI_SCHEMA_NAME_LEN (64 * 3)
/**
State data storage for @c get_thread_statement_locker_v1_t,
@c get_thread_statement_locker_v1_t.
@@ -1029,6 +1038,10 @@ struct PSI_statement_locker_state_v1
ulong m_sort_scan;
/** Statement digest. */
PSI_digest_locker_state m_digest_state;
/** Current schema name. */
char m_schema_name[PSI_SCHEMA_NAME_LEN];
/** Length in bytes of @c m_schema_name. */
uint m_schema_name_length;
};
/**
@@ -1187,10 +1200,13 @@ typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
Socket instrumentation initialisation API.
@param key the registered mutex key
@param socket descriptor
@param addr the socket ip address
@param addr_len length of socket ip address
@return an instrumented socket
*/
typedef struct PSI_socket* (*init_socket_v1_t)
(PSI_socket_key key, const my_socket *fd);
(PSI_socket_key key, const my_socket *fd,
const struct sockaddr *addr, socklen_t addr_len);
/**
socket instrumentation destruction API.
@@ -1290,7 +1306,7 @@ typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
@return an instrumented thread
*/
typedef struct PSI_thread* (*new_thread_v1_t)
(PSI_thread_key key, const void *identity, ulong thread_id);
(PSI_thread_key key, const void *identity, ulonglong thread_id);
/**
Assign an id to an instrumented thread.
@@ -1298,7 +1314,7 @@ typedef struct PSI_thread* (*new_thread_v1_t)
@param id the id to assign
*/
typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
unsigned long id);
ulonglong id);
/**
Get the instrumentation for the running thread.
@@ -1570,16 +1586,18 @@ typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
@param op the operation to perform
@param src_file the source file name
@param src_line the source line number
@return an instrumented file handle
*/
typedef struct PSI_file* (*start_file_open_wait_v1_t)
typedef void (*start_file_open_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
/**
End a file instrumentation open operation, for file streams.
@param locker the file locker.
@param result the opened file (NULL indicates failure, non NULL success).
@return an instrumented file handle
*/
typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker);
typedef struct PSI_file* (*end_file_open_wait_v1_t)
(struct PSI_file_locker *locker, void *result);
/**
End a file instrumentation open operation, for non stream files.
@@ -1616,6 +1634,25 @@ typedef void (*start_file_wait_v1_t)
typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
/**
Start a file instrumentation close operation.
@param locker the file locker
@param op the operation to perform
@param src_file the source file name
@param src_line the source line number
*/
typedef void (*start_file_close_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
/**
End a file instrumentation close operation.
@param locker the file locker.
@param rc the close operation return code (0 for success).
@return an instrumented file handle
*/
typedef void (*end_file_close_wait_v1_t)
(struct PSI_file_locker *locker, int rc);
/**
Start a new stage, and implicitly end the previous stage.
@param key the key of the new stage
@@ -1632,11 +1669,12 @@ typedef void (*end_stage_v1_t) (void);
Get a statement instrumentation locker.
@param state data storage for the locker
@param key the statement instrumentation key
@param charset client character set
@return a statement locker, or NULL
*/
typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
(struct PSI_statement_locker_state_v1 *state,
PSI_statement_key key);
PSI_statement_key key, const void *charset);
/**
Refine a statement locker to a more specific key.
@@ -1870,6 +1908,19 @@ typedef struct PSI_digest_locker * (*digest_start_v1_t)
typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
/**
Stores an array of connection attributes
@param buffer char array of length encoded connection attributes
in network format
@param length legnth of the data in buffer
@param from_cs charset in which @buffer is encodded
@return state
@retval non-0 attributes truncated
@retval 0 stored the attribute
*/
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
const void *from_cs);
/**
Performance Schema Interface, version 1.
@since PSI_VERSION_1
@@ -2005,6 +2056,10 @@ struct PSI_v1
start_file_wait_v1_t start_file_wait;
/** @sa end_file_wait_v1_t. */
end_file_wait_v1_t end_file_wait;
/** @sa start_file_close_wait_v1_t. */
start_file_close_wait_v1_t start_file_close_wait;
/** @sa end_file_close_wait_v1_t. */
end_file_close_wait_v1_t end_file_close_wait;
/** @sa start_stage_v1_t. */
start_stage_v1_t start_stage;
/** @sa end_stage_v1_t. */
@@ -2065,6 +2120,8 @@ struct PSI_v1
digest_start_v1_t digest_start;
/** @sa digest_add_token_v1_t. */
digest_add_token_v1_t digest_add_token;
/** @sa set_thread_connect_attrs_v1_t. */
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
/** @} (end of group Group_PSI_v1) */
@@ -2318,7 +2375,54 @@ typedef struct PSI_stage_info_none PSI_stage_info;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
#define PSI_CALL(M) PSI_server->M
/*
Allow to override PSI_XXX_CALL at compile time
with more efficient implementations, if available.
If nothing better is available,
make a dynamic call using the PSI_server function pointer.
*/
#ifndef PSI_MUTEX_CALL
#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_RWLOCK_CALL
#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_COND_CALL
#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_THREAD_CALL
#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_FILE_CALL
#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_SOCKET_CALL
#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_STAGE_CALL
#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_STATEMENT_CALL
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_TABLE_CALL
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_IDLE_CALL
#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#define PSI_DYNAMIC_CALL(M) PSI_server->M
/** @} */

View File

@@ -221,6 +221,8 @@ struct PSI_file_locker_state_v1
uint m_flags;
enum PSI_file_operation m_operation;
struct PSI_file *m_file;
const char *m_name;
void *m_class;
struct PSI_thread *m_thread;
size_t m_number_of_bytes;
ulonglong m_timer_start;
@@ -243,6 +245,7 @@ struct PSI_digest_storage
{
my_bool m_full;
int m_byte_count;
uint m_charset_number;
unsigned char m_token_array[1024];
};
typedef struct PSI_digest_storage PSI_digest_storage;
@@ -278,6 +281,8 @@ struct PSI_statement_locker_state_v1
ulong m_sort_rows;
ulong m_sort_scan;
PSI_digest_locker_state m_digest_state;
char m_schema_name[(64 * 3)];
uint m_schema_name_length;
};
struct PSI_socket_locker_state_v1
{
@@ -318,7 +323,8 @@ typedef struct PSI_cond* (*init_cond_v1_t)
(PSI_cond_key key, const void *identity);
typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
typedef struct PSI_socket* (*init_socket_v1_t)
(PSI_socket_key key, const my_socket *fd);
(PSI_socket_key key, const my_socket *fd,
const struct sockaddr *addr, socklen_t addr_len);
typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
typedef struct PSI_table_share* (*get_table_share_v1_t)
(my_bool temporary, struct TABLE_SHARE *share);
@@ -340,9 +346,9 @@ typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
const pthread_attr_t *attr,
void *(*start_routine)(void*), void *arg);
typedef struct PSI_thread* (*new_thread_v1_t)
(PSI_thread_key key, const void *identity, ulong thread_id);
(PSI_thread_key key, const void *identity, ulonglong thread_id);
typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
unsigned long id);
ulonglong id);
typedef struct PSI_thread* (*get_thread_v1_t)(void);
typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len,
@@ -420,9 +426,10 @@ typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t)
ulong flags,
const char *src_file, uint src_line);
typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
typedef struct PSI_file* (*start_file_open_wait_v1_t)
typedef void (*start_file_open_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker);
typedef struct PSI_file* (*end_file_open_wait_v1_t)
(struct PSI_file_locker *locker, void *result);
typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t)
(struct PSI_file_locker *locker, File file);
typedef void (*start_file_wait_v1_t)
@@ -430,12 +437,16 @@ typedef void (*start_file_wait_v1_t)
const char *src_file, uint src_line);
typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
typedef void (*start_file_close_wait_v1_t)
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
typedef void (*end_file_close_wait_v1_t)
(struct PSI_file_locker *locker, int rc);
typedef void (*start_stage_v1_t)
(PSI_stage_key key, const char *src_file, int src_line);
typedef void (*end_stage_v1_t) (void);
typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
(struct PSI_statement_locker_state_v1 *state,
PSI_statement_key key);
PSI_statement_key key, const void *charset);
typedef struct PSI_statement_locker* (*refine_statement_v1_t)
(struct PSI_statement_locker *locker,
PSI_statement_key key);
@@ -499,6 +510,8 @@ typedef struct PSI_digest_locker * (*digest_start_v1_t)
(struct PSI_statement_locker *locker);
typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
const void *from_cs);
struct PSI_v1
{
register_mutex_v1_t register_mutex;
@@ -566,6 +579,8 @@ struct PSI_v1
end_file_open_wait_and_bind_to_descriptor;
start_file_wait_v1_t start_file_wait;
end_file_wait_v1_t end_file_wait;
start_file_close_wait_v1_t start_file_close_wait;
end_file_close_wait_v1_t end_file_close_wait;
start_stage_v1_t start_stage;
end_stage_v1_t end_stage;
get_thread_statement_locker_v1_t get_thread_statement_locker;
@@ -596,6 +611,7 @@ struct PSI_v1
set_socket_thread_owner_v1_t set_socket_thread_owner;
digest_start_v1_t digest_start;
digest_add_token_v1_t digest_add_token;
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
};
typedef struct PSI_v1 PSI;
typedef struct PSI_mutex_info_v1 PSI_mutex_info;

View File

@@ -339,9 +339,16 @@ extern void (*debug_sync_C_callback_ptr)(MYSQL_THD, const char *, size_t);
if (debug_sync_service) \
debug_sync_service(thd, STRING_WITH_LEN(name)); \
} while(0)
#define DEBUG_SYNC_C_IF_THD(thd, name) \
do { \
if (debug_sync_service && thd) \
debug_sync_service((MYSQL_THD) thd, STRING_WITH_LEN(name)); \
} while(0)
#else
#define DEBUG_SYNC(thd,name) do { } while(0)
#endif
#define DEBUG_SYNC(thd,name) do { } while(0)
#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { } while(0)
#endif /* defined(ENABLED_DEBUG_SYNC) */
/* compatibility macro */
#define DEBUG_SYNC_C(name) DEBUG_SYNC(NULL, name)

View File

@@ -0,0 +1,64 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; version 2 of the
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file
This service provides functions to report error conditions and log to
mysql error log.
*/
#ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
#define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#endif
/* keep in sync with the loglevel enum in my_sys.h */
enum plugin_log_level
{
MY_ERROR_LEVEL,
MY_WARNING_LEVEL,
MY_INFORMATION_LEVEL
};
#ifdef __cplusplus
extern "C" {
#endif
extern struct my_plugin_log_service
{
/** write a message to the log */
int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
} *my_plugin_log_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
#else
int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
const char *format, ...);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,57 @@
#ifndef MYSQL_SERVICE_SHA1_INCLUDED
/* Copyright (c) 2013, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file
my sha1 service
Functions to calculate SHA1 hash from a memory buffer
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MYSQL_ABI_CHECK
#include <stdlib.h>
#endif
#define MY_SHA1_HASH_SIZE 20 /* Hash size in bytes */
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
} *my_sha1_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_sha1(A,B,C) my_sha1_service->my_sha1_type(A,B,C)
#define my_sha1_multi my_sha1_service->my_sha1_multi_type
#else
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
#endif
#ifdef __cplusplus
}
#endif
#define MYSQL_SERVICE_SHA1_INCLUDED
#endif

View File

@@ -26,6 +26,7 @@ extern "C" {
#include <mysql/service_debug_sync.h>
#include <mysql/service_kill_statement.h>
#include <mysql/service_thd_timezone.h>
#include <mysql/service_sha1.h>
#ifdef __cplusplus
}