From 1af1c70d711d1934dad41cec1d5dc55c4fdb4d71 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Dec 2001 15:00:14 +0200 Subject: [PATCH] Portability fixes include/my_pthread.h: Fix for HPUX mysql-test/mysql-test-run.sh: Wait for socket instead of pid file mysys/my_static.c: Portability fix (for OSF1) mysys/raid.cc: Portability fix (for OSF1) sql/mysqld.cc: Fixed typo for FreeBSD. strings/bcmp.c: Fix for purify --- include/my_pthread.h | 2 ++ mysql-test/mysql-test-run.sh | 13 ++++++------- mysys/my_static.c | 7 +++++++ mysys/raid.cc | 2 -- sql/mysqld.cc | 2 +- strings/bcmp.c | 17 ++++++++--------- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index bee5f5d92f4..e6cd039c80e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -448,6 +448,8 @@ struct hostent *my_gethostbyname_r(const char *name, #if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) #define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)) +int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime); #endif /* safe_mutex adds checking to mutex for easier debugging */ diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 932b063cbcf..76071da5b43 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -30,7 +30,7 @@ which () do for dir in $PATH do - if test -f $dir/$file + if test -e $dir/$file then echo "$dir/$file" continue 2 @@ -49,8 +49,7 @@ sleep_until_file_deleted () loop=$SLEEP_TIME_FOR_DELETE while (test $loop -gt 0) do - sleep 1 - if [ ! -f $file ] + if [ ! -e $file ] then return fi @@ -65,11 +64,11 @@ sleep_until_file_exists () org_time=$2 while (test $loop -gt 0) do - sleep 1 - if [ -f $file ] + if [ -e $file ] then return fi + sleep 1 loop=`expr $loop - 1` done echo "ERROR: $file was not created in $org_time seconds; Aborting" @@ -772,7 +771,7 @@ EOF else manager_launch master $MYSQLD $master_args fi - sleep_until_file_exists $MASTER_MYPID $wait_for_master + sleep_until_file_exists $MASTER_MYSOCK $wait_for_master wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER MASTER_RUNNING=1 } @@ -872,7 +871,7 @@ start_slave() manager_launch $slave_ident $SLAVE_MYSQLD $slave_args fi eval "SLAVE$1_RUNNING=1" - sleep_until_file_exists $slave_pid $wait_for_slave + sleep_until_file_exists $slave_sock $wait_for_slave wait_for_slave=$SLEEP_TIME_FOR_SECOND_SLAVE } diff --git a/mysys/my_static.c b/mysys/my_static.c index 61c719bcb81..1eb6220f185 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -82,6 +82,13 @@ struct remember *pRememberRoot = NULL; int volatile my_have_got_alarm=0; /* declare variable to reset */ ulong my_time_to_wait_for_lock=2; /* In seconds */ + /* + We need to have this define here as otherwise linking will fail + on OSF1 when compiling --without-raid --with-debug + */ + +const char *raid_type_string[]={"none","striped"}; + /* from errors.c */ #ifdef SHARED_LIBRARY char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */ diff --git a/mysys/raid.cc b/mysys/raid.cc index 9809086a622..72d3b2074be 100644 --- a/mysys/raid.cc +++ b/mysys/raid.cc @@ -79,8 +79,6 @@ #include #include -const char *raid_type_string[]={"none","striped"}; - #if defined(USE_RAID) && !defined(MYSQL_CLIENT) #define RAID_SEEK_DONE ~(off_t) 0 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ab7c68f0742..c010a2c17f9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -117,7 +117,7 @@ inline void reset_floating_point_exceptions() #if defined(__i386__) fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ | FP_X_IMP)); -else +#else fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | FP_X_IMP)); #endif diff --git a/strings/bcmp.c b/strings/bcmp.c index 52f545e7b42..7b510258fef 100644 --- a/strings/bcmp.c +++ b/strings/bcmp.c @@ -18,12 +18,18 @@ bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are identical to the "len" bytes starting at "s2", non-zero if they are different. - Now only used with purify. + Now only used with purify because purify gives wrong warnings when + comparing a shorter string with bcmp. */ #include #include "m_string.h" +#ifdef HAVE_purify +#undef bcmp +#undef HAVE_BCMP +#endif + #if !defined(bcmp) && !defined(HAVE_BCMP) #if defined(MC68000) && defined(DS90) @@ -45,14 +51,7 @@ uint len; /* 0 <= len <= 65535 */ #else -#ifdef HAVE_purify -int my_bcmp(s1, s2, len) -#else -int bcmp(s1, s2, len) -#endif - register const char *s1; - register const char *s2; - register uint len; +int bcmp(register const char *s1,register const char *s2, register uint len) { while (len-- != 0 && *s1++ == *s2++) ; return len+1;