Commit b87a116a authored by unknown's avatar unknown

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
parent 5c6f5b94
#ifndef NDBNET_H
#define NDBNET_H
#include <my_net.h>
#endif
......@@ -18,6 +18,7 @@
#define NDB_TCP_H
#include <ndb_global.h>
#include <ndb_net.h>
#if defined NDB_OSE || defined NDB_SOFTOSE
/**
......@@ -45,10 +46,6 @@ typedef int socklen_t;
/**
* Include files needed
*/
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#define NDB_NONBLOCK O_NONBLOCK
......@@ -75,12 +72,7 @@ typedef int socklen_t;
#endif
#ifndef NDB_MACOSX
#define NDB_SOCKLEN_T socklen_t
#else
#define NDB_SOCKLEN_T int
#endif
#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE
#ifdef __cplusplus
extern "C" {
......
......@@ -17,8 +17,7 @@
#ifndef NDB_THREAD_H
#define NDB_THREAD_H
#include <sys/types.h>
#include <ndb_global.h>
#ifdef __cplusplus
extern "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,52 +73,24 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
if (p_cond == NULL || p_mutex == NULL)
return 1;
#ifdef HAVE_CLOCK_GETTIME
clock_gettime(CLOCK_REALTIME, &abstime);
if(msecs >= 1000){
secs = msecs / 1000;
msecs = msecs % 1000;
}
abstime.tv_sec += secs;
abstime.tv_nsec += 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
#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;
#else
{
struct timeval tick_time;
int secs = 0;
if (p_cond == NULL || p_mutex == NULL)
return 1;
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;
msecs = msecs % 1000;
}
abstime.tv_sec = tick_time.tv_sec + secs;
abstime.tv_nsec = tick_time.tv_usec * 1000 + msecs * 1000000;
abstime.tv_sec += secs;
abstime.tv_nsec += msecs * 1000000;
if (abstime.tv_nsec >= 1000000000) {
abstime.tv_sec += 1;
abstime.tv_nsec -= 1000000000;
......@@ -129,8 +100,6 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
return result;
}
#endif
int
NdbCondition_Signal(struct NdbCondition* p_cond){
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment