From f2cbfb80a7642eccae891aba6a50e52b4edcfda1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Nov 2004 21:38:42 +0100 Subject: [PATCH] wl1744 - ndb win-port ndb/include/ndbapi/NdbDictionary.hpp: win-port ndb/include/ndbapi/ndb_cluster_connection.hpp: win-port ndb/include/util/SocketServer.hpp: win-port ndb/src/common/portlib/win32/NdbCondition.c: win-port ndb/src/common/portlib/win32/NdbEnv.c: win-port ndb/src/common/portlib/win32/NdbHost.c: win-port ndb/src/common/portlib/win32/NdbMem.c: win-port ndb/src/common/portlib/win32/NdbMutex.c: win-port ndb/src/common/portlib/win32/NdbSleep.c: win-port ndb/src/common/portlib/win32/NdbTCP.c: win-port ndb/src/common/portlib/win32/NdbThread.c: win-port ndb/src/common/portlib/win32/NdbTick.c: win-port ndb/src/common/util/File.cpp: win-port ndb/src/mgmsrv/ConfigInfo.cpp: win-port ndb/src/mgmsrv/InitConfigFileParser.cpp: win-port ndb/src/mgmsrv/MgmtSrvr.cpp: win-port ndb/src/mgmsrv/MgmtSrvr.hpp: win-port ndb/src/mgmsrv/Services.cpp: win-port ndb/src/mgmsrv/Services.hpp: win-port ndb/src/mgmsrv/SignalQueue.hpp: win-port ndb/src/ndbapi/NdbDictionaryImpl.hpp: win-port ndb/test/src/NdbRestarts.cpp: win-port --- ndb/include/ndbapi/NdbDictionary.hpp | 2 +- ndb/include/ndbapi/ndb_cluster_connection.hpp | 4 +- ndb/include/util/SocketServer.hpp | 2 +- ndb/src/common/portlib/win32/NdbCondition.c | 8 +-- ndb/src/common/portlib/win32/NdbEnv.c | 4 +- ndb/src/common/portlib/win32/NdbHost.c | 3 +- ndb/src/common/portlib/win32/NdbMem.c | 58 +++++++++++++++++-- ndb/src/common/portlib/win32/NdbMutex.c | 8 +-- ndb/src/common/portlib/win32/NdbSleep.c | 5 +- ndb/src/common/portlib/win32/NdbTCP.c | 2 +- ndb/src/common/portlib/win32/NdbThread.c | 8 +-- ndb/src/common/portlib/win32/NdbTick.c | 4 +- ndb/src/common/util/File.cpp | 3 +- ndb/src/mgmsrv/ConfigInfo.cpp | 2 +- ndb/src/mgmsrv/InitConfigFileParser.cpp | 2 +- ndb/src/mgmsrv/MgmtSrvr.cpp | 6 +- ndb/src/mgmsrv/MgmtSrvr.hpp | 2 +- ndb/src/mgmsrv/Services.cpp | 6 +- ndb/src/mgmsrv/Services.hpp | 2 +- ndb/src/mgmsrv/SignalQueue.hpp | 12 ++-- ndb/src/ndbapi/NdbDictionaryImpl.hpp | 2 +- ndb/test/src/NdbRestarts.cpp | 2 +- 22 files changed, 85 insertions(+), 62 deletions(-) diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index a3115076624..217243071d0 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -710,7 +710,7 @@ public: /** * Get a specific column in the index */ - const NdbDictionary::Column * getColumn(unsigned no) const ; + const Column * getColumn(unsigned no) const ; /** * Get a specific column name in the index diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp index f8e6f25ce73..6e24e084f58 100644 --- a/ndb/include/ndbapi/ndb_cluster_connection.hpp +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -19,9 +19,9 @@ #define CLUSTER_CONNECTION_HPP class TransporterFacade; -class LocalConfig; +struct LocalConfig; class ConfigRetriever; -class NdbThread; +struct NdbThread; extern "C" { void* run_ndb_cluster_connection_connect_thread(void*); diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp index 2fad991e5f8..9d8af204391 100644 --- a/ndb/include/util/SocketServer.hpp +++ b/ndb/include/util/SocketServer.hpp @@ -98,7 +98,7 @@ public: */ void stopSessions(bool wait = false); - void foreachSession(void (*f)(SocketServer::Session*, void*), void *data); + void foreachSession(void (*f)(Session*, void*), void *data); private: struct SessionInstance { diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c index 12b508cf33b..4046db1d60a 100644 --- a/ndb/src/common/portlib/win32/NdbCondition.c +++ b/ndb/src/common/portlib/win32/NdbCondition.c @@ -15,16 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include - +#include #include "NdbCondition.h" #include - struct NdbCondition { long nWaiters; diff --git a/ndb/src/common/portlib/win32/NdbEnv.c b/ndb/src/common/portlib/win32/NdbEnv.c index 0df703a5e97..f42e685fe15 100644 --- a/ndb/src/common/portlib/win32/NdbEnv.c +++ b/ndb/src/common/portlib/win32/NdbEnv.c @@ -14,10 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#include #include "NdbEnv.h" -#include -#include const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) { diff --git a/ndb/src/common/portlib/win32/NdbHost.c b/ndb/src/common/portlib/win32/NdbHost.c index f91dd1a531c..7df96c45991 100644 --- a/ndb/src/common/portlib/win32/NdbHost.c +++ b/ndb/src/common/portlib/win32/NdbHost.c @@ -15,9 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NdbHost.h" -#include -#include int NdbHost_GetHostName(char* buf) diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c index 274dc31353f..313ca9dff66 100644 --- a/ndb/src/common/portlib/win32/NdbMem.c +++ b/ndb/src/common/portlib/win32/NdbMem.c @@ -14,14 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include -#include -#include - +#include #include "NdbMem.h" - +#if 0 struct AWEINFO { SIZE_T dwSizeInBytesRequested; @@ -235,3 +231,53 @@ int NdbMem_MemUnlockAll() return -1; } +#endif + +void NdbMem_Create() +{ + /* Do nothing */ + return; +} + +void NdbMem_Destroy() +{ + /* Do nothing */ + return; +} + + +void* NdbMem_Allocate(size_t size) +{ + void* mem_allocated; + assert(size > 0); + mem_allocated= (void*)malloc(size); + return mem_allocated; +} + +void* NdbMem_AllocateAlign(size_t size, size_t alignment) +{ + (void)alignment; /* remove warning for unused parameter */ + /* + return (void*)memalign(alignment, size); + TEMP fix + */ + return (void*)malloc(size); +} + + +void NdbMem_Free(void* ptr) +{ + free(ptr); +} + + +int NdbMem_MemLockAll() +{ + return 0; +} + +int NdbMem_MemUnlockAll() +{ + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c index c93384d91db..83c126abd4d 100644 --- a/ndb/src/common/portlib/win32/NdbMutex.c +++ b/ndb/src/common/portlib/win32/NdbMutex.c @@ -15,15 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include - +#include #include "NdbMutex.h" - NdbMutex* NdbMutex_Create(void) { NdbMutex* pNdbMutex = (NdbMutex*)malloc(sizeof(NdbMutex)); diff --git a/ndb/src/common/portlib/win32/NdbSleep.c b/ndb/src/common/portlib/win32/NdbSleep.c index ac0f44dd07f..8f5bdc49acd 100644 --- a/ndb/src/common/portlib/win32/NdbSleep.c +++ b/ndb/src/common/portlib/win32/NdbSleep.c @@ -14,12 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#include #include "NdbSleep.h" -#include - - int NdbSleep_MilliSleep(int milliseconds) { diff --git a/ndb/src/common/portlib/win32/NdbTCP.c b/ndb/src/common/portlib/win32/NdbTCP.c index 483a53bd606..b936cd2db6c 100644 --- a/ndb/src/common/portlib/win32/NdbTCP.c +++ b/ndb/src/common/portlib/win32/NdbTCP.c @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#include #include "NdbTCP.h" int diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c index ae3c74be70d..98db0d5c287 100644 --- a/ndb/src/common/portlib/win32/NdbThread.c +++ b/ndb/src/common/portlib/win32/NdbThread.c @@ -14,13 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include -#include -#include - +#include #include "NdbThread.h" - +#include #define MAX_THREAD_NAME 16 diff --git a/ndb/src/common/portlib/win32/NdbTick.c b/ndb/src/common/portlib/win32/NdbTick.c index e3a67d8437d..4430cbf419b 100644 --- a/ndb/src/common/portlib/win32/NdbTick.c +++ b/ndb/src/common/portlib/win32/NdbTick.c @@ -14,9 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include +#include #include "NdbTick.h" +//#include /* #define FILETIME_PER_MICROSEC 10 diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index 15698db3bc9..937b8c0fa59 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -17,6 +17,7 @@ #include #include + #include #include @@ -28,13 +29,11 @@ bool File_class::exists(const char* aFileName) { bool rc = true; - #ifdef USE_MY_STAT_STRUCT struct my_stat stmp; #else struct stat stmp; #endif - if (my_stat(aFileName, &stmp, MYF(0)) != 0) { rc = false; diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index 41280b907c4..486e152819a 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -3177,7 +3177,7 @@ transform(InitConfigFileParser::Context & ctx, Uint64 oldVal; require(ctx.m_currentSection->get(oldName, &oldVal)); - Uint64 newVal = (Uint64)(oldVal * mul + add); + Uint64 newVal = (Uint64)((Int64)oldVal * mul + add); if(!ctx.m_info->verify(ctx.m_currentInfo, newName, newVal)){ ctx.reportError("Unable to handle deprication, new value not within bounds" "%s %s - [%s] starting at line: %d", diff --git a/ndb/src/mgmsrv/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp index adbcd8c4256..01d5afae381 100644 --- a/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -386,7 +386,7 @@ bool InitConfigFileParser::convertStringToUint64(const char* s, errno = 0; char* p; - long long v = strtoll(s, &p, log10base); + Int64 v = strtoll(s, &p, log10base); if (errno != 0) return false; diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 2bd2a564223..e86cfcb8e4b 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -124,7 +124,7 @@ MgmtSrvr::signalRecvThreadRun() while(!_isStopThread) { SigMatch *handler = NULL; NdbApiSignal *signal = NULL; - if(m_signalRecvQueue.waitFor(siglist, handler, signal, DEFAULT_TIMEOUT)) { + if(m_signalRecvQueue.waitFor(siglist, &handler, &signal, DEFAULT_TIMEOUT)) { if(handler->function != 0) (this->*handler->function)(signal); } @@ -2652,7 +2652,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, int p_type; unsigned val_32; - unsigned long long val_64; + Uint64 val_64; const char * val_char; do { p_type = 0; @@ -2714,7 +2714,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value, template class Vector; #if __SUNPRO_CC != 0x560 -template bool SignalQueue::waitFor(Vector&, SigMatch*&, NdbApiSignal*&, unsigned); +template bool SignalQueue::waitFor(Vector&, SigMatch**, NdbApiSignal**, unsigned); #endif template class MutexVector; diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index b3257491123..c70b6a0a90f 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -663,7 +663,7 @@ private: */ static void signalReceivedNotification(void* mgmtSrvr, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); + struct LinearSectionPtr ptr[3]); /** * Called from "outside" of MgmtSrvr when a DB process has died. diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 0394c4e80bb..47dde6c11d3 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -29,7 +29,7 @@ #include #include - +#include #include "Services.hpp" extern bool g_StopServer; @@ -282,8 +282,8 @@ MgmApiSession::runSession() { /* Backwards compatibility for old NDBs that still use * the old "GET CONFIG" command. */ - - for(size_t i=0; i bool waitFor(Vector &t, - T *&handler, - NdbApiSignal *&signal, + T **handler, + NdbApiSignal **signal, Uint32 timeout = DEFAULT_TIMEOUT); private: NdbMutex *m_mutex; /* Locks all data in SignalQueue */ @@ -75,8 +75,8 @@ private: template bool SignalQueue::waitFor(Vector &t, - T *&handler, - NdbApiSignal *&signal, + T **handler, + NdbApiSignal **signal, Uint32 timeout) { Guard g(m_mutex); @@ -88,8 +88,8 @@ SignalQueue::waitFor(Vector &t, for(size_t i = 0; i < t.size(); i++) { if(t[i].check(m_signalQueueHead->signal)) { - handler = &t[i]; - signal = pop(); + * handler = &t[i]; + * signal = pop(); return true; } } diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index 62d2a951f28..a47dae1bbb1 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -321,7 +321,7 @@ private: friend class Ndb; static void execSignal(void* dictImpl, class NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); + struct LinearSectionPtr ptr[3]); static void execNodeStatus(void* dictImpl, Uint32, bool alive, bool nfCompleted); diff --git a/ndb/test/src/NdbRestarts.cpp b/ndb/test/src/NdbRestarts.cpp index b649a60d98b..607e48c4126 100644 --- a/ndb/test/src/NdbRestarts.cpp +++ b/ndb/test/src/NdbRestarts.cpp @@ -445,7 +445,7 @@ int twoNodeFailure(NdbRestarter& _restarter, << ") secs " << endl; NdbSleep_SecSleep(seconds); - randomId = (random() % _restarter.getNumDbNodes()); + randomId = (rand() % _restarter.getNumDbNodes()); nodeId = _restarter.getDbNodeId(randomId); g_info << _restart->m_name << ": node = "<< nodeId << endl;