diff options
author | msvensson@neptunus.(none) <> | 2005-04-27 09:59:12 +0200 |
---|---|---|
committer | msvensson@neptunus.(none) <> | 2005-04-27 09:59:12 +0200 |
commit | f3c72cc8914f309c45f35fe857348989f165e8f0 (patch) | |
tree | e08fea906b88d0aa8efd72835e8cea713d2ce9cd | |
parent | 71c7c0d341b41d18127cd91bd1ae293eb4af8240 (diff) | |
download | mariadb-git-f3c72cc8914f309c45f35fe857348989f165e8f0.tar.gz |
Bug #9954 mysql-4.1.11/cmd-line-utils/libedit/makelist.sh is not portable
- Changed makelist.sh
- Bump up required version of autoconf
- Use new style to init mutex in my_thr_init
-rw-r--r-- | cmd-line-utils/libedit/makelist.sh | 7 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | include/my_pthread.h | 12 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 28 |
4 files changed, 20 insertions, 29 deletions
diff --git a/cmd-line-utils/libedit/makelist.sh b/cmd-line-utils/libedit/makelist.sh index b2502d16ed1..502604791f5 100644 --- a/cmd-line-utils/libedit/makelist.sh +++ b/cmd-line-utils/libedit/makelist.sh @@ -68,7 +68,7 @@ case $FLAG in /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { - name = substr($2, 1, length($2) - 3); + name = substr($2, 1, index($2,"(") - 1); # # XXX: need a space between name and prototype so that -fc and -fh # parsing is much easier @@ -97,7 +97,7 @@ case $FLAG in /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { - name = substr($2, 1, length($2) - 3); + name = substr($2, 1, index($2,"(") - 1); uname = ""; fname = ""; for (i = 1; i <= length(name); i++) { @@ -117,6 +117,7 @@ case $FLAG in printf(" \""); for (i = 2; i < NF; i++) printf("%s ", $i); + sub("\r", "", $i); printf("%s\" },\n", $i); ok = 0; } @@ -219,7 +220,7 @@ case $FLAG in /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { - name = substr($2, 1, length($2) - 3); + name = substr($2, 1, index($2, "(") - 1); fname = ""; for (i = 1; i <= length(name); i++) { s = substr(name, i, 1); diff --git a/configure.in b/configure.in index d191463d0f9..87f7033309e 100644 --- a/configure.in +++ b/configure.in @@ -118,7 +118,7 @@ AC_SUBST(SAVE_LDFLAGS) AC_SUBST(SAVE_CXXLDFLAGS) AC_SUBST(CXXLDFLAGS) -AC_PREREQ(2.12)dnl Minimum Autoconf version required. +AC_PREREQ(2.58)dnl Minimum Autoconf version required. #AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE AM_SANITY_CHECK diff --git a/include/my_pthread.h b/include/my_pthread.h index f8cd3e0de71..b5b282238ba 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -604,19 +604,13 @@ extern int my_rw_trywrlock(my_rw_lock_t *); #define pthread_attr_setstacksize(A,B) pthread_dummy(0) #endif -/* Define mutex types */ +/* Define mutex types, see my_thr_init.c */ #define MY_MUTEX_INIT_SLOW NULL -#define MY_MUTEX_INIT_FAST NULL -#define MY_MUTEX_INIT_ERRCHK NULL #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP extern pthread_mutexattr_t my_fast_mutexattr; -#undef MY_MUTEX_INIT_FAST #define MY_MUTEX_INIT_FAST &my_fast_mutexattr -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -extern pthread_mutexattr_t my_errchk_mutexattr; -#undef MY_INIT_MUTEX_ERRCHK -#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr +#else +#define MY_MUTEX_INIT_FAST NULL #endif extern my_bool my_thread_global_init(void); diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 36b37f68b46..93ba34ea5b4 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -40,9 +40,6 @@ pthread_mutex_t LOCK_gethostbyname_r; #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP pthread_mutexattr_t my_fast_mutexattr; #endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -pthread_mutexattr_t my_errchk_mutexattr; -#endif /* initialize thread environment @@ -62,19 +59,21 @@ my_bool my_thread_global_init(void) fprintf(stderr,"Can't initialize threads: error %d\n",errno); return 1; } + #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - pthread_mutexattr_init(&my_fast_mutexattr); /* - Note that the following statement may give a compiler warning under - some configurations, but there isn't anything we can do about this as - this is a bug in the header files for the thread implementation + Set mutex type to "fast" a.k.a "adaptive" + + The mutex kind determines what happens if a thread attempts to lock + a mutex it already owns with pthread_mutex_lock(3). If the mutex + is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends + the calling thread forever. If the mutex is of the ``error checking'' + kind, pthread_mutex_lock(3) returns immediately with the error + code EDEADLK. */ - pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP); -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - pthread_mutexattr_init(&my_errchk_mutexattr); - pthread_mutexattr_setkind_np(&my_errchk_mutexattr, - PTHREAD_MUTEX_ERRORCHECK_NP); + pthread_mutexattr_init(&my_fast_mutexattr); + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); #endif pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST); @@ -109,9 +108,6 @@ void my_thread_global_end(void) #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP pthread_mutexattr_destroy(&my_fast_mutexattr); #endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - pthread_mutexattr_destroy(&my_errchk_mutexattr); -#endif pthread_mutex_destroy(&THR_LOCK_malloc); pthread_mutex_destroy(&THR_LOCK_open); pthread_mutex_destroy(&THR_LOCK_lock); |