summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-12-17 03:02:58 +0200
committermonty@hundin.mysql.fi <>2001-12-17 03:02:58 +0200
commit4dbd9e061c35d79e96079b05408dd584c09f2c15 (patch)
tree941257314e6e021bd649a4b42156be700895e6a0 /mysys
parentfc3e066f36e3b084674cbb9f3febb67e0ddbbc09 (diff)
downloadmariadb-git-4dbd9e061c35d79e96079b05408dd584c09f2c15.tar.gz
Lots of portability fixes.
Fixed shutdown on HPUX. Fixed bug in query cache.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_pthread.c22
-rw-r--r--mysys/raid.cc8
-rw-r--r--mysys/thr_mutex.c10
3 files changed, 27 insertions, 13 deletions
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index aeac95627dd..161e4faaff6 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -16,6 +16,7 @@
/* Functions to get threads more portable */
+#define DONT_REMAP_PTHREAD_FUNCTIONS
#include "mysys_priv.h"
#ifdef THREAD
#include <signal.h>
@@ -460,6 +461,27 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
#endif
+/*****************************************************************************
+ Patches for HPUX
+ We need these because the pthread_mutex.. code returns -1 on error,
+ instead of the error code.
+
+ Note that currently we only remap pthread_ functions used by MySQL.
+ If we are depending on the value for some other pthread_xxx functions,
+ this has to be added here.
+*****************************************************************************/
+
+int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
+ struct timespec *abstime)
+{
+ int error=pthread_cond_timedwait(cond, mutex, abstime);
+ if (error == -1) /* Safety if the lib is fixed */
+ error=errno;
+ if (error == EAGAIN) /* Correct errno to Posix */
+ error=ETIMEDOUT;
+ return error;
+}
+
/* Some help functions */
diff --git a/mysys/raid.cc b/mysys/raid.cc
index d48bf9db953..9809086a622 100644
--- a/mysys/raid.cc
+++ b/mysys/raid.cc
@@ -81,14 +81,6 @@
const char *raid_type_string[]={"none","striped"};
-
-extern "C" {
- const char *my_raid_type(int raid_type)
- {
- return raid_type_string[raid_type];
- }
-}
-
#if defined(USE_RAID) && !defined(MYSQL_CLIENT)
#define RAID_SEEK_DONE ~(off_t) 0
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index adb67ae95c5..5353e58ba2d 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -107,7 +107,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
error=pthread_mutex_unlock(&mp->mutex);
if (error)
{
- fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
+ fprintf(stderr,"safe_mutex: Got error: %d (%d) when trying to unlock mutex at %s, line %d\n", error, errno, file, line);
fflush(stderr);
abort();
}
@@ -148,7 +148,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
pthread_mutex_lock(&mp->global);
if (error)
{
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_wait at %s, line %d\n", error, file, line);
+ fprintf(stderr,"safe_mutex: Got error: %d (%d) when doing a safe_mutex_wait at %s, line %d\n", error, errno, file, line);
fflush(stderr);
abort();
}
@@ -186,15 +186,15 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#ifdef EXTRA_DEBUG
if (error && (error != EINTR && error != ETIMEDOUT))
{
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_timedwait at %s, line %d\n", error, file, line);
+ fprintf(stderr,"safe_mutex: Got error: %d (%d) when doing a safe_mutex_timedwait at %s, line %d\n", error, errno, file, line);
}
#endif
pthread_mutex_lock(&mp->global);
if (mp->count++)
{
fprintf(stderr,
- "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)\n",
- mp->count-1, my_thread_id(), file, line, error);
+ "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d (%d))\n",
+ mp->count-1, my_thread_id(), file, line, error, error);
fflush(stderr);
abort();
}