Commit 53dce520 authored by brian@zim.(none)'s avatar brian@zim.(none)

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  zim.(none):/home/brian/mysql/dep-5.1
parents 5dc63107 ba2502b9
......@@ -122,12 +122,12 @@ functions */
/* Type information */
#if defined(__EMX__) || !defined(HAVE_UINT)
#if !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
typedef unsigned short ushort;
typedef unsigned int uint;
#endif /* defined(__EMX__) || !defined(HAVE_UINT) */
#endif /* !defined(HAVE_UINT) */
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
typedef __int64 longlong;
......
......@@ -29,9 +29,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#if defined(OS2) && defined(MYSQL_SERVER)
#define CER(X) client_errors[(X)-CR_MIN_ERROR]
#elif !defined(ER)
#if !defined(ER)
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
......
......@@ -84,7 +84,7 @@
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if defined(__cplusplus) && !defined(OS2)
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -256,7 +256,7 @@ extern int my_vsnprintf( char *str, size_t n,
const char *format, va_list ap );
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
#if defined(__cplusplus) && !defined(OS2)
#if defined(__cplusplus)
}
#endif
#endif
......@@ -254,7 +254,7 @@
#endif
#endif
#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
#if defined(THREAD) && !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif
......@@ -459,9 +459,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
#define USE_REGEX 1 /* We want the use the regex library */
/* Do not define for ultra sparcs */
#ifndef OS2
#define USE_BMOVE512 1 /* Use this unless system bmove is faster */
#endif
#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */
......@@ -506,7 +504,7 @@ int __void__;
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#if defined(__EMX__) || !defined(HAVE_UINT)
#if !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
typedef unsigned int uint;
......@@ -684,14 +682,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_DEVCHAR ':'
#ifndef FN_LIBCHAR
#ifdef __EMX__
#define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\"
#else
#define FN_LIBCHAR '/'
#define FN_ROOTDIR "/"
#endif
#endif
#define MY_NFILE 64 /* This is only used to save filenames */
#ifndef OS_FILE_LIMIT
#define OS_FILE_LIMIT 65535
......@@ -738,11 +731,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#undef remove /* Crashes MySQL on SCO 5.0.0 */
#ifndef __WIN__
#ifdef OS2
#define closesocket(A) soclose(A)
#else
#define closesocket(A) close(A)
#endif
#ifndef ulonglong2double
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
......@@ -951,7 +940,7 @@ typedef ulonglong my_off_t;
typedef unsigned long my_off_t;
#endif
#define MY_FILEPOS_ERROR (~(my_off_t) 0)
#if !defined(__WIN__) && !defined(OS2)
#if !defined(__WIN__)
typedef off_t os_off_t;
#endif
......@@ -964,16 +953,6 @@ typedef off_t os_off_t;
#define SOCKET_EADDRINUSE WSAEADDRINUSE
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#elif defined(OS2)
#define socket_errno sock_errno()
#define SOCKET_EINTR SOCEINTR
#define SOCKET_EAGAIN SOCEINPROGRESS
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
#define SOCKET_EADDRINUSE SOCEADDRINUSE
#define SOCKET_ENFILE SOCENFILE
#define SOCKET_EMFILE SOCEMFILE
#define closesocket(A) soclose(A)
#else /* Unix */
#define socket_errno errno
#define closesocket(A) close(A)
......
......@@ -53,12 +53,6 @@ C_MODE_START
#endif
#endif
#if defined(__EMX__)
#include <sys/ioctl.h>
#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
#undef HAVE_FCNTL
#endif /* defined(__EMX__) */
#if defined(MSDOS) || defined(__WIN__)
#define O_NONBLOCK 1 /* For emulation of fcntl() */
#endif
......
......@@ -26,7 +26,7 @@
even in non-threaded builds.
Case in point: 'mf_keycache.c'
*/
#if defined(__WIN__) || defined(OS2)
#if defined(__WIN__)
#elif defined(HAVE_UNIXWARE7_THREADS)
/* #include <thread.h> Currently, not relevant. Enable if needed. */
......
......@@ -31,19 +31,9 @@ extern "C" {
#define EXTERNC
#endif /* __cplusplus */
#if defined(__WIN__) || defined(OS2)
#if defined(__WIN__)
#ifdef OS2
typedef ULONG HANDLE;
typedef ULONG DWORD;
typedef int sigset_t;
#endif
#ifdef OS2
typedef HMTX pthread_mutex_t;
#else
typedef CRITICAL_SECTION pthread_mutex_t;
#endif
typedef HANDLE pthread_t;
typedef struct thread_attr {
DWORD dwStackSize ;
......@@ -62,30 +52,19 @@ typedef struct st_pthread_link {
typedef struct {
uint32 waiting;
#ifdef OS2
HEV semaphore;
#else
HANDLE semaphore;
#endif
} pthread_cond_t;
#ifndef OS2
struct timespec { /* For pthread_cond_timedwait() */
time_t tv_sec;
long tv_nsec;
};
#endif
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
#define pthread_handler_t EXTERNC void * _Optlink
typedef void * (_Optlink *pthread_handler)(void *);
#else
#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
#endif
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
......@@ -107,10 +86,8 @@ struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#ifndef OS2
#define ETIMEDOUT 145 /* Win32 doesn't have this */
#define getpid() GetCurrentThreadId()
#endif
#define pthread_self() win_pthread_self
#define HAVE_LOCALTIME_R 1
#define _REENTRANT 1
......@@ -145,15 +122,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#endif /* USE_TLS */
#define pthread_equal(A,B) ((A) == (B))
#ifdef OS2
extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
extern int pthread_mutex_lock (pthread_mutex_t *);
extern int pthread_mutex_unlock (pthread_mutex_t *);
extern int pthread_mutex_destroy (pthread_mutex_t *);
#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
#define pthread_kill(A,B) raise(B)
#define pthread_exit(A) pthread_dummy()
#else
#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
......@@ -161,7 +129,6 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy(0)
#endif /* OS2 */
/* Dummy defines for easier code */
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
......@@ -257,9 +224,6 @@ extern int my_sigwait(const sigset_t *set,int *sig);
#ifdef HAVE_SYNCH_H
#include <synch.h>
#endif
#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
#error Requires at least rev 2 of EMX pthreads library.
#endif
#ifdef __NETWARE__
void my_pthread_exit(void *status);
......@@ -382,15 +346,12 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif
#if defined(OS2)
#define my_pthread_getspecific(T,A) ((T) &(A))
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
#else
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
void *my_pthread_getspecific_imp(pthread_key_t key);
#endif /* OS2 */
#endif
#ifndef HAVE_LOCALTIME_R
struct tm *localtime_r(const time_t *clock, struct tm *res);
......
......@@ -73,14 +73,6 @@ typedef struct st_thr_alarm_entry
rf_SetTimer crono;
} thr_alarm_entry;
#elif defined(__EMX__) || defined(OS2)
typedef struct st_thr_alarm_entry
{
uint crono;
uint event;
} thr_alarm_entry;
#else /* System with posix threads */
typedef int thr_alarm_entry;
......
......@@ -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)))
......@@ -1001,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))))
......
......@@ -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"
......
......@@ -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)
......
......@@ -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
}
......
......@@ -54,7 +54,7 @@ int my_access(const char *path, int amode)
#endif /* __WIN__ */
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
#if defined(MSDOS) || defined(__WIN__)
/*
List of file names that causes problem on windows
......@@ -112,11 +112,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 */
......@@ -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);
......
......@@ -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__)
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
{
......
......@@ -26,14 +26,6 @@
#include <m_ctype.h>
#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
......@@ -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)
{
......
......@@ -87,7 +87,7 @@ 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 */
......
......@@ -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
......
......@@ -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 */
{
......
......@@ -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))
......
......@@ -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)
......
......@@ -190,7 +190,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(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
#if !defined(DONT_USE_SIGSUSPEND)
......
......@@ -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)
......
......@@ -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;
......
......@@ -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"
......
......@@ -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)
......@@ -222,14 +222,14 @@ void my_thread_end(void)
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
}
......
......@@ -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;
......@@ -563,145 +563,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);
......
......@@ -34,10 +34,6 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */
#define my_raid_delete(A,B,C) my_delete(A,B)
#endif
#ifdef OS2
#define _sanity(a,b)
#endif
static uint decode_bits;
static char **default_argv;
static const char *load_default_groups[]= { "myisamchk", 0 };
......@@ -378,7 +374,7 @@ static void usage(void)
directly with '--variable-name=value'.\n\
-t, --tmpdir=path Path for temporary files. Multiple paths can be\n\
specified, separated by ");
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
#if defined( __WIN__) || defined(__NETWARE__)
printf("semicolon (;)");
#else
printf("colon (:)");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment