summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h1
-rw-r--r--include/my_global.h36
-rw-r--r--include/my_pthread.h81
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql_h.ic19
-rw-r--r--include/typelib.h3
6 files changed, 87 insertions, 55 deletions
diff --git a/include/config-win.h b/include/config-win.h
index a9977ec955a..34e828e01e8 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -248,7 +248,6 @@ inline double ulonglong2double(ulonglong value)
#define tell(A) _telli64(A)
#endif
-#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1
diff --git a/include/my_global.h b/include/my_global.h
index 2a2b4a2ba99..b91ff8a9e5b 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1045,41 +1045,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#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 */
-#ifdef HAVE_TIMESPEC_TS_SEC
-#ifndef set_timespec
-#define set_timespec(ABSTIME,SEC) \
-{ \
- (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
- (ABSTIME).ts_nsec=0; \
-}
-#endif /* !set_timespec */
-#ifndef set_timespec_nsec
-#define set_timespec_nsec(ABSTIME,NSEC) \
-{ \
- ulonglong now= my_getsystime() + (NSEC/100); \
- (ABSTIME).ts_sec= (now / ULL(10000000)); \
- (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
-}
-#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;\
-}
-#endif /* !set_timespec */
-#ifndef set_timespec_nsec
-#define set_timespec_nsec(ABSTIME,NSEC) \
-{\
- ulonglong now= my_getsystime() + (NSEC/100); \
- (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
- (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
-}
-#endif /* !set_timespec_nsec */
-#endif /* HAVE_TIMESPEC_TS_SEC */
+
/*
Define-funktions for reading and storing in machine independent format
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 8f34a6127c3..52e900b5803 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -88,14 +88,6 @@ typedef struct {
#endif
} pthread_cond_t;
-
-#ifndef OS2
-struct timespec { /* For pthread_cond_timedwait() */
- time_t tv_sec;
- long tv_nsec;
-};
-#endif
-
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
@@ -106,6 +98,36 @@ typedef void * (_Optlink *pthread_handler)(void *);
typedef void * (__cdecl *pthread_handler)(void *);
#endif
+/*
+ Struct and macros to be used in combination with the
+ windows implementation of pthread_cond_timedwait
+*/
+
+/*
+ Declare a union to make sure FILETIME is properly aligned
+ so it can be used directly as a 64 bit value. The value
+ stored is in 100ns units.
+ */
+ union ft64 {
+ FILETIME ft;
+ __int64 i64;
+ };
+struct timespec {
+ union ft64 tv;
+ /* The max timeout value in millisecond for pthread_cond_timedwait */
+ long max_timeout_msec;
+};
+#define set_timespec(ABSTIME,SEC) { \
+ GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
+ (ABSTIME).tv.i64+= (__int64)(SEC)*10000000; \
+ (ABSTIME).max_timeout_msec= (long)((SEC)*1000); \
+}
+#define set_timespec_nsec(ABSTIME,NSEC) { \
+ GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
+ (ABSTIME).tv.i64+= (__int64)(NSEC)/100; \
+ (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
+}
+
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
@@ -183,8 +205,6 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#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)
@@ -492,6 +512,47 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
+/*
+ The defines set_timespec and set_timespec_nsec should be used
+ for calculating an absolute time at which
+ pthread_cond_timedwait should timeout
+*/
+#ifdef HAVE_TIMESPEC_TS_SEC
+#ifndef set_timespec
+#define set_timespec(ABSTIME,SEC) \
+{ \
+ (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
+ (ABSTIME).ts_nsec=0; \
+}
+#endif /* !set_timespec */
+#ifndef set_timespec_nsec
+#define set_timespec_nsec(ABSTIME,NSEC) \
+{ \
+ ulonglong now= my_getsystime() + (NSEC/100); \
+ (ABSTIME).ts_sec= (now / ULL(10000000)); \
+ (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
+}
+#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;\
+}
+#endif /* !set_timespec */
+#ifndef set_timespec_nsec
+#define set_timespec_nsec(ABSTIME,NSEC) \
+{\
+ ulonglong now= my_getsystime() + (NSEC/100); \
+ (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
+ (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
+}
+#endif /* !set_timespec_nsec */
+#endif /* HAVE_TIMESPEC_TS_SEC */
+
/* safe_mutex adds checking to mutex for easier debugging */
#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
diff --git a/include/mysql.h b/include/mysql.h
index fb2e4319b4c..c612bdf175a 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -64,9 +64,9 @@ typedef int my_socket;
#endif /* my_socket_defined */
#endif /* _global_h */
+#include "mysql_version.h"
#include "mysql_com.h"
#include "mysql_time.h"
-#include "mysql_version.h"
#include "typelib.h"
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
diff --git a/include/mysql_h.ic b/include/mysql_h.ic
index 0e546acef92..5a9daee6f9f 100644
--- a/include/mysql_h.ic
+++ b/include/mysql_h.ic
@@ -36,6 +36,8 @@ enum mysql_status;
typedef struct st_mysql_rows MYSQL_ROWS;
# 24 "my_list.h"
typedef struct st_list LIST;
+# 35 "my_alloc.h"
+typedef struct st_mem_root MEM_ROOT;
# 251 "mysql.h"
typedef struct st_mysql MYSQL;
# 653 "mysql.h"
@@ -60,7 +62,7 @@ typedef struct st_mysql_stmt MYSQL_STMT;
typedef struct character_set MY_CHARSET_INFO;
# 180 "mysql_com.h"
typedef struct st_net NET;
-# 21 "typelib.h"
+# 23 "typelib.h"
typedef struct st_typelib TYPELIB;
# 170 "mysql_com.h"
typedef struct st_vio Vio;
@@ -76,8 +78,6 @@ typedef int my_socket;
typedef unsigned long long int my_ulonglong;
# 144 "mysql.h"
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
-# 35 "my_alloc.h"
-typedef struct st_mem_root MEM_ROOT;
# 145 "mysql.h"
typedef struct st_mysql_data MYSQL_DATA;
# 750 "mysql.h"
@@ -419,7 +419,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned
my_bool report_error;
my_bool return_errno;
};
-# 21 "typelib.h"
+# 23 "typelib.h"
struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib
{
unsigned int count;
@@ -575,6 +575,7 @@ enum mysql_enum_shutdown_level
SHUTDOWN_WAIT_UPDATES = (unsigned char)((1 << 3)),
SHUTDOWN_WAIT_ALL_BUFFERS = ((unsigned char)((1 << 3)) << 1),
SHUTDOWN_WAIT_CRITICAL_BUFFERS = (((unsigned char)((1 << 3)) << 1) + 1),
+ KILL_QUERY = 254,
KILL_CONNECTION = 255,
};
# 154 "mysql.h"
@@ -630,9 +631,11 @@ enum mysql_status
extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2);
# 416 "mysql_com.h"
extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt);
+# 33 "typelib.h"
+extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from);
# 411 "mysql_com.h"
extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
-# 28 "typelib.h"
+# 30 "typelib.h"
extern int find_type(char * x, TYPELIB * typelib, unsigned int);
# 425 "mysql_com.h"
extern void get_salt_from_password(unsigned char * res, char const * password);
@@ -640,7 +643,7 @@ extern void get_salt_from_password(unsigned char * res, char const * password);
extern void get_salt_from_password_323(unsigned long int * res, char const * password);
# 431 "mysql_com.h"
extern char * get_tty_password(char * opt_message);
-# 30 "typelib.h"
+# 32 "typelib.h"
extern char const * get_type(TYPELIB * typelib, unsigned int);
# 413 "mysql_com.h"
extern void hash_password(unsigned long int * to, char const * password, unsigned int);
@@ -668,7 +671,7 @@ extern void make_password_from_salt_323(char * to, unsigned long int const * sal
extern void make_scrambled_password(char * to, char const * password);
# 414 "mysql_com.h"
extern void make_scrambled_password_323(char * to, char const * password);
-# 29 "typelib.h"
+# 31 "typelib.h"
extern void make_type(char * to, unsigned int, TYPELIB * typelib);
# 437 "mysql_com.h"
extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int);
@@ -962,5 +965,5 @@ extern void randominit(struct rand_struct *, unsigned long int, unsigned long in
extern void scramble(char * to, char const * message, char const * password);
# 415 "mysql_com.h"
extern void scramble_323(char * to, char const * message, char const * password);
-# 32 "typelib.h"
+# 35 "typelib.h"
extern TYPELIB sql_protocol_typelib;
diff --git a/include/typelib.h b/include/typelib.h
index 28554f739d3..75d170e59d3 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -17,6 +17,8 @@
#ifndef _typelib_h
#define _typelib_h
+#include "my_alloc.h"
+
typedef struct st_typelib { /* Different types saved here */
unsigned int count; /* How many types */
const char *name; /* Name of typelib */
@@ -27,6 +29,7 @@ typedef struct st_typelib { /* Different types saved here */
extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
+extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
extern TYPELIB sql_protocol_typelib;