summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/Makefile.am6
-rw-r--r--mysys/default.c16
-rw-r--r--mysys/mf_path.c2
-rw-r--r--mysys/mf_tempdir.c4
-rw-r--r--mysys/mf_tempfile.c15
-rw-r--r--mysys/my_access.c9
-rw-r--r--mysys/my_clock.c4
-rw-r--r--mysys/my_copy.c2
-rw-r--r--mysys/my_create.c6
-rw-r--r--mysys/my_dup.c2
-rw-r--r--mysys/my_file.c21
-rw-r--r--mysys/my_getwd.c17
-rw-r--r--mysys/my_init.c5
-rw-r--r--mysys/my_lib.c103
-rw-r--r--mysys/my_lock.c10
-rw-r--r--mysys/my_mkdir.c2
-rw-r--r--mysys/my_mmap.c5
-rw-r--r--mysys/my_open.c4
-rw-r--r--mysys/my_os2cond.c162
-rw-r--r--mysys/my_os2dirsrch.c184
-rw-r--r--mysys/my_os2dirsrch.h88
-rw-r--r--mysys/my_os2dlfcn.c74
-rw-r--r--mysys/my_os2dlfcn.h039
-rw-r--r--mysys/my_os2file64.c394
-rw-r--r--mysys/my_os2mutex.c83
-rw-r--r--mysys/my_os2thread.c128
-rw-r--r--mysys/my_os2tls.c151
-rw-r--r--mysys/my_pthread.c9
-rw-r--r--mysys/my_redel.c2
-rw-r--r--mysys/my_sleep.c2
-rw-r--r--mysys/my_static.c2
-rw-r--r--mysys/my_thr_init.c10
-rw-r--r--mysys/thr_alarm.c151
33 files changed, 95 insertions, 1617 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 51ea249bbf6..7a66164b775 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -22,10 +22,7 @@ INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \
pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a ../dbug/libdbug.a \
../strings/libmystrings.a
-noinst_HEADERS = mysys_priv.h my_static.h \
- my_os2cond.c my_os2dirsrch.c my_os2dirsrch.h \
- my_os2dlfcn.c my_os2file64.c my_os2mutex.c \
- my_os2thread.c my_os2tls.c
+noinst_HEADERS = mysys_priv.h my_static.h
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
@@ -73,6 +70,7 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
+ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
@DEFS@
libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
diff --git a/mysys/default.c b/mysys/default.c
index edd02402a2a..580bcc19eca 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -48,7 +48,7 @@ char *defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */
-#define MAX_DEFAULT_DIRS 6
+#define MAX_DEFAULT_DIRS 7
const char *default_directories[MAX_DEFAULT_DIRS + 1];
#ifdef __WIN__
@@ -601,7 +601,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
strmov(name,config_file);
}
fn_format(name,name,"","",4);
-#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(__WIN__) && !defined(__NETWARE__)
{
MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(0)))
@@ -959,11 +959,13 @@ static uint my_get_system_windows_directory(char *buffer, uint size)
4. getenv(DEFAULT_HOME_ENV)
5. Directory above where the executable is located
6. ""
+ 7. --sysconfdir=<path>
On Novell NetWare, this is:
1. sys:/etc/
2. getenv(DEFAULT_HOME_ENV)
3. ""
+ 4. --sysconfdir=<path>
On OS/2, this is:
1. getenv(ETC)
@@ -971,12 +973,14 @@ static uint my_get_system_windows_directory(char *buffer, uint size)
3. getenv(DEFAULT_HOME_ENV)
4. ""
5. "~/"
+ 6. --sysconfdir=<path>
Everywhere else, this is:
1. /etc/
2. getenv(DEFAULT_HOME_ENV)
3. ""
4. "~/"
+ 5. --sysconfdir=<path>
*/
@@ -997,10 +1001,6 @@ static void init_default_directories()
#elif defined(__NETWARE__)
*ptr++= "sys:/etc/";
#else
-#if defined(__EMX__) || defined(OS2)
- if ((env= getenv("ETC")))
- *ptr++= env;
-#endif
*ptr++= "/etc/";
#endif
if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
@@ -1041,5 +1041,9 @@ static void init_default_directories()
*ptr++= (char *)&config_dir;
}
#endif
+#ifdef DEFAULT_SYSCONFDIR
+ if (DEFAULT_SYSCONFDIR != "")
+ *ptr++= DEFAULT_SYSCONFDIR;
+#endif
*ptr= 0; /* end marker */
}
diff --git a/mysys/mf_path.c b/mysys/mf_path.c
index 1ecd5fbb2b1..cdaee74dd2c 100644
--- a/mysys/mf_path.c
+++ b/mysys/mf_path.c
@@ -73,7 +73,7 @@ my_string my_path(my_string to, const char *progname,
/* test if file without filename is found in path */
/* Returns to if found and to has dirpart if found, else NullS */
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
+#if defined(MSDOS) || defined(__WIN__)
#define F_OK 0
#define PATH_SEP ';'
#define PROGRAM_EXTENSION ".exe"
diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c
index e79980ab931..d12b73a2ca2 100644
--- a/mysys/mf_tempdir.c
+++ b/mysys/mf_tempdir.c
@@ -17,7 +17,7 @@
#include "mysys_priv.h"
#include <m_string.h>
-#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
+#if defined( __WIN__) || defined(__NETWARE__)
#define DELIM ';'
#else
#define DELIM ':'
@@ -38,7 +38,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
{
/* Get default temporary directory */
pathlist=getenv("TMPDIR"); /* Use this if possible */
-#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
+#if defined( __WIN__) || defined(__NETWARE__)
if (!pathlist)
pathlist=getenv("TEMP");
if (!pathlist)
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index a15bda4da6d..b079b9ec8e3 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -24,7 +24,7 @@
#endif
#ifdef HAVE_TEMPNAM
-#if !defined(MSDOS) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(MSDOS) && !defined(__NETWARE__)
extern char **environ;
#endif
#endif
@@ -121,16 +121,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
to[1]= 0;
dir=to;
}
-#ifdef OS2
- /* changing environ variable doesn't work with VACPP */
- char buffer[256], *end;
- buffer[sizeof(buffer)-1]= 0;
- end= strxnmov(buffer, sizeof(buffer)-1, (char*) "TMP=", dir, NullS);
- /* remove ending backslash */
- if (end[-1] == '\\')
- end[-1]= 0;
- putenv(buffer);
-#elif !defined(__NETWARE__)
+#if !defined(__NETWARE__)
old_env= (char**) environ;
if (dir)
{ /* Don't use TMPDIR if dir is given */
@@ -152,7 +143,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
{
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
}
-#if !defined(OS2) && !defined(__NETWARE__)
+#if !defined(__NETWARE__)
environ=(const char**) old_env;
#endif
}
diff --git a/mysys/my_access.c b/mysys/my_access.c
index 8bac47fc67e..ddf3fc6622a 100644
--- a/mysys/my_access.c
+++ b/mysys/my_access.c
@@ -54,6 +54,7 @@ int my_access(const char *path, int amode)
#endif /* __WIN__ */
+#if defined(MSDOS) || defined(__WIN__)
/*
List of file names that causes problem on windows
@@ -199,11 +200,3 @@ int check_if_legal_filename(const char *path)
DBUG_RETURN(0);
}
#endif
-
-
-#ifdef OS2
-int check_if_legal_filename(const char *path)
-{
- return 0;
-}
-#endif /* OS2 */
diff --git a/mysys/my_clock.c b/mysys/my_clock.c
index a192bde056d..384239bb2b2 100644
--- a/mysys/my_clock.c
+++ b/mysys/my_clock.c
@@ -17,14 +17,14 @@
#define USES_TYPES
#include "my_global.h"
-#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__)
#include "mysys_priv.h"
#include <sys/times.h>
#endif
long my_clock(void)
{
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__)
struct tms tmsbuf;
VOID(times(&tmsbuf));
return (tmsbuf.tms_utime + tmsbuf.tms_stime);
diff --git a/mysys/my_copy.c b/mysys/my_copy.c
index 2fb022a25f2..342b1cdc104 100644
--- a/mysys/my_copy.c
+++ b/mysys/my_copy.c
@@ -95,7 +95,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */
VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__)
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
#endif
#if !defined(VMS) && !defined(__ZTC__)
diff --git a/mysys/my_create.c b/mysys/my_create.c
index a85417c7701..d42e7e0db69 100644
--- a/mysys/my_create.c
+++ b/mysys/my_create.c
@@ -19,7 +19,7 @@
#include <my_dir.h>
#include "mysys_err.h"
#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
+#if defined(MSDOS) || defined(__WIN__)
#include <share.h>
#endif
@@ -41,13 +41,13 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
FileName, CreateFlags, access_flags, MyFlags));
-#if !defined(NO_OPEN_3) && !defined(__EMX__)
+#if !defined(NO_OPEN_3)
fd = open((my_string) FileName, access_flags | O_CREAT,
CreateFlags ? CreateFlags : my_umask);
#elif defined(VMS)
fd = open((my_string) FileName, access_flags | O_CREAT, 0,
"ctx=stm","ctx=bin");
-#elif defined(MSDOS) || defined(__EMX__) || defined(OS2)
+#elif defined(MSDOS)
if (access_flags & O_SHARE)
fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
diff --git a/mysys/my_dup.c b/mysys/my_dup.c
index 4b7434e29ea..f4c420eb459 100644
--- a/mysys/my_dup.c
+++ b/mysys/my_dup.c
@@ -19,7 +19,7 @@
#include "mysys_err.h"
#include <my_dir.h>
#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
+#if defined(MSDOS) || defined(__WIN__)
#include <share.h>
#endif
diff --git a/mysys/my_file.c b/mysys/my_file.c
index 6a9d39cf944..4c333c7d7db 100644
--- a/mysys/my_file.c
+++ b/mysys/my_file.c
@@ -33,7 +33,7 @@
May be more or less than max_file_limit!
*/
-#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) && !defined(HAVE_mit_thread)
+#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
#ifndef RLIM_INFINITY
#define RLIM_INFINITY ((uint) 0xffffffff)
@@ -72,25 +72,6 @@ static uint set_max_open_files(uint max_file_limit)
DBUG_RETURN(max_file_limit);
}
-#elif defined (OS2)
-
-static uint set_max_open_files(uint max_file_limit)
-{
- LONG cbReqCount;
- ULONG cbCurMaxFH0;
- APIRET ulrc;
- DBUG_ENTER("set_max_open_files");
-
- /* get current limit */
- cbReqCount = 0;
- DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH0);
-
- /* set new limit */
- if ((cbReqCount = max_file_limit - cbCurMaxFH0) > 0)
- ulrc = DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH);
- DBUG_RETURN(cbCurMaxFH0);
-}
-
#else
static int set_max_open_files(uint max_file_limit)
{
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index 5663ceaa60e..765c30bc281 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -27,14 +27,6 @@
#include <dos.h>
#include <direct.h>
#endif
-#if defined(OS2)
-#include <direct.h>
-#endif
-
-#ifdef __EMX__
-/* chdir2 support also drive change */
-#define chdir _chdir2
-#endif
/* Gets current working directory in buff. Directory is allways ended
with FN_LIBCHAR */
@@ -95,14 +87,14 @@ int my_setwd(const char *dir, myf MyFlags)
int res;
size_s length;
my_string start,pos;
-#if defined(VMS) || defined(MSDOS) || defined(OS2)
+#if defined(VMS) || defined(MSDOS)
char buff[FN_REFLEN];
#endif
DBUG_ENTER("my_setwd");
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
start=(my_string) dir;
-#if defined(MSDOS) || defined(OS2) /* OS2/MSDOS chdir can't change drive */
+#if defined(MSDOS) /* MSDOS chdir can't change drive */
#if !defined(_DDL) && !defined(WIN32)
if ((pos=(char*) strchr(dir,FN_DEVCHAR)) != 0)
{
@@ -113,13 +105,8 @@ int my_setwd(const char *dir, myf MyFlags)
drives= (uint) -1;
if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
{
-#ifdef OS2
- _chdrive(drive);
- drives = _getdrive();
-#else
_dos_setdrive(drive,&drives);
_dos_getdrive(&drives);
-#endif
}
if (drive != drives)
{
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 31757cd5df0..88b8e457bd6 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -87,13 +87,10 @@ my_bool my_init(void)
#endif
if (my_thread_global_init())
return 1;
-#if !defined( __WIN__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined( __WIN__) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
#endif /* THREAD */
-#ifdef UNIXWARE_7
- (void) isatty(0); /* Go around connect() bug in UW7 */
-#endif
{
DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 522fa56cbf1..e96286a94a8 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -26,9 +26,7 @@
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
-#ifndef OS2
# define dirent direct
-#endif
# define NAMLEN(dirent) (dirent)->d_namlen
# if defined(HAVE_SYS_NDIR_H)
# include <sys/ndir.h>
@@ -52,10 +50,6 @@
#include <descrip.h>
#endif
-#ifdef OS2
-#include "my_os2dirsrch.h"
-#endif
-
#if defined(THREAD) && defined(HAVE_READDIR_R)
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
#else
@@ -384,11 +378,10 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
/* Put LIB-CHAR as last path-character if not there */
-
tmp_file=tmp_path;
if (!*path)
*tmp_file++ ='.'; /* From current dir */
- tmp_file= strmov(tmp_file,path);
+ tmp_file= strnmov(tmp_file, path, FN_REFLEN-5);
if (tmp_file[-1] == FN_DEVCHAR)
*tmp_file++= '.'; /* From current dev-dir */
if (tmp_file[-1] != FN_LIBCHAR)
@@ -424,7 +417,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
if ((handle=_findfirst(tmp_path,&find)) == -1L)
#endif
{
- DBUG_PRINT("info", ("find_first returned error"));
+ DBUG_PRINT("info", ("findfirst returned error, errno: %d", errno));
if (errno != EINVAL)
goto error;
/*
@@ -433,72 +426,76 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
continue and return zero files in dir
*/
}
-
- do
+ else
{
+
+ do
+ {
#ifdef __BORLANDC__
- attrib= find.ff_attrib;
+ attrib= find.ff_attrib;
#else
- attrib= find.attrib;
- /*
- Do not show hidden and system files which Windows sometimes create.
- Note. Because Borland's findfirst() is called with the third
- argument = 0 hidden/system files are excluded from the search.
- */
- if (attrib & (_A_HIDDEN | _A_SYSTEM))
- continue;
-#endif
+ attrib= find.attrib;
+ /*
+ Do not show hidden and system files which Windows sometimes create.
+ Note. Because Borland's findfirst() is called with the third
+ argument = 0 hidden/system files are excluded from the search.
+ */
+ if (attrib & (_A_HIDDEN | _A_SYSTEM))
+ continue;
+#endif
#ifdef __BORLANDC__
- if (!(finfo.name= strdup_root(names_storage, find.ff_name)))
- goto error;
+ if (!(finfo.name= strdup_root(names_storage, find.ff_name)))
+ goto error;
#else
- if (!(finfo.name= strdup_root(names_storage, find.name)))
- goto error;
-#endif
- if (MyFlags & MY_WANT_STAT)
- {
- if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage,
- sizeof(MY_STAT))))
+ if (!(finfo.name= strdup_root(names_storage, find.name)))
goto error;
-
- bzero(finfo.mystat, sizeof(MY_STAT));
+#endif
+ if (MyFlags & MY_WANT_STAT)
+ {
+ if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage,
+ sizeof(MY_STAT))))
+ goto error;
+
+ bzero(finfo.mystat, sizeof(MY_STAT));
#ifdef __BORLANDC__
- finfo.mystat->st_size=find.ff_fsize;
+ finfo.mystat->st_size=find.ff_fsize;
#else
- finfo.mystat->st_size=find.size;
+ finfo.mystat->st_size=find.size;
#endif
- mode=MY_S_IREAD;
- if (!(attrib & _A_RDONLY))
- mode|=MY_S_IWRITE;
- if (attrib & _A_SUBDIR)
- mode|=MY_S_IFDIR;
- finfo.mystat->st_mode=mode;
+ mode= MY_S_IREAD;
+ if (!(attrib & _A_RDONLY))
+ mode|= MY_S_IWRITE;
+ if (attrib & _A_SUBDIR)
+ mode|= MY_S_IFDIR;
+ finfo.mystat->st_mode= mode;
#ifdef __BORLANDC__
- finfo.mystat->st_mtime=((uint32) find.ff_ftime);
+ finfo.mystat->st_mtime= ((uint32) find.ff_ftime);
#else
- finfo.mystat->st_mtime=((uint32) find.time_write);
+ finfo.mystat->st_mtime= ((uint32) find.time_write);
#endif
- }
- else
- finfo.mystat= NULL;
+ }
+ else
+ finfo.mystat= NULL;
- if (push_dynamic(dir_entries_storage, (gptr)&finfo))
- goto error;
-
+ if (push_dynamic(dir_entries_storage, (gptr)&finfo))
+ goto error;
+ }
#ifdef __BORLANDC__
- } while (findnext(&find) == 0);
+ while (findnext(&find) == 0);
#else
- } while (_findnext(handle,&find) == 0);
-
- _findclose(handle);
+ while (_findnext(handle,&find) == 0);
+
+ _findclose(handle);
#endif
+ }
result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
result->number_off_files= dir_entries_storage->elements;
-
+
if (!(MyFlags & MY_DONT_SORT))
qsort((void *) result->dir_entry, result->number_off_files,
sizeof(FILEINFO), (qsort_cmp) comp_names);
+ DBUG_PRINT(exit, ("found %d files", result->number_off_files));
DBUG_RETURN(result);
error:
my_errno=errno;
diff --git a/mysys/my_lock.c b/mysys/my_lock.c
index 8f915d6003a..919727e03d6 100644
--- a/mysys/my_lock.c
+++ b/mysys/my_lock.c
@@ -26,11 +26,6 @@
#ifdef __WIN__
#include <sys/locking.h>
#endif
-#ifdef __EMX__
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2emx.h>
-#endif
#ifdef __NETWARE__
#include <nks/fsio.h>
#endif
@@ -96,11 +91,6 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
DBUG_RETURN(0);
}
}
-#elif defined(__EMX__) || defined(OS2)
-
- if (!_lock64( fd, locktype, start, length, MyFlags))
- DBUG_RETURN(0);
-
#elif defined(HAVE_LOCKING)
/* Windows */
{
diff --git a/mysys/my_mkdir.c b/mysys/my_mkdir.c
index ba1f4c1f2d8..50f304ccce6 100644
--- a/mysys/my_mkdir.c
+++ b/mysys/my_mkdir.c
@@ -27,7 +27,7 @@ int my_mkdir(const char *dir, int Flags, myf MyFlags)
DBUG_ENTER("my_dir");
DBUG_PRINT("enter",("dir: %s",dir));
-#if defined(__WIN__) || defined(OS2)
+#if defined(__WIN__)
if (mkdir((char*) dir))
#else
if (mkdir((char*) dir, Flags & my_umask_dir))
diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c
index 21bfddae46c..19d9541a967 100644
--- a/mysys/my_mmap.c
+++ b/mysys/my_mmap.c
@@ -43,22 +43,19 @@ int my_getpagesize(void)
void *my_mmap(void *addr, size_t len, int prot,
int flags, int fd, my_off_t offset)
{
- DWORD flProtect=0;
HANDLE hFileMap;
LPVOID ptr;
HANDLE hFile= (HANDLE)_get_osfhandle(fd);
if (hFile == INVALID_HANDLE_VALUE)
return MAP_FAILED;
- flProtect|=SEC_COMMIT;
-
hFileMap=CreateFileMapping(hFile, &mmap_security_attributes,
PAGE_READWRITE, 0, (DWORD) len, NULL);
if (hFileMap == 0)
return MAP_FAILED;
ptr=MapViewOfFile(hFileMap,
- flags & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ,
+ prot & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ,
(DWORD)(offset >> 32), (DWORD)offset, len);
/*
diff --git a/mysys/my_open.c b/mysys/my_open.c
index 6ed3cb5becf..098d410d8ce 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -19,7 +19,7 @@
#include "mysys_err.h"
#include <my_dir.h>
#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
+#if defined(MSDOS) || defined(__WIN__)
#include <share.h>
#endif
@@ -45,7 +45,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
DBUG_ENTER("my_open");
DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
FileName, Flags, MyFlags));
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
+#if defined(MSDOS) || defined(__WIN__)
/*
Check that we don't try to open or create a file name that may
cause problems for us in the future (like PRN)
diff --git a/mysys/my_os2cond.c b/mysys/my_os2cond.c
deleted file mode 100644
index bf3e85c26a9..00000000000
--- a/mysys/my_os2cond.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-/*****************************************************************************
-** The following is a simple implementation of posix conditions
-*****************************************************************************/
-
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(OS2)
-#include <m_string.h>
-#include <process.h>
-#include <sys/timeb.h>
-
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
-{
- cond->waiting= 0;
- /* Warp3 FP29 or Warp4 FP4 or better required */
- if (DosCreateEventSem(NULL, &cond->semaphore, 0x0800, 0))
- return ENOMEM;
- return 0;
-}
-
-int pthread_cond_destroy(pthread_cond_t *cond)
-{
- for (;;)
- {
- APIRET rc;
- if ((rc= DosCloseEventSem(cond->semaphore)) != 301)
- return rc ? EINVAL : 0;
- DosPostEventSem(cond->semaphore);
- }
-}
-
-
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- int rval= 0;
- cond->waiting++;
- if (mutex)
- pthread_mutex_unlock(mutex);
- if (DosWaitEventSem(cond->semaphore, SEM_INDEFINITE_WAIT))
- rval= EINVAL;
- if (mutex)
- pthread_mutex_lock(mutex);
- cond->waiting--;
- return rval;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime)
-{
- struct timeb curtime;
- int result;
- long timeout;
- int rval= 0;
-
- _ftime(&curtime);
- timeout= ((long) (abstime->ts_sec - curtime.time) * 1000L +
- (long) ((abstime->ts_nsec / 1000) - curtime.millitm) / 1000L);
- if (timeout < 0) /* Some safety */
- timeout= 0L;
-
- cond->waiting++;
-
- if (mutex)
- pthread_mutex_unlock(mutex);
- if (DosWaitEventSem(cond->semaphore, timeout) != 0)
- rval= ETIMEDOUT;
- if (mutex)
- pthread_mutex_lock(mutex);
-
- cond->waiting--;
-
- return rval;
-}
-
-
-int pthread_cond_signal(pthread_cond_t *cond)
-{
- /* Bring the next thread off the condition queue: */
- DosPostEventSem(cond->semaphore);
- return 0;
-}
-
-
-int pthread_cond_broadcast(pthread_cond_t *cond)
-{
- int i;
- /* Enter a loop to bring all threads off the condition queue */
- for (i= cond->waiting; i--;)
- DosPostEventSem(cond->semaphore);
- return 0;
-}
-
-
-int pthread_attr_init(pthread_attr_t *connect_att)
-{
- connect_att->dwStackSize= 0;
- connect_att->dwCreatingFlag= 0;
- connect_att->priority= 0;
- return 0;
-}
-
-int pthread_attr_setstacksize(pthread_attr_t *connect_att, DWORD stack)
-{
- connect_att->dwStackSize= stack;
- return 0;
-}
-
-int pthread_attr_setprio(pthread_attr_t *connect_att, int priority)
-{
- connect_att->priority= priority;
- return 0;
-}
-
-int pthread_attr_destroy(pthread_attr_t *connect_att)
-{
- bzero((gptr) connect_att, sizeof(*connect_att));
- return 0;
-}
-
-/****************************************************************************
-** Fix localtime_r() to be a bit safer
-****************************************************************************/
-
-struct tm *localtime_r(const time_t *timep, struct tm *tmp)
-{
- if (*timep == (time_t) - 1) /* This will crash win32 */
- {
- bzero(tmp, sizeof(*tmp));
- }
- else
- {
- struct tm *res= localtime(timep);
- if (!res) /* Wrong date */
- {
- bzero(tmp, sizeof(*tmp)); /* Keep things safe */
- return 0;
- }
- *tmp= *res;
- }
- return tmp;
-}
-#endif /* __WIN__ */
diff --git a/mysys/my_os2dirsrch.c b/mysys/my_os2dirsrch.c
deleted file mode 100644
index 8d1f6ddd947..00000000000
--- a/mysys/my_os2dirsrch.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000-2003 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-
-/* Win32 directory search emulation */
-
-#if defined(OS2)
-
-long _findfirst( char* path, struct _finddata_t* dos_file)
-{
- HDIR hdir = HDIR_CREATE;
- APIRET rc;
- FILEFINDBUF3 buf3;
- ULONG entries = 1;
-
-#ifdef _DEBUG
- printf( "_findfirst path %s\n", path);
-#endif
-
- memset( &buf3, 0, sizeof( buf3));
- rc = DosFindFirst(
- path, /* The ASCIIZ path name of the file or subdirectory to be found. */
- &hdir, /* 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);
-#endif
-
- if (rc /* && entries == 0 */)
- return -1;
-
- if (dos_file)
- {
- memset( dos_file, 0, sizeof( struct _finddata_t));
- strcpy( dos_file->name, buf3.achName);
- dos_file->size = buf3.cbFile;
- dos_file->attrib = buf3.attrFile;
- }
- return (ULONG) hdir;
-}
-
-
-long _findnext( long hdir, struct _finddata_t* dos_file)
-{
- APIRET rc;
- FILEFINDBUF3 buf3;
- ULONG entries = 1;
-
- memset( &buf3, 0, sizeof( buf3));
- rc = DosFindNext(hdir,
- &buf3, /* Result buffer. */
- sizeof( buf3), /* 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);
-#endif
-
- if (rc /* && entries == 0 */)
- return -1;
-
- if (dos_file)
- {
- memset( dos_file, 0, sizeof( struct _finddata_t));
- strcpy( dos_file->name, buf3.achName);
- dos_file->size = buf3.cbFile;
- dos_file->attrib = buf3.attrFile;
- }
- return 0;
-}
-
-void _findclose( long hdir)
-{
- APIRET rc;
-
- rc = DosFindClose( hdir);
-#ifdef _DEBUG
- printf( "_findclose rc=%d hdir=%d\n", rc, hdir);
-#endif
-}
-
-DIR* opendir(char* path)
-{
- DIR* dir = (DIR*) calloc(1, sizeof( DIR));
- char buffer[260];
- APIRET rc;
- ULONG entries = 1;
-
- strmov(strmov(buffer, path), "*.*");
-
-#ifdef _DEBUG
- printf( "_findfirst path %s\n", buffer);
-#endif
-
- 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. */
-
-#ifdef _DEBUG
- printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName);
-#endif
-
- if (rc /* && entries == 0 */)
- return NULL;
-
- return dir;
-}
-
-
-struct dirent* readdir( DIR* dir)
-{
- APIRET rc;
- ULONG entries = 1;
-
- if (!dir->buf3.achName[0]) /* file not found on previous query */
- return NULL;
-
- /* copy last file name */
- strcpy( dir->ent.d_name, dir->buf3.achName);
-
- /* query next file */
- memset( &dir->buf3, 0, sizeof( dir->buf3));
- rc= DosFindNext(
- dir->hdir,
- &dir->buf3, /* Result buffer. */
- sizeof(dir->buf3), /* 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);
-#endif
-
- if (rc /* && entries == 0 */)
- *dir->buf3.achName= 0; /* reset name for next query */
-
- return &dir->ent;
-}
-
-
-int closedir (DIR *dir)
-{
- APIRET rc;
-
- rc = DosFindClose( dir->hdir);
-#ifdef _DEBUG
- printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir);
-#endif
- free(dir);
- return 0;
-}
-
-#endif /* OS2 */
diff --git a/mysys/my_os2dirsrch.h b/mysys/my_os2dirsrch.h
deleted file mode 100644
index 3889f628bad..00000000000
--- a/mysys/my_os2dirsrch.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-/* Win32 directory search emulation */
-
-#ifndef __MY_OS2DIRSRCH2_H__
-#define __MY_OS2DIRSRCH2_H__
-
-#ifdef __cplusplus_00
-extern "C" {
-#endif
-
-struct _finddata_t
-{
- unsigned attrib;
-#ifdef NOT_USED
- unsigned long time_create; /* -1 for FAT file systems */
- unsigned long time_access; /* -1 for FAT file systems */
- unsigned long time_write;
-#endif
- unsigned long size;
- char name[260];
-#ifdef NOT_USED
- uint16 wr_date;
- uint16 wr_time;
-#endif
-};
-
-
-struct dirent
-{
-#ifdef NOT_USED
- 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;
-#endif
- char d_name[260];
-#ifdef NOT_USED
- uint16 wr_date;
- uint16 wr_time;
-#endif
-};
-
-struct DIR
-{
- HDIR hdir;
- FILEFINDBUF3 buf3;
- struct dirent ent;
-};
-
-DIR *opendir ( char *);
-struct dirent *readdir (DIR *);
-int closedir (DIR *);
-
-#ifdef NOT_USED
-#define _A_NORMAL FILE_NORMAL
-#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);
-#endif
-
-#ifdef __cplusplus_00
-}
-#endif
-
-#endif /* __MY_OS2DIRSRCH2_H__ */
diff --git a/mysys/my_os2dlfcn.c b/mysys/my_os2dlfcn.c
deleted file mode 100644
index 9c9a6061e8d..00000000000
--- a/mysys/my_os2dlfcn.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-/*
- * dlfcn::Unix dynamic loading for OS/2
- *
- * Compatibility layer for dynamic loading.
- * Only minimal implementation
- *
-*/
-
-#define RTLD_LAZY 0
-#define RTLD_NOW 0
-
-void* dlopen( char* path, int flag);
-char* dlerror( void);
-void* dlsym( void* hmod, char* fn);
-void dlclose( void* hmod);
-
-char fail[ 256];
-
-void* dlopen( char* path, int flag)
-{
- APIRET rc;
- HMODULE hmod;
-
- rc = DosLoadModule( fail, sizeof( fail), path, &hmod);
- if (rc)
- return NULL;
-
- return (void*) hmod;
-}
-
-char* dlerror( void)
-{
- return fail;
-}
-
-void* dlsym( void* hmod, char* fn)
-{
- APIRET rc;
- PFN addr;
-
- rc = DosQueryProcAddr( (HMODULE) hmod, 0l, fn, &addr);
- if (rc)
- return NULL;
-
- return (void*) addr;
-}
-
-void dlclose( void* hmod)
-{
- APIRET rc;
-
- rc = DosFreeModule( (HMODULE) hmod);
-
-}
diff --git a/mysys/my_os2dlfcn.h0 b/mysys/my_os2dlfcn.h0
deleted file mode 100644
index 7f84d430230..00000000000
--- a/mysys/my_os2dlfcn.h0
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-/*
- * dlfcn::Unix dynamic loading for OS/2
- *
- * Compatibility layer for dynamic loading.
- * Only minimal implementation
- *
-*/
-
-#ifndef __DLFCN_H__
-#define __DLFCN_H__
-
-#define RTLD_LAZY 0
-#define RTLD_NOW 0
-
-void* dlopen( char* path, int flag);
-char* dlerror( void);
-void* dlsym( void* hmod, char* fn);
-void dlclose( void* hmod);
-
-#endif
diff --git a/mysys/my_os2file64.c b/mysys/my_os2file64.c
deleted file mode 100644
index 786e083adc4..00000000000
--- a/mysys/my_os2file64.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-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);
-
-/*
- This class is used to define a global c++ variable, that
- is initialized before main() gets called.
-*/
-
-class File64bit
-{
- public:
- 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
-#define ESPIPE EBADSEEK
-
-
-static unsigned char const errno_tab[] =
-{
- 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 */
- ENOMEM, EINVAL, EINVAL, ENOMEM, EINVAL, /* 100..104 */
- 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 */
- ENOENT, ENOENT, ENOENT, ECHILD, ECHILD, /* 125..129 */
- EACCES, EINVAL, ESPIPE, EINVAL, EINVAL, /* 130..134 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 135..139 */
- EINVAL, EINVAL, EBUSY, EINVAL, EINVAL, /* 140..144 */
- EINVAL, EINVAL, EINVAL, EBUSY, EINVAL, /* 145..149 */
- EINVAL, EINVAL, ENOMEM, EINVAL, EINVAL, /* 150..154 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 155..159 */
- EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 160..164 */
- EINVAL, EINVAL, EACCES, EINVAL, EINVAL, /* 165..169 */
- EBUSY, EINVAL, EINVAL, EINVAL, EINVAL, /* 170..174 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 175..179 */
- EINVAL, EINVAL, EINVAL, EINVAL, ECHILD, /* 180..184 */
- EINVAL, EINVAL, ENOENT, EINVAL, EINVAL, /* 185..189 */
- ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 190..194 */
- ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 195..199 */
- ENOEXEC,ENOEXEC,ENOEXEC,ENOENT, EINVAL, /* 200..204 */
- EINVAL, ENAMETOOLONG, EINVAL, EINVAL, EINVAL, /* 205..209 */
- EINVAL, EINVAL, EACCES, ENOEXEC,ENOEXEC, /* 210..214 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 215..219 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 220..224 */
- EINVAL, EINVAL, EINVAL, ECHILD, EINVAL, /* 225..229 */
- EINVAL, EBUSY, EAGAIN, ENOTCONN, EINVAL, /* 230..234 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 235..239 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 240..244 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 245..249 */
- EACCES, EACCES, EINVAL, ENOENT, EINVAL, /* 250..254 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 255..259 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 260..264 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 265..269 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 270..274 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 275..279 */
- EINVAL, EINVAL, EINVAL, EINVAL, EEXIST, /* 280..284 */
- EEXIST, EINVAL, EINVAL, EINVAL, EINVAL, /* 285..289 */
- ENOMEM, EMFILE, EINVAL, EINVAL, EINVAL, /* 290..294 */
- EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 295..299 */
- 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, EINVAL, EINVAL, EINVAL, EAGAIN, /* 320..324 */
- 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()
-{
- HMODULE hDoscalls;
-
- if (DosQueryModuleHandle("DOSCALLS", &hDoscalls) != NO_ERROR)
- return;
-
- if (DosQueryProcAddr(hDoscalls, 981, NULL, (PFN *)&_DosOpenL) != NO_ERROR)
- return;
-
- if (DosQueryProcAddr(hDoscalls, 988, NULL, (PFN *)&_DosSetFilePtrL) != NO_ERROR) {
- _DosOpenL = NULL;
- return;
- }
-
- if (DosQueryProcAddr(hDoscalls, 986, NULL, (PFN *)&_DosSetFileLocksL) != NO_ERROR) {
- _DosOpenL = NULL;
- _DosSetFilePtrL = NULL;
- return;
- }
- /* notify success */
-#ifdef MYSQL_SERVER
- printf( "WSeB 64bit file API loaded.\n");
-#endif
-}
-
-void _OS2errno( APIRET rc)
-{
- if (rc >= sizeof (errno_tab))
- errno = EINVAL;
- else
- errno = errno_tab[rc];
-}
-
-
-longlong _lseek64( int fd, longlong offset, int seektype)
-{
- APIRET rc;
- longlong actual;
-
- if (_DosSetFilePtrL)
- rc = _DosSetFilePtrL( fd, offset, seektype, &actual);
- else
- {
- ULONG ulActual;
- rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual);
- actual = ulActual;
- }
-
- if (!rc)
- return( actual); /* NO_ERROR */
-
- _OS2errno( rc); /* set errno */
- return(-1); /* seek failed */
-}
-
-
-inline APIRET _SetFileLocksL(HFILE hFile,
- 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
- only JFS can handle >2GB ranges.
- */
- if (rc != 87)
- return rc;
- /* got INVALID_PARAMETER, fallback to standard call */
- }
-
- FILELOCK flUnlock = { pflUnlock->lOffset, pflUnlock->lRange };
- FILELOCK flLock = { pflLock->lOffset, pflLock->lRange };
- return DosSetFileLocks( hFile, &flUnlock, &flLock, timeout, flags);
-}
-
-
-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;
- APIRET rc = -1;
-
- switch (locktype) {
- case F_UNLCK:
- UnlockArea.lOffset = start;
- UnlockArea.lRange = length ? length : LONGLONG_MAX;
- break;
-
- case F_RDLCK:
- case F_WRLCK:
- LockArea.lOffset = start;
- LockArea.lRange = length ? length : LONGLONG_MAX;
- readonly = (locktype == F_RDLCK ? 1 : 0);
- break;
-
- default:
- errno = EINVAL;
- rc = -1;
- break;
- }
-
- if (MyFlags & MY_DONT_WAIT)
- {
- rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly);
- /* 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); */
- }
- }
- else
- {
- while (rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) &&
- (rc == 33))
- {
- printf(".");
- DosSleep(1 * 1000);
- }
- /* printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc); */
- }
- if (!rc)
- return(0); /* NO_ERROR */
- _OS2errno( rc); /* set errno */
- return(-1); /* lock failed */
-}
-
-
-int sopen(const char *name, int oflag, int shflag, int mask)
-{
- int fail_errno;
- APIRET rc = 0;
- HFILE hf = 0;
- ULONG ulAction = 0;
- LONGLONG cbFile = 0;
- ULONG ulAttribute = FILE_NORMAL;
- ULONG fsOpenFlags = 0;
- ULONG fsOpenMode = 0;
-
- /* Extract the access mode and sharing mode bits. */
- fsOpenMode = (shflag & 0xFF) | (oflag & 0x03);
-
- /*
- Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see
- below).
- */
- fail_errno = ENOENT;
-
- /*
- Compute `open_flag' depending on `flags'. Note that _SO_CREAT is
- set for O_CREAT.
- */
-
- if (oflag & O_CREAT)
- {
- if (oflag & O_EXCL)
- {
- 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;
- else
- fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
-
- if (mask & S_IWRITE)
- ulAttribute = FILE_NORMAL;
- else
- ulAttribute = FILE_READONLY;
-
- }
- else if (oflag & O_TRUNC)
- fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
- else
- fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
-
- /* Try to open the file and handle errors. */
- if (_DosOpenL)
- rc = _DosOpenL( name, &hf, &ulAction, cbFile,
- ulAttribute, fsOpenFlags, fsOpenMode, NULL);
- else
- rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile,
- ulAttribute, fsOpenFlags, fsOpenMode, NULL);
-
- if (rc == ERROR_OPEN_FAILED)
- {
- errno = fail_errno;
- return -1;
- }
- if (rc != 0)
- {
- _OS2errno( rc); /* set errno */
- return -1;
- }
- if (oflag & O_APPEND)
- _lseek64( hf, 0L, SEEK_END);
- return hf;
-}
-
-
-int read(int fd, void *buffer, unsigned int count)
-{
- APIRET rc;
- ULONG actual;
-
- rc= DosRead( fd, (PVOID) buffer, count, &actual);
-
- if (!rc)
- return( actual); /* NO_ERROR */
- _OS2errno( rc); /* set errno */
- return(-1); /* read failed */
-}
-
-
-int write(int fd, const void *buffer, unsigned int count)
-{
- APIRET rc;
- ULONG actual;
-
- rc = DosWrite( fd, (PVOID) buffer, count, &actual);
-
- if (!rc)
- return( actual); /* NO_ERROR */
- _OS2errno( rc); /* set errno */
- return(-1); /* write failed */
-}
-
-
-int close( int fd)
-{
- APIRET rc;
- ULONG actual;
-
- rc = DosClose( fd);
-
- if (!rc)
- return( 0); /* NO_ERROR */
- _OS2errno( rc); /* set errno */
- return(-1); /* close failed */
-}
-
-
-int open( const char *name, int oflag)
-{
- return sopen( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE);
-}
-
-
-int open( const char *name, int oflag, int mask)
-{
- return sopen( name, oflag, OPEN_SHARE_DENYNONE, mask);
-}
diff --git a/mysys/my_os2mutex.c b/mysys/my_os2mutex.c
deleted file mode 100644
index 5010d6e8dd5..00000000000
--- a/mysys/my_os2mutex.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Modified and extended by Antony T Curtis <antony.curtis@olcs.net>
- * for use with OS/2.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdlib.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-
-int
-pthread_mutex_init(pthread_mutex_t * mutex,
- const pthread_mutexattr_t * mutex_attr)
-{
- (void) DosCreateMutexSem(NULL,mutex,0,0);
- return (0); /* Return the completion status: */
-}
-
-
-int
-pthread_mutex_destroy(pthread_mutex_t * mutex)
-{
- APIRET rc;
-
- do
- {
- rc = DosCloseMutexSem(*mutex);
- if (rc == 301) DosReleaseMutexSem(*mutex);
- } while (rc == 301);
-
- *mutex = 0;
- return (0); /* Return the completion status: */
-}
-
-
-int
-pthread_mutex_lock(pthread_mutex_t * mutex)
-{
- APIRET rc;
-
- rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
- if (rc)
- return(EINVAL);
- return (0); /* Return the completion status: */
-}
-
-
-int
-pthread_mutex_unlock(pthread_mutex_t * mutex)
-{
- (void) DosReleaseMutexSem(*mutex);
- return (0); /* Return the completion status: */
-}
-#endif
diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c
deleted file mode 100644
index 785ff07954d..00000000000
--- a/mysys/my_os2thread.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-/*****************************************************************************
-** Simulation of posix threads calls for OS/2
-*****************************************************************************/
-
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(OS2)
-#include <m_string.h>
-#include <process.h>
-
-static pthread_mutex_t THR_LOCK_thread;
-
-struct pthread_map
-{
- HANDLE pthreadself;
- pthread_handler func;
- void * param;
-};
-
-void win_pthread_init(void)
-{
- pthread_mutex_init(&THR_LOCK_thread,NULL);
-}
-
-/*
-** We have tried to use '_beginthreadex' instead of '_beginthread' here
-** but in this case the program leaks about 512 characters for each
-** created thread !
-** As we want to save the created thread handler for other threads to
-** use and to be returned by pthread_self() (instead of the Win32 pseudo
-** handler), we have to go trough pthread_start() to catch the returned handler
-** in the new thread.
-*/
-
-pthread_handler_t pthread_start(void *param)
-{
- DBUG_ENTER("pthread_start");
- 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 */
- win_pthread_self=((struct pthread_map *) param)->pthreadself;
- pthread_mutex_unlock(&THR_LOCK_thread);
- free((char*) param); /* Free param from create */
- /* pthread_exit((void*) (*func)(func_param)); */
- (*func)(func_param);
- DBUG_RETURN(0);
-}
-
-
-int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
- pthread_handler func, void *param)
-{
- HANDLE hThread;
- struct pthread_map *map;
- DBUG_ENTER("pthread_create");
-
- if (!(map=(struct pthread_map *)malloc(sizeof(*map))))
- DBUG_RETURN(-1);
- map->func=func;
- map->param=param;
- pthread_mutex_lock(&THR_LOCK_thread);
-#ifdef __BORLANDC__
- hThread=(HANDLE)_beginthread((void(_USERENTRY *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#elif defined( OS2)
- hThread=(HANDLE)_beginthread((void( _Optlink *)(void *)) pthread_start, NULL,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#else
- hThread=(HANDLE)_beginthread((void( __cdecl *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#endif
- DBUG_PRINT("info", ("hThread=%lu",(long) hThread));
- *thread_id=map->pthreadself=hThread;
- pthread_mutex_unlock(&THR_LOCK_thread);
-
- if (hThread == (HANDLE) -1)
- {
- int error=errno;
- DBUG_PRINT("error",
- ("Can't create thread to handle request (error %d)",error));
- DBUG_RETURN(error ? error : -1);
- }
-#ifdef OS2
- my_pthread_setprio(hThread, attr->priority);
-#else
- VOID(SetThreadPriority(hThread, attr->priority)) ;
-#endif
- DBUG_RETURN(0);
-}
-
-
-void pthread_exit(void *a)
-{
- _endthread();
-}
-
-/* This is neaded to get the macro pthread_setspecific to work */
-
-int win_pthread_setspecific(void *a,void *b,uint length)
-{
- memcpy(a,b,length);
- return 0;
-}
-
-#endif
diff --git a/mysys/my_os2tls.c b/mysys/my_os2tls.c
deleted file mode 100644
index f7cf3b09283..00000000000
--- a/mysys/my_os2tls.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright (C) Yuri Dario & 2000 MySQL AB
- All the above parties has a full, independent copyright to
- the following code, including the right to use the code in
- any manner without any demands from the other parties.
-
- 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 */
-
-DWORD TlsAlloc( void);
-BOOL TlsFree( DWORD);
-PVOID TlsGetValue( DWORD);
-BOOL TlsSetValue( DWORD, PVOID);
-
-#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 */
-
-
-DWORD TlsAlloc( void)
-{
- DWORD index = -1;
- DWORD mask, tibidx;
- int i;
-
- if (tls_storage == NULL)
- {
-
- APIRET rc;
-
- /* allocate memory for TLS storage */
- rc = DosAllocThreadLocalMemory( 1, &tls_storage);
- if (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");
- }
-
- pthread_mutex_lock( &tls_mutex);
-
- 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;
- }
- 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_storage[index] = 0;
-
- pthread_mutex_unlock( &tls_mutex);
- /* fprintf( stderr, "tid#%d, TlsAlloc index %d\n", _threadid, index); */
- return index;
-}
-
-BOOL TlsFree( DWORD index)
-{
- int tlsidx;
- DWORD mask;
-
- if (index >= TLS_MINIMUM_AVAILABLE)
- return NULL;
-
- pthread_mutex_lock( &tls_mutex);
-
- tlsidx = 0;
- if (index > 32)
- tlsidx++;
-
- mask = (1 << index);
- if (tls_bits[ tlsidx] & mask)
- {
- tls_bits[tlsidx] &= ~mask;
- tls_storage[index] = 0;
- pthread_mutex_unlock( &tls_mutex);
- return TRUE;
- }
-
- pthread_mutex_unlock( &tls_mutex);
- return FALSE;
-}
-
-
-PVOID TlsGetValue( DWORD index)
-{
- if (index >= TLS_MINIMUM_AVAILABLE)
- return NULL;
-
- /* verify if memory has been allocated for this thread */
- if (*tls_storage == NULL)
- {
- /* allocate memory for indexes */
- *tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int));
- /* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */
- }
-
- ULONG* tls_array = (ULONG*) *tls_storage;
- return (PVOID) tls_array[index];
-}
-
-
-BOOL TlsSetValue( DWORD index, PVOID val)
-{
-
- /* verify if memory has been allocated for this thread */
- if (*tls_storage == NULL)
- {
- /* allocate memory for indexes */
- *tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int));
- /* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */
- }
-
- if (index >= TLS_MINIMUM_AVAILABLE)
- return FALSE;
-
- ULONG* tls_array = (ULONG*) *tls_storage;
- /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x (old)\n", _threadid, tls_array, index, tls_array[ index]); */
- tls_array[ index] = (ULONG) val;
- /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val); */
- return TRUE;
-}
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 315e966bf43..80aa6b37dbc 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -24,7 +24,7 @@
#include <m_string.h>
#include <thr_alarm.h>
-#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
+#if (defined(__BSD__) || defined(_BSDI_VERSION))
#define SCHED_POLICY SCHED_RR
#else
#define SCHED_POLICY SCHED_OTHER
@@ -76,9 +76,6 @@ void my_pthread_attr_setprio(pthread_attr_t *attr, int priority)
#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
#undef pthread_getspecific
-#ifdef HAVE_UNIXWARE7_THREADS
-#define pthread_getspecific thr_getspecific
-#endif
void *my_pthread_getspecific_imp(pthread_key_t key)
{
@@ -190,7 +187,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res)
** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
****************************************************************************/
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(OS2)
+#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
#if !defined(DONT_USE_SIGSUSPEND)
@@ -429,7 +426,7 @@ int sigwait(sigset_t *setp, int *sigp)
** Patches for AIX and DEC OSF/1 3.2
*****************************************************************************/
-#if (defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) && !defined(HAVE_UNIXWARE7_THREADS)) || defined(HAVE_DEC_3_2_THREADS)
+#if defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT)
#include <netdb.h>
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 9af360424b0..02d3db8b860 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -90,7 +90,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
return 1;
VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
+#if !defined(MSDOS) && !defined(__WIN__) && !defined(__NETWARE__)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
{
if (MyFlags & MY_LINK_WARNING)
diff --git a/mysys/my_sleep.c b/mysys/my_sleep.c
index 31eaf7eeb96..2ef4c1f8382 100644
--- a/mysys/my_sleep.c
+++ b/mysys/my_sleep.c
@@ -25,8 +25,6 @@ void my_sleep(ulong m_seconds)
delay(m_seconds/1000+1);
#elif defined(__WIN__)
Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */
-#elif defined(OS2)
- DosSleep(m_seconds/1000+1);
#elif defined(HAVE_SELECT)
struct timeval t;
t.tv_sec= m_seconds / 1000000L;
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 17094548dbd..4f3e2078a5d 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -19,7 +19,7 @@
a shared library
*/
-#if !defined(stdin) || defined(OS2)
+#if !defined(stdin)
#include "mysys_priv.h"
#include "my_static.h"
#include "my_alarm.h"
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index d93f45091c6..9013cd6e79d 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -94,7 +94,7 @@ my_bool my_thread_global_init(void)
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
-#if defined( __WIN__) || defined(OS2)
+#if defined( __WIN__)
win_pthread_init();
#endif
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
@@ -217,19 +217,19 @@ void my_thread_end(void)
tmp->dbug=0;
}
#endif
-#if !defined(__bsdi__) && !defined(__OpenBSD__) || defined(HAVE_mit_thread)
+#if !defined(__bsdi__) && !defined(__OpenBSD__)
/* bsdi and openbsd 3.5 dumps core here */
pthread_cond_destroy(&tmp->suspend);
#endif
pthread_mutex_destroy(&tmp->mutex);
-#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
+#if !defined(__WIN__) || defined(USE_TLS)
free(tmp);
#else
tmp->init= 0;
#endif
}
/* The following free has to be done, even if my_thread_var() is 0 */
-#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
+#if !defined(__WIN__) || defined(USE_TLS)
pthread_setspecific(THR_KEY_mysys,0);
#endif
}
@@ -260,7 +260,7 @@ long my_thread_id()
{
#if defined(HAVE_PTHREAD_GETSEQUENCE_NP)
return pthread_getsequence_np(pthread_self());
-#elif (defined(__sun) || defined(__sgi) || defined(__linux__)) && !defined(HAVE_mit_thread)
+#elif (defined(__sun) || defined(__sgi) || defined(__linux__))
return pthread_self();
#else
return my_thread_var->id;
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 41914080a9d..dcb41837d96 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -42,7 +42,7 @@ volatile my_bool alarm_thread_running= 0;
static sig_handler process_alarm_part2(int sig);
-#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
+#if !defined(__WIN__)
static pthread_mutex_t LOCK_alarm;
static pthread_cond_t COND_alarm;
@@ -564,145 +564,6 @@ static void *alarm_handler(void *arg __attribute__((unused)))
#endif /* USE_ALARM_THREAD */
/*****************************************************************************
- thr_alarm for OS/2
-*****************************************************************************/
-
-#elif defined(__EMX__) || defined(OS2)
-
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2.h>
-
-static pthread_mutex_t LOCK_alarm;
-static sigset_t full_signal_set;
-static QUEUE alarm_queue;
-pthread_t alarm_thread;
-
-#ifdef USE_ALARM_THREAD
-static pthread_cond_t COND_alarm;
-static void *alarm_handler(void *arg);
-#define reschedule_alarms() pthread_cond_signal(&COND_alarm)
-#else
-#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
-#endif
-
-sig_handler process_alarm(int sig __attribute__((unused)))
-{
- sigset_t old_mask;
- ALARM *alarm_data;
- DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements));
-}
-
-
-/*
- Remove another thread from the alarm
-*/
-
-void thr_alarm_kill(pthread_t thread_id)
-{
- uint i;
-
- pthread_mutex_lock(&LOCK_alarm);
- for (i=0 ; i < alarm_queue.elements ; i++)
- {
- if (pthread_equal(((ALARM*) queue_element(&alarm_queue,i))->thread,
- thread_id))
- {
- ALARM *tmp=(ALARM*) queue_remove(&alarm_queue,i);
- tmp->expire_time=0;
- queue_insert(&alarm_queue,(byte*) tmp);
- reschedule_alarms();
- break;
- }
- }
- pthread_mutex_unlock(&LOCK_alarm);
-}
-
-bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
-{
- APIRET rc;
- if (alarm_aborted)
- {
- alarm->alarmed.crono=0;
- alarm->alarmed.event=0;
- return 1;
- }
- if (rc = DosCreateEventSem(NULL,(HEV *) &alarm->alarmed.event,
- DC_SEM_SHARED,FALSE))
- {
- printf("Error creating event semaphore! [%d] \n",rc);
- alarm->alarmed.crono=0;
- alarm->alarmed.event=0;
- return 1;
- }
- if (rc = DosAsyncTimer((long) sec*1000L, (HSEM) alarm->alarmed.event,
- (HTIMER *) &alarm->alarmed.crono))
- {
- printf("Error starting async timer! [%d] \n",rc);
- DosCloseEventSem((HEV) alarm->alarmed.event);
- alarm->alarmed.crono=0;
- alarm->alarmed.event=0;
- return 1;
- } /* endif */
- (*alrm)= &alarm->alarmed;
- return 1;
-}
-
-
-bool thr_got_alarm(thr_alarm_t *alrm_ptr)
-{
- thr_alarm_t alrm= *alrm_ptr;
- APIRET rc;
-
- if (alrm->crono)
- {
- rc = DosWaitEventSem((HEV) alrm->event, SEM_IMMEDIATE_RETURN);
- if (rc == 0) {
- DosCloseEventSem((HEV) alrm->event);
- alrm->crono = 0;
- alrm->event = 0;
- } /* endif */
- }
- return !alrm->crono || alarm_aborted;
-}
-
-
-void thr_end_alarm(thr_alarm_t *alrm_ptr)
-{
- thr_alarm_t alrm= *alrm_ptr;
- if (alrm->crono)
- {
- DosStopTimer((HTIMER) alrm->crono);
- DosCloseEventSem((HEV) alrm->event);
- alrm->crono = 0;
- alrm->event = 0;
- }
-}
-
-void end_thr_alarm(my_bool free_structures)
-{
- DBUG_ENTER("end_thr_alarm");
- alarm_aborted=1; /* No more alarms */
- DBUG_VOID_RETURN;
-}
-
-void init_thr_alarm(uint max_alarm)
-{
- DBUG_ENTER("init_thr_alarm");
- alarm_aborted=0; /* Yes, Gimmie alarms */
- DBUG_VOID_RETURN;
-}
-
-void thr_alarm_info(ALARM_INFO *info)
-{
- bzero((char*) info, sizeof(*info));
-}
-
-void resize_thr_alarm(uint max_alarms)
-{
-}
-
-/*****************************************************************************
thr_alarm for win95
*****************************************************************************/
@@ -902,10 +763,8 @@ static sig_handler print_signal_warning(int sig)
#ifdef DONT_REMEMBER_SIGNAL
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
-#ifndef OS2
if (sig == SIGALRM)
alarm(2); /* reschedule alarm */
-#endif
}
#endif /* USE_ONE_SIGNAL_HAND */
@@ -922,7 +781,6 @@ static void *signal_hand(void *arg __attribute__((unused)))
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
-#ifndef OS2
sigemptyset(&set); /* Catch all signals */
sigaddset(&set,SIGINT);
sigaddset(&set,SIGQUIT);
@@ -939,7 +797,6 @@ static void *signal_hand(void *arg __attribute__((unused)))
#else
puts("Starting signal handling thread");
#endif
-#endif /* OS2 */
printf("server alarm: %d thread alarm: %d\n",
THR_SERVER_ALARM,THR_CLIENT_ALARM);
DBUG_PRINT("info",("Starting signal and alarm handling thread"));
@@ -962,9 +819,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
case SIGINT:
case SIGQUIT:
case SIGTERM:
-#ifndef OS2
case SIGHUP:
-#endif
printf("Aborting nicely\n");
end_thr_alarm(0);
break;
@@ -974,13 +829,11 @@ static void *signal_hand(void *arg __attribute__((unused)))
exit(1);
return 0; /* Keep some compilers happy */
#endif
-#ifndef OS2
#ifdef USE_ONE_SIGNAL_HAND
case THR_SERVER_ALARM:
process_alarm(sig);
break;
#endif
-#endif /* OS2 */
}
}
}
@@ -1002,7 +855,6 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
pthread_cond_init(&COND_thread_count,NULL);
/* Start a alarm handling thread */
-#ifndef OS2
sigemptyset(&set);
sigaddset(&set,SIGINT);
sigaddset(&set,SIGQUIT);
@@ -1020,7 +872,6 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
sigaddset(&set,THR_CLIENT_ALARM);
VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0));
#endif
-#endif /* OS2 */
pthread_attr_init(&thr_attr);
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);