summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-08-12 03:28:02 +0300
committerunknown <monty@hundin.mysql.fi>2002-08-12 03:28:02 +0300
commitb2e946136d21ec3102b3204ef1e2a1a10b404ff3 (patch)
tree34d4d5eb2aef4b99d0518f461da41a331af8574e /mysys
parent49e4fea6c9f64f692b941589fd86158bf3e76a10 (diff)
downloadmariadb-git-b2e946136d21ec3102b3204ef1e2a1a10b404ff3.tar.gz
Fixed problem with BIGINT and shutdown on AIX
Moved IF(test,column,NULL) code to 4.0 Changed mysys_priv.h to include my_pthread.h or my_no_pthread.h. Removed some CR's in os2 files. Docs/manual.texi: Changelog include/global.h: Fix for BIGINT problem on AIX include/my_no_pthread.h: Fixed typo libmysql/Makefile.shared: Fix for BIGINT problem on AIX mysql-test/mysql-test-run.sh: Fix to find xterm on AIX 4.3 mysql-test/r/bigint.result: Fix for BIGINT problem on AIX mysql-test/r/func_if.result: Change results for IF() after reverting change. mysql-test/t/bigint.test: Fix for BIGINT problem on AIX mysys/Makefile.am: Fix for BIGINT problem on AIX mysys/my_gethostbyname.c: Cleanup mysys/my_init.c: Cleanup mysys/my_net.c: Cleanup mysys/my_os2cond.c: Space & CRLF cleanup mysys/my_os2dirsrch.c: Space & CRLF cleanup mysys/my_os2dirsrch.h: Space & CRLF cleanup mysys/my_os2dlfcn.c: Space & CRLF cleanup mysys/my_os2file64.c: Space & CRLF cleanup mysys/my_os2mutex.c: Space & CRLF cleanup mysys/my_os2thread.c: Space & CRLF cleanup mysys/my_os2tls.c: Space & CRLF cleanup mysys/mysys_priv.h: cleanup mysys/thr_rwlock.c: cleanup sql/ha_innobase.cc: Removed usage of sprintf() Fixed missing end \0 which caused control characters to appear in SHOW INNODB STATUS sql/item_cmpfunc.cc: Reverted change for IF() sql/mysqld.cc: Fix for shutdown on AIX
Diffstat (limited to 'mysys')
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/my_gethostbyname.c6
-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
15 files changed, 202 insertions, 177 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 7de59939227..e3918f71b58 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 \
getopt.c getopt1.c getvar.c my_mkdir.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
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index f30591d9fe3..ffbfc424d0a 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -18,7 +18,6 @@
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
-#include "my_pthread.h"
#include <assert.h>
#if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h>
@@ -28,11 +27,6 @@
/* This file is not needed if my_gethostbyname_r is a macro */
#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
usage of getbostbyname_r simpler.
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 3bc87fd179d..31e49731c94 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -21,9 +21,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 1c91f7ff802..575c843f297 100644
--- a/mysys/my_net.c
+++ b/mysys/my_net.c
@@ -34,11 +34,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 20fda270658..2049347cb36 100644
--- a/mysys/mysys_priv.h
+++ b/mysys/mysys_priv.h
@@ -23,10 +23,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 866948a1c23..d4fe79a06ac 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -18,7 +18,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)
/*