mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
proc_info_hook, mysys access to thd->proc_info
include/my_global.h: move __func__ definition to my_global.h include/my_sys.h: proc_info_hook mysys/my_static.c: proc_info_hook sql/mysqld.cc: proc_info_hook sql/sql_class.cc: support thd==0 in set_thd_proc_info sql/sql_profile.cc: move __func__ definition to my_global.h sql/sql_profile.h: move __func__ definition to my_global.h
This commit is contained in:
@ -1531,4 +1531,23 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
|
||||
#define bool In_C_you_should_use_my_bool_instead()
|
||||
#endif
|
||||
|
||||
/* Provide __func__ macro definition for platforms that miss it. */
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
# if __GNUC__ >= 2
|
||||
# define __func__ __FUNCTION__
|
||||
# else
|
||||
# define __func__ "<unknown>"
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# if _MSC_VER < 1300
|
||||
# define __func__ "<unknown>"
|
||||
# else
|
||||
# define __func__ __FUNCTION__
|
||||
# endif
|
||||
#elif defined(__BORLANDC__)
|
||||
# define __func__ __FUNC__
|
||||
#else
|
||||
# define __func__ "<unknown>"
|
||||
#endif
|
||||
|
||||
#endif /* my_global_h */
|
||||
|
@ -220,6 +220,9 @@ extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
|
||||
extern uint my_file_limit;
|
||||
extern ulong my_thread_stack_size;
|
||||
|
||||
extern const char *(*proc_info_hook)(void *, const char *, const char *,
|
||||
const char *, const unsigned int);
|
||||
|
||||
#ifdef HAVE_LARGE_PAGES
|
||||
extern my_bool my_use_large_pages;
|
||||
extern uint my_large_page_size;
|
||||
|
@ -92,6 +92,15 @@ int (*error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
||||
int (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
||||
my_message_no_curses;
|
||||
|
||||
static const char *proc_info_dummy(void *a, const char *b, const char *c,
|
||||
const char *d, const unsigned int e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *(*proc_info_hook)(void *, const char *, const char *, const char *,
|
||||
const unsigned int)= proc_info_dummy;
|
||||
|
||||
#ifdef __WIN__
|
||||
/* from my_getsystime.c */
|
||||
ulonglong query_performance_frequency, query_performance_offset;
|
||||
|
@ -3709,6 +3709,9 @@ static int init_server_components()
|
||||
|
||||
/* set up the hook before initializing plugins which may use it */
|
||||
error_handler_hook= my_message_sql;
|
||||
proc_info_hook= (const char *(*)(void *, const char *, const char *,
|
||||
const char *, const unsigned int))
|
||||
set_thd_proc_info;
|
||||
|
||||
if (xid_cache_init())
|
||||
{
|
||||
|
@ -253,6 +253,9 @@ const char *set_thd_proc_info(THD *thd, const char *info,
|
||||
const char *calling_file,
|
||||
const unsigned int calling_line)
|
||||
{
|
||||
if (!thd)
|
||||
thd= current_thd;
|
||||
|
||||
const char *old_info= thd->proc_info;
|
||||
DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line,
|
||||
(info != NULL) ? info : "(null)"));
|
||||
|
@ -38,9 +38,6 @@
|
||||
|
||||
#define MAX_QUERY_LENGTH 300
|
||||
|
||||
/* Reserved for systems that can't record the function name in source. */
|
||||
const char * const _unknown_func_ = "<unknown>";
|
||||
|
||||
/**
|
||||
Connects Information_Schema and Profiling.
|
||||
*/
|
||||
|
@ -16,27 +16,6 @@
|
||||
#ifndef _SQL_PROFILE_H
|
||||
#define _SQL_PROFILE_H
|
||||
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
# if __GNUC__ >= 2
|
||||
# define __func__ __FUNCTION__
|
||||
# else
|
||||
# define __func__ _unknown_func_
|
||||
extern const char * const _unknown_func_;
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# if _MSC_VER < 1300
|
||||
# define __func__ _unknown_func_
|
||||
extern const char * const _unknown_func_;
|
||||
# else
|
||||
# define __func__ __FUNCTION__
|
||||
# endif
|
||||
#elif defined(__BORLANDC__)
|
||||
# define __func__ __FUNC__
|
||||
#else
|
||||
# define __func__ _unknown_func_
|
||||
extern const char * const _unknown_func_;
|
||||
#endif
|
||||
|
||||
extern ST_FIELD_INFO query_profile_statistics_info[];
|
||||
int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond);
|
||||
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
|
||||
|
Reference in New Issue
Block a user