mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -24,4 +24,6 @@ windoze:
|
|||||||
windoze-dsp:
|
windoze-dsp:
|
||||||
|
|
||||||
all-windoze-dsp: windoze
|
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'`
|
||||||
|
@ -28,5 +28,6 @@ libndbclient.dsp: Makefile \
|
|||||||
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
||||||
@$(top_srcdir)/ndb/config/win-name $@ $(ndblib_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(ndblib_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbclient_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ dummy.cpp
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(libndbclient_la_LIBADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(libndbclient_la_LIBADD)
|
||||||
|
@touch dummy.cpp
|
||||||
|
@ -22,4 +22,4 @@ libtrace.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libtrace_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libtrace_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -44,4 +44,4 @@ libsignaldataprint.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
noinst_LTLIBRARIES = liblogger.la
|
noinst_LTLIBRARIES = liblogger.la
|
||||||
|
|
||||||
liblogger_la_SOURCES = Logger.cpp LogHandlerList.cpp LogHandler.cpp \
|
SOURCE_WIN = Logger.cpp LogHandlerList.cpp LogHandler.cpp \
|
||||||
ConsoleLogHandler.cpp FileLogHandler.cpp SysLogHandler.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/common.mk.am
|
||||||
include $(top_srcdir)/ndb/config/type_ndbapi.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 > $@
|
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(liblogger_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(SOURCE_WIN)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -26,4 +26,4 @@ libmgmsrvcommon.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libmgmsrvcommon_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libmgmsrvcommon_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -16,6 +16,16 @@ PortLibTest_SOURCES = NdbPortLibTest.cpp
|
|||||||
munmaptest_SOURCES = munmaptest.cpp
|
munmaptest_SOURCES = munmaptest.cpp
|
||||||
|
|
||||||
# Don't update the files from bitkeeper
|
# 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
|
windoze-dsp: libportlib.dsp
|
||||||
|
|
||||||
@ -28,5 +38,5 @@ libportlib.dsp: Makefile \
|
|||||||
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libportlib_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(WIN_src)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
184
ndb/src/common/portlib/win32/NdbCondition.c
Normal file
184
ndb/src/common/portlib/win32/NdbCondition.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
44
ndb/src/common/portlib/win32/NdbDaemon.c
Normal file
44
ndb/src/common/portlib/win32/NdbDaemon.c
Normal file
@ -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
|
33
ndb/src/common/portlib/win32/NdbEnv.c
Normal file
33
ndb/src/common/portlib/win32/NdbEnv.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
53
ndb/src/common/portlib/win32/NdbHost.c
Normal file
53
ndb/src/common/portlib/win32/NdbHost.c
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|
237
ndb/src/common/portlib/win32/NdbMem.c
Normal file
237
ndb/src/common/portlib/win32/NdbMem.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
78
ndb/src/common/portlib/win32/NdbMutex.c
Normal file
78
ndb/src/common/portlib/win32/NdbMutex.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
35
ndb/src/common/portlib/win32/NdbSleep.c
Normal file
35
ndb/src/common/portlib/win32/NdbSleep.c
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
|
39
ndb/src/common/portlib/win32/NdbTCP.c
Normal file
39
ndb/src/common/portlib/win32/NdbTCP.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
118
ndb/src/common/portlib/win32/NdbThread.c
Normal file
118
ndb/src/common/portlib/win32/NdbThread.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
64
ndb/src/common/portlib/win32/NdbTick.c
Normal file
64
ndb/src/common/portlib/win32/NdbTick.c
Normal file
@ -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;
|
||||||
|
}
|
@ -33,4 +33,4 @@ libtransporter.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libtransporter_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libtransporter_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#include <ndb_global.h>
|
#include <ndb_global.h>
|
||||||
|
|
||||||
#include <File.hpp>
|
#include <File.hpp>
|
||||||
|
|
||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
|
#include <my_dir.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// PUBLIC
|
// PUBLIC
|
||||||
@ -29,8 +29,13 @@ File_class::exists(const char* aFileName)
|
|||||||
{
|
{
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
|
|
||||||
|
#ifdef USE_MY_STAT_STRUCT
|
||||||
|
struct my_stat stmp;
|
||||||
|
#else
|
||||||
struct stat stmp;
|
struct stat stmp;
|
||||||
if (::stat(aFileName, &stmp) != 0)
|
#endif
|
||||||
|
|
||||||
|
if (my_stat(aFileName, &stmp, MYF(0)) != 0)
|
||||||
{
|
{
|
||||||
rc = false;
|
rc = false;
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,4 @@ libgeneral.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libgeneral_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libgeneral_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -17,16 +17,4 @@ ndb_cpcd_LDFLAGS = @ndb_bin_am_ldflags@
|
|||||||
# Don't update the files from bitkeeper
|
# Don't update the files from bitkeeper
|
||||||
%::SCCS/s.%
|
%::SCCS/s.%
|
||||||
|
|
||||||
windoze-dsp: ndb_cpcd.dsp
|
windoze-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)
|
|
||||||
|
@ -63,13 +63,13 @@ LDADD += \
|
|||||||
windoze-dsp: ndbd.dsp
|
windoze-dsp: ndbd.dsp
|
||||||
|
|
||||||
ndbd.dsp: Makefile \
|
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-name \
|
||||||
$(top_srcdir)/ndb/config/win-includes \
|
$(top_srcdir)/ndb/config/win-includes \
|
||||||
$(top_srcdir)/ndb/config/win-sources \
|
$(top_srcdir)/ndb/config/win-sources \
|
||||||
$(top_srcdir)/ndb/config/win-libraries
|
$(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-name $@ $(ndbbin_PROGRAMS)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(ndbd_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(ndbd_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
|
||||||
|
@ -23,4 +23,4 @@ libbackup.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libbackup_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libbackup_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -18,13 +18,13 @@ ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@
|
|||||||
windoze-dsp: ndb_restore.dsp
|
windoze-dsp: ndb_restore.dsp
|
||||||
|
|
||||||
ndb_restore.dsp: Makefile \
|
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-name \
|
||||||
$(top_srcdir)/ndb/config/win-includes \
|
$(top_srcdir)/ndb/config/win-includes \
|
||||||
$(top_srcdir)/ndb/config/win-sources \
|
$(top_srcdir)/ndb/config/win-sources \
|
||||||
$(top_srcdir)/ndb/config/win-libraries
|
$(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 $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(ndbtools_PROGRAMS)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_restore_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_restore_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
|
||||||
|
@ -21,4 +21,4 @@ libcmvmi.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libcmvmi_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libcmvmi_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -21,4 +21,4 @@ libdbacc.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbacc_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbacc_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -22,4 +22,4 @@ libdbdict.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbdict_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbdict_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -20,4 +20,4 @@ libdbdih.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbdih_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbdih_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -22,4 +22,4 @@ libdblqh.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdblqh_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdblqh_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -20,4 +20,4 @@ libdbtc.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtc_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtc_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -38,4 +38,4 @@ libdbtup.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtup_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtup_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -31,4 +31,4 @@ libdbtux.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtux_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbtux_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -8,9 +8,9 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am
|
|||||||
# Don't update the files from bitkeeper
|
# Don't update the files from bitkeeper
|
||||||
%::SCCS/s.%
|
%::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-lib.am \
|
||||||
$(top_srcdir)/ndb/config/win-name \
|
$(top_srcdir)/ndb/config/win-name \
|
||||||
$(top_srcdir)/ndb/config/win-includes \
|
$(top_srcdir)/ndb/config/win-includes \
|
||||||
@ -19,5 +19,5 @@ libutil.dsp: Makefile \
|
|||||||
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
cat $(top_srcdir)/ndb/config/win-lib.am > $@
|
||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libutil_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libdbutil_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -20,4 +20,4 @@ libgrep.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libgrep_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libgrep_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -23,4 +23,4 @@ libndbcntr.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbcntr_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbcntr_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -24,4 +24,4 @@ libndbfs.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbfs_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbfs_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -22,4 +22,4 @@ libqmgr.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libqmgr_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libqmgr_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -20,4 +20,4 @@ libsuma.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libsuma_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libsuma_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -20,4 +20,4 @@ libtrix.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libtrix_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libtrix_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -22,4 +22,4 @@ liberror.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(liberror_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(liberror_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -40,4 +40,4 @@ libkernel.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libkernel_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libkernel_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -26,4 +26,4 @@ libmgmapi.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libmgmapi_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libmgmapi_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "MgmtErrorReporter.hpp"
|
#include "MgmtErrorReporter.hpp"
|
||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
#include "ConfigInfo.hpp"
|
#include "ConfigInfo.hpp"
|
||||||
|
#include <m_string.h>
|
||||||
|
|
||||||
const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file
|
const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file
|
||||||
static void trim(char *);
|
static void trim(char *);
|
||||||
|
@ -45,13 +45,13 @@ ndb_mgmd_LDFLAGS = @ndb_bin_am_ldflags@
|
|||||||
windoze-dsp: ndb_mgmd.dsp
|
windoze-dsp: ndb_mgmd.dsp
|
||||||
|
|
||||||
ndb_mgmd.dsp: Makefile \
|
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-name \
|
||||||
$(top_srcdir)/ndb/config/win-includes \
|
$(top_srcdir)/ndb/config/win-includes \
|
||||||
$(top_srcdir)/ndb/config/win-sources \
|
$(top_srcdir)/ndb/config/win-sources \
|
||||||
$(top_srcdir)/ndb/config/win-libraries
|
$(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-name $@ $(ndbbin_PROGRAMS)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_mgmd_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_mgmd_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include <mgmapi.h>
|
#include <mgmapi.h>
|
||||||
#include <mgmapi_configuration.hpp>
|
#include <mgmapi_configuration.hpp>
|
||||||
#include <mgmapi_config_parameters.h>
|
#include <mgmapi_config_parameters.h>
|
||||||
|
#include <m_string.h>
|
||||||
|
|
||||||
//#define MGM_SRV_DEBUG
|
//#define MGM_SRV_DEBUG
|
||||||
#ifdef MGM_SRV_DEBUG
|
#ifdef MGM_SRV_DEBUG
|
||||||
|
@ -60,4 +60,4 @@ libndbapi.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbapi_la_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libndbapi_la_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <ndb_global.h>
|
#include <ndb_global.h>
|
||||||
#include <ndberror.h>
|
#include <ndberror.h>
|
||||||
|
#include <m_string.h>
|
||||||
|
|
||||||
typedef struct ErrorBundle {
|
typedef struct ErrorBundle {
|
||||||
int code;
|
int code;
|
||||||
|
@ -303,6 +303,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @deprecated do not use!
|
* @deprecated do not use!
|
||||||
*/
|
*/
|
||||||
|
#ifndef NDB_WIN32
|
||||||
inline int createTable( const char* aTableName,
|
inline int createTable( const char* aTableName,
|
||||||
Uint32 aTableSize,
|
Uint32 aTableSize,
|
||||||
KeyType aTupleKey,
|
KeyType aTupleKey,
|
||||||
@ -324,6 +325,7 @@ public:
|
|||||||
aMemoryType,
|
aMemoryType,
|
||||||
(aStoredTable == 1 ? true : false));
|
(aStoredTable == 1 ? true : false));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new attribute to a database table.
|
* Add a new attribute to a database table.
|
||||||
|
@ -24,16 +24,4 @@ wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
|
|||||||
# Don't update the files from bitkeeper
|
# Don't update the files from bitkeeper
|
||||||
%::SCCS/s.%
|
%::SCCS/s.%
|
||||||
|
|
||||||
windoze-dsp: atrt.dsp
|
windoze-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)
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
#include <ndb_global.h>
|
#include <ndb_global.h>
|
||||||
#include <editline/editline.h>
|
|
||||||
|
|
||||||
#include <netdb.h>
|
|
||||||
|
|
||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
#include <NdbTCP.h>
|
#include <NdbTCP.h>
|
||||||
|
@ -32,4 +32,4 @@ libNDBT.dsp: Makefile \
|
|||||||
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LIBRARIES)
|
||||||
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
|
||||||
@$(top_srcdir)/ndb/config/win-sources $@ $(libNDBT_a_SOURCES)
|
@$(top_srcdir)/ndb/config/win-sources $@ $(libNDBT_a_SOURCES)
|
||||||
@$(top_srcdir)/ndb/config/win-libraries $@ $(LDADD)
|
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)
|
||||||
|
@ -57,7 +57,7 @@ NdbRestarter::NdbRestarter(const char* _addr):
|
|||||||
switch(m->type){
|
switch(m->type){
|
||||||
case MgmId_TCP:
|
case MgmId_TCP:
|
||||||
char buf[255];
|
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);
|
addr.assign(buf);
|
||||||
host.assign(m->name.c_str());
|
host.assign(m->name.c_str());
|
||||||
port = m->port;
|
port = m->port;
|
||||||
|
@ -293,7 +293,7 @@ arg_printusage (struct getargs *args,
|
|||||||
col += fprintf(stderr, " %s", buf);
|
col += fprintf(stderr, " %s", buf);
|
||||||
}
|
}
|
||||||
if (args[i].short_name) {
|
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 += 2;
|
||||||
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||||
0, 0, &args[i]);
|
0, 0, &args[i]);
|
||||||
|
Reference in New Issue
Block a user