diff options
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 4 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 5 | ||||
-rw-r--r-- | config.h.cmake | 4 | ||||
-rw-r--r-- | configure.cmake | 5 | ||||
-rw-r--r-- | include/my_pthread.h | 12 | ||||
-rw-r--r-- | mysys/lf_hash.c | 22 | ||||
-rw-r--r-- | mysys/my_wincond.c | 14 | ||||
-rw-r--r-- | plugin/semisync/semisync_master.cc | 7 |
9 files changed, 53 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 586119b2ffb..1abfa95f8b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -328,9 +328,16 @@ IF(SYSCONFDIR) SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}") ENDIF() -SET(TMPDIR "P_tmpdir" - CACHE PATH - "PATH to MySQL TMP dir. Defaults to the P_tmpdir macro in <stdio.h>") +IF(WIN32) # P_tmpdir is not defined on Windows as of VS2015. + SET(TMPDIR "" # So we use empty path as default. In practice TMP/TEMP is used + CACHE PATH + "PATH to MySQL TMP dir") +ELSE() + SET(TMPDIR "P_tmpdir" + CACHE PATH + "PATH to MySQL TMP dir. Defaults to the P_tmpdir macro in <stdio.h>") +ENDIF() + IF(TMPDIR STREQUAL "P_tmpdir") # Do not quote it, to refer to the P_tmpdir macro. SET(DEFAULT_TMPDIR "P_tmpdir") diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 98158ca806b..1b79970a830 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -185,6 +185,8 @@ CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h) CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h) CHECK_SYMBOL_REPLACEMENT(isnan _isnan float.h) CHECK_SYMBOL_REPLACEMENT(finite _finite float.h) +CHECK_SYMBOL_REPLACEMENT(tzname _tzname time.h) +CHECK_SYMBOL_REPLACEMENT(snprintf _snprintf stdio.h) CHECK_FUNCTION_REPLACEMENT(popen _popen) CHECK_FUNCTION_REPLACEMENT(pclose _pclose) CHECK_FUNCTION_REPLACEMENT(access _access) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index bbed14556b9..1b5a2cedfd5 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -227,7 +227,6 @@ SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "") SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "") SET(HAVE_SLEEP CACHE INTERNAL "") -SET(HAVE_SNPRINTF CACHE INTERNAL "") SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "") SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "") SET(STACK_DIRECTION -1 CACHE INTERNAL "") @@ -301,7 +300,7 @@ SET(HAVE_TIME 1 CACHE INTERNAL "") SET(HAVE_TIMES CACHE INTERNAL "") SET(HAVE_TIMESPEC_TS_SEC CACHE INTERNAL "") SET(HAVE_TIME_H 1 CACHE INTERNAL "") -SET(HAVE_TZNAME 1 CACHE INTERNAL "") +SET(HAVE__tzname 1 CACHE INTERNAL "") SET(HAVE_UNISTD_H CACHE INTERNAL "") SET(HAVE_UTIME_H CACHE INTERNAL "") SET(HAVE_VALLOC CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 8c93da072fb..4548d0a221f 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -376,6 +376,7 @@ #cmakedefine HAVE_UINT64 1 #cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@ #cmakedefine HAVE_BOOL 1 +#cmakedefine HAVE_STRUCT_TIMESPEC #cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@ @@ -497,6 +498,7 @@ #cmakedefine strtok_r @strtok_r@ #cmakedefine strtoll @strtoll@ #cmakedefine strtoull @strtoull@ +#cmakedefine tzname @tzname@ #cmakedefine vsnprintf @vsnprintf@ #if (_MSC_VER > 1310) # define HAVE_SETENV diff --git a/configure.cmake b/configure.cmake index 28974a84c49..f90d36a01e4 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -561,7 +561,7 @@ MY_CHECK_TYPE_SIZE(char CHAR) MY_CHECK_TYPE_SIZE(short SHORT) MY_CHECK_TYPE_SIZE(int INT) MY_CHECK_TYPE_SIZE("long long" LONG_LONG) -SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h sys/types.h) +SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h sys/types.h time.h) MY_CHECK_TYPE_SIZE(off_t OFF_T) MY_CHECK_TYPE_SIZE(uchar UCHAR) MY_CHECK_TYPE_SIZE(uint UINT) @@ -576,6 +576,7 @@ MY_CHECK_TYPE_SIZE(u_int32_t U_INT32_T) MY_CHECK_TYPE_SIZE(int64 INT64) MY_CHECK_TYPE_SIZE(uint64 UINT64) MY_CHECK_TYPE_SIZE(time_t TIME_T) +MY_CHECK_TYPE_SIZE("struct timespec" STRUCT_TIMESPEC) SET (CMAKE_EXTRA_INCLUDE_FILES sys/types.h) MY_CHECK_TYPE_SIZE(bool BOOL) SET(CMAKE_EXTRA_INCLUDE_FILES) diff --git a/include/my_pthread.h b/include/my_pthread.h index 92676bd727c..6ff198ac6f3 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,6 +90,7 @@ typedef volatile LONG my_pthread_once_t; windows implementation of pthread_cond_timedwait */ +#ifndef HAVE_STRUCT_TIMESPEC /* Declare a union to make sure FILETIME is properly aligned so it can be used directly as a 64 bit value. The value @@ -128,6 +129,7 @@ struct timespec { ((TS1.tv.i64 > TS2.tv.i64) ? 1 : \ ((TS1.tv.i64 < TS2.tv.i64) ? -1 : 0)) +#endif int win_pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *); @@ -433,13 +435,7 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); #endif /* !set_timespec_nsec */ #else #ifndef set_timespec -#define set_timespec(ABSTIME,SEC) \ -{\ - struct timeval tv;\ - gettimeofday(&tv,0);\ - (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ - (ABSTIME).tv_nsec=tv.tv_usec*1000;\ -} +#define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL) #endif /* !set_timespec */ #ifndef set_timespec_nsec #define set_timespec_nsec(ABSTIME,NSEC) \ diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c index 4f0a3a32d86..dc019b07bd9 100644 --- a/mysys/lf_hash.c +++ b/mysys/lf_hash.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ typedef struct { /* a structure to pass the context (pointers two the three successive elements - in a list) from lfind to linsert/ldelete + in a list) from my_lfind to linsert/ldelete */ typedef struct { intptr volatile *prev; @@ -70,7 +70,7 @@ typedef struct { cursor is positioned in either case pins[0..2] are used, they are NOT removed on return */ -static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, +static int my_lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins) { uint32 cur_hashnr; @@ -138,7 +138,7 @@ retry: /* DESCRIPTION insert a 'node' in the list that starts from 'head' in the correct - position (as found by lfind) + position (as found by my_lfind) RETURN 0 - inserted @@ -156,7 +156,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, for (;;) { - if (lfind(head, cs, node->hashnr, node->key, node->keylen, + if (my_lfind(head, cs, node->hashnr, node->key, node->keylen, &cursor, pins) && (flags & LF_HASH_UNIQUE)) { @@ -207,7 +207,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, for (;;) { - if (!lfind(head, cs, hashnr, key, keylen, &cursor, pins)) + if (!my_lfind(head, cs, hashnr, key, keylen, &cursor, pins)) { res= 1; /* not found */ break; @@ -231,7 +231,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, (to ensure the number of "set DELETED flag" actions is equal to the number of "remove from the list" actions) */ - lfind(head, cs, hashnr, key, keylen, &cursor, pins); + my_lfind(head, cs, hashnr, key, keylen, &cursor, pins); } res= 0; break; @@ -257,12 +257,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, it uses pins[0..2], on return the pin[2] keeps the node found all other pins are removed. */ -static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, +static LF_SLIST *my_lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, const uchar *key, uint keylen, LF_PINS *pins) { CURSOR cursor; - int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins); + int res= my_lfind(head, cs, hashnr, key, keylen, &cursor, pins); if (res) _lf_pin(pins, 2, cursor.curr); _lf_unpin(pins, 0); @@ -443,7 +443,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) MY_ERRPTR if OOM NOTE - see lsearch() for pin usage notes + see my_lsearch() for pin usage notes */ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) { @@ -457,7 +457,7 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) return MY_ERRPTR; if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) return MY_ERRPTR; - found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, + found= my_lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, (uchar *)key, keylen, pins); lf_rwunlock_by_pins(pins); return found ? found+1 : 0; diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index ac0166c87b8..567721baf27 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -88,6 +88,7 @@ static void check_native_cond_availability(void) static DWORD get_milliseconds(const struct timespec *abstime) { +#ifndef HAVE_STRUCT_TIMESPEC long long millis; union ft64 now; @@ -118,6 +119,17 @@ static DWORD get_milliseconds(const struct timespec *abstime) millis= UINT_MAX; return (DWORD)millis; +#else + /* + Convert timespec to millis and subtract current time. + my_getsystime() returns time in 100 ns units. + */ + if (abstime == NULL) + return INFINITE; + + return (DWORD)(abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000 - + my_getsystime() / 10000); +#endif } diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 2e40fc8b5c5..40d577e4372 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -1,6 +1,5 @@ /* Copyright (C) 2007 Google Inc. - Copyright (c) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. - Use is subject to license terms. + Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,7 +47,7 @@ static int getWaitTime(const struct timespec& start_ts); static unsigned long long timespec_to_usec(const struct timespec *ts) { -#ifndef __WIN__ +#ifdef HAVE_STRUCT_TIMESPEC return (unsigned long long) ts->tv_sec * TIME_MILLION + ts->tv_nsec / TIME_THOUSAND; #else return ts->tv.i64 / 10; @@ -683,7 +682,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, } /* Calcuate the waiting period. */ -#ifdef __WIN__ +#ifndef HAVE_STRUCT_TIMESPEC abstime.tv.i64 = start_ts.tv.i64 + (__int64)wait_timeout_ * TIME_THOUSAND * 10; abstime.max_timeout_msec= (long)wait_timeout_; #else |