summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi5
-rw-r--r--include/my_no_pthread.h2
-rw-r--r--include/my_sys.h15
-rw-r--r--innobase/include/os0thread.h4
-rw-r--r--innobase/include/trx0trx.h9
-rw-r--r--innobase/include/univ.i6
-rw-r--r--innobase/include/ut0ut.h12
-rw-r--r--innobase/lock/lock0lock.c6
-rw-r--r--innobase/os/os0thread.c11
-rw-r--r--innobase/srv/srv0srv.c13
-rw-r--r--innobase/trx/trx0trx.c13
-rw-r--r--innobase/ut/ut0ut.c25
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/t/bigint.test6
-rw-r--r--mysql-test/t/func_if.test4
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/my_gethostbyname.c3
-rw-r--r--mysys/my_init.c3
-rw-r--r--mysys/my_net.c5
-rw-r--r--mysys/my_os2cond.c24
-rw-r--r--mysys/my_os2dirsrch.c66
-rw-r--r--mysys/my_os2dirsrch.h20
-rw-r--r--mysys/my_os2dlfcn.c4
-rw-r--r--mysys/my_os2file64.c144
-rw-r--r--mysys/my_os2mutex.c8
-rw-r--r--mysys/my_os2thread.c6
-rw-r--r--mysys/my_os2tls.c44
-rw-r--r--mysys/my_port.c40
-rw-r--r--mysys/mysys_priv.h6
-rw-r--r--mysys/thr_rwlock.c1
-rw-r--r--sql/ha_innodb.cc65
-rw-r--r--sql/ha_innodb.h1
-rw-r--r--sql/item_cmpfunc.cc6
-rw-r--r--sql/mysqld.cc26
-rw-r--r--sql/sql_insert.cc2
36 files changed, 405 insertions, 206 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index a10c53af7a8..1b448cfca06 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -50881,7 +50881,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
@item
-Fixed a security bug with empty db column in db table
+Fixed problem with @code{UNSIGNED BIGINT} on AIX.
+@item
+Fixed security bug when having an empty databasename in the @code{user.db}
+table.
@item
Changed initialisation of @code{RND()} to make it less predicatable.
@item
diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h
index 81c0de580db..0a034f78192 100644
--- a/include/my_no_pthread.h
+++ b/include/my_no_pthread.h
@@ -20,7 +20,7 @@
environment, easier to use.
*/
-#if !defined(_my_no_pthread_h) && !defined(THREADS)
+#if !defined(_my_no_pthread_h) && !defined(THREAD)
#define _my_no_pthread_h
#define pthread_mutex_init(A,B)
diff --git a/include/my_sys.h b/include/my_sys.h
index de60b7b1a03..163fb72a910 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -158,22 +158,21 @@ extern my_string my_strdup(const char *from,myf MyFlags);
#define CALLER_INFO /* nothing */
#define ORIG_CALLER_INFO /* nothing */
#endif
+
#ifdef HAVE_ALLOCA
-#ifdef __GNUC__
-/* Remove any previous definitions. */
-#undef alloca
-#define alloca(size) __builtin_alloca (size)
-#else /* xlc */
-#ifdef _AIX
- #pragma alloca
+#if defined(_AIX) && !defined(__GNUC__)
+#pragma alloca
#endif /* _AIX */
-#endif /* __GNUC__ */
+#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H)
+#define alloca __builtin_alloca
+#endif /* GNUC */
#define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) {}
#else
#define my_alloca(SZ) my_malloc(SZ,MYF(0))
#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
#endif /* HAVE_ALLOCA */
+
#ifdef MSDOS
#ifdef __ZTC__
void * __CDECL halloc(long count,size_t length);
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 636cfd79e50..95a3a95fb74 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -70,7 +70,9 @@ os_thread_create(
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id); /* out: id of created
- thread */
+ thread; currently this is
+ identical to the handle to
+ the thread */
/*********************************************************************
A thread calling this function ends its execution. */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 6e98f22c34b..e1f65e9da0f 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -117,6 +117,13 @@ void
trx_start_if_not_started(
/*=====================*/
trx_t* trx); /* in: transaction */
+/*****************************************************************
+Starts the transaction if it is not yet started. */
+
+void
+trx_start_if_not_started_noninline(
+/*===============================*/
+ trx_t* trx); /* in: transaction */
/********************************************************************
Commits a transaction. */
@@ -262,7 +269,7 @@ void
trx_print(
/*======*/
char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ 800 bytes */
trx_t* trx); /* in: transaction */
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index a4f29dc4cf3..f32161fed20 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -63,6 +63,12 @@ Microsoft Visual C++ */
#define HAVE_PWRITE
#endif
+/* Apparently in some old SCO Unixes the return type of sprintf is not
+an integer as it should be according to the modern Posix standard. Because
+of that we define sprintf inside InnoDB code as our own function ut_sprintf */
+#undef sprintf
+#define sprintf ut_sprintf
+
#endif
/* DEBUG VERSION CONTROL
diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h
index 408788016c1..8ec23b23dcd 100644
--- a/innobase/include/ut0ut.h
+++ b/innobase/include/ut0ut.h
@@ -17,6 +17,18 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
+
+/************************************************************
+Uses vsprintf to emulate sprintf so that the function always returns
+the printed length. Apparently in some old SCO Unixes sprintf did not
+return the printed length but a pointer to the end of the printed string. */
+
+ulint
+ut_sprintf(
+/*=======*/
+ char* buf, /* in/out: buffer where to print */
+ const char* format, /* in: format of prints */
+ ...); /* in: arguments to be printed */
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 0bc7e9b4166..7030dbf9130 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -2755,6 +2755,8 @@ lock_deadlock_occurs(
err_buf += sprintf(err_buf,
"*** WE ROLL BACK TRANSACTION (2)\n");
+ ut_a(strlen(lock_latest_err_buf) < 4100);
+
/*
sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
index, NULL, NULL, NULL);
@@ -3626,7 +3628,7 @@ lock_print_info(
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
while (trx) {
- if (buf_end - buf < 600) {
+ if (buf_end - buf < 900) {
return;
}
@@ -3663,7 +3665,7 @@ loop:
return;
}
- if (buf_end - buf < 600) {
+ if (buf_end - buf < 900) {
return;
}
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index a8b417f4f3a..cb1205c5a85 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -97,17 +97,20 @@ os_thread_create(
function */
os_thread_id_t* thread_id __attribute__((unused)))
/* out: id of created
- thread */
+ thread; currently this is
+ identical to the handle to
+ the thread */
{
#ifdef __WIN__
os_thread_t thread;
+ ulint win_thread_id;
thread = CreateThread(NULL, /* no security attributes */
0, /* default size stack */
(LPTHREAD_START_ROUTINE)start_f,
arg,
0, /* thread runs immediately */
- thread_id);
+ &win_thread_id);
if (srv_set_thread_priorities) {
@@ -118,6 +121,8 @@ os_thread_create(
ut_a(SetThreadPriority(thread, srv_query_thread_priority));
}
+ *thread_id = thread;
+
return(thread);
#else
int ret;
@@ -135,6 +140,8 @@ os_thread_create(
my_pthread_setprio(pthread, srv_query_thread_priority);
}
+ *thread_id = pthread;
+
return(pthread);
#endif
}
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 3b16e9557fa..d0ac011e60f 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -2228,6 +2228,7 @@ srv_sprintf_innodb_monitor(
ut_sprintf_timestamp(buf);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, " INNODB MONITOR OUTPUT\n"
"=====================================\n");
@@ -2242,6 +2243,7 @@ srv_sprintf_innodb_monitor(
sync_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "------------\n"
"TRANSACTIONS\n"
@@ -2254,15 +2256,18 @@ srv_sprintf_innodb_monitor(
"--------\n");
os_aio_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "-------------------------------------\n"
"INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
"-------------------------------------\n");
ibuf_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
ha_print_info(buf, buf_end, btr_search_sys->hash_index);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
@@ -2278,6 +2283,7 @@ srv_sprintf_innodb_monitor(
"---\n");
log_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "----------------------\n"
"BUFFER POOL AND MEMORY\n"
@@ -2288,6 +2294,7 @@ srv_sprintf_innodb_monitor(
mem_pool_get_reserved(mem_comm_pool));
buf_print_io(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "--------------\n"
"ROW OPERATIONS\n"
@@ -2321,6 +2328,8 @@ srv_sprintf_innodb_monitor(
buf += sprintf(buf, "----------------------------\n"
"END OF INNODB MONITOR OUTPUT\n"
"============================\n");
+ ut_a(buf < buf_end + 1900);
+
mutex_exit(&srv_innodb_monitor_mutex);
}
@@ -2378,7 +2387,9 @@ loop:
buf = mem_alloc(100000);
- srv_sprintf_innodb_monitor(buf, 100000);
+ srv_sprintf_innodb_monitor(buf, 90000);
+
+ ut_a(strlen(buf) < 99000);
printf("%s", buf);
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index ef17588a2bb..994a6777924 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -39,6 +39,17 @@ sess_t* trx_dummy_sess = NULL;
the kernel mutex */
ulint trx_n_mysql_transactions = 0;
+/*****************************************************************
+Starts the transaction if it is not yet started. */
+
+void
+trx_start_if_not_started_noninline(
+/*===============================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx_start_if_not_started(trx);
+}
+
/********************************************************************
Retrieves the error_info field from a trx. */
@@ -1465,7 +1476,7 @@ void
trx_print(
/*======*/
char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ 800 bytes */
trx_t* trx) /* in: transaction */
{
char* start_of_line;
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index c164afa0573..c77cbe9cdcf 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -12,11 +12,36 @@ Created 5/11/1994 Heikki Tuuri
#include "ut0ut.ic"
#endif
+#include <stdarg.h>
+
#include "ut0sort.h"
ibool ut_always_false = FALSE;
/************************************************************
+Uses vsprintf to emulate sprintf so that the function always returns
+the printed length. Apparently in some old SCO Unixes sprintf did not
+return the printed length but a pointer to the end of the printed string. */
+
+ulint
+ut_sprintf(
+/*=======*/
+ char* buf, /* in/out: buffer where to print */
+ const char* format, /* in: format of prints */
+ ...) /* in: arguments to be printed */
+{
+ va_list args;
+
+ va_start(args, format);
+
+ vsprintf(buf, format, args);
+
+ va_end(args);
+
+ return((ulint)strlen(buf));
+}
+
+/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
we do this by a special conversion. */
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 98bcd173fc6..e308baa7bd0 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -60,7 +60,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
charset.lo hash.lo mf_iocache.lo \
mf_iocache2.lo my_seek.lo \
my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \
- my_getopt.lo my_gethostbyname.lo
+ my_getopt.lo my_gethostbyname.lo my_port.lo
sqlobjects = net.lo
# Not needed in the minimum library
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 85cdc11eda9..146d6ba12ff 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions
#--
-PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin
+PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
# Standard functions
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 535bf0e4a60..15b35ac7c87 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -5,6 +5,12 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999;
+#
+# In 3.23 we have to disable the test of column to bigint as
+# this fails on AIX powerpc (the resolution for double is not good enough)
+# This will work on 4.0 as we then have internal handling of bigint variables.
+#
+
drop table if exists t1;
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index c5cc73ecd1f..85553d1a2fd 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -28,3 +28,7 @@ create table t1 (num double(12,2));
insert into t1 values (144.54);
select sum(if(num is null,0.00,num)) from t1;
drop table t1;
+create table t1 (x int, y int);
+insert into t1 values (0,6),(10,16),(20,26),(30,10),(40,46),(50,56);
+select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) from t1;
+drop table t1;
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 646bedf9603..4ff1b04fc79 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -49,7 +49,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_quick.c my_lockmem.c my_static.c \
my_getopt.c my_mkdir.c \
default.c my_compress.c checksum.c raid.cc \
- my_net.c my_semaphore.c \
+ my_net.c my_semaphore.c my_port.c \
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index f21a880350b..5044a505054 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -18,9 +18,6 @@
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
-#ifdef THREAD
-#include "my_pthread.h"
-#endif
#include <assert.h>
#if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h>
diff --git a/mysys/my_init.c b/mysys/my_init.c
index c4e6132aa9c..f47286159f7 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -20,9 +20,6 @@
#include "m_ctype.h"
#include <m_string.h>
#include <m_ctype.h>
-#ifdef THREAD
-#include <my_pthread.h>
-#endif
#ifdef HAVE_GETRUSAGE
#include <sys/resource.h>
/* extern int getrusage(int, struct rusage *); */
diff --git a/mysys/my_net.c b/mysys/my_net.c
index a4a842ac15e..be92adae353 100644
--- a/mysys/my_net.c
+++ b/mysys/my_net.c
@@ -33,11 +33,6 @@
#endif
#endif /* !defined(MSDOS) && !defined(__WIN__) */
-#ifndef THREAD
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
-
void my_inet_ntoa(struct in_addr in, char *buf)
{
char *ptr;
diff --git a/mysys/my_os2cond.c b/mysys/my_os2cond.c
index c436ad9a0e9..d930aadb2d1 100644
--- a/mysys/my_os2cond.c
+++ b/mysys/my_os2cond.c
@@ -32,8 +32,8 @@
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{
- APIRET rc = 0;
- HEV event;
+ APIRET rc = 0;
+ HEV event;
cond->waiting=0;
/* Warp3 FP29 or Warp4 FP4 or better required */
rc = DosCreateEventSem( NULL, &cond->semaphore, 0x0800, 0);
@@ -61,7 +61,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
APIRET rc;
- int rval;
+ int rval;
rval = 0;
cond->waiting++;
@@ -80,13 +80,13 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime)
+ struct timespec *abstime)
{
struct timeb curtime;
int result;
long timeout;
APIRET rc;
- int rval;
+ int rval;
_ftime(&curtime);
timeout= ((long) (abstime->ts_sec - curtime.time)*1000L +
@@ -123,13 +123,13 @@ int pthread_cond_signal(pthread_cond_t *cond)
int pthread_cond_broadcast(pthread_cond_t *cond)
{
- int i;
+ int i;
APIRET rc;
- /*
- * Enter a loop to bring all threads off the
- * condition queue:
- */
+ /*
+ * Enter a loop to bring all threads off the
+ * condition queue:
+ */
i = cond->waiting;
while (i--) rc = DosPostEventSem(cond->semaphore);
@@ -176,9 +176,9 @@ struct tm *localtime_r(const time_t *timep,struct tm *tmp)
else
{
struct tm *res=localtime(timep);
- if (!res) /* Wrong date */
+ if (!res) /* Wrong date */
{
- bzero(tmp,sizeof(*tmp)); /* Keep things safe */
+ bzero(tmp,sizeof(*tmp)); /* Keep things safe */
return 0;
}
*tmp= *res;
diff --git a/mysys/my_os2dirsrch.c b/mysys/my_os2dirsrch.c
index 36f56d3ed2e..773d6800d1e 100644
--- a/mysys/my_os2dirsrch.c
+++ b/mysys/my_os2dirsrch.c
@@ -26,10 +26,10 @@
long _findfirst( char* path, struct _finddata_t* dos_file)
{
- HDIR hdir = HDIR_CREATE;
- APIRET rc;
+ HDIR hdir = HDIR_CREATE;
+ APIRET rc;
FILEFINDBUF3 buf3;
- ULONG entries = 1;
+ ULONG entries = 1;
#ifdef _DEBUG
printf( "_findfirst path %s\n", path);
@@ -37,13 +37,13 @@ long _findfirst( char* path, struct _finddata_t* dos_file)
memset( &buf3, 0, sizeof( buf3));
rc = DosFindFirst(
- path, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
- &hdir, /* Address of the handle associated with this DosFindFirst request. */
- FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
- &buf3, /* Result buffer. */
- sizeof( buf3), /* The length, in bytes, of pfindbuf. */
- &entries, /* Pointer to the number of entries: */
- FIL_STANDARD); /* The level of file information required. */
+ path, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
+ &hdir, /* Address of the handle associated with this DosFindFirst request. */
+ FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
+ &buf3, /* Result buffer. */
+ sizeof( buf3), /* The length, in bytes, of pfindbuf. */
+ &entries, /* Pointer to the number of entries: */
+ FIL_STANDARD); /* The level of file information required. */
#ifdef _DEBUG
printf( "_findfirst rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName);
@@ -64,16 +64,16 @@ long _findfirst( char* path, struct _finddata_t* dos_file)
long _findnext( long hdir, struct _finddata_t* dos_file)
{
- APIRET rc;
+ APIRET rc;
FILEFINDBUF3 buf3;
- ULONG entries = 1;
+ ULONG entries = 1;
memset( &buf3, 0, sizeof( buf3));
rc = DosFindNext(
- hdir,
- &buf3, /* Result buffer. */
- sizeof( buf3), /* The length, in bytes, of pfindbuf. */
- &entries); /* Pointer to the number of entries: */
+ hdir,
+ &buf3, /* Result buffer. */
+ sizeof( buf3), /* The length, in bytes, of pfindbuf. */
+ &entries); /* Pointer to the number of entries: */
#ifdef _DEBUG
printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName);
@@ -93,7 +93,7 @@ long _findnext( long hdir, struct _finddata_t* dos_file)
void _findclose( long hdir)
{
- APIRET rc;
+ APIRET rc;
rc = DosFindClose( hdir);
#ifdef _DEBUG
@@ -105,8 +105,8 @@ DIR* opendir( char* path)
{
DIR* dir = (DIR*) calloc( 1, sizeof( DIR));
char buffer[260];
- APIRET rc;
- ULONG entries = 1;
+ APIRET rc;
+ ULONG entries = 1;
strcpy( buffer, path);
strcat( buffer, "*.*");
@@ -118,13 +118,13 @@ DIR* opendir( char* path)
dir->hdir = HDIR_CREATE;
memset( &dir->buf3, 0, sizeof( dir->buf3));
rc = DosFindFirst(
- buffer, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
- &dir->hdir, /* Address of the handle associated with this DosFindFirst request. */
- FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
- &dir->buf3, /* Result buffer. */
- sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
- &entries, /* Pointer to the number of entries: */
- FIL_STANDARD); /* The level of file information required. */
+ buffer, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
+ &dir->hdir, /* Address of the handle associated with this DosFindFirst request. */
+ FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
+ &dir->buf3, /* Result buffer. */
+ sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
+ &entries, /* Pointer to the number of entries: */
+ FIL_STANDARD); /* The level of file information required. */
#ifdef _DEBUG
printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName);
@@ -138,9 +138,9 @@ DIR* opendir( char* path)
struct dirent* readdir( DIR* dir)
{
- APIRET rc;
+ APIRET rc;
//FILEFINDBUF3 buf3;
- ULONG entries = 1;
+ ULONG entries = 1;
if (!dir->buf3.achName[0]) // file not found on previous query
return NULL;
@@ -151,10 +151,10 @@ struct dirent* readdir( DIR* dir)
// query next file
memset( &dir->buf3, 0, sizeof( dir->buf3));
rc = DosFindNext(
- dir->hdir,
- &dir->buf3, /* Result buffer. */
- sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
- &entries); /* Pointer to the number of entries: */
+ dir->hdir,
+ &dir->buf3, /* Result buffer. */
+ sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
+ &entries); /* Pointer to the number of entries: */
#ifdef _DEBUG
printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName);
@@ -168,7 +168,7 @@ struct dirent* readdir( DIR* dir)
int closedir (DIR *dir)
{
- APIRET rc;
+ APIRET rc;
rc = DosFindClose( dir->hdir);
#ifdef _DEBUG
diff --git a/mysys/my_os2dirsrch.h b/mysys/my_os2dirsrch.h
index 2afe0f609f1..e894d27b576 100644
--- a/mysys/my_os2dirsrch.h
+++ b/mysys/my_os2dirsrch.h
@@ -30,9 +30,9 @@ extern "C" {
struct _finddata_t
{
unsigned attrib;
- //unsigned long time_create; /* -1 for FAT file systems */
- //unsigned long time_access; /* -1 for FAT file systems */
- //unsigned long time_write;
+ //unsigned long time_create; /* -1 for FAT file systems */
+ //unsigned long time_access; /* -1 for FAT file systems */
+ //unsigned long time_write;
unsigned long size;
char name[260];
//uint16 wr_date;
@@ -42,10 +42,10 @@ struct _finddata_t
struct dirent
{
//unsigned attrib;
- //unsigned long time_create; /* -1 for FAT file systems */
- //unsigned long time_access; /* -1 for FAT file systems */
- //unsigned long time_write;
- //unsigned long size;
+ //unsigned long time_create; /* -1 for FAT file systems */
+ //unsigned long time_access; /* -1 for FAT file systems */
+ //unsigned long time_write;
+ //unsigned long size;
char d_name[260];
//uint16 wr_date;
//uint16 wr_time;
@@ -66,9 +66,9 @@ int closedir (DIR *);
//#define _A_SUBDIR FILE_DIRECTORY
//#define _A_RDONLY FILE_READONLY
-//long _findfirst( char*, struct _finddata_t*);
-//long _findnext( long, struct _finddata_t*);
-//void _findclose( long);
+//long _findfirst( char*, struct _finddata_t*);
+//long _findnext( long, struct _finddata_t*);
+//void _findclose( long);
#ifdef __cplusplus_00
}
diff --git a/mysys/my_os2dlfcn.c b/mysys/my_os2dlfcn.c
index 0b0b5518eff..9c9a6061e8d 100644
--- a/mysys/my_os2dlfcn.c
+++ b/mysys/my_os2dlfcn.c
@@ -34,7 +34,7 @@ char* dlerror( void);
void* dlsym( void* hmod, char* fn);
void dlclose( void* hmod);
-char fail[ 256];
+char fail[ 256];
void* dlopen( char* path, int flag)
{
@@ -56,7 +56,7 @@ char* dlerror( void)
void* dlsym( void* hmod, char* fn)
{
APIRET rc;
- PFN addr;
+ PFN addr;
rc = DosQueryProcAddr( (HMODULE) hmod, 0l, fn, &addr);
if (rc)
diff --git a/mysys/my_os2file64.c b/mysys/my_os2file64.c
index 2f41d344e32..bc24c92b87f 100644
--- a/mysys/my_os2file64.c
+++ b/mysys/my_os2file64.c
@@ -18,11 +18,11 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
-void _OS2errno( APIRET rc);
+void _OS2errno( APIRET rc);
longlong _lseek64( int fd, longlong offset, int seektype);
-int _lock64( int fd, int locktype, my_off_t start,
- my_off_t length, myf MyFlags);
-int _sopen64( const char *name, int oflag, int shflag, int mask);
+int _lock64( int fd, int locktype, my_off_t start,
+ my_off_t length, myf MyFlags);
+int _sopen64( const char *name, int oflag, int shflag, int mask);
//
// this class is used to define a global c++ variable, that
@@ -34,52 +34,52 @@ class File64bit
File64bit(); /* default constructor */
} initFile64bit;
-static APIRET (* APIENTRY _DosOpenL)(PCSZ pszFileName,
- PHFILE phf,
- PULONG pulAction,
- LONGLONG cbFile,
- ULONG ulAttribute,
- ULONG fsOpenFlags,
- ULONG fsOpenMode,
- PEAOP2 peaop2);
-static APIRET (* APIENTRY _DosSetFilePtrL)(HFILE hFile,
- LONGLONG ib,
- ULONG method,
- PLONGLONG ibActual);
-static APIRET (* APIENTRY _DosSetFileLocksL)(HFILE hFile,
- PFILELOCKL pflUnlock,
- PFILELOCKL pflLock,
- ULONG timeout,
- ULONG flags);
-
-#define EIO EINVAL
+static APIRET (* APIENTRY _DosOpenL)(PCSZ pszFileName,
+ PHFILE phf,
+ PULONG pulAction,
+ LONGLONG cbFile,
+ ULONG ulAttribute,
+ ULONG fsOpenFlags,
+ ULONG fsOpenMode,
+ PEAOP2 peaop2);
+static APIRET (* APIENTRY _DosSetFilePtrL)(HFILE hFile,
+ LONGLONG ib,
+ ULONG method,
+ PLONGLONG ibActual);
+static APIRET (* APIENTRY _DosSetFileLocksL)(HFILE hFile,
+ PFILELOCKL pflUnlock,
+ PFILELOCKL pflLock,
+ ULONG timeout,
+ ULONG flags);
+
+#define EIO EINVAL
#define ESPIPE EBADSEEK
static unsigned char const errno_tab[] =
{
- 0 , EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */
- EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */
+ 0 , EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */
+ EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */
EINVAL, ENOEXEC,EINVAL, EINVAL, EINVAL, /* 10..14 */
ENOENT, EBUSY, EXDEV, ENOENT, EROFS, /* 15..19 */
- EIO, EIO, EIO, EIO, EIO, /* 20..24 */
- EIO, EIO, EIO, ENOSPC, EIO, /* 25..29 */
- EIO, EIO, EACCES, EACCES, EIO, /* 30..34 */
- EIO, EIO, EIO, EIO, ENOSPC, /* 35..39 */
- EIO, EIO, EIO, EIO, EIO, /* 40..44 */
- EIO, EIO, EIO, EIO, EIO, /* 45..49 */
- EIO, EIO, EIO, EIO, EBUSY, /* 50..54 */
- EIO, EIO, EIO, EIO, EIO, /* 55..59 */
- EIO, ENOSPC, ENOSPC, EIO, EIO, /* 60..64 */
- EACCES, EIO, EIO, EIO, EIO, /* 65..69 */
- EIO, EIO, EIO, EROFS, EIO, /* 70..74 */
- EIO, EIO, EIO, EIO, EIO, /* 75..79 */
- EEXIST, EIO, ENOENT, EIO, EIO, /* 80..84 */
- EIO, EIO, EINVAL, EIO, EAGAIN, /* 85..89 */
- EIO, EIO, EIO, EIO, EIO, /* 90..94 */
- EINTR, EIO, EIO, EIO, EACCES, /* 95..99 */
+ EIO, EIO, EIO, EIO, EIO, /* 20..24 */
+ EIO, EIO, EIO, ENOSPC, EIO, /* 25..29 */
+ EIO, EIO, EACCES, EACCES, EIO, /* 30..34 */
+ EIO, EIO, EIO, EIO, ENOSPC, /* 35..39 */
+ EIO, EIO, EIO, EIO, EIO, /* 40..44 */
+ EIO, EIO, EIO, EIO, EIO, /* 45..49 */
+ EIO, EIO, EIO, EIO, EBUSY, /* 50..54 */
+ EIO, EIO, EIO, EIO, EIO, /* 55..59 */
+ EIO, ENOSPC, ENOSPC, EIO, EIO, /* 60..64 */
+ EACCES, EIO, EIO, EIO, EIO, /* 65..69 */
+ EIO, EIO, EIO, EROFS, EIO, /* 70..74 */
+ EIO, EIO, EIO, EIO, EIO, /* 75..79 */
+ EEXIST, EIO, ENOENT, EIO, EIO, /* 80..84 */
+ EIO, EIO, EINVAL, EIO, EAGAIN, /* 85..89 */
+ EIO, EIO, EIO, EIO, EIO, /* 90..94 */
+ EINTR, EIO, EIO, EIO, EACCES, /* 95..99 */
ENOMEM, EINVAL, EINVAL, ENOMEM, EINVAL, /* 100..104 */
- EINVAL, ENOMEM, EIO, EACCES, EPIPE, /* 105..109 */
+ EINVAL, ENOMEM, EIO, EACCES, EPIPE, /* 105..109 */
ENOENT, E2BIG, ENOSPC, ENOMEM, EBADF, /* 110..114 */
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 115..119 */
EINVAL, EINVAL, EINVAL, ENOENT, EINVAL, /* 120..124 */
@@ -121,16 +121,16 @@ static unsigned char const errno_tab[] =
EINVAL, EBUSY, EINVAL, ESRCH, EINVAL, /* 300..304 */
ESRCH, EINVAL, EINVAL, EINVAL, ESRCH, /* 305..309 */
EINVAL, ENOMEM, EINVAL, EINVAL, EINVAL, /* 310..314 */
- EINVAL, E2BIG, ENOENT, EIO, EIO, /* 315..319 */
+ EINVAL, E2BIG, ENOENT, EIO, EIO, /* 315..319 */
EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 320..324 */
- EINVAL, EINVAL, EINVAL, EIO, ENOENT, /* 325..329 */
+ EINVAL, EINVAL, EINVAL, EIO, ENOENT, /* 325..329 */
EACCES, EACCES, EACCES, ENOENT, ENOMEM /* 330..334 */
};
/*
* Initialize 64bit file access: dynamic load of WSeB API
*/
- File64bit :: File64bit()
+ File64bit :: File64bit()
{
HMODULE hDoscalls;
@@ -156,7 +156,7 @@ static unsigned char const errno_tab[] =
#endif
}
-void _OS2errno( APIRET rc)
+void _OS2errno( APIRET rc)
{
if (rc >= sizeof (errno_tab))
errno = EINVAL;
@@ -187,19 +187,19 @@ longlong _lseek64( int fd, longlong offset, int seektype)
}
inline _SetFileLocksL(HFILE hFile,
- PFILELOCKL pflUnlock,
- PFILELOCKL pflLock,
- ULONG timeout,
- ULONG flags)
+ PFILELOCKL pflUnlock,
+ PFILELOCKL pflLock,
+ ULONG timeout,
+ ULONG flags)
{
if (_DosSetFileLocksL) {
APIRET rc;
rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags);
- // on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that
+ // on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that
// only JFS can handle >2GB ranges.
if (rc != 87)
- return rc;
+ return rc;
// got INVALID_PARAMETER, fallback to standard call
}
@@ -209,8 +209,8 @@ inline _SetFileLocksL(HFILE hFile,
return DosSetFileLocks( hFile, &flUnlock, &flLock, timeout, flags);
}
-int _lock64( int fd, int locktype, my_off_t start,
- my_off_t length, myf MyFlags)
+int _lock64( int fd, int locktype, my_off_t start,
+ my_off_t length, myf MyFlags)
{
FILELOCKL LockArea = {0,0}, UnlockArea = {0,0};
ULONG readonly = 0;
@@ -241,16 +241,16 @@ int _lock64( int fd, int locktype, my_off_t start,
//printf( "fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc);
if (rc == 33) { /* Lock Violation */
- DBUG_PRINT("info",("Was locked, trying with timeout"));
- rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly);
- //printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc);
+ DBUG_PRINT("info",("Was locked, trying with timeout"));
+ rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly);
+ //printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc);
}
} else {
while( rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) && (rc == 33)) {
- printf(".");
- DosSleep(1 * 1000);
+ printf(".");
+ DosSleep(1 * 1000);
}
//printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc);
}
@@ -264,9 +264,9 @@ int _lock64( int fd, int locktype, my_off_t start,
return(-1);
}
-int sopen( const char *name, int oflag, int shflag, int mask)
+int sopen( const char *name, int oflag, int shflag, int mask)
{
- int fail_errno;
+ int fail_errno;
APIRET rc = 0;
HFILE hf = 0;
ULONG ulAction = 0;
@@ -289,18 +289,18 @@ int sopen( const char *name, int oflag, int shflag, int mask)
{
if (oflag & O_EXCL)
{
- fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- fail_errno = EEXIST;
+ fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ fail_errno = EEXIST;
}
else if (oflag & O_TRUNC)
- fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
else
- fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
if (mask & S_IWRITE)
- ulAttribute = FILE_NORMAL;
+ ulAttribute = FILE_NORMAL;
else
- ulAttribute = FILE_READONLY;
+ ulAttribute = FILE_READONLY;
}
else if (oflag & O_TRUNC)
@@ -311,10 +311,10 @@ int sopen( const char *name, int oflag, int shflag, int mask)
/* Try to open the file and handle errors. */
if (_DosOpenL)
rc = _DosOpenL( name, &hf, &ulAction, cbFile,
- ulAttribute, fsOpenFlags, fsOpenMode, NULL);
+ ulAttribute, fsOpenFlags, fsOpenMode, NULL);
else
rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile,
- ulAttribute, fsOpenFlags, fsOpenMode, NULL);
+ ulAttribute, fsOpenFlags, fsOpenMode, NULL);
if (rc == ERROR_OPEN_FAILED)
{
@@ -334,7 +334,7 @@ int sopen( const char *name, int oflag, int shflag, int mask)
return hf;
}
-int read( int fd, void *buffer, unsigned int count)
+int read( int fd, void *buffer, unsigned int count)
{
APIRET rc;
ULONG actual;
@@ -350,7 +350,7 @@ int read( int fd, void *buffer, unsigned int count)
return(-1);
}
-int write( int fd, const void *buffer, unsigned int count)
+int write( int fd, const void *buffer, unsigned int count)
{
APIRET rc;
ULONG actual;
@@ -366,7 +366,7 @@ int write( int fd, const void *buffer, unsigned int count)
return(-1);
}
-int close( int fd)
+int close( int fd)
{
APIRET rc;
ULONG actual;
diff --git a/mysys/my_os2mutex.c b/mysys/my_os2mutex.c
index 0ae6ae86d8c..718aa9f2932 100644
--- a/mysys/my_os2mutex.c
+++ b/mysys/my_os2mutex.c
@@ -72,8 +72,8 @@ pthread_mutex_destroy(pthread_mutex_t * mutex)
int
pthread_mutex_lock(pthread_mutex_t * mutex)
{
- int ret = 0;
- int status = 0;
+ int ret = 0;
+ int status = 0;
APIRET rc = 0;
rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
@@ -86,9 +86,9 @@ pthread_mutex_lock(pthread_mutex_t * mutex)
int
pthread_mutex_unlock(pthread_mutex_t * mutex)
{
- int ret = 0;
+ int ret = 0;
APIRET rc = 0;
- int status;
+ int status;
rc = DosReleaseMutexSem(*mutex);
diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c
index 89a3311c10b..6f196f43d75 100644
--- a/mysys/my_os2thread.c
+++ b/mysys/my_os2thread.c
@@ -31,9 +31,9 @@ static pthread_mutex_t THR_LOCK_thread;
struct pthread_map
{
- HANDLE pthreadself;
+ HANDLE pthreadself;
pthread_handler func;
- void * param;
+ void * param;
};
void win_pthread_init(void)
@@ -57,7 +57,7 @@ static pthread_handler_decl(pthread_start,param)
pthread_handler func=((struct pthread_map *) param)->func;
void *func_param=((struct pthread_map *) param)->param;
my_thread_init(); /* Will always succeed in windows */
- pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
+ pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
win_pthread_self=((struct pthread_map *) param)->pthreadself;
pthread_mutex_unlock(&THR_LOCK_thread);
free((char*) param); /* Free param from create */
diff --git a/mysys/my_os2tls.c b/mysys/my_os2tls.c
index 25d543d0768..1598fa34e2b 100644
--- a/mysys/my_os2tls.c
+++ b/mysys/my_os2tls.c
@@ -18,23 +18,23 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
-DWORD TlsAlloc( void);
-BOOL TlsFree( DWORD);
-PVOID TlsGetValue( DWORD);
-BOOL TlsSetValue( DWORD, PVOID);
+DWORD TlsAlloc( void);
+BOOL TlsFree( DWORD);
+PVOID TlsGetValue( DWORD);
+BOOL TlsSetValue( DWORD, PVOID);
-#define TLS_MINIMUM_AVAILABLE 64
+#define TLS_MINIMUM_AVAILABLE 64
-PULONG tls_storage; /* TLS local storage */
-DWORD tls_bits[2]; /* TLS in-use bits */
-pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */
+PULONG tls_storage; /* TLS local storage */
+DWORD tls_bits[2]; /* TLS in-use bits */
+pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */
-DWORD TlsAlloc( void)
+DWORD TlsAlloc( void)
{
DWORD index = -1;
DWORD mask, tibidx;
- int i;
+ int i;
if (tls_storage == NULL) {
@@ -43,12 +43,12 @@ DWORD TlsAlloc( void)
// allocate memory for TLS storage
rc = DosAllocThreadLocalMemory( 1, &tls_storage);
if (rc) {
- fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n", rc);
+ fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n", rc);
}
// create a mutex
if (pthread_mutex_init( &tls_mutex, NULL))
- fprintf( stderr, "Failed to init TLS mutex\n");
+ fprintf( stderr, "Failed to init TLS mutex\n");
}
pthread_mutex_lock( &tls_mutex);
@@ -56,18 +56,18 @@ DWORD TlsAlloc( void)
tibidx = 0;
if (tls_bits[0] == 0xFFFFFFFF) {
if (tls_bits[1] == 0xFFFFFFFF) {
- fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid);
- pthread_mutex_unlock( &tls_mutex);
- return -1;
+ fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid);
+ pthread_mutex_unlock( &tls_mutex);
+ return -1;
}
tibidx = 1;
}
for( i=0; i<32; i++) {
mask = (1 << i);
if ((tls_bits[ tibidx] & mask) == 0) {
- tls_bits[ tibidx] |= mask;
- index = (tibidx*32) + i;
- break;
+ tls_bits[ tibidx] |= mask;
+ index = (tibidx*32) + i;
+ break;
}
}
tls_storage[index] = 0;
@@ -79,9 +79,9 @@ DWORD TlsAlloc( void)
return index;
}
-BOOL TlsFree( DWORD index)
+BOOL TlsFree( DWORD index)
{
- int tlsidx;
+ int tlsidx;
DWORD mask;
if (index >= TLS_MINIMUM_AVAILABLE)
@@ -106,7 +106,7 @@ BOOL TlsFree( DWORD index)
}
-PVOID TlsGetValue( DWORD index)
+PVOID TlsGetValue( DWORD index)
{
if (index >= TLS_MINIMUM_AVAILABLE)
return NULL;
@@ -122,7 +122,7 @@ PVOID TlsGetValue( DWORD index)
return (PVOID) tls_array[ index];
}
-BOOL TlsSetValue( DWORD index, PVOID val)
+BOOL TlsSetValue( DWORD index, PVOID val)
{
// verify if memory has been allocated for this thread
diff --git a/mysys/my_port.c b/mysys/my_port.c
new file mode 100644
index 00000000000..a9778875850
--- /dev/null
+++ b/mysys/my_port.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA */
+
+/*
+ Small functions to make code portable
+*/
+
+#include "mysys_priv.h"
+
+#ifdef _AIX
+
+/*
+ On AIX, at least with gcc 3.1, the expression
+ '(double) (ulonglong) var' doesn't always work for big unsigned
+ integers like '18446744073709551615'. The end result is that the
+ high bit is simply dropped. (probably bug in gcc optimizations)
+ Handling the conversion in a sub function seems to work.
+*/
+
+
+
+double my_longlong2double(unsigned long long nr)
+{
+ return (double) nr;
+}
+#endif /* _AIX */
diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h
index ba16e8820fe..75d77ed9987 100644
--- a/mysys/mysys_priv.h
+++ b/mysys/mysys_priv.h
@@ -22,10 +22,10 @@
#endif
#ifdef THREAD
+#include <my_pthread.h>
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
extern pthread_mutex_t LOCK_bitmap;
-#else /* THREAD */
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
+#else
+#include <my_no_pthread.h>
#endif
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index f1f70b5c4ac..29db2b997a0 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -17,7 +17,6 @@
/* Synchronization - readers / writer thread locks */
#include "mysys_priv.h"
-#include <my_pthread.h>
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
#include <errno.h>
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 5d7d083ef91..bd03e9cffd3 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -19,7 +19,7 @@
/* TODO list for the InnoDB handler:
- Ask Monty if strings of different languages can exist in the same
- database. Answer: in near future yes, but not yet.
+ database. Answer: in 4.1 yes.
*/
#ifdef __GNUC__
@@ -308,6 +308,8 @@ innobase_mysql_print_thd(
}
buf[0]='\n';
buf[1]=0;
+
+ ut_a(strlen(old_buf) < 400);
}
}
@@ -393,6 +395,61 @@ ha_innobase::update_thd(
return(0);
}
+/*********************************************************************
+Call this when you have opened a new table handle in HANDLER, before you
+call index_read_idx() etc. Actually, we can let the cursor stay open even
+over a transaction commit! Then you should call this before every operation,
+fecth next etc. This function inits the necessary things even after a
+transaction commit. */
+
+/* TODO: THIS CODE HAS NOT BEEN TESTED!!! */
+
+void
+ha_innobase::init_table_handle_for_HANDLER(void)
+/*============================================*/
+{
+ row_prebuilt_t* prebuilt;
+
+ /* If current thd does not yet have a trx struct, create one.
+ If the current handle does not yet have a prebuilt struct, create
+ one. Update the trx pointers in the prebuilt struct. Normally
+ this operation is done in external_lock. */
+
+ update_thd(current_thd);
+
+ /* Initialize the prebuilt struct much like it would be inited in
+ external_lock */
+
+ prebuilt = (row_prebuilt_t*)innobase_prebuilt;
+
+ /* If the transaction is not started yet, start it */
+
+ trx_start_if_not_started_noninline(prebuilt->trx);
+
+ /* Assign a read view if the transaction does not have it yet */
+
+ trx_assign_read_view(prebuilt->trx);
+
+ /* We did the necessary inits in this function, no need to repeat them
+ in row_search_for_mysql */
+
+ prebuilt->sql_stat_start = FALSE;
+
+ /* We let HANDLER always to do the reads as consistent reads, even
+ if the trx isolation level would have been specified as SERIALIZABLE */
+
+ prebuilt->select_lock_type = LOCK_NONE;
+
+ /* Always fetch all columns in the index record */
+
+ prebuilt->hint_no_need_to_fetch_extra_cols = FALSE;
+
+ /* We want always to fetch all columns in the whole row? Or do
+ we???? */
+
+ prebuilt->read_just_key = FALSE;
+}
+
/*************************************************************************
Opens an InnoDB database. */
@@ -3460,8 +3517,10 @@ innodb_show_status(
DBUG_ENTER("innodb_show_status");
- /* We let the InnoDB Monitor to output at most 100 kB of text */
- buf = (char*)ut_malloc(100 * 1024);
+ /* We let the InnoDB Monitor to output at most 100 kB of text, add
+ a safety margin of 10 kB for buffer overruns */
+
+ buf = (char*)ut_malloc(110 * 1024);
srv_sprintf_innodb_monitor(buf, 100 * 1024);
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 3d5db845fc6..cac00a2d83c 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -164,6 +164,7 @@ class ha_innobase: public handler
void free_foreign_key_create_info(char* str);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
+ void init_table_handle_for_HANDLER(); /* TODO: NOT TESTED!!! */
longlong get_auto_increment();
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 19d64812f34..6391e61cb77 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -501,12 +501,12 @@ Item_func_if::fix_length_and_dec()
if (null1)
{
cached_result_type= arg2_type;
- binary= args[1]->binary;
+ binary= args[2]->binary;
}
else if (null2)
{
- cached_result_type= arg2_type;
- binary= args[2]->binary;
+ cached_result_type= arg1_type;
+ binary= args[1]->binary;
}
else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
{
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3b998d61207..863ee5912c8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -646,29 +646,45 @@ static void close_server_sock()
if (tmp_sock != INVALID_SOCKET)
{
ip_sock=INVALID_SOCKET;
- DBUG_PRINT("info",("closing TCP/IP socket"));
+ DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
VOID(shutdown(tmp_sock,2));
+#ifdef NOT_USED
+ /*
+ The following code is disabled as it causes MySQL to hang on
+ AIX 4.3 during shutdown
+ */
+ DBUG_PRINT("info",("calling closesocket on TCP/IP socket"));
VOID(closesocket(tmp_sock));
+#endif
}
tmp_sock=unix_sock;
if (tmp_sock != INVALID_SOCKET)
{
unix_sock=INVALID_SOCKET;
- DBUG_PRINT("info",("closing Unix socket"));
+ DBUG_PRINT("info",("calling shutdown on unix socket"));
VOID(shutdown(tmp_sock,2));
+#ifdef NOT_USED
+ /*
+ The following code is disabled as it may cause MySQL to hang on
+ AIX 4.3 during shutdown (not tested, but likely)
+ */
+ DBUG_PRINT("info",("calling closesocket on unix/IP socket"));
VOID(closesocket(tmp_sock));
+#endif
VOID(unlink(mysql_unix_port));
}
DBUG_VOID_RETURN;
#endif
}
+
void kill_mysql(void)
{
DBUG_ENTER("kill_mysql");
#ifdef SIGNALS_DONT_BREAK_READ
- close_server_sock(); /* force accept to wake up */
+ abort_loop=1; // Break connection loops
+ close_server_sock(); // Force accept to wake up
#endif
#if defined(__WIN__)
@@ -699,7 +715,7 @@ void kill_mysql(void)
DBUG_PRINT("quit",("After pthread_kill"));
shutdown_in_progress=1; // Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
- if (!abort_loop)
+ if (!kill_in_progress)
{
pthread_t tmp;
abort_loop=1;
@@ -1273,7 +1289,7 @@ static void sig_reload(int signo)
static void sig_kill(int signo)
{
- if (!abort_loop)
+ if (!kill_in_progress)
{
abort_loop=1; // mark abort for threads
kill_server((void*) signo);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index e7a85c8262a..156078b9663 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -345,7 +345,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
else
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
thd->cuted_fields);
- ::send_ok(&thd->net,info.copied+info.deleted,0L,buff);
+ ::send_ok(&thd->net,info.copied+info.deleted,(ulonglong)id,buff);
}
DBUG_RETURN(0);