diff options
author | unknown <monty@donna.mysql.com> | 2000-11-28 04:47:47 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-11-28 04:47:47 +0200 |
commit | 746f0b3b762f2a9d31347dfddf4b07a1621fc15b (patch) | |
tree | e3d40dd7c6a7e86bd2388da19d59d5a372bf7bb8 /mysys | |
parent | 2700d28319bf29ee3957a357eaa102bcc72e1ac4 (diff) | |
download | mariadb-git-746f0b3b762f2a9d31347dfddf4b07a1621fc15b.tar.gz |
New thr_alarm struct for better integration with OS2
Run bootstrap in separate thread
Fix bug in FLUSH TABLES table_name
Docs/manual.texi:
Updated ChangeLog
client/mysql.cc:
Added info about compressed protocol
include/getopt.h:
Fix for OS2
include/global.h:
Fix for OS2
include/my_sys.h:
Fix for OS2
include/mysql_com.h:
Fix for OS2
include/thr_alarm.h:
Cleanup up alarm struct for OS2 port
isam/isamchk.c:
Fix for OS2
libmysql/libmysql.c:
cleanup
libmysql/net.c:
Use new thr_alarm
libmysql/violite.c:
Fix for OS2
myisam/ChangeLog:
Changes
myisam/mi_create.c:
Use less stack
myisam/myisamchk.c:
Fix for OS2
mysys/default.c:
Fix for OS2
mysys/getopt.c:
Fix for OS2
mysys/mf_format.c:
Safety
mysys/mf_path.c:
Fix for OS2
mysys/my_create.c:
Fix for OS2
mysys/my_lock.c:
Fix for OS2
mysys/my_open.c:
Fix for OS2
mysys/thr_alarm.c:
Use new thr_alarm struct
readline/input.c:
Fix for OS2
readline/rltty.c:
Fix for OS2
sql/ha_myisam.cc:
Remove unnecessary fn_format
sql/my_lock.c:
Use new thr_alarm
sql/mysql_priv.h:
Changed bootstrap to run in separate thread to avoid problem with
small stack
sql/mysqld.cc:
Changed bootstrap to run in separate thread to avoid problem with
small stack
sql/net_serv.cc:
Use new thr_alarm
sql/sql_base.cc:
Fix problem with FLUSH TABLE table_name
sql/sql_class.cc:
Fix for new bootstrap
sql/sql_class.h:
cleanup
sql/sql_delete.cc:
cleanup
sql/sql_load.cc:
Fix for OS2
sql/sql_parse.cc:
Changed bootstrap to run in separate thread to avoid problem with
small stack
sql/sql_select.cc:
Reset used structure elements
sql/sql_table.cc:
For OS2
sql/violite.c:
For OS2
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/default.c | 10 | ||||
-rw-r--r-- | mysys/getopt.c | 4 | ||||
-rw-r--r-- | mysys/mf_format.c | 2 | ||||
-rw-r--r-- | mysys/mf_path.c | 2 | ||||
-rw-r--r-- | mysys/my_create.c | 6 | ||||
-rw-r--r-- | mysys/my_lock.c | 2 | ||||
-rw-r--r-- | mysys/my_open.c | 4 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 112 |
8 files changed, 115 insertions, 27 deletions
diff --git a/mysys/default.c b/mysys/default.c index e7e2e7cc8ff..6518fb5816f 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -146,6 +146,12 @@ void load_defaults(const char *conf_file, const char **groups, &group)) goto err; #endif +#ifdef __EMX__ + if (getenv("ETC") && + search_default_file(&args, &alloc, getenv("ETC"), conf_file, + default_ext, &group)) + goto err; +#endif for (dirs=default_directories ; *dirs; dirs++) { int error=0; @@ -357,6 +363,10 @@ void print_defaults(const char *conf_file, const char **groups) GetWindowsDirectory(name,sizeof(name)); printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext); #endif +#ifdef __EMX__ + if (getenv("ETC")) + printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext); +#endif for (dirs=default_directories ; *dirs; dirs++) { if (**dirs) diff --git a/mysys/getopt.c b/mysys/getopt.c index 88fdbff7811..a2a3b5bbec9 100644 --- a/mysys/getopt.c +++ b/mysys/getopt.c @@ -660,8 +660,12 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, const stru } } +#ifdef __EMX__ +int getopt (int argc, char **argv, __const__ char *optstring) +#else int getopt (int argc, char *const *argv, const char *optstring) +#endif { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, diff --git a/mysys/mf_format.c b/mysys/mf_format.c index 47d5e17cf22..3050fd88e90 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -117,7 +117,7 @@ my_string fn_format(my_string to, const char *name, const char *dsk, if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode))) { if (realpath(to,buff)) - strmov(to,buff); + strnmov(to,buff,FN_REFLEN-1); } } #endif diff --git a/mysys/mf_path.c b/mysys/mf_path.c index f7dcf34e6b4..3158c45470c 100644 --- a/mysys/mf_path.c +++ b/mysys/mf_path.c @@ -74,7 +74,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__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" diff --git a/mysys/my_create.c b/mysys/my_create.c index 068fd7109f6..8273170fc0a 100644 --- a/mysys/my_create.c +++ b/mysys/my_create.c @@ -20,7 +20,7 @@ #include <my_dir.h> #include "mysys_err.h" #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) #include <share.h> #endif @@ -42,13 +42,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) +#if !defined(NO_OPEN_3) && !defined(__EMX__) 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(__WIN__) +#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) 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_lock.c b/mysys/my_lock.c index ed637648353..6486e07834b 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -33,9 +33,11 @@ #include <os2emx.h> #endif +#ifndef __EMX__ #ifdef HAVE_FCNTL static struct flock lock; /* Must be static for sun-sparc */ #endif +#endif /* Lock a part of a file */ diff --git a/mysys/my_open.c b/mysys/my_open.c index 98733266d1b..aadf197d2cb 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -19,7 +19,7 @@ #include "mysys_priv.h" #include "mysys_err.h" #include <errno.h> -#if defined(MSDOS) || defined(__WIN__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) #include <share.h> #endif @@ -34,7 +34,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__) +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO); else diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 2397e315eff..72515932141 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -37,7 +37,7 @@ static my_bool alarm_aborted=1; my_bool thr_alarm_inited=0; -#if !defined(__WIN__) && !defined(__OS2__) +#if !defined(__WIN__) && !defined(__EMX__) static pthread_mutex_t LOCK_alarm; static sigset_t full_signal_set; @@ -460,42 +460,91 @@ static void *alarm_handler(void *arg __attribute__((unused))) ** thr_alarm for OS/2 *****************************************************************************/ -#elif defined(__OS2__) +#elif defined(__EMX__) #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) { - alrm->crono=0; - alrm->event=0; + alarm->alarmed.crono=0; + alarm->alarmed.event=0; return 1; } - if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE))) + if (rc = DosCreateEventSem(NULL,(HEV *) &alarm->alarmed.event, + DC_SEM_SHARED,FALSE)) { printf("Error creating event semaphore! [%d] \n",rc); - alrm->crono=0; - alrm->event=0; + alarm->alarmed.crono=0; + alarm->alarmed.event=0; return 1; } - if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) { + if (rc = DosAsyncTimer((long) sec*1000L, (HSEM) alarm->alarmed.event, + (HTIMER *) &alarm->alarmed.crono)) + { printf("Error starting async timer! [%d] \n",rc); - DosCloseEventSem((HEV) alrm->event); - alrm->crono=0; - alrm->event=0; + 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) +bool thr_got_alarm(thr_alarm_t *alrm_ptr) { + thr_alarm_t alrm= *alrm_ptr; APIRET rc; if (alrm->crono) @@ -511,8 +560,9 @@ bool thr_got_alarm(thr_alarm_t *alrm) } -void thr_end_alarm(thr_alarm_t *alrm) +void thr_end_alarm(thr_alarm_t *alrm_ptr) { + thr_alarm_t alrm= *alrm_ptr; if (alrm->crono) { DosStopTimer((HTIMER) alrm->crono); @@ -542,21 +592,35 @@ void init_thr_alarm(uint max_alarm) #else /* __WIN__ */ +void thr_alarm_kill(pthread_t thread_id) +{ + /* Can't do this yet */ +} + +sig_handler process_alarm(int sig __attribute__((unused))) +{ + /* Can't do this yet */ +} + + bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) { if (alarm_aborted) { - alrm->crono=0; + alarm->alarmed.crono=0; return 1; } - if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL))) + if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000, + (TIMERPROC) NULL))) return 1; + (*alrm)= &alarm->alarmed; return 0; } -bool thr_got_alarm(thr_alarm_t *alrm) +bool thr_got_alarm(thr_alarm_t *alrm_ptr) { + thr_alarm_t alrm= *alrm_ptr; MSG msg; if (alrm->crono) { @@ -571,8 +635,9 @@ bool thr_got_alarm(thr_alarm_t *alrm) } -void thr_end_alarm(thr_alarm_t *alrm) +void thr_end_alarm(thr_alarm_t *alrm_ptr) { + thr_alarm_t alrm= *alrm_ptr; if (alrm->crono) { KillTimer(NULL, alrm->crono); @@ -587,6 +652,13 @@ void end_thr_alarm(void) DBUG_VOID_RETURN; } +void init_thr_alarm(uint max_alarm) +{ + DBUG_ENTER("init_thr_alarm"); + alarm_aborted=0; /* Yes, Gimmie alarms */ + DBUG_VOID_RETURN; +} + #endif /* __WIN__ */ #endif /* THREAD */ @@ -634,12 +706,12 @@ static void *test_thread(void *arg) } else { - for (retry=0 ; !thr_got_alarm(got_alarm) && retry < 10 ; retry++) + for (retry=0 ; !thr_got_alarm(&got_alarm) && retry < 10 ; retry++) { printf("Thread: %s Waiting %d sec\n",my_thread_name(),wait_time); select(0,(fd_set_ptr) &fd,0,0,0); } - if (!thr_got_alarm(got_alarm)) + if (!thr_got_alarm(&got_alarm)) { printf("Thread: %s didn't get an alarm. Aborting!\n", my_thread_name()); |