diff options
author | unknown <tomas@mc05.(none)> | 2004-05-11 14:39:17 +0200 |
---|---|---|
committer | unknown <tomas@mc05.(none)> | 2004-05-11 14:39:17 +0200 |
commit | f23d1ad6c2f2fb9e4e6204936eb07e902320f03d (patch) | |
tree | b5f87d617dfbc3714d6b98881021aa0f06a7811d /ndb/src | |
parent | ce2d84ce40571d7bdff9ed9d1237a78b66729e30 (diff) | |
download | mariadb-git-f23d1ad6c2f2fb9e4e6204936eb07e902320f03d.tar.gz |
lots of HAVE_ and some ndb_global fixes for ndb subtree
ndb/include/portlib/NdbTCP.h:
introduced ndb_net.h
ndb/include/portlib/NdbThread.h:
ndb_global
ndb/src/common/portlib/unix/NdbCondition.c:
Used HAVE_CLOCK_GETTIME
ndb/src/common/portlib/unix/NdbMem.c:
used HAVE_MLOCKALL
ndb/src/common/portlib/unix/NdbSleep.c:
ndb_global
ndb/src/common/portlib/unix/NdbThread.c:
.
ndb/src/common/portlib/unix/NdbTick.c:
HAVE_CLOCK_GETTIME
ndb/src/kernel/vm/Emulator.cpp:
ndb_global
Diffstat (limited to 'ndb/src')
-rw-r--r-- | ndb/src/common/portlib/unix/NdbCondition.c | 49 | ||||
-rw-r--r-- | ndb/src/common/portlib/unix/NdbMem.c | 8 | ||||
-rw-r--r-- | ndb/src/common/portlib/unix/NdbSleep.c | 12 | ||||
-rw-r--r-- | ndb/src/common/portlib/unix/NdbThread.c | 5 | ||||
-rw-r--r-- | ndb/src/common/portlib/unix/NdbTick.c | 10 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Emulator.cpp | 6 |
6 files changed, 19 insertions, 71 deletions
diff --git a/ndb/src/common/portlib/unix/NdbCondition.c b/ndb/src/common/portlib/unix/NdbCondition.c index 024c6b433f3..9615e107d0c 100644 --- a/ndb/src/common/portlib/unix/NdbCondition.c +++ b/ndb/src/common/portlib/unix/NdbCondition.c @@ -61,7 +61,6 @@ NdbCondition_Wait(struct NdbCondition* p_cond, return result; } -#if defined NDB_SOLARIS || defined NDB_HPUX #include <time.h> int NdbCondition_WaitTimeout(struct NdbCondition* p_cond, @@ -74,7 +73,16 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, if (p_cond == NULL || p_mutex == NULL) return 1; +#ifdef HAVE_CLOCK_GETTIME clock_gettime(CLOCK_REALTIME, &abstime); +#else + { + struct timeval tick_time; + gettimeofday(&tick_time, 0); + abstime.tv_sec = tick_time.tv_sec; + abstime.tv_nsec = tick_time.tv_usec * 1000; + } +#endif if(msecs >= 1000){ secs = msecs / 1000; @@ -92,45 +100,6 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, return result; } -#endif - -#if defined NDB_LINUX || defined NDB_MACOSX -#include <unistd.h> -#include <sys/time.h> - -int -NdbCondition_WaitTimeout(struct NdbCondition* p_cond, - NdbMutex* p_mutex, - int msecs){ - int result; - struct timespec abstime; - struct timeval tick_time; - int secs = 0; - - if (p_cond == NULL || p_mutex == NULL) - return 1; - - gettimeofday(&tick_time, 0); - - if(msecs >= 1000){ - secs = msecs / 1000; - msecs = msecs % 1000; - } - - - abstime.tv_sec = tick_time.tv_sec + secs; - abstime.tv_nsec = tick_time.tv_usec * 1000 + msecs * 1000000; - if (abstime.tv_nsec >= 1000000000) { - abstime.tv_sec += 1; - abstime.tv_nsec -= 1000000000; - } - - result = pthread_cond_timedwait(&p_cond->cond, p_mutex, &abstime); - - return result; -} -#endif - int NdbCondition_Signal(struct NdbCondition* p_cond){ diff --git a/ndb/src/common/portlib/unix/NdbMem.c b/ndb/src/common/portlib/unix/NdbMem.c index aa3663e064f..4ddb5b52ecd 100644 --- a/ndb/src/common/portlib/unix/NdbMem.c +++ b/ndb/src/common/portlib/unix/NdbMem.c @@ -54,16 +54,16 @@ void NdbMem_Free(void* ptr) int NdbMem_MemLockAll(){ -#if defined NDB_MACOSX - return 0; +#ifdef HAVE_MLOCKALL + return -1; #else return mlockall(MCL_CURRENT); #endif } int NdbMem_MemUnlockAll(){ -#if defined NDB_MACOSX - return 0; +#ifdef HAVE_MLOCKALL + return -1; #else return munlockall(); #endif diff --git a/ndb/src/common/portlib/unix/NdbSleep.c b/ndb/src/common/portlib/unix/NdbSleep.c index 35132d7f9c7..8702a25d1b1 100644 --- a/ndb/src/common/portlib/unix/NdbSleep.c +++ b/ndb/src/common/portlib/unix/NdbSleep.c @@ -15,19 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbSleep.h" - -#ifdef NDB_SOLARIS -#include <sys/types.h> -#include <unistd.h> -#endif - -#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX -#include <time.h> -#include <unistd.h> -#endif - int NdbSleep_MilliSleep(int milliseconds){ int result = 0; diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/unix/NdbThread.c index dbb3da03eab..7f043bef56e 100644 --- a/ndb/src/common/portlib/unix/NdbThread.c +++ b/ndb/src/common/portlib/unix/NdbThread.c @@ -16,9 +16,8 @@ #include <ndb_global.h> - -#include "NdbThread.h" -#include <pthread.h> +#include <NdbThread.h> +#include <my_pthread.h> #define MAX_THREAD_NAME 16 diff --git a/ndb/src/common/portlib/unix/NdbTick.c b/ndb/src/common/portlib/unix/NdbTick.c index f4cda6449d6..d8f0b6ec27a 100644 --- a/ndb/src/common/portlib/unix/NdbTick.c +++ b/ndb/src/common/portlib/unix/NdbTick.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbTick.h" -#include <time.h> #define NANOSEC_PER_SEC 1000000000 #define MICROSEC_PER_SEC 1000000 @@ -25,7 +25,7 @@ #define MILLISEC_PER_NANOSEC 1000000 -#if defined NDB_SOLARIS || NDB_HPUX +#ifdef HAVE_CLOCK_GETTIME NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timespec tick_time; @@ -44,11 +44,7 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){ * micros = t.tv_nsec / 1000; return res; } -#endif - -#if defined NDB_LINUX || NDB_MACOSX -#include <unistd.h> -#include <sys/time.h> +#else NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timeval tick_time; diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 7eae1f519c0..0d6d3f55acb 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -39,12 +39,6 @@ extern "C" { extern void (* ndb_new_handler)(); } - -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) -#include <sys/types.h> -#include <sys/wait.h> -#endif - /** * Declare the global variables */ |