diff options
author | unknown <joreland@mysql.com> | 2004-11-11 21:25:55 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2004-11-11 21:25:55 +0100 |
commit | 44af4e4a99e866dd6ee29809a1f1efd4f18ce3f8 (patch) | |
tree | 407fb5bb3e6aea352d458c813f4dd087a5651d9b | |
parent | d55be176d78a9cf853a92280b577fd2d33869bfb (diff) | |
download | mariadb-git-44af4e4a99e866dd6ee29809a1f1efd4f18ce3f8.tar.gz |
wl1744 - ndb on windoze
ndb/Makefile.am:
ndb-windows
ndb/src/Makefile.am:
ndb-windows
ndb/src/common/debugger/Makefile.am:
ndb-windows
ndb/src/common/debugger/signaldata/Makefile.am:
ndb-windows
ndb/src/common/logger/Makefile.am:
ndb-windows
ndb/src/common/mgmcommon/Makefile.am:
ndb-windows
ndb/src/common/portlib/Makefile.am:
ndb-windows
ndb/src/common/transporter/Makefile.am:
ndb-windows
ndb/src/common/util/File.cpp:
ndb-windows
ndb/src/common/util/Makefile.am:
ndb-windows
ndb/src/cw/cpcd/Makefile.am:
ndb-windows
ndb/src/kernel/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/backup/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/backup/restore/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/cmvmi/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbacc/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbdict/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbdih/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dblqh/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbtc/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbtup/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbtux/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/dbutil/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/grep/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/ndbcntr/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/ndbfs/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/qmgr/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/suma/Makefile.am:
ndb-windows
ndb/src/kernel/blocks/trix/Makefile.am:
ndb-windows
ndb/src/kernel/error/Makefile.am:
ndb-windows
ndb/src/kernel/vm/Makefile.am:
ndb-windows
ndb/src/mgmapi/Makefile.am:
ndb-windows
ndb/src/mgmsrv/InitConfigFileParser.cpp:
ndb-windows
ndb/src/mgmsrv/Makefile.am:
ndb-windows
ndb/src/mgmsrv/MgmtSrvr.cpp:
ndb-windows
ndb/src/ndbapi/Makefile.am:
ndb-windows
ndb/src/ndbapi/ndberror.c:
ndb-windows
ndb/test/include/NdbSchemaOp.hpp:
ndb-windows
ndb/test/run-test/Makefile.am:
ndb-windows
ndb/test/src/CpcClient.cpp:
ndb-windows
ndb/test/src/Makefile.am:
ndb-windows
ndb/test/src/NdbRestarter.cpp:
ndb-windows
ndb/test/src/getarg.c:
ndb-windows
53 files changed, 964 insertions, 82 deletions
diff --git a/ndb/Makefile.am b/ndb/Makefile.am index e4f21ac8040..a0b8efa7bb4 100644 --- a/ndb/Makefile.am +++ b/ndb/Makefile.am @@ -24,4 +24,6 @@ windoze: windoze-dsp: all-windoze-dsp: windoze - tar cvfz ndb-win-dsp.tar.gz `find . -name '*.dsp'` + find . -name '*.dsp' | xargs unix2dos + $(top_srcdir)/ndb/config/make-win-dsw.sh | unix2dos > ndb.dsw + tar cvfz ndb-win-dsp.tar.gz ndb.dsw `find . -name '*.dsp'` diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am index 07f6ea5d8d4..6f3ca744b0e 100644 --- a/ndb/src/Makefile.am +++ b/ndb/src/Makefile.am @@ -28,5 +28,6 @@ libndbclient.dsp: Makefile \ cat $(top_srcdir)/ndb/config/win-lib.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(ndblib_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(libndbclient_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(libndbclient_la_LIBADD) + @$(top_srcdir)/ndb/config/win-sources $@ dummy.cpp + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(libndbclient_la_LIBADD) + @touch dummy.cpp diff --git a/ndb/src/common/debugger/Makefile.am b/ndb/src/common/debugger/Makefile.am index 08251eb9155..e25a11c9bee 100644 --- a/ndb/src/common/debugger/Makefile.am +++ b/ndb/src/common/debugger/Makefile.am @@ -22,4 +22,4 @@ libtrace.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libtrace_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/debugger/signaldata/Makefile.am b/ndb/src/common/debugger/signaldata/Makefile.am index bc18e17fbb0..9146d552568 100644 --- a/ndb/src/common/debugger/signaldata/Makefile.am +++ b/ndb/src/common/debugger/signaldata/Makefile.am @@ -44,4 +44,4 @@ libsignaldataprint.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/logger/Makefile.am b/ndb/src/common/logger/Makefile.am index 90f3346b414..0af21f9fbde 100644 --- a/ndb/src/common/logger/Makefile.am +++ b/ndb/src/common/logger/Makefile.am @@ -1,8 +1,9 @@ noinst_LTLIBRARIES = liblogger.la -liblogger_la_SOURCES = Logger.cpp LogHandlerList.cpp LogHandler.cpp \ - ConsoleLogHandler.cpp FileLogHandler.cpp SysLogHandler.cpp +SOURCE_WIN = Logger.cpp LogHandlerList.cpp LogHandler.cpp \ + ConsoleLogHandler.cpp FileLogHandler.cpp +liblogger_la_SOURCES = $(SOURCE_WIN) SysLogHandler.cpp include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am @@ -20,5 +21,5 @@ liblogger.dsp: Makefile \ cat $(top_srcdir)/ndb/config/win-lib.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(liblogger_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-sources $@ $(SOURCE_WIN) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/mgmcommon/Makefile.am b/ndb/src/common/mgmcommon/Makefile.am index ebb89f8a251..b322af03268 100644 --- a/ndb/src/common/mgmcommon/Makefile.am +++ b/ndb/src/common/mgmcommon/Makefile.am @@ -26,4 +26,4 @@ libmgmsrvcommon.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libmgmsrvcommon_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/portlib/Makefile.am b/ndb/src/common/portlib/Makefile.am index fe69ef7346a..7717e1fcc27 100644 --- a/ndb/src/common/portlib/Makefile.am +++ b/ndb/src/common/portlib/Makefile.am @@ -16,6 +16,16 @@ PortLibTest_SOURCES = NdbPortLibTest.cpp munmaptest_SOURCES = munmaptest.cpp # Don't update the files from bitkeeper +WIN_src = win32/NdbCondition.c \ + win32/NdbDaemon.c \ + win32/NdbEnv.c \ + win32/NdbHost.c \ + win32/NdbMem.c \ + win32/NdbMutex.c \ + win32/NdbSleep.c \ + win32/NdbTCP.c \ + win32/NdbThread.c \ + win32/NdbTick.c windoze-dsp: libportlib.dsp @@ -28,5 +38,5 @@ libportlib.dsp: Makefile \ cat $(top_srcdir)/ndb/config/win-lib.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(libportlib_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-sources $@ $(WIN_src) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c new file mode 100644 index 00000000000..12b508cf33b --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbCondition.c @@ -0,0 +1,184 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <winsock2.h> +#include <ws2tcpip.h> +#include <windows.h> +#include <assert.h> +#include <sys/types.h> + +#include "NdbCondition.h" +#include <NdbMutex.h> + + +struct NdbCondition +{ + long nWaiters; + NdbMutex* pNdbMutexWaitersLock; + HANDLE hSemaphore; + HANDLE hEventWaitersDone; + int bWasBroadcast; +}; + + +struct NdbCondition* +NdbCondition_Create(void) +{ + int result = 0; + struct NdbCondition* pNdbCondition = (struct NdbCondition*)malloc(sizeof(struct NdbCondition)); + if(!pNdbCondition) + return 0; + + pNdbCondition->nWaiters = 0; + pNdbCondition->bWasBroadcast = 0; + if(!(pNdbCondition->hSemaphore = CreateSemaphore(0, 0, MAXLONG, 0))) + result = -1; + else if(!(pNdbCondition->pNdbMutexWaitersLock = NdbMutex_Create())) + result = -1; + else if(!(pNdbCondition->hEventWaitersDone = CreateEvent(0, 0, 0, 0))) + result = -1; + + assert(!result); + return pNdbCondition; +} + + +int +NdbCondition_Wait(struct NdbCondition* p_cond, + NdbMutex* p_mutex) +{ + int result; + int bLastWaiter; + if(!p_cond || !p_mutex) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + p_cond->nWaiters++; + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + + if(NdbMutex_Unlock(p_mutex)) + return -1; + result = WaitForSingleObject (p_cond->hSemaphore, INFINITE); + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + p_cond->nWaiters--; + bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0); + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + + if(result==WAIT_OBJECT_0 && bLastWaiter) + SetEvent(p_cond->hEventWaitersDone); + + NdbMutex_Lock(p_mutex); + return result; +} + + +int +NdbCondition_WaitTimeout(struct NdbCondition* p_cond, + NdbMutex* p_mutex, + int msecs) +{ + int result; + int bLastWaiter; + if (!p_cond || !p_mutex) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + p_cond->nWaiters++; + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + if(msecs<0) + msecs = 0; + + if(NdbMutex_Unlock(p_mutex)) + return -1; + result = WaitForSingleObject(p_cond->hSemaphore, msecs); + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + p_cond->nWaiters--; + bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0); + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + + if(result!=WAIT_OBJECT_0) + result = -1; + + if(bLastWaiter) + SetEvent(p_cond->hEventWaitersDone); + + NdbMutex_Lock(p_mutex); + return result; +} + + +int +NdbCondition_Signal(struct NdbCondition* p_cond) +{ + int bHaveWaiters; + if(!p_cond) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + bHaveWaiters = (p_cond->nWaiters > 0); + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + + if(bHaveWaiters) + return (ReleaseSemaphore(p_cond->hSemaphore, 1, 0) ? 0 : -1); + else + return 0; +} + + +int NdbCondition_Broadcast(struct NdbCondition* p_cond) +{ + int bHaveWaiters; + int result = 0; + if(!p_cond) + return 1; + + NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); + bHaveWaiters = 0; + if(p_cond->nWaiters > 0) + { + p_cond->bWasBroadcast = !0; + bHaveWaiters = 1; + } + NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); + if(bHaveWaiters) + { + if(!ReleaseSemaphore(p_cond->hSemaphore, p_cond->nWaiters, 0)) + result = -1; + else if(WaitForSingleObject (p_cond->hEventWaitersDone, INFINITE) != WAIT_OBJECT_0) + result = -1; + p_cond->bWasBroadcast = 0; + } + return result; +} + + +int NdbCondition_Destroy(struct NdbCondition* p_cond) +{ + int result; + if(!p_cond) + return 1; + + CloseHandle(p_cond->hEventWaitersDone); + NdbMutex_Destroy(p_cond->pNdbMutexWaitersLock); + result = (CloseHandle(p_cond->hSemaphore) ? 0 : -1); + + free(p_cond); + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbDaemon.c b/ndb/src/common/portlib/win32/NdbDaemon.c new file mode 100644 index 00000000000..b96d4c20260 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbDaemon.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "NdbDaemon.h" + +#define NdbDaemon_ErrorSize 500 +long NdbDaemon_DaemonPid; +int NdbDaemon_ErrorCode; +char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; + +int +NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) +{ + // XXX do something + return 0; +} + +#ifdef NDB_DAEMON_TEST + +int +main() +{ + if (NdbDaemon_Make("test.pid", "test.log", 0) == -1) { + fprintf(stderr, "NdbDaemon_Make: %s\n", NdbDaemon_ErrorText); + return 1; + } + sleep(10); + return 0; +} + +#endif diff --git a/ndb/src/common/portlib/win32/NdbEnv.c b/ndb/src/common/portlib/win32/NdbEnv.c new file mode 100644 index 00000000000..0df703a5e97 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbEnv.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "NdbEnv.h" +#include <string.h> +#include <stdlib.h> + +const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) +{ + char* p = NULL; + p = getenv(name); + + if (p != NULL && buf != NULL){ + strncpy(buf, p, buflen); + buf[buflen-1] = 0; + } + return p; +} + diff --git a/ndb/src/common/portlib/win32/NdbHost.c b/ndb/src/common/portlib/win32/NdbHost.c new file mode 100644 index 00000000000..f91dd1a531c --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbHost.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "NdbHost.h" +#include <windows.h> +#include <process.h> + + +int NdbHost_GetHostName(char* buf) +{ + /* We must initialize TCP/IP if we want to call gethostname */ + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = MAKEWORD( 2, 0 ); + err = WSAStartup( wVersionRequested, &wsaData ); + if ( err != 0 ) { + /** + * Tell the user that we couldn't find a usable + * WinSock DLL. + */ + return -1; + } + + /* Get host name */ + if(gethostname(buf, MAXHOSTNAMELEN)) + { + return -1; + } + return 0; +} + + +int NdbHost_GetProcessId(void) +{ + return _getpid(); +} + diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c new file mode 100644 index 00000000000..274dc31353f --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbMem.c @@ -0,0 +1,237 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <windows.h> +#include <assert.h> +#include <NdbStdio.h> + +#include "NdbMem.h" + + +struct AWEINFO +{ + SIZE_T dwSizeInBytesRequested; + ULONG_PTR nNumberOfPagesRequested; + ULONG_PTR nNumberOfPagesActual; + ULONG_PTR nNumberOfPagesFreed; + ULONG_PTR* pnPhysicalMemoryPageArray; + void* pRegionReserved; +}; + +const size_t cNdbMem_nMaxAWEinfo = 256; +size_t gNdbMem_nAWEinfo = 0; + +struct AWEINFO* gNdbMem_pAWEinfo = 0; + + +void ShowLastError(const char* szContext, const char* szFunction) +{ + DWORD dwError = GetLastError(); + LPVOID lpMsgBuf; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dwError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR)&lpMsgBuf, + 0, + NULL + ); + printf("%s : %s failed : %lu : %s\n", szContext, szFunction, dwError, (char*)lpMsgBuf); + LocalFree(lpMsgBuf); +} + + + +void NdbMem_Create() +{ + // Address Windowing Extensions + struct PRIVINFO + { + DWORD Count; + LUID_AND_ATTRIBUTES Privilege[1]; + } Info; + + HANDLE hProcess = GetCurrentProcess(); + HANDLE hToken; + if(!OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken)) + { + ShowLastError("NdbMem_Create", "OpenProcessToken"); + } + + Info.Count = 1; + Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; + if(!LookupPrivilegeValue(0, SE_LOCK_MEMORY_NAME, &(Info.Privilege[0].Luid))) + { + ShowLastError("NdbMem_Create", "LookupPrivilegeValue"); + } + + if(!AdjustTokenPrivileges(hToken, FALSE, (PTOKEN_PRIVILEGES)&Info, 0, 0, 0)) + { + ShowLastError("NdbMem_Create", "AdjustTokenPrivileges"); + } + + if(!CloseHandle(hToken)) + { + ShowLastError("NdbMem_Create", "CloseHandle"); + } + + return; +} + +void NdbMem_Destroy() +{ + /* Do nothing */ + return; +} + +void* NdbMem_Allocate(size_t size) +{ + // Address Windowing Extensions + struct AWEINFO* pAWEinfo; + HANDLE hProcess; + SYSTEM_INFO sysinfo; + + if(!gNdbMem_pAWEinfo) + { + gNdbMem_pAWEinfo = VirtualAlloc(0, + sizeof(struct AWEINFO)*cNdbMem_nMaxAWEinfo, + MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + } + + assert(gNdbMem_nAWEinfo < cNdbMem_nMaxAWEinfo); + pAWEinfo = gNdbMem_pAWEinfo+gNdbMem_nAWEinfo++; + + hProcess = GetCurrentProcess(); + GetSystemInfo(&sysinfo); + pAWEinfo->nNumberOfPagesRequested = (size+sysinfo.dwPageSize-1)/sysinfo.dwPageSize; + pAWEinfo->pnPhysicalMemoryPageArray = VirtualAlloc(0, + sizeof(ULONG_PTR)*pAWEinfo->nNumberOfPagesRequested, + MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + pAWEinfo->nNumberOfPagesActual = pAWEinfo->nNumberOfPagesRequested; + if(!AllocateUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesActual), pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Allocate", "AllocateUserPhysicalPages"); + return 0; + } + if(pAWEinfo->nNumberOfPagesRequested != pAWEinfo->nNumberOfPagesActual) + { + ShowLastError("NdbMem_Allocate", "nNumberOfPagesRequested != nNumberOfPagesActual"); + return 0; + } + + pAWEinfo->dwSizeInBytesRequested = size; + pAWEinfo->pRegionReserved = VirtualAlloc(0, pAWEinfo->dwSizeInBytesRequested, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE); + if(!pAWEinfo->pRegionReserved) + { + ShowLastError("NdbMem_Allocate", "VirtualAlloc"); + return 0; + } + + if(!MapUserPhysicalPages(pAWEinfo->pRegionReserved, pAWEinfo->nNumberOfPagesActual, pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Allocate", "MapUserPhysicalPages"); + return 0; + } + + /* + printf("allocate AWE memory: %lu bytes, %lu pages, address %lx\n", + pAWEinfo->dwSizeInBytesRequested, + pAWEinfo->nNumberOfPagesActual, + pAWEinfo->pRegionReserved); + */ + return pAWEinfo->pRegionReserved; +} + + +void* NdbMem_AllocateAlign(size_t size, size_t alignment) +{ + /* + return (void*)memalign(alignment, size); + TEMP fix + */ + return NdbMem_Allocate(size); +} + + +void NdbMem_Free(void* ptr) +{ + // VirtualFree(ptr, 0, MEM_DECOMMIT|MEM_RELEASE); + + // Address Windowing Extensions + struct AWEINFO* pAWEinfo = 0; + size_t i; + HANDLE hProcess; + + for(i=0; i<gNdbMem_nAWEinfo; ++i) + { + if(ptr==gNdbMem_pAWEinfo[i].pRegionReserved) + { + pAWEinfo = gNdbMem_pAWEinfo+i; + } + } + if(!pAWEinfo) + { + ShowLastError("NdbMem_Free", "ptr is not AWE memory"); + } + + hProcess = GetCurrentProcess(); + if(!MapUserPhysicalPages(ptr, pAWEinfo->nNumberOfPagesActual, 0)) + { + ShowLastError("NdbMem_Free", "MapUserPhysicalPages"); + } + + if(!VirtualFree(ptr, 0, MEM_RELEASE)) + { + ShowLastError("NdbMem_Free", "VirtualFree"); + } + + pAWEinfo->nNumberOfPagesFreed = pAWEinfo->nNumberOfPagesActual; + if(!FreeUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesFreed), pAWEinfo->pnPhysicalMemoryPageArray)) + { + ShowLastError("NdbMem_Free", "FreeUserPhysicalPages"); + } + + VirtualFree(pAWEinfo->pnPhysicalMemoryPageArray, 0, MEM_DECOMMIT|MEM_RELEASE); +} + + +int NdbMem_MemLockAll() +{ + /* + HANDLE hProcess = GetCurrentProcess(); + SIZE_T nMinimumWorkingSetSize; + SIZE_T nMaximumWorkingSetSize; + GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); + ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; + + SetProcessWorkingSetSize(hProcess, 50000000, 100000000); + + GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); + ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; + */ + return -1; +} + +int NdbMem_MemUnlockAll() +{ + //VirtualUnlock(); + return -1; +} + diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c new file mode 100644 index 00000000000..c93384d91db --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbMutex.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <winsock2.h> +#include <ws2tcpip.h> +#include <windows.h> +#include <time.h> +#include <assert.h> + +#include "NdbMutex.h" + + +NdbMutex* NdbMutex_Create(void) +{ + NdbMutex* pNdbMutex = (NdbMutex*)malloc(sizeof(NdbMutex)); + if(!pNdbMutex) + return 0; + + InitializeCriticalSection(pNdbMutex); + return pNdbMutex; +} + + +int NdbMutex_Destroy(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + DeleteCriticalSection(p_mutex); + free(p_mutex); + return 0; +} + + +int NdbMutex_Lock(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + EnterCriticalSection (p_mutex); + return 0; +} + + +int NdbMutex_Unlock(NdbMutex* p_mutex) +{ + if(!p_mutex) + return -1; + + LeaveCriticalSection(p_mutex); + return 0; +} + + +int NdbMutex_Trylock(NdbMutex* p_mutex) +{ + int result = -1; + if(p_mutex) + { + result = (TryEnterCriticalSection(p_mutex) ? 0 : -1); + } + return result; +} + diff --git a/ndb/src/common/portlib/win32/NdbSleep.c b/ndb/src/common/portlib/win32/NdbSleep.c new file mode 100644 index 00000000000..ac0f44dd07f --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbSleep.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "NdbSleep.h" + +#include <windows.h> + + +int +NdbSleep_MilliSleep(int milliseconds) +{ + Sleep(milliseconds); + return 0; +} + +int +NdbSleep_SecSleep(int seconds) +{ + return NdbSleep_MilliSleep(seconds*1000); +} + diff --git a/ndb/src/common/portlib/win32/NdbTCP.c b/ndb/src/common/portlib/win32/NdbTCP.c new file mode 100644 index 00000000000..483a53bd606 --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbTCP.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "NdbTCP.h" + +int +Ndb_getInAddr(struct in_addr * dst, const char *address) +{ + struct hostent * hostPtr; + + /* Try it as aaa.bbb.ccc.ddd. */ + dst->s_addr = inet_addr(address); + if (dst->s_addr != -1) { + return 0; + } + + hostPtr = gethostbyname(address); + if (hostPtr != NULL) { + dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; + return 0; + } + + return -1; +} + diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c new file mode 100644 index 00000000000..ae3c74be70d --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbThread.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <windows.h> +#include <process.h> +#include <assert.h> + +#include "NdbThread.h" + + +#define MAX_THREAD_NAME 16 + +typedef unsigned (WINAPI* NDB_WIN32_THREAD_FUNC)(void*); + + +struct NdbThread +{ + HANDLE hThread; + unsigned nThreadId; + char thread_name[MAX_THREAD_NAME]; +}; + + +struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, + NDB_THREAD_ARG *p_thread_arg, + const NDB_THREAD_STACKSIZE thread_stack_size, + const char* p_thread_name, + NDB_THREAD_PRIO thread_prio) +{ + struct NdbThread* tmpThread; + unsigned initflag; + int nPriority = 0; + + if(!p_thread_func) + return 0; + + tmpThread = (struct NdbThread*)malloc(sizeof(struct NdbThread)); + if(!tmpThread) + return 0; + + strncpy((char*)&tmpThread->thread_name, p_thread_name, MAX_THREAD_NAME); + + switch(thread_prio) + { + case NDB_THREAD_PRIO_HIGHEST: nPriority=THREAD_PRIORITY_HIGHEST; break; + case NDB_THREAD_PRIO_HIGH: nPriority=THREAD_PRIORITY_ABOVE_NORMAL; break; + case NDB_THREAD_PRIO_MEAN: nPriority=THREAD_PRIORITY_NORMAL; break; + case NDB_THREAD_PRIO_LOW: nPriority=THREAD_PRIORITY_BELOW_NORMAL; break; + case NDB_THREAD_PRIO_LOWEST: nPriority=THREAD_PRIORITY_LOWEST; break; + } + initflag = (nPriority ? CREATE_SUSPENDED : 0); + + tmpThread->hThread = (HANDLE)_beginthreadex(0, thread_stack_size, + (NDB_WIN32_THREAD_FUNC)p_thread_func, p_thread_arg, + initflag, &tmpThread->nThreadId); + + if(nPriority && tmpThread->hThread) + { + SetThreadPriority(tmpThread->hThread, nPriority); + ResumeThread (tmpThread->hThread); + } + + assert(tmpThread->hThread); + return tmpThread; +} + + +void NdbThread_Destroy(struct NdbThread** p_thread) +{ + CloseHandle((*p_thread)->hThread); + (*p_thread)->hThread = 0; + free(*p_thread); + *p_thread = 0; +} + + +int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) +{ + void *local_status = 0; + if (status == 0) + status = &local_status; + + if(WaitForSingleObject(p_wait_thread->hThread, INFINITE) == WAIT_OBJECT_0 + && GetExitCodeThread(p_wait_thread->hThread, (LPDWORD)status)) + { + CloseHandle(p_wait_thread->hThread); + p_wait_thread->hThread = 0; + return 0; + } + return -1; +} + + +void NdbThread_Exit(int status) +{ + _endthreadex((DWORD) status); +} + + +int NdbThread_SetConcurrencyLevel(int level) +{ + return 0; +} + diff --git a/ndb/src/common/portlib/win32/NdbTick.c b/ndb/src/common/portlib/win32/NdbTick.c new file mode 100644 index 00000000000..e3a67d8437d --- /dev/null +++ b/ndb/src/common/portlib/win32/NdbTick.c @@ -0,0 +1,64 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include <windows.h> +#include "NdbTick.h" + +/* +#define FILETIME_PER_MICROSEC 10 +#define FILETIME_PER_MILLISEC 10000 +#define FILETIME_PER_SEC 10000000 + + +NDB_TICKS NdbTick_CurrentMillisecond(void) +{ + ULONGLONG ullTime; + GetSystemTimeAsFileTime((LPFILETIME)&ullTime); + return (ullTime / FILETIME_PER_MILLISEC); +} + +int +NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros) +{ + ULONGLONG ullTime; + GetSystemTimeAsFileTime((LPFILETIME)&ullTime); + *secs = (ullTime / FILETIME_PER_SEC); + *micros = (Uint32)((ullTime % FILETIME_PER_SEC) / FILETIME_PER_MICROSEC); + return 0; +} +*/ + + +NDB_TICKS NdbTick_CurrentMillisecond(void) +{ + LARGE_INTEGER liCount, liFreq; + QueryPerformanceCounter(&liCount); + QueryPerformanceFrequency(&liFreq); + return (liCount.QuadPart*1000) / liFreq.QuadPart; +} + +int +NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros) +{ + LARGE_INTEGER liCount, liFreq; + QueryPerformanceCounter(&liCount); + QueryPerformanceFrequency(&liFreq); + *secs = liCount.QuadPart / liFreq.QuadPart; + liCount.QuadPart -= *secs * liFreq.QuadPart; + *micros = (liCount.QuadPart*1000000) / liFreq.QuadPart; + return 0; +} diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am index 3204a9a9254..d76b1b6048b 100644 --- a/ndb/src/common/transporter/Makefile.am +++ b/ndb/src/common/transporter/Makefile.am @@ -33,4 +33,4 @@ libtransporter.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libtransporter_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index f3faa8c4f7f..15698db3bc9 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -17,8 +17,8 @@ #include <ndb_global.h> #include <File.hpp> - #include <NdbOut.hpp> +#include <my_dir.h> // // PUBLIC @@ -28,9 +28,14 @@ bool File_class::exists(const char* aFileName) { bool rc = true; - + +#ifdef USE_MY_STAT_STRUCT + struct my_stat stmp; +#else struct stat stmp; - if (::stat(aFileName, &stmp) != 0) +#endif + + if (my_stat(aFileName, &stmp, MYF(0)) != 0) { rc = false; } diff --git a/ndb/src/common/util/Makefile.am b/ndb/src/common/util/Makefile.am index cbc849a49f9..a62c8186174 100644 --- a/ndb/src/common/util/Makefile.am +++ b/ndb/src/common/util/Makefile.am @@ -29,4 +29,4 @@ libgeneral.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libgeneral_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/cw/cpcd/Makefile.am b/ndb/src/cw/cpcd/Makefile.am index 20ac8e6e578..75f557b2af7 100644 --- a/ndb/src/cw/cpcd/Makefile.am +++ b/ndb/src/cw/cpcd/Makefile.am @@ -17,16 +17,4 @@ ndb_cpcd_LDFLAGS = @ndb_bin_am_ldflags@ # Don't update the files from bitkeeper %::SCCS/s.% -windoze-dsp: ndb_cpcd.dsp - -ndb_cpcd.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ - $(top_srcdir)/ndb/config/win-name \ - $(top_srcdir)/ndb/config/win-includes \ - $(top_srcdir)/ndb/config/win-sources \ - $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ - @$(top_srcdir)/ndb/config/win-name $@ $(ndbbin_PROGRAMS) - @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(ndb_cpcd_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) +windoze-dsp: diff --git a/ndb/src/kernel/Makefile.am b/ndb/src/kernel/Makefile.am index 5b975d9d0eb..55d3c5a578f 100644 --- a/ndb/src/kernel/Makefile.am +++ b/ndb/src/kernel/Makefile.am @@ -63,13 +63,13 @@ LDADD += \ windoze-dsp: ndbd.dsp ndbd.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-prg.am \ $(top_srcdir)/ndb/config/win-name \ $(top_srcdir)/ndb/config/win-includes \ $(top_srcdir)/ndb/config/win-sources \ $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ + cat $(top_srcdir)/ndb/config/win-prg.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(ndbbin_PROGRAMS) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(ndbd_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) diff --git a/ndb/src/kernel/blocks/backup/Makefile.am b/ndb/src/kernel/blocks/backup/Makefile.am index 4726f291d01..a1f8ff31746 100644 --- a/ndb/src/kernel/blocks/backup/Makefile.am +++ b/ndb/src/kernel/blocks/backup/Makefile.am @@ -23,4 +23,4 @@ libbackup.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libbackup_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile.am b/ndb/src/kernel/blocks/backup/restore/Makefile.am index 3a9baea8fbc..e172b9ea323 100644 --- a/ndb/src/kernel/blocks/backup/restore/Makefile.am +++ b/ndb/src/kernel/blocks/backup/restore/Makefile.am @@ -18,13 +18,13 @@ ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@ windoze-dsp: ndb_restore.dsp ndb_restore.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-prg.am \ $(top_srcdir)/ndb/config/win-name \ $(top_srcdir)/ndb/config/win-includes \ $(top_srcdir)/ndb/config/win-sources \ $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ - @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) + cat $(top_srcdir)/ndb/config/win-prg.am > $@ + @$(top_srcdir)/ndb/config/win-name $@ $(ndbtools_PROGRAMS) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(ndb_restore_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) diff --git a/ndb/src/kernel/blocks/cmvmi/Makefile.am b/ndb/src/kernel/blocks/cmvmi/Makefile.am index f806183338f..dc2e12746fd 100644 --- a/ndb/src/kernel/blocks/cmvmi/Makefile.am +++ b/ndb/src/kernel/blocks/cmvmi/Makefile.am @@ -21,4 +21,4 @@ libcmvmi.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libcmvmi_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbacc/Makefile.am b/ndb/src/kernel/blocks/dbacc/Makefile.am index 40b0ecdee1f..e44524c3edd 100644 --- a/ndb/src/kernel/blocks/dbacc/Makefile.am +++ b/ndb/src/kernel/blocks/dbacc/Makefile.am @@ -21,4 +21,4 @@ libdbacc.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbacc_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbdict/Makefile.am b/ndb/src/kernel/blocks/dbdict/Makefile.am index c97dcb62ba5..9a0d68f8148 100644 --- a/ndb/src/kernel/blocks/dbdict/Makefile.am +++ b/ndb/src/kernel/blocks/dbdict/Makefile.am @@ -22,4 +22,4 @@ libdbdict.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbdict_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbdih/Makefile.am b/ndb/src/kernel/blocks/dbdih/Makefile.am index 86eb4df5df1..d6ad380b806 100644 --- a/ndb/src/kernel/blocks/dbdih/Makefile.am +++ b/ndb/src/kernel/blocks/dbdih/Makefile.am @@ -20,4 +20,4 @@ libdbdih.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbdih_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dblqh/Makefile.am b/ndb/src/kernel/blocks/dblqh/Makefile.am index 3ea54b29659..854860b269c 100644 --- a/ndb/src/kernel/blocks/dblqh/Makefile.am +++ b/ndb/src/kernel/blocks/dblqh/Makefile.am @@ -22,4 +22,4 @@ libdblqh.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdblqh_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtc/Makefile.am b/ndb/src/kernel/blocks/dbtc/Makefile.am index cf8f7c36fd3..98ee2639bac 100644 --- a/ndb/src/kernel/blocks/dbtc/Makefile.am +++ b/ndb/src/kernel/blocks/dbtc/Makefile.am @@ -20,4 +20,4 @@ libdbtc.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtc_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtup/Makefile.am b/ndb/src/kernel/blocks/dbtup/Makefile.am index a1cf3f0d234..e51410e6be3 100644 --- a/ndb/src/kernel/blocks/dbtup/Makefile.am +++ b/ndb/src/kernel/blocks/dbtup/Makefile.am @@ -38,4 +38,4 @@ libdbtup.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtup_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbtux/Makefile.am b/ndb/src/kernel/blocks/dbtux/Makefile.am index a6bcad10a76..b5951e8ed37 100644 --- a/ndb/src/kernel/blocks/dbtux/Makefile.am +++ b/ndb/src/kernel/blocks/dbtux/Makefile.am @@ -31,4 +31,4 @@ libdbtux.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libdbtux_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/dbutil/Makefile.am b/ndb/src/kernel/blocks/dbutil/Makefile.am index 24ed1d48086..925356c2f76 100644 --- a/ndb/src/kernel/blocks/dbutil/Makefile.am +++ b/ndb/src/kernel/blocks/dbutil/Makefile.am @@ -8,9 +8,9 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am # Don't update the files from bitkeeper %::SCCS/s.% -windoze-dsp: libutil.dsp +windoze-dsp: libdbutil.dsp -libutil.dsp: Makefile \ +libdbutil.dsp: Makefile \ $(top_srcdir)/ndb/config/win-lib.am \ $(top_srcdir)/ndb/config/win-name \ $(top_srcdir)/ndb/config/win-includes \ @@ -19,5 +19,5 @@ libutil.dsp: Makefile \ cat $(top_srcdir)/ndb/config/win-lib.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(libutil_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-sources $@ $(libdbutil_a_SOURCES) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/grep/Makefile.am b/ndb/src/kernel/blocks/grep/Makefile.am index cbb1c1721c1..6d2b422784b 100644 --- a/ndb/src/kernel/blocks/grep/Makefile.am +++ b/ndb/src/kernel/blocks/grep/Makefile.am @@ -20,4 +20,4 @@ libgrep.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libgrep_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/ndbcntr/Makefile.am b/ndb/src/kernel/blocks/ndbcntr/Makefile.am index de5e24e6be8..3f24675b2b3 100644 --- a/ndb/src/kernel/blocks/ndbcntr/Makefile.am +++ b/ndb/src/kernel/blocks/ndbcntr/Makefile.am @@ -23,4 +23,4 @@ libndbcntr.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libndbcntr_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/ndbfs/Makefile.am b/ndb/src/kernel/blocks/ndbfs/Makefile.am index b33508f6bee..a22386f8612 100644 --- a/ndb/src/kernel/blocks/ndbfs/Makefile.am +++ b/ndb/src/kernel/blocks/ndbfs/Makefile.am @@ -24,4 +24,4 @@ libndbfs.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libndbfs_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/qmgr/Makefile.am b/ndb/src/kernel/blocks/qmgr/Makefile.am index 280fd7caeec..278af2a7865 100644 --- a/ndb/src/kernel/blocks/qmgr/Makefile.am +++ b/ndb/src/kernel/blocks/qmgr/Makefile.am @@ -22,4 +22,4 @@ libqmgr.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libqmgr_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/suma/Makefile.am b/ndb/src/kernel/blocks/suma/Makefile.am index 1101aa78c73..5a74dbb74eb 100644 --- a/ndb/src/kernel/blocks/suma/Makefile.am +++ b/ndb/src/kernel/blocks/suma/Makefile.am @@ -20,4 +20,4 @@ libsuma.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libsuma_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/blocks/trix/Makefile.am b/ndb/src/kernel/blocks/trix/Makefile.am index 85ff101b496..343063a6283 100644 --- a/ndb/src/kernel/blocks/trix/Makefile.am +++ b/ndb/src/kernel/blocks/trix/Makefile.am @@ -20,4 +20,4 @@ libtrix.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libtrix_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/error/Makefile.am b/ndb/src/kernel/error/Makefile.am index fe78667caba..54f3de2d76d 100644 --- a/ndb/src/kernel/error/Makefile.am +++ b/ndb/src/kernel/error/Makefile.am @@ -22,4 +22,4 @@ liberror.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(liberror_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/kernel/vm/Makefile.am b/ndb/src/kernel/vm/Makefile.am index 038ea882dce..0dce9285ae3 100644 --- a/ndb/src/kernel/vm/Makefile.am +++ b/ndb/src/kernel/vm/Makefile.am @@ -40,4 +40,4 @@ libkernel.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libkernel_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am index fab9f5d762d..f03bf155c6e 100644 --- a/ndb/src/mgmapi/Makefile.am +++ b/ndb/src/mgmapi/Makefile.am @@ -26,4 +26,4 @@ libmgmapi.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libmgmapi_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/mgmsrv/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp index bf74f220b58..adbcd8c4256 100644 --- a/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -21,6 +21,7 @@ #include "MgmtErrorReporter.hpp" #include <NdbOut.hpp> #include "ConfigInfo.hpp" +#include <m_string.h> const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file static void trim(char *); diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 4b66e3cc7bc..50e0b6023ad 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -45,13 +45,13 @@ ndb_mgmd_LDFLAGS = @ndb_bin_am_ldflags@ windoze-dsp: ndb_mgmd.dsp ndb_mgmd.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ + $(top_srcdir)/ndb/config/win-prg.am \ $(top_srcdir)/ndb/config/win-name \ $(top_srcdir)/ndb/config/win-includes \ $(top_srcdir)/ndb/config/win-sources \ $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ + cat $(top_srcdir)/ndb/config/win-prg.am > $@ @$(top_srcdir)/ndb/config/win-name $@ $(ndbbin_PROGRAMS) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(ndb_mgmd_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD) diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index a49b29af275..2bd2a564223 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -52,6 +52,7 @@ #include <mgmapi.h> #include <mgmapi_configuration.hpp> #include <mgmapi_config_parameters.h> +#include <m_string.h> //#define MGM_SRV_DEBUG #ifdef MGM_SRV_DEBUG diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am index e3dcd682bba..9f8a851b995 100644 --- a/ndb/src/ndbapi/Makefile.am +++ b/ndb/src/ndbapi/Makefile.am @@ -60,4 +60,4 @@ libndbapi.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libndbapi_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 750ed720f78..3815bbc79c2 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -17,6 +17,7 @@ #include <ndb_global.h> #include <ndberror.h> +#include <m_string.h> typedef struct ErrorBundle { int code; diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp index 43f76c8c253..ac859f8abe8 100644 --- a/ndb/test/include/NdbSchemaOp.hpp +++ b/ndb/test/include/NdbSchemaOp.hpp @@ -303,6 +303,7 @@ public: * * @deprecated do not use! */ +#ifndef NDB_WIN32 inline int createTable( const char* aTableName, Uint32 aTableSize, KeyType aTupleKey, @@ -324,6 +325,7 @@ public: aMemoryType, (aStoredTable == 1 ? true : false)); } +#endif /** * Add a new attribute to a database table. diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am index bc245a1413f..83dcb3dbbcf 100644 --- a/ndb/test/run-test/Makefile.am +++ b/ndb/test/run-test/Makefile.am @@ -24,16 +24,4 @@ wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run # Don't update the files from bitkeeper %::SCCS/s.% -windoze-dsp: atrt.dsp - -atrt.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ - $(top_srcdir)/ndb/config/win-name \ - $(top_srcdir)/ndb/config/win-includes \ - $(top_srcdir)/ndb/config/win-sources \ - $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ - @$(top_srcdir)/ndb/config/win-name $@ $(test_PROGRAMS) - @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(atrt_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) +windoze-dsp: diff --git a/ndb/test/src/CpcClient.cpp b/ndb/test/src/CpcClient.cpp index d407ba65312..2ef23528360 100644 --- a/ndb/test/src/CpcClient.cpp +++ b/ndb/test/src/CpcClient.cpp @@ -15,9 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> -#include <editline/editline.h> - -#include <netdb.h> #include <NdbOut.hpp> #include <NdbTCP.h> diff --git a/ndb/test/src/Makefile.am b/ndb/test/src/Makefile.am index 7d5904d897b..53a1df04c62 100644 --- a/ndb/test/src/Makefile.am +++ b/ndb/test/src/Makefile.am @@ -32,4 +32,4 @@ libNDBT.dsp: Makefile \ @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES) @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/ndb/config/win-sources $@ $(libNDBT_a_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD) + @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp index 4d6d3ddc001..14976b561e8 100644 --- a/ndb/test/src/NdbRestarter.cpp +++ b/ndb/test/src/NdbRestarter.cpp @@ -57,7 +57,7 @@ NdbRestarter::NdbRestarter(const char* _addr): switch(m->type){ case MgmId_TCP: char buf[255]; - snprintf(buf, 255, "%s:%d", m->name.c_str(), m->port); + BaseString::snprintf(buf, 255, "%s:%d", m->name.c_str(), m->port); addr.assign(buf); host.assign(m->name.c_str()); port = m->port; diff --git a/ndb/test/src/getarg.c b/ndb/test/src/getarg.c index 9f03af69824..58e33e81470 100644 --- a/ndb/test/src/getarg.c +++ b/ndb/test/src/getarg.c @@ -293,7 +293,7 @@ arg_printusage (struct getargs *args, col += fprintf(stderr, " %s", buf); } if (args[i].short_name) { - snprintf(buf, sizeof(buf), "[-%c", args[i].short_name); + BaseString::snprintf(buf, sizeof(buf), "[-%c", args[i].short_name); len += 2; len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf), 0, 0, &args[i]); |