diff options
Diffstat (limited to 'include')
32 files changed, 679 insertions, 647 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index e610a8e325c..ad023083829 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -15,6 +15,8 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA +pkgpsiincludedir = $(pkgincludedir)/psi + BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h HEADERS_GEN_CONFIGURE = mysql_version.h HEADERS_GEN_MAKE = my_config.h @@ -25,18 +27,16 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h mysql/services.h \ mysql/service_my_snprintf.h mysql/service_thd_alloc.h \ my_pthread.h my_no_pthread.h \ - mysql/psi/psi.h mysql/psi/mysql_thread.h \ - mysql/psi/mysql_file.h \ decimal.h errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h -noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ +noinst_HEADERS = config-win.h lf.h my_bit.h \ heap.h my_bitmap.h my_uctype.h password.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ - mysys_err.h my_base.h help_start.h help_end.h \ + mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ @@ -45,7 +45,10 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ my_vle.h my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ - atomic/solaris.h mysql/innodb_priv.h + atomic/solaris.h mysql/innodb_priv.h my_compiler.h + +pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \ + mysql/psi/mysql_file.h EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \ CMakeLists.txt \ diff --git a/include/config-netware.h b/include/config-netware.h deleted file mode 100644 index a4465ea177a..00000000000 --- a/include/config-netware.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2000 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 */ - -/* Header for NetWare compatible with MySQL */ - -#ifndef _config_netware_h -#define _config_netware_h - -#define __event_h__ -#define _EVENT_H_ -/* - These two #define(s) are needed as both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - - -/* required headers */ -#include <unistd.h> -#include <stdio.h> -#include <errno.h> -#include <screen.h> -#include <limits.h> -#include <signal.h> -#include <errno.h> -#include <stdbool.h> -#include <stdlib.h> -#include <sys/types.h> -#include <time.h> -#include <sys/time.h> -#include <pthread.h> -#include <termios.h> - -#undef _EVENT_H_ -/* - This #undef exists here because both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* required adjustments */ -#undef HAVE_READDIR_R -#undef HAVE_RWLOCK_INIT -#undef HAVE_SCHED_H -#undef HAVE_SYS_MMAN_H -#undef HAVE_SYNCH_H -#undef HAVE_MMAP -#undef HAVE_RINT - -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 -#define HAVE_PTHREAD_SIGMASK 1 -#define HAVE_PTHREAD_YIELD_ZERO_ARG 1 -#define HAVE_BROKEN_REALPATH 1 - -/* changes made to make use of LibC-June-2004 for building purpose */ -#undef HAVE_POSIX_SIGNALS -#undef HAVE_PTHREAD_ATTR_SETSCOPE -#undef HAVE_ALLOC_A -#undef HAVE_FINITE -#undef HAVE_GETPWNAM -#undef HAVE_GETPWUID -#undef HAVE_READLINK -#undef HAVE_STPCPY -/* changes end */ - -/* Changes made to make use of LibC-June-2005 for building purpose */ -#undef HAVE_GETPASS -#undef HAVE_GETRLIMIT -#undef HAVE_GETRUSAGE -#undef HAVE_INITGROUPS -/* Changes end - LibC-June-2005 */ - -/* no libc crypt() function */ -#ifdef HAVE_OPENSSL - #define HAVE_CRYPT 1 -#else - #undef HAVE_CRYPT -#endif /* HAVE_OPENSSL */ - -/* Netware has an ancient zlib */ -#undef HAVE_COMPRESS -#define HAVE_COMPRESS -#undef HAVE_ARCHIVE_DB - -/* include the old function apis */ -#define USE_OLD_FUNCTIONS 1 - -/* no case sensitivity */ -#define FN_NO_CASE_SENSE 1 - -/* the thread alarm is not used */ -#define DONT_USE_THR_ALARM 1 - -/* signals do not interrupt sockets */ -#define SIGNALS_DONT_BREAK_READ 1 - -/* signal by closing the sockets */ -#define SIGNAL_WITH_VIO_CLOSE 1 - -/* On NetWare, stack grows towards lower address */ -#define STACK_DIRECTION -1 - -/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */ -#define NW_THD_STACKSIZE 65536 - -/* On NetWare, to fix the problem with the deletion of open files */ -#define CANT_DELETE_OPEN_FILES 1 - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define FN_DEVCHAR ':' - -/* default directory information */ -#define DEFAULT_MYSQL_HOME "sys:/mysql" -#define PACKAGE "mysql" -#define DEFAULT_BASEDIR "sys:/" -#define SHAREDIR "share/" -#define DEFAULT_CHARSET_HOME "sys:/mysql/" -#define MYSQL_DATADIR "data/" - -/* 64-bit file system calls */ -#define SIZEOF_OFF_T 8 -#define off_t off64_t -#define chsize chsize64 -#define ftruncate ftruncate64 -#define lseek lseek64 -#define pread pread64 -#define pwrite pwrite64 -#define tell tell64 - -/* do not use the extended time in LibC sys\stat.h */ -#define _POSIX_SOURCE - -/* Some macros for portability */ - -#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; } - -/* extra protection against CPU Hogs on NetWare */ -#define NETWARE_YIELD pthread_yield() -/* Screen mode for help texts */ -#define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A) - -#ifdef __cplusplus -} -#endif - -#endif /* _config_netware_h */ diff --git a/include/config-win.h b/include/config-win.h index 269ec0e925a..9e8bb19c12d 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -185,7 +185,6 @@ typedef SSIZE_T ssize_t; #define SOCKET_SIZE_TYPE int #define my_socket_defined #define byte_defined -#define HUGE_PTR #define STDCALL __stdcall /* Used by libmysql.dll */ #define isnan(X) _isnan(X) #define finite(X) _finite(X) diff --git a/include/hash.h b/include/hash.h index 7b4ec1b4685..d390cb7d4e6 100644 --- a/include/hash.h +++ b/include/hash.h @@ -64,14 +64,14 @@ typedef struct st_hash { typedef uint HASH_SEARCH_STATE; #define my_hash_init(A,B,C,D,E,F,G,H) \ - _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO) + _my_hash_init(A,0,B,C,D,E,F,G,H) #define my_hash_init2(A,B,C,D,E,F,G,H,I) \ - _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO) + _my_hash_init(A,B,C,D,E,F,G,H,I) my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, my_hash_get_key get_key, void (*free_element)(void*), - uint flags CALLER_INFO_PROTO); + uint flags); void my_hash_free(HASH *tree); void my_hash_reset(HASH *hash); uchar *my_hash_element(HASH *hash, ulong idx); @@ -100,7 +100,7 @@ my_bool my_hash_check(HASH *hash); /* Only in debug library */ #define my_hash_clear(H) bzero((char*) (H), sizeof(*(H))) #define my_hash_inited(H) ((H)->blength != 0) #define my_hash_init_opt(A,B,C,D,E,F,G,H) \ - (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO)) + (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H)) #ifdef __cplusplus } diff --git a/include/help_end.h b/include/help_end.h deleted file mode 100644 index 92953efe35a..00000000000 --- a/include/help_end.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef HELP_END_INCLUDED -#define HELP_END_INCLUDED - -/* Copyright (C) 2004-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifdef __NETWARE__ -#undef printf -#undef puts -#undef fputs -#undef fputc -#undef putchar -#endif -#endif /* HELP_END_INCLUDED */ diff --git a/include/help_start.h b/include/help_start.h deleted file mode 100644 index 414f7ec93a0..00000000000 --- a/include/help_start.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef HELP_START_INCLUDED -#define HELP_START_INCLUDED - -/* Copyright (C) 2004-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/* Divert all help information on NetWare to logger screen. */ - -#ifdef __NETWARE__ -#define printf consoleprintf -#define puts(s) consoleprintf("%s\n",s) -#define fputs(s,f) puts(s) -#define fputc(s,f) consoleprintf("%c", s) -#define putchar(s) consoleprintf("%c", s) -#endif -#endif /* HELP_START_INCLUDED */ diff --git a/include/lf.h b/include/lf.h index 7e8f05f4ada..d1f592d1047 100644 --- a/include/lf.h +++ b/include/lf.h @@ -204,7 +204,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); #define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox) #define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) #define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) -#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0)) +#define lf_alloc_direct_free(ALLOC, ADDR) my_free((ADDR)) lock_wrap(lf_alloc_new, void *, (LF_PINS *pins), diff --git a/include/m_string.h b/include/m_string.h index 1a2a508edfb..c2779c63941 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -36,10 +36,6 @@ /* need by my_vsnprintf */ #include <stdarg.h> -#ifdef _AIX -#undef HAVE_BCMP -#endif - /* This is needed for the definitions of bzero... on solaris */ #if defined(HAVE_STRINGS_H) #include <strings.h> @@ -63,14 +59,10 @@ /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) #endif -#if !defined(HAVE_BCMP) -# define bcopy(s, d, n) memcpy((d), (s), (n)) -# define bcmp(A,B,C) memcmp((A),(B),(C)) -# define bzero(A,B) memset((A),0,(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) +#if !defined(bzero) && !defined(HAVE_BZERO) +# define bzero(A,B) memset((A),0,(B)) #endif #if defined(__cplusplus) @@ -92,8 +84,8 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ #endif /* Declared in int2str() */ -extern char NEAR _dig_vec_upper[]; -extern char NEAR _dig_vec_lower[]; +extern char _dig_vec_upper[]; +extern char _dig_vec_lower[]; #ifndef strmov #define strmov_overlapp(A,B) strmov(A,B) @@ -116,19 +108,6 @@ extern char NEAR _dig_vec_lower[]; extern void bfill(uchar *dst,size_t len,pchar fill); #endif -#if !defined(bzero) && !defined(HAVE_BZERO) -extern void bzero(uchar * dst,size_t len); -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) -extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len); -#endif -#ifdef HAVE_purify -extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len); -#undef bcmp -#define bcmp(A,B,C) my_bcmp((A),(B),(C)) -#endif /* HAVE_purify */ - #ifndef bmove512 extern void bmove512(uchar *dst,const uchar *src,size_t len); #endif @@ -156,15 +135,15 @@ extern char *strmov(char *dst,const char *src); #else extern char *strmov_overlapp(char *dst,const char *src); #endif -extern char *strnmov(char *dst,const char *src,size_t n); -extern char *strsuff(const char *src,const char *suffix); -extern char *strcont(const char *src,const char *set); -extern char *strxcat _VARARGS((char *dst,const char *src, ...)); -extern char *strxmov _VARARGS((char *dst,const char *src, ...)); -extern char *strxcpy _VARARGS((char *dst,const char *src, ...)); -extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...)); +extern char *strnmov(char *dst, const char *src, size_t n); +extern char *strsuff(const char *src, const char *suffix); +extern char *strcont(const char *src, const char *set); +extern char *strxcat(char *dst, const char *src, ...); +extern char *strxmov(char *dst, const char *src, ...); +extern char *strxcpy(char *dst, const char *src, ...); +extern char *strxncat(char *dst, size_t len, const char *src, ...); +extern char *strxnmov(char *dst, size_t len, const char *src, ...); +extern char *strxncpy(char *dst, size_t len, const char *src, ...); /* Prototypes of normal stringfunctions (with may ours) */ diff --git a/include/my_alarm.h b/include/my_alarm.h index dd2d5642f5f..fa396cf02f9 100644 --- a/include/my_alarm.h +++ b/include/my_alarm.h @@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock; #define ALARM_END (void) signal(SIGALRM,alarm_signal); \ (void) alarm(alarm_old); #define ALARM_TEST my_have_got_alarm -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY #define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \ (void) signal(SIGALRM,my_set_alarm_variable);\ my_have_got_alarm=0; #else #define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \ my_have_got_alarm=0; -#endif /* DONT_REMEMBER_SIGNAL */ +#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */ #else #define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 #define ALARM_INIT diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 314dac983b0..0caf2da12d0 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) -/** - check, set and clear a bit of interest of an integer. - - If the bit is out of range @retval -1. Otherwise - bit_is_set @return 0 or 1 reflecting the bit is set or not; - bit_do_set @return 1 (bit is set 1) - bit_do_clear @return 0 (bit is cleared to 0) -*/ - -#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) -#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) |= (ULL(1) << (B)), 1) : -1) -#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) &= ~(ULL(1) << (B)), 0) : -1) - #ifdef __cplusplus } #endif diff --git a/include/my_compiler.h b/include/my_compiler.h new file mode 100644 index 00000000000..1cd46ff4260 --- /dev/null +++ b/include/my_compiler.h @@ -0,0 +1,129 @@ +#ifndef MY_COMPILER_INCLUDED +#define MY_COMPILER_INCLUDED + +/* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + Header for compiler-dependent features. + + Intended to contain a set of reusable wrappers for preprocessor + macros, attributes, pragmas, and any other features that are + specific to a target compiler. +*/ + +#include <my_global.h> /* stddef.h offsetof */ + +/** + Compiler-dependent internal convenience macros. +*/ + +/* GNU C/C++ */ +#if defined __GNUC__ +/* Any after 2.95... */ +# define MY_ALIGN_EXT + +/* Microsoft Visual C++ */ +#elif defined _MSC_VER +# define MY_ALIGNOF(type) __alignof(type) +# define MY_ALIGNED(n) __declspec(align(n)) + +/* Oracle Solaris Studio */ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if __SUNPRO_C >= 0x590 +# define MY_ALIGN_EXT +# endif + +/* IBM XL C/C++ */ +#elif defined __xlC__ +# if __xlC__ >= 0x0600 +# define MY_ALIGN_EXT +# endif + +/* HP aCC */ +#elif defined(__HP_aCC) || defined(__HP_cc) +# if (__HP_aCC >= 60000) || (__HP_cc >= 60000) +# define MY_ALIGN_EXT +# endif +#endif + +#ifdef MY_ALIGN_EXT +/** Specifies the minimum alignment of a type. */ +# define MY_ALIGNOF(type) __alignof__(type) +/** Determine the alignment requirement of a type. */ +# define MY_ALIGNED(n) __attribute__((__aligned__((n)))) +#endif + +/** + Generic compiler-dependent features. +*/ +#ifndef MY_ALIGNOF +# ifdef __cplusplus + template<typename type> struct my_alignof_helper { char m1; type m2; }; + /* Invalid for non-POD types, but most compilers give the right answer. */ +# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2) +# else +# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2) +# endif +#endif + +/** + C++ Type Traits +*/ + +#ifdef __cplusplus + +/** + Opaque storage with a particular alignment. +*/ +# if defined(MY_ALIGNED) +/* Partial specialization used due to MSVC++. */ +template<size_t alignment> struct my_alignment_imp; +template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; +template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; +template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; +template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; +template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; +/* ... expand as necessary. */ +# else +template<size_t alignment> +struct my_alignment_imp { double m1; }; +# endif + +/** + A POD type with a given size and alignment. + + @remark If the compiler does not support a alignment attribute + (MY_ALIGN macro), the default alignment of a double is + used instead. + + @tparam size The minimum size. + @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. +*/ +template <size_t size, size_t alignment> +struct my_aligned_storage +{ + union + { + char data[size]; + my_alignment_imp<alignment> align; + }; +}; + +#endif /* __cplusplus */ + +#include <my_attribute.h> + +#endif /* MY_COMPILER_INCLUDED */ diff --git a/include/my_dbug.h b/include/my_dbug.h index 34681fbc633..19570ac2a67 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -45,7 +45,7 @@ extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_ _VARARGS((const char *format,...)) +extern void _db_doprnt_(const char *format,...) ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword, const unsigned char *memory, size_t length); diff --git a/include/my_global.h b/include/my_global.h index 7b9c34cd724..b0db017c565 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -46,15 +46,6 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ -#if defined(__QNXNTO__) && !defined(FD_SETSIZE) -#define FD_SETSIZE 1024 /* Max number of file descriptor bits in - fd_set, used when calling 'select' - Must be defined before including - "sys/select.h" and "sys/time.h" - */ -#endif - - /* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ #ifdef USE_PRAGMA_IMPLEMENTATION #define USE_PRAGMA_INTERFACE @@ -82,20 +73,7 @@ #define CPP_UNNAMED_NS_END } #endif -#if defined(_WIN32) -#include <my_config.h> -#elif defined(__NETWARE__) -#include <my_config.h> -#include <config-netware.h> -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#else #include <my_config.h> -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#endif /* _WIN32... */ #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #define HAVE_PSI_INTERFACE @@ -108,12 +86,6 @@ #define IF_WIN(A,B) B #endif -#ifdef __NETWARE__ -#define IF_NETWARE(A,B) A -#else -#define IF_NETWARE(A,B) B -#endif - #ifndef DBUG_OFF #define IF_DBUG(A,B) A #else @@ -143,12 +115,6 @@ #define HAVE_EXTERNAL_CLIENT #endif -/* Some defines to avoid ifdefs in the code */ -#ifndef NETWARE_YIELD -#define NETWARE_YIELD -#define NETWARE_SET_SCREEN_MODE(A) -#endif - #if defined (_WIN32) /* off_t is 32 bit long. We do not use C runtime functions @@ -591,22 +557,6 @@ C_MODE_END extern "C" int madvise(void *addr, size_t len, int behav); #endif -#ifdef __QNXNTO__ -/* This has to be after include limits.h */ -#define HAVE_ERRNO_AS_DEFINE -#define HAVE_FCNTL_LOCK -#undef HAVE_FINITE -#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ -#undef LONGLONG_MAX /* standard system library 'limits.h' */ -#ifdef __cplusplus -#ifndef HAVE_RINT -#define HAVE_RINT -#endif /* rint() and isnan() functions are not */ -#define rint(a) std::rint(a) /* visible in C++ scope due to an error */ -#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */ -#endif -#endif - /* We can not live without the following defines */ #define USE_MYFUNC 1 /* Must use syscall indirection */ @@ -627,26 +577,34 @@ extern "C" int madvise(void *addr, size_t len, int behav); #endif /* Does the system remember a signal handler after a signal ? */ -#ifndef HAVE_BSD_SIGNALS -#define DONT_REMEMBER_SIGNAL +#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION) +#define SIGNAL_HANDLER_RESET_ON_DELIVERY #endif -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(var) var=0 /* No uninitialize-warning */ +/* + Deprecated workaround for false-positive uninitialized variables + warnings. Those should be silenced using tool-specific heuristics. + + Enabled by default for g++ due to the bug referenced below. +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + (defined(__GNUC__) && defined(__cplusplus)) +#define LINT_INIT(var) var= 0 #else #define LINT_INIT(var) #endif -/* +/* Suppress uninitialized variable warning without generating code. The _cplusplus is a temporary workaround for C++ code pending a fix - for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ - !defined(__GNUC__) +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + defined(__cplusplus) || !defined(__GNUC__) #define UNINIT_VAR(x) x= 0 #else +/* GCC specific self-initialization which inhibits the warning. */ #define UNINIT_VAR(x) x= x #endif @@ -670,7 +628,6 @@ typedef unsigned short ushort; #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define test_all_bits(a,b) (((a) & (b)) == (b)) -#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) /* Define some general constants */ @@ -691,7 +648,7 @@ typedef unsigned short ushort; #define my_const_cast(A) (A) #endif -#include <my_attribute.h> +#include <my_compiler.h> /* Wen using the embedded library, users might run into link problems, @@ -704,16 +661,6 @@ int __cxa_pure_virtual () __attribute__ ((weak)); C_MODE_END #endif -/* From old s-system.h */ - -/* - Support macros for non ansi & other old compilers. Since such - things are no longer supported we do nothing. We keep then since - some of our code may still be needed to upgrade old customers. -*/ -#define _VARARGS(X) X -#define _STATIC_VARARGS(X) X - /* The DBUG_ON flag always takes precedence over default DBUG_OFF */ #if defined(DBUG_ON) && defined(DBUG_OFF) #undef DBUG_OFF @@ -729,7 +676,6 @@ C_MODE_END #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ #define ASCII_BITS_USED 8 /* Bit char used */ -#define NEAR_F /* No near function handling */ /* Some types that is different between systems */ @@ -889,11 +835,8 @@ typedef SOCKET_SIZE_TYPE size_socket; How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ -#ifdef SAFEMALLOC -#define MALLOC_OVERHEAD (8+24+4) -#else #define MALLOC_OVERHEAD 8 -#endif + /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) /* Typical record cash */ @@ -1076,20 +1019,6 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) -#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] - -#ifdef __cplusplus -template <size_t sz> struct Aligned_char_array -{ - union { - void *v; // Ensures alignment. - char arr[sz]; // The actual buffer. - } u; - void* arr() { return &u.arr[0]; } -}; -#endif /* __cplusplus */ - /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current @@ -1106,14 +1035,6 @@ template <size_t sz> struct Aligned_char_array ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) #define NullS (char *) 0 -/* Nowdays we do not support MessyDos */ -#ifndef NEAR -#define NEAR /* Who needs segments ? */ -#define FAR /* On a good machine */ -#ifndef HUGE_PTR -#define HUGE_PTR -#endif -#endif #ifdef STDCALL #undef STDCALL @@ -1625,17 +1546,6 @@ do { doubleget_union _tmp; \ #endif /* WORDS_BIGENDIAN */ -/* sprintf does not always return the number of bytes :- */ -#ifdef SPRINTF_RETURNS_INT -#define my_sprintf(buff,args) sprintf args -#else -#ifdef SPRINTF_RETURNS_PTR -#define my_sprintf(buff,args) ((int)(sprintf args - buff)) -#else -#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) -#endif -#endif - #ifndef THREAD #define thread_safe_increment(V,L) (V)++ #define thread_safe_decrement(V,L) (V)-- @@ -1680,25 +1590,12 @@ do { doubleget_union _tmp; \ #endif -#ifndef __NETWARE__ /* * Include standard definitions of operator new and delete. */ #ifdef __cplusplus #include <new> #endif -#else -/* - * Define placement versions of operator new and operator delete since - * we don't have <new> when building for Netware. - */ -#ifdef __cplusplus -inline void *operator new(size_t, void *ptr) { return ptr; } -inline void *operator new[](size_t, void *ptr) { return ptr; } -inline void operator delete(void*, void*) { /* Do nothing */ } -inline void operator delete[](void*, void*) { /* Do nothing */ } -#endif -#endif /* Length of decimal number represented by INT32. */ #define MY_INT32_NUM_DECIMAL_DIGITS 11 @@ -1712,11 +1609,6 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } #define min(a, b) ((a) < (b) ? (a) : (b)) #endif -#define x_free(A) \ - do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0) -#define safeFree(X) \ - do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0) - /* Only Linux is known to need an explicit sync of the directory to make sure a file creation/deletion/renaming in(from,to) this directory durable. diff --git a/include/my_list.h b/include/my_list.h index 775b56587b8..ff086e1725b 100644 --- a/include/my_list.h +++ b/include/my_list.h @@ -37,7 +37,7 @@ extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); #define list_rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) -#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); } +#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } #ifdef __cplusplus } diff --git a/include/my_net.h b/include/my_net.h index 8617f180431..1b8425984ae 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -46,7 +46,7 @@ C_MODE_START #include <sys/ioctl.h> #endif -#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) #include <netinet/in_systm.h> #include <netinet/in.h> #include <netinet/ip.h> diff --git a/include/my_nosys.h b/include/my_nosys.h index df5639b81e2..ecb60333830 100644 --- a/include/my_nosys.h +++ b/include/my_nosys.h @@ -39,7 +39,7 @@ extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count, myf myFlags); extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count); -#if !defined(SAFEMALLOC) && defined(USE_HALLOC) +#if defined(USE_HALLOC) #define my_malloc(a,b) halloc(a,1) #define my_no_flags_free(a) hfree(a) #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index ea37f6e6b92..e5ffa0db3bb 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -195,11 +195,6 @@ int pthread_cancel(pthread_t thread); #include <synch.h> #endif -#ifdef __NETWARE__ -void my_pthread_exit(void *status); -#define pthread_exit(A) my_pthread_exit(A) -#endif - #define pthread_key(T,V) pthread_key_t V #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) @@ -356,7 +351,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } -#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ +#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ #define HAVE_PTHREAD_KILL #endif @@ -461,10 +456,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); /* safe_mutex adds checking to mutex for easier debugging */ -#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) -#define SAFE_MUTEX_DETECT_DESTROY -#endif - typedef struct st_safe_mutex_t { pthread_mutex_t global,mutex; diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 9250fd4579e..78e3dbca577 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -32,9 +32,7 @@ #define HAVE_STACKTRACE 1 #endif -#if !defined(__NETWARE__) #define HAVE_WRITE_CORE -#endif #if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \ HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \ diff --git a/include/my_sys.h b/include/my_sys.h index 29c78289a1b..c5702ec7395 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -42,7 +42,7 @@ typedef struct my_aio_result { #endif /* HAVE_VALGRIND */ #ifndef THREAD -extern int NEAR my_errno; /* Last error in mysys */ +extern int my_errno; /* Last error in mysys */ #else #include <my_pthread.h> #endif @@ -158,46 +158,15 @@ extern int NEAR my_errno; /* Last error in mysys */ #define GETDATE_FIXEDLENGTH 16 /* defines when allocating data */ -#ifdef SAFEMALLOC -#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) -#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG ) -#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG ) -#define my_checkmalloc() _sanity( __FILE__, __LINE__ ) -#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) -#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) -#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) -#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C) -#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0) -#define QUICK_SAFEMALLOC sf_malloc_quick=1 -#define NORMAL_SAFEMALLOC sf_malloc_quick=0 -extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; -extern ulonglong sf_malloc_mem_limit; - -#define CALLER_INFO_PROTO , const char *sFile, uint uLine -#define CALLER_INFO , __FILE__, __LINE__ -#define ORIG_CALLER_INFO , sFile, uLine -#else -#define my_checkmalloc() -#undef TERMINATE -#define TERMINATE(A,B) {} -#define QUICK_SAFEMALLOC -#define NORMAL_SAFEMALLOC extern void *my_malloc(size_t Size,myf MyFlags); -#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) +extern void *my_multi_malloc(myf MyFlags, ...); extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags); -extern void my_no_flags_free(void *ptr); +extern void my_free(void *ptr); extern void *my_memdup(const void *from,size_t length,myf MyFlags); extern char *my_strdup(const char *from,myf MyFlags); extern char *my_strndup(const char *from, size_t length, myf MyFlags); -/* we do use FG (as a no-op) in below so that a typo on FG is caught */ -#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR)) -#define CALLER_INFO_PROTO /* nothing */ -#define CALLER_INFO /* nothing */ -#define ORIG_CALLER_INFO /* nothing */ #define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0) -#endif - #if defined(ENABLED_DEBUG_SYNC) extern void (*debug_sync_C_callback_ptr)(const char *, size_t); #define DEBUG_SYNC_C(_sync_point_name_) do { \ @@ -211,11 +180,11 @@ extern void (*debug_sync_C_callback_ptr)(const char *, size_t); #ifdef HAVE_LARGE_PAGES extern uint my_get_large_page_size(void); extern uchar * my_large_malloc(size_t size, myf my_flags); -extern void my_large_free(uchar * ptr, myf my_flags); +extern void my_large_free(uchar *ptr); #else #define my_get_large_page_size() (0) #define my_large_malloc(A,B) my_malloc_lock((A),(B)) -#define my_large_free(A,B) my_free_lock((A),(B)) +#define my_large_free(A) my_free_lock((A)) #endif /* HAVE_LARGE_PAGES */ #ifdef HAVE_ALLOCA @@ -233,7 +202,7 @@ extern void my_large_free(uchar * ptr, myf my_flags); #define my_afree(PTR) {} #else #define my_alloca(SZ) my_malloc(SZ,MYF(0)) -#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) +#define my_afree(PTR) my_free(PTR) #endif /* HAVE_ALLOCA */ #ifndef errno /* did we already get it? */ @@ -245,7 +214,7 @@ extern int errno; /* declare errno */ #endif /* #ifndef errno */ extern char *home_dir; /* Home directory for user */ extern const char *my_progname; /* program-name (printed in errors) */ -extern char NEAR curr_dir[]; /* Current directory for user */ +extern char curr_dir[]; /* Current directory for user */ extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern void (*fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags); @@ -278,17 +247,16 @@ extern void (*my_sigtstp_cleanup)(void), (*my_sigtstp_restart)(void), (*my_abort_hook)(int); /* Executed when comming from shell */ -extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */ -extern int NEAR my_umask_dir, - NEAR my_recived_signals, /* Signals we have got */ - NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ - NEAR my_dont_interrupt; /* call remember_intr when set */ -extern my_bool NEAR my_use_symdir; -extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; +extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ +extern int my_umask_dir, + my_recived_signals, /* Signals we have got */ + my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ + my_dont_interrupt; /* call remember_intr when set */ +extern my_bool my_use_symdir; extern ulong my_default_record_cache_size; -extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, - NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern my_bool my_disable_locking, my_disable_async_io, + my_disable_flush_key_blocks, my_disable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; /* from default.c */ @@ -642,20 +610,6 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, myf MyFlags); extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); -extern void *_mymalloc(size_t uSize,const char *sFile, - uint uLine, myf MyFlag); -extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile, - uint uLine, myf MyFlag); -extern void * my_multi_malloc _VARARGS((myf MyFlags, ...)); -extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag); -extern int _sanity(const char *sFile, uint uLine); -extern void *_my_memdup(const void *from, size_t length, - const char *sFile, uint uLine,myf MyFlag); -extern char * _my_strdup(const char *from, const char *sFile, uint uLine, - myf MyFlag); -extern char *_my_strndup(const char *from, size_t length, - const char *sFile, uint uLine, - myf MyFlag); /* implemented in my_memmem.c */ extern void *my_memmem(const void *haystack, size_t haystacklen, @@ -684,9 +638,6 @@ extern HANDLE my_get_osfhandle(File fd); extern void my_osmaperr(unsigned long last_error); #endif -#ifndef TERMINATE -extern void TERMINATE(FILE *file, uint flag); -#endif extern void init_glob_errs(void); extern const char** get_global_errmsgs(); extern void wait_for_free_space(const char *filename, int errors); @@ -698,10 +649,10 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_sync(File fd, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags); -extern void my_error _VARARGS((int nr,myf MyFlags, ...)); -extern void my_printf_error _VARARGS((uint my_err, const char *format, - myf MyFlags, ...)) - ATTRIBUTE_FORMAT(printf, 2, 4); +extern void my_error(int nr,myf MyFlags, ...); +extern void my_printf_error(uint my_err, const char *format, + myf MyFlags, ...) + ATTRIBUTE_FORMAT(printf, 2, 4); extern void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap); extern int my_error_register(const char** (*get_errmsgs) (), @@ -835,18 +786,16 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO) -#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO) -#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO) -#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO) -extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size, - void *init_buffer, uint init_alloc, - uint alloc_increment - CALLER_INFO_PROTO); +#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) +#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) +#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) +#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) +extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, + void *init_buffer, uint init_alloc, + uint alloc_increment); /* init_dynamic_array() function is deprecated */ -extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, - uint init_alloc,uint alloc_increment - CALLER_INFO_PROTO); +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, + uint init_alloc, uint alloc_increment); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element); extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); extern uchar *pop_dynamic(DYNAMIC_ARRAY*); @@ -876,10 +825,10 @@ extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); #ifdef HAVE_MLOCK extern void *my_malloc_lock(size_t length,myf flags); -extern void my_free_lock(void *ptr,myf flags); +extern void my_free_lock(void *ptr); #else #define my_malloc_lock(A,B) my_malloc((A),(B)) -#define my_free_lock(A,B) my_free((A),(B)) +#define my_free_lock(A) my_free((A)) #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) @@ -963,10 +912,7 @@ extern int my_getncpus(); #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 -#ifndef __NETWARE__ #define HAVE_MMAP -#endif - void *my_mmap(void *, size_t, int, int, int, my_off_t); int my_munmap(void *, size_t); #endif @@ -1031,10 +977,6 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa); char* my_cgets(char *string, size_t clen, size_t* plen); #endif -#ifdef __NETWARE__ -void netware_reg_user(const char *ip, const char *user, - const char *application); -#endif #include <mysql/psi/psi.h> diff --git a/include/my_time.h b/include/my_time.h index 829cb706bb6..fdfe130c45f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -35,8 +35,6 @@ extern uchar days_in_month[]; Using the system built in time_t is not an option as we rely on the above requirements in the time functions - - For example QNX has an unsigned time_t type */ typedef long my_time_t; diff --git a/include/myisam.h b/include/myisam.h index d590a29c1b3..7547f6b475e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -55,8 +55,6 @@ extern "C" { #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ #define MI_NAME_IEXT ".MYI" #define MI_NAME_DEXT ".MYD" -/* Max extra space to use when sorting keys */ -#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L /* Possible values for myisam_block_size (must be power of 2) */ #define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ diff --git a/include/mysql.h b/include/mysql.h index 452b4374cf7..7eef91cf55a 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -79,10 +79,6 @@ extern char *mysql_unix_port; #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ #define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ -#ifdef __NETWARE__ -#pragma pack(push, 8) /* 8 byte alignment */ -#endif - #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) @@ -746,10 +742,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, 1, stmt) -#ifdef __NETWARE__ -#pragma pack(pop) /* restore alignment */ -#endif - #ifdef __cplusplus } #endif diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 4fef9e9ec0b..bc5d611ec84 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -233,10 +233,10 @@ extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; -my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, +my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, my_ulonglong cur_set, my_ulonglong default_set, - const char *str, uint length, - char **err_pos, uint *err_len); + const char *str, unsigned int length, + char **err_pos, unsigned int *err_len); typedef struct st_mysql_rows { struct st_mysql_rows *next; MYSQL_ROW data; diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 0a998aaa76c..de145f642e1 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + 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 @@ -506,9 +506,10 @@ inline_mysql_file_fgets( 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(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); @@ -532,9 +533,10 @@ inline_mysql_file_fgetc( 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(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); @@ -558,10 +560,11 @@ inline_mysql_file_fputs( 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(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { @@ -588,9 +591,10 @@ inline_mysql_file_fputc( 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(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); @@ -614,9 +618,10 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) 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(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__); @@ -642,9 +647,10 @@ inline_mysql_file_vfprintf( 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(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); @@ -668,9 +674,10 @@ inline_mysql_file_fflush( 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(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); @@ -700,9 +707,10 @@ inline_mysql_file_fstat( 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(filenr, + 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); @@ -726,9 +734,11 @@ inline_mysql_file_stat( 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(key, PSI_FILE_STAT, + 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); @@ -752,9 +762,10 @@ inline_mysql_file_chsize( 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(file, + 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, @@ -784,10 +795,11 @@ inline_mysql_file_fopen( { #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 - (key, PSI_FILE_STREAM_OPEN, filename, that); + (&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); @@ -800,7 +812,7 @@ inline_mysql_file_fopen( #endif if (unlikely(that->m_file == NULL)) { - my_free(that, MYF(0)); + my_free(that); return NULL; } } @@ -820,10 +832,11 @@ inline_mysql_file_fclose( { #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(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); @@ -834,7 +847,7 @@ inline_mysql_file_fclose( if (likely(locker != NULL)) PSI_server->end_file_wait(locker, (size_t) 0); #endif - my_free(file, MYF(0)); + my_free(file); } return result; } @@ -849,9 +862,10 @@ inline_mysql_file_fread( 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(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); @@ -882,9 +896,10 @@ inline_mysql_file_fwrite( 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(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); @@ -915,9 +930,10 @@ inline_mysql_file_fseek( 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(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); @@ -941,9 +957,10 @@ inline_mysql_file_ftell( 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(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); @@ -967,9 +984,10 @@ inline_mysql_file_create( 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(key, PSI_FILE_CREATE, + 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); @@ -1014,9 +1032,10 @@ inline_mysql_file_open( 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(key, PSI_FILE_OPEN, + 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); @@ -1040,9 +1059,10 @@ inline_mysql_file_close( 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(file, + 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); @@ -1066,9 +1086,10 @@ inline_mysql_file_read( 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(file, + 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); @@ -1099,9 +1120,10 @@ inline_mysql_file_write( 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(file, + 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); @@ -1132,9 +1154,10 @@ inline_mysql_file_pread( 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(file, PSI_FILE_READ); + 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); } @@ -1164,9 +1187,10 @@ inline_mysql_file_pwrite( 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(file, + 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); @@ -1197,9 +1221,10 @@ inline_mysql_file_seek( 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(file, PSI_FILE_SEEK); + 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); } @@ -1222,9 +1247,10 @@ inline_mysql_file_tell( 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(file, PSI_FILE_TELL); + 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); } @@ -1247,9 +1273,10 @@ inline_mysql_file_delete( 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(key, PSI_FILE_DELETE, + 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); @@ -1273,9 +1300,10 @@ inline_mysql_file_rename( 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(key, PSI_FILE_RENAME, + 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); @@ -1300,9 +1328,10 @@ inline_mysql_file_create_with_symlink( 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(key, PSI_FILE_CREATE, + 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); @@ -1327,9 +1356,10 @@ inline_mysql_file_delete_with_symlink( 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(key, PSI_FILE_DELETE, + 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); @@ -1353,9 +1383,10 @@ inline_mysql_file_rename_with_symlink( 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(key, PSI_FILE_RENAME, + 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); @@ -1379,9 +1410,10 @@ inline_mysql_file_sync( 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(fd, PSI_FILE_SYNC); + 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); } diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 4e839c7cf6a..d133f2655fb 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + 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 @@ -625,9 +625,10 @@ static inline int inline_mysql_mutex_lock( 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(that->m_psi, PSI_MUTEX_LOCK); + 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); } @@ -654,9 +655,10 @@ static inline int inline_mysql_mutex_trylock( 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(that->m_psi, PSI_MUTEX_TRYLOCK); + 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); } @@ -682,13 +684,8 @@ static inline int inline_mysql_mutex_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_mutex(thread, 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); @@ -771,9 +768,10 @@ static inline int inline_mysql_rwlock_rdlock( 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(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); @@ -798,9 +796,10 @@ static inline int inline_mysql_prlock_rdlock( 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(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); @@ -825,9 +824,10 @@ static inline int inline_mysql_rwlock_wrlock( 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(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); @@ -852,9 +852,10 @@ static inline int inline_mysql_prlock_wrlock( 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(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); @@ -879,9 +880,10 @@ static inline int inline_mysql_rwlock_tryrdlock( 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(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); @@ -906,9 +908,10 @@ static inline int inline_mysql_prlock_tryrdlock( 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(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); @@ -933,9 +936,10 @@ static inline int inline_mysql_rwlock_trywrlock( 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(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); @@ -960,9 +964,10 @@ static inline int inline_mysql_prlock_trywrlock( 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(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); @@ -982,13 +987,8 @@ static inline int inline_mysql_rwlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_unlock(&that->m_rwlock); return result; @@ -1000,13 +1000,8 @@ static inline int inline_mysql_prlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_pr_unlock(&that->m_prlock); return result; @@ -1053,9 +1048,10 @@ static inline int inline_mysql_cond_wait( 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(that->m_psi, mutex->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); @@ -1081,9 +1077,10 @@ static inline int inline_mysql_cond_timedwait( 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(that->m_psi, mutex->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); @@ -1102,13 +1099,8 @@ static inline int inline_mysql_cond_signal( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->signal_cond(thread, that->m_psi); - } + PSI_server->signal_cond(that->m_psi); #endif result= pthread_cond_signal(&that->m_cond); return result; @@ -1119,13 +1111,8 @@ static inline int inline_mysql_cond_broadcast( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->broadcast_cond(thread, that->m_psi); - } + PSI_server->broadcast_cond(that->m_psi); #endif result= pthread_cond_broadcast(&that->m_cond); return result; diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 51446fa83a5..562e4a80fd5 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2010 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + 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 @@ -422,6 +422,175 @@ struct PSI_file_info_v1 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. */ /** @@ -619,40 +788,51 @@ 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 *mutex, enum PSI_mutex_operation op); + (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 *rwlock, enum PSI_rwlock_operation op); + (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 *cond, struct PSI_mutex *mutex, + (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 *table); + (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 @@ -660,58 +840,59 @@ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (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 *file, enum PSI_file_operation op); + (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) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); /** Record a mutex instrumentation unlock event. - @param thread the running thread instrumentation @param mutex the mutex instrumentation */ typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); /** Record a rwlock instrumentation unlock event. - @param thread the running thread instrumentation @param rwlock the rwlock instrumentation */ typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); /** Record a condition instrumentation signal event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a condition instrumentation broadcast event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a mutex instrumentation wait start event. @@ -1013,6 +1194,36 @@ struct PSI_file_info_v2 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 */ @@ -1056,6 +1267,11 @@ 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 @@ -1065,6 +1281,11 @@ 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 */ diff --git a/include/mysql/psi/psi_abi_v1.h b/include/mysql/psi/psi_abi_v1.h index c9dfd031668..0f62291696f 100644 --- a/include/mysql/psi/psi_abi_v1.h +++ b/include/mysql/psi/psi_abi_v1.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + 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 diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index 6ecd0f3098d..adb3010469b 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -88,6 +88,71 @@ struct PSI_file_info_v1 const char *m_name; int m_flags; }; +struct PSI_mutex_locker_state_v1 +{ + uint m_flags; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_mutex_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_rwlock_locker_state_v1 +{ + uint m_flags; + struct PSI_rwlock *m_rwlock; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_rwlock_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_cond_locker_state_v1 +{ + uint m_flags; + struct PSI_cond *m_cond; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_cond_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_file_locker_state_v1 +{ + uint m_flags; + struct PSI_file *m_file; + struct PSI_thread *m_thread; + size_t m_number_of_bytes; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_file_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_table_locker_state_v1 +{ + uint m_flags; + struct PSI_table *m_table; + struct PSI_table_share *m_table_share; + void *m_class; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + uint m_index; + uint m_lock_index; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; typedef void (*register_mutex_v1_t) (const char *category, struct PSI_mutex_info_v1 *info, int count); typedef void (*register_rwlock_v1_t) @@ -129,29 +194,38 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); typedef void (*delete_current_thread_v1_t)(void); typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex *mutex, enum PSI_mutex_operation op); + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op); typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op); typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond *cond, struct PSI_mutex *mutex, + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op); typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table *table); + (struct PSI_table_locker_state_v1 *state, + struct PSI_table *table); typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file *file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*start_mutex_wait_v1_t) (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); typedef void (*end_mutex_wait_v1_t) @@ -240,5 +314,10 @@ 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; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/include/mysql/psi/psi_abi_v2.h b/include/mysql/psi/psi_abi_v2.h index e720c4c2b7c..08bca609b41 100644 --- a/include/mysql/psi/psi_abi_v2.h +++ b/include/mysql/psi/psi_abi_v2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + 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 diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp index b32415a59b4..63f8c52c50a 100644 --- a/include/mysql/psi/psi_abi_v2.h.pp +++ b/include/mysql/psi/psi_abi_v2.h.pp @@ -82,11 +82,36 @@ struct PSI_file_info_v2 { int placeholder; }; +struct PSI_mutex_locker_state_v2 +{ + int placeholder; +}; +struct PSI_rwlock_locker_state_v2 +{ + int placeholder; +}; +struct PSI_cond_locker_state_v2 +{ + int placeholder; +}; +struct PSI_file_locker_state_v2 +{ + int placeholder; +}; +struct PSI_table_locker_state_v2 +{ + int placeholder; +}; 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; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/include/mysys_err.h b/include/mysys_err.h index 6c18055b31b..9629dfec014 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -15,17 +15,15 @@ #ifndef _mysys_err_h #define _mysys_err_h -#ifdef __cplusplus - -#include "my_global.h" /* NEAR */ +#ifdef __cplusplus extern "C" { #endif #define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ #define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) -extern const char * NEAR globerrs[]; /* my_error_messages is here */ +extern const char *globerrs[]; /* my_error_messages is here */ /* Error message numbers in global map */ /* diff --git a/include/typelib.h b/include/typelib.h index c6a7f7a42e9..3badb14c96e 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -36,9 +36,9 @@ extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; -my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, +my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, my_ulonglong cur_set, my_ulonglong default_set, - const char *str, uint length, - char **err_pos, uint *err_len); + const char *str, unsigned int length, + char **err_pos, unsigned int *err_len); #endif /* _typelib_h */ |