You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
CONC-385 Remove some irrelevant cmake system checks
This commit is contained in:
@@ -13,106 +13,11 @@
|
|||||||
|
|
||||||
INCLUDE(CheckFunctionExists)
|
INCLUDE(CheckFunctionExists)
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
|
|
||||||
CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
|
|
||||||
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
|
|
||||||
CHECK_FUNCTION_EXISTS (alloca HAVE_ALLOCA)
|
CHECK_FUNCTION_EXISTS (alloca HAVE_ALLOCA)
|
||||||
CHECK_FUNCTION_EXISTS (bcmp HAVE_BCMP)
|
|
||||||
CHECK_FUNCTION_EXISTS (bfill HAVE_BFILL)
|
|
||||||
CHECK_FUNCTION_EXISTS (bmove HAVE_BMOVE)
|
|
||||||
CHECK_FUNCTION_EXISTS (bzero HAVE_BZERO)
|
|
||||||
CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
|
|
||||||
CHECK_FUNCTION_EXISTS (compress HAVE_COMPRESS)
|
|
||||||
CHECK_FUNCTION_EXISTS (crypt HAVE_CRYPT)
|
|
||||||
CHECK_FUNCTION_EXISTS (dlerror HAVE_DLERROR)
|
CHECK_FUNCTION_EXISTS (dlerror HAVE_DLERROR)
|
||||||
CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN)
|
CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN)
|
||||||
CHECK_FUNCTION_EXISTS (fchmod HAVE_FCHMOD)
|
|
||||||
CHECK_FUNCTION_EXISTS (fcntl HAVE_FCNTL)
|
CHECK_FUNCTION_EXISTS (fcntl HAVE_FCNTL)
|
||||||
CHECK_FUNCTION_EXISTS (fconvert HAVE_FCONVERT)
|
|
||||||
CHECK_FUNCTION_EXISTS (fdatasync HAVE_FDATASYNC)
|
|
||||||
CHECK_FUNCTION_EXISTS (fesetround HAVE_FESETROUND)
|
|
||||||
CHECK_FUNCTION_EXISTS (finite HAVE_FINITE)
|
|
||||||
CHECK_FUNCTION_EXISTS (fseeko HAVE_FSEEKO)
|
|
||||||
CHECK_FUNCTION_EXISTS (fsync HAVE_FSYNC)
|
|
||||||
CHECK_FUNCTION_EXISTS (getaddrinfo HAVE_GETADDRINFO)
|
|
||||||
CHECK_FUNCTION_EXISTS (getcwd HAVE_GETCWD)
|
|
||||||
CHECK_FUNCTION_EXISTS (gethostbyaddr_r HAVE_GETHOSTBYADDR_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (gethostbyname_r HAVE_GETHOSTBYNAME_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (gethrtime HAVE_GETHRTIME)
|
|
||||||
CHECK_FUNCTION_EXISTS (getnameinfo HAVE_GETNAMEINFO)
|
|
||||||
CHECK_FUNCTION_EXISTS (getpagesize HAVE_GETPAGESIZE)
|
|
||||||
CHECK_FUNCTION_EXISTS (getpass HAVE_GETPASS)
|
|
||||||
CHECK_FUNCTION_EXISTS (getpassphrase HAVE_GETPASSPHRASE)
|
|
||||||
CHECK_FUNCTION_EXISTS (getpwnam HAVE_GETPWNAM)
|
|
||||||
CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID)
|
|
||||||
CHECK_FUNCTION_EXISTS (getrlimit HAVE_GETRLIMIT)
|
|
||||||
CHECK_FUNCTION_EXISTS (getrusage HAVE_GETRUSAGE)
|
|
||||||
CHECK_FUNCTION_EXISTS (getwd HAVE_GETWD)
|
|
||||||
CHECK_FUNCTION_EXISTS (gmtime_r HAVE_GMTIME_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (initgroups HAVE_INITGROUPS)
|
|
||||||
CHECK_FUNCTION_EXISTS (ldiv HAVE_LDIV)
|
|
||||||
CHECK_FUNCTION_EXISTS (localtime_r HAVE_LOCALTIME_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (log2 HAVE_LOG2)
|
|
||||||
CHECK_FUNCTION_EXISTS (longjmp HAVE_LONGJMP)
|
|
||||||
CHECK_FUNCTION_EXISTS (lstat HAVE_LSTAT)
|
|
||||||
CHECK_FUNCTION_EXISTS (madvise HAVE_MADVISE)
|
|
||||||
CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO)
|
|
||||||
CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
|
|
||||||
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
|
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
|
||||||
CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE)
|
|
||||||
CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP)
|
|
||||||
CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK)
|
|
||||||
CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL)
|
|
||||||
CHECK_FUNCTION_EXISTS (mmap HAVE_MMAP)
|
|
||||||
CHECK_FUNCTION_EXISTS (mmap64 HAVE_MMAP64)
|
|
||||||
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
|
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
|
||||||
CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE)
|
CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE)
|
||||||
CHECK_FUNCTION_EXISTS (perror HAVE_PERROR)
|
|
||||||
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
|
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
|
||||||
CHECK_FUNCTION_EXISTS (pread HAVE_PREAD)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_setprio HAVE_PTHREAD_ATTR_SETPRIO)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_setschedparam HAVE_PTHREAD_ATTR_SETSCHEDPARAM)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_kill HAVE_PTHREAD_KILL)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_setprio_np HAVE_PTHREAD_SETPRIO_NP)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_setschedparam HAVE_PTHREAD_SETSCHEDPARAM)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_threadmask HAVE_PTHREAD_THREADMASK)
|
|
||||||
CHECK_FUNCTION_EXISTS (pthread_yield_np HAVE_PTHREAD_YIELD_NP)
|
|
||||||
CHECK_FUNCTION_EXISTS (readdir_r HAVE_READDIR_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (readlink HAVE_READLINK)
|
|
||||||
CHECK_FUNCTION_EXISTS (realpath HAVE_REALPATH)
|
|
||||||
CHECK_FUNCTION_EXISTS (rename HAVE_RENAME)
|
|
||||||
CHECK_FUNCTION_EXISTS (sched_yield HAVE_SCHED_YIELD)
|
|
||||||
CHECK_FUNCTION_EXISTS (select HAVE_SELECT)
|
|
||||||
CHECK_FUNCTION_EXISTS (setfd HAVE_SETFD)
|
|
||||||
CHECK_FUNCTION_EXISTS (setfilepointer HAVE_SETFILEPOINTER)
|
|
||||||
CHECK_FUNCTION_EXISTS (sigaction HAVE_SIGACTION)
|
|
||||||
CHECK_FUNCTION_EXISTS (sigthreadmask HAVE_SIGTHREADMASK)
|
|
||||||
CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT)
|
|
||||||
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
|
|
||||||
CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF)
|
|
||||||
CHECK_FUNCTION_EXISTS (stpcpy HAVE_STPCPY)
|
|
||||||
CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR)
|
|
||||||
CHECK_FUNCTION_EXISTS (strlcpy HAVE_STRLCPY)
|
|
||||||
CHECK_FUNCTION_EXISTS (strnlen HAVE_STRNLEN)
|
|
||||||
CHECK_FUNCTION_EXISTS (strpbrk HAVE_STRPBRK)
|
|
||||||
CHECK_FUNCTION_EXISTS (strsep HAVE_STRSEP)
|
|
||||||
CHECK_FUNCTION_EXISTS (strstr HAVE_STRSTR)
|
|
||||||
CHECK_FUNCTION_EXISTS (strtok_r HAVE_STRTOK_R)
|
|
||||||
CHECK_FUNCTION_EXISTS (strtol HAVE_STRTOL)
|
|
||||||
CHECK_FUNCTION_EXISTS (strtoll HAVE_STRTOLL)
|
|
||||||
CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL)
|
|
||||||
CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL)
|
|
||||||
CHECK_FUNCTION_EXISTS (tell HAVE_TELL)
|
|
||||||
CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY)
|
|
||||||
CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD)
|
|
||||||
CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF)
|
|
||||||
CHECK_FUNCTION_EXISTS (vsnprintf HAVE_VSNPRINTF)
|
|
||||||
|
@@ -14,21 +14,10 @@ INCLUDE(CheckIncludeFiles)
|
|||||||
|
|
||||||
CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
|
CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
|
||||||
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
|
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
|
||||||
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
|
|
||||||
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
|
|
||||||
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
|
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
|
||||||
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
|
|
||||||
CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H)
|
CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H)
|
||||||
CHECK_INCLUDE_FILES (fenv.h HAVE_FENV_H)
|
|
||||||
CHECK_INCLUDE_FILES (float.h HAVE_FLOAT_H)
|
CHECK_INCLUDE_FILES (float.h HAVE_FLOAT_H)
|
||||||
CHECK_INCLUDE_FILES (fpu/control.h HAVE_FPU_CONTROL_H)
|
|
||||||
CHECK_INCLUDE_FILES (grp.h HAVE_GRP_H)
|
|
||||||
CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
|
|
||||||
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
|
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
|
||||||
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
|
|
||||||
CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
|
|
||||||
CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
|
|
||||||
CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H)
|
|
||||||
CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
|
CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
|
||||||
CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
|
CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
|
||||||
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
|
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
|
||||||
@@ -49,28 +38,11 @@ ENDIF(HAVE_STDINT_H)
|
|||||||
CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
|
CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
|
||||||
CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
|
CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
|
||||||
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
|
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
|
||||||
CHECK_INCLUDE_FILES (synch.h HAVE_SYNCH_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/fpu.h HAVE_SYS_FPU_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
|
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||||
CHECK_INCLUDE_FILES (sys/ipc.h HAVE_SYS_IPC_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/mman.h HAVE_SYS_MMAN_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/prctl.h HAVE_SYS_PRCTL_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
|
CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
|
||||||
CHECK_INCLUDE_FILES (sys/shm.h HAVE_SYS_SHM_H)
|
|
||||||
|
|
||||||
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
|
|
||||||
IF(HAVE_SYS_SOCKET_H)
|
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
|
|
||||||
ENDIF(HAVE_SYS_SOCKET_H)
|
|
||||||
|
|
||||||
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/timeb.h HAVE_SYS_TIMEB_H)
|
|
||||||
CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
|
CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
|
||||||
CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
|
CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
|
||||||
CHECK_INCLUDE_FILES (sysent.h HAVE_SYSENT_H)
|
|
||||||
CHECK_INCLUDE_FILES (termio.h HAVE_TERMIO_H)
|
|
||||||
CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H)
|
|
||||||
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
|
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
|
||||||
CHECK_INCLUDE_FILES (utime.h HAVE_UTIME_H)
|
CHECK_INCLUDE_FILES (utime.h HAVE_UTIME_H)
|
||||||
CHECK_INCLUDE_FILES (ucontext.h HAVE_UCONTEXT_H)
|
CHECK_INCLUDE_FILES (ucontext.h HAVE_UCONTEXT_H)
|
||||||
|
@@ -12,17 +12,14 @@
|
|||||||
INCLUDE (CheckTypeSize)
|
INCLUDE (CheckTypeSize)
|
||||||
|
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES signal.h)
|
SET(CMAKE_EXTRA_INCLUDE_FILES signal.h)
|
||||||
CHECK_TYPE_SIZE(sigset_t SIZEOF_SIGSET_T)
|
|
||||||
CHECK_TYPE_SIZE(char SIZEOF_CHAR)
|
|
||||||
CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
|
CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
|
||||||
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
|
|
||||||
CHECK_TYPE_SIZE(int SIZEOF_INT)
|
CHECK_TYPE_SIZE(int SIZEOF_INT)
|
||||||
CHECK_TYPE_SIZE(long SIZEOF_LONG)
|
CHECK_TYPE_SIZE(long SIZEOF_LONG)
|
||||||
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
|
SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
|
||||||
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
|
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
|
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
|
||||||
CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
|
|
||||||
CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR)
|
CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR)
|
||||||
CHECK_TYPE_SIZE(uint SIZEOF_UINT)
|
CHECK_TYPE_SIZE(uint SIZEOF_UINT)
|
||||||
CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
|
CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
|
||||||
@@ -32,7 +29,6 @@ CHECK_TYPE_SIZE(int16 SIZEOF_INT16)
|
|||||||
CHECK_TYPE_SIZE(uint16 SIZEOF_UINT16)
|
CHECK_TYPE_SIZE(uint16 SIZEOF_UINT16)
|
||||||
CHECK_TYPE_SIZE(int32 SIZEOF_INT32)
|
CHECK_TYPE_SIZE(int32 SIZEOF_INT32)
|
||||||
CHECK_TYPE_SIZE(uint32 SIZEOF_UINT32)
|
CHECK_TYPE_SIZE(uint32 SIZEOF_UINT32)
|
||||||
CHECK_TYPE_SIZE(u_int32_t SIZEOF_UINT_32_T)
|
|
||||||
CHECK_TYPE_SIZE(int64 SIZEOF_INT64)
|
CHECK_TYPE_SIZE(int64 SIZEOF_INT64)
|
||||||
CHECK_TYPE_SIZE(uint64 SIZEOF_UINT64)
|
CHECK_TYPE_SIZE(uint64 SIZEOF_UINT64)
|
||||||
CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
|
CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
|
||||||
@@ -42,53 +38,6 @@ CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
|
|||||||
#
|
#
|
||||||
INCLUDE (CheckCSourceCompiles)
|
INCLUDE (CheckCSourceCompiles)
|
||||||
|
|
||||||
#
|
|
||||||
# signal handler
|
|
||||||
#
|
|
||||||
CHECK_C_SOURCE_COMPILES("
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#ifdef signal
|
|
||||||
#undef signal
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern \"C\" void (*signal (int, void (*)(int)))(int);
|
|
||||||
#else
|
|
||||||
void (*signal ()) ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int ac, char **av)
|
|
||||||
{
|
|
||||||
}"
|
|
||||||
IS_VOID_SIGNAL)
|
|
||||||
|
|
||||||
IF(IS_VOID_SIGNAL)
|
|
||||||
SET(RETSIGTYPE "void")
|
|
||||||
ELSE(IS_VOID_SIGNAL)
|
|
||||||
SET(RETSIGTYPE "int")
|
|
||||||
ENDIF(IS_VOID_SIGNAL)
|
|
||||||
|
|
||||||
#
|
|
||||||
# quick sort
|
|
||||||
#
|
|
||||||
CHECK_C_SOURCE_COMPILES("
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern \"C\" void qsort(void *base, size_t nel, size_t width, int (*compar) (const void *, const void *));
|
|
||||||
#else
|
|
||||||
void qsort(void *base, size_t nel, size_t width, int (*compar) (const void *, const void *));
|
|
||||||
#endif
|
|
||||||
int main(int ac, char **av)
|
|
||||||
{
|
|
||||||
}"
|
|
||||||
IS_VOID_QSORT)
|
|
||||||
IF(IS_VOID_QSORT)
|
|
||||||
SET(RETQSORTTYPE "void")
|
|
||||||
ELSE(IS_VOID_QSORT)
|
|
||||||
SET(RETQSORTTYPE "int")
|
|
||||||
ENDIF(IS_VOID_QSORT)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# SOCKET_SIZE
|
# SOCKET_SIZE
|
||||||
#
|
#
|
||||||
|
@@ -6,147 +6,34 @@
|
|||||||
#cmakedefine HAVE_BIGENDIAN 1
|
#cmakedefine HAVE_BIGENDIAN 1
|
||||||
#cmakedefine HAVE_SETLOCALE 1
|
#cmakedefine HAVE_SETLOCALE 1
|
||||||
#cmakedefine HAVE_NL_LANGINFO 1
|
#cmakedefine HAVE_NL_LANGINFO 1
|
||||||
#cmakedefine HAVE_ARPA_INET_H 1
|
|
||||||
#cmakedefine HAVE_CRYPT_H 1
|
|
||||||
#cmakedefine HAVE_DIRENT_H 1
|
|
||||||
#cmakedefine HAVE_DLFCN_H 1
|
#cmakedefine HAVE_DLFCN_H 1
|
||||||
#cmakedefine HAVE_EXECINFO_H 1
|
|
||||||
#cmakedefine HAVE_FCNTL_H 1
|
#cmakedefine HAVE_FCNTL_H 1
|
||||||
#cmakedefine HAVE_FENV_H 1
|
|
||||||
#cmakedefine HAVE_FLOAT_H 1
|
#cmakedefine HAVE_FLOAT_H 1
|
||||||
#cmakedefine HAVE_FPU_CONTROL_H 1
|
|
||||||
#cmakedefine HAVE_GRP_H 1
|
|
||||||
#cmakedefine HAVE_IEEEFP_H 1
|
|
||||||
#cmakedefine HAVE_LIMITS_H 1
|
#cmakedefine HAVE_LIMITS_H 1
|
||||||
#cmakedefine HAVE_MALLOC_H 1
|
|
||||||
#cmakedefine HAVE_MEMORY_H 1
|
|
||||||
#cmakedefine HAVE_NETINET_IN_H 1
|
|
||||||
#cmakedefine HAVE_PATHS_H 1
|
|
||||||
#cmakedefine HAVE_PWD_H 1
|
#cmakedefine HAVE_PWD_H 1
|
||||||
#cmakedefine HAVE_SCHED_H 1
|
|
||||||
#cmakedefine HAVE_SELECT_H 1
|
#cmakedefine HAVE_SELECT_H 1
|
||||||
#cmakedefine HAVE_STDDEF_H 1
|
#cmakedefine HAVE_STDDEF_H 1
|
||||||
#cmakedefine HAVE_STDINT_H 1
|
#cmakedefine HAVE_STDINT_H 1
|
||||||
#cmakedefine HAVE_STDLIB_H 1
|
#cmakedefine HAVE_STDLIB_H 1
|
||||||
#cmakedefine HAVE_STRING_H 1
|
#cmakedefine HAVE_STRING_H 1
|
||||||
#cmakedefine HAVE_STRINGS_H 1
|
|
||||||
#cmakedefine HAVE_SYNCH_H 1
|
|
||||||
#cmakedefine HAVE_SYS_FPU_H 1
|
|
||||||
#cmakedefine HAVE_SYS_IOCTL_H 1
|
#cmakedefine HAVE_SYS_IOCTL_H 1
|
||||||
#cmakedefine HAVE_SYS_IPC_H 1
|
|
||||||
#cmakedefine HAVE_SYS_MMAN_H 1
|
|
||||||
#cmakedefine HAVE_SYS_PRCTL_H 1
|
|
||||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||||
#cmakedefine HAVE_SYS_SHM_H 1
|
|
||||||
#cmakedefine HAVE_SYS_SOCKET_H 1
|
#cmakedefine HAVE_SYS_SOCKET_H 1
|
||||||
#cmakedefine HAVE_SYS_STAT_H 1
|
|
||||||
#cmakedefine HAVE_SYS_STREAM_H 1
|
#cmakedefine HAVE_SYS_STREAM_H 1
|
||||||
#cmakedefine HAVE_SYS_TIMEB_H 1
|
|
||||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||||
#cmakedefine HAVE_SYS_UN_H 1
|
#cmakedefine HAVE_SYS_UN_H 1
|
||||||
#cmakedefine HAVE_SYSENT_H 1
|
|
||||||
#cmakedefine HAVE_TERMIO_H 1
|
|
||||||
#cmakedefine HAVE_TERMIOS_H 1
|
|
||||||
#cmakedefine HAVE_UNISTD_H 1
|
#cmakedefine HAVE_UNISTD_H 1
|
||||||
#cmakedefine HAVE_UTIME_H 1
|
|
||||||
#cmakedefine HAVE_UCONTEXT_H 1
|
#cmakedefine HAVE_UCONTEXT_H 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function definitions - processed in LibmysqlFunctions.txt
|
* function definitions - processed in LibmysqlFunctions.txt
|
||||||
*/
|
*/
|
||||||
#cmakedefine HAVE_ACCESS 1
|
|
||||||
#cmakedefine HAVE_AIOWAIT 1
|
|
||||||
#cmakedefine HAVE_ALARM 1
|
|
||||||
#cmakedefine HAVE_ALLOCA 1
|
|
||||||
#cmakedefine HAVE_BCMP 1
|
|
||||||
#cmakedefine HAVE_BFILL 1
|
|
||||||
#cmakedefine HAVE_BMOVE 1
|
|
||||||
#cmakedefine HAVE_BZERO 1
|
|
||||||
#cmakedefine HAVE_CLOCK_GETTIME 1
|
|
||||||
#cmakedefine HAVE_COMPRESS 1
|
|
||||||
#cmakedefine HAVE_CRYPT 1
|
|
||||||
#cmakedefine HAVE_DLERROR 1
|
#cmakedefine HAVE_DLERROR 1
|
||||||
#cmakedefine HAVE_DLOPEN 1
|
#cmakedefine HAVE_DLOPEN 1
|
||||||
#cmakedefine HAVE_FCHMOD 1
|
|
||||||
#cmakedefine HAVE_FCNTL 1
|
|
||||||
#cmakedefine HAVE_FCONVERT 1
|
|
||||||
#cmakedefine HAVE_FDATASYNC 1
|
|
||||||
#cmakedefine HAVE_FESETROUND 1
|
|
||||||
#cmakedefine HAVE_FINITE 1
|
|
||||||
#cmakedefine HAVE_FSEEKO 1
|
|
||||||
#cmakedefine HAVE_FSYNC 1
|
|
||||||
#cmakedefine HAVE_GETADDRINFO 1
|
|
||||||
#cmakedefine HAVE_GETCWD 1
|
|
||||||
#cmakedefine HAVE_GETHOSTBYADDR_R 1
|
|
||||||
#cmakedefine HAVE_GETHOSTBYNAME_R 1
|
|
||||||
#cmakedefine HAVE_GETHRTIME 1
|
|
||||||
#cmakedefine HAVE_GETNAMEINFO 1
|
|
||||||
#cmakedefine HAVE_GETPAGESIZE 1
|
|
||||||
#cmakedefine HAVE_GETPASS 1
|
|
||||||
#cmakedefine HAVE_GETPASSPHRASE 1
|
|
||||||
#cmakedefine HAVE_GETPWNAM 1
|
|
||||||
#cmakedefine HAVE_GETPWUID 1
|
#cmakedefine HAVE_GETPWUID 1
|
||||||
#cmakedefine HAVE_GETRLIMIT 1
|
|
||||||
#cmakedefine HAVE_GETRUSAGE 1
|
|
||||||
#cmakedefine HAVE_GETWD 1
|
|
||||||
#cmakedefine HAVE_GMTIME_R 1
|
|
||||||
#cmakedefine HAVE_INITGROUPS 1
|
|
||||||
#cmakedefine HAVE_LDIV 1
|
|
||||||
#cmakedefine HAVE_LOCALTIME_R 1
|
|
||||||
#cmakedefine HAVE_LOG2 1
|
|
||||||
#cmakedefine HAVE_LONGJMP 1
|
|
||||||
#cmakedefine HAVE_LSTAT 1
|
|
||||||
#cmakedefine HAVE_MADVISE 1
|
|
||||||
#cmakedefine HAVE_MALLINFO 1
|
|
||||||
#cmakedefine HAVE_MEMALIGN 1
|
|
||||||
#cmakedefine HAVE_MEMCPY 1
|
#cmakedefine HAVE_MEMCPY 1
|
||||||
#cmakedefine HAVE_MEMMOVE 1
|
|
||||||
#cmakedefine HAVE_MKSTEMP 1
|
|
||||||
#cmakedefine HAVE_MLOCK 1
|
|
||||||
#cmakedefine HAVE_MLOCKALL 1
|
|
||||||
#cmakedefine HAVE_MMAP 1
|
|
||||||
#cmakedefine HAVE_MMAP64 1
|
|
||||||
#cmakedefine HAVE_PERROR 1
|
|
||||||
#cmakedefine HAVE_POLL 1
|
#cmakedefine HAVE_POLL 1
|
||||||
#cmakedefine HAVE_PREAD 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_INIT 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_KILL 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_SETPRIO_NP 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_SETSCHEDPARAM 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_SIGMASK 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_THREADMASK 1
|
|
||||||
#cmakedefine HAVE_PTHREAD_YIELD_NP 1
|
|
||||||
#cmakedefine HAVE_READDIR_R 1
|
|
||||||
#cmakedefine HAVE_READLINK 1
|
|
||||||
#cmakedefine HAVE_REALPATH 1
|
|
||||||
#cmakedefine HAVE_RENAME 1
|
|
||||||
#cmakedefine HAVE_SCHED_YIELD 1
|
|
||||||
#cmakedefine HAVE_SELECT 1
|
|
||||||
#cmakedefine HAVE_SETFD 1
|
|
||||||
#cmakedefine HAVE_SETFILEPOINTER 1
|
|
||||||
#cmakedefine HAVE_SIGNAL 1
|
|
||||||
#cmakedefine HAVE_SIGACTION 1
|
|
||||||
#cmakedefine HAVE_SIGTHREADMASK 1
|
|
||||||
#cmakedefine HAVE_SIGWAIT 1
|
|
||||||
#cmakedefine HAVE_SLEEP 1
|
|
||||||
#cmakedefine HAVE_SNPRINTF 1
|
|
||||||
#cmakedefine HAVE_SQLITE 1
|
|
||||||
#cmakedefine HAVE_STPCPY 1
|
|
||||||
#cmakedefine HAVE_STRERROR 1
|
|
||||||
#cmakedefine HAVE_STRLCPY 1
|
|
||||||
#cmakedefine HAVE_STRNLEN 1
|
|
||||||
#cmakedefine HAVE_STRPBRK 1
|
|
||||||
#cmakedefine HAVE_STRSEP 1
|
|
||||||
#cmakedefine HAVE_STRSTR 1
|
|
||||||
#cmakedefine HAVE_STRTOK_R 1
|
#cmakedefine HAVE_STRTOK_R 1
|
||||||
#cmakedefine HAVE_STRTOL 1
|
#cmakedefine HAVE_STRTOL 1
|
||||||
#cmakedefine HAVE_STRTOLL 1
|
#cmakedefine HAVE_STRTOLL 1
|
||||||
@@ -161,21 +48,13 @@
|
|||||||
/*
|
/*
|
||||||
* types and sizes
|
* types and sizes
|
||||||
*/
|
*/
|
||||||
/* Types we may use */
|
|
||||||
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
|
|
||||||
#if defined(SIZEOF_CHAR)
|
|
||||||
# define HAVE_CHAR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
|
#cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
|
||||||
#if defined(SIZEOF_CHARP)
|
#if defined(SIZEOF_CHARP)
|
||||||
# define HAVE_CHARP 1
|
# define HAVE_CHARP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
|
|
||||||
#if defined(SIZEOF_SHORT)
|
|
||||||
# define HAVE_SHORT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_INT @SIZEOF_INT@
|
#cmakedefine SIZEOF_INT @SIZEOF_INT@
|
||||||
#if defined(SIZEOF_INT)
|
#if defined(SIZEOF_INT)
|
||||||
@@ -193,20 +72,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_SIGSET_T @SIZEOF_SIGSET_T@
|
|
||||||
#if defined(SIZEOF_SIGSET_T)
|
|
||||||
# define HAVE_SIGSET_T 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
||||||
#if defined(SIZEOF_SIZE_T)
|
#if defined(SIZEOF_SIZE_T)
|
||||||
# define HAVE_SIZE_T 1
|
# define HAVE_SIZE_T 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
|
|
||||||
#if defined(SIZEOF_UCHAR)
|
|
||||||
# define HAVE_UCHAR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
|
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
|
||||||
#if defined(SIZEOF_UINT)
|
#if defined(SIZEOF_UINT)
|
||||||
@@ -244,10 +114,6 @@
|
|||||||
#if defined(SIZEOF_UINT32)
|
#if defined(SIZEOF_UINT32)
|
||||||
# define HAVE_UINT32 1
|
# define HAVE_UINT32 1
|
||||||
#endif
|
#endif
|
||||||
#cmakedefine SIZEOF_U_INT32_T @SIZEOF_U_INT32_T@
|
|
||||||
#if defined(SIZEOF_U_INT32_T)
|
|
||||||
# define HAVE_U_INT32_T 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
|
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
|
||||||
#if defined(SIZEOF_INT64)
|
#if defined(SIZEOF_INT64)
|
||||||
|
@@ -108,10 +108,6 @@ double my_ulonglong2double(unsigned long long A);
|
|||||||
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
|
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
|
||||||
#undef HAVE_SNPRINTF
|
#undef HAVE_SNPRINTF
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_BROKEN_PREAD /* These doesn't work on HPUX 11.x */
|
|
||||||
#undef HAVE_PREAD
|
|
||||||
#undef HAVE_PWRITE
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
|
#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
|
||||||
#undef inline
|
#undef inline
|
||||||
#define inline
|
#define inline
|
||||||
@@ -513,16 +509,6 @@ extern double my_atof(const char*);
|
|||||||
#define UNINIT_VAR(x) x= x
|
#define UNINIT_VAR(x) x= x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Remove some things that mit_thread break or doesn't support */
|
|
||||||
#if defined(HAVE_mit_thread) && defined(THREAD)
|
|
||||||
#undef HAVE_PREAD
|
|
||||||
#undef HAVE_REALPATH
|
|
||||||
#undef HAVE_MLOCK
|
|
||||||
#undef HAVE_TEMPNAM /* Use ours */
|
|
||||||
#undef HAVE_PTHREAD_SETPRIO
|
|
||||||
#undef HAVE_FTRUNCATE
|
|
||||||
#undef HAVE_READLINK
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is from the old m-machine.h file */
|
/* This is from the old m-machine.h file */
|
||||||
|
|
||||||
|
@@ -21,563 +21,13 @@
|
|||||||
#ifndef _my_pthread_h
|
#ifndef _my_pthread_h
|
||||||
#define _my_pthread_h
|
#define _my_pthread_h
|
||||||
|
|
||||||
#undef SAFE_MUTEX
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#ifndef ETIME
|
|
||||||
#define ETIME ETIMEDOUT /* For FreeBSD */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
typedef CRITICAL_SECTION pthread_mutex_t;
|
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||||
|
|
||||||
typedef HANDLE pthread_t;
|
|
||||||
typedef struct thread_attr {
|
|
||||||
DWORD dwStackSize ;
|
|
||||||
DWORD dwCreatingFlag ;
|
|
||||||
int priority ;
|
|
||||||
} pthread_attr_t ;
|
|
||||||
|
|
||||||
typedef struct { int dummy; } pthread_condattr_t;
|
|
||||||
|
|
||||||
/* Implementation of posix conditions */
|
|
||||||
|
|
||||||
typedef struct st_pthread_link {
|
|
||||||
DWORD thread_id;
|
|
||||||
struct st_pthread_link *next;
|
|
||||||
} pthread_link;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32 waiting;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SIGNAL = 0,
|
|
||||||
BROADCAST = 1,
|
|
||||||
MAX_EVENTS = 2
|
|
||||||
} EVENTS;
|
|
||||||
HANDLE events[MAX_EVENTS];
|
|
||||||
CRITICAL_SECTION waiters_count_lock;
|
|
||||||
} pthread_cond_t;
|
|
||||||
|
|
||||||
#ifndef _TIMESPEC_DEFINED
|
|
||||||
#if (!defined(_MSC_VER) || _MSC_VER < 1900)
|
|
||||||
struct timespec { /* For pthread_cond_timedwait() */
|
|
||||||
time_t tv_sec;
|
|
||||||
long tv_nsec;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int pthread_mutexattr_t;
|
|
||||||
#define pthread_self() GetCurrentThreadId()
|
|
||||||
|
|
||||||
#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
|
|
||||||
typedef void * (__cdecl *pthread_handler)(void *);
|
|
||||||
|
|
||||||
void win_pthread_init(void);
|
|
||||||
|
|
||||||
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
|
|
||||||
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
|
|
||||||
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
|
|
||||||
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
|
||||||
struct timespec *abstime);
|
|
||||||
int pthread_cond_signal(pthread_cond_t *cond);
|
|
||||||
int pthread_cond_broadcast(pthread_cond_t *cond);
|
|
||||||
int pthread_cond_destroy(pthread_cond_t *cond);
|
|
||||||
int pthread_attr_init(pthread_attr_t *connect_att);
|
|
||||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
|
|
||||||
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
|
|
||||||
int pthread_attr_destroy(pthread_attr_t *connect_att);
|
|
||||||
struct tm *localtime_r(const time_t *timep,struct tm *tmp);
|
|
||||||
|
|
||||||
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
|
|
||||||
|
|
||||||
#ifndef OS2
|
|
||||||
#define getpid() GetCurrentThreadId()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HAVE_LOCALTIME_R 1
|
|
||||||
#define _REENTRANT 1
|
|
||||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
|
||||||
|
|
||||||
#undef SAFE_MUTEX /* This will cause conflicts */
|
|
||||||
#define pthread_key(T,V) DWORD V
|
|
||||||
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
|
|
||||||
#define pthread_getspecific(A) (TlsGetValue(A))
|
|
||||||
#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
|
|
||||||
#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
|
|
||||||
#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
|
|
||||||
#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
|
|
||||||
|
|
||||||
|
|
||||||
#define pthread_equal(A,B) ((A) == (B))
|
|
||||||
|
|
||||||
#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
|
#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
|
||||||
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
|
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
|
||||||
#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
|
|
||||||
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
||||||
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
||||||
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
|
|
||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
|
||||||
|
|
||||||
|
|
||||||
/* Dummy defines for easier code */
|
|
||||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
|
||||||
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)
|
|
||||||
#define pthread_attr_setscope(A,B)
|
|
||||||
#define pthread_detach_this_thread()
|
|
||||||
#define pthread_condattr_init(A)
|
|
||||||
#define pthread_condattr_destroy(A)
|
|
||||||
|
|
||||||
/*Irena: compiler does not like this: */
|
|
||||||
/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */
|
|
||||||
#define my_pthread_getprio(thread_id) pthread_dummy(0)
|
|
||||||
|
|
||||||
#elif defined(HAVE_UNIXWARE7_THREADS)
|
|
||||||
|
|
||||||
#include <thread.h>
|
|
||||||
#include <synch.h>
|
|
||||||
|
|
||||||
#ifndef _REENTRANT
|
|
||||||
#define _REENTRANT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HAVE_NONPOSIX_SIGWAIT
|
|
||||||
#define pthread_t thread_t
|
|
||||||
#define pthread_cond_t cond_t
|
|
||||||
#define pthread_mutex_t mutex_t
|
|
||||||
#define pthread_key_t thread_key_t
|
|
||||||
typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
|
|
||||||
|
|
||||||
#define pthread_key_create(A,B) thr_keycreate((A),(B))
|
|
||||||
|
|
||||||
#define pthread_handler_decl(A,B) void *A(void *B)
|
|
||||||
#define pthread_key(T,V) pthread_key_t V
|
|
||||||
|
|
||||||
void * my_pthread_getspecific_imp(pthread_key_t key);
|
|
||||||
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
|
|
||||||
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V)
|
|
||||||
|
|
||||||
#define pthread_setspecific(A,B) thr_setspecific(A,B)
|
|
||||||
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
|
|
||||||
|
|
||||||
#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A))
|
|
||||||
#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL)
|
|
||||||
#define pthread_cond_destroy(a) cond_destroy(a)
|
|
||||||
#define pthread_cond_signal(a) cond_signal(a)
|
|
||||||
#define pthread_cond_wait(a,b) cond_wait((a),(b))
|
|
||||||
#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c))
|
|
||||||
#define pthread_cond_broadcast(a) cond_broadcast(a)
|
|
||||||
|
|
||||||
#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL)
|
|
||||||
#define pthread_mutex_lock(a) mutex_lock(a)
|
|
||||||
#define pthread_mutex_unlock(a) mutex_unlock(a)
|
|
||||||
#define pthread_mutex_destroy(a) mutex_destroy(a)
|
|
||||||
|
|
||||||
#define pthread_self() thr_self()
|
|
||||||
#define pthread_exit(A) thr_exit(A)
|
|
||||||
#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0)
|
|
||||||
#define pthread_kill(A,B) thr_kill((A),(B))
|
|
||||||
#define HAVE_PTHREAD_KILL
|
|
||||||
|
|
||||||
#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C))
|
|
||||||
|
|
||||||
extern int my_sigwait(const sigset_t *set,int *sig);
|
|
||||||
|
|
||||||
#define pthread_detach_this_thread() pthread_dummy(0)
|
|
||||||
|
|
||||||
#define pthread_attr_init(A) pthread_dummy(0)
|
|
||||||
#define pthread_attr_destroy(A) pthread_dummy(0)
|
|
||||||
#define pthread_attr_setscope(A,B) pthread_dummy(0)
|
|
||||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
|
||||||
#define my_pthread_setprio(A,B) pthread_dummy (0)
|
|
||||||
#define my_pthread_getprio(A) pthread_dummy (0)
|
|
||||||
#define my_pthread_attr_setprio(A,B) pthread_dummy(0)
|
|
||||||
|
|
||||||
#else /* Normal threads */
|
|
||||||
|
|
||||||
#ifdef HAVE_rts_threads
|
|
||||||
#define sigwait org_sigwait
|
|
||||||
#include <signal.h>
|
|
||||||
#undef sigwait
|
|
||||||
#endif
|
|
||||||
#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */
|
|
||||||
#include <pthread.h>
|
|
||||||
#ifndef _REENTRANT
|
|
||||||
#define _REENTRANT
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_THR_SETCONCURRENCY
|
|
||||||
#include <thread.h> /* Probably solaris */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SCHED_H
|
|
||||||
#include <sched.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYNCH_H
|
|
||||||
#include <synch.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
|
|
||||||
#error Requires at least rev 2 of EMX pthreads library.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int my_pthread_getprio(pthread_t thread_id);
|
|
||||||
|
|
||||||
#define pthread_key(T,V) pthread_key_t V
|
|
||||||
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
|
|
||||||
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
|
|
||||||
#define pthread_detach_this_thread()
|
|
||||||
#define pthread_handler_decl(A,B) void *A(void *B)
|
|
||||||
typedef void *(* pthread_handler)(void *);
|
|
||||||
|
|
||||||
/* Test first for RTS or FSU threads */
|
|
||||||
|
|
||||||
#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
|
|
||||||
#define HAVE_rts_threads
|
|
||||||
extern int my_pthread_create_detached;
|
|
||||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
|
||||||
#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached
|
|
||||||
#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL
|
|
||||||
#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL
|
|
||||||
#define USE_ALARM_THREAD
|
|
||||||
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
|
|
||||||
|
|
||||||
#if defined(HAVE_UNIXWARE7_POSIX)
|
|
||||||
#undef HAVE_NONPOSIX_SIGWAIT
|
|
||||||
#define HAVE_NONPOSIX_SIGWAIT /* sigwait takes only 1 argument */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_NONPOSIX_SIGWAIT
|
|
||||||
#define my_sigwait(A,B) sigwait((A),(B))
|
|
||||||
#else
|
|
||||||
int my_sigwait(const sigset_t *set,int *sig);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
|
|
||||||
#ifndef SAFE_MUTEX
|
|
||||||
#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
|
|
||||||
extern int my_pthread_mutex_init(pthread_mutex_t *mp,
|
|
||||||
const pthread_mutexattr_t *attr);
|
|
||||||
#endif /* SAFE_MUTEX */
|
|
||||||
#define pthread_cond_init(a,b) my_pthread_cond_init((a),(b))
|
|
||||||
extern int my_pthread_cond_init(pthread_cond_t *mp,
|
|
||||||
const pthread_condattr_t *attr);
|
|
||||||
#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
|
|
||||||
|
|
||||||
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
|
|
||||||
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
|
|
||||||
int sigwait(sigset_t *setp, int *sigp); /* Use our implementation */
|
|
||||||
#endif
|
|
||||||
#if !defined(HAVE_SIGSET) && !defined(my_sigset)
|
|
||||||
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; \
|
|
||||||
sigemptyset(&set); \
|
|
||||||
s.sa_handler = (B); \
|
|
||||||
s.sa_mask = set; \
|
|
||||||
s.sa_flags = 0; \
|
|
||||||
sigaction((A), &s, (struct sigaction *) NULL); \
|
|
||||||
} while (0)
|
|
||||||
#elif !defined(my_sigset)
|
|
||||||
#define my_sigset(A,B) signal((A),(B))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef my_pthread_setprio
|
|
||||||
#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */
|
|
||||||
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
|
|
||||||
#elif defined(HAVE_PTHREAD_SETPRIO)
|
|
||||||
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
|
|
||||||
#else
|
|
||||||
extern void my_pthread_setprio(pthread_t thread_id,int prior);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef my_pthread_attr_setprio
|
|
||||||
#ifdef HAVE_PTHREAD_ATTR_SETPRIO
|
|
||||||
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))
|
|
||||||
#else
|
|
||||||
extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
|
|
||||||
#define pthread_attr_setscope(A,B)
|
|
||||||
#undef HAVE_GETHOSTBYADDR_R /* No definition */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
|
|
||||||
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
|
|
||||||
pthread_mutex_t *mutex,
|
|
||||||
struct timespec *abstime);
|
|
||||||
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
|
|
||||||
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
|
|
||||||
#else
|
|
||||||
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
|
|
||||||
void *my_pthread_getspecific_imp(pthread_key_t key);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_LOCALTIME_R
|
|
||||||
struct tm *localtime_r(const time_t *clock, struct tm *res);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_CONDATTR_CREATE
|
|
||||||
/* DCE threads on HPUX 10.20 */
|
|
||||||
#define pthread_condattr_init pthread_condattr_create
|
|
||||||
#define pthread_condattr_destroy pthread_condattr_delete
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
|
|
||||||
#define pthread_cond_destroy(A) pthread_dummy(0)
|
|
||||||
#define pthread_mutex_destroy(A) pthread_dummy(0)
|
|
||||||
#define pthread_attr_delete(A) pthread_dummy(0)
|
|
||||||
#define pthread_condattr_delete(A) pthread_dummy(0)
|
|
||||||
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
|
|
||||||
#define pthread_equal(A,B) ((A) == (B))
|
|
||||||
#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
|
|
||||||
#define pthread_attr_init(A) pthread_attr_create(A)
|
|
||||||
#define pthread_attr_destroy(A) pthread_attr_delete(A)
|
|
||||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
|
||||||
#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
|
|
||||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
|
||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
|
||||||
#undef pthread_detach_this_thread
|
|
||||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_DARWIN_THREADS
|
|
||||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
|
||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
|
||||||
#define pthread_condattr_init(A) pthread_dummy(0)
|
|
||||||
#define pthread_condattr_destroy(A) pthread_dummy(0)
|
|
||||||
#define pthread_signal(A,B) pthread_dummy(0)
|
|
||||||
#undef pthread_detach_this_thread
|
|
||||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
|
|
||||||
#undef sigset
|
|
||||||
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
|
|
||||||
/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */
|
|
||||||
#define pthread_key_create(A,B) \
|
|
||||||
pthread_keycreate(A,(B) ?\
|
|
||||||
(pthread_destructor_t) (B) :\
|
|
||||||
(pthread_destructor_t) pthread_dummy)
|
|
||||||
#define pthread_attr_init(A) pthread_attr_create(A)
|
|
||||||
#define pthread_attr_destroy(A) pthread_attr_delete(A)
|
|
||||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
|
||||||
#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
|
|
||||||
#ifndef pthread_sigmask
|
|
||||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
|
||||||
#endif
|
|
||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
|
||||||
#undef pthread_detach_this_thread
|
|
||||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
|
||||||
+#elif !defined(HAVE_PTHREAD_KILL) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
|
|
||||||
#define HAVE_PTHREAD_KILL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* defined(_WIN32) */
|
#endif /* defined(_WIN32) */
|
||||||
|
|
||||||
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
|
|
||||||
#undef pthread_cond_timedwait
|
|
||||||
#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,
|
|
||||||
struct timespec *abstime);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
|
|
||||||
#undef pthread_mutex_trylock
|
|
||||||
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
|
|
||||||
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* safe_mutex adds checking to mutex for easier debugging */
|
|
||||||
|
|
||||||
typedef struct st_safe_mutex_t
|
|
||||||
{
|
|
||||||
pthread_mutex_t global,mutex;
|
|
||||||
char *file;
|
|
||||||
uint line,count;
|
|
||||||
pthread_t thread;
|
|
||||||
} safe_mutex_t;
|
|
||||||
|
|
||||||
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr);
|
|
||||||
int safe_mutex_lock(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_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
|
|
||||||
uint line);
|
|
||||||
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
|
||||||
struct timespec *abstime, const char *file, uint line);
|
|
||||||
|
|
||||||
/* Wrappers if safe mutex is actually used */
|
|
||||||
#ifdef SAFE_MUTEX
|
|
||||||
#undef pthread_mutex_init
|
|
||||||
#undef pthread_mutex_lock
|
|
||||||
#undef pthread_mutex_unlock
|
|
||||||
#undef pthread_mutex_destroy
|
|
||||||
#undef pthread_mutex_wait
|
|
||||||
#undef pthread_mutex_timedwait
|
|
||||||
#undef pthread_mutex_t
|
|
||||||
#undef pthread_cond_wait
|
|
||||||
#undef pthread_cond_timedwait
|
|
||||||
#undef pthread_mutex_trylock
|
|
||||||
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
|
|
||||||
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
|
|
||||||
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
|
|
||||||
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
|
|
||||||
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
|
|
||||||
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
|
|
||||||
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
|
|
||||||
#define pthread_mutex_t safe_mutex_t
|
|
||||||
#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread))
|
|
||||||
#else
|
|
||||||
#define safe_mutex_assert_owner(mp)
|
|
||||||
#endif /* SAFE_MUTEX */
|
|
||||||
|
|
||||||
/* READ-WRITE thread locking */
|
|
||||||
|
|
||||||
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
|
|
||||||
/* use these defs for simple mutex locking */
|
|
||||||
#define rw_lock_t pthread_mutex_t
|
|
||||||
#define my_rwlock_init(A,B) pthread_mutex_init((A),(B))
|
|
||||||
#define rw_rdlock(A) pthread_mutex_lock((A))
|
|
||||||
#define rw_wrlock(A) pthread_mutex_lock((A))
|
|
||||||
#define rw_tryrdlock(A) pthread_mutex_trylock((A))
|
|
||||||
#define rw_trywrlock(A) pthread_mutex_trylock((A))
|
|
||||||
#define rw_unlock(A) pthread_mutex_unlock((A))
|
|
||||||
#define rwlock_destroy(A) pthread_mutex_destroy((A))
|
|
||||||
#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK)
|
|
||||||
#define rw_lock_t pthread_rwlock_t
|
|
||||||
#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B))
|
|
||||||
#define rw_rdlock(A) pthread_rwlock_rdlock(A)
|
|
||||||
#define rw_wrlock(A) pthread_rwlock_wrlock(A)
|
|
||||||
#define rw_tryrdlock(A) pthread_rwlock_tryrdlock((A))
|
|
||||||
#define rw_trywrlock(A) pthread_rwlock_trywrlock((A))
|
|
||||||
#define rw_unlock(A) pthread_rwlock_unlock(A)
|
|
||||||
#define rwlock_destroy(A) pthread_rwlock_destroy(A)
|
|
||||||
#elif defined(HAVE_RWLOCK_INIT)
|
|
||||||
#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */
|
|
||||||
#define rw_lock_t rwlock_t
|
|
||||||
#endif
|
|
||||||
#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0)
|
|
||||||
#else
|
|
||||||
/* Use our own version of read/write locks */
|
|
||||||
typedef struct _my_rw_lock_t {
|
|
||||||
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 */
|
|
||||||
} my_rw_lock_t;
|
|
||||||
|
|
||||||
#define rw_lock_t my_rw_lock_t
|
|
||||||
#define rw_rdlock(A) my_rw_rdlock((A))
|
|
||||||
#define rw_wrlock(A) my_rw_wrlock((A))
|
|
||||||
#define rw_tryrdlock(A) my_rw_tryrdlock((A))
|
|
||||||
#define rw_trywrlock(A) my_rw_trywrlock((A))
|
|
||||||
#define rw_unlock(A) my_rw_unlock((A))
|
|
||||||
#define rwlock_destroy(A) my_rwlock_destroy((A))
|
|
||||||
|
|
||||||
extern int my_rwlock_init(my_rw_lock_t *, void *);
|
|
||||||
extern int my_rwlock_destroy(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_unlock(my_rw_lock_t *);
|
|
||||||
extern int my_rw_tryrdlock(my_rw_lock_t *);
|
|
||||||
extern int my_rw_trywrlock(my_rw_lock_t *);
|
|
||||||
#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
|
|
||||||
|
|
||||||
#define GETHOSTBYADDR_BUFF_SIZE 2048
|
|
||||||
|
|
||||||
#ifndef HAVE_THR_SETCONCURRENCY
|
|
||||||
#define thr_setconcurrency(A) pthread_dummy(0)
|
|
||||||
#endif
|
|
||||||
#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize)
|
|
||||||
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define mutex types */
|
|
||||||
#define MY_MUTEX_INIT_SLOW NULL
|
|
||||||
#define MY_MUTEX_INIT_FAST NULL
|
|
||||||
#define MY_MUTEX_INIT_ERRCHK NULL
|
|
||||||
|
|
||||||
extern my_bool my_thread_global_init(void);
|
|
||||||
extern void my_thread_global_end(void);
|
|
||||||
extern my_bool my_thread_init(void);
|
|
||||||
extern void my_thread_end(void);
|
|
||||||
extern const char *my_thread_name(void);
|
|
||||||
extern long my_thread_id(void);
|
|
||||||
extern int pthread_no_free(void *);
|
|
||||||
extern int pthread_dummy(int);
|
|
||||||
|
|
||||||
/* All thread specific variables are in the following struct */
|
|
||||||
|
|
||||||
#define THREAD_NAME_SIZE 10
|
|
||||||
#if defined(__ia64__)
|
|
||||||
#define DEFAULT_THREAD_STACK (128*1024)
|
|
||||||
#else
|
|
||||||
#define DEFAULT_THREAD_STACK (64*1024)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct st_my_thread_var
|
|
||||||
{
|
|
||||||
int thr_errno;
|
|
||||||
pthread_cond_t suspend;
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
pthread_mutex_t * volatile current_mutex;
|
|
||||||
pthread_cond_t * volatile current_cond;
|
|
||||||
pthread_t pthread_self;
|
|
||||||
long id;
|
|
||||||
int cmp_length;
|
|
||||||
int volatile abort;
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
gptr dbug;
|
|
||||||
char name[THREAD_NAME_SIZE+1];
|
|
||||||
#endif
|
|
||||||
my_bool initialized;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
|
|
||||||
extern void **my_thread_var_dbug();
|
|
||||||
#define my_thread_var (_my_thread_var())
|
|
||||||
#define my_errno my_thread_var->thr_errno
|
|
||||||
|
|
||||||
/* statistics_xxx functions are for not essential statistic */
|
|
||||||
|
|
||||||
#ifndef thread_safe_increment
|
|
||||||
#ifdef HAVE_ATOMIC_ADD
|
|
||||||
#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
|
|
||||||
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
|
|
||||||
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
|
|
||||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
|
||||||
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
|
||||||
#else
|
|
||||||
#define thread_safe_increment(V,L) \
|
|
||||||
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
|
|
||||||
#define thread_safe_add(V,C,L) \
|
|
||||||
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
|
|
||||||
#define thread_safe_sub(V,C,L) \
|
|
||||||
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
|
|
||||||
#ifdef SAFE_STATISTICS
|
|
||||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
|
||||||
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
|
||||||
#else
|
|
||||||
#define statistic_increment(V,L) (V)++
|
|
||||||
#define statistic_add(V,C,L) (V)+=(C)
|
|
||||||
#endif /* SAFE_STATISTICS */
|
|
||||||
#endif /* HAVE_ATOMIC_ADD */
|
|
||||||
#endif /* thread_safe_increment */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _my_ptread_h */
|
#endif /* _my_ptread_h */
|
||||||
|
@@ -247,19 +247,6 @@ typedef struct st_record_cache /* Used when caching records */
|
|||||||
enum cache_type type;
|
enum cache_type type;
|
||||||
} RECORD_CACHE;
|
} RECORD_CACHE;
|
||||||
|
|
||||||
/*
|
|
||||||
enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE,
|
|
||||||
STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP };
|
|
||||||
|
|
||||||
extern struct ma_file_info
|
|
||||||
{
|
|
||||||
my_string name;
|
|
||||||
enum file_type type;
|
|
||||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
#endif
|
|
||||||
} ma_file_info[MY_NFILE];
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct st_dynamic_array {
|
typedef struct st_dynamic_array {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
@@ -536,13 +523,6 @@ void set_all_changeable_vars(CHANGEABLE_VAR *vars);
|
|||||||
my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars);
|
my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars);
|
||||||
my_bool set_changeable_varval(const char *var, ulong val,
|
my_bool set_changeable_varval(const char *var, ulong val,
|
||||||
CHANGEABLE_VAR *vars);
|
CHANGEABLE_VAR *vars);
|
||||||
#ifdef HAVE_MLOCK
|
|
||||||
extern unsigned char *ma_malloc_lock(size_t length,myf flags);
|
|
||||||
extern void ma_free_lock(unsigned char *ptr,myf flags);
|
|
||||||
#else
|
|
||||||
#define ma_malloc_lock(A,B) ma_malloc((A),(B))
|
|
||||||
#define ma_free_lock(A,B) ma_free((A),(B))
|
|
||||||
#endif
|
|
||||||
#define ma_alloc_root_inited(A) ((A)->min_malloc != 0)
|
#define ma_alloc_root_inited(A) ((A)->min_malloc != 0)
|
||||||
void ma_init_alloc_root(MA_MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size);
|
void ma_init_alloc_root(MA_MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size);
|
||||||
void *ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size);
|
void *ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size);
|
||||||
|
@@ -196,9 +196,6 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
|
|||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef THREAD
|
|
||||||
safe_mutex_assert_owner(&LOCK_load_client_plugin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p->next= plugin_list[plugin_nr];
|
p->next= plugin_list[plugin_nr];
|
||||||
plugin_list[plugin_nr]= p;
|
plugin_list[plugin_nr]= p;
|
||||||
@@ -276,7 +273,7 @@ int mysql_client_plugin_init()
|
|||||||
|
|
||||||
memset(&mysql, 0, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
|
memset(&mysql, 0, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
|
||||||
|
|
||||||
pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
|
pthread_mutex_init(&LOCK_load_client_plugin, NULL);
|
||||||
ma_init_alloc_root(&mem_root, 128, 128);
|
ma_init_alloc_root(&mem_root, 128, 128);
|
||||||
|
|
||||||
memset(&plugin_list, 0, sizeof(plugin_list));
|
memset(&plugin_list, 0, sizeof(plugin_list));
|
||||||
|
@@ -21,10 +21,6 @@
|
|||||||
#include "mariadb_ctype.h"
|
#include "mariadb_ctype.h"
|
||||||
#include <ma_string.h>
|
#include <ma_string.h>
|
||||||
#include <mariadb_ctype.h>
|
#include <mariadb_ctype.h>
|
||||||
#ifdef HAVE_GETRUSAGE
|
|
||||||
#include <sys/resource.h>
|
|
||||||
/* extern int getrusage(int, struct rusage *); */
|
|
||||||
#endif
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -66,30 +62,6 @@ void ma_end(int infoflag __attribute__((unused)))
|
|||||||
} /* ma_end */
|
} /* ma_end */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/*
|
|
||||||
This code is specially for running MySQL, but it should work in
|
|
||||||
other cases too.
|
|
||||||
|
|
||||||
Inizializzazione delle variabili d'ambiente per Win a 32 bit.
|
|
||||||
|
|
||||||
Vengono inserite nelle variabili d'ambiente (utilizzando cosi'
|
|
||||||
le funzioni getenv e putenv) i valori presenti nelle chiavi
|
|
||||||
del file di registro:
|
|
||||||
|
|
||||||
HKEY_LOCAL_MACHINE\software\MySQL
|
|
||||||
|
|
||||||
Se la kiave non esiste nonn inserisce nessun valore
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Crea la stringa d'ambiente */
|
|
||||||
|
|
||||||
void setEnvString(char *ret, const char *name, const char *value)
|
|
||||||
{
|
|
||||||
sprintf(ret, "%s=%s", name, value);
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static my_bool my_win_init()
|
static my_bool my_win_init()
|
||||||
{
|
{
|
||||||
WORD VersionRequested;
|
WORD VersionRequested;
|
||||||
|
@@ -965,7 +965,7 @@ int ma_tls_start(char *errmsg, size_t errmsg_len)
|
|||||||
if (ma_tls_initialized)
|
if (ma_tls_initialized)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pthread_mutex_init(&LOCK_gnutls_config,MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&LOCK_gnutls_config,NULL);
|
||||||
pthread_mutex_lock(&LOCK_gnutls_config);
|
pthread_mutex_lock(&LOCK_gnutls_config);
|
||||||
|
|
||||||
if ((rc= gnutls_global_init()) != GNUTLS_E_SUCCESS)
|
if ((rc= gnutls_global_init()) != GNUTLS_E_SUCCESS)
|
||||||
|
Reference in New Issue
Block a user