diff options
author | unknown <brian@zim.(none)> | 2006-04-15 08:49:00 -0700 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2006-04-15 08:49:00 -0700 |
commit | 06e8697d04ea7ecc28aed3ae7d68a3156546004c (patch) | |
tree | 0016808c56b0545d9e84a1650e620b6bf9dc516b /mysys | |
parent | 1b2312211f3938a45a79ea49ead7f3660fbb2c3e (diff) | |
download | mariadb-git-06e8697d04ea7ecc28aed3ae7d68a3156546004c.tar.gz |
Another long patch to remove the rest of the OS2 support.
include/config-win.h:
Removing OS2 stuff
include/errmsg.h:
Removing OS2 stuff
include/m_string.h:
OS2 removal
include/my_global.h:
OS2 removal
include/my_net.h:
OS2 removal
include/my_no_pthread.h:
OS2 removal
include/my_pthread.h:
OS2 removal
include/thr_alarm.h:
OS2 removal
mysys/default.c:
OS2 removal
mysys/mf_path.c:
OS2 removal
mysys/mf_tempdir.c:
OS2 removal
mysys/mf_tempfile.c:
OS2 removal
mysys/my_access.c:
OS2 removal
mysys/my_clock.c:
OS2 removal
mysys/my_copy.c:
OS2 removal
mysys/my_create.c:
OS2 removal
mysys/my_dup.c:
OS2 removal
mysys/my_file.c:
OS2 removal
mysys/my_getwd.c:
OS2 removal
mysys/my_init.c:
OS2 removal
mysys/my_lib.c:
OS2 removal
mysys/my_lock.c:
OS2 removal
mysys/my_mkdir.c:
OS2 removal
mysys/my_open.c:
OS2 removal
mysys/my_pthread.c:
OS2 removal
mysys/my_redel.c:
OS2 removal
mysys/my_sleep.c:
OS2 removal
mysys/my_static.c:
OS2 removal
mysys/my_thr_init.c:
OS2 removal
mysys/thr_alarm.c:
OS2 removal
storage/myisam/myisamchk.c:
OS2 removal
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/default.c | 6 | ||||
-rw-r--r-- | mysys/mf_path.c | 2 | ||||
-rw-r--r-- | mysys/mf_tempdir.c | 4 | ||||
-rw-r--r-- | mysys/mf_tempfile.c | 15 | ||||
-rw-r--r-- | mysys/my_access.c | 10 | ||||
-rw-r--r-- | mysys/my_clock.c | 4 | ||||
-rw-r--r-- | mysys/my_copy.c | 2 | ||||
-rw-r--r-- | mysys/my_create.c | 6 | ||||
-rw-r--r-- | mysys/my_dup.c | 2 | ||||
-rw-r--r-- | mysys/my_file.c | 19 | ||||
-rw-r--r-- | mysys/my_getwd.c | 17 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/my_lib.c | 6 | ||||
-rw-r--r-- | mysys/my_lock.c | 10 | ||||
-rw-r--r-- | mysys/my_mkdir.c | 2 | ||||
-rw-r--r-- | mysys/my_open.c | 4 | ||||
-rw-r--r-- | mysys/my_pthread.c | 2 | ||||
-rw-r--r-- | mysys/my_redel.c | 2 | ||||
-rw-r--r-- | mysys/my_sleep.c | 2 | ||||
-rw-r--r-- | mysys/my_static.c | 2 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 6 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 151 |
22 files changed, 28 insertions, 248 deletions
diff --git a/mysys/default.c b/mysys/default.c index 90f8dc5f689..580bcc19eca 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -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)))) 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 99e7a28914d..805dc1ee5d1 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -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 */ 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..28d77cdf8b8 100644 --- a/mysys/my_file.c +++ b/mysys/my_file.c @@ -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..7408a320509 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -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 */ diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 522fa56cbf1..6c8da7087d3 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 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_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_pthread.c b/mysys/my_pthread.c index 315e966bf43..9a1810b9c1d 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -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) 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..7fb7439aa82 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) @@ -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 } 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); |