summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/buf0buf.h8
-rw-r--r--innobase/include/buf0buf.ic2
-rw-r--r--innobase/include/hash0hash.ic1
-rw-r--r--innobase/include/mach0data.ic2
-rw-r--r--innobase/include/mem0mem.h16
-rw-r--r--innobase/include/mem0pool.h14
-rw-r--r--innobase/include/mtr0mtr.h4
-rw-r--r--innobase/include/os0file.h12
-rw-r--r--innobase/include/os0sync.h7
-rw-r--r--innobase/include/os0sync.ic2
-rw-r--r--innobase/include/os0thread.h8
-rw-r--r--innobase/include/row0mysql.ic4
-rw-r--r--innobase/include/srv0srv.h8
-rw-r--r--innobase/include/sync0rw.h14
-rw-r--r--innobase/include/sync0sync.h6
-rw-r--r--innobase/include/univ.i19
-rw-r--r--innobase/include/ut0dbg.h6
17 files changed, 81 insertions, 52 deletions
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 08c59d60c91..09883fbb037 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -119,7 +119,7 @@ in LA! */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET, __FILE__, __LINE__, MTR)
+ BUF_GET, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
@@ -134,7 +134,7 @@ with care. */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
- BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
+ BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
@@ -146,7 +146,7 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
+ BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
@@ -158,7 +158,7 @@ buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#ifdef UNIV_SYNC_DEBUG
#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\
- LA, G, MC, __FILE__, __LINE__, MTR)
+ LA, G, MC, IB__FILE__, __LINE__, MTR)
#else
#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\
LA, G, MC, MTR)
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index 24ada36bca2..1ecc6f34a78 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -558,7 +558,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
- __FILE__, __LINE__,
+ IB__FILE__, __LINE__,
#endif
mtr);
if (frame != NULL) {
diff --git a/innobase/include/hash0hash.ic b/innobase/include/hash0hash.ic
index 3ed2f9088dd..0d713140c13 100644
--- a/innobase/include/hash0hash.ic
+++ b/innobase/include/hash0hash.ic
@@ -18,7 +18,6 @@ hash_get_nth_cell(
hash_table_t* table, /* in: hash table */
ulint n) /* in: cell index */
{
- ut_ad(n >= 0);
ut_ad(n < table->n_cells);
return(table->array + n);
diff --git a/innobase/include/mach0data.ic b/innobase/include/mach0data.ic
index 6c93cb687a5..176f3415281 100644
--- a/innobase/include/mach0data.ic
+++ b/innobase/include/mach0data.ic
@@ -17,7 +17,7 @@ mach_write_to_1(
ulint n) /* in: ulint integer to be stored, >= 0, < 256 */
{
ut_ad(b);
- ut_ad((n >= 0) && (n <= 0xFF));
+ ut_ad(n <= 0xFF);
b[0] = (byte)n;
}
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index a2259a97503..95024cf8011 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -64,7 +64,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create(N) mem_heap_create_func(N, NULL, MEM_HEAP_DYNAMIC)
#endif
@@ -74,7 +74,7 @@ heap creation. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create_in_buffer(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BUFFER)
@@ -86,7 +86,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(N, NULL,\
MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER)
@@ -99,7 +99,7 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
- __FILE__, __LINE__)
+ IB__FILE__, __LINE__)
#else
#define mem_heap_fast_create(N, B) mem_heap_create_func(N, (B),\
MEM_HEAP_DYNAMIC)
@@ -109,7 +109,7 @@ Use this macro instead of the corresponding function! Macro for memory
heap freeing. */
#ifdef UNIV_MEM_DEBUG
#define mem_heap_free(heap) mem_heap_free_func(\
- (heap), __FILE__, __LINE__)
+ (heap), IB__FILE__, __LINE__)
#else
#define mem_heap_free(heap) mem_heap_free_func(heap)
#endif
@@ -226,7 +226,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG
#define mem_alloc(N) mem_alloc_func(\
- (N), __FILE__, __LINE__)
+ (N), IB__FILE__, __LINE__)
#else
#define mem_alloc(N) mem_alloc_func(N)
#endif
@@ -235,7 +235,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#ifdef UNIV_MEM_DEBUG
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\
- (N), __FILE__, __LINE__)
+ (N), IB__FILE__, __LINE__)
#else
#define mem_alloc_noninline(N) mem_alloc_func_noninline(N)
#endif
@@ -278,7 +278,7 @@ Use this macro instead of the corresponding function!
Macro for memory buffer freeing */
#ifdef UNIV_MEM_DEBUG
#define mem_free(PTR) mem_free_func(\
- (PTR), __FILE__, __LINE__)
+ (PTR), IB__FILE__, __LINE__)
#else
#define mem_free(PTR) mem_free_func(PTR)
#endif
diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h
index b6906894c53..14198920bca 100644
--- a/innobase/include/mem0pool.h
+++ b/innobase/include/mem0pool.h
@@ -11,6 +11,7 @@ Created 6/9/1994 Heikki Tuuri
#include "univ.i"
#include "os0file.h"
+#include "ut0lst.h"
typedef struct mem_area_struct mem_area_t;
typedef struct mem_pool_struct mem_pool_t;
@@ -18,8 +19,19 @@ typedef struct mem_pool_struct mem_pool_t;
/* The common memory pool */
extern mem_pool_t* mem_comm_pool;
+/* Memory area header */
+
+struct mem_area_struct{
+ ulint size_and_free; /* memory area size is obtained by
+ anding with ~MEM_AREA_FREE; area in
+ a free list if ANDing with
+ MEM_AREA_FREE results in nonzero */
+ UT_LIST_NODE_T(mem_area_t)
+ free_list; /* free list node */
+};
+
/* Each memory area takes this many extra bytes for control information */
-#define MEM_AREA_EXTRA_SIZE UNIV_MEM_ALIGNMENT
+#define MEM_AREA_EXTRA_SIZE (sizeof(struct mem_area_struct))
/************************************************************************
Creates a memory pool. */
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 9f9401cd1a5..dec8eeb1e15 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -204,7 +204,7 @@ mtr_read_dulint(
/*************************************************************************
This macro locks an rw-lock in s-mode. */
#ifdef UNIV_SYNC_DEBUG
-#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), __FILE__, __LINE__,\
+#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), IB__FILE__, __LINE__,\
(MTR))
#else
#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), (MTR))
@@ -212,7 +212,7 @@ This macro locks an rw-lock in s-mode. */
/*************************************************************************
This macro locks an rw-lock in x-mode. */
#ifdef UNIV_SYNC_DEBUG
-#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\
+#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), IB__FILE__, __LINE__,\
(MTR))
#else
#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), (MTR))
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 0960cf32105..98e892f16b2 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -13,7 +13,6 @@ Created 10/21/1995 Heikki Tuuri
#ifdef __WIN__
-#include <windows.h>
#if (defined(__NT__) || defined(__WIN2000__))
#define WIN_ASYNC_IO
@@ -28,19 +27,10 @@ Created 10/21/1995 Heikki Tuuri
#define POSIX_ASYNC_IO
#endif
-#ifndef S_IRUSR
-#define S_IRUSR 00400
-#define S_IWUSR 00200
-#define S_IRGRP 00040
-#define S_IWGRP 00020
-#define S_IROTH 00004
-#define S_IWOTH 00002
-#endif
-
#endif
#ifdef __WIN__
-typedef HANDLE os_file_t;
+#define os_file_t HANDLE
#else
typedef int os_file_t;
#endif
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h
index 3201a12b0a7..89e3f953b50 100644
--- a/innobase/include/os0sync.h
+++ b/innobase/include/os0sync.h
@@ -13,8 +13,7 @@ Created 9/6/1995 Heikki Tuuri
#ifdef __WIN__
-#include <windows.h>
-typedef CRITICAL_SECTION os_fast_mutex_t;
+#define os_fast_mutex_t CRITICAL_SECTION
typedef void* os_event_t;
#else
@@ -190,9 +189,9 @@ os_fast_mutex_free(
/*===============*/
os_fast_mutex_t* fast_mutex); /* in: mutex to free */
#endif
-
+
#ifndef UNIV_NONINL
#include "os0sync.ic"
#endif
-#endif
+#endif
diff --git a/innobase/include/os0sync.ic b/innobase/include/os0sync.ic
index d82f38483e3..8be9a783593 100644
--- a/innobase/include/os0sync.ic
+++ b/innobase/include/os0sync.ic
@@ -25,7 +25,7 @@ os_fast_mutex_trylock(
#ifdef __WIN__
int ret;
- /* TryEnterCriticalSection is probably not found from
+ /* TODO: TryEnterCriticalSection is probably not found from
NT versions < 4! */
ret = TryEnterCriticalSection(fast_mutex);
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 2b2d9fb4bd6..2e4b6f0f6ee 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -28,6 +28,10 @@ typedef pthread_t os_thread_t;
#endif
typedef unsigned long int os_thread_id_t;
+/* Define a function pointer type to use in a typecast */
+typedef void* (*os_posix_f_t) (void*);
+
+
/********************************************************************
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
@@ -37,8 +41,12 @@ os_thread_t
os_thread_create(
/*=============*/
/* out: handle to the thread */
+#ifndef __WIN__
+ os_posix_f_t start_f,
+#else
ulint (*start_f)(void*), /* in: pointer to function
from which to start */
+#endif
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id); /* out: id of created
diff --git a/innobase/include/row0mysql.ic b/innobase/include/row0mysql.ic
index 773e25a87ef..957a143008d 100644
--- a/innobase/include/row0mysql.ic
+++ b/innobase/include/row0mysql.ic
@@ -43,6 +43,8 @@ row_mysql_read_var_ref(
return(field + 2);
*/
+ UT_NOT_USED(len);
+
return(field); /* No real var implemented in MySQL yet! */
}
@@ -83,7 +85,7 @@ row_mysql_store_col_in_innobase_format(
}
if (!is_unsigned) {
- *ptr = *ptr ^ 128;
+ *ptr = (byte) (*ptr ^ 128);
}
} else if (type == DATA_VARCHAR || type == DATA_VARMYSQL
|| type == DATA_BINARY) {
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 6418b903eeb..a6750e3b277 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -132,7 +132,11 @@ srv_release_threads(
/*************************************************************************
The master thread controlling the server. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_master_thread(
/*==============*/
/* out: a dummy parameter */
@@ -187,7 +191,11 @@ srv_release_mysql_thread_if_suspended(
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */
+#ifndef __WIN__
+void*
+#else
ulint
+#endif
srv_lock_timeout_monitor_thread(
/*============================*/
/* out: a dummy parameter */
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 20afdfb025f..4e055da3810 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -57,7 +57,7 @@ location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
-#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
+#define rw_lock_create(L) rw_lock_create_func((L), IB__FILE__, __LINE__)
/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
@@ -94,7 +94,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, __FILE__, __LINE__)
+ (M), 0, IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock(M) rw_lock_s_lock_func(M)
#endif
@@ -104,7 +104,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), __FILE__, __LINE__)
+ (M), (P), IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(M)
#endif
@@ -114,7 +114,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
- (M), __FILE__, __LINE__)
+ (M), IB__FILE__, __LINE__)
#else
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(M)
#endif
@@ -201,7 +201,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, __FILE__, __LINE__)
+ (M), 0, IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock(M) rw_lock_x_lock_func(M, 0)
#endif
@@ -211,7 +211,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), __FILE__, __LINE__)
+ (M), (P), IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(M, P)
#endif
@@ -221,7 +221,7 @@ corresponding function. */
#ifdef UNIV_SYNC_DEBUG
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), __FILE__, __LINE__)
+ (M), IB__FILE__, __LINE__)
#else
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(M)
#endif
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 87c4628d2e4..f22cce17a1a 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
+#define mutex_create(M) mutex_create_func((M), IB__FILE__, __LINE__)
/*===================*/
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
@@ -64,7 +64,7 @@ NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
#ifdef UNIV_SYNC_DEBUG
-#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
+#define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
#else
#define mutex_enter(M) mutex_enter_func(M)
#endif
@@ -75,7 +75,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */
#ifdef UNIV_SYNC_DEBUG
-#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
+#define mutex_enter_fast(M) mutex_enter_func((M), IB__FILE__, __LINE__)
#else
#define mutex_enter_fast(M) mutex_enter_func(M)
#endif
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index d60c297f3c4..3b8e9be5888 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -13,6 +13,12 @@ Created 1/20/1994 Heikki Tuuri
#define __WIN__
#include <windows.h>
+/* If you want to check for errors with compiler level -W4,
+comment out the above include of windows.h and let the following defines
+be defined:
+#define HANDLE void*
+#define CRITICAL_SECTION ulint
+*/
#else
/* The Unix version */
@@ -38,7 +44,7 @@ subdirectory of 'mysql'. */
/* DEBUG VERSION CONTROL
===================== */
/* Make a non-inline debug version */
-/*
+
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
@@ -48,7 +54,7 @@ subdirectory of 'mysql'. */
#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
-*/
+
#define UNIV_LIGHT_MEM_DEBUG
#define YYDEBUG 1
@@ -91,8 +97,8 @@ definitions: */
#elif defined(_WIN64)
#define UNIV_WORD_SIZE 8
#else
-/* config.h generated by GNU autoconf will define SIZEOF_INT in Posix */
-#define UNIV_WORD_SIZE SIZEOF_INT
+/* MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
+#define UNIV_WORD_SIZE SIZEOF_LONG
#endif
/* The following alignment is used in memory allocations in memory heap
@@ -158,6 +164,11 @@ headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
has the SQL NULL as its value. */
#define UNIV_SQL_NULL ULINT_UNDEFINED
+/* The following definition of __FILE__ removes compiler warnings
+associated with const char* / char* mismatches with __FILE__ */
+
+#define IB__FILE__ ((char*)__FILE__)
+
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index cf49f4f993f..a61f80f01c6 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -28,7 +28,7 @@ extern ulint* ut_dbg_null_ptr;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
/* printf(\
"Assertion failure in thread %lu in file %s line %lu\n",\
- os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\
+ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
printf(\
"we generate a memory trap on purpose to start the debugger\n");*/\
ut_dbg_stop_threads = TRUE;\
@@ -39,7 +39,7 @@ extern ulint* ut_dbg_null_ptr;
}\
if (ut_dbg_stop_threads) {\
printf("Thread %lu stopped in file %s line %lu\n",\
- os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\
+ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
}
@@ -48,7 +48,7 @@ extern ulint* ut_dbg_null_ptr;
ulint dbg_i;\
printf(\
"Assertion failure in thread %lu in file %s line %lu\n",\
- os_thread_get_curr_id(), __FILE__, (ulint)__LINE__);\
+ os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
printf("Generates memory trap on purpose for stack debugging\n");\
ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\