summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h67
-rw-r--r--include/my_alloc.h13
-rw-r--r--include/my_global.h2
-rw-r--r--include/my_pthread.h6
-rw-r--r--include/my_semaphore.h17
-rw-r--r--include/my_sys.h9
-rw-r--r--include/myisam.h5
-rw-r--r--include/mysql.h41
-rw-r--r--include/thr_alarm.h9
9 files changed, 102 insertions, 67 deletions
diff --git a/include/config-win.h b/include/config-win.h
index 12a89bec21b..c0d0dad894e 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -24,11 +24,11 @@
#include <malloc.h>
#if defined(__NT__)
-#define SYSTEM_TYPE "NT"
+#define SYSTEM_TYPE "NT"
#elif defined(__WIN2000__)
-#define SYSTEM_TYPE "WIN2000"
+#define SYSTEM_TYPE "WIN2000"
#else
-#define SYSTEM_TYPE "Win95/Win98"
+#define SYSTEM_TYPE "Win95/Win98"
#endif
#if defined(_WIN64) || defined(WIN64)
@@ -43,23 +43,23 @@
#endif
#endif /* _WIN64 */
#ifndef __WIN__
-#define __WIN__ /* To make it easier in VC++ */
+#define __WIN__ /* To make it easier in VC++ */
#endif
/* File and lock constants */
-#define O_SHARE 0x1000 /* Open file in sharing mode */
+#define O_SHARE 0x1000 /* Open file in sharing mode */
#ifdef __BORLANDC__
-#define F_RDLCK LK_NBLCK /* read lock */
-#define F_WRLCK LK_NBRLCK /* write lock */
-#define F_UNLCK LK_UNLCK /* remove lock(s) */
+#define F_RDLCK LK_NBLCK /* read lock */
+#define F_WRLCK LK_NBRLCK /* write lock */
+#define F_UNLCK LK_UNLCK /* remove lock(s) */
#else
-#define F_RDLCK _LK_NBLCK /* read lock */
-#define F_WRLCK _LK_NBRLCK /* write lock */
-#define F_UNLCK _LK_UNLCK /* remove lock(s) */
+#define F_RDLCK _LK_NBLCK /* read lock */
+#define F_WRLCK _LK_NBRLCK /* write lock */
+#define F_UNLCK _LK_UNLCK /* remove lock(s) */
#endif
-#define F_EXCLUSIVE 1 /* We have only exclusive locking */
-#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
+#define F_EXCLUSIVE 1 /* We have only exclusive locking */
+#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
#define F_OK 0 /* parameter to access() */
#define S_IROTH S_IREAD /* for my_lib */
@@ -70,15 +70,15 @@
#define O_SHORT_LIVED 0
#define SH_DENYNO _SH_DENYNO
#else
-#define O_BINARY _O_BINARY /* compability with MSDOS */
-#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
-#define O_TEMPORARY _O_TEMPORARY
-#define O_SHORT_LIVED _O_SHORT_LIVED
-#define SH_DENYNO _SH_DENYNO
+#define O_BINARY _O_BINARY /* compability with MSDOS */
+#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
+#define O_TEMPORARY _O_TEMPORARY
+#define O_SHORT_LIVED _O_SHORT_LIVED
+#define SH_DENYNO _SH_DENYNO
#endif
#define NO_OPEN_3 /* For my_create() */
-#define SIGQUIT SIGTERM /* No SIGQUIT */
+#define SIGQUIT SIGTERM /* No SIGQUIT */
#undef _REENTRANT /* Crashes something for win32 */
#undef SAFE_MUTEX /* Can't be used on windows */
@@ -89,15 +89,15 @@
/* Type information */
-typedef unsigned short ushort;
-typedef unsigned int uint;
+typedef unsigned short ushort;
+typedef unsigned int uint;
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
-typedef __int64 longlong;
+typedef __int64 longlong;
typedef int sigset_t;
#define longlong_defined
/* off_t should not be __int64 because of conflicts in header files;
Use my_off_t or os_off_t instead */
-typedef long off_t;
+typedef long off_t;
typedef __int64 os_off_t;
#ifdef _WIN64
typedef UINT_PTR rf_SetTimer;
@@ -109,7 +109,7 @@ typedef uint rf_SetTimer;
#define Socket_defined
#define my_socket SOCKET
#define bool BOOL
-#define SIGPIPE SIGINT
+#define SIGPIPE SIGINT
#define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID
#define RETSIGTYPE void
@@ -118,7 +118,9 @@ typedef uint rf_SetTimer;
#define bool_defined
#define byte_defined
#define HUGE_PTR
-#define STDCALL __stdcall /* Used by libmysql.dll */
+#define STDCALL __stdcall /* Used by libmysql.dll */
+#define isnan(X) _isnan(X)
+#define finite(X) _finite(X)
#ifndef UNDEF_THREAD_HACK
#define THREAD
@@ -201,7 +203,7 @@ inline double ulonglong2double(ulonglong value)
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
+ (((ulonglong) ((uchar) (A)[4])) << 32))
#define uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
@@ -247,14 +249,15 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_FLOAT_H
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
-#define HAVE_RINT /* defined in this file */
-#define NO_FCNTL_NONBLOCK /* No FCNTL */
+#define HAVE_RINT /* defined in this file */
+#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
#define HAVE_STRPBRK
#define HAVE_STRSTR
#define HAVE_COMPRESS
#define HAVE_CREATESEMAPHORE
-
+#define HAVE_ISNAN
+#define HAVE_FINITE
#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
#ifdef NOT_USED
@@ -276,8 +279,8 @@ inline double ulonglong2double(ulonglong value)
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
-#define DEFAULT_MYSQL_HOME "c:\\mysql"
-#define PACKAGE "mysql"
+#define DEFAULT_MYSQL_HOME "c:\\mysql"
+#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
@@ -303,6 +306,6 @@ inline double ulonglong2double(ulonglong value)
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));
-#define statistic_add(V,C,L) (V)+=(C)
+#define statistic_add(V,C,L) (V)+=(C)
#endif
#define statistic_increment(V,L) thread_safe_increment((V),(L))
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 60d0d4f4b6d..31f1fb7165f 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -21,6 +21,8 @@
#ifndef _my_alloc_h
#define _my_alloc_h
+#define MAX_BLOCK_USAGE_BEFORE_DROP 10
+
typedef struct st_used_mem
{ /* struct for once_alloc (block) */
struct st_used_mem *next; /* Next block in use */
@@ -35,9 +37,14 @@ typedef struct st_mem_root
USED_MEM *used; /* blocks almost without free memory */
USED_MEM *pre_alloc; /* preallocated block */
/* if block have less memory it will be put in 'used' list */
- unsigned int min_malloc;
- unsigned int block_size; /* initial block size */
- unsigned int block_num; /* allocated blocks counter */
+ unsigned int min_malloc;
+ unsigned int block_size; /* initial block size */
+ unsigned int block_num; /* allocated blocks counter */
+ /*
+ first free block in queue test counter (if it exceed
+ MAX_BLOCK_USAGE_BEFORE_DROP block will be droped in 'used' list)
+ */
+ unsigned int first_block_usage;
void (*error_handler)(void);
} MEM_ROOT;
diff --git a/include/my_global.h b/include/my_global.h
index 6ffe6fe949d..2ad8a870048 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -313,7 +313,7 @@ typedef unsigned short ushort;
#define rint(A) floor((A)+0.5)
#endif
-/* Define som general constants */
+/* Define some general constants */
#ifndef TRUE
#define TRUE (1) /* Logical true */
#define FALSE (0) /* Logical false */
diff --git a/include/my_pthread.h b/include/my_pthread.h
index fda31b9d4f2..0908f7b8ab9 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -485,6 +485,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#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)
@@ -492,6 +494,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#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)
@@ -512,6 +516,8 @@ typedef struct _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))
diff --git a/include/my_semaphore.h b/include/my_semaphore.h
index 36c4b1a4740..aecbde09511 100644
--- a/include/my_semaphore.h
+++ b/include/my_semaphore.h
@@ -33,20 +33,29 @@
C_MODE_START
-#ifndef __WIN__
+#ifdef HAVE_SEMAPHORE_H
#include <semaphore.h>
#else
+#ifdef __WIN__
typedef HANDLE sem_t;
+#else
+typedef struct {
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ uint count;
+} sem_t;
+#endif
+
int sem_init(sem_t * sem, int pshared, unsigned int value);
int sem_destroy(sem_t * sem);
int sem_trywait(sem_t * sem);
int sem_wait(sem_t * sem);
int sem_post(sem_t * sem);
-int sem_post_multiple(sem_t * sem,int count);
-int sem_getvalue(sem_t * sem, int * sval);
+int sem_post_multiple(sem_t * sem, unsigned int count);
+int sem_getvalue(sem_t * sem, unsigned int * sval);
-#endif /* __WIN__ */
+#endif
C_MODE_END
#endif /* !_my_semaphore_h_ */
diff --git a/include/my_sys.h b/include/my_sys.h
index 6085724c329..0b191c17173 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -664,7 +664,7 @@ extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);
extern void init_io_cache_share(IO_CACHE *info,
- IO_CACHE_SHARE *s, uint num_threads);
+ IO_CACHE_SHARE *s, uint num_threads);
extern void remove_io_thread(IO_CACHE *info);
#endif
extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count);
@@ -748,13 +748,6 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
ulong checksum(const byte *mem, uint count);
uint my_bit_log2(ulong value);
-#if defined(SAFE_MUTEX) && !defined(DBUG_OFF)
-#define DBUG_ASSERT_LOCK(lock) DBUG_ASSERT((lock)->count == 1 && \
- (lock)->thread == pthread_self())
-#else
-#define DBUG_ASSERT_LOCK(lock)
-#endif
-
#if defined(_MSC_VER) && !defined(__WIN__)
extern void sleep(int sec);
#endif
diff --git a/include/myisam.h b/include/myisam.h
index 57d219ab358..a30155841ff 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -351,6 +351,7 @@ typedef struct st_mi_check_param
char *op_name;
} MI_CHECK;
+
typedef struct st_sort_info
{
MI_INFO *info;
@@ -368,6 +369,7 @@ typedef struct st_sort_info
pthread_cond_t cond;
} SORT_INFO;
+
typedef struct st_mi_sort_param
{
pthread_t thr;
@@ -391,6 +393,7 @@ typedef struct st_mi_sort_param
void (*lock_in_memory)(MI_CHECK *);
} MI_SORT_PARAM;
+
/* functions in mi_check */
void myisamchk_init(MI_CHECK *param);
int chk_status(MI_CHECK *param, MI_INFO *info);
@@ -424,8 +427,6 @@ int movepoint(MI_INFO *info,byte *record,my_off_t oldpos,
int sort_write_record(MI_SORT_PARAM *sort_param);
int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile);
int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong);
-void *_thr_find_all_keys(MI_SORT_PARAM *info);
-int _thr_write_keys(MI_SORT_PARAM *sort_param);
int test_if_almost_full(MI_INFO *info);
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
diff --git a/include/mysql.h b/include/mysql.h
index 5bcdca636c0..af3e8c773ef 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -122,17 +122,17 @@ struct st_mysql_options {
my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe;
/*
- on connect, find out the replication role of the server, and
+ On connect, find out the replication role of the server, and
establish connections to all the peers
*/
my_bool rpl_probe;
- /*
- each call to mysql_real_query() will parse it to tell if it is a read
- or a write, and direct it to the slave or the master
+ /*
+ Each call to mysql_real_query() will parse it to tell if it is a read
+ or a write, and direct it to the slave or the master
*/
my_bool rpl_parse;
/*
- if set, never read from a master,only from slave, when doing
+ If set, never read from a master,only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
@@ -185,8 +185,10 @@ typedef struct st_mysql {
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
- /* pointers to the master, and the next slave
- connections, points to itself if lone connection */
+ /*
+ Pointers to the master, and the next slave connections, points to
+ itself if lone connection.
+ */
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
@@ -234,21 +236,27 @@ typedef struct st_mysql_manager
char last_error[MAX_MYSQL_MANAGER_ERR];
} MYSQL_MANAGER;
-/* Set up and bring down the server; to ensure that applications will
- * work when linked against either the standard client library or the
- * embedded server library, these functions should be called. */
+/*
+ Set up and bring down the server; to ensure that applications will
+ work when linked against either the standard client library or the
+ embedded server library, these functions should be called.
+*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
-/* Set up and bring down a thread; these function should be called
- * for each thread in an application which opens at least one MySQL
- * connection. All uses of the connection(s) should be between these
- * function calls. */
+/*
+ Set up and bring down a thread; these function should be called
+ for each thread in an application which opens at least one MySQL
+ connection. All uses of the connection(s) should be between these
+ function calls.
+*/
my_bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
-/* Functions to get information from the MYSQL and MYSQL_RES structures */
-/* Should definitely be used if one uses shared libraries */
+/*
+ Functions to get information from the MYSQL and MYSQL_RES structures
+ Should definitely be used if one uses shared libraries.
+*/
my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
@@ -272,7 +280,6 @@ MYSQL * STDCALL mysql_init(MYSQL *mysql);
int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
-int STDCALL mysql_ssl_clear(MYSQL *mysql);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
const char *passwd, const char *db);
MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 5caf552718c..30825d49158 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -38,6 +38,15 @@ extern "C" {
#define THR_SERVER_ALARM SIGALRM
#endif
+typedef struct st_alarm_info
+{
+ ulong next_alarm_time;
+ uint active_alarms;
+ uint max_used_alarms;
+} ALARM_INFO;
+
+void thr_alarm_info(ALARM_INFO *info);
+
#if defined(DONT_USE_THR_ALARM) || !defined(THREAD)
#define USE_ALARM_THREAD