Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d825808a
Commit
d825808a
authored
Aug 12, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
1239863b
b779b638
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
270 additions
and
220 deletions
+270
-220
Docs/manual.texi
Docs/manual.texi
+3
-2
include/global.h
include/global.h
+2
-0
include/my_no_pthread.h
include/my_no_pthread.h
+1
-1
libmysql/Makefile.shared
libmysql/Makefile.shared
+1
-1
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+1
-1
mysql-test/r/bigint.result
mysql-test/r/bigint.result
+2
-0
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+1
-1
mysql-test/t/bigint.test
mysql-test/t/bigint.test
+7
-1
mysys/Makefile.am
mysys/Makefile.am
+1
-1
mysys/my_gethostbyname.c
mysys/my_gethostbyname.c
+0
-6
mysys/my_init.c
mysys/my_init.c
+0
-3
mysys/my_net.c
mysys/my_net.c
+0
-5
mysys/my_os2cond.c
mysys/my_os2cond.c
+12
-12
mysys/my_os2dirsrch.c
mysys/my_os2dirsrch.c
+33
-33
mysys/my_os2dirsrch.h
mysys/my_os2dirsrch.h
+10
-10
mysys/my_os2dlfcn.c
mysys/my_os2dlfcn.c
+2
-2
mysys/my_os2file64.c
mysys/my_os2file64.c
+72
-72
mysys/my_os2mutex.c
mysys/my_os2mutex.c
+4
-4
mysys/my_os2thread.c
mysys/my_os2thread.c
+3
-3
mysys/my_os2tls.c
mysys/my_os2tls.c
+22
-22
mysys/my_port.c
mysys/my_port.c
+40
-0
mysys/mysys_priv.h
mysys/mysys_priv.h
+3
-3
mysys/thr_rwlock.c
mysys/thr_rwlock.c
+0
-1
sql/ha_innobase.cc
sql/ha_innobase.cc
+32
-21
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-6
sql/mysqld.cc
sql/mysqld.cc
+17
-9
No files found.
Docs/manual.texi
View file @
d825808a
...
@@ -46928,9 +46928,10 @@ not yet 100% confident in this code.
...
@@ -46928,9 +46928,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.52
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
@itemize @bullet
@item
@item
Changed behaviour that @code{IF(condition,column,NULL)} returns column type
Fixed problem with @code{UNSIGNED BIGINT} on AIX.
@item
@item
Fixed a security bug with empty db column in db table
Fixed security bug when having an empty databasename in the @code{user.db}
table.
@item
@item
Changed initialisation of @code{RND()} to make it less predicatable.
Changed initialisation of @code{RND()} to make it less predicatable.
@item
@item
include/global.h
View file @
d825808a
...
@@ -104,6 +104,8 @@
...
@@ -104,6 +104,8 @@
#define _H_STRINGS
#define _H_STRINGS
#define _SYS_STREAM_H
#define _SYS_STREAM_H
#define _AIX32_CURSES
#define _AIX32_CURSES
#define longlong2double(A) my_longlong2double(A)
double
my_longlong2double
(
unsigned
long
long
A
);
#endif
#endif
#ifdef HAVE_BROKEN_SNPRINTF
/* HPUX 10.20 don't have this defined */
#ifdef HAVE_BROKEN_SNPRINTF
/* HPUX 10.20 don't have this defined */
...
...
include/my_no_pthread.h
View file @
d825808a
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
environment, easier to use.
environment, easier to use.
*/
*/
#if !defined(_my_no_pthread_h) && !defined(THREAD
S
)
#if !defined(_my_no_pthread_h) && !defined(THREAD)
#define _my_no_pthread_h
#define _my_no_pthread_h
#define pthread_mutex_init(A,B)
#define pthread_mutex_init(A,B)
...
...
libmysql/Makefile.shared
View file @
d825808a
...
@@ -57,7 +57,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
...
@@ -57,7 +57,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
thr_mutex.lo mulalloc.lo string.lo default.lo
\
thr_mutex.lo mulalloc.lo string.lo default.lo
\
my_compress.lo array.lo my_once.lo list.lo my_net.lo
\
my_compress.lo array.lo my_once.lo list.lo my_net.lo
\
charset.lo hash.lo mf_iocache.lo my_seek.lo
\
charset.lo hash.lo mf_iocache.lo my_seek.lo
\
my_pread.lo mf_cache.lo my_gethostbyname.lo
my_pread.lo mf_cache.lo my_gethostbyname.lo
my_port.lo
# Not needed in the minimum library
# Not needed in the minimum library
mysysobjects2
=
getopt.lo getopt1.lo getvar.lo my_lib.lo
mysysobjects2
=
getopt.lo getopt1.lo getvar.lo my_lib.lo
mysysobjects
=
$(mysysobjects1)
$(mysysobjects2)
mysysobjects
=
$(mysysobjects1)
$(mysysobjects2)
...
...
mysql-test/mysql-test-run.sh
View file @
d825808a
...
@@ -18,7 +18,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
...
@@ -18,7 +18,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions
# Program Definitions
#--
#--
PATH
=
/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin
PATH
=
/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin
:/usr/bin/X11
# Standard functions
# Standard functions
...
...
mysql-test/r/bigint.result
View file @
d825808a
...
@@ -10,4 +10,6 @@ a
...
@@ -10,4 +10,6 @@ a
a
a
18446744073709551615
18446744073709551615
a
a
18446744073709551615
a
18446744073709551614
18446744073709551614
mysql-test/r/func_if.result
View file @
d825808a
...
@@ -34,4 +34,4 @@ aaa
...
@@ -34,4 +34,4 @@ aaa
sum(if(num is null,0.00,num))
sum(if(num is null,0.00,num))
144.54
144.54
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
6 5
6
16
6
mysql-test/t/bigint.test
View file @
d825808a
...
@@ -5,12 +5,18 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
...
@@ -5,12 +5,18 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
select
9223372036854775807
,
-
00
9223372036854775808
;
select
9223372036854775807
,
-
00
9223372036854775808
;
select
+
9999999999999999999
,
-
9999999999999999999
;
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
;
drop
table
if
exists
t1
;
create
table
t1
(
a
bigint
unsigned
not
null
,
primary
key
(
a
));
create
table
t1
(
a
bigint
unsigned
not
null
,
primary
key
(
a
));
insert
into
t1
values
(
18446744073709551615
),
(
0xFFFFFFFFFFFFFFFE
);
insert
into
t1
values
(
18446744073709551615
),
(
0xFFFFFFFFFFFFFFFE
);
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t1
where
a
=
18446744073709551615
;
select
*
from
t1
where
a
=
18446744073709551615
;
#
select * from t1 where a='18446744073709551615';
select
*
from
t1
where
a
=
'18446744073709551615'
;
delete
from
t1
where
a
=
18446744073709551615
;
delete
from
t1
where
a
=
18446744073709551615
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
mysys/Makefile.am
View file @
d825808a
...
@@ -49,7 +49,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
...
@@ -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_quick.c my_lockmem.c my_static.c
\
getopt.c getopt1.c getvar.c my_mkdir.c
\
getopt.c getopt1.c getvar.c my_mkdir.c
\
default.c my_compress.c checksum.c raid.cc raid2.c
\
default.c my_compress.c checksum.c raid.cc raid2.c
\
my_net.c
\
my_net.c
my_port.c
\
my_vsnprintf.c charset.c my_bitmap.c my_gethostbyname.c
my_vsnprintf.c charset.c my_bitmap.c my_gethostbyname.c
EXTRA_DIST
=
thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c
\
EXTRA_DIST
=
thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c
\
thr_mutex.c thr_rwlock.c
thr_mutex.c thr_rwlock.c
...
...
mysys/my_gethostbyname.c
View file @
d825808a
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
/* Thread safe version of gethostbyname_r() */
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
#include "mysys_priv.h"
#include "my_pthread.h"
#include <assert.h>
#include <assert.h>
#if !defined(MSDOS) && !defined(__WIN__)
#if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h>
#include <netdb.h>
...
@@ -28,11 +27,6 @@
...
@@ -28,11 +27,6 @@
/* This file is not needed if my_gethostbyname_r is a macro */
/* This file is not needed if my_gethostbyname_r is a macro */
#if !defined(my_gethostbyname_r)
#if !defined(my_gethostbyname_r)
#ifndef THREAD
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)
#endif
/*
/*
Emulate SOLARIS style calls, not because it's better, but just to make the
Emulate SOLARIS style calls, not because it's better, but just to make the
usage of getbostbyname_r simpler.
usage of getbostbyname_r simpler.
...
...
mysys/my_init.c
View file @
d825808a
...
@@ -21,9 +21,6 @@
...
@@ -21,9 +21,6 @@
#include "m_ctype.h"
#include "m_ctype.h"
#include <m_string.h>
#include <m_string.h>
#include <m_ctype.h>
#include <m_ctype.h>
#ifdef THREAD
#include <my_pthread.h>
#endif
#ifdef HAVE_GETRUSAGE
#ifdef HAVE_GETRUSAGE
#include <sys/resource.h>
#include <sys/resource.h>
/* extern int getrusage(int, struct rusage *); */
/* extern int getrusage(int, struct rusage *); */
...
...
mysys/my_net.c
View file @
d825808a
...
@@ -34,11 +34,6 @@
...
@@ -34,11 +34,6 @@
#endif
#endif
#endif
/* !defined(MSDOS) && !defined(__WIN__) */
#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
)
void
my_inet_ntoa
(
struct
in_addr
in
,
char
*
buf
)
{
{
char
*
ptr
;
char
*
ptr
;
...
...
mysys/my_os2cond.c
View file @
d825808a
...
@@ -32,8 +32,8 @@
...
@@ -32,8 +32,8 @@
int
pthread_cond_init
(
pthread_cond_t
*
cond
,
const
pthread_condattr_t
*
attr
)
int
pthread_cond_init
(
pthread_cond_t
*
cond
,
const
pthread_condattr_t
*
attr
)
{
{
APIRET
rc
=
0
;
APIRET
rc
=
0
;
HEV
event
;
HEV
event
;
cond
->
waiting
=
0
;
cond
->
waiting
=
0
;
/* Warp3 FP29 or Warp4 FP4 or better required */
/* Warp3 FP29 or Warp4 FP4 or better required */
rc
=
DosCreateEventSem
(
NULL
,
&
cond
->
semaphore
,
0x0800
,
0
);
rc
=
DosCreateEventSem
(
NULL
,
&
cond
->
semaphore
,
0x0800
,
0
);
...
@@ -61,7 +61,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
...
@@ -61,7 +61,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
int
pthread_cond_wait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
)
int
pthread_cond_wait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
)
{
{
APIRET
rc
;
APIRET
rc
;
int
rval
;
int
rval
;
rval
=
0
;
rval
=
0
;
cond
->
waiting
++
;
cond
->
waiting
++
;
...
@@ -80,13 +80,13 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
...
@@ -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
,
int
pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
struct
timespec
*
abstime
)
struct
timespec
*
abstime
)
{
{
struct
timeb
curtime
;
struct
timeb
curtime
;
int
result
;
int
result
;
long
timeout
;
long
timeout
;
APIRET
rc
;
APIRET
rc
;
int
rval
;
int
rval
;
_ftime
(
&
curtime
);
_ftime
(
&
curtime
);
timeout
=
((
long
)
(
abstime
->
ts_sec
-
curtime
.
time
)
*
1000L
+
timeout
=
((
long
)
(
abstime
->
ts_sec
-
curtime
.
time
)
*
1000L
+
...
@@ -123,13 +123,13 @@ int pthread_cond_signal(pthread_cond_t *cond)
...
@@ -123,13 +123,13 @@ int pthread_cond_signal(pthread_cond_t *cond)
int
pthread_cond_broadcast
(
pthread_cond_t
*
cond
)
int
pthread_cond_broadcast
(
pthread_cond_t
*
cond
)
{
{
int
i
;
int
i
;
APIRET
rc
;
APIRET
rc
;
/*
/*
* Enter a loop to bring all threads off the
* Enter a loop to bring all threads off the
* condition queue:
* condition queue:
*/
*/
i
=
cond
->
waiting
;
i
=
cond
->
waiting
;
while
(
i
--
)
rc
=
DosPostEventSem
(
cond
->
semaphore
);
while
(
i
--
)
rc
=
DosPostEventSem
(
cond
->
semaphore
);
...
@@ -176,9 +176,9 @@ struct tm *localtime_r(const time_t *timep,struct tm *tmp)
...
@@ -176,9 +176,9 @@ struct tm *localtime_r(const time_t *timep,struct tm *tmp)
else
else
{
{
struct
tm
*
res
=
localtime
(
timep
);
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
;
return
0
;
}
}
*
tmp
=
*
res
;
*
tmp
=
*
res
;
...
...
mysys/my_os2dirsrch.c
View file @
d825808a
...
@@ -26,10 +26,10 @@
...
@@ -26,10 +26,10 @@
long
_findfirst
(
char
*
path
,
struct
_finddata_t
*
dos_file
)
long
_findfirst
(
char
*
path
,
struct
_finddata_t
*
dos_file
)
{
{
HDIR
hdir
=
HDIR_CREATE
;
HDIR
hdir
=
HDIR_CREATE
;
APIRET
rc
;
APIRET
rc
;
FILEFINDBUF3
buf3
;
FILEFINDBUF3
buf3
;
ULONG
entries
=
1
;
ULONG
entries
=
1
;
#ifdef _DEBUG
#ifdef _DEBUG
printf
(
"_findfirst path %s
\n
"
,
path
);
printf
(
"_findfirst path %s
\n
"
,
path
);
...
@@ -37,13 +37,13 @@ long _findfirst( char* path, struct _finddata_t* dos_file)
...
@@ -37,13 +37,13 @@ long _findfirst( char* path, struct _finddata_t* dos_file)
memset
(
&
buf3
,
0
,
sizeof
(
buf3
));
memset
(
&
buf3
,
0
,
sizeof
(
buf3
));
rc
=
DosFindFirst
(
rc
=
DosFindFirst
(
path
,
/* Address of the ASCIIZ path name of the file or subdirectory to be found. */
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. */
&
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. */
FILE_NORMAL
|
FILE_DIRECTORY
,
/* Attribute value that determines the file objects to be searched for. */
&
buf3
,
/* Result buffer. */
&
buf3
,
/* Result buffer. */
sizeof
(
buf3
),
/* The length, in bytes, of pfindbuf. */
sizeof
(
buf3
),
/* The length, in bytes, of pfindbuf. */
&
entries
,
/* Pointer to the number of entries: */
&
entries
,
/* Pointer to the number of entries: */
FIL_STANDARD
);
/* The level of file information required. */
FIL_STANDARD
);
/* The level of file information required. */
#ifdef _DEBUG
#ifdef _DEBUG
printf
(
"_findfirst rc=%d hdir=%d entries=%d->%s
\n
"
,
rc
,
hdir
,
entries
,
buf3
.
achName
);
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)
...
@@ -64,16 +64,16 @@ long _findfirst( char* path, struct _finddata_t* dos_file)
long
_findnext
(
long
hdir
,
struct
_finddata_t
*
dos_file
)
long
_findnext
(
long
hdir
,
struct
_finddata_t
*
dos_file
)
{
{
APIRET
rc
;
APIRET
rc
;
FILEFINDBUF3
buf3
;
FILEFINDBUF3
buf3
;
ULONG
entries
=
1
;
ULONG
entries
=
1
;
memset
(
&
buf3
,
0
,
sizeof
(
buf3
));
memset
(
&
buf3
,
0
,
sizeof
(
buf3
));
rc
=
DosFindNext
(
rc
=
DosFindNext
(
hdir
,
hdir
,
&
buf3
,
/* Result buffer. */
&
buf3
,
/* Result buffer. */
sizeof
(
buf3
),
/* The length, in bytes, of pfindbuf. */
sizeof
(
buf3
),
/* The length, in bytes, of pfindbuf. */
&
entries
);
/* Pointer to the number of entries: */
&
entries
);
/* Pointer to the number of entries: */
#ifdef _DEBUG
#ifdef _DEBUG
printf
(
"_findnext rc=%d hdir=%d entries=%d->%s
\n
"
,
rc
,
hdir
,
entries
,
buf3
.
achName
);
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)
...
@@ -93,7 +93,7 @@ long _findnext( long hdir, struct _finddata_t* dos_file)
void
_findclose
(
long
hdir
)
void
_findclose
(
long
hdir
)
{
{
APIRET
rc
;
APIRET
rc
;
rc
=
DosFindClose
(
hdir
);
rc
=
DosFindClose
(
hdir
);
#ifdef _DEBUG
#ifdef _DEBUG
...
@@ -105,8 +105,8 @@ DIR* opendir( char* path)
...
@@ -105,8 +105,8 @@ DIR* opendir( char* path)
{
{
DIR
*
dir
=
(
DIR
*
)
calloc
(
1
,
sizeof
(
DIR
));
DIR
*
dir
=
(
DIR
*
)
calloc
(
1
,
sizeof
(
DIR
));
char
buffer
[
260
];
char
buffer
[
260
];
APIRET
rc
;
APIRET
rc
;
ULONG
entries
=
1
;
ULONG
entries
=
1
;
strcpy
(
buffer
,
path
);
strcpy
(
buffer
,
path
);
strcat
(
buffer
,
"*.*"
);
strcat
(
buffer
,
"*.*"
);
...
@@ -118,13 +118,13 @@ DIR* opendir( char* path)
...
@@ -118,13 +118,13 @@ DIR* opendir( char* path)
dir
->
hdir
=
HDIR_CREATE
;
dir
->
hdir
=
HDIR_CREATE
;
memset
(
&
dir
->
buf3
,
0
,
sizeof
(
dir
->
buf3
));
memset
(
&
dir
->
buf3
,
0
,
sizeof
(
dir
->
buf3
));
rc
=
DosFindFirst
(
rc
=
DosFindFirst
(
buffer
,
/* Address of the ASCIIZ path name of the file or subdirectory to be found. */
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. */
&
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. */
FILE_NORMAL
|
FILE_DIRECTORY
,
/* Attribute value that determines the file objects to be searched for. */
&
dir
->
buf3
,
/* Result buffer. */
&
dir
->
buf3
,
/* Result buffer. */
sizeof
(
dir
->
buf3
),
/* The length, in bytes, of pfindbuf. */
sizeof
(
dir
->
buf3
),
/* The length, in bytes, of pfindbuf. */
&
entries
,
/* Pointer to the number of entries: */
&
entries
,
/* Pointer to the number of entries: */
FIL_STANDARD
);
/* The level of file information required. */
FIL_STANDARD
);
/* The level of file information required. */
#ifdef _DEBUG
#ifdef _DEBUG
printf
(
"opendir rc=%d hdir=%d entries=%d->%s
\n
"
,
rc
,
dir
->
hdir
,
entries
,
dir
->
buf3
.
achName
);
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)
...
@@ -138,9 +138,9 @@ DIR* opendir( char* path)
struct
dirent
*
readdir
(
DIR
*
dir
)
struct
dirent
*
readdir
(
DIR
*
dir
)
{
{
APIRET
rc
;
APIRET
rc
;
//FILEFINDBUF3 buf3;
//FILEFINDBUF3 buf3;
ULONG
entries
=
1
;
ULONG
entries
=
1
;
if
(
!
dir
->
buf3
.
achName
[
0
])
// file not found on previous query
if
(
!
dir
->
buf3
.
achName
[
0
])
// file not found on previous query
return
NULL
;
return
NULL
;
...
@@ -151,10 +151,10 @@ struct dirent* readdir( DIR* dir)
...
@@ -151,10 +151,10 @@ struct dirent* readdir( DIR* dir)
// query next file
// query next file
memset
(
&
dir
->
buf3
,
0
,
sizeof
(
dir
->
buf3
));
memset
(
&
dir
->
buf3
,
0
,
sizeof
(
dir
->
buf3
));
rc
=
DosFindNext
(
rc
=
DosFindNext
(
dir
->
hdir
,
dir
->
hdir
,
&
dir
->
buf3
,
/* Result buffer. */
&
dir
->
buf3
,
/* Result buffer. */
sizeof
(
dir
->
buf3
),
/* The length, in bytes, of pfindbuf. */
sizeof
(
dir
->
buf3
),
/* The length, in bytes, of pfindbuf. */
&
entries
);
/* Pointer to the number of entries: */
&
entries
);
/* Pointer to the number of entries: */
#ifdef _DEBUG
#ifdef _DEBUG
printf
(
"_findnext rc=%d hdir=%d entries=%d->%s
\n
"
,
rc
,
dir
->
hdir
,
entries
,
dir
->
buf3
.
achName
);
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)
...
@@ -168,7 +168,7 @@ struct dirent* readdir( DIR* dir)
int
closedir
(
DIR
*
dir
)
int
closedir
(
DIR
*
dir
)
{
{
APIRET
rc
;
APIRET
rc
;
rc
=
DosFindClose
(
dir
->
hdir
);
rc
=
DosFindClose
(
dir
->
hdir
);
#ifdef _DEBUG
#ifdef _DEBUG
...
...
mysys/my_os2dirsrch.h
View file @
d825808a
...
@@ -30,9 +30,9 @@ extern "C" {
...
@@ -30,9 +30,9 @@ extern "C" {
struct
_finddata_t
struct
_finddata_t
{
{
unsigned
attrib
;
unsigned
attrib
;
//unsigned long
time_create; /* -1 for FAT file systems */
//unsigned long
time_create; /* -1 for FAT file systems */
//unsigned long
time_access; /* -1 for FAT file systems */
//unsigned long
time_access; /* -1 for FAT file systems */
//unsigned long
time_write;
//unsigned long
time_write;
unsigned
long
size
;
unsigned
long
size
;
char
name
[
260
];
char
name
[
260
];
//uint16 wr_date;
//uint16 wr_date;
...
@@ -42,10 +42,10 @@ struct _finddata_t
...
@@ -42,10 +42,10 @@ struct _finddata_t
struct
dirent
struct
dirent
{
{
//unsigned attrib;
//unsigned attrib;
//unsigned long
time_create; /* -1 for FAT file systems */
//unsigned long
time_create; /* -1 for FAT file systems */
//unsigned long
time_access; /* -1 for FAT file systems */
//unsigned long
time_access; /* -1 for FAT file systems */
//unsigned long
time_write;
//unsigned long
time_write;
//unsigned long
size;
//unsigned long
size;
char
d_name
[
260
];
char
d_name
[
260
];
//uint16 wr_date;
//uint16 wr_date;
//uint16 wr_time;
//uint16 wr_time;
...
@@ -66,9 +66,9 @@ int closedir (DIR *);
...
@@ -66,9 +66,9 @@ int closedir (DIR *);
//#define _A_SUBDIR FILE_DIRECTORY
//#define _A_SUBDIR FILE_DIRECTORY
//#define _A_RDONLY FILE_READONLY
//#define _A_RDONLY FILE_READONLY
//long
_findfirst( char*, struct _finddata_t*);
//long
_findfirst( char*, struct _finddata_t*);
//long
_findnext( long, struct _finddata_t*);
//long
_findnext( long, struct _finddata_t*);
//void
_findclose( long);
//void
_findclose( long);
#ifdef __cplusplus_00
#ifdef __cplusplus_00
}
}
...
...
mysys/my_os2dlfcn.c
View file @
d825808a
...
@@ -34,7 +34,7 @@ char* dlerror( void);
...
@@ -34,7 +34,7 @@ char* dlerror( void);
void
*
dlsym
(
void
*
hmod
,
char
*
fn
);
void
*
dlsym
(
void
*
hmod
,
char
*
fn
);
void
dlclose
(
void
*
hmod
);
void
dlclose
(
void
*
hmod
);
char
fail
[
256
];
char
fail
[
256
];
void
*
dlopen
(
char
*
path
,
int
flag
)
void
*
dlopen
(
char
*
path
,
int
flag
)
{
{
...
@@ -56,7 +56,7 @@ char* dlerror( void)
...
@@ -56,7 +56,7 @@ char* dlerror( void)
void
*
dlsym
(
void
*
hmod
,
char
*
fn
)
void
*
dlsym
(
void
*
hmod
,
char
*
fn
)
{
{
APIRET
rc
;
APIRET
rc
;
PFN
addr
;
PFN
addr
;
rc
=
DosQueryProcAddr
(
(
HMODULE
)
hmod
,
0l
,
fn
,
&
addr
);
rc
=
DosQueryProcAddr
(
(
HMODULE
)
hmod
,
0l
,
fn
,
&
addr
);
if
(
rc
)
if
(
rc
)
...
...
mysys/my_os2file64.c
View file @
d825808a
...
@@ -18,11 +18,11 @@
...
@@ -18,11 +18,11 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
MA 02111-1307, USA */
void
_OS2errno
(
APIRET
rc
);
void
_OS2errno
(
APIRET
rc
);
longlong
_lseek64
(
int
fd
,
longlong
offset
,
int
seektype
);
longlong
_lseek64
(
int
fd
,
longlong
offset
,
int
seektype
);
int
_lock64
(
int
fd
,
int
locktype
,
my_off_t
start
,
int
_lock64
(
int
fd
,
int
locktype
,
my_off_t
start
,
my_off_t
length
,
myf
MyFlags
);
my_off_t
length
,
myf
MyFlags
);
int
_sopen64
(
const
char
*
name
,
int
oflag
,
int
shflag
,
int
mask
);
int
_sopen64
(
const
char
*
name
,
int
oflag
,
int
shflag
,
int
mask
);
//
//
// this class is used to define a global c++ variable, that
// this class is used to define a global c++ variable, that
...
@@ -34,52 +34,52 @@ class File64bit
...
@@ -34,52 +34,52 @@ class File64bit
File64bit
();
/* default constructor */
File64bit
();
/* default constructor */
}
initFile64bit
;
}
initFile64bit
;
static
APIRET
(
*
APIENTRY
_DosOpenL
)(
PCSZ
pszFileName
,
static
APIRET
(
*
APIENTRY
_DosOpenL
)(
PCSZ
pszFileName
,
PHFILE
phf
,
PHFILE
phf
,
PULONG
pulAction
,
PULONG
pulAction
,
LONGLONG
cbFile
,
LONGLONG
cbFile
,
ULONG
ulAttribute
,
ULONG
ulAttribute
,
ULONG
fsOpenFlags
,
ULONG
fsOpenFlags
,
ULONG
fsOpenMode
,
ULONG
fsOpenMode
,
PEAOP2
peaop2
);
PEAOP2
peaop2
);
static
APIRET
(
*
APIENTRY
_DosSetFilePtrL
)(
HFILE
hFile
,
static
APIRET
(
*
APIENTRY
_DosSetFilePtrL
)(
HFILE
hFile
,
LONGLONG
ib
,
LONGLONG
ib
,
ULONG
method
,
ULONG
method
,
PLONGLONG
ibActual
);
PLONGLONG
ibActual
);
static
APIRET
(
*
APIENTRY
_DosSetFileLocksL
)(
HFILE
hFile
,
static
APIRET
(
*
APIENTRY
_DosSetFileLocksL
)(
HFILE
hFile
,
PFILELOCKL
pflUnlock
,
PFILELOCKL
pflUnlock
,
PFILELOCKL
pflLock
,
PFILELOCKL
pflLock
,
ULONG
timeout
,
ULONG
timeout
,
ULONG
flags
);
ULONG
flags
);
#define EIO
EINVAL
#define EIO
EINVAL
#define ESPIPE EBADSEEK
#define ESPIPE EBADSEEK
static
unsigned
char
const
errno_tab
[]
=
static
unsigned
char
const
errno_tab
[]
=
{
{
0
,
EINVAL
,
ENOENT
,
ENOENT
,
EMFILE
,
/* 0..4 */
0
,
EINVAL
,
ENOENT
,
ENOENT
,
EMFILE
,
/* 0..4 */
EACCES
,
EBADF
,
EIO
,
ENOMEM
,
EIO
,
/* 5..9 */
EACCES
,
EBADF
,
EIO
,
ENOMEM
,
EIO
,
/* 5..9 */
EINVAL
,
ENOEXEC
,
EINVAL
,
EINVAL
,
EINVAL
,
/* 10..14 */
EINVAL
,
ENOEXEC
,
EINVAL
,
EINVAL
,
EINVAL
,
/* 10..14 */
ENOENT
,
EBUSY
,
EXDEV
,
ENOENT
,
EROFS
,
/* 15..19 */
ENOENT
,
EBUSY
,
EXDEV
,
ENOENT
,
EROFS
,
/* 15..19 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 20..24 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 20..24 */
EIO
,
EIO
,
EIO
,
ENOSPC
,
EIO
,
/* 25..29 */
EIO
,
EIO
,
EIO
,
ENOSPC
,
EIO
,
/* 25..29 */
EIO
,
EIO
,
EACCES
,
EACCES
,
EIO
,
/* 30..34 */
EIO
,
EIO
,
EACCES
,
EACCES
,
EIO
,
/* 30..34 */
EIO
,
EIO
,
EIO
,
EIO
,
ENOSPC
,
/* 35..39 */
EIO
,
EIO
,
EIO
,
EIO
,
ENOSPC
,
/* 35..39 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 40..44 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 40..44 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 45..49 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 45..49 */
EIO
,
EIO
,
EIO
,
EIO
,
EBUSY
,
/* 50..54 */
EIO
,
EIO
,
EIO
,
EIO
,
EBUSY
,
/* 50..54 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 55..59 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 55..59 */
EIO
,
ENOSPC
,
ENOSPC
,
EIO
,
EIO
,
/* 60..64 */
EIO
,
ENOSPC
,
ENOSPC
,
EIO
,
EIO
,
/* 60..64 */
EACCES
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 65..69 */
EACCES
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 65..69 */
EIO
,
EIO
,
EIO
,
EROFS
,
EIO
,
/* 70..74 */
EIO
,
EIO
,
EIO
,
EROFS
,
EIO
,
/* 70..74 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 75..79 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 75..79 */
EEXIST
,
EIO
,
ENOENT
,
EIO
,
EIO
,
/* 80..84 */
EEXIST
,
EIO
,
ENOENT
,
EIO
,
EIO
,
/* 80..84 */
EIO
,
EIO
,
EINVAL
,
EIO
,
EAGAIN
,
/* 85..89 */
EIO
,
EIO
,
EINVAL
,
EIO
,
EAGAIN
,
/* 85..89 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 90..94 */
EIO
,
EIO
,
EIO
,
EIO
,
EIO
,
/* 90..94 */
EINTR
,
EIO
,
EIO
,
EIO
,
EACCES
,
/* 95..99 */
EINTR
,
EIO
,
EIO
,
EIO
,
EACCES
,
/* 95..99 */
ENOMEM
,
EINVAL
,
EINVAL
,
ENOMEM
,
EINVAL
,
/* 100..104 */
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 */
ENOENT
,
E2BIG
,
ENOSPC
,
ENOMEM
,
EBADF
,
/* 110..114 */
EINVAL
,
EINVAL
,
EINVAL
,
EINVAL
,
EINVAL
,
/* 115..119 */
EINVAL
,
EINVAL
,
EINVAL
,
EINVAL
,
EINVAL
,
/* 115..119 */
EINVAL
,
EINVAL
,
EINVAL
,
ENOENT
,
EINVAL
,
/* 120..124 */
EINVAL
,
EINVAL
,
EINVAL
,
ENOENT
,
EINVAL
,
/* 120..124 */
...
@@ -121,16 +121,16 @@ static unsigned char const errno_tab[] =
...
@@ -121,16 +121,16 @@ static unsigned char const errno_tab[] =
EINVAL
,
EBUSY
,
EINVAL
,
ESRCH
,
EINVAL
,
/* 300..304 */
EINVAL
,
EBUSY
,
EINVAL
,
ESRCH
,
EINVAL
,
/* 300..304 */
ESRCH
,
EINVAL
,
EINVAL
,
EINVAL
,
ESRCH
,
/* 305..309 */
ESRCH
,
EINVAL
,
EINVAL
,
EINVAL
,
ESRCH
,
/* 305..309 */
EINVAL
,
ENOMEM
,
EINVAL
,
EINVAL
,
EINVAL
,
/* 310..314 */
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
,
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 */
EACCES
,
EACCES
,
EACCES
,
ENOENT
,
ENOMEM
/* 330..334 */
};
};
/*
/*
* Initialize 64bit file access: dynamic load of WSeB API
* Initialize 64bit file access: dynamic load of WSeB API
*/
*/
File64bit
::
File64bit
()
File64bit
::
File64bit
()
{
{
HMODULE
hDoscalls
;
HMODULE
hDoscalls
;
...
@@ -156,7 +156,7 @@ static unsigned char const errno_tab[] =
...
@@ -156,7 +156,7 @@ static unsigned char const errno_tab[] =
#endif
#endif
}
}
void
_OS2errno
(
APIRET
rc
)
void
_OS2errno
(
APIRET
rc
)
{
{
if
(
rc
>=
sizeof
(
errno_tab
))
if
(
rc
>=
sizeof
(
errno_tab
))
errno
=
EINVAL
;
errno
=
EINVAL
;
...
@@ -187,19 +187,19 @@ longlong _lseek64( int fd, longlong offset, int seektype)
...
@@ -187,19 +187,19 @@ longlong _lseek64( int fd, longlong offset, int seektype)
}
}
inline
_SetFileLocksL
(
HFILE
hFile
,
inline
_SetFileLocksL
(
HFILE
hFile
,
PFILELOCKL
pflUnlock
,
PFILELOCKL
pflUnlock
,
PFILELOCKL
pflLock
,
PFILELOCKL
pflLock
,
ULONG
timeout
,
ULONG
timeout
,
ULONG
flags
)
ULONG
flags
)
{
{
if
(
_DosSetFileLocksL
)
{
if
(
_DosSetFileLocksL
)
{
APIRET
rc
;
APIRET
rc
;
rc
=
_DosSetFileLocksL
(
hFile
,
pflUnlock
,
pflLock
,
timeout
,
flags
);
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.
// only JFS can handle >2GB ranges.
if
(
rc
!=
87
)
if
(
rc
!=
87
)
return
rc
;
return
rc
;
// got INVALID_PARAMETER, fallback to standard call
// got INVALID_PARAMETER, fallback to standard call
}
}
...
@@ -209,8 +209,8 @@ inline _SetFileLocksL(HFILE hFile,
...
@@ -209,8 +209,8 @@ inline _SetFileLocksL(HFILE hFile,
return
DosSetFileLocks
(
hFile
,
&
flUnlock
,
&
flLock
,
timeout
,
flags
);
return
DosSetFileLocks
(
hFile
,
&
flUnlock
,
&
flLock
,
timeout
,
flags
);
}
}
int
_lock64
(
int
fd
,
int
locktype
,
my_off_t
start
,
int
_lock64
(
int
fd
,
int
locktype
,
my_off_t
start
,
my_off_t
length
,
myf
MyFlags
)
my_off_t
length
,
myf
MyFlags
)
{
{
FILELOCKL
LockArea
=
{
0
,
0
},
UnlockArea
=
{
0
,
0
};
FILELOCKL
LockArea
=
{
0
,
0
},
UnlockArea
=
{
0
,
0
};
ULONG
readonly
=
0
;
ULONG
readonly
=
0
;
...
@@ -241,16 +241,16 @@ int _lock64( int fd, int locktype, my_off_t start,
...
@@ -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);
//printf( "fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc);
if
(
rc
==
33
)
{
/* Lock Violation */
if
(
rc
==
33
)
{
/* Lock Violation */
DBUG_PRINT
(
"info"
,(
"Was locked, trying with timeout"
));
DBUG_PRINT
(
"info"
,(
"Was locked, trying with timeout"
));
rc
=
_SetFileLocksL
(
fd
,
&
UnlockArea
,
&
LockArea
,
1
*
1000
,
readonly
);
rc
=
_SetFileLocksL
(
fd
,
&
UnlockArea
,
&
LockArea
,
1
*
1000
,
readonly
);
//printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc);
//printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc);
}
}
}
else
{
}
else
{
while
(
rc
=
_SetFileLocksL
(
fd
,
&
UnlockArea
,
&
LockArea
,
0
,
readonly
)
&&
(
rc
==
33
))
{
while
(
rc
=
_SetFileLocksL
(
fd
,
&
UnlockArea
,
&
LockArea
,
0
,
readonly
)
&&
(
rc
==
33
))
{
printf
(
"."
);
printf
(
"."
);
DosSleep
(
1
*
1000
);
DosSleep
(
1
*
1000
);
}
}
//printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc);
//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,
...
@@ -264,9 +264,9 @@ int _lock64( int fd, int locktype, my_off_t start,
return
(
-
1
);
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
;
APIRET
rc
=
0
;
HFILE
hf
=
0
;
HFILE
hf
=
0
;
ULONG
ulAction
=
0
;
ULONG
ulAction
=
0
;
...
@@ -289,18 +289,18 @@ int sopen( const char *name, int oflag, int shflag, int mask)
...
@@ -289,18 +289,18 @@ int sopen( const char *name, int oflag, int shflag, int mask)
{
{
if
(
oflag
&
O_EXCL
)
if
(
oflag
&
O_EXCL
)
{
{
fsOpenFlags
=
OPEN_ACTION_FAIL_IF_EXISTS
|
OPEN_ACTION_CREATE_IF_NEW
;
fsOpenFlags
=
OPEN_ACTION_FAIL_IF_EXISTS
|
OPEN_ACTION_CREATE_IF_NEW
;
fail_errno
=
EEXIST
;
fail_errno
=
EEXIST
;
}
}
else
if
(
oflag
&
O_TRUNC
)
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
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
)
if
(
mask
&
S_IWRITE
)
ulAttribute
=
FILE_NORMAL
;
ulAttribute
=
FILE_NORMAL
;
else
else
ulAttribute
=
FILE_READONLY
;
ulAttribute
=
FILE_READONLY
;
}
}
else
if
(
oflag
&
O_TRUNC
)
else
if
(
oflag
&
O_TRUNC
)
...
@@ -311,10 +311,10 @@ int sopen( const char *name, int oflag, int shflag, int mask)
...
@@ -311,10 +311,10 @@ int sopen( const char *name, int oflag, int shflag, int mask)
/* Try to open the file and handle errors. */
/* Try to open the file and handle errors. */
if
(
_DosOpenL
)
if
(
_DosOpenL
)
rc
=
_DosOpenL
(
name
,
&
hf
,
&
ulAction
,
cbFile
,
rc
=
_DosOpenL
(
name
,
&
hf
,
&
ulAction
,
cbFile
,
ulAttribute
,
fsOpenFlags
,
fsOpenMode
,
NULL
);
ulAttribute
,
fsOpenFlags
,
fsOpenMode
,
NULL
);
else
else
rc
=
DosOpen
(
name
,
&
hf
,
&
ulAction
,
(
LONG
)
cbFile
,
rc
=
DosOpen
(
name
,
&
hf
,
&
ulAction
,
(
LONG
)
cbFile
,
ulAttribute
,
fsOpenFlags
,
fsOpenMode
,
NULL
);
ulAttribute
,
fsOpenFlags
,
fsOpenMode
,
NULL
);
if
(
rc
==
ERROR_OPEN_FAILED
)
if
(
rc
==
ERROR_OPEN_FAILED
)
{
{
...
@@ -334,7 +334,7 @@ int sopen( const char *name, int oflag, int shflag, int mask)
...
@@ -334,7 +334,7 @@ int sopen( const char *name, int oflag, int shflag, int mask)
return
hf
;
return
hf
;
}
}
int
read
(
int
fd
,
void
*
buffer
,
unsigned
int
count
)
int
read
(
int
fd
,
void
*
buffer
,
unsigned
int
count
)
{
{
APIRET
rc
;
APIRET
rc
;
ULONG
actual
;
ULONG
actual
;
...
@@ -350,7 +350,7 @@ int read( int fd, void *buffer, unsigned int count)
...
@@ -350,7 +350,7 @@ int read( int fd, void *buffer, unsigned int count)
return
(
-
1
);
return
(
-
1
);
}
}
int
write
(
int
fd
,
const
void
*
buffer
,
unsigned
int
count
)
int
write
(
int
fd
,
const
void
*
buffer
,
unsigned
int
count
)
{
{
APIRET
rc
;
APIRET
rc
;
ULONG
actual
;
ULONG
actual
;
...
@@ -366,7 +366,7 @@ int write( int fd, const void *buffer, unsigned int count)
...
@@ -366,7 +366,7 @@ int write( int fd, const void *buffer, unsigned int count)
return
(
-
1
);
return
(
-
1
);
}
}
int
close
(
int
fd
)
int
close
(
int
fd
)
{
{
APIRET
rc
;
APIRET
rc
;
ULONG
actual
;
ULONG
actual
;
...
...
mysys/my_os2mutex.c
View file @
d825808a
...
@@ -72,8 +72,8 @@ pthread_mutex_destroy(pthread_mutex_t * mutex)
...
@@ -72,8 +72,8 @@ pthread_mutex_destroy(pthread_mutex_t * mutex)
int
int
pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
{
{
int
ret
=
0
;
int
ret
=
0
;
int
status
=
0
;
int
status
=
0
;
APIRET
rc
=
0
;
APIRET
rc
=
0
;
rc
=
DosRequestMutexSem
(
*
mutex
,
SEM_INDEFINITE_WAIT
);
rc
=
DosRequestMutexSem
(
*
mutex
,
SEM_INDEFINITE_WAIT
);
...
@@ -86,9 +86,9 @@ pthread_mutex_lock(pthread_mutex_t * mutex)
...
@@ -86,9 +86,9 @@ pthread_mutex_lock(pthread_mutex_t * mutex)
int
int
pthread_mutex_unlock
(
pthread_mutex_t
*
mutex
)
pthread_mutex_unlock
(
pthread_mutex_t
*
mutex
)
{
{
int
ret
=
0
;
int
ret
=
0
;
APIRET
rc
=
0
;
APIRET
rc
=
0
;
int
status
;
int
status
;
rc
=
DosReleaseMutexSem
(
*
mutex
);
rc
=
DosReleaseMutexSem
(
*
mutex
);
...
...
mysys/my_os2thread.c
View file @
d825808a
...
@@ -31,9 +31,9 @@ static pthread_mutex_t THR_LOCK_thread;
...
@@ -31,9 +31,9 @@ static pthread_mutex_t THR_LOCK_thread;
struct
pthread_map
struct
pthread_map
{
{
HANDLE
pthreadself
;
HANDLE
pthreadself
;
pthread_handler
func
;
pthread_handler
func
;
void
*
param
;
void
*
param
;
};
};
void
win_pthread_init
(
void
)
void
win_pthread_init
(
void
)
...
@@ -57,7 +57,7 @@ static pthread_handler_decl(pthread_start,param)
...
@@ -57,7 +57,7 @@ static pthread_handler_decl(pthread_start,param)
pthread_handler
func
=
((
struct
pthread_map
*
)
param
)
->
func
;
pthread_handler
func
=
((
struct
pthread_map
*
)
param
)
->
func
;
void
*
func_param
=
((
struct
pthread_map
*
)
param
)
->
param
;
void
*
func_param
=
((
struct
pthread_map
*
)
param
)
->
param
;
my_thread_init
();
/* Will always succeed in windows */
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
;
win_pthread_self
=
((
struct
pthread_map
*
)
param
)
->
pthreadself
;
pthread_mutex_unlock
(
&
THR_LOCK_thread
);
pthread_mutex_unlock
(
&
THR_LOCK_thread
);
free
((
char
*
)
param
);
/* Free param from create */
free
((
char
*
)
param
);
/* Free param from create */
...
...
mysys/my_os2tls.c
View file @
d825808a
...
@@ -18,23 +18,23 @@
...
@@ -18,23 +18,23 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
MA 02111-1307, USA */
DWORD
TlsAlloc
(
void
);
DWORD
TlsAlloc
(
void
);
BOOL
TlsFree
(
DWORD
);
BOOL
TlsFree
(
DWORD
);
PVOID
TlsGetValue
(
DWORD
);
PVOID
TlsGetValue
(
DWORD
);
BOOL
TlsSetValue
(
DWORD
,
PVOID
);
BOOL
TlsSetValue
(
DWORD
,
PVOID
);
#define TLS_MINIMUM_AVAILABLE
64
#define TLS_MINIMUM_AVAILABLE
64
PULONG
tls_storage
;
/* TLS local storage */
PULONG
tls_storage
;
/* TLS local storage */
DWORD
tls_bits
[
2
];
/* TLS in-use bits */
DWORD
tls_bits
[
2
];
/* TLS in-use bits */
pthread_mutex_t
tls_mutex
;
/* TLS mutex for in-use bits */
pthread_mutex_t
tls_mutex
;
/* TLS mutex for in-use bits */
DWORD
TlsAlloc
(
void
)
DWORD
TlsAlloc
(
void
)
{
{
DWORD
index
=
-
1
;
DWORD
index
=
-
1
;
DWORD
mask
,
tibidx
;
DWORD
mask
,
tibidx
;
int
i
;
int
i
;
if
(
tls_storage
==
NULL
)
{
if
(
tls_storage
==
NULL
)
{
...
@@ -43,12 +43,12 @@ DWORD TlsAlloc( void)
...
@@ -43,12 +43,12 @@ DWORD TlsAlloc( void)
// allocate memory for TLS storage
// allocate memory for TLS storage
rc
=
DosAllocThreadLocalMemory
(
1
,
&
tls_storage
);
rc
=
DosAllocThreadLocalMemory
(
1
,
&
tls_storage
);
if
(
rc
)
{
if
(
rc
)
{
fprintf
(
stderr
,
"DosAllocThreadLocalMemory error: return code = %u
\n
"
,
rc
);
fprintf
(
stderr
,
"DosAllocThreadLocalMemory error: return code = %u
\n
"
,
rc
);
}
}
// create a mutex
// create a mutex
if
(
pthread_mutex_init
(
&
tls_mutex
,
NULL
))
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
);
pthread_mutex_lock
(
&
tls_mutex
);
...
@@ -56,18 +56,18 @@ DWORD TlsAlloc( void)
...
@@ -56,18 +56,18 @@ DWORD TlsAlloc( void)
tibidx
=
0
;
tibidx
=
0
;
if
(
tls_bits
[
0
]
==
0xFFFFFFFF
)
{
if
(
tls_bits
[
0
]
==
0xFFFFFFFF
)
{
if
(
tls_bits
[
1
]
==
0xFFFFFFFF
)
{
if
(
tls_bits
[
1
]
==
0xFFFFFFFF
)
{
fprintf
(
stderr
,
"tid#%d, no more TLS bits available
\n
"
,
_threadid
);
fprintf
(
stderr
,
"tid#%d, no more TLS bits available
\n
"
,
_threadid
);
pthread_mutex_unlock
(
&
tls_mutex
);
pthread_mutex_unlock
(
&
tls_mutex
);
return
-
1
;
return
-
1
;
}
}
tibidx
=
1
;
tibidx
=
1
;
}
}
for
(
i
=
0
;
i
<
32
;
i
++
)
{
for
(
i
=
0
;
i
<
32
;
i
++
)
{
mask
=
(
1
<<
i
);
mask
=
(
1
<<
i
);
if
((
tls_bits
[
tibidx
]
&
mask
)
==
0
)
{
if
((
tls_bits
[
tibidx
]
&
mask
)
==
0
)
{
tls_bits
[
tibidx
]
|=
mask
;
tls_bits
[
tibidx
]
|=
mask
;
index
=
(
tibidx
*
32
)
+
i
;
index
=
(
tibidx
*
32
)
+
i
;
break
;
break
;
}
}
}
}
tls_storage
[
index
]
=
0
;
tls_storage
[
index
]
=
0
;
...
@@ -79,9 +79,9 @@ DWORD TlsAlloc( void)
...
@@ -79,9 +79,9 @@ DWORD TlsAlloc( void)
return
index
;
return
index
;
}
}
BOOL
TlsFree
(
DWORD
index
)
BOOL
TlsFree
(
DWORD
index
)
{
{
int
tlsidx
;
int
tlsidx
;
DWORD
mask
;
DWORD
mask
;
if
(
index
>=
TLS_MINIMUM_AVAILABLE
)
if
(
index
>=
TLS_MINIMUM_AVAILABLE
)
...
@@ -106,7 +106,7 @@ BOOL TlsFree( DWORD index)
...
@@ -106,7 +106,7 @@ BOOL TlsFree( DWORD index)
}
}
PVOID
TlsGetValue
(
DWORD
index
)
PVOID
TlsGetValue
(
DWORD
index
)
{
{
if
(
index
>=
TLS_MINIMUM_AVAILABLE
)
if
(
index
>=
TLS_MINIMUM_AVAILABLE
)
return
NULL
;
return
NULL
;
...
@@ -122,7 +122,7 @@ PVOID TlsGetValue( DWORD index)
...
@@ -122,7 +122,7 @@ PVOID TlsGetValue( DWORD index)
return
(
PVOID
)
tls_array
[
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
// verify if memory has been allocated for this thread
...
...
mysys/my_port.c
0 → 100644
View file @
d825808a
/* 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 */
mysys/mysys_priv.h
View file @
d825808a
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
#endif
#endif
#ifdef THREAD
#ifdef THREAD
#include <my_pthread.h>
extern
pthread_mutex_t
THR_LOCK_malloc
,
THR_LOCK_open
,
THR_LOCK_keycache
,
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
;
THR_LOCK_lock
,
THR_LOCK_isam
,
THR_LOCK_net
,
THR_LOCK_charset
;
extern
pthread_mutex_t
LOCK_bitmap
;
extern
pthread_mutex_t
LOCK_bitmap
;
#else
/* THREAD */
#else
#define pthread_mutex_lock(A)
#include <my_no_pthread.h>
#define pthread_mutex_unlock(A)
#endif
#endif
mysys/thr_rwlock.c
View file @
d825808a
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
/* Synchronization - readers / writer thread locks */
/* Synchronization - readers / writer thread locks */
#include "mysys_priv.h"
#include "mysys_priv.h"
#include <my_pthread.h>
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
/*
/*
...
...
sql/ha_innobase.cc
View file @
d825808a
...
@@ -264,35 +264,46 @@ innobase_mysql_print_thd(
...
@@ -264,35 +264,46 @@ innobase_mysql_print_thd(
void
*
input_thd
)
/* in: pointer to a MySQL THD object */
void
*
input_thd
)
/* in: pointer to a MySQL THD object */
{
{
THD
*
thd
;
THD
*
thd
;
char
*
old_buf
=
buf
;
thd
=
(
THD
*
)
input_thd
;
thd
=
(
THD
*
)
input_thd
;
buf
+=
ut_sprintf
(
buf
,
"MySQL thread id %lu, query id %lu"
,
/* We can't use value of sprintf() as this is not portable */
thd
->
thread_id
,
thd
->
query_id
);
buf
+=
my_sprintf
(
buf
,
if
(
thd
->
host
)
{
(
buf
,
"MySQL thread id %lu"
,
buf
+=
ut_sprintf
(
buf
,
" %.30s"
,
thd
->
host
);
thd
->
thread_id
)
);
}
if
(
thd
->
host
)
{
if
(
thd
->
ip
)
{
*
buf
++=
' '
;
buf
+=
ut_sprintf
(
buf
,
" %.20s"
,
thd
->
ip
);
buf
=
strnmov
(
buf
,
thd
->
host
,
30
);
}
}
if
(
thd
->
user
)
{
if
(
thd
->
ip
)
buf
+=
ut_sprintf
(
buf
,
" %.20s"
,
thd
->
user
);
{
}
*
buf
++=
' '
;
buf
=
strnmov
(
buf
,
thd
->
ip
,
20
);
}
if
(
thd
->
proc_info
)
{
if
(
thd
->
user
)
buf
+=
ut_sprintf
(
buf
,
" %.50s"
,
thd
->
proc_info
);
{
}
*
buf
++=
' '
;
buf
=
strnmov
(
buf
,
thd
->
user
,
20
);
}
if
(
thd
->
query
)
{
if
(
thd
->
proc_info
)
buf
+=
ut_sprintf
(
buf
,
"
\n
%.150s"
,
thd
->
query
);
{
}
*
buf
++=
' '
;
buf
=
strnmov
(
buf
,
thd
->
proc_info
,
50
);
}
buf
+=
ut_sprintf
(
buf
,
"
\n
"
);
if
(
thd
->
query
)
{
*
buf
++=
'\n'
;
buf
=
strnmov
(
buf
,
thd
->
query
,
150
);
}
buf
[
0
]
=
'\n'
;
buf
[
1
]
=
0
;
ut_a
(
strlen
(
old_buf
)
<
400
);
ut_a
(
strlen
(
old_buf
)
<
400
);
}
}
}
}
...
...
sql/item_cmpfunc.cc
View file @
d825808a
...
@@ -494,12 +494,7 @@ Item_func_if::fix_length_and_dec()
...
@@ -494,12 +494,7 @@ Item_func_if::fix_length_and_dec()
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
bool
null1
=
args
[
1
]
->
null_value
;
bool
null2
=
args
[
2
]
->
null_value
;
if
(
null1
&&
!
null2
)
arg1_type
=
arg2_type
;
else
if
(
!
null1
&&
null2
)
arg2_type
=
arg1_type
;
binary
=
1
;
binary
=
1
;
if
(
arg1_type
==
STRING_RESULT
||
arg2_type
==
STRING_RESULT
)
if
(
arg1_type
==
STRING_RESULT
||
arg2_type
==
STRING_RESULT
)
{
{
...
...
sql/mysqld.cc
View file @
d825808a
...
@@ -43,6 +43,8 @@
...
@@ -43,6 +43,8 @@
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
#define HAVE_CLOSE_SERVER_SOCK 1
#define HAVE_CLOSE_SERVER_SOCK 1
void
close_server_sock
();
void
close_server_sock
();
#else
#define close_server_sock()
#endif
#endif
extern
"C"
{
// Because of SCO 3.2V4.2
extern
"C"
{
// Because of SCO 3.2V4.2
...
@@ -465,9 +467,7 @@ static void close_connections(void)
...
@@ -465,9 +467,7 @@ static void close_connections(void)
if
(
error
!=
0
&&
!
count
++
)
if
(
error
!=
0
&&
!
count
++
)
sql_print_error
(
"Got error %d from pthread_cond_timedwait"
,
error
);
sql_print_error
(
"Got error %d from pthread_cond_timedwait"
,
error
);
#endif
#endif
#if defined(HAVE_DEC_3_2_THREADS) || defined(SIGNALS_DONT_BREAK_READ)
close_server_sock
();
close_server_sock
();
#endif
}
}
(
void
)
pthread_mutex_unlock
(
&
LOCK_thread_count
);
(
void
)
pthread_mutex_unlock
(
&
LOCK_thread_count
);
#endif
/* __WIN__ */
#endif
/* __WIN__ */
...
@@ -598,18 +598,26 @@ if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
...
@@ -598,18 +598,26 @@ if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
void
close_server_sock
()
void
close_server_sock
()
{
{
DBUG_ENTER
(
"close_server_sock"
);
DBUG_ENTER
(
"close_server_sock"
);
if
(
ip_sock
!=
INVALID_SOCKET
)
if
(
ip_sock
!=
INVALID_SOCKET
)
{
{
DBUG_PRINT
(
"info"
,(
"c
losing
TCP/IP socket"
));
DBUG_PRINT
(
"info"
,(
"c
alling shutdown on
TCP/IP socket"
));
VOID
(
shutdown
(
ip_sock
,
2
));
VOID
(
shutdown
(
ip_sock
,
2
));
#ifdef NOT_USED
/*
The following code is disabled as it cases MySQL to hang on
AIX 4.3 during shutdown
*/
DBUG_PRINT
(
"info"
,(
"calling closesocket on TCP/IP socket"
));
VOID
(
closesocket
(
ip_sock
));
VOID
(
closesocket
(
ip_sock
));
#endif
ip_sock
=
INVALID_SOCKET
;
ip_sock
=
INVALID_SOCKET
;
}
}
if
(
unix_sock
!=
INVALID_SOCKET
)
if
(
unix_sock
!=
INVALID_SOCKET
)
{
{
DBUG_PRINT
(
"info"
,(
"c
losing U
nix socket"
));
DBUG_PRINT
(
"info"
,(
"c
alling shutdown on u
nix socket"
));
VOID
(
shutdown
(
unix_sock
,
2
));
VOID
(
shutdown
(
unix_sock
,
2
));
VOID
(
closesocket
(
unix_sock
));
DBUG_PRINT
(
"info"
,(
"calling closesocket on unix socket"
));
VOID
(
unlink
(
mysql_unix_port
));
VOID
(
unlink
(
mysql_unix_port
));
unix_sock
=
INVALID_SOCKET
;
unix_sock
=
INVALID_SOCKET
;
}
}
...
@@ -621,7 +629,8 @@ void kill_mysql(void)
...
@@ -621,7 +629,8 @@ void kill_mysql(void)
{
{
DBUG_ENTER
(
"kill_mysql"
);
DBUG_ENTER
(
"kill_mysql"
);
#ifdef SIGNALS_DONT_BREAK_READ
#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
#endif
#if defined(__WIN__)
#if defined(__WIN__)
{
{
...
@@ -647,10 +656,9 @@ void kill_mysql(void)
...
@@ -647,10 +656,9 @@ void kill_mysql(void)
DBUG_PRINT
(
"quit"
,(
"After pthread_kill"
));
DBUG_PRINT
(
"quit"
,(
"After pthread_kill"
));
shutdown_in_progress
=
1
;
// Safety if kill didn't work
shutdown_in_progress
=
1
;
// Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
#ifdef SIGNALS_DONT_BREAK_READ
if
(
!
abort_loop
)
if
(
!
kill_in_progress
)
{
{
pthread_t
tmp
;
pthread_t
tmp
;
abort_loop
=
1
;
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
(
void
*
)
0
))
(
void
*
)
0
))
sql_print_error
(
"Error: Can't create thread to kill server"
);
sql_print_error
(
"Error: Can't create thread to kill server"
);
...
@@ -1220,7 +1228,7 @@ static void sig_reload(int signo)
...
@@ -1220,7 +1228,7 @@ static void sig_reload(int signo)
static
void
sig_kill
(
int
signo
)
static
void
sig_kill
(
int
signo
)
{
{
if
(
!
abort_loop
)
if
(
!
kill_in_progress
)
{
{
abort_loop
=
1
;
// mark abort for threads
abort_loop
=
1
;
// mark abort for threads
kill_server
((
void
*
)
signo
);
kill_server
((
void
*
)
signo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment