| my_global.h | | my_global.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #undef WIN | | #undef WIN | |
| #undef WIN32 | | #undef WIN32 | |
| #undef _WIN | | #undef _WIN | |
| #undef _WIN32 | | #undef _WIN32 | |
| #undef _WIN64 | | #undef _WIN64 | |
| #undef __WIN__ | | #undef __WIN__ | |
| #undef __WIN32__ | | #undef __WIN32__ | |
| #define HAVE_ERRNO_AS_DEFINE | | #define HAVE_ERRNO_AS_DEFINE | |
| #endif /* __CYGWIN__ */ | | #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 */ | | /* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ | |
| #ifdef USE_PRAGMA_IMPLEMENTATION | | #ifdef USE_PRAGMA_IMPLEMENTATION | |
| #define USE_PRAGMA_INTERFACE | | #define USE_PRAGMA_INTERFACE | |
| #endif | | #endif | |
| | | | |
| #if defined(__OpenBSD__) && (OpenBSD >= 200411) | | #if defined(__OpenBSD__) && (OpenBSD >= 200411) | |
| #define HAVE_ERRNO_AS_DEFINE | | #define HAVE_ERRNO_AS_DEFINE | |
| #endif | | #endif | |
| | | | |
| #if defined(i386) && !defined(__i386__) | | #if defined(i386) && !defined(__i386__) | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 76 | |
| #else | | #else | |
| #define C_MODE_START | | #define C_MODE_START | |
| #define C_MODE_END | | #define C_MODE_END | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| #define CPP_UNNAMED_NS_START namespace { | | #define CPP_UNNAMED_NS_START namespace { | |
| #define CPP_UNNAMED_NS_END } | | #define CPP_UNNAMED_NS_END } | |
| #endif | | #endif | |
| | | | |
|
| #if defined(_WIN32) | | | |
| #include <my_config.h> | | | |
| #elif defined(__NETWARE__) | | | |
| #include <my_config.h> | | #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 | | #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE | |
| #define HAVE_PSI_INTERFACE | | #define HAVE_PSI_INTERFACE | |
| #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ | | #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ | |
| | | | |
| /* Make it easier to add conditional code in _expressions_ */ | | /* Make it easier to add conditional code in _expressions_ */ | |
| #ifdef __WIN__ | | #ifdef __WIN__ | |
| #define IF_WIN(A,B) A | | #define IF_WIN(A,B) A | |
| #else | | #else | |
| #define IF_WIN(A,B) B | | #define IF_WIN(A,B) B | |
| #endif | | #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 | | | |
| #define IF_DBUG(A,B) B | | | |
| #endif | | | |
| | | | |
| #ifdef HAVE_purify | | #ifdef HAVE_purify | |
| #define IF_PURIFY(A,B) A | | #define IF_PURIFY(A,B) A | |
| #else | | #else | |
| #define IF_PURIFY(A,B) B | | #define IF_PURIFY(A,B) B | |
| #endif | | #endif | |
| | | | |
|
| #ifdef DISABLE_GRANT_OPTIONS | | | |
| #define IF_DISABLE_GRANT_OPTIONS(A,B) A | | | |
| #else | | | |
| #define IF_DISABLE_GRANT_OPTIONS(A,B) B | | | |
| #endif | | | |
| | | | |
| #ifndef EMBEDDED_LIBRARY | | #ifndef EMBEDDED_LIBRARY | |
| #ifdef WITH_NDB_BINLOG | | #ifdef WITH_NDB_BINLOG | |
| #define HAVE_NDB_BINLOG 1 | | #define HAVE_NDB_BINLOG 1 | |
| #endif | | #endif | |
| #endif /* !EMBEDDED_LIBRARY */ | | #endif /* !EMBEDDED_LIBRARY */ | |
| | | | |
| #ifndef EMBEDDED_LIBRARY | | #ifndef EMBEDDED_LIBRARY | |
| #define HAVE_REPLICATION | | #define HAVE_REPLICATION | |
| #define HAVE_EXTERNAL_CLIENT | | #define HAVE_EXTERNAL_CLIENT | |
| #endif | | #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) | | #if defined (_WIN32) | |
| /* | | /* | |
| off_t is 32 bit long. We do not use C runtime functions | | off_t is 32 bit long. We do not use C runtime functions | |
| with off_t but native Win32 file IO APIs, that work with | | with off_t but native Win32 file IO APIs, that work with | |
| 64 bit offsets. | | 64 bit offsets. | |
| */ | | */ | |
| #undef SIZEOF_OFF_T | | #undef SIZEOF_OFF_T | |
| #define SIZEOF_OFF_T 8 | | #define SIZEOF_OFF_T 8 | |
| | | | |
| /* | | /* | |
| | | | |
| skipping to change at line 244 | | skipping to change at line 199 | |
| other reason to use them is for documentation | | other reason to use them is for documentation | |
| */ | | */ | |
| | | | |
| #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) | | #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) | |
| #define __builtin_expect(x, expected_value) (x) | | #define __builtin_expect(x, expected_value) (x) | |
| #endif | | #endif | |
| | | | |
| #define likely(x) __builtin_expect((x),1) | | #define likely(x) __builtin_expect((x),1) | |
| #define unlikely(x) __builtin_expect((x),0) | | #define unlikely(x) __builtin_expect((x),0) | |
| | | | |
|
| /* | | | |
| The macros below are useful in optimising places where it has been | | | |
| discovered that cache misses stall the process and where a prefetch | | | |
| of the cache line can improve matters. This is available in GCC 3.1.1 | | | |
| and later versions. | | | |
| PREFETCH_READ says that addr is going to be used for reading and that | | | |
| it is to be kept in caches if possible for a while | | | |
| PREFETCH_WRITE also says that the item to be cached is likely to be | | | |
| updated. | | | |
| The *LOCALITY scripts are also available for experimentation purposes | | | |
| mostly and should only be used if they are verified to improve matters. | | | |
| For more input see GCC manual (available in GCC 3.1.1 and later) | | | |
| */ | | | |
| | | | |
| #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) | | | |
| #define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3) | | | |
| #define PREFETCH_WRITE(addr) \ | | | |
| __builtin_prefetch(addr, 1, 3) | | | |
| #define PREFETCH_READ_LOCALITY(addr, locality) \ | | | |
| __builtin_prefetch(addr, 0, locality) | | | |
| #define PREFETCH_WRITE_LOCALITY(addr, locality) \ | | | |
| __builtin_prefetch(addr, 1, locality) | | | |
| #else | | | |
| #define PREFETCH_READ(addr) | | | |
| #define PREFETCH_READ_LOCALITY(addr, locality) | | | |
| #define PREFETCH_WRITE(addr) | | | |
| #define PREFETCH_WRITE_LOCALITY(addr, locality) | | | |
| #endif | | | |
| | | | |
| /* | | | |
| The following macro is used to ensure that code often used in most | | | |
| SQL statements and definitely for parts of the SQL processing are | | | |
| kept in a code segment by itself. This has the advantage that the | | | |
| risk of common code being overlapping in caches of the CPU is less. | | | |
| This can be a cause of big performance problems. | | | |
| Routines should be put in this category with care and when they are | | | |
| put there one should also strive to make as much of the error handling | | | |
| as possible (or uncommon code of the routine) to execute in a | | | |
| separate method to avoid moving to much code to this code segment. | | | |
| | | | |
| It is very easy to use, simply add HOT_METHOD at the end of the | | | |
| function declaration. | | | |
| For more input see GCC manual (available in GCC 2.95 and later) | | | |
| */ | | | |
| | | | |
| #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) | | | |
| #define HOT_METHOD \ | | | |
| __attribute__ ((section ("hot_code_section"))) | | | |
| #else | | | |
| #define HOT_METHOD | | | |
| #endif | | | |
| | | | |
| /* | | | |
| The following macro is used to ensure that popular global variables | | | |
| are located next to each other to avoid that they contend for the | | | |
| same cache lines. | | | |
| | | | |
| It is very easy to use, simply add HOT_DATA at the end of the declaration | | | |
| of the variable, the variable must be initialised because of the way | | | |
| that linker works so a declaration using HOT_DATA should look like: | | | |
| uint global_hot_data HOT_DATA = 0; | | | |
| For more input see GCC manual (available in GCC 2.95 and later) | | | |
| */ | | | |
| | | | |
| #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) | | | |
| #define HOT_DATA \ | | | |
| __attribute__ ((section ("hot_data_section"))) | | | |
| #else | | | |
| #define HOT_DATA | | | |
| #endif | | | |
| | | | |
| /* | | | |
| now let's figure out if inline functions are supported | | | |
| autoconf defines 'inline' to be empty, if not | | | |
| */ | | | |
| #define inline_test_1(X) X ## 1 | | | |
| #define inline_test_2(X) inline_test_1(X) | | | |
| #if inline_test_2(inline) != 1 | | | |
| #define HAVE_INLINE | | | |
| #else | | | |
| #warning No "inline" support in C, all "static inline" functions will be in | | | |
| stantiated in every .o file!!! | | | |
| #endif | | | |
| #undef inline_test_2 | | | |
| #undef inline_test_1 | | | |
| /* helper macro for "instantiating" inline functions */ | | | |
| #define STATIC_INLINE static inline | | | |
| | | | |
| /* | | | |
| The following macros are used to control inlining a bit more than | | | |
| usual. These macros are used to ensure that inlining always or | | | |
| never occurs (independent of compilation mode). | | | |
| For more input see GCC manual (available in GCC 3.1.1 and later) | | | |
| */ | | | |
| | | | |
| #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) | | | |
| #define ALWAYS_INLINE __attribute__ ((always_inline)) | | | |
| #define NEVER_INLINE __attribute__ ((noinline)) | | | |
| #else | | | |
| #define ALWAYS_INLINE | | | |
| #define NEVER_INLINE | | | |
| #endif | | | |
| | | | |
| /* Fix problem with S_ISLNK() on Linux */ | | /* Fix problem with S_ISLNK() on Linux */ | |
| #if defined(TARGET_OS_LINUX) || defined(__GLIBC__) | | #if defined(TARGET_OS_LINUX) || defined(__GLIBC__) | |
| #undef _GNU_SOURCE | | #undef _GNU_SOURCE | |
| #define _GNU_SOURCE 1 | | #define _GNU_SOURCE 1 | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| Temporary solution to solve bug#7156. Include "sys/types.h" before | | Temporary solution to solve bug#7156. Include "sys/types.h" before | |
| the thread headers, else the function madvise() will not be defined | | the thread headers, else the function madvise() will not be defined | |
| */ | | */ | |
| | | | |
| skipping to change at line 455 | | skipping to change at line 308 | |
| #undef HAVE_SNPRINTF | | #undef HAVE_SNPRINTF | |
| #endif | | #endif | |
| #ifdef HAVE_BROKEN_PREAD | | #ifdef HAVE_BROKEN_PREAD | |
| /* | | /* | |
| pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without | | pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without | |
| installing the kernel patch PHKL_20349 or greater | | installing the kernel patch PHKL_20349 or greater | |
| */ | | */ | |
| #undef HAVE_PREAD | | #undef HAVE_PREAD | |
| #undef HAVE_PWRITE | | #undef HAVE_PWRITE | |
| #endif | | #endif | |
|
| #if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus) | | | |
| #undef inline | | | |
| #define inline | | | |
| #endif | | | |
| | | | |
| #ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ | | #ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ | |
| #undef HAVE_GETHOSTBYNAME_R | | #undef HAVE_GETHOSTBYNAME_R | |
| #endif | | #endif | |
| #ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ | | #ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ | |
| #undef HAVE_INITGROUPS | | #undef HAVE_INITGROUPS | |
| #endif | | #endif | |
| | | | |
| /* gcc/egcs issues */ | | /* gcc/egcs issues */ | |
| | | | |
| #if defined(__GNUC) && defined(__EXCEPTIONS) | | #if defined(__GNUC) && defined(__EXCEPTIONS) | |
| #error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" | | #error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" | |
| #endif | | #endif | |
| | | | |
|
| /* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ | | | |
| #if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_M | | | |
| INOR__ == 8) | | | |
| #undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ | | | |
| #define __LONG_MAX__ 2147483647 | | | |
| #endif | | | |
| | | | |
| /* egcs 1.1.2 has a problem with memcpy on Alpha */ | | | |
| #if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ | | | |
| == 2 && __GNUC_MINOR__ >= 95)) | | | |
| #define BAD_MEMCPY | | | |
| #endif | | | |
| | | | |
| #if defined(_lint) && !defined(lint) | | #if defined(_lint) && !defined(lint) | |
| #define lint | | #define lint | |
| #endif | | #endif | |
| #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) | | #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) | |
| #define _LONG_LONG 1 /* For AIX string library */ | | #define _LONG_LONG 1 /* For AIX string library */ | |
| #endif | | #endif | |
| | | | |
| #ifndef stdin | | #ifndef stdin | |
| #include <stdio.h> | | #include <stdio.h> | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 588 | | skipping to change at line 426 | |
| #if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) | | #if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) | |
| /* Fix bug in setrlimit */ | | /* Fix bug in setrlimit */ | |
| #undef setrlimit | | #undef setrlimit | |
| #define setrlimit cma_setrlimit64 | | #define setrlimit cma_setrlimit64 | |
| #endif | | #endif | |
| /* Declare madvise where it is not declared for C++, like Solaris */ | | /* Declare madvise where it is not declared for C++, like Solaris */ | |
| #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) | | #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) | |
| extern "C" int madvise(void *addr, size_t len, int behav); | | extern "C" int madvise(void *addr, size_t len, int behav); | |
| #endif | | #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 */ | | | |
| #define MASTER 1 /* Compile without unireg */ | | | |
| #define ENGLISH 1 /* Messages in English */ | | | |
| #define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ | | | |
| #define USE_REGEX 1 /* We want the use the regex library */ | | | |
| /* Do not define for ultra sparcs */ | | | |
| #define USE_BMOVE512 1 /* Use this unless system bmove is faster */ | | | |
| | | | |
| #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ | | #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ | |
| #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ | | #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ | |
| | | | |
| /* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ | | /* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ | |
| #ifdef I_AM_PARANOID | | #ifdef I_AM_PARANOID | |
| #define DONT_ALLOW_USER_CHANGE 1 | | #define DONT_ALLOW_USER_CHANGE 1 | |
| #define DONT_USE_MYSQL_PWD 1 | | #define DONT_USE_MYSQL_PWD 1 | |
| #endif | | #endif | |
| | | | |
| /* Does the system remember a signal handler after a signal ? */ | | /* Does the system remember a signal handler after a signal ? */ | |
|
| #ifndef HAVE_BSD_SIGNALS | | #if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION) | |
| #define DONT_REMEMBER_SIGNAL | | #define SIGNAL_HANDLER_RESET_ON_DELIVERY | |
| #endif | | #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 | | #else | |
| #define LINT_INIT(var) | | #define LINT_INIT(var) | |
| #endif | | #endif | |
| | | | |
|
| | | #ifndef SO_EXT | |
| | | #ifdef _WIN32 | |
| | | #define SO_EXT ".dll" | |
| | | #elif defined(__APPLE__) | |
| | | #define SO_EXT ".dylib" | |
| | | #else | |
| | | #define SO_EXT ".so" | |
| | | #endif | |
| | | #endif | |
| | | | |
| /* | | /* | |
| Suppress uninitialized variable warning without generating code. | | Suppress uninitialized variable warning without generating code. | |
| | | | |
| The _cplusplus is a temporary workaround for C++ code pending a fix | | 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) | | | #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ | |
| | \ | | defined(__cplusplus) || !defined(__GNUC__) | |
| !defined(__GNUC__) | | | |
| #define UNINIT_VAR(x) x= 0 | | #define UNINIT_VAR(x) x= 0 | |
| #else | | #else | |
|
| | | /* GCC specific self-initialization which inhibits the warning. */ | |
| #define UNINIT_VAR(x) x= x | | #define UNINIT_VAR(x) x= x | |
| #endif | | #endif | |
| | | | |
|
| /* Define some useful general macros */ | | | |
| #if !defined(max) | | | |
| #define max(a, b) ((a) > (b) ? (a) : (b)) | | | |
| #define min(a, b) ((a) < (b) ? (a) : (b)) | | | |
| #endif | | | |
| | | | |
| #if !defined(HAVE_UINT) | | #if !defined(HAVE_UINT) | |
| #undef HAVE_UINT | | #undef HAVE_UINT | |
| #define HAVE_UINT | | #define HAVE_UINT | |
| typedef unsigned int uint; | | typedef unsigned int uint; | |
| typedef unsigned short ushort; | | typedef unsigned short ushort; | |
| #endif | | #endif | |
| | | | |
|
| #define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) | | | |
| #define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) | | | |
| #define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } | | #define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } | |
| #define test(a) ((a) ? 1 : 0) | | #define test(a) ((a) ? 1 : 0) | |
| #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) | | #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 set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) | |
| #define test_all_bits(a,b) (((a) & (b)) == (b)) | | #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 array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) | |
| | | | |
| /* Define some general constants */ | | /* Define some general constants */ | |
| #ifndef TRUE | | #ifndef TRUE | |
| #define TRUE (1) /* Logical true */ | | #define TRUE (1) /* Logical true */ | |
| #define FALSE (0) /* Logical false */ | | #define FALSE (0) /* Logical false */ | |
| #endif | | #endif | |
| | | | |
|
| #if defined(__GNUC__) | | #include <my_compiler.h> | |
| #define function_volatile volatile | | | |
| #define my_reinterpret_cast(A) reinterpret_cast<A> | | | |
| #define my_const_cast(A) const_cast<A> | | | |
| # ifndef GCC_VERSION | | | |
| # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) | | | |
| # endif | | | |
| #elif !defined(my_reinterpret_cast) | | | |
| #define my_reinterpret_cast(A) (A) | | | |
| #define my_const_cast(A) (A) | | | |
| #endif | | | |
| | | | |
| #include <my_attribute.h> | | | |
| | | | |
| /* | | /* | |
| Wen using the embedded library, users might run into link problems, | | Wen using the embedded library, users might run into link problems, | |
| duplicate declaration of __cxa_pure_virtual, solved by declaring it a | | duplicate declaration of __cxa_pure_virtual, solved by declaring it a | |
| weak symbol. | | weak symbol. | |
| */ | | */ | |
| #if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL) | | #if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL) | |
| C_MODE_START | | C_MODE_START | |
| int __cxa_pure_virtual () __attribute__ ((weak)); | | int __cxa_pure_virtual () __attribute__ ((weak)); | |
| C_MODE_END | | C_MODE_END | |
| #endif | | #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 */ | | /* The DBUG_ON flag always takes precedence over default DBUG_OFF */ | |
| #if defined(DBUG_ON) && defined(DBUG_OFF) | | #if defined(DBUG_ON) && defined(DBUG_OFF) | |
| #undef DBUG_OFF | | #undef DBUG_OFF | |
| #endif | | #endif | |
| | | | |
| /* We might be forced to turn debug off, if not turned off already */ | | /* We might be forced to turn debug off, if not turned off already */ | |
| #if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) | | #if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) | |
| # define DBUG_OFF | | # define DBUG_OFF | |
| # ifdef DBUG_ON | | # ifdef DBUG_ON | |
| # undef DBUG_ON | | # undef DBUG_ON | |
| # endif | | # endif | |
| #endif | | #endif | |
| | | | |
|
| #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 */ | | /* Some types that is different between systems */ | |
| | | | |
| typedef int File; /* File descriptor */ | | typedef int File; /* File descriptor */ | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| typedef SOCKET my_socket; | | typedef SOCKET my_socket; | |
| #else | | #else | |
| typedef int my_socket; /* File descriptor for sockets */ | | typedef int my_socket; /* File descriptor for sockets */ | |
| #define INVALID_SOCKET -1 | | #define INVALID_SOCKET -1 | |
| #endif | | #endif | |
| /* Type for fuctions that handles signals */ | | /* Type for fuctions that handles signals */ | |
| | | | |
| skipping to change at line 803 | | skipping to change at line 598 | |
| #endif | | #endif | |
| | | | |
| /* additional file share flags for win32 */ | | /* additional file share flags for win32 */ | |
| #ifdef __WIN__ | | #ifdef __WIN__ | |
| #define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ | | #define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ | |
| #define _SH_DENYWRD 0x120 /* deny write mode & delete */ | | #define _SH_DENYWRD 0x120 /* deny write mode & delete */ | |
| #define _SH_DENYRDD 0x130 /* deny read mode & delete */ | | #define _SH_DENYRDD 0x130 /* deny read mode & delete */ | |
| #define _SH_DENYDEL 0x140 /* deny delete only */ | | #define _SH_DENYDEL 0x140 /* deny delete only */ | |
| #endif /* __WIN__ */ | | #endif /* __WIN__ */ | |
| | | | |
|
| /* #define USE_RECORD_LOCK */ | | /* General constants */ | |
| | | | |
| /* Unsigned types supported by the compiler */ | | | |
| #define UNSINT8 /* unsigned int8 (char) */ | | | |
| #define UNSINT16 /* unsigned int16 */ | | | |
| #define UNSINT32 /* unsigned int32 */ | | | |
| | | | |
| /* General constants */ | | | |
| #define FN_LEN 256 /* Max file name len */ | | #define FN_LEN 256 /* Max file name len */ | |
| #define FN_HEADLEN 253 /* Max length of filepart of file name */ | | #define FN_HEADLEN 253 /* Max length of filepart of file name */ | |
| #define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN)
*/ | | #define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN)
*/ | |
| #define FN_REFLEN 512 /* Max length of full path-name */ | | #define FN_REFLEN 512 /* Max length of full path-name */ | |
| #define FN_EXTCHAR '.' | | #define FN_EXTCHAR '.' | |
| #define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ | | #define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ | |
| #define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ | | #define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ | |
| #define FN_PARENTDIR ".." /* Parent directory; Must be a string */ | | #define FN_PARENTDIR ".." /* Parent directory; Must be a string */ | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| | | | |
| skipping to change at line 871 | | skipping to change at line 659 | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| #define MY_NFILE (16384 + MY_FILE_MIN) | | #define MY_NFILE (16384 + MY_FILE_MIN) | |
| #else | | #else | |
| #define MY_NFILE 64 | | #define MY_NFILE 64 | |
| #endif | | #endif | |
| | | | |
| #ifndef OS_FILE_LIMIT | | #ifndef OS_FILE_LIMIT | |
| #define OS_FILE_LIMIT UINT_MAX | | #define OS_FILE_LIMIT UINT_MAX | |
| #endif | | #endif | |
| | | | |
|
| /* #define EXT_IN_LIBNAME */ | | | |
| /* #define FN_NO_CASE_SENSE */ | | | |
| /* #define FN_UPPER_CASE TRUE */ | | | |
| | | | |
| /* | | /* | |
| Io buffer size; Must be a power of 2 and a multiple of 512. May be | | Io buffer size; Must be a power of 2 and a multiple of 512. May be | |
| smaller what the disk page size. This influences the speed of the | | smaller what the disk page size. This influences the speed of the | |
| isam btree library. eg to big to slow. | | isam btree library. eg to big to slow. | |
| */ | | */ | |
| #define IO_SIZE 4096 | | #define IO_SIZE 4096 | |
| /* | | /* | |
| How much overhead does malloc have. The code often allocates | | How much overhead does malloc have. The code often allocates | |
| something like 1024-MALLOC_OVERHEAD bytes | | something like 1024-MALLOC_OVERHEAD bytes | |
| */ | | */ | |
|
| #ifdef SAFEMALLOC | | | |
| #define MALLOC_OVERHEAD (8+24+4) | | | |
| #else | | | |
| #define MALLOC_OVERHEAD 8 | | #define MALLOC_OVERHEAD 8 | |
|
| #endif | | | |
| /* get memory in huncs */ | | /* get memory in huncs */ | |
| #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) | | #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) | |
| /* Typical record cash */ | | /* Typical record cash */ | |
| #define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) | | #define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) | |
| /* Typical key cash */ | | /* Typical key cash */ | |
| #define KEY_CACHE_SIZE (uint) (8*1024*1024) | | #define KEY_CACHE_SIZE (uint) (8*1024*1024) | |
| /* Default size of a key cache block */ | | /* Default size of a key cache block */ | |
| #define KEY_CACHE_BLOCK_SIZE (uint) 1024 | | #define KEY_CACHE_BLOCK_SIZE (uint) 1024 | |
| | | | |
| /* Some things that this system doesn't have */ | | /* Some things that this system doesn't have */ | |
| | | | |
|
| #define NO_HASH /* Not needed anymore */ | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| #define NO_DIR_LIBRARY /* Not standard dir-library */ | | #define NO_DIR_LIBRARY /* Not standard dir-library */ | |
| #endif | | #endif | |
| | | | |
| /* Some defines of functions for portability */ | | /* Some defines of functions for portability */ | |
| | | | |
| #undef remove /* Crashes MySQL on SCO 5.0.0 */ | | #undef remove /* Crashes MySQL on SCO 5.0.0 */ | |
| #ifndef __WIN__ | | #ifndef __WIN__ | |
| #define closesocket(A) close(A) | | #define closesocket(A) close(A) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 948 | | skipping to change at line 728 | |
| #define my_off_t2double(A) ((double) (my_off_t) (A)) | | #define my_off_t2double(A) ((double) (my_off_t) (A)) | |
| #endif | | #endif | |
| #ifndef double2ulonglong | | #ifndef double2ulonglong | |
| #define double2ulonglong(A) ((ulonglong) (double) (A)) | | #define double2ulonglong(A) ((ulonglong) (double) (A)) | |
| #endif | | #endif | |
| | | | |
| #ifndef offsetof | | #ifndef offsetof | |
| #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |
| #endif | | #endif | |
| #define ulong_to_double(X) ((double) (ulong) (X)) | | #define ulong_to_double(X) ((double) (ulong) (X)) | |
|
| #define SET_STACK_SIZE(X) /* Not needed on real machines */ | | | |
| | | | |
| #ifndef STACK_DIRECTION | | #ifndef STACK_DIRECTION | |
| #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" | | #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" | |
| #endif | | #endif | |
| | | | |
| #if !defined(HAVE_STRTOK_R) | | #if !defined(HAVE_STRTOK_R) | |
| #define strtok_r(A,B,C) strtok((A),(B)) | | #define strtok_r(A,B,C) strtok((A),(B)) | |
| #endif | | #endif | |
| | | | |
| /* This is from the old m-machine.h file */ | | /* This is from the old m-machine.h file */ | |
| | | | |
| #if SIZEOF_LONG_LONG > 4 | | #if SIZEOF_LONG_LONG > 4 | |
| #define HAVE_LONG_LONG 1 | | #define HAVE_LONG_LONG 1 | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define | | Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define | |
| ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined
. | | ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined
. | |
|
| Also on Windows we define these constants by hand in config-win.h. | | | |
| */ | | */ | |
| | | | |
| #if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) | | #if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) | |
| #define LONGLONG_MIN ((long long) 0x8000000000000000LL) | | #define LONGLONG_MIN ((long long) 0x8000000000000000LL) | |
| #define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) | | #define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) | |
| #endif | | #endif | |
| | | | |
| #if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) | | #if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) | |
| /* First check for ANSI C99 definition: */ | | /* First check for ANSI C99 definition: */ | |
| #ifdef ULLONG_MAX | | #ifdef ULLONG_MAX | |
| | | | |
| skipping to change at line 1065 | | skipping to change at line 843 | |
| */ | | */ | |
| #if SIZEOF_CHARP == 4 | | #if SIZEOF_CHARP == 4 | |
| typedef long my_ptrdiff_t; | | typedef long my_ptrdiff_t; | |
| #else | | #else | |
| typedef long long my_ptrdiff_t; | | typedef long long my_ptrdiff_t; | |
| #endif | | #endif | |
| | | | |
| #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) | | #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) | |
| #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) | | #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) | |
| /* Size to make adressable obj. */ | | /* Size to make adressable obj. */ | |
|
| #define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t))) | | | |
| /* Offset of field f in structure t */ | | | |
| #define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) | | | |
| #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) | | #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 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 | | 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 | | offsets of members in class for non-POD types (according to the current | |
| version of C++ standard offsetof() macro can't be used in such cases and | | version of C++ standard offsetof() macro can't be used in such cases and | |
| attempt to do so causes warnings to be emitted, OTOH in many cases it is | | attempt to do so causes warnings to be emitted, OTOH in many cases it is | |
| still OK to assume that all instances of the class has the same offsets | | still OK to assume that all instances of the class has the same offsets | |
| for the same members). | | for the same members). | |
| | | | |
| This is temporary solution which should be removed once File_parser class | | This is temporary solution which should be removed once File_parser class | |
| and related routines are refactored. | | and related routines are refactored. | |
| */ | | */ | |
| | | | |
| #define my_offsetof(TYPE, MEMBER) \ | | #define my_offsetof(TYPE, MEMBER) \ | |
| ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) | | ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) | |
| | | | |
| #define NullS (char *) 0 | | #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 | | #ifdef STDCALL | |
| #undef STDCALL | | #undef STDCALL | |
| #endif | | #endif | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| #define STDCALL __stdcall | | #define STDCALL __stdcall | |
| #else | | #else | |
| #define STDCALL | | #define STDCALL | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1200 | | skipping to change at line 953 | |
| #elif SIZEOF_CHARP == SIZEOF_LONG | | #elif SIZEOF_CHARP == SIZEOF_LONG | |
| typedef long intptr; | | typedef long intptr; | |
| #elif SIZEOF_CHARP == SIZEOF_LONG_LONG | | #elif SIZEOF_CHARP == SIZEOF_LONG_LONG | |
| typedef long long intptr; | | typedef long long intptr; | |
| #else | | #else | |
| #error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(lo
ng long) | | #error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(lo
ng long) | |
| #endif | | #endif | |
| | | | |
| #define MY_ERRPTR ((void*)(intptr)1) | | #define MY_ERRPTR ((void*)(intptr)1) | |
| | | | |
|
| #ifdef USE_RAID | | | |
| /* | | | |
| The following is done with a if to not get problems with pre-processors | | | |
| with late define evaluation | | | |
| */ | | | |
| #if SIZEOF_OFF_T == 4 | | | |
| #define SYSTEM_SIZEOF_OFF_T 4 | | | |
| #else | | | |
| #define SYSTEM_SIZEOF_OFF_T 8 | | | |
| #endif | | | |
| #undef SIZEOF_OFF_T | | | |
| #define SIZEOF_OFF_T 8 | | | |
| #else | | | |
| #define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T | | | |
| #endif /* USE_RAID */ | | | |
| | | | |
| #if defined(_WIN32) | | #if defined(_WIN32) | |
| typedef unsigned long long my_off_t; | | typedef unsigned long long my_off_t; | |
| typedef unsigned long long os_off_t; | | typedef unsigned long long os_off_t; | |
| #else | | #else | |
| typedef off_t os_off_t; | | typedef off_t os_off_t; | |
| #if SIZEOF_OFF_T > 4 | | #if SIZEOF_OFF_T > 4 | |
| typedef ulonglong my_off_t; | | typedef ulonglong my_off_t; | |
| #else | | #else | |
| typedef unsigned long my_off_t; | | typedef unsigned long my_off_t; | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1256 | | skipping to change at line 993 | |
| #define closesocket(A) close(A) | | #define closesocket(A) close(A) | |
| #define SOCKET_EINTR EINTR | | #define SOCKET_EINTR EINTR | |
| #define SOCKET_EAGAIN EAGAIN | | #define SOCKET_EAGAIN EAGAIN | |
| #define SOCKET_ETIMEDOUT SOCKET_EINTR | | #define SOCKET_ETIMEDOUT SOCKET_EINTR | |
| #define SOCKET_EWOULDBLOCK EWOULDBLOCK | | #define SOCKET_EWOULDBLOCK EWOULDBLOCK | |
| #define SOCKET_EADDRINUSE EADDRINUSE | | #define SOCKET_EADDRINUSE EADDRINUSE | |
| #define SOCKET_ENFILE ENFILE | | #define SOCKET_ENFILE ENFILE | |
| #define SOCKET_EMFILE EMFILE | | #define SOCKET_EMFILE EMFILE | |
| #endif | | #endif | |
| | | | |
|
| typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ | | | |
| typedef short int15; /* Most effective integer 0 <= x <= 32767 */ | | | |
| typedef int myf; /* Type of MyFlags in my_funcs */ | | typedef int myf; /* Type of MyFlags in my_funcs */ | |
| typedef char my_bool; /* Small bool */ | | typedef char my_bool; /* Small bool */ | |
|
| /* Macros for converting *constants* to the right type */ | | | |
| #define INT8(v) (int8) (v) | | /* Macros for converting *constants* to the right type */ | |
| #define INT16(v) (int16) (v) | | | |
| #define INT32(v) (int32) (v) | | | |
| #define MYF(v) (myf) (v) | | #define MYF(v) (myf) (v) | |
| | | | |
| #ifndef LL | | #ifndef LL | |
| #ifdef HAVE_LONG_LONG | | #ifdef HAVE_LONG_LONG | |
| #define LL(A) A ## LL | | #define LL(A) A ## LL | |
| #else | | #else | |
| #define LL(A) A ## L | | #define LL(A) A ## L | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 1307 | | skipping to change at line 1040 | |
| #define reg11 register | | #define reg11 register | |
| #define reg12 register | | #define reg12 register | |
| #define reg13 register | | #define reg13 register | |
| #define reg14 register | | #define reg14 register | |
| #define reg15 register | | #define reg15 register | |
| #define reg16 register | | #define reg16 register | |
| #endif | | #endif | |
| | | | |
| #include <my_dbug.h> | | #include <my_dbug.h> | |
| | | | |
|
| /* | | | |
| Sometimes we want to make sure that the variable is not put into | | | |
| a register in debugging mode so we can see its value in the core | | | |
| */ | | | |
| | | | |
| #ifndef DBUG_OFF | | | |
| #define dbug_volatile volatile | | | |
| #else | | | |
| #define dbug_volatile | | | |
| #endif | | | |
| | | | |
| /* Some helper macros */ | | /* Some helper macros */ | |
| #define YESNO(X) ((X) ? "yes" : "no") | | #define YESNO(X) ((X) ? "yes" : "no") | |
| | | | |
|
| /* Defines for time function */ | | | |
| #define SCALE_SEC 100 | | | |
| #define SCALE_USEC 10000 | | | |
| #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen
*/ | | #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen
*/ | |
| #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen
*/ | | #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen
*/ | |
| | | | |
| /* | | /* | |
| Define-funktions for reading and storing in machine independent format | | Define-funktions for reading and storing in machine independent format | |
| (low byte first) | | (low byte first) | |
| */ | | */ | |
| | | | |
| /* Optimized store functions for Intel x86 */ | | /* Optimized store functions for Intel x86 */ | |
| #if defined(__i386__) || defined(_WIN32) | | #if defined(__i386__) || defined(_WIN32) | |
| | | | |
| skipping to change at line 1519 | | skipping to change at line 1238 | |
| ((uchar*) &def_temp)[0]=(M)[7];\ | | ((uchar*) &def_temp)[0]=(M)[7];\ | |
| ((uchar*) &def_temp)[1]=(M)[6];\ | | ((uchar*) &def_temp)[1]=(M)[6];\ | |
| ((uchar*) &def_temp)[2]=(M)[5];\ | | ((uchar*) &def_temp)[2]=(M)[5];\ | |
| ((uchar*) &def_temp)[3]=(M)[4];\ | | ((uchar*) &def_temp)[3]=(M)[4];\ | |
| ((uchar*) &def_temp)[4]=(M)[3];\ | | ((uchar*) &def_temp)[4]=(M)[3];\ | |
| ((uchar*) &def_temp)[5]=(M)[2];\ | | ((uchar*) &def_temp)[5]=(M)[2];\ | |
| ((uchar*) &def_temp)[6]=(M)[1];\ | | ((uchar*) &def_temp)[6]=(M)[1];\ | |
| ((uchar*) &def_temp)[7]=(M)[0];\ | | ((uchar*) &def_temp)[7]=(M)[0];\ | |
| (V) = def_temp; } while(0) | | (V) = def_temp; } while(0) | |
| #else | | #else | |
|
| #define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float | | #define float4get(V,M) memcpy(&V, (M), sizeof(float)) | |
| )) | | #define float4store(V,M) memcpy(V, (&M), sizeof(float)) | |
| #define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float | | | |
| )) | | | |
| | | | |
| #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) | | #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) | |
| #define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\ | | #define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\ | |
| *(((char*)T)+1)=(char) ((uchar *) &V)[5];\ | | *(((char*)T)+1)=(char) ((uchar *) &V)[5];\ | |
| *(((char*)T)+2)=(char) ((uchar *) &V)[6];\ | | *(((char*)T)+2)=(char) ((uchar *) &V)[6];\ | |
| *(((char*)T)+3)=(char) ((uchar *) &V)[7];\ | | *(((char*)T)+3)=(char) ((uchar *) &V)[7];\ | |
| *(((char*)T)+4)=(char) ((uchar *) &V)[0];\ | | *(((char*)T)+4)=(char) ((uchar *) &V)[0];\ | |
| *(((char*)T)+5)=(char) ((uchar *) &V)[1];\ | | *(((char*)T)+5)=(char) ((uchar *) &V)[1];\ | |
| *(((char*)T)+6)=(char) ((uchar *) &V)[2];\ | | *(((char*)T)+6)=(char) ((uchar *) &V)[2];\ | |
| *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\ | | *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\ | |
| | | | |
| skipping to change at line 1590 | | skipping to change at line 1309 | |
| ((uchar*) &def_temp)[3]=(M)[3];\ | | ((uchar*) &def_temp)[3]=(M)[3];\ | |
| (V)=def_temp; } while(0) | | (V)=def_temp; } while(0) | |
| #define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ | | #define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ | |
| *(((char*)T)+1)=(char)(def_temp); \ | | *(((char*)T)+1)=(char)(def_temp); \ | |
| *(((char*)T)+0)=(char)(def_temp >> 8); } while
(0) | | *(((char*)T)+0)=(char)(def_temp >> 8); } while
(0) | |
| #define longstore(T,A) do { *(((char*)T)+3)=((A));\ | | #define longstore(T,A) do { *(((char*)T)+3)=((A));\ | |
| *(((char*)T)+2)=(((A) >> 8));\ | | *(((char*)T)+2)=(((A) >> 8));\ | |
| *(((char*)T)+1)=(((A) >> 16));\ | | *(((char*)T)+1)=(((A) >> 16));\ | |
| *(((char*)T)+0)=(((A) >> 24)); } while(0) | | *(((char*)T)+0)=(((A) >> 24)); } while(0) | |
| | | | |
|
| #define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float | | #define floatget(V,M) memcpy(&V, (M), sizeof(float)) | |
| )) | | #define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float)) | |
| #define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(floa | | #define doubleget(V,M) memcpy(&V, (M), sizeof(double)) | |
| t)) | | #define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double)) | |
| #define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double | | #define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) | |
| )) | | #define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) | |
| #define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(doubl | | | |
| e)) | | | |
| #define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulong | | | |
| long)) | | | |
| #define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulo | | | |
| nglong)) | | | |
| | | | |
| #else | | #else | |
| | | | |
| #define ushortget(V,M) do { V = uint2korr(M); } while(0) | | #define ushortget(V,M) do { V = uint2korr(M); } while(0) | |
| #define shortget(V,M) do { V = sint2korr(M); } while(0) | | #define shortget(V,M) do { V = sint2korr(M); } while(0) | |
| #define longget(V,M) do { V = sint4korr(M); } while(0) | | #define longget(V,M) do { V = sint4korr(M); } while(0) | |
| #define ulongget(V,M) do { V = uint4korr(M); } while(0) | | #define ulongget(V,M) do { V = uint4korr(M); } while(0) | |
| #define shortstore(T,V) int2store(T,V) | | #define shortstore(T,V) int2store(T,V) | |
| #define longstore(T,V) int4store(T,V) | | #define longstore(T,V) int4store(T,V) | |
| #ifndef floatstore | | #ifndef floatstore | |
|
| #define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(flo | | #define floatstore(T,V) memcpy((T), (void *) (&V), sizeof(float)) | |
| at)) | | #define floatget(V,M) memcpy(&V, (M), sizeof(float)) | |
| #define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(flo | | | |
| at)) | | | |
| #endif | | #endif | |
| #ifndef doubleget | | #ifndef doubleget | |
|
| #define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double | | #define doubleget(V,M) memcpy(&V, (M), sizeof(double)) | |
| )) | | #define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double)) | |
| #define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(doubl | | | |
| e)) | | | |
| #endif /* doubleget */ | | #endif /* doubleget */ | |
|
| #define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulong | | #define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) | |
| long)) | | #define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) | |
| #define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulo | | | |
| nglong)) | | | |
| | | | |
| #endif /* WORDS_BIGENDIAN */ | | #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 | | #ifndef THREAD | |
| #define thread_safe_increment(V,L) (V)++ | | #define thread_safe_increment(V,L) (V)++ | |
| #define thread_safe_decrement(V,L) (V)-- | | #define thread_safe_decrement(V,L) (V)-- | |
| #define thread_safe_add(V,C,L) (V)+=(C) | | #define thread_safe_add(V,C,L) (V)+=(C) | |
| #define thread_safe_sub(V,C,L) (V)-=(C) | | #define thread_safe_sub(V,C,L) (V)-=(C) | |
| #define statistic_increment(V,L) (V)++ | | #define statistic_increment(V,L) (V)++ | |
| #define statistic_decrement(V,L) (V)-- | | #define statistic_decrement(V,L) (V)-- | |
| #define statistic_add(V,C,L) (V)+=(C) | | #define statistic_add(V,C,L) (V)+=(C) | |
| #define statistic_sub(V,C,L) (V)-=(C) | | #define statistic_sub(V,C,L) (V)-=(C) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1654 | | skipping to change at line 1362 | |
| #endif | | #endif | |
| | | | |
| #if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL) | | #if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL) | |
| #define NO_EMBEDDED_ACCESS_CHECKS | | #define NO_EMBEDDED_ACCESS_CHECKS | |
| #endif | | #endif | |
| | | | |
| #if defined(_WIN32) | | #if defined(_WIN32) | |
| #define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) | | #define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) | |
| #define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) | | #define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) | |
| #define dlclose(lib) FreeLibrary((HMODULE)lib) | | #define dlclose(lib) FreeLibrary((HMODULE)lib) | |
|
| | | #ifndef HAVE_DLOPEN | |
| #define HAVE_DLOPEN | | #define HAVE_DLOPEN | |
| #endif | | #endif | |
|
| | | #endif | |
| | | | |
| #ifdef HAVE_DLOPEN | | #ifdef HAVE_DLOPEN | |
| #if defined(HAVE_DLFCN_H) | | #if defined(HAVE_DLFCN_H) | |
| #include <dlfcn.h> | | #include <dlfcn.h> | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| /* FreeBSD 2.2.2 does not define RTLD_NOW) */ | | | |
| #ifndef RTLD_NOW | | | |
| #define RTLD_NOW 1 | | | |
| #endif | | | |
| | | | |
| #ifndef HAVE_DLERROR | | #ifndef HAVE_DLERROR | |
|
| | | #ifdef _WIN32 | |
| #define dlerror() "" | | #define dlerror() "" | |
|
| | | #else | |
| | | #define dlerror() "No support for dynamic loading (static build?)" | |
| | | #endif | |
| #endif | | #endif | |
| | | | |
|
| #ifndef __NETWARE__ | | | |
| /* | | /* | |
| * Include standard definitions of operator new and delete. | | * Include standard definitions of operator new and delete. | |
| */ | | */ | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| #include <new> | | #include <new> | |
| #endif | | #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. */ | | /* Length of decimal number represented by INT32. */ | |
| #define MY_INT32_NUM_DECIMAL_DIGITS 11 | | #define MY_INT32_NUM_DECIMAL_DIGITS 11 | |
| | | | |
| /* Length of decimal number represented by INT64. */ | | /* Length of decimal number represented by INT64. */ | |
| #define MY_INT64_NUM_DECIMAL_DIGITS 21 | | #define MY_INT64_NUM_DECIMAL_DIGITS 21 | |
| | | | |
| /* Define some useful general macros (should be done after all headers). */ | | /* Define some useful general macros (should be done after all headers). */ | |
| #if !defined(max) | | #if !defined(max) | |
| #define max(a, b) ((a) > (b) ? (a) : (b)) | | #define max(a, b) ((a) > (b) ? (a) : (b)) | |
| #define min(a, b) ((a) < (b) ? (a) : (b)) | | #define min(a, b) ((a) < (b) ? (a) : (b)) | |
| #endif | | #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 sur
e a | | Only Linux is known to need an explicit sync of the directory to make sur
e a | |
| file creation/deletion/renaming in(from,to) this directory durable. | | file creation/deletion/renaming in(from,to) this directory durable. | |
| */ | | */ | |
| #ifdef TARGET_OS_LINUX | | #ifdef TARGET_OS_LINUX | |
| #define NEED_EXPLICIT_SYNC_DIR 1 | | #define NEED_EXPLICIT_SYNC_DIR 1 | |
| #endif | | #endif | |
| | | | |
| #if !defined(__cplusplus) && !defined(bool) | | #if !defined(__cplusplus) && !defined(bool) | |
| #define bool In_C_you_should_use_my_bool_instead() | | #define bool In_C_you_should_use_my_bool_instead() | |
| | | | |
| skipping to change at line 1795 | | skipping to change at line 1486 | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /* Defines that are unique to the embedded version of MySQL */ | | /* Defines that are unique to the embedded version of MySQL */ | |
| | | | |
| #ifdef EMBEDDED_LIBRARY | | #ifdef EMBEDDED_LIBRARY | |
| | | | |
| /* Things we don't need in the embedded version of MySQL */ | | /* Things we don't need in the embedded version of MySQL */ | |
| /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library
*/ | | /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library
*/ | |
| | | | |
|
| #undef HAVE_PSTACK /* No stacktrace */ | | | |
| #undef HAVE_OPENSSL | | #undef HAVE_OPENSSL | |
| #undef HAVE_SMEM /* No shared memory */ | | #undef HAVE_SMEM /* No shared memory */ | |
| #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ | | #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ | |
| | | | |
|
| #define DONT_USE_RAID | | | |
| | | | |
| #endif /* EMBEDDED_LIBRARY */ | | #endif /* EMBEDDED_LIBRARY */ | |
| | | | |
| #endif /* my_global_h */ | | #endif /* my_global_h */ | |
| | | | |
End of changes. 52 change blocks. |
| 381 lines changed or deleted | | 49 lines changed or added | |
|
| my_pthread.h | | my_pthread.h | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| | | | |
| typedef struct { int dummy; } pthread_condattr_t; | | typedef struct { int dummy; } pthread_condattr_t; | |
| | | | |
| /* Implementation of posix conditions */ | | /* Implementation of posix conditions */ | |
| | | | |
| typedef struct st_pthread_link { | | typedef struct st_pthread_link { | |
| DWORD thread_id; | | DWORD thread_id; | |
| struct st_pthread_link *next; | | struct st_pthread_link *next; | |
| } pthread_link; | | } pthread_link; | |
| | | | |
|
| typedef struct { | | /** | |
| uint32 waiting; | | Implementation of Windows condition variables. | |
| CRITICAL_SECTION lock_waiting; | | We use native conditions on Vista and later, and fallback to own | |
| | | implementation on earlier OS version. | |
| enum { | | */ | |
| SIGNAL= 0, | | typedef union | |
| BROADCAST= 1, | | { | |
| MAX_EVENTS= 2 | | /* Native condition (used on Vista and later) */ | |
| } EVENTS; | | CONDITION_VARIABLE native_cond; | |
| | | | |
| HANDLE events[MAX_EVENTS]; | | | |
| HANDLE broadcast_block_event; | | | |
| | | | |
|
| | | /* Own implementation (used on XP) */ | |
| | | struct | |
| | | { | |
| | | uint32 waiting; | |
| | | CRITICAL_SECTION lock_waiting; | |
| | | enum | |
| | | { | |
| | | SIGNAL= 0, | |
| | | BROADCAST= 1, | |
| | | MAX_EVENTS= 2 | |
| | | } EVENTS; | |
| | | HANDLE events[MAX_EVENTS]; | |
| | | HANDLE broadcast_block_event; | |
| | | }; | |
| } pthread_cond_t; | | } pthread_cond_t; | |
| | | | |
| typedef int pthread_mutexattr_t; | | typedef int pthread_mutexattr_t; | |
| #define pthread_self() GetCurrentThreadId() | | #define pthread_self() GetCurrentThreadId() | |
| #define pthread_handler_t EXTERNC void * __cdecl | | #define pthread_handler_t EXTERNC void * __cdecl | |
| typedef void * (__cdecl *pthread_handler)(void *); | | typedef void * (__cdecl *pthread_handler)(void *); | |
| | | | |
| typedef volatile LONG my_pthread_once_t; | | typedef volatile LONG my_pthread_once_t; | |
| #define MY_PTHREAD_ONCE_INIT 0 | | #define MY_PTHREAD_ONCE_INIT 0 | |
| #define MY_PTHREAD_ONCE_INPROGRESS 1 | | #define MY_PTHREAD_ONCE_INPROGRESS 1 | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 205 | |
| #ifdef HAVE_THR_SETCONCURRENCY | | #ifdef HAVE_THR_SETCONCURRENCY | |
| #include <thread.h> /* Probably solaris */ | | #include <thread.h> /* Probably solaris */ | |
| #endif | | #endif | |
| #ifdef HAVE_SCHED_H | | #ifdef HAVE_SCHED_H | |
| #include <sched.h> | | #include <sched.h> | |
| #endif | | #endif | |
| #ifdef HAVE_SYNCH_H | | #ifdef HAVE_SYNCH_H | |
| #include <synch.h> | | #include <synch.h> | |
| #endif | | #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 pthread_key(T,V) pthread_key_t V | |
| #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(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)) | | #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) | |
| #define pthread_detach_this_thread() | | #define pthread_detach_this_thread() | |
| #define pthread_handler_t EXTERNC void * | | #define pthread_handler_t EXTERNC void * | |
| typedef void *(* pthread_handler)(void *); | | typedef void *(* pthread_handler)(void *); | |
| | | | |
| #define my_pthread_once_t pthread_once_t | | #define my_pthread_once_t pthread_once_t | |
| #define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT | | #define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT | |
| #define my_pthread_once(C,F) pthread_once(C,F) | | #define my_pthread_once(C,F) pthread_once(C,F) | |
| | | | |
| skipping to change at line 258 | | skipping to change at line 264 | |
| int sigwait(sigset_t *setp, int *sigp); /* Use our implement
ion */ | | int sigwait(sigset_t *setp, int *sigp); /* Use our implement
ion */ | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| We define my_sigset() and use that instead of the system sigset() so that | | We define my_sigset() and use that instead of the system sigset() so that | |
| we can favor an implementation based on sigaction(). On some systems, suc
h | | we can favor an implementation based on sigaction(). On some systems, suc
h | |
| as Mac OS X, sigset() results in flags such as SA_RESTART being set, and | | as Mac OS X, sigset() results in flags such as SA_RESTART being set, and | |
| we want to make sure that no such flags are set. | | we want to make sure that no such flags are set. | |
| */ | | */ | |
| #if defined(HAVE_SIGACTION) && !defined(my_sigset) | | #if defined(HAVE_SIGACTION) && !defined(my_sigset) | |
|
| #define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc;
\ | | #define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set;
\ | |
| DBUG_ASSERT((A) != 0);
\ | | DBUG_ASSERT((A) != 0);
\ | |
| sigemptyset(&l_set);
\ | | sigemptyset(&l_set);
\ | |
| l_s.sa_handler = (B);
\ | | l_s.sa_handler = (B);
\ | |
| l_s.sa_mask = l_set;
\ | | l_s.sa_mask = l_set;
\ | |
| l_s.sa_flags = 0;
\ | | l_s.sa_flags = 0;
\ | |
|
| l_rc= sigaction((A), &l_s, (struct sigaction *) | | sigaction((A), &l_s, NULL); | |
| NULL);\ | | \ | |
| DBUG_ASSERT(l_rc == 0); | | | |
| \ | | | |
| } while (0) | | } while (0) | |
| #elif defined(HAVE_SIGSET) && !defined(my_sigset) | | #elif defined(HAVE_SIGSET) && !defined(my_sigset) | |
| #define my_sigset(A,B) sigset((A),(B)) | | #define my_sigset(A,B) sigset((A),(B)) | |
| #elif !defined(my_sigset) | | #elif !defined(my_sigset) | |
| #define my_sigset(A,B) signal((A),(B)) | | #define my_sigset(A,B) signal((A),(B)) | |
| #endif | | #endif | |
| | | | |
| #if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS) | | #if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS) | |
| #define pthread_attr_setscope(A,B) | | #define pthread_attr_setscope(A,B) | |
| #undef HAVE_GETHOSTBYADDR_R /* No definition */ | | #undef HAVE_GETHOSTBYADDR_R /* No definition */ | |
| | | | |
| skipping to change at line 354 | | skipping to change at line 359 | |
| #define pthread_attr_init(A) pthread_attr_create(A) | | #define pthread_attr_init(A) pthread_attr_create(A) | |
| #define pthread_attr_destroy(A) pthread_attr_delete(A) | | #define pthread_attr_destroy(A) pthread_attr_delete(A) | |
| #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) | | #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) | |
| #define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) | | #define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) | |
| #ifndef pthread_sigmask | | #ifndef pthread_sigmask | |
| #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) | | #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) | |
| #endif | | #endif | |
| #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) | | #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) | |
| #undef pthread_detach_this_thread | | #undef pthread_detach_this_thread | |
| #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthre
ad_detach(&tmp); } | | #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthre
ad_detach(&tmp); } | |
|
| #elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ | | #else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ | |
| #define HAVE_PTHREAD_KILL | | #define HAVE_PTHREAD_KILL | |
| #endif | | #endif | |
| | | | |
| #endif /* defined(__WIN__) */ | | #endif /* defined(__WIN__) */ | |
| | | | |
| #if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) | | #if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) | |
| #undef pthread_cond_timedwait | | #undef pthread_cond_timedwait | |
| #define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)
) | | #define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)
) | |
| int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, | | int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, | |
| struct timespec *abstime); | | struct timespec *abstime); | |
| | | | |
| skipping to change at line 459 | | skipping to change at line 464 | |
| #define cmp_timespec(TS1, TS2) \ | | #define cmp_timespec(TS1, TS2) \ | |
| ((TS1.tv_sec > TS2.tv_sec || \ | | ((TS1.tv_sec > TS2.tv_sec || \ | |
| (TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec > TS2.tv_nsec)) ? 1 : \ | | (TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec > TS2.tv_nsec)) ? 1 : \ | |
| ((TS1.tv_sec < TS2.tv_sec || \ | | ((TS1.tv_sec < TS2.tv_sec || \ | |
| (TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec < TS2.tv_nsec)) ? -1 : 0)) | | (TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec < TS2.tv_nsec)) ? -1 : 0)) | |
| #endif /* !cmp_timespec */ | | #endif /* !cmp_timespec */ | |
| #endif /* HAVE_TIMESPEC_TS_SEC */ | | #endif /* HAVE_TIMESPEC_TS_SEC */ | |
| | | | |
| /* safe_mutex adds checking to mutex for easier debugging */ | | /* 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 | | typedef struct st_safe_mutex_t | |
| { | | { | |
| pthread_mutex_t global,mutex; | | pthread_mutex_t global,mutex; | |
| const char *file; | | const char *file; | |
| uint line,count; | | uint line,count; | |
| pthread_t thread; | | pthread_t thread; | |
| #ifdef SAFE_MUTEX_DETECT_DESTROY | | #ifdef SAFE_MUTEX_DETECT_DESTROY | |
| struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */ | | struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */ | |
| #endif | | #endif | |
| } safe_mutex_t; | | } safe_mutex_t; | |
| | | | |
| skipping to change at line 498 | | skipping to change at line 499 | |
| #endif /* SAFE_MUTEX_DETECT_DESTROY */ | | #endif /* SAFE_MUTEX_DETECT_DESTROY */ | |
| | | | |
| int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr, | | int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr, | |
| const char *file, uint line); | | const char *file, uint line); | |
| int safe_mutex_lock(safe_mutex_t *mp, my_bool try_lock, const char *file, u
int line); | | int safe_mutex_lock(safe_mutex_t *mp, my_bool try_lock, const char *file, u
int line); | |
| int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); | | int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); | |
| int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); | | int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); | |
| int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, | | int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, | |
| uint line); | | uint line); | |
| int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, | | int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, | |
|
| struct timespec *abstime, const char *file, uint lin | | const struct timespec *abstime, | |
| e); | | const char *file, uint line); | |
| void safe_mutex_global_init(void); | | void safe_mutex_global_init(void); | |
| void safe_mutex_end(FILE *file); | | void safe_mutex_end(FILE *file); | |
| | | | |
| /* Wrappers if safe mutex is actually used */ | | /* Wrappers if safe mutex is actually used */ | |
| #ifdef SAFE_MUTEX | | #ifdef SAFE_MUTEX | |
| #undef pthread_mutex_init | | #undef pthread_mutex_init | |
| #undef pthread_mutex_lock | | #undef pthread_mutex_lock | |
| #undef pthread_mutex_unlock | | #undef pthread_mutex_unlock | |
| #undef pthread_mutex_destroy | | #undef pthread_mutex_destroy | |
| #undef pthread_mutex_wait | | #undef pthread_mutex_wait | |
| | | | |
| skipping to change at line 602 | | skipping to change at line 604 | |
| #define rwlock_destroy(A) pthread_rwlock_destroy(A) | | #define rwlock_destroy(A) pthread_rwlock_destroy(A) | |
| #elif defined(HAVE_RWLOCK_INIT) | | #elif defined(HAVE_RWLOCK_INIT) | |
| #ifdef HAVE_RWLOCK_T /* For example Solaris 2.6->
*/ | | #ifdef HAVE_RWLOCK_T /* For example Solaris 2.6->
*/ | |
| #define rw_lock_t rwlock_t | | #define rw_lock_t rwlock_t | |
| #endif | | #endif | |
| #define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) | | #define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) | |
| #else | | #else | |
| /* Use our own version of read/write locks */ | | /* Use our own version of read/write locks */ | |
| #define NEED_MY_RW_LOCK 1 | | #define NEED_MY_RW_LOCK 1 | |
| #define rw_lock_t my_rw_lock_t | | #define rw_lock_t my_rw_lock_t | |
|
| #define my_rwlock_init(A,B) my_rw_init((A), 0) | | #define my_rwlock_init(A,B) my_rw_init((A)) | |
| #define rw_rdlock(A) my_rw_rdlock((A)) | | #define rw_rdlock(A) my_rw_rdlock((A)) | |
| #define rw_wrlock(A) my_rw_wrlock((A)) | | #define rw_wrlock(A) my_rw_wrlock((A)) | |
| #define rw_tryrdlock(A) my_rw_tryrdlock((A)) | | #define rw_tryrdlock(A) my_rw_tryrdlock((A)) | |
| #define rw_trywrlock(A) my_rw_trywrlock((A)) | | #define rw_trywrlock(A) my_rw_trywrlock((A)) | |
| #define rw_unlock(A) my_rw_unlock((A)) | | #define rw_unlock(A) my_rw_unlock((A)) | |
| #define rwlock_destroy(A) my_rw_destroy((A)) | | #define rwlock_destroy(A) my_rw_destroy((A)) | |
|
| | | #define rw_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A)) | |
| | | #define rw_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner | |
| | | ((A)) | |
| #endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ | | #endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ | |
| | | | |
|
| /* | | /** | |
| Portable read-write locks which prefer readers. | | Portable implementation of special type of read-write locks. | |
| | | | |
|
| Required by some algorithms in order to provide correctness. | | These locks have two properties which are unusual for rwlocks: | |
| */ | | 1) They "prefer readers" in the sense that they do not allow | |
| | | situations in which rwlock is rd-locked and there is a | |
| | | pending rd-lock which is blocked (e.g. due to pending | |
| | | request for wr-lock). | |
| | | This is a stronger guarantee than one which is provided for | |
| | | PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux. | |
| | | MDL subsystem deadlock detector relies on this property for | |
| | | its correctness. | |
| | | 2) They are optimized for uncontended wr-lock/unlock case. | |
| | | This is scenario in which they are most oftenly used | |
| | | within MDL subsystem. Optimizing for it gives significant | |
| | | performance improvements in some of tests involving many | |
| | | connections. | |
| | | | |
| | | Another important requirement imposed on this type of rwlock | |
| | | by the MDL subsystem is that it should be OK to destroy rwlock | |
| | | object which is in unlocked state even though some threads might | |
| | | have not yet fully left unlock operation for it (of course there | |
| | | is an external guarantee that no thread will try to lock rwlock | |
| | | which is destroyed). | |
| | | Putting it another way the unlock operation should not access | |
| | | rwlock data after changing its state to unlocked. | |
| | | | |
|
| #if defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_ | | TODO/FIXME: We should consider alleviating this requirement as | |
| SETKIND_NP) | | it blocks us from doing certain performance optimizations. | |
| /* | | | |
| On systems which have a way to specify that readers should | | | |
| be preferred through attribute mechanism (e.g. Linux) we use | | | |
| system implementation of read/write locks. | | | |
| */ | | */ | |
|
| #define rw_pr_lock_t pthread_rwlock_t | | | |
| | | typedef struct st_rw_pr_lock_t { | |
| | | /** | |
| | | Lock which protects the structure. | |
| | | Also held for the duration of wr-lock. | |
| | | */ | |
| | | pthread_mutex_t lock; | |
| | | /** | |
| | | Condition variable which is used to wake-up | |
| | | writers waiting for readers to go away. | |
| | | */ | |
| | | pthread_cond_t no_active_readers; | |
| | | /** Number of active readers. */ | |
| | | uint active_readers; | |
| | | /** Number of writers waiting for readers to go away. */ | |
| | | uint writers_waiting_readers; | |
| | | /** Indicates whether there is an active writer. */ | |
| | | my_bool active_writer; | |
| | | #ifdef SAFE_MUTEX | |
| | | /** Thread holding wr-lock (for debug purposes only). */ | |
| | | pthread_t writer_thread; | |
| | | #endif | |
| | | } rw_pr_lock_t; | |
| | | | |
| extern int rw_pr_init(rw_pr_lock_t *); | | extern int rw_pr_init(rw_pr_lock_t *); | |
|
| #define rw_pr_rdlock(A) pthread_rwlock_rdlock(A) | | extern int rw_pr_rdlock(rw_pr_lock_t *); | |
| #define rw_pr_wrlock(A) pthread_rwlock_wrlock(A) | | extern int rw_pr_wrlock(rw_pr_lock_t *); | |
| #define rw_pr_tryrdlock(A) pthread_rwlock_tryrdlock(A) | | extern int rw_pr_unlock(rw_pr_lock_t *); | |
| #define rw_pr_trywrlock(A) pthread_rwlock_trywrlock(A) | | extern int rw_pr_destroy(rw_pr_lock_t *); | |
| #define rw_pr_unlock(A) pthread_rwlock_unlock(A) | | #ifdef SAFE_MUTEX | |
| #define rw_pr_destroy(A) pthread_rwlock_destroy(A) | | #define rw_pr_lock_assert_write_owner(A) \ | |
| | | DBUG_ASSERT((A)->active_writer && pthread_equal(pthread_self(), \ | |
| | | (A)->writer_thread)) | |
| | | #define rw_pr_lock_assert_not_write_owner(A) \ | |
| | | DBUG_ASSERT(! (A)->active_writer || ! pthread_equal(pthread_self(), \ | |
| | | (A)->writer_thread)) | |
| #else | | #else | |
|
| /* Otherwise we have to use our own implementation of read/write locks. */ | | #define rw_pr_lock_assert_write_owner(A) | |
| #define NEED_MY_RW_LOCK 1 | | #define rw_pr_lock_assert_not_write_owner(A) | |
| struct st_my_rw_lock_t; | | #endif /* SAFE_MUTEX */ | |
| #define rw_pr_lock_t my_rw_lock_t | | | |
| extern int rw_pr_init(struct st_my_rw_lock_t *); | | | |
| #define rw_pr_rdlock(A) my_rw_rdlock((A)) | | | |
| #define rw_pr_wrlock(A) my_rw_wrlock((A)) | | | |
| #define rw_pr_tryrdlock(A) my_rw_tryrdlock((A)) | | | |
| #define rw_pr_trywrlock(A) my_rw_trywrlock((A)) | | | |
| #define rw_pr_unlock(A) my_rw_unlock((A)) | | | |
| #define rw_pr_destroy(A) my_rw_destroy((A)) | | | |
| #endif /* defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOC | | | |
| KATTR_SETKIND_NP) */ | | | |
| | | | |
| #ifdef NEED_MY_RW_LOCK | | #ifdef NEED_MY_RW_LOCK | |
|
| | | | |
| | | #ifdef _WIN32 | |
| | | | |
| | | /** | |
| | | Implementation of Windows rwlock. | |
| | | | |
| | | We use native (slim) rwlocks on Win7 and later, and fallback to portable | |
| | | implementation on earlier Windows. | |
| | | | |
| | | slim rwlock are also available on Vista/WS2008, but we do not use it | |
| | | ("trylock" APIs are missing on Vista) | |
| | | */ | |
| | | typedef union | |
| | | { | |
| | | /* Native rwlock (is_srwlock == TRUE) */ | |
| | | struct | |
| | | { | |
| | | SRWLOCK srwlock; /* native reader writer lock */ | |
| | | BOOL have_exclusive_srwlock; /* used for unlock */ | |
| | | }; | |
| | | | |
| | | /* | |
| | | Portable implementation (is_srwlock == FALSE) | |
| | | Fields are identical with Unix my_rw_lock_t fields. | |
| | | */ | |
| | | struct | |
| | | { | |
| | | pthread_mutex_t lock; /* lock for structure */ | |
| | | pthread_cond_t readers; /* waiting readers */ | |
| | | pthread_cond_t writers; /* waiting writers */ | |
| | | int state; /* -1:writer,0:free,>0:readers */ | |
| | | int waiters; /* number of waiting writers */ | |
| | | #ifdef SAFE_MUTEX | |
| | | pthread_t write_thread; | |
| | | #endif | |
| | | }; | |
| | | } my_rw_lock_t; | |
| | | | |
| | | #else /* _WIN32 */ | |
| | | | |
| /* | | /* | |
|
| On systems which don't support native read/write locks, or don't support | | On systems which don't support native read/write locks we have | |
| read/write locks which prefer readers we have to use own implementation. | | to use own implementation. | |
| */ | | */ | |
| typedef struct st_my_rw_lock_t { | | typedef struct st_my_rw_lock_t { | |
| pthread_mutex_t lock; /* lock for structure */ | | pthread_mutex_t lock; /* lock for structure */ | |
| pthread_cond_t readers; /* waiting readers */ | | pthread_cond_t readers; /* waiting readers */ | |
| pthread_cond_t writers; /* waiting writers */ | | pthread_cond_t writers; /* waiting writers */ | |
| int state; /* -1:writer,0:free,>0:readers */ | | int state; /* -1:writer,0:free,>0:readers */ | |
| int waiters; /* number of waiting writers */ | | int waiters; /* number of waiting writers */ | |
|
| my_bool prefer_readers; | | #ifdef SAFE_MUTEX | |
| | | pthread_t write_thread; | |
| | | #endif | |
| } my_rw_lock_t; | | } my_rw_lock_t; | |
| | | | |
|
| extern int my_rw_init(my_rw_lock_t *, my_bool *); | | #endif /*! _WIN32 */ | |
| | | | |
| | | extern int my_rw_init(my_rw_lock_t *); | |
| extern int my_rw_destroy(my_rw_lock_t *); | | extern int my_rw_destroy(my_rw_lock_t *); | |
| extern int my_rw_rdlock(my_rw_lock_t *); | | extern int my_rw_rdlock(my_rw_lock_t *); | |
| extern int my_rw_wrlock(my_rw_lock_t *); | | extern int my_rw_wrlock(my_rw_lock_t *); | |
| extern int my_rw_unlock(my_rw_lock_t *); | | extern int my_rw_unlock(my_rw_lock_t *); | |
| extern int my_rw_tryrdlock(my_rw_lock_t *); | | extern int my_rw_tryrdlock(my_rw_lock_t *); | |
| extern int my_rw_trywrlock(my_rw_lock_t *); | | extern int my_rw_trywrlock(my_rw_lock_t *); | |
|
| | | #ifdef SAFE_MUTEX | |
| | | #define my_rw_lock_assert_write_owner(A) \ | |
| | | DBUG_ASSERT((A)->state == -1 && pthread_equal(pthread_self(), \ | |
| | | (A)->write_thread)) | |
| | | #define my_rw_lock_assert_not_write_owner(A) \ | |
| | | DBUG_ASSERT((A)->state >= 0 || ! pthread_equal(pthread_self(), \ | |
| | | (A)->write_thread)) | |
| | | #else | |
| | | #define my_rw_lock_assert_write_owner(A) | |
| | | #define my_rw_lock_assert_not_write_owner(A) | |
| | | #endif | |
| #endif /* NEED_MY_RW_LOCK */ | | #endif /* NEED_MY_RW_LOCK */ | |
| | | | |
| #define GETHOSTBYADDR_BUFF_SIZE 2048 | | #define GETHOSTBYADDR_BUFF_SIZE 2048 | |
| | | | |
| #ifndef HAVE_THR_SETCONCURRENCY | | #ifndef HAVE_THR_SETCONCURRENCY | |
| #define thr_setconcurrency(A) pthread_dummy(0) | | #define thr_setconcurrency(A) pthread_dummy(0) | |
| #endif | | #endif | |
| #if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_sets
tacksize) | | #if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_sets
tacksize) | |
| #define pthread_attr_setstacksize(A,B) pthread_dummy(0) | | #define pthread_attr_setstacksize(A,B) pthread_dummy(0) | |
| #endif | | #endif | |
| | | | |
End of changes. 21 change blocks. |
| 64 lines changed or deleted | | 157 lines changed or added | |
|
| my_sys.h | | my_sys.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| # define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,l
en) | | # define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,l
en) | |
| # define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len) | | # define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len) | |
| #else /* HAVE_VALGRIND */ | | #else /* HAVE_VALGRIND */ | |
| # define MEM_UNDEFINED(a,len) ((void) 0) | | # define MEM_UNDEFINED(a,len) ((void) 0) | |
| # define MEM_NOACCESS(a,len) ((void) 0) | | # define MEM_NOACCESS(a,len) ((void) 0) | |
| # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) | | # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) | |
| # define MEM_CHECK_DEFINED(a,len) ((void) 0) | | # define MEM_CHECK_DEFINED(a,len) ((void) 0) | |
| #endif /* HAVE_VALGRIND */ | | #endif /* HAVE_VALGRIND */ | |
| | | | |
| #ifndef THREAD | | #ifndef THREAD | |
|
| extern int NEAR my_errno; /* Last error in mysys */ | | extern int my_errno; /* Last error in mysys */ | |
| #else | | #else | |
| #include <my_pthread.h> | | #include <my_pthread.h> | |
| #endif | | #endif | |
| | | | |
| #include <m_ctype.h> /* for CHARSET_INFO */ | | #include <m_ctype.h> /* for CHARSET_INFO */ | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #include <typelib.h> | | #include <typelib.h> | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| #include <malloc.h> /*for alloca*/ | | #include <malloc.h> /*for alloca*/ | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| | | | |
| /* General bitmaps for my_func's */ | | /* General bitmaps for my_func's */ | |
| #define MY_FFNF 1 /* Fatal if file not found */ | | #define MY_FFNF 1 /* Fatal if file not found */ | |
| #define MY_FNABP 2 /* Fatal if not all bytes read/writen */ | | #define MY_FNABP 2 /* Fatal if not all bytes read/writen */ | |
| #define MY_NABP 4 /* Error if not all bytes read/write
n */ | | #define MY_NABP 4 /* Error if not all bytes read/write
n */ | |
| #define MY_FAE 8 /* Fatal if any error */ | | #define MY_FAE 8 /* Fatal if any error */ | |
| #define MY_WME 16 /* Write message on error */ | | #define MY_WME 16 /* Write message on error */ | |
| #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ | | #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ | |
| #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors
*/ | | #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors
*/ | |
| #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory
*/ | | #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory
*/ | |
|
| #define MY_RAID 64 /* Support for RAID */ | | #define MY_UNUSED 64 /* Unused (was support for RAID) */ | |
| #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete
*/ | | #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete
*/ | |
| #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ | | #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ | |
| #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ | | #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ | |
| #define MY_COPYTIME 64 /* my_redel() copys time */ | | #define MY_COPYTIME 64 /* my_redel() copys time */ | |
| #define MY_DELETE_OLD 256 /* my_create_with_symlink() */ | | #define MY_DELETE_OLD 256 /* my_create_with_symlink() */ | |
| #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ | | #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ | |
| #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ | | #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ | |
| #define MY_REDEL_MAKE_BACKUP 256 | | #define MY_REDEL_MAKE_BACKUP 256 | |
| #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ | | #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ | |
| #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ | | #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 104 | |
| #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ | | #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ | |
| #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ | | #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ | |
| #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ | | #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ | |
| #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ | | #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ | |
| #define MY_SYNC 4096 /* my_copy(): sync dst file */ | | #define MY_SYNC 4096 /* my_copy(): sync dst file */ | |
| | | | |
| #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ | | #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ | |
| #define MY_GIVE_INFO 2 /* Give time info about process*/ | | #define MY_GIVE_INFO 2 /* Give time info about process*/ | |
| #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ | | #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ | |
| | | | |
|
| #define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ | | | |
| #define MY_REMOVE_OPTION 1 | | | |
| #define MY_REMOVE_SECTION 2 | | | |
| | | | |
| #define ME_HIGHBYTE 8 /* Shift for colours */ | | #define ME_HIGHBYTE 8 /* Shift for colours */ | |
| #define ME_NOCUR 1 /* Don't use curses message */ | | #define ME_NOCUR 1 /* Don't use curses message */ | |
| #define ME_OLDWIN 2 /* Use old window */ | | #define ME_OLDWIN 2 /* Use old window */ | |
| #define ME_BELL 4 /* Ring bell then printing message *
/ | | #define ME_BELL 4 /* Ring bell then printing message *
/ | |
| #define ME_HOLDTANG 8 /* Don't delete last keys */ | | #define ME_HOLDTANG 8 /* Don't delete last keys */ | |
| #define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ | | #define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ | |
| #define ME_WAITTANG 32 /* Wait for a user action */ | | #define ME_WAITTANG 32 /* Wait for a user action */ | |
| #define ME_NOREFRESH 64 /* Dont refresh screen */ | | #define ME_NOREFRESH 64 /* Dont refresh screen */ | |
| #define ME_NOINPUT 128 /* Dont use the input libary */ | | #define ME_NOINPUT 128 /* Dont use the input libary */ | |
| #define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ | | #define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 156 | |
| #define MY_ERRNO_ERANGE 34 | | #define MY_ERRNO_ERANGE 34 | |
| | | | |
| /* Bits for get_date timeflag */ | | /* Bits for get_date timeflag */ | |
| #define GETDATE_DATE_TIME 1 | | #define GETDATE_DATE_TIME 1 | |
| #define GETDATE_SHORT_DATE 2 | | #define GETDATE_SHORT_DATE 2 | |
| #define GETDATE_HHMMSSTIME 4 | | #define GETDATE_HHMMSSTIME 4 | |
| #define GETDATE_GMT 8 | | #define GETDATE_GMT 8 | |
| #define GETDATE_FIXEDLENGTH 16 | | #define GETDATE_FIXEDLENGTH 16 | |
| | | | |
| /* defines when allocating data */ | | /* 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); | | 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_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 void *my_memdup(const void *from,size_t length,myf MyFlags); | |
| extern char *my_strdup(const char *from,myf MyFlags); | | extern char *my_strdup(const char *from,myf MyFlags); | |
| extern char *my_strndup(const char *from, size_t length, | | extern char *my_strndup(const char *from, size_t length, | |
| myf MyFlags); | | 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) | | #define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while
(0) | |
|
| #endif | | | |
| | | | |
| #if defined(ENABLED_DEBUG_SYNC) | | #if defined(ENABLED_DEBUG_SYNC) | |
| extern void (*debug_sync_C_callback_ptr)(const char *, size_t); | | extern void (*debug_sync_C_callback_ptr)(const char *, size_t); | |
| #define DEBUG_SYNC_C(_sync_point_name_) do { \ | | #define DEBUG_SYNC_C(_sync_point_name_) do { \ | |
| if (debug_sync_C_callback_ptr != NULL) \ | | if (debug_sync_C_callback_ptr != NULL) \ | |
| (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ | | (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ | |
| while(0) | | while(0) | |
| #else | | #else | |
| #define DEBUG_SYNC_C(_sync_point_name_) | | #define DEBUG_SYNC_C(_sync_point_name_) | |
| #endif /* defined(ENABLED_DEBUG_SYNC) */ | | #endif /* defined(ENABLED_DEBUG_SYNC) */ | |
| | | | |
| #ifdef HAVE_LARGE_PAGES | | #ifdef HAVE_LARGE_PAGES | |
| extern uint my_get_large_page_size(void); | | extern uint my_get_large_page_size(void); | |
| extern uchar * my_large_malloc(size_t size, myf my_flags); | | 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 | | #else | |
| #define my_get_large_page_size() (0) | | #define my_get_large_page_size() (0) | |
| #define my_large_malloc(A,B) my_malloc_lock((A),(B)) | | #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 */ | | #endif /* HAVE_LARGE_PAGES */ | |
| | | | |
| #ifdef HAVE_ALLOCA | | #ifdef HAVE_ALLOCA | |
| #if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) | | #if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) | |
| #pragma alloca | | #pragma alloca | |
| #endif /* _AIX */ | | #endif /* _AIX */ | |
| #if defined(__MWERKS__) | | #if defined(__MWERKS__) | |
| #undef alloca | | #undef alloca | |
| #define alloca _alloca | | #define alloca _alloca | |
| #endif /* __MWERKS__ */ | | #endif /* __MWERKS__ */ | |
| #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) | | #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) | |
| #define alloca __builtin_alloca | | #define alloca __builtin_alloca | |
| #endif /* GNUC */ | | #endif /* GNUC */ | |
| #define my_alloca(SZ) alloca((size_t) (SZ)) | | #define my_alloca(SZ) alloca((size_t) (SZ)) | |
| #define my_afree(PTR) {} | | #define my_afree(PTR) {} | |
| #else | | #else | |
|
| #define my_alloca(SZ) my_malloc(SZ,MYF(0)) | | #define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE)) | |
| #define my_afree(PTR) my_free(PTR,MYF(MY_WME)) | | #define my_afree(PTR) my_free(PTR) | |
| #endif /* HAVE_ALLOCA */ | | #endif /* HAVE_ALLOCA */ | |
| | | | |
| #ifndef errno /* did we already get it? */ | | #ifndef errno /* did we already get it? */ | |
| #ifdef HAVE_ERRNO_AS_DEFINE | | #ifdef HAVE_ERRNO_AS_DEFINE | |
| #include <errno.h> /* errno is a define */ | | #include <errno.h> /* errno is a define */ | |
| #else | | #else | |
| extern int errno; /* declare errno */ | | extern int errno; /* declare errno */ | |
| #endif | | #endif | |
| #endif /* #ifndef errno */ | | #endif /* #ifndef errno */ | |
| extern char *home_dir; /* Home directory for user */ | | extern char *home_dir; /* Home directory for user */ | |
| extern const char *my_progname; /* program-name (printed in
errors) */ | | 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 (*error_handler_hook)(uint my_err, const char *str,myf MyFlags)
; | |
| extern void (*fatal_error_handler_hook)(uint my_err, const char *str, | | extern void (*fatal_error_handler_hook)(uint my_err, const char *str, | |
| myf MyFlags); | | myf MyFlags); | |
| extern uint my_file_limit; | | extern uint my_file_limit; | |
| extern ulong my_thread_stack_size; | | extern ulong my_thread_stack_size; | |
| | | | |
| extern const char *(*proc_info_hook)(void *, const char *, const char *, | | extern const char *(*proc_info_hook)(void *, const char *, const char *, | |
| const char *, const unsigned int); | | const char *, const unsigned int); | |
| | | | |
| #ifdef HAVE_LARGE_PAGES | | #ifdef HAVE_LARGE_PAGES | |
| | | | |
| skipping to change at line 280 | | skipping to change at line 245 | |
| extern ulong my_file_total_opened; | | extern ulong my_file_total_opened; | |
| extern uint mysys_usage_id; | | extern uint mysys_usage_id; | |
| extern my_bool my_init_done; | | extern my_bool my_init_done; | |
| | | | |
| /* Point to current my_message() */ | | /* Point to current my_message() */ | |
| extern void (*my_sigtstp_cleanup)(void), | | extern void (*my_sigtstp_cleanup)(void), | |
| /* Executed before jump to shell */ | | /* Executed before jump to shell */ | |
| (*my_sigtstp_restart)(void), | | (*my_sigtstp_restart)(void), | |
| (*my_abort_hook)(int); | | (*my_abort_hook)(int); | |
| /* Executed when comming from shell
*/ | | /* Executed when comming from shell
*/ | |
|
| extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation | | extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation | |
| mask */ | | mask */ | |
| extern int NEAR my_umask_dir, | | extern int my_umask_dir, | |
| NEAR my_recived_signals, /* Signals we have got */ | | my_recived_signals, /* Signals we have got */ | |
| NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ | | my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ | |
| NEAR my_dont_interrupt; /* call remember_intr when set */ | | my_dont_interrupt; /* call remember_intr when set */ | |
| extern my_bool NEAR my_use_symdir; | | extern my_bool my_use_symdir; | |
| extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; | | | |
| | | | |
| extern ulong my_default_record_cache_size; | | extern ulong my_default_record_cache_size; | |
|
| extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, | | extern my_bool my_disable_locking, my_disable_async_io, | |
| NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; | | my_disable_flush_key_blocks, my_disable_symlinks; | |
| extern char wild_many,wild_one,wild_prefix; | | extern char wild_many,wild_one,wild_prefix; | |
| extern const char *charsets_dir; | | extern const char *charsets_dir; | |
| /* from default.c */ | | /* from default.c */ | |
|
| extern char *my_defaults_extra_file; | | extern const char *my_defaults_extra_file; | |
| extern const char *my_defaults_group_suffix; | | extern const char *my_defaults_group_suffix; | |
| extern const char *my_defaults_file; | | extern const char *my_defaults_file; | |
| | | | |
| extern my_bool timed_mutexes; | | extern my_bool timed_mutexes; | |
| | | | |
|
| typedef struct wild_file_pack /* Struct to hold info when selecting files | | | |
| */ | | | |
| { | | | |
| uint wilds; /* How many wildcards */ | | | |
| uint not_pos; /* Start of not-theese-files */ | | | |
| char * *wild; /* Pointer to wildcards */ | | | |
| } WF_PACK; | | | |
| | | | |
| enum loglevel { | | enum loglevel { | |
| ERROR_LEVEL, | | ERROR_LEVEL, | |
| WARNING_LEVEL, | | WARNING_LEVEL, | |
| INFORMATION_LEVEL | | INFORMATION_LEVEL | |
| }; | | }; | |
| | | | |
| enum cache_type | | enum cache_type | |
| { | | { | |
| TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, | | TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, | |
| SEQ_READ_APPEND /* sequential read or append */, | | SEQ_READ_APPEND /* sequential read or append */, | |
| | | | |
| skipping to change at line 601 | | skipping to change at line 558 | |
| | | | |
| /* Define the type of function to be passed to process_default_option_files
*/ | | /* Define the type of function to be passed to process_default_option_files
*/ | |
| typedef int (*Process_option_func)(void *ctx, const char *group_name, | | typedef int (*Process_option_func)(void *ctx, const char *group_name, | |
| const char *option); | | const char *option); | |
| | | | |
| #include <my_alloc.h> | | #include <my_alloc.h> | |
| | | | |
| /* Prototypes for mysys and my_func functions */ | | /* Prototypes for mysys and my_func functions */ | |
| | | | |
| extern int my_copy(const char *from,const char *to,myf MyFlags); | | extern int my_copy(const char *from,const char *to,myf MyFlags); | |
|
| extern int my_append(const char *from,const char *to,myf MyFlags); | | | |
| extern int my_delete(const char *name,myf MyFlags); | | extern int my_delete(const char *name,myf MyFlags); | |
| extern int my_getwd(char * buf,size_t size,myf MyFlags); | | extern int my_getwd(char * buf,size_t size,myf MyFlags); | |
| extern int my_setwd(const char *dir,myf MyFlags); | | extern int my_setwd(const char *dir,myf MyFlags); | |
| extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFla
gs); | | extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFla
gs); | |
| extern void *my_once_alloc(size_t Size,myf MyFlags); | | extern void *my_once_alloc(size_t Size,myf MyFlags); | |
| extern void my_once_free(void); | | extern void my_once_free(void); | |
| extern char *my_once_strdup(const char *src,myf myflags); | | extern char *my_once_strdup(const char *src,myf myflags); | |
| extern void *my_once_memdup(const void *src, size_t len, myf myflags); | | extern void *my_once_memdup(const void *src, size_t len, myf myflags); | |
| extern File my_open(const char *FileName,int Flags,myf MyFlags); | | extern File my_open(const char *FileName,int Flags,myf MyFlags); | |
| extern File my_register_filename(File fd, const char *FileName, | | extern File my_register_filename(File fd, const char *FileName, | |
| enum file_type type_of_file, | | enum file_type type_of_file, | |
| uint error_message_number, myf MyFlags); | | uint error_message_number, myf MyFlags); | |
| extern File my_create(const char *FileName,int CreateFlags, | | extern File my_create(const char *FileName,int CreateFlags, | |
| int AccessFlags, myf MyFlags); | | int AccessFlags, myf MyFlags); | |
| extern int my_close(File Filedes,myf MyFlags); | | extern int my_close(File Filedes,myf MyFlags); | |
|
| extern File my_dup(File file, myf MyFlags); | | | |
| extern int my_mkdir(const char *dir, int Flags, myf MyFlags); | | extern int my_mkdir(const char *dir, int Flags, myf MyFlags); | |
| extern int my_readlink(char *to, const char *filename, myf MyFlags); | | extern int my_readlink(char *to, const char *filename, myf MyFlags); | |
| extern int my_is_symlink(const char *filename); | | extern int my_is_symlink(const char *filename); | |
| extern int my_realpath(char *to, const char *filename, myf MyFlags); | | extern int my_realpath(char *to, const char *filename, myf MyFlags); | |
| extern File my_create_with_symlink(const char *linkname, const char *filena
me, | | extern File my_create_with_symlink(const char *linkname, const char *filena
me, | |
| int createflags, int access_flags, | | int createflags, int access_flags, | |
| myf MyFlags); | | myf MyFlags); | |
| extern int my_delete_with_symlink(const char *name, myf MyFlags); | | extern int my_delete_with_symlink(const char *name, myf MyFlags); | |
| extern int my_rename_with_symlink(const char *from,const char *to,myf MyFla
gs); | | extern int my_rename_with_symlink(const char *from,const char *to,myf MyFla
gs); | |
| extern int my_symlink(const char *content, const char *linkname, myf MyFlag
s); | | extern int my_symlink(const char *content, const char *linkname, myf MyFlag
s); | |
| | | | |
| skipping to change at line 643 | | skipping to change at line 598 | |
| extern my_off_t my_tell(File fd,myf MyFlags); | | extern my_off_t my_tell(File fd,myf MyFlags); | |
| extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, | | extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, | |
| myf MyFlags); | | myf MyFlags); | |
| extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, | | extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, | |
| my_off_t offset,myf MyFlags); | | my_off_t offset,myf MyFlags); | |
| extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags)
; | | extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags)
; | |
| extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, | | extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, | |
| myf MyFlags); | | myf MyFlags); | |
| extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,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 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 */ | | /* implemented in my_memmem.c */ | |
| extern void *my_memmem(const void *haystack, size_t haystacklen, | | extern void *my_memmem(const void *haystack, size_t haystacklen, | |
| const void *needle, size_t needlelen); | | const void *needle, size_t needlelen); | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| extern int my_access(const char *path, int amode); | | extern int my_access(const char *path, int amode); | |
| #else | | #else | |
| #define my_access access | | #define my_access access | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 684 | | skipping to change at line 625 | |
| #else | | #else | |
| #define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) | | #define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) | |
| #endif | | #endif | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| /* Windows-only functions (CRT equivalents)*/ | | /* Windows-only functions (CRT equivalents)*/ | |
| extern HANDLE my_get_osfhandle(File fd); | | extern HANDLE my_get_osfhandle(File fd); | |
| extern void my_osmaperr(unsigned long last_error); | | extern void my_osmaperr(unsigned long last_error); | |
| #endif | | #endif | |
| | | | |
|
| #ifndef TERMINATE | | | |
| extern void TERMINATE(FILE *file, uint flag); | | | |
| #endif | | | |
| extern void init_glob_errs(void); | | extern void init_glob_errs(void); | |
| extern const char** get_global_errmsgs(); | | extern const char** get_global_errmsgs(); | |
| extern void wait_for_free_space(const char *filename, int errors); | | extern void wait_for_free_space(const char *filename, int errors); | |
| extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); | | extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); | |
| extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags
); | | extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags
); | |
| extern int my_fclose(FILE *fd,myf MyFlags); | | extern int my_fclose(FILE *fd,myf MyFlags); | |
| extern File my_fileno(FILE *fd); | | extern File my_fileno(FILE *fd); | |
| extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); | | 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(File fd, myf my_flags); | |
| extern int my_sync_dir(const char *dir_name, 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 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_error(int nr,myf MyFlags, ...); | |
| extern void my_printf_error _VARARGS((uint my_err, const char *format, | | extern void my_printf_error(uint my_err, const char *format, | |
| myf MyFlags, ...)) | | myf MyFlags, ...) | |
| ATTRIBUTE_FORMAT(printf, 2, 4); | | ATTRIBUTE_FORMAT(printf, 2, 4); | |
| extern void my_printv_error(uint error, const char *format, myf MyFlags, | | extern void my_printv_error(uint error, const char *format, myf MyFlags, | |
| va_list ap); | | va_list ap); | |
| extern int my_error_register(const char** (*get_errmsgs) (), | | extern int my_error_register(const char** (*get_errmsgs) (), | |
| int first, int last); | | int first, int last); | |
| extern const char **my_error_unregister(int first, int last); | | extern const char **my_error_unregister(int first, int last); | |
| extern void my_message(uint my_err, const char *str,myf MyFlags); | | extern void my_message(uint my_err, const char *str,myf MyFlags); | |
| extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); | | extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); | |
| extern my_bool my_basic_init(void); | | extern my_bool my_basic_init(void); | |
| extern my_bool my_init(void); | | extern my_bool my_init(void); | |
| extern void my_end(int infoflag); | | extern void my_end(int infoflag); | |
| | | | |
| skipping to change at line 762 | | skipping to change at line 700 | |
| extern size_t unpack_filename(char * to,const char *from); | | extern size_t unpack_filename(char * to,const char *from); | |
| extern char * intern_filename(char * to,const char *from); | | extern char * intern_filename(char * to,const char *from); | |
| extern char * directory_file_name(char * dst, const char *src); | | extern char * directory_file_name(char * dst, const char *src); | |
| extern int pack_filename(char * to, const char *name, size_t max_length); | | extern int pack_filename(char * to, const char *name, size_t max_length); | |
| extern char * my_path(char * to,const char *progname, | | extern char * my_path(char * to,const char *progname, | |
| const char *own_pathname_part); | | const char *own_pathname_part); | |
| extern char * my_load_path(char * to, const char *path, | | extern char * my_load_path(char * to, const char *path, | |
| const char *own_path_prefix); | | const char *own_path_prefix); | |
| extern int wild_compare(const char *str,const char *wildstr, | | extern int wild_compare(const char *str,const char *wildstr, | |
| pbool str_is_pattern); | | pbool str_is_pattern); | |
|
| extern WF_PACK *wf_comp(char * str); | | | |
| extern int wf_test(struct wild_file_pack *wf_pack,const char *name); | | | |
| extern void wf_end(struct wild_file_pack *buffer); | | | |
| extern my_bool array_append_string_unique(const char *str, | | extern my_bool array_append_string_unique(const char *str, | |
| const char **array, size_t size); | | const char **array, size_t size); | |
| extern void get_date(char * to,int timeflag,time_t use_time); | | extern void get_date(char * to,int timeflag,time_t use_time); | |
| extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, | | extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, | |
| pbool remove_garbage); | | pbool remove_garbage); | |
| extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, | | extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, | |
| size_t reclength,enum cache_type type, | | size_t reclength,enum cache_type type, | |
| pbool use_async_io); | | pbool use_async_io); | |
| extern int read_cache_record(RECORD_CACHE *info,uchar *to); | | extern int read_cache_record(RECORD_CACHE *info,uchar *to); | |
| extern int end_record_cache(RECORD_CACHE *info); | | extern int end_record_cache(RECORD_CACHE *info); | |
| extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, | | extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, | |
| const uchar *record,size_t length); | | const uchar *record,size_t length); | |
| extern int flush_write_cache(RECORD_CACHE *info); | | extern int flush_write_cache(RECORD_CACHE *info); | |
|
| extern long my_clock(void); | | | |
| extern sig_handler sigtstp_handler(int signal_number); | | | |
| extern void handle_recived_signals(void); | | extern void handle_recived_signals(void); | |
| | | | |
| extern sig_handler my_set_alarm_variable(int signo); | | extern sig_handler my_set_alarm_variable(int signo); | |
| extern void my_string_ptr_sort(uchar *base,uint items,size_t size); | | extern void my_string_ptr_sort(uchar *base,uint items,size_t size); | |
| extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, | | extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, | |
| size_t size_of_element,uchar *buffer[]); | | size_t size_of_element,uchar *buffer[]); | |
| extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size, | | extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size, | |
| qsort_cmp cmp); | | qsort_cmp cmp); | |
| extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size, | | extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size, | |
| qsort2_cmp cmp, void *cmp_argument); | | qsort2_cmp cmp, void *cmp_argument); | |
| | | | |
| skipping to change at line 835 | | skipping to change at line 768 | |
| extern my_off_t my_b_filelength(IO_CACHE *info); | | extern my_off_t my_b_filelength(IO_CACHE *info); | |
| extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...); | | extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...); | |
| extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); | | extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); | |
| extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, | | extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, | |
| const char *prefix, size_t cache_size, | | const char *prefix, size_t cache_size, | |
| myf cache_myflags); | | myf cache_myflags); | |
| extern my_bool real_open_cached_file(IO_CACHE *cache); | | extern my_bool real_open_cached_file(IO_CACHE *cache); | |
| extern void close_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, | | File create_temp_file(char *to, const char *dir, const char *pfx, | |
| int mode, myf MyFlags); | | int mode, myf MyFlags); | |
|
| #define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CAL | | #define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D) | |
| LER_INFO) | | #define my_init_dynamic_array_ci(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) | |
| ORIG_CALLER_INFO) | | #define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E) | |
| #define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CAL | | extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, | |
| LER_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, | | void *init_buffer, uint init_alloc, | |
|
| uint alloc_increment | | uint alloc_increment); | |
| CALLER_INFO_PROTO); | | | |
| /* init_dynamic_array() function is deprecated */ | | /* init_dynamic_array() function is deprecated */ | |
|
| extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, | | extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, | |
| uint init_alloc,uint alloc_increment | | uint init_alloc, uint alloc_increment); | |
| CALLER_INFO_PROTO); | | | |
| extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element); | | extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element); | |
| extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); | | extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); | |
| extern uchar *pop_dynamic(DYNAMIC_ARRAY*); | | extern uchar *pop_dynamic(DYNAMIC_ARRAY*); | |
| extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_
index); | | extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_
index); | |
| extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements); | | extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements); | |
| extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_ind
ex); | | extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_ind
ex); | |
| extern void delete_dynamic(DYNAMIC_ARRAY *array); | | extern void delete_dynamic(DYNAMIC_ARRAY *array); | |
| extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); | | extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); | |
| extern void freeze_size(DYNAMIC_ARRAY *array); | | extern void freeze_size(DYNAMIC_ARRAY *array); | |
| extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element); | | extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element); | |
| | | | |
| skipping to change at line 876 | | skipping to change at line 807 | |
| my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, | | my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, | |
| size_t length); | | size_t length); | |
| extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *app
end, | | extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *app
end, | |
| ...); | | ...); | |
| extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); | | extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); | |
| extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); | | extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); | |
| extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); | | extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); | |
| extern void dynstr_free(DYNAMIC_STRING *str); | | extern void dynstr_free(DYNAMIC_STRING *str); | |
| #ifdef HAVE_MLOCK | | #ifdef HAVE_MLOCK | |
| extern void *my_malloc_lock(size_t length,myf flags); | | 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 | | #else | |
| #define my_malloc_lock(A,B) my_malloc((A),(B)) | | #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 | | #endif | |
| #define alloc_root_inited(A) ((A)->min_malloc != 0) | | #define alloc_root_inited(A) ((A)->min_malloc != 0) | |
| #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) | | #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) | |
| #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (
A)->min_malloc=0;} while(0) | | #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (
A)->min_malloc=0;} while(0) | |
| extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, | | extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, | |
| size_t pre_alloc_size); | | size_t pre_alloc_size); | |
| extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); | | extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); | |
| extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); | | extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); | |
| extern void free_root(MEM_ROOT *root, myf MyFLAGS); | | extern void free_root(MEM_ROOT *root, myf MyFLAGS); | |
| extern void set_prealloc_root(MEM_ROOT *root, char *ptr); | | extern void set_prealloc_root(MEM_ROOT *root, char *ptr); | |
| extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, | | extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, | |
| size_t prealloc_size); | | size_t prealloc_size); | |
| extern char *strdup_root(MEM_ROOT *root,const char *str); | | extern char *strdup_root(MEM_ROOT *root,const char *str); | |
|
| | | static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) | |
| | | { | |
| | | return str ? strdup_root(root, str) : 0; | |
| | | } | |
| extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); | | extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); | |
| extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); | | extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); | |
| extern int get_defaults_options(int argc, char **argv, | | extern int get_defaults_options(int argc, char **argv, | |
| char **defaults, char **extra_defaults, | | char **defaults, char **extra_defaults, | |
| char **group_suffix); | | char **group_suffix); | |
| extern const char *args_separator; | | extern const char *args_separator; | |
| extern int my_load_defaults(const char *conf_file, const char **groups, | | extern int my_load_defaults(const char *conf_file, const char **groups, | |
| int *argc, char ***argv, const char ***); | | int *argc, char ***argv, const char ***); | |
| extern int load_defaults(const char *conf_file, const char **groups, | | extern int load_defaults(const char *conf_file, const char **groups, | |
| int *argc, char ***argv); | | int *argc, char ***argv); | |
|
| extern int modify_defaults_file(const char *file_location, const char *opti | | | |
| on, | | | |
| const char *option_value, | | | |
| const char *section_name, int remove_option | | | |
| ); | | | |
| extern int my_search_option_files(const char *conf_file, int *argc, | | extern int my_search_option_files(const char *conf_file, int *argc, | |
| char ***argv, uint *args_used, | | char ***argv, uint *args_used, | |
| Process_option_func func, void *func_ctx, | | Process_option_func func, void *func_ctx, | |
| const char **default_directories); | | const char **default_directories); | |
| extern void free_defaults(char **argv); | | extern void free_defaults(char **argv); | |
| extern void my_print_default_files(const char *conf_file); | | extern void my_print_default_files(const char *conf_file); | |
| extern void print_defaults(const char *conf_file, const char **groups); | | extern void print_defaults(const char *conf_file, const char **groups); | |
| extern my_bool my_compress(uchar *, size_t *, size_t *); | | extern my_bool my_compress(uchar *, size_t *, size_t *); | |
| extern my_bool my_uncompress(uchar *, size_t , size_t *); | | extern my_bool my_uncompress(uchar *, size_t , size_t *); | |
| extern uchar *my_compress_alloc(const uchar *packet, size_t *len, | | extern uchar *my_compress_alloc(const uchar *packet, size_t *len, | |
| | | | |
| skipping to change at line 963 | | skipping to change at line 895 | |
| /* not a complete set of mmap() flags, but only those that nesessary */ | | /* not a complete set of mmap() flags, but only those that nesessary */ | |
| #define PROT_READ 1 | | #define PROT_READ 1 | |
| #define PROT_WRITE 2 | | #define PROT_WRITE 2 | |
| #define MAP_NORESERVE 0 | | #define MAP_NORESERVE 0 | |
| #define MAP_SHARED 0x0001 | | #define MAP_SHARED 0x0001 | |
| #define MAP_PRIVATE 0x0002 | | #define MAP_PRIVATE 0x0002 | |
| #define MAP_NOSYNC 0x0800 | | #define MAP_NOSYNC 0x0800 | |
| #define MAP_FAILED ((void *)-1) | | #define MAP_FAILED ((void *)-1) | |
| #define MS_SYNC 0x0000 | | #define MS_SYNC 0x0000 | |
| | | | |
|
| #ifndef __NETWARE__ | | | |
| #define HAVE_MMAP | | #define HAVE_MMAP | |
|
| #endif | | | |
| | | | |
| void *my_mmap(void *, size_t, int, int, int, my_off_t); | | void *my_mmap(void *, size_t, int, int, int, my_off_t); | |
| int my_munmap(void *, size_t); | | int my_munmap(void *, size_t); | |
| #endif | | #endif | |
| | | | |
| /* my_getpagesize */ | | /* my_getpagesize */ | |
| #ifdef HAVE_GETPAGESIZE | | #ifdef HAVE_GETPAGESIZE | |
| #define my_getpagesize() getpagesize() | | #define my_getpagesize() getpagesize() | |
| #else | | #else | |
| int my_getpagesize(void); | | int my_getpagesize(void); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1031 | | skipping to change at line 960 | |
| | | | |
| int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, | | int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, | |
| DWORD owner_rights, DWORD everybody_rights); | | DWORD owner_rights, DWORD everybody_rights); | |
| | | | |
| void my_security_attr_free(SECURITY_ATTRIBUTES *sa); | | void my_security_attr_free(SECURITY_ATTRIBUTES *sa); | |
| | | | |
| /* implemented in my_conio.c */ | | /* implemented in my_conio.c */ | |
| char* my_cgets(char *string, size_t clen, size_t* plen); | | char* my_cgets(char *string, size_t clen, size_t* plen); | |
| | | | |
| #endif | | #endif | |
|
| #ifdef __NETWARE__ | | | |
| void netware_reg_user(const char *ip, const char *user, | | | |
| const char *application); | | | |
| #endif | | | |
| | | | |
| #include <mysql/psi/psi.h> | | #include <mysql/psi/psi.h> | |
| | | | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; | | extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; | |
| void my_init_mysys_psi_keys(void); | | void my_init_mysys_psi_keys(void); | |
| #endif | | #endif | |
| | | | |
| struct st_mysql_file; | | struct st_mysql_file; | |
| extern struct st_mysql_file *mysql_stdin; | | extern struct st_mysql_file *mysql_stdin; | |
| | | | |
End of changes. 33 change blocks. |
| 120 lines changed or deleted | | 37 lines changed or added | |
|
| mysql.h | | mysql.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A */ | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A */ | |
| | | | |
| /* | | /* | |
| This file defines the client API to MySQL and also the ABI of the | | This file defines the client API to MySQL and also the ABI of the | |
| dynamically linked libmysqlclient. | | dynamically linked libmysqlclient. | |
| | | | |
|
| The ABI should never be changed in a released product of MySQL | | The ABI should never be changed in a released product of MySQL, | |
| thus you need to take great care when changing the file. In case | | thus you need to take great care when changing the file. In case | |
|
| the file is changed so the ABI is broken, you must also | | the file is changed so the ABI is broken, you must also update | |
| update the SHAREDLIB_MAJOR_VERSION in configure.in . | | the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef _mysql_h | | #ifndef _mysql_h | |
| #define _mysql_h | | #define _mysql_h | |
| | | | |
| #ifdef _AIX /* large-file support will break without this */ | | #ifdef _AIX /* large-file support will break without this */ | |
| #include <standards.h> | | #include <standards.h> | |
| #endif | | #endif | |
| | | | |
| #ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ | | #ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 46 | |
| #undef _WIN32 | | #undef _WIN32 | |
| #undef _WIN64 | | #undef _WIN64 | |
| #undef __WIN__ | | #undef __WIN__ | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #ifndef _global_h /* If not standard header */ | | #ifndef _global_h /* If not standard header */ | |
|
| | | #ifndef MYSQL_ABI_CHECK | |
| #include <sys/types.h> | | #include <sys/types.h> | |
|
| | | #endif | |
| #ifdef __LCC__ | | #ifdef __LCC__ | |
| #include <winsock2.h> /* For windows */ | | #include <winsock2.h> /* For windows */ | |
| #endif | | #endif | |
| typedef char my_bool; | | typedef char my_bool; | |
| #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) | | #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) | |
| #define __WIN__ | | #define __WIN__ | |
| #endif | | #endif | |
| #if !defined(__WIN__) | | #if !defined(__WIN__) | |
| #define STDCALL | | #define STDCALL | |
| #else | | #else | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 83 | |
| #include "mysql_time.h" | | #include "mysql_time.h" | |
| | | | |
| #include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ | | #include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ | |
| | | | |
| extern unsigned int mysql_port; | | extern unsigned int mysql_port; | |
| extern char *mysql_unix_port; | | extern char *mysql_unix_port; | |
| | | | |
| #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout o
n read */ | | #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout o
n read */ | |
| #define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write
*/ | | #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_PRI_KEY(n) ((n) & PRI_KEY_FLAG) | |
| #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) | | #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) | |
| #define IS_BLOB(n) ((n) & BLOB_FLAG) | | #define IS_BLOB(n) ((n) & BLOB_FLAG) | |
| /** | | /** | |
| Returns true if the value is a number which does not need quotes for | | Returns true if the value is a number which does not need quotes for | |
| the sql_lex.cc parser to parse correctly. | | the sql_lex.cc parser to parse correctly. | |
| */ | | */ | |
| #define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMES
TAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) | | #define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMES
TAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) | |
| #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_ST
RING) | | #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_ST
RING) | |
| | | | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 168 | |
| enum mysql_option | | enum mysql_option | |
| { | | { | |
| MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, | | MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, | |
| MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, | | MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, | |
| MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, | | MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, | |
| MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT
, | | MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT
, | |
| MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, | | MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, | |
| MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, | | MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, | |
| MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, | | MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, | |
| MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, | | MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, | |
|
| MYSQL_OPT_SSL_VERIFY_SERVER_CERT | | MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | @todo remove the "extension", move st_mysql_options completely | |
| | | out of mysql.h | |
| | | */ | |
| | | struct st_mysql_options_extention; | |
| | | | |
| struct st_mysql_options { | | struct st_mysql_options { | |
| unsigned int connect_timeout, read_timeout, write_timeout; | | unsigned int connect_timeout, read_timeout, write_timeout; | |
| unsigned int port, protocol; | | unsigned int port, protocol; | |
| unsigned long client_flag; | | unsigned long client_flag; | |
| char *host,*user,*password,*unix_socket,*db; | | char *host,*user,*password,*unix_socket,*db; | |
| struct st_dynamic_array *init_commands; | | struct st_dynamic_array *init_commands; | |
| char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; | | char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; | |
| char *ssl_key; /* PEM key file */ | | char *ssl_key; /* PEM key file */ | |
| char *ssl_cert; /* PEM cert file */ | | char *ssl_cert; /* PEM cert file */ | |
| char *ssl_ca; /* PEM CA file */ | | char *ssl_ca; /* PEM CA file */ | |
| | | | |
| skipping to change at line 207 | | skipping to change at line 210 | |
| my_bool secure_auth; | | my_bool secure_auth; | |
| /* 0 - never report, 1 - always report (default) */ | | /* 0 - never report, 1 - always report (default) */ | |
| my_bool report_data_truncation; | | my_bool report_data_truncation; | |
| | | | |
| /* function pointers for local infile support */ | | /* function pointers for local infile support */ | |
| int (*local_infile_init)(void **, const char *, void *); | | int (*local_infile_init)(void **, const char *, void *); | |
| int (*local_infile_read)(void *, char *, unsigned int); | | int (*local_infile_read)(void *, char *, unsigned int); | |
| void (*local_infile_end)(void *); | | void (*local_infile_end)(void *); | |
| int (*local_infile_error)(void *, char *, unsigned int); | | int (*local_infile_error)(void *, char *, unsigned int); | |
| void *local_infile_userdata; | | void *local_infile_userdata; | |
|
| void *extension; | | struct st_mysql_options_extention *extension; | |
| }; | | }; | |
| | | | |
| enum mysql_status | | enum mysql_status | |
| { | | { | |
|
| MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT | | MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, | |
| | | MYSQL_STATUS_STATEMENT_GET_RESULT | |
| }; | | }; | |
| | | | |
| enum mysql_protocol_type | | enum mysql_protocol_type | |
| { | | { | |
| MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, | | MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, | |
| MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY | | MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY | |
| }; | | }; | |
| | | | |
| typedef struct character_set | | typedef struct character_set | |
| { | | { | |
| | | | |
| skipping to change at line 635 | | skipping to change at line 639 | |
| etc) | | etc) | |
| */ | | */ | |
| STMT_ATTR_CURSOR_TYPE, | | STMT_ATTR_CURSOR_TYPE, | |
| /* | | /* | |
| Amount of rows to retrieve from server per one fetch if using cursors. | | Amount of rows to retrieve from server per one fetch if using cursors. | |
| Accepts unsigned long attribute in the range 1 - ulong_max | | Accepts unsigned long attribute in the range 1 - ulong_max | |
| */ | | */ | |
| STMT_ATTR_PREFETCH_ROWS | | STMT_ATTR_PREFETCH_ROWS | |
| }; | | }; | |
| | | | |
|
| typedef struct st_mysql_methods | | | |
| { | | | |
| my_bool (*read_query_result)(MYSQL *mysql); | | | |
| my_bool (*advanced_command)(MYSQL *mysql, | | | |
| enum enum_server_command command, | | | |
| const unsigned char *header, | | | |
| unsigned long header_length, | | | |
| const unsigned char *arg, | | | |
| unsigned long arg_length, | | | |
| my_bool skip_check, | | | |
| MYSQL_STMT *stmt); | | | |
| MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, | | | |
| unsigned int fields); | | | |
| MYSQL_RES * (*use_result)(MYSQL *mysql); | | | |
| void (*fetch_lengths)(unsigned long *to, | | | |
| MYSQL_ROW column, unsigned int field_count); | | | |
| void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results); | | | |
| #if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) | | | |
| MYSQL_FIELD * (*list_fields)(MYSQL *mysql); | | | |
| my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); | | | |
| int (*stmt_execute)(MYSQL_STMT *stmt); | | | |
| int (*read_binary_rows)(MYSQL_STMT *stmt); | | | |
| int (*unbuffered_fetch)(MYSQL *mysql, char **row); | | | |
| void (*free_embedded_thd)(MYSQL *mysql); | | | |
| const char *(*read_statistics)(MYSQL *mysql); | | | |
| my_bool (*next_result)(MYSQL *mysql); | | | |
| int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *pass | | | |
| wd); | | | |
| int (*read_rows_from_cursor)(MYSQL_STMT *stmt); | | | |
| #endif | | | |
| } MYSQL_METHODS; | | | |
| | | | |
| MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); | | MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); | |
| int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, | | int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, | |
| unsigned long length); | | unsigned long length); | |
| int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); | | int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); | |
| int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); | | int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); | |
| int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, | | int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, | |
| unsigned int column, | | unsigned int column, | |
| unsigned long offset); | | unsigned long offset); | |
| int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); | | int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); | |
| unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); | | unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); | |
| | | | |
| skipping to change at line 727 | | skipping to change at line 700 | |
| #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) | | #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) | |
| | | | |
| #ifdef USE_OLD_FUNCTIONS | | #ifdef USE_OLD_FUNCTIONS | |
| MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host
, | | MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host
, | |
| const char *user, const char *passwd); | | const char *user, const char *passwd); | |
| int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); | | int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); | |
| int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); | | int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); | |
| #endif | | #endif | |
| #define HAVE_MYSQL_REAL_CONNECT | | #define HAVE_MYSQL_REAL_CONNECT | |
| | | | |
|
| /* | | | |
| The following functions are mainly exported because of mysqlbinlog; | | | |
| They are not for general usage | | | |
| */ | | | |
| | | | |
| #define simple_command(mysql, command, arg, length, skip_check) \ | | | |
| (*(mysql)->methods->advanced_command)(mysql, command, 0, \ | | | |
| 0, arg, length, skip_check, NULL) | | | |
| #define stmt_command(mysql, command, arg, length, stmt) \ | | | |
| (*(mysql)->methods->advanced_command)(mysql, command, 0, \ | | | |
| 0, arg, length, 1, stmt) | | | |
| | | | |
| #ifdef __NETWARE__ | | | |
| #pragma pack(pop) /* restore alignment */ | | | |
| #endif | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* _mysql_h */ | | #endif /* _mysql_h */ | |
| | | | |
End of changes. 11 change blocks. |
| 59 lines changed or deleted | | 15 lines changed or added | |
|
| mysql_file.h | | mysql_file.h | |
|
| /* Copyright (C) 2008-2009 Sun Microsystems, Inc | | /* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reser
ved. | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; version 2 of the License. | | the Free Software Foundation; version 2 of the License. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software Foundation, | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ | |
| */ | | | |
| | | | |
| #ifndef MYSQL_FILE_H | | #ifndef MYSQL_FILE_H | |
| #define MYSQL_FILE_H | | #define MYSQL_FILE_H | |
| | | | |
| /* For strlen() */ | | /* For strlen() */ | |
| #include <string.h> | | #include <string.h> | |
| /* For MY_STAT */ | | /* For MY_STAT */ | |
| #include <my_dir.h> | | #include <my_dir.h> | |
| /* For my_chsize */ | | /* For my_chsize */ | |
| #include <my_sys.h> | | #include <my_sys.h> | |
| | | | |
| skipping to change at line 509 | | skipping to change at line 509 | |
| static inline char * | | static inline char * | |
| inline_mysql_file_fgets( | | inline_mysql_file_fgets( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| char *str, int size, MYSQL_FILE *file) | | char *str, int size, MYSQL_FILE *file) | |
| { | | { | |
| char *result; | | char *result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_READ); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line
); | | PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line
); | |
| } | | } | |
| #endif | | #endif | |
| result= fgets(str, size, file->m_file); | | result= fgets(str, size, file->m_file); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, result ? strlen(result) : 0); | | PSI_server->end_file_wait(locker, result ? strlen(result) : 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 535 | | skipping to change at line 536 | |
| static inline int | | static inline int | |
| inline_mysql_file_fgetc( | | inline_mysql_file_fgetc( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file) | | MYSQL_FILE *file) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_READ); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= fgetc(file->m_file); | | result= fgetc(file->m_file); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 1); | | PSI_server->end_file_wait(locker, (size_t) 1); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 561 | | skipping to change at line 563 | |
| static inline int | | static inline int | |
| inline_mysql_file_fputs( | | inline_mysql_file_fputs( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *str, MYSQL_FILE *file) | | const char *str, MYSQL_FILE *file) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| size_t bytes= 0; | | size_t bytes= 0; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| bytes= str ? strlen(str) : 0; | | bytes= str ? strlen(str) : 0; | |
| PSI_server->start_file_wait(locker, bytes, src_file, src_line); | | PSI_server->start_file_wait(locker, bytes, src_file, src_line); | |
| } | | } | |
| } | | } | |
| #endif | | #endif | |
| result= fputs(str, file->m_file); | | result= fputs(str, file->m_file); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| | | | |
| skipping to change at line 591 | | skipping to change at line 594 | |
| static inline int | | static inline int | |
| inline_mysql_file_fputc( | | inline_mysql_file_fputc( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| char c, MYSQL_FILE *file) | | char c, MYSQL_FILE *file) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= fputc(c, file->m_file); | | result= fputc(c, file->m_file); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 1); | | PSI_server->end_file_wait(locker, (size_t) 1); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 617 | | skipping to change at line 621 | |
| static inline int | | static inline int | |
| inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) | | inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) | |
| { | | { | |
| /* | | /* | |
| TODO: figure out how to pass src_file and src_line from the caller. | | TODO: figure out how to pass src_file and src_line from the caller. | |
| */ | | */ | |
| int result; | | int result; | |
| va_list args; | | va_list args; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__); | | PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__); | |
| } | | } | |
| #endif | | #endif | |
| va_start(args, format); | | va_start(args, format); | |
| result= vfprintf(file->m_file, format, args); | | result= vfprintf(file->m_file, format, args); | |
| va_end(args); | | va_end(args); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| | | | |
| skipping to change at line 645 | | skipping to change at line 650 | |
| static inline int | | static inline int | |
| inline_mysql_file_vfprintf( | | inline_mysql_file_vfprintf( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, const char *format, va_list args) | | MYSQL_FILE *file, const char *format, va_list args) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= vfprintf(file->m_file, format, args); | | result= vfprintf(file->m_file, format, args); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) result); | | PSI_server->end_file_wait(locker, (size_t) result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 671 | | skipping to change at line 677 | |
| static inline int | | static inline int | |
| inline_mysql_file_fflush( | | inline_mysql_file_fflush( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file) | | MYSQL_FILE *file) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_FLUSH); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= fflush(file->m_file); | | result= fflush(file->m_file); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 703 | | skipping to change at line 710 | |
| static inline int | | static inline int | |
| inline_mysql_file_fstat( | | inline_mysql_file_fstat( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| int filenr, MY_STAT *stat_area, myf flags) | | int filenr, MY_STAT *stat_area, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_FSTAT); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_fstat(filenr, stat_area, flags); | | result= my_fstat(filenr, stat_area, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 737 | |
| static inline MY_STAT * | | static inline MY_STAT * | |
| inline_mysql_file_stat( | | inline_mysql_file_stat( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *path, MY_STAT *stat_area, myf flags) | | const char *path, MY_STAT *stat_area, myf flags) | |
| { | | { | |
| MY_STAT *result; | | MY_STAT *result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | path, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_open_wait(locker, src_file, src_line); | | PSI_server->start_file_open_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_stat(path, stat_area, flags); | | result= my_stat(path, stat_area, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 755 | | skipping to change at line 765 | |
| static inline int | | static inline int | |
| inline_mysql_file_chsize( | | inline_mysql_file_chsize( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, my_off_t newlength, int filler, myf flags) | | File file, my_off_t newlength, int filler, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_CHSIZE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) newlength, src_file, | | PSI_server->start_file_wait(locker, (size_t) newlength, src_file, | |
| src_line); | | src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_chsize(file, newlength, filler, flags); | | result= my_chsize(file, newlength, filler, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) newlength); | | PSI_server->end_file_wait(locker, (size_t) newlength); | |
| | | | |
| skipping to change at line 787 | | skipping to change at line 798 | |
| const char *filename, int flags, myf myFlags) | | const char *filename, int flags, myf myFlags) | |
| { | | { | |
| MYSQL_FILE *that; | | MYSQL_FILE *that; | |
| that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME)); | | that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME)); | |
| if (likely(that != NULL)) | | if (likely(that != NULL)) | |
| { | | { | |
| that->m_psi= NULL; | | that->m_psi= NULL; | |
| { | | { | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | if (likely(PSI_server != NULL)) | |
| { | | { | |
| locker= PSI_server->get_thread_file_name_locker | | 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)) | | if (likely(locker != NULL)) | |
| that->m_psi= PSI_server->start_file_open_wait(locker, src_file, | | that->m_psi= PSI_server->start_file_open_wait(locker, src_file, | |
| src_line); | | src_line); | |
| } | | } | |
| #endif | | #endif | |
| that->m_file= my_fopen(filename, flags, myFlags); | | that->m_file= my_fopen(filename, flags, myFlags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_open_wait(locker); | | PSI_server->end_file_open_wait(locker); | |
| #endif | | #endif | |
| if (unlikely(that->m_file == NULL)) | | if (unlikely(that->m_file == NULL)) | |
| { | | { | |
|
| my_free(that, MYF(0)); | | my_free(that); | |
| return NULL; | | return NULL; | |
| } | | } | |
| } | | } | |
| } | | } | |
| return that; | | return that; | |
| } | | } | |
| | | | |
| static inline int | | static inline int | |
| inline_mysql_file_fclose( | | inline_mysql_file_fclose( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, myf flags) | | MYSQL_FILE *file, myf flags) | |
| { | | { | |
| int result= 0; | | int result= 0; | |
| if (likely(file != NULL)) | | if (likely(file != NULL)) | |
| { | | { | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| DBUG_ASSERT(file != NULL); | | DBUG_ASSERT(file != NULL); | |
| if (likely(PSI_server && file->m_psi)) | | 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_CLO
SE); | | PSI_FILE_STREAM_CLO
SE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line)
; | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line)
; | |
| } | | } | |
| #endif | | #endif | |
| result= my_fclose(file->m_file, flags); | | result= my_fclose(file->m_file, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
|
| my_free(file, MYF(0)); | | my_free(file); | |
| } | | } | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_fread( | | inline_mysql_file_fread( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) | | MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) | |
| { | | { | |
| size_t result= 0; | | size_t result= 0; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_READ); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_fread(file->m_file, buffer, count, flags); | | result= my_fread(file->m_file, buffer, count, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_read; | | size_t bytes_read; | |
| | | | |
| skipping to change at line 885 | | skipping to change at line 899 | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_fwrite( | | inline_mysql_file_fwrite( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) | | MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) | |
| { | | { | |
| size_t result= 0; | | size_t result= 0; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_fwrite(file->m_file, buffer, count, flags); | | result= my_fwrite(file->m_file, buffer, count, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_written; | | size_t bytes_written; | |
| | | | |
| skipping to change at line 918 | | skipping to change at line 933 | |
| static inline my_off_t | | static inline my_off_t | |
| inline_mysql_file_fseek( | | inline_mysql_file_fseek( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, my_off_t pos, int whence, myf flags) | | MYSQL_FILE *file, my_off_t pos, int whence, myf flags) | |
| { | | { | |
| my_off_t result; | | my_off_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_SEEK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_fseek(file->m_file, pos, whence, flags); | | result= my_fseek(file->m_file, pos, whence, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 944 | | skipping to change at line 960 | |
| static inline my_off_t | | static inline my_off_t | |
| inline_mysql_file_ftell( | | inline_mysql_file_ftell( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| MYSQL_FILE *file, myf flags) | | MYSQL_FILE *file, myf flags) | |
| { | | { | |
| my_off_t result; | | my_off_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server && file->m_psi)) | | 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); | | PSI_FILE_TELL); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_ftell(file->m_file, flags); | | result= my_ftell(file->m_file, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 970 | | skipping to change at line 987 | |
| static inline File | | static inline File | |
| inline_mysql_file_create( | | inline_mysql_file_create( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *filename, int create_flags, int access_flags, myf myFlags) | | const char *filename, int create_flags, int access_flags, myf myFlags) | |
| { | | { | |
| File file; | | File file; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_C
REATE, | |
| filename, &locker); | | filename, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_open_wait(locker, src_file, src_line); | | PSI_server->start_file_open_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| file= my_create(filename, create_flags, access_flags, myFlags); | | file= my_create(filename, create_flags, access_flags, myFlags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | | PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1017 | | skipping to change at line 1035 | |
| static inline File | | static inline File | |
| inline_mysql_file_open( | | inline_mysql_file_open( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *filename, int flags, myf myFlags) | | const char *filename, int flags, myf myFlags) | |
| { | | { | |
| File file; | | File file; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_O
PEN, | |
| filename, &locker); | | filename, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_open_wait(locker, src_file, src_line); | | PSI_server->start_file_open_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| file= my_open(filename, flags, myFlags); | | file= my_open(filename, flags, myFlags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | | PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1043 | | skipping to change at line 1062 | |
| static inline int | | static inline int | |
| inline_mysql_file_close( | | inline_mysql_file_close( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, myf flags) | | File file, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_CLOSE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_close(file, flags); | | result= my_close(file, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1069 | | skipping to change at line 1089 | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_read( | | inline_mysql_file_read( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, uchar *buffer, size_t count, myf flags) | | File file, uchar *buffer, size_t count, myf flags) | |
| { | | { | |
| size_t result= 0; | | size_t result= 0; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_READ); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_read(file, buffer, count, flags); | | result= my_read(file, buffer, count, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_read; | | size_t bytes_read; | |
| | | | |
| skipping to change at line 1102 | | skipping to change at line 1123 | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_write( | | inline_mysql_file_write( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, const uchar *buffer, size_t count, myf flags) | | File file, const uchar *buffer, size_t count, myf flags) | |
| { | | { | |
| size_t result; | | size_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_write(file, buffer, count, flags); | | result= my_write(file, buffer, count, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_written; | | size_t bytes_written; | |
| | | | |
| skipping to change at line 1135 | | skipping to change at line 1157 | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_pread( | | inline_mysql_file_pread( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, uchar *buffer, size_t count, my_off_t offset, myf flags) | | File file, uchar *buffer, size_t count, my_off_t offset, myf flags) | |
| { | | { | |
| size_t result; | | size_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | if (likely(PSI_server != NULL)) | |
| { | | { | |
|
| locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_RE
AD); | | locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI
_FILE_READ); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_pread(file, buffer, count, offset, flags); | | result= my_pread(file, buffer, count, offset, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_read; | | size_t bytes_read; | |
| if (flags & (MY_NABP | MY_FNABP)) | | if (flags & (MY_NABP | MY_FNABP)) | |
| | | | |
| skipping to change at line 1167 | | skipping to change at line 1190 | |
| static inline size_t | | static inline size_t | |
| inline_mysql_file_pwrite( | | inline_mysql_file_pwrite( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) | | File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) | |
| { | | { | |
| size_t result; | | size_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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); | | PSI_FILE_WRITE); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, count, src_file, src_line); | | PSI_server->start_file_wait(locker, count, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_pwrite(file, buffer, count, offset, flags); | | result= my_pwrite(file, buffer, count, offset, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| { | | { | |
| size_t bytes_written; | | size_t bytes_written; | |
| | | | |
| skipping to change at line 1200 | | skipping to change at line 1224 | |
| static inline my_off_t | | static inline my_off_t | |
| inline_mysql_file_seek( | | inline_mysql_file_seek( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, my_off_t pos, int whence, myf flags) | | File file, my_off_t pos, int whence, myf flags) | |
| { | | { | |
| my_off_t result; | | my_off_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | if (likely(PSI_server != NULL)) | |
| { | | { | |
|
| locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_SE
EK); | | locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI
_FILE_SEEK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_seek(file, pos, whence, flags); | | result= my_seek(file, pos, whence, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| return result; | | return result; | |
| | | | |
| skipping to change at line 1225 | | skipping to change at line 1250 | |
| static inline my_off_t | | static inline my_off_t | |
| inline_mysql_file_tell( | | inline_mysql_file_tell( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File file, myf flags) | | File file, myf flags) | |
| { | | { | |
| my_off_t result; | | my_off_t result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | if (likely(PSI_server != NULL)) | |
| { | | { | |
|
| locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_TE
LL); | | locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI
_FILE_TELL); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_tell(file, flags); | | result= my_tell(file, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| return result; | | return result; | |
| | | | |
| skipping to change at line 1250 | | skipping to change at line 1276 | |
| static inline int | | static inline int | |
| inline_mysql_file_delete( | | inline_mysql_file_delete( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *name, myf flags) | | const char *name, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_D
ELETE, | |
| name, &locker); | | name, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_delete(name, flags); | | result= my_delete(name, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1276 | | skipping to change at line 1303 | |
| static inline int | | static inline int | |
| inline_mysql_file_rename( | | inline_mysql_file_rename( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *from, const char *to, myf flags) | | const char *from, const char *to, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_R
ENAME, | |
| to, &locker); | | to, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_rename(from, to, flags); | | result= my_rename(from, to, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1303 | | skipping to change at line 1331 | |
| inline_mysql_file_create_with_symlink( | | inline_mysql_file_create_with_symlink( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *linkname, const char *filename, int create_flags, | | const char *linkname, const char *filename, int create_flags, | |
| int access_flags, myf flags) | | int access_flags, myf flags) | |
| { | | { | |
| File file; | | File file; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_C
REATE, | |
| filename, &locker); | | filename, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_open_wait(locker, src_file, src_line); | | PSI_server->start_file_open_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| file= my_create_with_symlink(linkname, filename, create_flags, access_fla
gs, | | file= my_create_with_symlink(linkname, filename, create_flags, access_fla
gs, | |
| flags); | | flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | | PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file); | |
| | | | |
| skipping to change at line 1330 | | skipping to change at line 1359 | |
| static inline int | | static inline int | |
| inline_mysql_file_delete_with_symlink( | | inline_mysql_file_delete_with_symlink( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *name, myf flags) | | const char *name, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_D
ELETE, | |
| name, &locker); | | name, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_delete_with_symlink(name, flags); | | result= my_delete_with_symlink(name, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1356 | | skipping to change at line 1386 | |
| static inline int | | static inline int | |
| inline_mysql_file_rename_with_symlink( | | inline_mysql_file_rename_with_symlink( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_file_key key, const char *src_file, uint src_line, | | PSI_file_key key, const char *src_file, uint src_line, | |
| #endif | | #endif | |
| const char *from, const char *to, myf flags) | | const char *from, const char *to, myf flags) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_R
ENAME, | |
| to, &locker); | | to, &locker); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_rename_with_symlink(from, to, flags); | | result= my_rename_with_symlink(from, to, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1382 | | skipping to change at line 1413 | |
| static inline int | | static inline int | |
| inline_mysql_file_sync( | | inline_mysql_file_sync( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| const char *src_file, uint src_line, | | const char *src_file, uint src_line, | |
| #endif | | #endif | |
| File fd, myf flags) | | File fd, myf flags) | |
| { | | { | |
| int result= 0; | | int result= 0; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_file_locker *locker= NULL; | | struct PSI_file_locker *locker= NULL; | |
|
| | | PSI_file_locker_state state; | |
| if (likely(PSI_server != NULL)) | | 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_F
ILE_SYNC); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | | PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= my_sync(fd, flags); | | result= my_sync(fd, flags); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_file_wait(locker, (size_t) 0); | | PSI_server->end_file_wait(locker, (size_t) 0); | |
| #endif | | #endif | |
| return result; | | return result; | |
| | | | |
End of changes. 66 change blocks. |
| 37 lines changed or deleted | | 68 lines changed or added | |
|
| mysql_thread.h | | mysql_thread.h | |
|
| /* Copyright (C) 2008-2009 Sun Microsystems, Inc | | /* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reser
ved. | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; version 2 of the License. | | the Free Software Foundation; version 2 of the License. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software Foundation, | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ | |
| */ | | | |
| | | | |
| #ifndef MYSQL_THREAD_H | | #ifndef MYSQL_THREAD_H | |
| #define MYSQL_THREAD_H | | #define MYSQL_THREAD_H | |
| | | | |
| /** | | /** | |
| @file mysql/psi/mysql_thread.h | | @file mysql/psi/mysql_thread.h | |
| Instrumentation helpers for mysys threads, mutexes, | | Instrumentation helpers for mysys threads, mutexes, | |
| read write locks and conditions. | | read write locks and conditions. | |
| This header file provides the necessary declarations | | This header file provides the necessary declarations | |
| to use the mysys thread API with the performance schema instrumentation. | | to use the mysys thread API with the performance schema instrumentation. | |
| | | | |
| skipping to change at line 144 | | skipping to change at line 144 | |
| @sa mysql_rwlock_destroy | | @sa mysql_rwlock_destroy | |
| */ | | */ | |
| typedef struct st_mysql_rwlock mysql_rwlock_t; | | typedef struct st_mysql_rwlock mysql_rwlock_t; | |
| | | | |
| /** | | /** | |
| Type of an instrumented prlock. | | Type of an instrumented prlock. | |
| A prlock is a read write lock that 'prefers readers' (pr). | | A prlock is a read write lock that 'prefers readers' (pr). | |
| @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. | | @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. | |
| @sa mysql_prlock_init | | @sa mysql_prlock_init | |
| @sa mysql_prlock_rdlock | | @sa mysql_prlock_rdlock | |
|
| @sa mysql_prlock_tryrdlock | | | |
| @sa mysql_prlock_wrlock | | @sa mysql_prlock_wrlock | |
|
| @sa mysql_prlock_trywrlock | | | |
| @sa mysql_prlock_unlock | | @sa mysql_prlock_unlock | |
| @sa mysql_prlock_destroy | | @sa mysql_prlock_destroy | |
| */ | | */ | |
| typedef struct st_mysql_prlock mysql_prlock_t; | | typedef struct st_mysql_prlock mysql_prlock_t; | |
| | | | |
| /** | | /** | |
| An instrumented cond structure. | | An instrumented cond structure. | |
| @sa mysql_cond_t | | @sa mysql_cond_t | |
| */ | | */ | |
| struct st_mysql_cond | | struct st_mysql_cond | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 216 | |
| | | | |
| /** | | /** | |
| @def mysql_mutex_assert_not_owner(M) | | @def mysql_mutex_assert_not_owner(M) | |
| Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. | | Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. | |
| @c mysql_mutex_assert_not_owner is a drop-in replacement | | @c mysql_mutex_assert_not_owner is a drop-in replacement | |
| for @c safe_mutex_assert_not_owner. | | for @c safe_mutex_assert_not_owner. | |
| */ | | */ | |
| #define mysql_mutex_assert_not_owner(M) \ | | #define mysql_mutex_assert_not_owner(M) \ | |
| safe_mutex_assert_not_owner(&(M)->m_mutex) | | safe_mutex_assert_not_owner(&(M)->m_mutex) | |
| | | | |
|
| | | /** Wrappers for instrumented prlock objects. */ | |
| | | | |
| | | #define mysql_prlock_assert_write_owner(M) \ | |
| | | rw_pr_lock_assert_write_owner(&(M)->m_prlock) | |
| | | | |
| | | #define mysql_prlock_assert_not_write_owner(M) \ | |
| | | rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) | |
| | | | |
| /** | | /** | |
| @def mysql_mutex_init(K, M, A) | | @def mysql_mutex_init(K, M, A) | |
| Instrumented mutex_init. | | Instrumented mutex_init. | |
| @c mysql_mutex_init is a replacement for @c pthread_mutex_init. | | @c mysql_mutex_init is a replacement for @c pthread_mutex_init. | |
| @param K The PSI_mutex_key for this instrumented mutex | | @param K The PSI_mutex_key for this instrumented mutex | |
| @param M The mutex to initialize | | @param M The mutex to initialize | |
| @param A Mutex attributes | | @param A Mutex attributes | |
| */ | | */ | |
| | | | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| | | | |
| skipping to change at line 416 | | skipping to change at line 422 | |
| */ | | */ | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| #define mysql_rwlock_tryrdlock(RW) \ | | #define mysql_rwlock_tryrdlock(RW) \ | |
| inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) | | inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) | |
| #else | | #else | |
| #define mysql_rwlock_tryrdlock(RW) \ | | #define mysql_rwlock_tryrdlock(RW) \ | |
| inline_mysql_rwlock_tryrdlock(RW) | | inline_mysql_rwlock_tryrdlock(RW) | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| @def mysql_prlock_tryrdlock(RW) | | | |
| Instrumented rw_pr_tryrdlock. | | | |
| @c mysql_prlock_tryrdlock is a drop-in replacement | | | |
| for @c rw_pr_tryrdlock. | | | |
| */ | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| #define mysql_prlock_tryrdlock(RW) \ | | | |
| inline_mysql_prlock_tryrdlock(RW, __FILE__, __LINE__) | | | |
| #else | | | |
| #define mysql_prlock_tryrdlock(RW) \ | | | |
| inline_mysql_prlock_tryrdlock(RW) | | | |
| #endif | | | |
| | | | |
| /** | | | |
| @def mysql_rwlock_trywrlock(RW) | | @def mysql_rwlock_trywrlock(RW) | |
| Instrumented rwlock_trywrlock. | | Instrumented rwlock_trywrlock. | |
| @c mysql_rwlock_trywrlock is a drop-in replacement | | @c mysql_rwlock_trywrlock is a drop-in replacement | |
| for @c pthread_rwlock_trywrlock. | | for @c pthread_rwlock_trywrlock. | |
| */ | | */ | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| #define mysql_rwlock_trywrlock(RW) \ | | #define mysql_rwlock_trywrlock(RW) \ | |
| inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) | | inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) | |
| #else | | #else | |
| #define mysql_rwlock_trywrlock(RW) \ | | #define mysql_rwlock_trywrlock(RW) \ | |
| inline_mysql_rwlock_trywrlock(RW) | | inline_mysql_rwlock_trywrlock(RW) | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| @def mysql_prlock_trywrlock(RW) | | | |
| Instrumented rw_pr_trywrlock. | | | |
| @c mysql_prlock_trywrlock is a drop-in replacement | | | |
| for @c rw_pr_trywrlock. | | | |
| */ | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| #define mysql_prlock_trywrlock(RW) \ | | | |
| inline_mysql_prlock_trywrlock(RW, __FILE__, __LINE__) | | | |
| #else | | | |
| #define mysql_prlock_trywrlock(RW) \ | | | |
| inline_mysql_prlock_trywrlock(RW) | | | |
| #endif | | | |
| | | | |
| /** | | | |
| @def mysql_rwlock_unlock(RW) | | @def mysql_rwlock_unlock(RW) | |
| Instrumented rwlock_unlock. | | Instrumented rwlock_unlock. | |
| @c mysql_rwlock_unlock is a drop-in replacement | | @c mysql_rwlock_unlock is a drop-in replacement | |
| for @c pthread_rwlock_unlock. | | for @c pthread_rwlock_unlock. | |
| */ | | */ | |
| #define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) | | #define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) | |
| | | | |
| /** | | /** | |
| @def mysql_prlock_unlock(RW) | | @def mysql_prlock_unlock(RW) | |
| Instrumented rw_pr_unlock. | | Instrumented rw_pr_unlock. | |
| | | | |
| skipping to change at line 627 | | skipping to change at line 605 | |
| static inline int inline_mysql_mutex_lock( | | static inline int inline_mysql_mutex_lock( | |
| mysql_mutex_t *that | | mysql_mutex_t *that | |
| #if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) | | #if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_mutex_locker *locker= NULL; | | struct PSI_mutex_locker *locker= NULL; | |
|
| | | PSI_mutex_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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_MU
TEX_LOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_mutex_wait(locker, src_file, src_line); | | PSI_server->start_mutex_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| #ifdef SAFE_MUTEX | | #ifdef SAFE_MUTEX | |
| result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line); | | result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line); | |
| #else | | #else | |
| result= pthread_mutex_lock(&that->m_mutex); | | result= pthread_mutex_lock(&that->m_mutex); | |
| #endif | | #endif | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| | | | |
| skipping to change at line 656 | | skipping to change at line 635 | |
| static inline int inline_mysql_mutex_trylock( | | static inline int inline_mysql_mutex_trylock( | |
| mysql_mutex_t *that | | mysql_mutex_t *that | |
| #if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) | | #if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE) | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_mutex_locker *locker= NULL; | | struct PSI_mutex_locker *locker= NULL; | |
|
| | | PSI_mutex_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
| { | | { | |
|
| locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_TRYL
OCK); | | locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MU
TEX_TRYLOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_mutex_wait(locker, src_file, src_line); | | PSI_server->start_mutex_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| #ifdef SAFE_MUTEX | | #ifdef SAFE_MUTEX | |
| result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line); | | result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line); | |
| #else | | #else | |
| result= pthread_mutex_trylock(&that->m_mutex); | | result= pthread_mutex_trylock(&that->m_mutex); | |
| #endif | | #endif | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| | | | |
| skipping to change at line 684 | | skipping to change at line 664 | |
| | | | |
| static inline int inline_mysql_mutex_unlock( | | static inline int inline_mysql_mutex_unlock( | |
| mysql_mutex_t *that | | mysql_mutex_t *that | |
| #ifdef SAFE_MUTEX | | #ifdef SAFE_MUTEX | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
|
| struct PSI_thread *thread; | | | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
|
| { | | PSI_server->unlock_mutex(that->m_psi); | |
| thread= PSI_server->get_thread(); | | | |
| if (likely(thread != NULL)) | | | |
| PSI_server->unlock_mutex(thread, that->m_psi); | | | |
| } | | | |
| #endif | | #endif | |
| #ifdef SAFE_MUTEX | | #ifdef SAFE_MUTEX | |
| result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); | | result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); | |
| #else | | #else | |
| result= pthread_mutex_unlock(&that->m_mutex); | | result= pthread_mutex_unlock(&that->m_mutex); | |
| #endif | | #endif | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| static inline int inline_mysql_rwlock_init( | | static inline int inline_mysql_rwlock_init( | |
| | | | |
| skipping to change at line 773 | | skipping to change at line 748 | |
| static inline int inline_mysql_rwlock_rdlock( | | static inline int inline_mysql_rwlock_rdlock( | |
| mysql_rwlock_t *that | | mysql_rwlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_READLOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | | PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_rdlock(&that->m_rwlock); | | result= rw_rdlock(&that->m_rwlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_rdwait(locker, result); | | PSI_server->end_rwlock_rdwait(locker, result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 800 | | skipping to change at line 776 | |
| static inline int inline_mysql_prlock_rdlock( | | static inline int inline_mysql_prlock_rdlock( | |
| mysql_prlock_t *that | | mysql_prlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_READLOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | | PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_pr_rdlock(&that->m_prlock); | | result= rw_pr_rdlock(&that->m_prlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_rdwait(locker, result); | | PSI_server->end_rwlock_rdwait(locker, result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 827 | | skipping to change at line 804 | |
| static inline int inline_mysql_rwlock_wrlock( | | static inline int inline_mysql_rwlock_wrlock( | |
| mysql_rwlock_t *that | | mysql_rwlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_WRITELOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | | PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_wrlock(&that->m_rwlock); | | result= rw_wrlock(&that->m_rwlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_wrwait(locker, result); | | PSI_server->end_rwlock_wrwait(locker, result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 854 | | skipping to change at line 832 | |
| static inline int inline_mysql_prlock_wrlock( | | static inline int inline_mysql_prlock_wrlock( | |
| mysql_prlock_t *that | | mysql_prlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_WRITELOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | | PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_pr_wrlock(&that->m_prlock); | | result= rw_pr_wrlock(&that->m_prlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_wrwait(locker, result); | | PSI_server->end_rwlock_wrwait(locker, result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 881 | | skipping to change at line 860 | |
| static inline int inline_mysql_rwlock_tryrdlock( | | static inline int inline_mysql_rwlock_tryrdlock( | |
| mysql_rwlock_t *that | | mysql_rwlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_TRYREADLOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | | PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_tryrdlock(&that->m_rwlock); | | result= rw_tryrdlock(&that->m_rwlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_rdwait(locker, result); | | PSI_server->end_rwlock_rdwait(locker, result); | |
| #endif | | #endif | |
| return result; | | return result; | |
| } | | } | |
| | | | |
|
| #ifndef DISABLE_MYSQL_PRLOCK_H | | | |
| static inline int inline_mysql_prlock_tryrdlock( | | | |
| mysql_prlock_t *that | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| , const char *src_file, uint src_line | | | |
| #endif | | | |
| ) | | | |
| { | | | |
| int result; | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| struct PSI_rwlock_locker *locker= NULL; | | | |
| if (likely(PSI_server && that->m_psi)) | | | |
| { | | | |
| locker= PSI_server->get_thread_rwlock_locker(that->m_psi, | | | |
| PSI_RWLOCK_TRYREADLOCK); | | | |
| if (likely(locker != NULL)) | | | |
| PSI_server->start_rwlock_rdwait(locker, src_file, src_line); | | | |
| } | | | |
| #endif | | | |
| result= rw_pr_tryrdlock(&that->m_prlock); | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| if (likely(locker != NULL)) | | | |
| PSI_server->end_rwlock_rdwait(locker, result); | | | |
| #endif | | | |
| return result; | | | |
| } | | | |
| #endif | | | |
| | | | |
| static inline int inline_mysql_rwlock_trywrlock( | | static inline int inline_mysql_rwlock_trywrlock( | |
| mysql_rwlock_t *that | | mysql_rwlock_t *that | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_rwlock_locker *locker= NULL; | | struct PSI_rwlock_locker *locker= NULL; | |
|
| | | PSI_rwlock_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_RWLOCK_TRYWRITELOCK); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | | PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= rw_trywrlock(&that->m_rwlock); | | result= rw_trywrlock(&that->m_rwlock); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_rwlock_wrwait(locker, result); | | PSI_server->end_rwlock_wrwait(locker, result); | |
| #endif | | #endif | |
| return result; | | return result; | |
| } | | } | |
| | | | |
|
| #ifndef DISABLE_MYSQL_PRLOCK_H | | | |
| static inline int inline_mysql_prlock_trywrlock( | | | |
| mysql_prlock_t *that | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| , const char *src_file, uint src_line | | | |
| #endif | | | |
| ) | | | |
| { | | | |
| int result; | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| struct PSI_rwlock_locker *locker= NULL; | | | |
| if (likely(PSI_server && that->m_psi)) | | | |
| { | | | |
| locker= PSI_server->get_thread_rwlock_locker(that->m_psi, | | | |
| PSI_RWLOCK_TRYWRITELOCK); | | | |
| if (likely(locker != NULL)) | | | |
| PSI_server->start_rwlock_wrwait(locker, src_file, src_line); | | | |
| } | | | |
| #endif | | | |
| result= rw_pr_trywrlock(&that->m_prlock); | | | |
| #ifdef HAVE_PSI_INTERFACE | | | |
| if (likely(locker != NULL)) | | | |
| PSI_server->end_rwlock_wrwait(locker, result); | | | |
| #endif | | | |
| return result; | | | |
| } | | | |
| #endif | | | |
| | | | |
| static inline int inline_mysql_rwlock_unlock( | | static inline int inline_mysql_rwlock_unlock( | |
| mysql_rwlock_t *that) | | mysql_rwlock_t *that) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
|
| struct PSI_thread *thread; | | | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
|
| { | | PSI_server->unlock_rwlock(that->m_psi); | |
| thread= PSI_server->get_thread(); | | | |
| if (likely(thread != NULL)) | | | |
| PSI_server->unlock_rwlock(thread, that->m_psi); | | | |
| } | | | |
| #endif | | #endif | |
| result= rw_unlock(&that->m_rwlock); | | result= rw_unlock(&that->m_rwlock); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| #ifndef DISABLE_MYSQL_PRLOCK_H | | #ifndef DISABLE_MYSQL_PRLOCK_H | |
| static inline int inline_mysql_prlock_unlock( | | static inline int inline_mysql_prlock_unlock( | |
| mysql_prlock_t *that) | | mysql_prlock_t *that) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
|
| struct PSI_thread *thread; | | | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
|
| { | | PSI_server->unlock_rwlock(that->m_psi); | |
| thread= PSI_server->get_thread(); | | | |
| if (likely(thread != NULL)) | | | |
| PSI_server->unlock_rwlock(thread, that->m_psi); | | | |
| } | | | |
| #endif | | #endif | |
| result= rw_pr_unlock(&that->m_prlock); | | result= rw_pr_unlock(&that->m_prlock); | |
| return result; | | return result; | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| static inline int inline_mysql_cond_init( | | static inline int inline_mysql_cond_init( | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| PSI_cond_key key, | | PSI_cond_key key, | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1055 | | skipping to change at line 970 | |
| mysql_cond_t *that, | | mysql_cond_t *that, | |
| mysql_mutex_t *mutex | | mysql_mutex_t *mutex | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_cond_locker *locker= NULL; | | struct PSI_cond_locker *locker= NULL; | |
|
| | | PSI_cond_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_COND_WAIT); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_cond_wait(locker, src_file, src_line); | | PSI_server->start_cond_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex); | | result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_cond_wait(locker, result); | | PSI_server->end_cond_wait(locker, result); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1083 | | skipping to change at line 999 | |
| mysql_mutex_t *mutex, | | mysql_mutex_t *mutex, | |
| struct timespec *abstime | | struct timespec *abstime | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| , const char *src_file, uint src_line | | , const char *src_file, uint src_line | |
| #endif | | #endif | |
| ) | | ) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| struct PSI_cond_locker *locker= NULL; | | struct PSI_cond_locker *locker= NULL; | |
|
| | | PSI_cond_locker_state state; | |
| if (likely(PSI_server && that->m_psi)) | | 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); | | PSI_COND_TIMEDWAIT); | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->start_cond_wait(locker, src_file, src_line); | | PSI_server->start_cond_wait(locker, src_file, src_line); | |
| } | | } | |
| #endif | | #endif | |
| result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); | | result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime); | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| if (likely(locker != NULL)) | | if (likely(locker != NULL)) | |
| PSI_server->end_cond_wait(locker, result); | | PSI_server->end_cond_wait(locker, result); | |
| #endif | | #endif | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| static inline int inline_mysql_cond_signal( | | static inline int inline_mysql_cond_signal( | |
| mysql_cond_t *that) | | mysql_cond_t *that) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
|
| struct PSI_thread *thread; | | | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
|
| { | | PSI_server->signal_cond(that->m_psi); | |
| thread= PSI_server->get_thread(); | | | |
| if (likely(thread != NULL)) | | | |
| PSI_server->signal_cond(thread, that->m_psi); | | | |
| } | | | |
| #endif | | #endif | |
| result= pthread_cond_signal(&that->m_cond); | | result= pthread_cond_signal(&that->m_cond); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| static inline int inline_mysql_cond_broadcast( | | static inline int inline_mysql_cond_broadcast( | |
| mysql_cond_t *that) | | mysql_cond_t *that) | |
| { | | { | |
| int result; | | int result; | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
|
| struct PSI_thread *thread; | | | |
| if (likely(PSI_server && that->m_psi)) | | if (likely(PSI_server && that->m_psi)) | |
|
| { | | PSI_server->broadcast_cond(that->m_psi); | |
| thread= PSI_server->get_thread(); | | | |
| if (likely(thread != NULL)) | | | |
| PSI_server->broadcast_cond(thread, that->m_psi); | | | |
| } | | | |
| #endif | | #endif | |
| result= pthread_cond_broadcast(&that->m_cond); | | result= pthread_cond_broadcast(&that->m_cond); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| #ifdef HAVE_PSI_INTERFACE | | #ifdef HAVE_PSI_INTERFACE | |
| static inline int inline_mysql_thread_create( | | static inline int inline_mysql_thread_create( | |
| PSI_thread_key key, | | PSI_thread_key key, | |
| pthread_t *thread, const pthread_attr_t *attr, | | pthread_t *thread, const pthread_attr_t *attr, | |
| void *(*start_routine)(void*), void *arg) | | void *(*start_routine)(void*), void *arg) | |
| | | | |
End of changes. 39 change blocks. |
| 130 lines changed or deleted | | 36 lines changed or added | |
|
| psi.h | | psi.h | |
|
| /* Copyright (C) 2008-2010 Sun Microsystems, Inc | | /* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reser
ved. | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; version 2 of the License. | | the Free Software Foundation; version 2 of the License. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software Foundation, | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ | |
| */ | | | |
| | | | |
| #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | | #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | |
| #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | | #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H | |
| | | | |
| #ifndef _global_h | | #ifndef _global_h | |
| /* | | /* | |
| Make sure a .c or .cc file contains an include to my_global.h first. | | Make sure a .c or .cc file contains an include to my_global.h first. | |
| When this include is missing, all the #ifdef HAVE_XXX have no effect, | | When this include is missing, all the #ifdef HAVE_XXX have no effect, | |
| and the resulting binary won't build, or won't link, | | and the resulting binary won't build, or won't link, | |
| or will crash at runtime | | or will crash at runtime | |
| | | | |
| skipping to change at line 425 | | skipping to change at line 425 | |
| The name of the file instrument to register. | | The name of the file instrument to register. | |
| */ | | */ | |
| const char *m_name; | | const char *m_name; | |
| /** | | /** | |
| The flags of the file instrument to register. | | The flags of the file instrument to register. | |
| @sa PSI_FLAG_GLOBAL | | @sa PSI_FLAG_GLOBAL | |
| */ | | */ | |
| int m_flags; | | 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. */ | | /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ | |
| | | | |
| /** | | /** | |
| Mutex registration API. | | Mutex registration API. | |
| @param category a category name (typically a plugin name) | | @param category a category name (typically a plugin name) | |
| @param info an array of mutex info to register | | @param info an array of mutex info to register | |
| @param count the size of the info array | | @param count the size of the info array | |
| */ | | */ | |
| typedef void (*register_mutex_v1_t) | | typedef void (*register_mutex_v1_t) | |
| (const char *category, struct PSI_mutex_info_v1 *info, int count); | | (const char *category, struct PSI_mutex_info_v1 *info, int count); | |
| | | | |
| skipping to change at line 622 | | skipping to change at line 791 | |
| typedef void (*set_thread_v1_t)(struct PSI_thread *thread); | | typedef void (*set_thread_v1_t)(struct PSI_thread *thread); | |
| | | | |
| /** Delete the current thread instrumentation. */ | | /** Delete the current thread instrumentation. */ | |
| typedef void (*delete_current_thread_v1_t)(void); | | typedef void (*delete_current_thread_v1_t)(void); | |
| | | | |
| /** Delete a thread instrumentation. */ | | /** Delete a thread instrumentation. */ | |
| typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); | | typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); | |
| | | | |
| /** | | /** | |
| Get a mutex instrumentation locker. | | Get a mutex instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param mutex the instrumented mutex to lock | | @param mutex the instrumented mutex to lock | |
| @return a mutex locker, or NULL | | @return a mutex locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) | | 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. | | Get a rwlock instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param rwlock the instrumented rwlock to lock | | @param rwlock the instrumented rwlock to lock | |
| @return a rwlock locker, or NULL | | @return a rwlock locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) | | 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. | | Get a cond instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param cond the instrumented condition to wait on | | @param cond the instrumented condition to wait on | |
| @param mutex the instrumented mutex associated with the condition | | @param mutex the instrumented mutex associated with the condition | |
| @return a condition locker, or NULL | | @return a condition locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) | | 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); | | enum PSI_cond_operation op); | |
| | | | |
| /** | | /** | |
| Get a table instrumentation locker. | | Get a table instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param table the instrumented table to lock | | @param table the instrumented table to lock | |
| @return a table locker, or NULL | | @return a table locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) | | 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. | | 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 key the file instrumentation key | |
| @param op the operation to perform | | @param op the operation to perform | |
| @param name the file name | | @param name the file name | |
| @param identity a pointer representative of this file. | | @param identity a pointer representative of this file. | |
| @return a file locker, or NULL | | @return a file locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) | | 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); | | const void *identity); | |
| | | | |
| /** | | /** | |
| Get a file stream instrumentation locker. | | Get a file stream instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param file the file stream to access | | @param file the file stream to access | |
| @param op the operation to perform | | @param op the operation to perform | |
| @return a file locker, or NULL | | @return a file locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) | | 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. | | Get a file instrumentation locker. | |
|
| | | @param state data storage for the locker | |
| @param file the file descriptor to access | | @param file the file descriptor to access | |
| @param op the operation to perform | | @param op the operation to perform | |
| @return a file locker, or NULL | | @return a file locker, or NULL | |
| */ | | */ | |
| typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) | | 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. | | Record a mutex instrumentation unlock event. | |
|
| @param thread the running thread instrumentation | | | |
| @param mutex the mutex instrumentation | | @param mutex the mutex instrumentation | |
| */ | | */ | |
| typedef void (*unlock_mutex_v1_t) | | typedef void (*unlock_mutex_v1_t) | |
|
| (struct PSI_thread *thread, struct PSI_mutex *mutex); | | (struct PSI_mutex *mutex); | |
| | | | |
| /** | | /** | |
| Record a rwlock instrumentation unlock event. | | Record a rwlock instrumentation unlock event. | |
|
| @param thread the running thread instrumentation | | | |
| @param rwlock the rwlock instrumentation | | @param rwlock the rwlock instrumentation | |
| */ | | */ | |
| typedef void (*unlock_rwlock_v1_t) | | typedef void (*unlock_rwlock_v1_t) | |
|
| (struct PSI_thread *thread, struct PSI_rwlock *rwlock); | | (struct PSI_rwlock *rwlock); | |
| | | | |
| /** | | /** | |
| Record a condition instrumentation signal event. | | Record a condition instrumentation signal event. | |
|
| @param thread the running thread instrumentation | | | |
| @param cond the cond instrumentation | | @param cond the cond instrumentation | |
| */ | | */ | |
| typedef void (*signal_cond_v1_t) | | typedef void (*signal_cond_v1_t) | |
|
| (struct PSI_thread *thread, struct PSI_cond *cond); | | (struct PSI_cond *cond); | |
| | | | |
| /** | | /** | |
| Record a condition instrumentation broadcast event. | | Record a condition instrumentation broadcast event. | |
|
| @param thread the running thread instrumentation | | | |
| @param cond the cond instrumentation | | @param cond the cond instrumentation | |
| */ | | */ | |
| typedef void (*broadcast_cond_v1_t) | | 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. | | Record a mutex instrumentation wait start event. | |
| @param locker a thread locker for the running thread | | @param locker a thread locker for the running thread | |
| */ | | */ | |
| typedef void (*start_mutex_wait_v1_t) | | typedef void (*start_mutex_wait_v1_t) | |
| (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); | | (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); | |
| | | | |
| /** | | /** | |
| Record a mutex instrumentation wait end event. | | Record a mutex instrumentation wait end event. | |
| | | | |
| skipping to change at line 1016 | | skipping to change at line 1197 | |
| int placeholder; | | int placeholder; | |
| }; | | }; | |
| | | | |
| /** Placeholder */ | | /** Placeholder */ | |
| struct PSI_file_info_v2 | | struct PSI_file_info_v2 | |
| { | | { | |
| /** Placeholder */ | | /** Placeholder */ | |
| int placeholder; | | int placeholder; | |
| }; | | }; | |
| | | | |
|
| | | struct PSI_mutex_locker_state_v2 | |
| | | { | |
| | | /** Placeholder */ | |
| | | int placeholder; | |
| | | }; | |
| | | | |
| | | struct PSI_rwlock_locker_state_v2 | |
| | | { | |
| | | /** Placeholder */ | |
| | | int placeholder; | |
| | | }; | |
| | | | |
| | | struct PSI_cond_locker_state_v2 | |
| | | { | |
| | | /** Placeholder */ | |
| | | int placeholder; | |
| | | }; | |
| | | | |
| | | struct PSI_file_locker_state_v2 | |
| | | { | |
| | | /** Placeholder */ | |
| | | int placeholder; | |
| | | }; | |
| | | | |
| | | struct PSI_table_locker_state_v2 | |
| | | { | |
| | | /** Placeholder */ | |
| | | int placeholder; | |
| | | }; | |
| | | | |
| /** @} (end of group Group_PSI_v2) */ | | /** @} (end of group Group_PSI_v2) */ | |
| | | | |
| #endif /* HAVE_PSI_2 */ | | #endif /* HAVE_PSI_2 */ | |
| | | | |
| /** | | /** | |
| @typedef PSI | | @typedef PSI | |
| The instrumentation interface for the current version. | | The instrumentation interface for the current version. | |
| @sa PSI_CURRENT_VERSION | | @sa PSI_CURRENT_VERSION | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 1059 | | skipping to change at line 1270 | |
| */ | | */ | |
| | | | |
| /* Export the required version */ | | /* Export the required version */ | |
| #ifdef USE_PSI_1 | | #ifdef USE_PSI_1 | |
| typedef struct PSI_v1 PSI; | | typedef struct PSI_v1 PSI; | |
| typedef struct PSI_mutex_info_v1 PSI_mutex_info; | | typedef struct PSI_mutex_info_v1 PSI_mutex_info; | |
| typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; | | typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; | |
| typedef struct PSI_cond_info_v1 PSI_cond_info; | | typedef struct PSI_cond_info_v1 PSI_cond_info; | |
| typedef struct PSI_thread_info_v1 PSI_thread_info; | | typedef struct PSI_thread_info_v1 PSI_thread_info; | |
| typedef struct PSI_file_info_v1 PSI_file_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 | | #endif | |
| | | | |
| #ifdef USE_PSI_2 | | #ifdef USE_PSI_2 | |
| typedef struct PSI_v2 PSI; | | typedef struct PSI_v2 PSI; | |
| typedef struct PSI_mutex_info_v2 PSI_mutex_info; | | typedef struct PSI_mutex_info_v2 PSI_mutex_info; | |
| typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; | | typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; | |
| typedef struct PSI_cond_info_v2 PSI_cond_info; | | typedef struct PSI_cond_info_v2 PSI_cond_info; | |
| typedef struct PSI_thread_info_v2 PSI_thread_info; | | typedef struct PSI_thread_info_v2 PSI_thread_info; | |
| typedef struct PSI_file_info_v2 PSI_file_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 | | #endif | |
| | | | |
| #else /* HAVE_PSI_INTERFACE */ | | #else /* HAVE_PSI_INTERFACE */ | |
| | | | |
| /** | | /** | |
| Dummy structure, used to declare PSI_server when no instrumentation | | Dummy structure, used to declare PSI_server when no instrumentation | |
| is available. | | is available. | |
| The content does not matter, since PSI_server will be NULL. | | The content does not matter, since PSI_server will be NULL. | |
| */ | | */ | |
| struct PSI_none | | struct PSI_none | |
| | | | |
End of changes. 28 change blocks. |
| 19 lines changed or deleted | | 239 lines changed or added | |
|