Commit de135a12 authored by unknown's avatar unknown

ut0ut.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes

mem0pool.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0shm.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
page0page.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
que0que.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0ins.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0sel.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0upd.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0vers.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0start.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0arr.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0rec.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0trx.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ut0dbg.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
lock0lock.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0log.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0recv.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ibuf0ibuf.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.ic	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
hash0hash.ic	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mach0data.ic	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0mem.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0pool.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mtr0mtr.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.ic	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.h	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
univ.i  	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.ic	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
com0shm.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0data.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0type.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0crea.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0dict.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fil0fil.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fsp0fsp.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fut0lst.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0sea.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0flu.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0btr.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0cur.c	Fixes for 64-bit Linux, bug fixes, compiler warning fixes


innobase/btr/btr0btr.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0cur.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0sea.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0buf.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0flu.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/com/com0shm.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0data.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0type.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0crea.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0dict.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fil/fil0fil.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fsp/fsp0fsp.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fut/fut0lst.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ibuf/ibuf0ibuf.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.ic:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/hash0hash.ic:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mach0data.ic:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0mem.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0pool.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mtr0mtr.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0file.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.ic:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0thread.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/row0mysql.ic:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/univ.i:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/srv0srv.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0rw.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0sync.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/ut0dbg.h:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/lock/lock0lock.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0log.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0recv.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/mem/mem0pool.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0file.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0shm.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0sync.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0thread.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/page/page0page.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/que/que0que.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0ins.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0mysql.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0sel.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0upd.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0vers.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0srv.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0start.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0arr.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0rw.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0sync.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0rec.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0trx.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ut/ut0ut.c:
  Fixes for 64-bit Linux, bug fixes, compiler warning fixes
parent 6bd98a63
......@@ -6,9 +6,6 @@ The B-tree
Created 6/2/1994 Heikki Tuuri
*******************************************************/
/* Test a change in bitkeeper */
#include "btr0btr.h"
#ifdef UNIV_NONINL
......
......@@ -25,6 +25,7 @@ Created 10/16/1994 Heikki Tuuri
#include "page0page.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "btr0btr.h"
#include "btr0sea.h"
#include "row0upd.h"
......@@ -314,7 +315,7 @@ btr_cur_search_to_nth_level(
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
mtr);
......@@ -485,7 +486,7 @@ btr_cur_open_at_index_side(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
......@@ -574,7 +575,7 @@ btr_cur_open_at_rnd_pos(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
......
......@@ -187,13 +187,13 @@ btr_search_info_update_hash(
return;
}
n_unique = dict_index_get_n_unique_in_tree(index);
if (info->n_hash_potential == 0) {
goto set_new_recomm;
}
n_unique = dict_index_get_n_unique_in_tree(index);
/* Test if the search would have succeeded using the recommended
hash prefix */
......@@ -676,7 +676,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
mtr);
......
......@@ -1117,7 +1117,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG
buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
#else
buf_block_buf_fix_inc(block);
#endif
......
......@@ -560,7 +560,7 @@ buf_flush_batch(
if (buf_debug_prints && (page_count > 0)) {
if (flush_type == BUF_FLUSH_LRU) {
printf("To flush %lu pages in LRU flush\n",
page_count, flush_type);
page_count);
} else if (flush_type == BUF_FLUSH_LIST) {
printf("To flush %lu pages in flush list flush\n",
page_count, flush_type);
......
......@@ -774,7 +774,7 @@ com_shm_create_or_open(
ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM");
ut_strcpy(buf + len, (char*)"_IBSHM");
shm = os_shm_create(sizeof(com_shm_info_t) + COM_MAX_ADDR_LEN +
com_shm_endpoint_get_size(ep), buf);
......@@ -791,13 +791,13 @@ com_shm_create_or_open(
return(COM_ERR_NOT_SPECIFIED);
}
ut_strcpy(buf + len, "_IBSHM_EV_NE"),
ut_strcpy(buf + len, (char*)"_IBSHM_EV_NE"),
event_ne = os_event_create_auto(buf);
ut_ad(event_ne);
ut_strcpy(buf + len, "_IBSHM_EV_EM"),
ut_strcpy(buf + len, (char*)"_IBSHM_EV_EM"),
event_em = os_event_create_auto(buf);
......@@ -843,7 +843,7 @@ com_shm_open(
/* Open the interprocess mutex to protect the shared memory area */
ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM_MTX");
ut_strcpy(buf + len, (char*)"_IBSHM_MTX");
ret = ip_mutex_open(com_shm_get_ip_mutex(map), buf, &ip_hdl);
......@@ -890,7 +890,7 @@ com_shm_bind(
/* Create the interprocess mutex to protect the shared memory area */
ut_memcpy(buf, name, len);
ut_strcpy(buf + len, "_IBSHM_MTX");
ut_strcpy(buf + len, (char*)"_IBSHM_MTX");
ret = ip_mutex_create(com_shm_get_ip_mutex(map), buf, &ip_hdl);
......
......@@ -155,9 +155,7 @@ dtuple_validate(
ulint len;
ulint i;
ulint j;
ulint sum = 0; /* A dummy variable used
to prevent the compiler
from erasing the loop below */
ut_a(tuple->magic_n = DATA_TUPLE_MAGIC_N);
n_fields = dtuple_get_n_fields(tuple);
......@@ -227,7 +225,7 @@ dfield_print(
}
} else if (mtype == DATA_INT) {
ut_a(len == 4); /* only works for 32-bit integers */
printf("%li", (int)mach_read_from_4(data));
printf("%i", (int)mach_read_from_4(data));
} else {
ut_error;
}
......@@ -285,13 +283,13 @@ dfield_print_also_hex(
data = dfield_get_data(dfield);
for (i = 0; i < len; i++) {
printf("%02x", (ulint)*data);
printf("%02lx", (ulint)*data);
data++;
}
} else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */
printf("%li", (int)mach_read_from_4(data));
printf("%i", (int)mach_read_from_4(data));
} else {
ut_error;
}
......@@ -380,6 +378,8 @@ dtuple_sprintf(
return(len);
}
#ifdef notdefined
/******************************************************************
Generates random numbers, where 10/16 is uniformly
distributed between 0 and n1, 5/16 between 0 and n2,
......@@ -788,3 +788,5 @@ dtuple_gen_search_tuple_TPC_C(
ut_ad(dtuple_validate(tuple));
}
#endif /* notdefined */
......@@ -89,5 +89,3 @@ dtype_print(
printf("; len %lu prec %lu\n", type->len, type->prec);
}
......@@ -80,16 +80,6 @@ dict_create_search_tuple(
table */
mem_heap_t* heap); /* in: memory heap from which the memory for
the built tuple is allocated */
/*************************************************************************
Creates the single index for a cluster: it contains all the columns of
the cluster definition in the order they were defined. */
static
void
dict_create_cluster_index(
/*======================*/
dict_table_t* table, /* in: cluster */
trx_t* trx); /* in: transaction handle */
/*********************************************************************
Based on a table object, this function builds the entry to be inserted
......@@ -814,7 +804,7 @@ dict_create_table_step(
que_thr_t* thr) /* in: query thread */
{
tab_node_t* node;
ulint err;
ulint err = DB_ERROR;
trx_t* trx;
ut_ad(thr);
......@@ -922,7 +912,7 @@ dict_create_index_step(
{
ind_node_t* node;
ibool success;
ulint err;
ulint err = DB_ERROR;
trx_t* trx;
ut_ad(thr);
......
......@@ -19,6 +19,7 @@ Created 1/8/1996 Heikki Tuuri
#include "dict0mem.h"
#include "trx0undo.h"
#include "btr0btr.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "pars0pars.h"
#include "pars0sym.h"
......@@ -39,13 +40,6 @@ dict_sys_t* dict_sys = NULL; /* the dictionary system */
#define DICT_POOL_PER_VARYING 4 /* buffer pool max size per data
dictionary varying size in bytes */
/**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. */
static
void
dict_table_LRU_trim(void);
/*=====================*/
/**************************************************************************
Adds a column to the data dictionary hash table. */
static
......@@ -586,7 +580,7 @@ dict_table_remove_from_cache(
/**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. Currently not used! */
static
void
dict_table_LRU_trim(void)
/*=====================*/
......
......@@ -544,6 +544,8 @@ fil_write_flushed_lsn_to_data_files(
}
mutex_exit(&(fil_system->mutex));
return(DB_SUCCESS);
}
/***********************************************************************
......
......@@ -2626,11 +2626,11 @@ fseg_free_step(
fseg_inode_t* inode;
ulint space;
space = buf_frame_get_space_id(header);
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
space = buf_frame_get_space_id(header);
mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr);
......@@ -2682,11 +2682,11 @@ fseg_free_step_not_header(
ulint space;
ulint page_no;
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space), MTR_MEMO_X_LOCK));
space = buf_frame_get_space_id(header);
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr);
......
......@@ -512,5 +512,5 @@ flst_print(
printf("FILE-BASED LIST:\n");
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n",
buf_frame_get_space_id(frame), buf_frame_get_page_no(frame),
base - frame, len);
(ulint) (base - frame), len);
}
......@@ -1292,6 +1292,8 @@ ibuf_add_free_page(
mutex_exit(&ibuf_mutex);
ibuf_exit();
return(DB_SUCCESS);
}
/*************************************************************************
......@@ -2424,7 +2426,7 @@ ibuf_merge_or_delete_for_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
......
......@@ -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)
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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. */
......
......@@ -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))
......
......@@ -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
......
......@@ -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
......@@ -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);
......
......@@ -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
......
......@@ -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) {
......
......@@ -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 */
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -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);\
......
......@@ -3177,7 +3177,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
if (page) {
......
......@@ -72,16 +72,6 @@ the previous */
#define LOG_ARCHIVE_READ 1
#define LOG_ARCHIVE_WRITE 2
/**********************************************************
Calculates the file count of an lsn within a log group. */
static
ulint
log_group_calc_lsn_file_count(
/*==========================*/
/* out: file count within the log group */
dulint lsn, /* in: lsn, must be within 4 GB of
group->next_block_lsn */
log_group_t* group); /* in: log group */
/**********************************************************
Completes a checkpoint write i/o to a log file. */
static
......@@ -520,6 +510,8 @@ log_calc_max_ages(void)
+ LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
success = FALSE;
goto failure;
} else {
margin = smallest_capacity - free;
}
......@@ -540,10 +532,11 @@ log_calc_max_ages(void)
log_sys->max_archived_lsn_age_async = smallest_archive_margin
- smallest_archive_margin /
LOG_ARCHIVE_RATIO_ASYNC;
failure:
mutex_exit(&(log_sys->mutex));
if (!success) {
printf(
fprintf(stderr,
"Error: log file group too small for the number of threads\n");
}
......
......@@ -407,12 +407,17 @@ recv_find_max_checkpoint(
/* Check the consistency of the checkpoint info */
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
if (fold != mach_read_from_4(buf
if ((fold & 0xFFFFFFFF)
!= mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_1)) {
if (log_debug_writes) {
fprintf(stderr,
"Innobase: Checkpoint in group %lu at %lu invalid\n",
group->id, field);
"Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
group->id, field,
fold & 0xFFFFFFFF,
mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_1));
}
goto not_consistent;
......@@ -421,12 +426,16 @@ recv_find_max_checkpoint(
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
LOG_CHECKPOINT_CHECKSUM_2
- LOG_CHECKPOINT_LSN);
if (fold != mach_read_from_4(buf
if ((fold & 0xFFFFFFFF)
!= mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2)) {
if (log_debug_writes) {
fprintf(stderr,
"Innobase: Checkpoint in group %lu at %lu invalid\n",
group->id, field);
"Innobase: Checkpoint in group %lu at %lu invalid, %lu, %lu\n",
group->id, field,
fold & 0xFFFFFFFF,
mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2));
}
goto not_consistent;
}
......@@ -461,10 +470,7 @@ recv_find_max_checkpoint(
if (*max_group == NULL) {
if (log_debug_writes) {
fprintf(stderr,
"Innobase: No valid checkpoint found\n");
}
fprintf(stderr, "Innobase: No valid checkpoint found\n");
return(DB_ERROR);
}
......@@ -796,7 +802,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page, BUF_KEEP_OLD,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
ut_a(success);
......@@ -860,8 +866,8 @@ recv_recover_page(
if (log_debug_writes) {
fprintf(stderr,
"Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n",
recv->type, recv->len, recv_addr->space,
"Innobase: Applying log rec type %lu len %lu to space %lu page no %lu\n",
(ulint)recv->type, recv->len, recv_addr->space,
recv_addr->page_no);
}
......@@ -1213,7 +1219,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
if (frame) {
......@@ -1228,7 +1234,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
if (frame) {
......@@ -1449,7 +1455,7 @@ recv_parse_log_recs(
if (log_debug_writes) {
fprintf(stderr,
"Innobase: Parsed a single log rec type %lu len %lu space %lu page no %lu\n",
type, len, space, page_no);
(ulint)type, len, space, page_no);
}
if (type == MLOG_DUMMY_RECORD) {
......@@ -1498,7 +1504,7 @@ recv_parse_log_recs(
if (log_debug_writes) {
fprintf(stderr,
"Innobase: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n",
type, len, space, page_no);
(ulint)type, len, space, page_no);
}
total_len += len;
......
......@@ -72,22 +72,11 @@ and for the adaptive index. Thus, for each individual transaction, its locks
can occupy at most about the size of the buffer frame of memory in the common
pool, and after that its locks will grow into the buffer 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 */
};
/* Mask used to extract the free bit from area->size */
#define MEM_AREA_FREE 1
/* The smallest memory area total size */
#define MEM_AREA_MIN_SIZE (2 * UNIV_MEM_ALIGNMENT)
#define MEM_AREA_MIN_SIZE (2 * sizeof(struct mem_area_struct))
/* Data structure for a memory pool. The space is allocated using the buddy
algorithm, where free list i contains areas of size 2 to power i. */
......
......@@ -166,6 +166,8 @@ os_file_handle_error(
int input_char;
ulint err;
UT_NOT_USED(file);
err = os_file_get_last_error();
if (err == OS_FILE_DISK_FULL) {
......@@ -316,8 +318,11 @@ os_file_create(
UT_NOT_USED(purpose);
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IRGRP | S_IROTH
| S_IWUSR | S_IWGRP | S_IWOTH);
#ifndef S_IRWXU
file = open(name, create_flag);
#else
file = open(name, create_flag, S_IRWXU | S_IRWXG | S_IRWXO);
#endif
} else {
file = open(name, create_flag);
}
......@@ -445,6 +450,8 @@ os_file_set_size(
low = size;
#if (UNIV_WORD_SIZE == 8)
low = low + (size_high << 32);
#else
UT_NOT_USED(size_high);
#endif
while (offset < low) {
if (low - offset < UNIV_PAGE_SIZE * 64) {
......@@ -478,6 +485,8 @@ os_file_set_size(
}
ut_error;
return(FALSE);
}
/***************************************************************************
......@@ -660,6 +669,8 @@ os_file_read(
#if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32);
#else
UT_NOT_USED(offset_high);
#endif
try_again:
/* Protect the seek / read operation with a mutex */
......@@ -669,7 +680,7 @@ os_file_read(
ret = os_file_pread(file, buf, n, (off_t) offset);
if (ret == n) {
if ((ulint)ret == n) {
os_mutex_exit(os_file_seek_mutexes[i]);
return(TRUE);
......@@ -751,16 +762,17 @@ os_file_write(
#if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32);
#else
UT_NOT_USED(offset_high);
#endif
try_again:
ret = pwrite(file, buf, n, (off_t) offset);
if (ret == n) {
if ((ulint)ret == n) {
return(TRUE);
}
#endif
error_handling:
error_handling:
retry = os_file_handle_error(file, name);
if (retry) {
......@@ -1411,7 +1423,6 @@ os_aio(
return(TRUE);
}
error_handling:
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(file, name);
......@@ -1908,7 +1919,8 @@ os_aio_print(void)
if (slot->reserved) {
n_reserved++;
printf("Reserved slot, messages %lx %lx\n",
slot->message1, slot->message2);
(ulint)slot->message1,
(ulint)slot->message2);
ut_a(slot->len > 0);
}
}
......
......@@ -90,6 +90,8 @@ os_shm_free(
}
#else
UT_NOT_USED(shm);
return(FALSE);
#endif
}
......@@ -116,6 +118,8 @@ os_shm_map(
return(mem);
#else
UT_NOT_USED(shm);
return(NULL);
#endif
}
......@@ -142,5 +146,7 @@ os_shm_unmap(
}
#else
UT_NOT_USED(addr);
return(FALSE);
#endif
}
......@@ -19,14 +19,14 @@ Created 9/6/1995 Heikki Tuuri
#include "ut0mem.h"
/* Type definition for an operating system mutex struct */
struct os_mutex_struct{
struct os_mutex_struct{
void* handle; /* OS handle to mutex */
ulint count; /* we use this counter to check
that the same thread does not
recursively lock the mutex: we
do not assume that the OS mutex
supports recursive locking, though
NT seems to do that */
NT seems to do that */
};
/*************************************************************
......@@ -44,7 +44,7 @@ os_event_create(
{
#ifdef __WIN__
HANDLE event;
event = CreateEvent(NULL, /* No security attributes */
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
......@@ -108,7 +108,7 @@ os_event_set(
/*=========*/
os_event_t event) /* in: event to set */
{
#ifdef __WIN__
#ifdef __WIN__
ut_a(event);
ut_a(SetEvent(event));
#else
......@@ -124,7 +124,7 @@ os_event_set(
}
os_fast_mutex_unlock(&(event->os_mutex));
#endif
#endif
}
/**************************************************************
......@@ -162,7 +162,7 @@ void
os_event_free(
/*==========*/
os_event_t event) /* in: event to free */
{
#ifdef __WIN__
ut_a(event);
......@@ -238,7 +238,7 @@ os_event_wait_time(
} else {
err = WaitForSingleObject(event, INFINITE);
}
if (err == WAIT_OBJECT_0) {
return(0);
......@@ -250,7 +250,7 @@ os_event_wait_time(
}
#else
UT_NOT_USED(time);
/* In Posix this is just an ordinary, infinite wait */
os_event_wait(event);
......@@ -290,7 +290,7 @@ os_event_wait_multiple(
return(index - WAIT_OBJECT_0);
#else
ut_a(n == 0);
/* In Posix we can only wait for a single event */
os_event_wait(*event_array);
......@@ -331,7 +331,7 @@ os_mutex_create(
os_mutex_t mutex_str;
UT_NOT_USED(name);
os_mutex = ut_malloc(sizeof(os_fast_mutex_t));
os_fast_mutex_init(os_mutex);
......@@ -342,7 +342,7 @@ os_mutex_create(
mutex_str->count = 0;
return(mutex_str);
#endif
#endif
}
/**************************************************************
......@@ -398,7 +398,7 @@ os_mutex_exit(
(mutex->count)--;
os_fast_mutex_unlock(mutex->handle);
#endif
#endif
}
/**************************************************************
......@@ -432,7 +432,7 @@ os_fast_mutex_init(
{
#ifdef __WIN__
ut_a(fast_mutex);
InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#else
pthread_mutex_init(fast_mutex, NULL);
......
......@@ -30,9 +30,6 @@ os_thread_get_curr_id(void)
#endif
}
/* 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
......@@ -42,8 +39,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
......@@ -65,11 +66,7 @@ os_thread_create(
int ret;
os_thread_t pthread;
/* Note that below we cast the start function returning an integer
to a function returning a pointer: this may cause error
if the return value is used somewhere! */
ret = pthread_create(&pthread, NULL, (os_posix_f_t) start_f, arg);
ret = pthread_create(&pthread, NULL, start_f, arg);
return(pthread);
#endif
......
......@@ -1055,9 +1055,9 @@ page_dir_print(
printf("--------------------------------\n");
printf("PAGE DIRECTORY\n");
printf("Page address %lx\n", page);
printf("Page address %lx\n", (ulint)page);
printf("Directory stack top at offs: %lu; number of slots: %lu\n",
page_dir_get_nth_slot(page, n - 1) - page, n);
(ulint)(page_dir_get_nth_slot(page, n - 1) - page), n);
for (i = 0; i < n; i++) {
slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) {
......@@ -1067,7 +1067,7 @@ page_dir_print(
printf(
"Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
i, page_dir_slot_get_n_owned(slot),
page_dir_slot_get_rec(slot) - page);
(ulint)(page_dir_slot_get_rec(slot) - page));
}
}
printf("Total of %lu records\n", 2 + page_get_n_recs(page));
......@@ -1091,7 +1091,7 @@ page_print_list(
printf("--------------------------------\n");
printf("PAGE RECORD LIST\n");
printf("Page address %lu\n", page);
printf("Page address %lu\n", (ulint)page);
n_recs = page_get_n_recs(page);
......@@ -1142,7 +1142,7 @@ page_header_print(
{
printf("--------------------------------\n");
printf("PAGE HEADER INFO\n");
printf("Page address %lx, n records %lu\n", page,
printf("Page address %lx, n records %lu\n", (ulint)page,
page_header_get_field(page, PAGE_N_RECS));
printf("n dir slots %lu, heap top %lu\n",
......
......@@ -1243,7 +1243,7 @@ que_thr_step(
/***********************************************************************
Checks if there is a need for a query thread switch or stopping the current
thread. */
static
que_thr_t*
que_thr_check_if_switch(
/*====================*/
......
......@@ -439,6 +439,8 @@ row_ins_duplicate_error(
page_t* page;
ulint n_unique;
UT_NOT_USED(mtr);
ut_ad(cursor->index->type & DICT_UNIQUE);
/* NOTE: For unique non-clustered indexes there may be any number
......
......@@ -93,9 +93,6 @@ row_mysql_convert_row_to_innobase(
field type information is already
copied there, or will be copied
later */
byte* buf, /* in/out: buffer to use in converting
data in columns; this must be at least
the size of mysql_rec! */
row_prebuilt_t* prebuilt, /* in: prebuilt struct where template
must be of type ROW_MYSQL_WHOLE_ROW */
byte* mysql_rec) /* in: row in the MySQL format;
......@@ -474,9 +471,8 @@ row_insert_for_mysql(
node = prebuilt->ins_node;
}
row_mysql_convert_row_to_innobase(node->row,
prebuilt->ins_upd_rec_buff,
prebuilt, mysql_rec);
row_mysql_convert_row_to_innobase(node->row, prebuilt, mysql_rec);
savept = trx_savept_take(trx);
thr = que_fork_get_first_thr(prebuilt->ins_graph);
......@@ -666,9 +662,7 @@ row_update_for_mysql(
prebuilt->mysql_row_len);
}
row_mysql_convert_row_to_innobase(row_tuple,
prebuilt->ins_upd_rec_buff,
prebuilt, mysql_rec);
row_mysql_convert_row_to_innobase(row_tuple, prebuilt, mysql_rec);
search_tuple = dtuple_create(heap, ref_len);
......
......@@ -1791,6 +1791,8 @@ row_sel_convert_mysql_key_to_innobase(
byte* key_end;
ulint n_fields = 0;
UT_NOT_USED(index);
key_end = key_ptr + key_len;
/* Permit us to access any field in the tuple (ULINT_MAX): */
......@@ -1919,7 +1921,7 @@ row_sel_field_store_in_mysql_format(
}
if (!is_unsigned) {
dest[len - 1] = dest[len - 1] ^ 128;
dest[len - 1] = (byte) (dest[len - 1] ^ 128);
}
ut_ad(col_len == len);
......
......@@ -750,7 +750,7 @@ row_upd_sec_index_entry(
btr_cur_t* btr_cur;
mem_heap_t* heap;
rec_t* rec;
ulint err;
ulint err = DB_SUCCESS;
index = node->index;
......@@ -781,7 +781,7 @@ row_upd_sec_index_entry(
btr_pcur_close(&pcur);
mtr_commit(&mtr);
if (node->is_delete || (err != DB_SUCCESS)) {
if (node->is_delete || err != DB_SUCCESS) {
mem_heap_free(heap);
......@@ -1169,7 +1169,7 @@ row_upd(
upd_node_t* node, /* in: row update node */
que_thr_t* thr) /* in: query thread */
{
ulint err;
ulint err = DB_SUCCESS;
ut_ad(node && thr);
......
......@@ -51,7 +51,8 @@ row_vers_impl_x_locked_off_kernel(
mem_heap_t* heap;
mem_heap_t* heap2;
dtuple_t* row;
dtuple_t* entry;
dtuple_t* entry = NULL; /* assignment to eliminate compiler
warning */
trx_t* trx;
ibool vers_del;
ibool rec_del;
......
......@@ -807,7 +807,7 @@ srv_console(
/*************************************************************************
Creates the first communication endpoint for the server. This
first call also initializes the com0com.* module. */
static
void
srv_communication_init(
/*===================*/
......@@ -1037,7 +1037,7 @@ srv_worker_thread(
/*************************************************************************
Creates the worker threads. */
static
void
srv_create_worker_threads(void)
/*===========================*/
......@@ -1717,7 +1717,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 */
......@@ -1782,7 +1786,11 @@ srv_lock_timeout_monitor_thread(
goto loop;
#ifndef __WIN__
return(NULL);
#else
return(0);
#endif
}
/***********************************************************************
......@@ -1811,7 +1819,11 @@ srv_active_wake_master_thread(void)
/*************************************************************************
The master thread controlling the server. */
#ifndef __WIN__
void*
#else
ulint
#endif
srv_master_thread(
/*==============*/
/* out: a dummy parameter */
......@@ -1951,5 +1963,9 @@ srv_master_thread(
goto loop;
#ifndef __WIN__
return(NULL);
#else
return(0);
#endif
}
......@@ -81,7 +81,12 @@ os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5];
/************************************************************************
I/o-handler thread function. */
static
#ifndef __WIN__
void*
#else
ulint
#endif
io_handler_thread(
/*==============*/
void* arg)
......@@ -101,7 +106,11 @@ io_handler_thread(
mutex_exit(&ios_mutex);
}
#ifndef __WIN__
return(NULL);
#else
return(0);
#endif
}
/*************************************************************************
......@@ -124,6 +133,8 @@ open_or_create_log_file(
ulint size_high;
char name[10000];
UT_NOT_USED(create_new_db);
*log_file_created = FALSE;
sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", i);
......@@ -506,7 +517,7 @@ innobase_start_or_create_for_mysql(void)
n[i] = i;
os_thread_create(io_handler_thread, n + i, thread_ids + i);
}
}
err = open_or_create_data_files(&create_new_db,
&min_flushed_lsn, &min_arch_log_no,
......@@ -514,6 +525,8 @@ innobase_start_or_create_for_mysql(void)
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
fprintf(stderr, "Innobase: Could not open data files\n");
return((int) err);
}
......
......@@ -119,7 +119,6 @@ sync_array_get_nth_cell(
ulint n) /* in: index */
{
ut_a(arr);
ut_a(n >= 0);
ut_a(n < arr->n_cells);
return(arr->array + n);
......@@ -455,8 +454,9 @@ sync_array_cell_print(
}
printf("%lx waited for by thread %lu op. %s file %s line %lu ",
cell->wait_object, cell->thread,
str, cell->file,cell->line);
(ulint)cell->wait_object,
(ulint)cell->thread,
str, cell->file, cell->line);
if (!cell->waiting) {
printf("WAIT ENDED ");
}
......@@ -633,7 +633,7 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
printf("rw-lock %lx ", lock);
printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug);
sync_array_cell_print(cell);
......@@ -666,7 +666,7 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
printf("rw-lock %lx ", lock);
printf("rw-lock %lx ", (ulint) lock);
rw_lock_debug_print(debug);
sync_array_cell_print(cell);
......
......@@ -165,7 +165,6 @@ rw_lock_validate(
ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a((rw_lock_get_reader_count(lock) == 0)
|| (rw_lock_get_writer(lock) != RW_LOCK_EX));
ut_a(rw_lock_get_reader_count(lock) >= 0);
ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
......
......@@ -259,7 +259,7 @@ mutex_enter_nowait(
if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, __FILE__, __LINE__);
mutex_set_debug_info(mutex, IB__FILE__, __LINE__);
#endif
return(0); /* Succeeded! */
......
......@@ -1040,7 +1040,7 @@ trx_undo_report_row_operation(
RW_X_LATCH, undo->guess_page,
BUF_GET,
#ifdef UNIV_SYNC_DEBUG
__FILE__, __LINE__,
IB__FILE__, __LINE__,
#endif
&mtr);
......
......@@ -30,14 +30,6 @@ sess_t* trx_dummy_sess = NULL;
the kernel mutex */
ulint trx_n_mysql_transactions = 0;
/********************************************************************
Takes care of the error handling when an SQL error or other error has
occurred. */
static
void
trx_error_handle(
/*=============*/
trx_t* trx); /* in: trx handle */
/********************************************************************
Creates and initializes a transaction object. */
......
......@@ -91,7 +91,7 @@ ut_print_buf(
data = buf;
for (i = 0; i < len; i++) {
printf("%02x", (ulint)*data);
printf("%02lx", (ulint)*data);
data++;
}
......@@ -131,7 +131,7 @@ ut_sprintf_buf(
data = buf;
for (i = 0; i < len; i++) {
n += sprintf(str + n, "%02x", (ulint)*data);
n += sprintf(str + n, "%02lx", (ulint)*data);
data++;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment