diff options
Diffstat (limited to 'ndb/src')
228 files changed, 781 insertions, 1148 deletions
diff --git a/ndb/src/client/odbc/common/Ctx.cpp b/ndb/src/client/odbc/common/Ctx.cpp index 85edbd1a63f..44689657788 100644 --- a/ndb/src/client/odbc/common/Ctx.cpp +++ b/ndb/src/client/odbc/common/Ctx.cpp @@ -14,11 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbUnistd.h> -#include <stdlib.h> -#include <string.h> -#include <NdbStdio.h> -#include <stdarg.h> +#include <ndb_global.h> #include <NdbApi.hpp> #include <common/common.hpp> #include "DiagArea.hpp" diff --git a/ndb/src/client/odbc/common/DataField.cpp b/ndb/src/client/odbc/common/DataField.cpp index 5853f90c08f..dfd4137ffd9 100644 --- a/ndb/src/client/odbc/common/DataField.cpp +++ b/ndb/src/client/odbc/common/DataField.cpp @@ -14,14 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbUnistd.h> -#include <NdbStdio.h> -#include <stdlib.h> -#include <errno.h> -#include <limits.h> -#include <math.h> +#include <ndb_global.h> #include "DataField.hpp" -#include <time.h> #ifndef INT_MAX #define INT_MAX (2147483647) diff --git a/ndb/src/client/odbc/common/DataType.cpp b/ndb/src/client/odbc/common/DataType.cpp index 62bd622b9b5..9c9629f1d24 100644 --- a/ndb/src/client/odbc/common/DataType.cpp +++ b/ndb/src/client/odbc/common/DataType.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DataType.hpp" -#include <NdbStdio.h> // SqlType diff --git a/ndb/src/client/odbc/common/OdbcData.cpp b/ndb/src/client/odbc/common/OdbcData.cpp index d2402c7e0ab..2e1bd768aec 100644 --- a/ndb/src/client/odbc/common/OdbcData.cpp +++ b/ndb/src/client/odbc/common/OdbcData.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <new> -#include <string.h> -#include <NdbStdio.h> +#include <ndb_global.h> #include "OdbcData.hpp" OdbcData::OdbcData() : diff --git a/ndb/src/common/debugger/DebuggerNames.cpp b/ndb/src/common/debugger/DebuggerNames.cpp index fdee978ab54..ebe94a6059f 100644 --- a/ndb/src/common/debugger/DebuggerNames.cpp +++ b/ndb/src/common/debugger/DebuggerNames.cpp @@ -14,16 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "DebuggerNames.hpp" #include <BlockNumbers.h> #include <GlobalSignalNumbers.h> #include <signaldata/SignalDataPrint.hpp> -#include <NdbStdio.h> -#include <stdlib.h> -#include <string.h> - static const char * localSignalNames[MAX_GSN+1]; static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1]; static const char * localBlockNames[NO_OF_BLOCKS]; diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp index 12f01890c54..dd957d67383 100644 --- a/ndb/src/common/debugger/EventLogger.cpp +++ b/ndb/src/common/debugger/EventLogger.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "EventLogger.hpp" #include <NdbConfig.h> @@ -22,10 +24,6 @@ #include <GrepEvent.hpp> #include <NodeState.hpp> #include <version.h> -#include <NdbStdio.h> - -#include <string.h> -#include <ctype.h> // // PUBLIC diff --git a/ndb/src/common/debugger/SignalLoggerManager.cpp b/ndb/src/common/debugger/SignalLoggerManager.cpp index ae6edd5ed71..3839a348222 100644 --- a/ndb/src/common/debugger/SignalLoggerManager.cpp +++ b/ndb/src/common/debugger/SignalLoggerManager.cpp @@ -14,15 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SignalLoggerManager.hpp" #include <LongSignal.hpp> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <time.h> -#include <NdbString.h> - #include <DebuggerNames.hpp> SignalLoggerManager::SignalLoggerManager() diff --git a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp index 11ee0948c17..84410a2b2db 100644 --- a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp +++ b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> #include <kernel_types.h> #include <BlockNumbers.h> #include <signaldata/CloseComReqConf.hpp> diff --git a/ndb/src/common/debugger/signaldata/ContinueB.cpp b/ndb/src/common/debugger/signaldata/ContinueB.cpp index 054909d961e..1be6da86cb1 100644 --- a/ndb/src/common/debugger/signaldata/ContinueB.cpp +++ b/ndb/src/common/debugger/signaldata/ContinueB.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> #include <kernel_types.h> #include <BlockNumbers.h> #include <signaldata/DihContinueB.hpp> diff --git a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp index 6685345f17a..027f743b5ea 100644 --- a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp +++ b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp @@ -26,7 +26,7 @@ printCREATE_FRAGMENTATION_REQ(FILE * output, const Uint32 * theData, fprintf(output, " noOfFragments: %x\n", sig->noOfFragments); fprintf(output, " fragmentNode: %x\n", sig->fragmentNode); if (sig->primaryTableId == RNIL) - fprintf(output, " primaryTableId: none\n", sig->primaryTableId); + fprintf(output, " primaryTableId: none\n"); else fprintf(output, " primaryTableId: %x\n", sig->primaryTableId); return true; diff --git a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp index f3b4b97f0fd..2e900de8f70 100644 --- a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp +++ b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> #include <kernel_types.h> #include <BlockNumbers.h> #include <signaldata/PrepFailReqRef.hpp> diff --git a/ndb/src/common/debugger/signaldata/SystemError.cpp b/ndb/src/common/debugger/signaldata/SystemError.cpp index 5ed7dc6b18d..549c34710a0 100644 --- a/ndb/src/common/debugger/signaldata/SystemError.cpp +++ b/ndb/src/common/debugger/signaldata/SystemError.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> #include <kernel_types.h> #include <BlockNumbers.h> #include <signaldata/SystemError.hpp> diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c index 0529d18b952..1e4c1ecba76 100644 --- a/ndb/src/common/editline/editline.c +++ b/ndb/src/common/editline/editline.c @@ -19,10 +19,10 @@ ** ** Main editing routines for editline library. */ +#include <ndb_global.h> + #include "editline_internal.h" #include <signal.h> -#include <ctype.h> -#include <unistd.h> /* ** Manifest constants. diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h index 93c13e55edc..5ed2b32a873 100644 --- a/ndb/src/common/editline/editline_internal.h +++ b/ndb/src/common/editline/editline_internal.h @@ -19,9 +19,8 @@ ** Internal header file for editline library. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <ndb_global.h> + #if defined(SYS_UNIX) #include "unix.h" #endif /* defined(SYS_UNIX) */ diff --git a/ndb/src/common/editline/editline_win32.c b/ndb/src/common/editline/editline_win32.c index feef0108523..5083edb7fae 100644 --- a/ndb/src/common/editline/editline_win32.c +++ b/ndb/src/common/editline/editline_win32.c @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <malloc.h> +#include <ndb_global.h> char* readline(const char* prompt) diff --git a/ndb/src/common/editline/test/testit.c b/ndb/src/common/editline/test/testit.c index 9a7dfb7bbdf..4058f8ae660 100644 --- a/ndb/src/common/editline/test/testit.c +++ b/ndb/src/common/editline/test/testit.c @@ -20,11 +20,7 @@ ** A "micro-shell" to test editline library. ** If given any arguments, commands aren't executed. */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <NdbString.h> +#include <ndb_global.h> #include <editline/editline.h> int diff --git a/ndb/src/common/editline/unix.h b/ndb/src/common/editline/unix.h index 582c4888856..37f461b471d 100644 --- a/ndb/src/common/editline/unix.h +++ b/ndb/src/common/editline/unix.h @@ -21,6 +21,5 @@ #define CRLF "\r\n" -#include <sys/types.h> -#include <sys/stat.h> +#include <ndb_global.h> #include <dirent.h> diff --git a/ndb/src/common/logger/FileLogHandler.cpp b/ndb/src/common/logger/FileLogHandler.cpp index f3d547b4fe7..d13dd7b2a78 100644 --- a/ndb/src/common/logger/FileLogHandler.cpp +++ b/ndb/src/common/logger/FileLogHandler.cpp @@ -14,16 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "FileLogHandler.hpp" +#include <FileLogHandler.hpp> #include <File.hpp> -#include <NdbStdio.h> -#include <sys/param.h> - -#include <errno.h> -#include <string.h> - // // PUBLIC // @@ -35,7 +29,7 @@ FileLogHandler::FileLogHandler() : m_maxLogEntries(MAX_LOG_ENTRIES) { - m_pLogFile = new File("logger.log", "a+"); + m_pLogFile = new File_class("logger.log", "a+"); } FileLogHandler::FileLogHandler(const char* aFileName, @@ -47,7 +41,7 @@ FileLogHandler::FileLogHandler(const char* aFileName, m_maxFileSize(maxFileSize), m_maxLogEntries(maxLogEntries) { - m_pLogFile = new File(aFileName, "a+"); + m_pLogFile = new File_class(aFileName, "a+"); } FileLogHandler::~FileLogHandler() @@ -166,10 +160,10 @@ FileLogHandler::createNewFile() ::snprintf(newName, sizeof(newName), "%s.%d", m_pLogFile->getName(), fileNo++); - } while (File::exists(newName)); + } while (File_class::exists(newName)); m_pLogFile->close(); - if (!File::rename(m_pLogFile->getName(), newName)) + if (!File_class::rename(m_pLogFile->getName(), newName)) { setErrorCode(errno); rc = false; @@ -201,7 +195,7 @@ FileLogHandler::setFilename(const BaseString &filename) { close(); if(m_pLogFile) delete m_pLogFile; - m_pLogFile = new File(filename.c_str(), "a+"); + m_pLogFile = new File_class(filename.c_str(), "a+"); open(); return true; }; diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp index d1445555e87..83d479c82fd 100644 --- a/ndb/src/common/logger/LogHandler.cpp +++ b/ndb/src/common/logger/LogHandler.cpp @@ -17,9 +17,6 @@ #include "LogHandler.hpp" #include <NdbTick.h> -#include <NdbString.h> - -#include <time.h> // // PUBLIC diff --git a/ndb/src/common/logger/LogHandlerList.cpp b/ndb/src/common/logger/LogHandlerList.cpp index f020ad23e56..62495d7566b 100644 --- a/ndb/src/common/logger/LogHandlerList.cpp +++ b/ndb/src/common/logger/LogHandlerList.cpp @@ -17,8 +17,6 @@ #include "LogHandlerList.hpp" #include <LogHandler.hpp> -#include <NdbStdio.h> -#include <ndb_types.h> // // PUBLIC diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp index 6eaafd91854..9c9f1eece18 100644 --- a/ndb/src/common/logger/Logger.cpp +++ b/ndb/src/common/logger/Logger.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdarg.h> +#include <ndb_global.h> #include "Logger.hpp" @@ -27,12 +27,6 @@ #include <SysLogHandler.hpp> #endif -#include <NdbStdio.h> -#include <ndb_types.h> -#include <NdbString.h> - -#include <assert.h> - // // PUBLIC // diff --git a/ndb/src/common/logger/SysLogHandler.cpp b/ndb/src/common/logger/SysLogHandler.cpp index f3511bf5638..a300c487eb9 100644 --- a/ndb/src/common/logger/SysLogHandler.cpp +++ b/ndb/src/common/logger/SysLogHandler.cpp @@ -17,7 +17,6 @@ #include "SysLogHandler.hpp" #include <syslog.h> -#include <NdbString.h> // // PUBLIC diff --git a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp index 22f67d15659..44ee11717b4 100644 --- a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp +++ b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "LogHandlerListUnitTest.hpp" #include <ConsoleLogHandler.hpp> @@ -22,9 +24,6 @@ #include <NdbOut.hpp> -#include <stdio.h> -#include <assert.h> - typedef bool (*TESTFUNC)(const char*); typedef struct { diff --git a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp index 4b0241a0b03..017dcb79c1f 100644 --- a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp +++ b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp @@ -25,12 +25,8 @@ #endif #include <NdbOut.hpp> -#include <NdbStdio.h> #include <NdbMain.h> -#include <string.h> -#include <assert.h> - typedef bool (*TESTFUNC)(const char*); typedef struct { diff --git a/ndb/src/common/mgmcommon/Config.hpp b/ndb/src/common/mgmcommon/Config.hpp index 1314abe004a..284256d9ed6 100644 --- a/ndb/src/common/mgmcommon/Config.hpp +++ b/ndb/src/common/mgmcommon/Config.hpp @@ -23,9 +23,7 @@ #include <kernel_types.h> #include <NdbOut.hpp> -#include <NdbStdio.h> #include <ndb_limits.h> -#include <NdbConstant.hpp> #include <Properties.hpp> /** diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index a3f26454df6..04dc5466bbc 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -14,6 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> +#include <ndb_version.h> + #include <ConfigRetriever.hpp> #include "LocalConfig.hpp" @@ -21,21 +24,15 @@ #include <NdbOut.hpp> #include <NdbTCP.h> -#include <string.h> -#include <NdbStdio.h> #include <NdbEnv.h> #include "MgmtErrorReporter.hpp" #include <uucode.h> #include <Properties.hpp> -#include <stdio.h> -#include <NdbString.h> -#include <sys/stat.h> #include <socket_io.h> #include <NdbConfig.h> -#include <ndb_version.h> //**************************************************************************** //**************************************************************************** diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp index 33652fa472c..62c4bd28857 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp @@ -14,16 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "InitConfigFileParser.hpp" -#include <string.h> -#include <errno.h> #include "Config.hpp" #include "MgmtErrorReporter.hpp" #include <NdbOut.hpp> #include "ConfigInfo.hpp" -#include <stdarg.h> -#include <ctype.h> -#include <NdbString.h> const int MAX_LINE_LENGTH = 120; // Max length of line of text in config file static void trim(char *); diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp index 1e85067396c..f4f27abb055 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp @@ -17,7 +17,8 @@ #ifndef InitConfigFileParser_H #define InitConfigFileParser_H -#include <stdio.h> +#include <ndb_global.h> + #include <Properties.hpp> class Config; diff --git a/ndb/src/common/mgmcommon/LocalConfig.hpp b/ndb/src/common/mgmcommon/LocalConfig.hpp index ec7b572e92d..eb676bf9bed 100644 --- a/ndb/src/common/mgmcommon/LocalConfig.hpp +++ b/ndb/src/common/mgmcommon/LocalConfig.hpp @@ -17,10 +17,8 @@ #ifndef LocalConfig_H #define LocalConfig_H -#include <stdlib.h> -#include <string.h> +#include <ndb_global.h> #include <NdbOut.hpp> -#include <NdbStdio.h> //**************************************************************************** // Description: The class LocalConfig corresponds to the information possible diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/mgmcommon/NdbConfig.c index b12d9fcfaf9..827ef34a840 100644 --- a/ndb/src/common/mgmcommon/NdbConfig.c +++ b/ndb/src/common/mgmcommon/NdbConfig.c @@ -14,10 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <NdbConfig.h> #include <NdbEnv.h> -#include <stdlib.h> -#include <string.h> const char* NdbConfig_HomePath(char* buf, int buflen){ diff --git a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp index 7260a84ce7a..daa287cc44d 100644 --- a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp +++ b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp @@ -15,10 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbMain.h> #include <ConfigRetriever.hpp> #include <Properties.hpp> -#include <stdlib.h> #include <NdbOut.hpp> void usage(const char * prg){ diff --git a/ndb/src/common/portlib/Makefile b/ndb/src/common/portlib/Makefile index a928fc1e6d7..48f4929a839 100644 --- a/ndb/src/common/portlib/Makefile +++ b/ndb/src/common/portlib/Makefile @@ -4,38 +4,16 @@ DIRS := ifeq ($(NDB_OS), SOFTOSE) DIRS += ose -endif - +else ifeq ($(NDB_OS), OSE) DIRS += ose -endif - -ifeq ($(NDB_OS), SIMCELLO) -DIRS += ose -endif - -ifeq ($(NDB_OS), LINUX) -DIRS += unix -endif - -ifeq ($(NDB_OS), MACOSX) -DIRS += unix -endif - -ifeq ($(NDB_OS), SOLARIS) +else +ifeq ($(NDB_OS), WIN32) +DIRS += win32 +else DIRS += unix endif - -ifeq ($(NDB_OS), SOLARIS6) -DIRS += unix endif - -ifeq ($(NDB_OS), HPUX) -DIRS += unix -endif - -ifeq ($(NDB_OS), WIN32) -DIRS += win32 endif diff --git a/ndb/src/common/portlib/memtest/memtest.c b/ndb/src/common/portlib/memtest/memtest.c index d23235b7aa2..059a4ec025e 100644 --- a/ndb/src/common/portlib/memtest/memtest.c +++ b/ndb/src/common/portlib/memtest/memtest.c @@ -16,10 +16,8 @@ -#include <stdio.h> -#include <unistd.h> -#include <sys/time.h> -#include <sys/mman.h> +#include <ndb_global.h> + long long getMilli(); long long getMicro(); void malloctest(int loopcount, int memsize, int touch); diff --git a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp index 9e396cd98ee..b1d84131810 100644 --- a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp +++ b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp @@ -17,6 +17,8 @@ +#include <ndb_global.h> + #include <NdbOut.hpp> #include <NdbThread.h> #include <NdbMutex.h> @@ -27,13 +29,6 @@ #include <NdbHost.h> #include <NdbMain.h> #include <getarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/time.h> -#include <sys/mman.h> - struct ThreadData { diff --git a/ndb/src/common/portlib/mmstest/mmslist.cpp b/ndb/src/common/portlib/mmstest/mmslist.cpp index bd00211445c..05538785293 100644 --- a/ndb/src/common/portlib/mmstest/mmslist.cpp +++ b/ndb/src/common/portlib/mmstest/mmslist.cpp @@ -14,14 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_common.h> + #include <NdbOut.hpp> #include <NdbMain.h> #include <ose.h> #include <mms.sig> #include <mms_err.h> -#include <string.h> -#include <stdio.h> #include <NdbOut.hpp> /** diff --git a/ndb/src/common/portlib/mmstest/mmstest.cpp b/ndb/src/common/portlib/mmstest/mmstest.cpp index 6ebb5064aaf..9cc7d810985 100644 --- a/ndb/src/common/portlib/mmstest/mmstest.cpp +++ b/ndb/src/common/portlib/mmstest/mmstest.cpp @@ -14,13 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbOut.hpp> #include "NdbThread.h" #include <NdbMem.h> #include <NdbMain.h> -#include <stdlib.h> - NDB_COMMAND(ndbmem, "ndbmem", "ndbmem", "Test the ndbmem functionality", 4096){ ndbout << "Starting test of NdbMem" << endl; diff --git a/ndb/src/common/portlib/ose/NdbCondition.c b/ndb/src/common/portlib/ose/NdbCondition.c index 2ab6e49006b..73a2dbc5d66 100644 --- a/ndb/src/common/portlib/ose/NdbCondition.c +++ b/ndb/src/common/portlib/ose/NdbCondition.c @@ -17,7 +17,6 @@ #include "NdbCondition.h" #include <pthread.h> -#include <assert.h> #include <sys/types.h> #include <malloc.h> diff --git a/ndb/src/common/portlib/ose/NdbMem.c b/ndb/src/common/portlib/ose/NdbMem.c index 6d922e4c073..0e38024bbb4 100644 --- a/ndb/src/common/portlib/ose/NdbMem.c +++ b/ndb/src/common/portlib/ose/NdbMem.c @@ -17,7 +17,6 @@ #include "NdbMem.h" -#include <assert.h> #if defined NDB_OSE #include <ose.h> @@ -134,7 +133,6 @@ int NdbMem_MemUnlockAll(){ } #else -#include <assert.h> #include <stdlib.h> diff --git a/ndb/src/common/portlib/ose/NdbMutex.c b/ndb/src/common/portlib/ose/NdbMutex.c index 859ddefd536..253c0e412ff 100644 --- a/ndb/src/common/portlib/ose/NdbMutex.c +++ b/ndb/src/common/portlib/ose/NdbMutex.c @@ -19,7 +19,6 @@ #include <pthread.h> #include <stdlib.h> -#include <assert.h> NdbMutex* NdbMutex_Create(void) diff --git a/ndb/src/common/portlib/ose/NdbOut.cpp b/ndb/src/common/portlib/ose/NdbOut.cpp index 0ee12249ff5..eb81bc9d971 100644 --- a/ndb/src/common/portlib/ose/NdbOut.cpp +++ b/ndb/src/common/portlib/ose/NdbOut.cpp @@ -14,12 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbOut.hpp" -#include <NdbStdio.h> -#include <stdarg.h> -#include <NdbUnistd.h> -#include <string.h> +#include <ndb_global.h> +#include "NdbOut.hpp" #if defined NDB_SOFTOSE #include <dbgprintf.h> diff --git a/ndb/src/common/portlib/ose/NdbThread.c b/ndb/src/common/portlib/ose/NdbThread.c index 41a5f181c40..e46903a5cce 100644 --- a/ndb/src/common/portlib/ose/NdbThread.c +++ b/ndb/src/common/portlib/ose/NdbThread.c @@ -18,7 +18,6 @@ #include "NdbThread.h" #include <pthread.h> #include <malloc.h> -#include <assert.h> #include <string.h> #include <NdbOut.hpp> diff --git a/ndb/src/common/portlib/test/NdbPortLibTest.cpp b/ndb/src/common/portlib/test/NdbPortLibTest.cpp index 8a5c8f4a878..55b9ccec5f2 100644 --- a/ndb/src/common/portlib/test/NdbPortLibTest.cpp +++ b/ndb/src/common/portlib/test/NdbPortLibTest.cpp @@ -20,7 +20,7 @@ * TODO - Add tests for NdbMem */ - +#include <ndb_global.h> #include "NdbOut.hpp" #include "NdbThread.h" @@ -32,11 +32,6 @@ #include "NdbHost.h" #include "NdbMain.h" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - int TestHasFailed; int verbose = 0; diff --git a/ndb/src/common/portlib/unix/NdbCondition.c b/ndb/src/common/portlib/unix/NdbCondition.c index 35b80821052..1d229bdcdef 100644 --- a/ndb/src/common/portlib/unix/NdbCondition.c +++ b/ndb/src/common/portlib/unix/NdbCondition.c @@ -15,16 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbCondition.h> -#include <pthread.h> -#include <assert.h> -#include <sys/types.h> -#if defined NDB_MACOSX -#include <stdlib.h> -#else -#include <malloc.h> -#endif +#include <ndb_global.h> +#include <NdbCondition.h> +#include <NdbThread.h> #include <NdbMutex.h> struct NdbCondition @@ -67,8 +61,6 @@ NdbCondition_Wait(struct NdbCondition* p_cond, return result; } -#if defined NDB_SOLARIS || defined NDB_HPUX -#include <time.h> int NdbCondition_WaitTimeout(struct NdbCondition* p_cond, NdbMutex* p_mutex, @@ -80,7 +72,16 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, if (p_cond == NULL || p_mutex == NULL) return 1; +#ifdef HAVE_CLOCK_GETTIME clock_gettime(CLOCK_REALTIME, &abstime); +#else + { + struct timeval tick_time; + gettimeofday(&tick_time, 0); + abstime.tv_sec = tick_time.tv_sec; + abstime.tv_nsec = tick_time.tv_usec * 1000; + } +#endif if(msecs >= 1000){ secs = msecs / 1000; @@ -98,45 +99,6 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, return result; } -#endif - -#if defined NDB_LINUX || defined NDB_MACOSX -#include <unistd.h> -#include <sys/time.h> - -int -NdbCondition_WaitTimeout(struct NdbCondition* p_cond, - NdbMutex* p_mutex, - int msecs){ - int result; - struct timespec abstime; - struct timeval tick_time; - int secs = 0; - - if (p_cond == NULL || p_mutex == NULL) - return 1; - - gettimeofday(&tick_time, 0); - - if(msecs >= 1000){ - secs = msecs / 1000; - msecs = msecs % 1000; - } - - - abstime.tv_sec = tick_time.tv_sec + secs; - abstime.tv_nsec = tick_time.tv_usec * 1000 + msecs * 1000000; - if (abstime.tv_nsec >= 1000000000) { - abstime.tv_sec += 1; - abstime.tv_nsec -= 1000000000; - } - - result = pthread_cond_timedwait(&p_cond->cond, p_mutex, &abstime); - - return result; -} -#endif - int NdbCondition_Signal(struct NdbCondition* p_cond){ diff --git a/ndb/src/common/portlib/unix/NdbDaemon.c b/ndb/src/common/portlib/unix/NdbDaemon.c index fc114266c9d..186331a4dab 100644 --- a/ndb/src/common/portlib/unix/NdbDaemon.c +++ b/ndb/src/common/portlib/unix/NdbDaemon.c @@ -14,40 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbDaemon.h" -#include <assert.h> - -#ifdef NDB_LINUX -#include <sys/types.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#endif - -#ifdef NDB_SOLARIS -#include <sys/types.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#endif #define NdbDaemon_ErrorSize 500 -#if defined(NDB_LINUX) || defined(NDB_SOLARIS) long NdbDaemon_DaemonPid; int NdbDaemon_ErrorCode; char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; -#endif + int NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) { - /* XXX fix other unixes */ -#if defined(NDB_LINUX) || defined(NDB_SOLARIS) int lockfd = -1, logfd = -1, n; char buf[64]; @@ -149,11 +126,21 @@ NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) dup2(logfd, 2); close(logfd); } -#endif /* Success */ return 0; } +#if 0 +int +NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) +{ + /* Fail */ + snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize, + "Daemon mode not implemented"); + return -1; +} +#endif + #ifdef NDB_DAEMON_TEST int diff --git a/ndb/src/common/portlib/unix/NdbEnv.c b/ndb/src/common/portlib/unix/NdbEnv.c index b01e3b239ca..d294e0b52ca 100644 --- a/ndb/src/common/portlib/unix/NdbEnv.c +++ b/ndb/src/common/portlib/unix/NdbEnv.c @@ -15,9 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbEnv.h" -#include <string.h> -#include <stdlib.h> +#include <ndb_global.h> + +#include <NdbEnv.h> const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) { diff --git a/ndb/src/common/portlib/unix/NdbHost.c b/ndb/src/common/portlib/unix/NdbHost.c index 8d2a23fccda..4749bb39ea7 100644 --- a/ndb/src/common/portlib/unix/NdbHost.c +++ b/ndb/src/common/portlib/unix/NdbHost.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbHost.h" -#include <unistd.h> int NdbHost_GetHostName(char* buf) { diff --git a/ndb/src/common/portlib/unix/NdbMem.c b/ndb/src/common/portlib/unix/NdbMem.c index 3b47494967f..0b06e5b23f1 100644 --- a/ndb/src/common/portlib/unix/NdbMem.c +++ b/ndb/src/common/portlib/unix/NdbMem.c @@ -15,14 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbMem.h" +#include <ndb_global.h> -#include <assert.h> -#include <assert.h> -#include <stdlib.h> -#ifndef NDB_MACOSX -#include <sys/mman.h> -#endif +#include <NdbMem.h> void NdbMem_Create() { @@ -59,19 +54,18 @@ void NdbMem_Free(void* ptr) int NdbMem_MemLockAll(){ -#if defined NDB_MACOSX - return 0; -#else - //return mlockall(MCL_CURRENT | MCL_FUTURE); +#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) return mlockall(MCL_CURRENT); +#else + return -1; #endif } int NdbMem_MemUnlockAll(){ -#if defined NDB_MACOSX - return 0; -#else +#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) return munlockall(); +#else + return -1; #endif } diff --git a/ndb/src/common/portlib/unix/NdbMutex.c b/ndb/src/common/portlib/unix/NdbMutex.c index 3cadc0667e7..50f314d2683 100644 --- a/ndb/src/common/portlib/unix/NdbMutex.c +++ b/ndb/src/common/portlib/unix/NdbMutex.c @@ -15,11 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbMutex.h" +#include <ndb_global.h> -#include <pthread.h> -#include <stdlib.h> -#include <assert.h> +#include <NdbThread.h> +#include <NdbMutex.h> NdbMutex* NdbMutex_Create(void) { diff --git a/ndb/src/common/portlib/unix/NdbSleep.c b/ndb/src/common/portlib/unix/NdbSleep.c index 35132d7f9c7..8702a25d1b1 100644 --- a/ndb/src/common/portlib/unix/NdbSleep.c +++ b/ndb/src/common/portlib/unix/NdbSleep.c @@ -15,19 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbSleep.h" - -#ifdef NDB_SOLARIS -#include <sys/types.h> -#include <unistd.h> -#endif - -#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX -#include <time.h> -#include <unistd.h> -#endif - int NdbSleep_MilliSleep(int milliseconds){ int result = 0; diff --git a/ndb/src/common/portlib/unix/NdbTCP.c b/ndb/src/common/portlib/unix/NdbTCP.c index c2613c211c5..287dc6c2ecd 100644 --- a/ndb/src/common/portlib/unix/NdbTCP.c +++ b/ndb/src/common/portlib/unix/NdbTCP.c @@ -15,20 +15,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <NdbMutex.h> #include "NdbTCP.h" +#ifdef NDB_WIN32 +static NdbMutex & LOCK_gethostbyname = * NdbMutex_Create(); +#else +static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER; +#endif -#ifdef NDB_SOLARIS int Ndb_getInAddr(struct in_addr * dst, const char *address) { - struct hostent host, * hostPtr; - char buf[1024]; - int h_errno; - hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno); + struct hostent * hostPtr; + NdbMutex_Lock(&LOCK_gethostbyname); + hostPtr = gethostbyname(address); if (hostPtr != NULL) { dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; + NdbMutex_Unlock(&LOCK_gethostbyname); return 0; } + NdbMutex_Unlock(&LOCK_gethostbyname); /* Try it as aaa.bbb.ccc.ddd. */ dst->s_addr = inet_addr(address); @@ -37,13 +43,14 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { } return -1; } -#endif -#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX +#if 0 int Ndb_getInAddr(struct in_addr * dst, const char *address) { - struct hostent * hostPtr; - hostPtr = gethostbyname(address); + struct hostent host, * hostPtr; + char buf[1024]; + int h_errno; + hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno); if (hostPtr != NULL) { dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; return 0; @@ -57,4 +64,3 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { return -1; } #endif - diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/unix/NdbThread.c index 3665c4c9159..a5c42f79be8 100644 --- a/ndb/src/common/portlib/unix/NdbThread.c +++ b/ndb/src/common/portlib/unix/NdbThread.c @@ -15,16 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbThread.h" +#include <ndb_global.h> +#include <NdbThread.h> #include <pthread.h> -#ifdef NDB_MACOSX -#include <stdlib.h> -#else -#include <malloc.h> -#endif -#include <assert.h> -#include <string.h> -#include <NdbStdio.h> #define MAX_THREAD_NAME 16 @@ -94,7 +87,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) if (p_wait_thread == NULL) return 0; - if (p_wait_thread->thread == NULL) + if (p_wait_thread->thread == 0) return 0; result = pthread_join(p_wait_thread->thread, status); diff --git a/ndb/src/common/portlib/unix/NdbTick.c b/ndb/src/common/portlib/unix/NdbTick.c index 5adb4ec80c2..d8f0b6ec27a 100644 --- a/ndb/src/common/portlib/unix/NdbTick.c +++ b/ndb/src/common/portlib/unix/NdbTick.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbTick.h" -#include <time.h> #define NANOSEC_PER_SEC 1000000000 #define MICROSEC_PER_SEC 1000000 @@ -25,7 +25,7 @@ #define MILLISEC_PER_NANOSEC 1000000 -#if defined NDB_SOLARIS || NDB_HPUX +#ifdef HAVE_CLOCK_GETTIME NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timespec tick_time; @@ -44,11 +44,7 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){ * micros = t.tv_nsec / 1000; return res; } -#endif - -#if defined NDB_LINUX || NDB_MACOSX -#include <unistd.h> -#include <sys/time.h> +#else NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timeval tick_time; @@ -99,12 +95,12 @@ NdbTick_getMicrosPassed(struct MicroSecondTimer start, ret_value = ((NDB_TICKS)MICROSEC_PER_SEC) * sec_passed; } else if (start.seconds > stop.seconds) { return ret_value; - }//if + } if (start.micro_seconds < stop.micro_seconds) { ret_value += (stop.micro_seconds - start.micro_seconds); } else if (ret_value != (NDB_TICKS)0) { ret_value -= (start.micro_seconds - stop.micro_seconds); - }//if + } return ret_value; } #endif diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c index 12b508cf33b..77869b673de 100644 --- a/ndb/src/common/portlib/win32/NdbCondition.c +++ b/ndb/src/common/portlib/win32/NdbCondition.c @@ -18,7 +18,6 @@ #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> -#include <assert.h> #include <sys/types.h> #include "NdbCondition.h" diff --git a/ndb/src/common/portlib/win32/NdbDaemon.c b/ndb/src/common/portlib/win32/NdbDaemon.c index b96d4c20260..972fb1b88d8 100644 --- a/ndb/src/common/portlib/win32/NdbDaemon.c +++ b/ndb/src/common/portlib/win32/NdbDaemon.c @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "NdbDaemon.h" #define NdbDaemon_ErrorSize 500 @@ -24,8 +25,10 @@ char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; int NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) { - // XXX do something - return 0; + /* Fail */ + snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize, + "Daemon mode not implemented"); + return -1; } #ifdef NDB_DAEMON_TEST diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c index 274dc31353f..ab7123b0a29 100644 --- a/ndb/src/common/portlib/win32/NdbMem.c +++ b/ndb/src/common/portlib/win32/NdbMem.c @@ -16,8 +16,6 @@ #include <windows.h> -#include <assert.h> -#include <NdbStdio.h> #include "NdbMem.h" diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c index c93384d91db..e797024d5bb 100644 --- a/ndb/src/common/portlib/win32/NdbMutex.c +++ b/ndb/src/common/portlib/win32/NdbMutex.c @@ -19,7 +19,6 @@ #include <ws2tcpip.h> #include <windows.h> #include <time.h> -#include <assert.h> #include "NdbMutex.h" diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c index ae3c74be70d..1f052f034e8 100644 --- a/ndb/src/common/portlib/win32/NdbThread.c +++ b/ndb/src/common/portlib/win32/NdbThread.c @@ -17,7 +17,6 @@ #include <windows.h> #include <process.h> -#include <assert.h> #include "NdbThread.h" diff --git a/ndb/src/common/transporter/Makefile b/ndb/src/common/transporter/Makefile index 3bd23b627d3..372bf640566 100644 --- a/ndb/src/common/transporter/Makefile +++ b/ndb/src/common/transporter/Makefile @@ -10,7 +10,6 @@ DIRS := basictest perftest SOURCES = \ Transporter.cpp \ SendBuffer.cpp \ - SHM_Transporter.cpp \ TCP_Transporter.cpp \ TransporterRegistry.cpp \ Packer.cpp @@ -20,37 +19,19 @@ DIRS := basictest perftest CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \ -I$(call fixpath,$(NDB_TOP)/include/transporter) + +ifeq ($(NDB_SHM), Y) +SOURCES += SHM_Transporter.cpp ifeq ($(NDB_OS), WIN32) SOURCES += SHM_Transporter.win32.cpp -endif - -ifeq ($(NDB_OS), SOLARIS) +else SOURCES += SHM_Transporter.unix.cpp endif - -ifeq ($(NDB_OS), HPUX) -SOURCES += SHM_Transporter.unix.cpp endif -ifeq ($(NDB_OS), MACOSX) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), IBMAIX) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), TRU64X) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), LINUX) -SOURCES += SHM_Transporter.unix.cpp ifeq ($(NDB_SCI), Y) SOURCES += SCI_Transporter.cpp endif -endif - ifneq ($(findstring OSE, $(NDB_OS)),) SOURCES += OSE_Transporter.cpp diff --git a/ndb/src/common/transporter/OSE_Receiver.cpp b/ndb/src/common/transporter/OSE_Receiver.cpp index 558dee92d8d..b7d47b2f88c 100644 --- a/ndb/src/common/transporter/OSE_Receiver.cpp +++ b/ndb/src/common/transporter/OSE_Receiver.cpp @@ -20,7 +20,6 @@ #include "TransporterCallback.hpp" #include <TransporterRegistry.hpp> #include "TransporterInternalDefinitions.hpp" -#include <NdbStdio.h> OSE_Receiver::OSE_Receiver(TransporterRegistry * tr, int _recBufSize, diff --git a/ndb/src/common/transporter/OSE_Transporter.cpp b/ndb/src/common/transporter/OSE_Transporter.cpp index a7a5ed81ce2..c9b0f777319 100644 --- a/ndb/src/common/transporter/OSE_Transporter.cpp +++ b/ndb/src/common/transporter/OSE_Transporter.cpp @@ -23,11 +23,9 @@ #include <NdbMutex.h> -#include <NdbStdio.h> #include <NdbHost.h> #include <NdbOut.hpp> #include <time.h> -#include <assert.h> OSE_Transporter::OSE_Transporter(int _prioASignalSize, int _prioBSignalSize, diff --git a/ndb/src/common/transporter/Packer.cpp b/ndb/src/common/transporter/Packer.cpp index 77bd66d1ba9..fa72af12dac 100644 --- a/ndb/src/common/transporter/Packer.cpp +++ b/ndb/src/common/transporter/Packer.cpp @@ -14,13 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "Packer.hpp" #include <TransporterRegistry.hpp> #include <TransporterCallback.hpp> #include <RefConvert.hpp> -#include <stdio.h> - Uint32 TransporterRegistry::unpack(Uint32 * readPtr, Uint32 sizeOfData, diff --git a/ndb/src/common/transporter/SCI_Transporter.cpp b/ndb/src/common/transporter/SCI_Transporter.cpp index 2be857e8115..c52c8a9d8c0 100644 --- a/ndb/src/common/transporter/SCI_Transporter.cpp +++ b/ndb/src/common/transporter/SCI_Transporter.cpp @@ -14,17 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SCI_Transporter.hpp" -#include <NdbStdio.h> #include <NdbOut.hpp> #include <NdbSleep.h> #include <NdbTick.h> -#include <stdlib.h> #include <NdbTick.h> -#if 0 -#include <malloc.h> -#include <sys/time.h> -#endif + #include "TransporterInternalDefinitions.hpp" #include <TransporterCallback.hpp> diff --git a/ndb/src/common/transporter/SHM_Buffer.hpp b/ndb/src/common/transporter/SHM_Buffer.hpp index 43250853fee..32e59dd57a2 100644 --- a/ndb/src/common/transporter/SHM_Buffer.hpp +++ b/ndb/src/common/transporter/SHM_Buffer.hpp @@ -17,10 +17,9 @@ #ifndef SHM_BUFFER_HPP #define SHM_BUFFER_HPP -#include <stdio.h> -#include <ndb_types.h> +#include <ndb_global.h> + #include <NdbSleep.h> -#include <assert.h> /** * These classes implement a circular buffer diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp index f18b775efa4..7c673f93c22 100644 --- a/ndb/src/common/transporter/SHM_Transporter.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.cpp @@ -15,18 +15,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include <TransporterCallback.hpp> #include <NdbSleep.h> #include <NdbOut.hpp> -#include <stdio.h> -#include <stdlib.h> - -#ifdef NDB_WIN32 -#include <windows.h> -#else +#ifndef NDB_WIN32 #include <sys/ipc.h> #include <sys/shm.h> #endif diff --git a/ndb/src/common/transporter/SHM_Transporter.unix.cpp b/ndb/src/common/transporter/SHM_Transporter.unix.cpp index 975c1191aea..afbf124432e 100644 --- a/ndb/src/common/transporter/SHM_Transporter.unix.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.unix.cpp @@ -15,15 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include <TransporterCallback.hpp> #include <NdbSleep.h> #include <NdbOut.hpp> -#include <stdio.h> - - #include <sys/ipc.h> #include <sys/shm.h> diff --git a/ndb/src/common/transporter/SHM_Transporter.win32.cpp b/ndb/src/common/transporter/SHM_Transporter.win32.cpp index 4ba52c9179d..c289a85da0e 100644 --- a/ndb/src/common/transporter/SHM_Transporter.win32.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.win32.cpp @@ -15,14 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include <TransporterCallback.hpp> #include <NdbSleep.h> #include <NdbOut.hpp> -#include <stdio.h> - #include <windows.h> diff --git a/ndb/src/common/transporter/SendBuffer.hpp b/ndb/src/common/transporter/SendBuffer.hpp index 75ef0708e83..63a01f3de24 100644 --- a/ndb/src/common/transporter/SendBuffer.hpp +++ b/ndb/src/common/transporter/SendBuffer.hpp @@ -33,10 +33,9 @@ #include "TransporterDefinitions.hpp" #include <TransporterCallback.hpp> -#include <stdlib.h> #ifdef DEBUG_TRANSPORTER -#include <stdio.h> +#include <ndb_global.h> #endif class SendBuffer { diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp index 8a7d1741636..99b6a137797 100644 --- a/ndb/src/common/transporter/TCP_Transporter.cpp +++ b/ndb/src/common/transporter/TCP_Transporter.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbTCP.h> #include "TCP_Transporter.hpp" #include <NdbOut.hpp> @@ -23,13 +25,9 @@ #if defined NDB_OSE || defined NDB_SOFTOSE #define inet_send inet_send #else -#include <NdbStdio.h> #define inet_send send #endif -#include <stdlib.h> - - #ifdef NDB_WIN32 class ndbstrerror { diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp index 1e19a8375ba..5ca523d5185 100644 --- a/ndb/src/common/transporter/Transporter.cpp +++ b/ndb/src/common/transporter/Transporter.cpp @@ -17,7 +17,6 @@ #include "Transporter.hpp" #include "TransporterInternalDefinitions.hpp" -#include <NdbStdio.h> #include <NdbSleep.h> Transporter::Transporter(NodeId lNodeId, NodeId rNodeId, diff --git a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp index 18d54ca1e89..624b495422f 100644 --- a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp +++ b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp @@ -21,39 +21,18 @@ #include <NdbOut.hpp> #endif -#ifdef NDB_SOLARIS -#define NDB_TCP_TRANSPORTER -//#define NDB_SCI_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_OSE || defined NDB_SOFTOSE -#define NDB_TCP_TRANSPORTER -#define NDB_OSE_TRANSPORTER -#elif defined NDB_LINUX -#define NDB_TCP_TRANSPORTER -#define NDB_SCI_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_WIN32 -#define NDB_TCP_TRANSPORTER -#elif defined NDB_HPUX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_MACOSX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_IBMAIX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_TRU64X #define NDB_TCP_TRANSPORTER + +#ifdef HAVE_NDB_SHM #define NDB_SHM_TRANSPORTER -#else -#error unsupported platform #endif -#ifndef HAVE_SCI -#ifdef NDB_SCI_TRANSPORTER -#undef NDB_SCI_TRANSPORTER +#ifdef HAVE_NDB_SCI +#define NDB_SCI_TRANSPORTER #endif + +#ifdef HAVE_NDB_OSE +#define NDB_OSE_TRANSPORTER #endif #ifdef DEBUG_TRANSPORTER diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index dcd957f40ce..3f98eeed89e 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -14,14 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "TransporterRegistry.hpp" #include "TransporterInternalDefinitions.hpp" #include "Transporter.hpp" -#include <assert.h> -#include <stdlib.h> - #ifdef NDB_TCP_TRANSPORTER #include "TCP_Transporter.hpp" #endif diff --git a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp index 5d8186badb8..c0a437c4907 100644 --- a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp +++ b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp @@ -14,18 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" #include <RefConvert.hpp> -#include <NdbStdio.h> -#include <stdlib.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> #include <NdbSleep.h> -#include <NdbString.h> int basePortTCP = 17000; diff --git a/ndb/src/common/transporter/buddy.cpp b/ndb/src/common/transporter/buddy.cpp index c65aad1df2c..dc25e2dc66c 100644 --- a/ndb/src/common/transporter/buddy.cpp +++ b/ndb/src/common/transporter/buddy.cpp @@ -15,9 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "buddy.hpp" -#include <stdlib.h> -#include <math.h> - void Chunk256::setFree(bool free){ // Bit 0 of allocationTimeStamp represents if the segment is free or not diff --git a/ndb/src/common/transporter/buddy.hpp b/ndb/src/common/transporter/buddy.hpp index 7272ac884ec..f720e9e61a1 100644 --- a/ndb/src/common/transporter/buddy.hpp +++ b/ndb/src/common/transporter/buddy.hpp @@ -17,8 +17,7 @@ #ifndef BUDDY_H #define BUDDY_H -#include <stdlib.h> -#include <stdio.h> +#include <ndb_global.h> typedef unsigned int Uint32; typedef unsigned short Uint16; diff --git a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp index 03ce7ea6df3..803029ee565 100644 --- a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp +++ b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp @@ -14,17 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> +#include <ndb_global.h> + #include "sisci_types.h" #include "sisci_api.h" #include "sisci_error.h" //#include "sisci_demolib.h" -#include <strings.h> -#include <ndb_types.h> #include <NdbTick.h> -#include "NdbSleep.h" +#include <NdbSleep.h> #define NO_CALLBACK NULL #define NO_FLAGS 0 #define DATA_TRANSFER_READY 8 diff --git a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp index 6d7f7083a48..d33221c2835 100644 --- a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp +++ b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp @@ -14,18 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" #include <RefConvert.hpp> -#include <NdbStdio.h> -#include <stdlib.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> #include <NdbSleep.h> -#include <NdbString.h> int basePortTCP = 17000; diff --git a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp index 919cc9d7511..0fce6aaad39 100644 --- a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp +++ b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" @@ -21,8 +23,6 @@ #include "prioTransporterTest.hpp" -#include <NdbStdio.h> -#include <stdlib.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> diff --git a/ndb/src/common/util/Base64.cpp b/ndb/src/common/util/Base64.cpp index 5f4bbc8645a..482d0b10ad2 100644 --- a/ndb/src/common/util/Base64.cpp +++ b/ndb/src/common/util/Base64.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <string.h> +#include <ndb_global.h> #include <Base64.hpp> static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/ndb/src/common/util/BaseString.cpp b/ndb/src/common/util/BaseString.cpp index 1b0eaa1b83c..d15249adf72 100644 --- a/ndb/src/common/util/BaseString.cpp +++ b/ndb/src/common/util/BaseString.cpp @@ -15,11 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* -*- c-basic-offset: 4; -*- */ -#include <string.h> -#include <NdbStdio.h> -#include <stdarg.h> -#include "BaseString.hpp" -#include <stdlib.h> +#include <ndb_global.h> +#include <BaseString.hpp> BaseString::BaseString() { @@ -340,7 +337,6 @@ BaseString::trim(char * str, const char * delim){ #ifdef TEST_BASE_STRING -#include <assert.h> /* g++ -g -Wall -o tbs -DTEST_BASE_STRING -I$NDB_TOP/include/util \ diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index ad72b41835d..22d262a0d27 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -14,15 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <File.hpp> - -#include <errno.h> -#include <string.h> -#include <sys/stat.h> +#include <ndb_global.h> -#if defined NDB_OSE || defined NDB_SOFTOSE -#include <unistd.h> -#endif +#include <File.hpp> #include <NdbOut.hpp> @@ -31,7 +25,7 @@ // bool -File::exists(const char* aFileName) +File_class::exists(const char* aFileName) { bool rc = true; @@ -56,7 +50,7 @@ File::exists(const char* aFileName) } long -File::size(FILE* f) +File_class::size(FILE* f) { long cur_pos = 0, length = 0; @@ -69,23 +63,23 @@ File::size(FILE* f) } bool -File::rename(const char* currFileName, const char* newFileName) +File_class::rename(const char* currFileName, const char* newFileName) { return ::rename(currFileName, newFileName) == 0 ? true : false; } bool -File::remove(const char* aFileName) +File_class::remove(const char* aFileName) { return ::remove(aFileName) == 0 ? true : false; } -File::File() : +File_class::File_class() : m_file(NULL), m_fileMode("r") { } -File::File(const char* aFileName, const char* mode) : +File_class::File_class(const char* aFileName, const char* mode) : m_file(NULL), m_fileMode(mode) { @@ -93,13 +87,13 @@ File::File(const char* aFileName, const char* mode) : } bool -File::open() +File_class::open() { return open(m_fileName, m_fileMode); } bool -File::open(const char* aFileName, const char* mode) +File_class::open(const char* aFileName, const char* mode) { if(m_fileName != aFileName){ /** @@ -116,21 +110,21 @@ File::open(const char* aFileName, const char* mode) return rc; } -File::~File() +File_class::~File_class() { close(); } bool -File::remove() +File_class::remove() { // Close the file first! close(); - return File::remove(m_fileName); + return File_class::remove(m_fileName); } bool -File::close() +File_class::close() { bool rc = true; if (m_file != NULL) @@ -144,55 +138,55 @@ File::close() } int -File::read(void* buf, size_t itemSize, size_t nitems) const +File_class::read(void* buf, size_t itemSize, size_t nitems) const { return ::fread(buf, itemSize, nitems, m_file); } int -File::readChar(char* buf, long start, long length) const +File_class::readChar(char* buf, long start, long length) const { return ::fread((void*)&buf[start], 1, length, m_file); } int -File::readChar(char* buf) +File_class::readChar(char* buf) { return readChar(buf, 0, strlen(buf)); } int -File::write(const void* buf, size_t size, size_t nitems) +File_class::write(const void* buf, size_t size, size_t nitems) { return ::fwrite(buf, size, nitems, m_file); } int -File::writeChar(const char* buf, long start, long length) +File_class::writeChar(const char* buf, long start, long length) { return ::fwrite((const void*)&buf[start], sizeof(char), length, m_file); } int -File::writeChar(const char* buf) +File_class::writeChar(const char* buf) { return writeChar(buf, 0, ::strlen(buf)); } long -File::size() const +File_class::size() const { - return File::size(m_file); + return File_class::size(m_file); } const char* -File::getName() const +File_class::getName() const { return m_fileName; } int -File::flush() const +File_class::flush() const { #if defined NDB_OSE || defined NDB_SOFTOSE ::fflush(m_file); diff --git a/ndb/src/common/util/InputStream.cpp b/ndb/src/common/util/InputStream.cpp index c52b594225d..410e9a70e9c 100644 --- a/ndb/src/common/util/InputStream.cpp +++ b/ndb/src/common/util/InputStream.cpp @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "InputStream.hpp" #include <socket_io.h> -#include <assert.h> -#include <string.h> FileInputStream Stdin(stdin); diff --git a/ndb/src/common/util/Makefile b/ndb/src/common/util/Makefile index b3e33704266..e8ca2b87c20 100644 --- a/ndb/src/common/util/Makefile +++ b/ndb/src/common/util/Makefile @@ -18,15 +18,7 @@ endif ifeq ($(NDB_OS), OSE) SOURCES += NdbErrHnd.cpp endif -ifdef NDB_STRDUP - SOURCES.c += strdup.c -endif -ifdef NDB_STRLCAT - SOURCES.c += strlcat.c -endif -ifdef NDB_STRLCPY - SOURCES.c += strlcpy.c -endif + SOURCES.c += strdup.c strlcat.c strlcpy.c DIRS := testSimpleProperties diff --git a/ndb/src/common/util/NdbErrHnd.cpp b/ndb/src/common/util/NdbErrHnd.cpp index 53df5d702ca..f1c28a7bbdd 100644 --- a/ndb/src/common/util/NdbErrHnd.cpp +++ b/ndb/src/common/util/NdbErrHnd.cpp @@ -18,7 +18,6 @@ #if defined NDB_OSE || defined NDB_SOFTOSE #include <NdbOut.hpp> -#include <NdbStdio.h> #include <ndb_types.h> #include "ose.h" diff --git a/ndb/src/common/util/NdbOut.cpp b/ndb/src/common/util/NdbOut.cpp index 2624bfa04bd..6d76cf22402 100644 --- a/ndb/src/common/util/NdbOut.cpp +++ b/ndb/src/common/util/NdbOut.cpp @@ -14,11 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbOut.hpp" -#include <NdbStdio.h> -#include <stdarg.h> -#include <NdbUnistd.h> -#include <string.h> +#include <ndb_global.h> + +#include <NdbOut.hpp> #include <OutputStream.hpp> static FileOutputStream ndbouts_fileoutputstream(stdout); diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index dba7012cc0f..e91ade374cf 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -286,7 +286,6 @@ NdbSqlUtil::cmpTimespec(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 #ifdef NDB_SQL_UTIL_TEST -#include <assert.h> #include <NdbTick.h> #include <NdbOut.hpp> diff --git a/ndb/src/common/util/OutputStream.cpp b/ndb/src/common/util/OutputStream.cpp index 1143fe00fd1..bf3599dbac9 100644 --- a/ndb/src/common/util/OutputStream.cpp +++ b/ndb/src/common/util/OutputStream.cpp @@ -15,8 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <OutputStream.hpp> -#include <stdarg.h> #include <socket_io.h> FileOutputStream::FileOutputStream(FILE * file){ diff --git a/ndb/src/common/util/Parser.cpp b/ndb/src/common/util/Parser.cpp index d5c23fe14c1..2e8120f88ce 100644 --- a/ndb/src/common/util/Parser.cpp +++ b/ndb/src/common/util/Parser.cpp @@ -15,14 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "Parser.hpp" -#include <stdio.h> #include <NdbOut.hpp> -#include <string.h> #include <Properties.hpp> -#include <assert.h> #include <Base64.hpp> +#undef DEBUG #define DEBUG(x) ndbout << x << endl; static void trim(char * str); diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp index 4841d6e5e9e..2ab008142ba 100644 --- a/ndb/src/common/util/Properties.cpp +++ b/ndb/src/common/util/Properties.cpp @@ -14,14 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <Properties.hpp> #include <NdbTCP.h> -#include <string.h> -#include <stdlib.h> -#include <assert.h> -#include <NdbString.h> - #include <NdbOut.hpp> /** diff --git a/ndb/src/common/util/SimpleProperties.cpp b/ndb/src/common/util/SimpleProperties.cpp index a118478ba6c..c3980f03c4d 100644 --- a/ndb/src/common/util/SimpleProperties.cpp +++ b/ndb/src/common/util/SimpleProperties.cpp @@ -14,12 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <SimpleProperties.hpp> -#include <stdlib.h> -#include <NdbString.h> #include <NdbOut.hpp> #include <NdbTCP.h> -#include <assert.h> #include <UtilBuffer.hpp> bool diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp index 39f46eceed9..a0ec0aaa676 100644 --- a/ndb/src/common/util/SocketServer.cpp +++ b/ndb/src/common/util/SocketServer.cpp @@ -15,17 +15,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SocketServer.hpp" #include <NdbTCP.h> -#include <string.h> #include <NdbOut.hpp> #include <NdbThread.h> #include <NdbSleep.h> -#include <stdio.h> -#include <assert.h> - #define DEBUG(x) ndbout << x << endl; SocketServer::SocketServer(int maxSessions) : diff --git a/ndb/src/common/util/filetest/FileUnitTest.cpp b/ndb/src/common/util/filetest/FileUnitTest.cpp index ebcca26d3d2..b6e7b7e8ec0 100644 --- a/ndb/src/common/util/filetest/FileUnitTest.cpp +++ b/ndb/src/common/util/filetest/FileUnitTest.cpp @@ -18,7 +18,6 @@ #include <File.hpp> #include <NdbOut.hpp> -#include <assert.h> typedef bool (*TESTFUNC)(const char*); diff --git a/ndb/src/common/util/getarg.c b/ndb/src/common/util/getarg.c index 5f792437a65..ae016746987 100644 --- a/ndb/src/common/util/getarg.c +++ b/ndb/src/common/util/getarg.c @@ -32,18 +32,8 @@ * SUCH DAMAGE. */ -#include <ndb_types.h> +#include <ndb_global.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -RCSID("$KTH: getarg.c,v 1.23 2000/09/01 21:25:54 lha Exp $"); -#endif - -#include <NdbStdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <ctype.h> #include "getarg.h" #define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag) @@ -407,12 +397,12 @@ arg_match_long(struct getargs *args, size_t num_args, } case arg_string: { - *(char**)current->value = optarg + 1; + *(char**)current->value = (char*)optarg + 1; return 0; } case arg_strings: { - add_string((getarg_strings*)current->value, optarg + 1); + add_string((getarg_strings*)current->value, (char*)optarg + 1); return 0; } case arg_flag: diff --git a/ndb/src/common/util/new.cpp b/ndb/src/common/util/new.cpp index a0709a3fa13..889e83edf6f 100644 --- a/ndb/src/common/util/new.cpp +++ b/ndb/src/common/util/new.cpp @@ -1,6 +1,5 @@ -#include <malloc.h> -#include <stdlib.h> +#include <ndb_global.h> extern "C" { void (* ndb_new_handler)() = 0; diff --git a/ndb/src/common/util/random.c b/ndb/src/common/util/random.c index 91da19572e2..286ab093a26 100644 --- a/ndb/src/common/util/random.c +++ b/ndb/src/common/util/random.c @@ -18,16 +18,8 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <sys/types.h> +#include <ndb_global.h> -#ifndef NDB_WIN32 -#include <sys/time.h> -#endif - -#include <ndb_types.h> #include <NdbOut.hpp> #include <random.h> diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp index 878a9059512..8def7ebe91b 100644 --- a/ndb/src/common/util/socket_io.cpp +++ b/ndb/src/common/util/socket_io.cpp @@ -14,13 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbTCP.h> #include <socket_io.h> -#include <stdarg.h> -#include <string.h> -#include <NdbStdio.h> #include <NdbOut.hpp> -#include <NdbString.h> extern "C" int diff --git a/ndb/src/common/util/strdup.c b/ndb/src/common/util/strdup.c index 5291be86b0f..afe2306427e 100644 --- a/ndb/src/common/util/strdup.c +++ b/ndb/src/common/util/strdup.c @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdlib.h> +#include <ndb_global.h> #ifndef HAVE_STRDUP char * diff --git a/ndb/src/common/util/strlcat.c b/ndb/src/common/util/strlcat.c index ccff15da27f..aa282abe48d 100644 --- a/ndb/src/common/util/strlcat.c +++ b/ndb/src/common/util/strlcat.c @@ -31,17 +31,13 @@ * SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <ndb_types.h> +#include <ndb_global.h> /* RCSID("$KTH: strlcat.c,v 1.1 2000/08/16 01:23:47 lha Exp $"); */ -//#include <NdbString.h> #ifndef HAVE_STRLCAT + size_t strlcat (char *dst, const char *src, size_t dst_sz) { diff --git a/ndb/src/common/util/strlcpy.c b/ndb/src/common/util/strlcpy.c index 9a3048081ca..97cff177d48 100644 --- a/ndb/src/common/util/strlcpy.c +++ b/ndb/src/common/util/strlcpy.c @@ -31,20 +31,12 @@ * SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <ndb_types.h> +#include <ndb_global.h> /* RCSID("$KTH: strlcpy.c,v 1.1 2000/08/16 01:23:48 lha Exp $"); */ #ifndef HAVE_STRLCPY -#ifdef NDB_WIN32 -#include <string.h> -#endif - size_t strlcpy (char *dst, const char *src, size_t dst_sz) { diff --git a/ndb/src/common/util/testProperties/testProperties.cpp b/ndb/src/common/util/testProperties/testProperties.cpp index 4a2999b89c1..3aa2af92c5b 100644 --- a/ndb/src/common/util/testProperties/testProperties.cpp +++ b/ndb/src/common/util/testProperties/testProperties.cpp @@ -14,10 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "Properties.hpp" #include <NdbOut.hpp> -#include <stdlib.h> -#include <string.h> #include "uucode.h" diff --git a/ndb/src/common/util/testSimpleProperties/sp_test.cpp b/ndb/src/common/util/testSimpleProperties/sp_test.cpp index d6dbe2a1502..d4052b64132 100644 --- a/ndb/src/common/util/testSimpleProperties/sp_test.cpp +++ b/ndb/src/common/util/testSimpleProperties/sp_test.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SimpleProperties.hpp" #include <NdbOut.hpp> -#include <assert.h> -#include <stdio.h> Uint32 page[8192]; diff --git a/ndb/src/common/util/uucode.c b/ndb/src/common/util/uucode.c index f862d982204..da34d565153 100644 --- a/ndb/src/common/util/uucode.c +++ b/ndb/src/common/util/uucode.c @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <string.h> +#include <ndb_global.h> /* ENC is the basic 1 character encoding function to make a char printing */ /* DEC is single character decode */ diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index 2ff10f51932..10f621d5db8 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <string.h> -#include <ndb_types.h> +#include <ndb_global.h> #include <ndb_version.h> #include <version.h> @@ -61,7 +59,7 @@ struct NdbUpGradeCompatible { UG_MatchType matchType; }; -//#define TEST_VERSION +/*#define TEST_VERSION*/ #ifndef TEST_VERSION struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { @@ -74,7 +72,7 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { void ndbSetOwnVersion() {} -#else // testing purposes +#else /* testing purposes */ struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { { MAKE_VERSION(4,1,5), MAKE_VERSION(4,1,0), UG_Range }, @@ -122,7 +120,7 @@ ndbGetOwnVersion() { #ifndef TEST_VERSION return NDB_VERSION_D; -#else // testing purposes +#else /* testing purposes */ if (ndbOwnVersionTesting == 0) return NDB_VERSION_D; else diff --git a/ndb/src/cw/cpcc-win32/C++/StdAfx.h b/ndb/src/cw/cpcc-win32/C++/StdAfx.h index d84b5811f8d..370d04fb466 100644 --- a/ndb/src/cw/cpcc-win32/C++/StdAfx.h +++ b/ndb/src/cw/cpcc-win32/C++/StdAfx.h @@ -48,15 +48,12 @@ #include <afxtempl.h> // C RunTime Header Files -#include <stdlib.h> -#include <malloc.h> +#include <ndb_global.h> #include <memory.h> #include <tchar.h> #include <commctrl.h> #include <shlwapi.h> #include <crtdbg.h> -#include <string.h> -#include <stdio.h> // Local Header Files #include "resource.h" diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp index 9cf17addcc2..caf19ddba0e 100644 --- a/ndb/src/cw/cpcd/APIService.cpp +++ b/ndb/src/cw/cpcd/APIService.cpp @@ -23,7 +23,6 @@ #include "APIService.hpp" #include "CPCD.hpp" #include <NdbMutex.h> -#include <NdbStdio.h> #include <OutputStream.hpp> /** diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp index 8864ccf6e4e..f2878b7dea1 100644 --- a/ndb/src/cw/cpcd/CPCD.cpp +++ b/ndb/src/cw/cpcd/CPCD.cpp @@ -15,11 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string.h> +#include <ndb_global.h> #include <NdbOut.hpp> -#include <NdbUnistd.h> -#include <NdbStdio.h> -#include <errno.h> #include "APIService.hpp" #include "CPCD.hpp" diff --git a/ndb/src/cw/cpcd/Monitor.cpp b/ndb/src/cw/cpcd/Monitor.cpp index a96f3509ee8..2935cd0a648 100644 --- a/ndb/src/cw/cpcd/Monitor.cpp +++ b/ndb/src/cw/cpcd/Monitor.cpp @@ -14,9 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbThread.h> #include <NdbOut.hpp> -#include <NdbUnistd.h> #include <NdbSleep.h> #include "CPCD.hpp" diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index a54c6b8e475..74426306a88 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -14,13 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <sys/types.h> +#include <ndb_global.h> #include <signal.h> -#include <assert.h> -#include <stdlib.h> -#include <NdbUnistd.h> #include <BaseString.hpp> #include <InputStream.hpp> @@ -28,10 +25,9 @@ #include "CPCD.hpp" #include <pwd.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/stat.h> +#ifdef HAVE_GETRLIMIT #include <sys/resource.h> +#endif void CPCD::Process::print(FILE * f){ @@ -108,12 +104,12 @@ bool CPCD::Process::isRunning() { if(m_pid <= 1){ - logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid); + //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid); return false; } /* Check if there actually exists a process with such a pid */ errno = 0; - int s = kill((pid_t) m_pid, 0); /* Sending "signal" 0 to a process only + int s = kill((pid_t)-m_pid, 0); /* Sending "signal" 0 to a process only * checkes if the process actually exists */ if(s != 0) { switch(errno) { @@ -130,7 +126,6 @@ CPCD::Process::isRunning() { } return false; } - return true; } @@ -152,7 +147,6 @@ CPCD::Process::readPid() { f = fopen(filename, "r"); if(f == NULL){ - logger.debug("readPid - %s not found", filename); return -1; /* File didn't exist */ } @@ -213,6 +207,7 @@ setup_environment(const char *env) { static int set_ulimit(const BaseString & pair){ +#ifdef HAVE_GETRLIMIT errno = 0; do { Vector<BaseString> list; @@ -220,42 +215,43 @@ set_ulimit(const BaseString & pair){ if(list.size() != 2){ break; } - - int resource = 0; + + int res; rlim_t value = RLIM_INFINITY; if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } + + struct rlimit rlp; +#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} + if(list[0].trim() == "c"){ - resource = RLIMIT_CORE; + _RLIMIT_FIX(RLIMIT_CORE); } else if(list[0] == "d"){ - resource = RLIMIT_DATA; + _RLIMIT_FIX(RLIMIT_DATA); } else if(list[0] == "f"){ - resource = RLIMIT_FSIZE; + _RLIMIT_FIX(RLIMIT_FSIZE); } else if(list[0] == "n"){ - resource = RLIMIT_NOFILE; + _RLIMIT_FIX(RLIMIT_NOFILE); } else if(list[0] == "s"){ - resource = RLIMIT_STACK; + _RLIMIT_FIX(RLIMIT_STACK); } else if(list[0] == "t"){ - resource = RLIMIT_CPU; + _RLIMIT_FIX(RLIMIT_CPU); } else { errno = EINVAL; break; } - struct rlimit rlp; - if(getrlimit(resource, &rlp) != 0){ + if(!res) break; - } - - rlp.rlim_cur = value; - if(setrlimit(resource, &rlp) != 0){ - break; - } + return 0; } while(false); logger.error("Unable to process ulimit: %s(%s)", pair.c_str(), strerror(errno)); return -1; +#else + return 0; // Maybe it's ok anyway... +#endif } void @@ -360,8 +356,8 @@ CPCD::Process::start() { */ switch(pid = fork()) { case 0: /* Child */ - - writePid(getpid()); + setsid(); + writePid(getpgrp()); if(runas(m_runas.c_str()) == 0){ do_exec(); } @@ -386,14 +382,13 @@ CPCD::Process::start() { switch(fork()) { case 0: /* Child */ signal(SIGCHLD, SIG_IGN); - pid_t pid; switch(pid = fork()) { case 0: /* Child */ - writePid(getpid()); + setsid(); + writePid(getpgrp()); if(runas(m_runas.c_str()) != 0){ _exit(1); } - setsid(); do_exec(); _exit(1); /* NOTREACHED */ @@ -424,15 +419,18 @@ CPCD::Process::start() { logger.critical("Unknown process type"); return -1; } - + while(readPid() < 0){ sched_yield(); } - - if(pid != -1 && pid != m_pid){ - logger.error("pid and m_pid don't match: %d %d", pid, m_pid); + + errno = 0; + pid_t pgid = getpgid(pid); + + if(pgid != -1 && pgid != m_pid){ + logger.error("pgid and m_pid don't match: %d %d (%d)", pgid, m_pid, pid); } - + if(isRunning()){ m_status = RUNNING; return 0; @@ -449,33 +447,36 @@ CPCD::Process::stop() { unlink(filename); if(m_pid <= 1){ - logger.critical("Stopping process with bogus pid: %d", m_pid); + logger.critical("Stopping process with bogus pid: %d id: %d", + m_pid, m_id); return; } m_status = STOPPING; - - int ret = kill((pid_t)m_pid, SIGTERM); + + errno = 0; + int ret = kill(-m_pid, SIGTERM); switch(ret) { case 0: - logger.debug("Sent SIGTERM to pid %d", (int)m_pid); + logger.debug("Sent SIGTERM to pid %d", (int)-m_pid); break; default: - logger.debug("kill pid: %d : %s", (int)m_pid, strerror(errno)); + logger.debug("kill pid: %d : %s", (int)-m_pid, strerror(errno)); break; } - + if(isRunning()){ - ret = kill((pid_t)m_pid, SIGKILL); + errno = 0; + ret = kill(-m_pid, SIGKILL); switch(ret) { case 0: - logger.debug("Sent SIGKILL to pid %d", (int)m_pid); + logger.debug("Sent SIGKILL to pid %d", (int)-m_pid); break; default: - logger.debug("kill pid: %d : %s\n", (int)m_pid, strerror(errno)); + logger.debug("kill pid: %d : %s\n", (int)-m_pid, strerror(errno)); break; } - } - + } + m_pid = -1; m_status = STOPPED; } diff --git a/ndb/src/cw/cpcd/common.cpp b/ndb/src/cw/cpcd/common.cpp index 731866b22fd..cb1c0c37183 100644 --- a/ndb/src/cw/cpcd/common.cpp +++ b/ndb/src/cw/cpcd/common.cpp @@ -14,11 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "common.hpp" #include <logger/Logger.hpp> #include <pwd.h> -#include <sys/types.h> -#include <unistd.h> #include <Properties.hpp> #include <BaseString.hpp> @@ -152,7 +152,10 @@ parse_config_file(struct getargs args[], int num_arg, const Properties& p){ break; } } - if(!found) + if(!found) { printf("Unknown parameter: %s\n", name); + return 1; + } } + return 0; } diff --git a/ndb/src/cw/cpcd/common.hpp b/ndb/src/cw/cpcd/common.hpp index 65fcce05f66..c3d87b8b9f5 100644 --- a/ndb/src/cw/cpcd/common.hpp +++ b/ndb/src/cw/cpcd/common.hpp @@ -17,7 +17,7 @@ #ifndef __CPCD_COMMON_HPP_INCLUDED__ #define __CPCD_COMMON_HPP_INCLUDED__ -#include <stdio.h> +#include <ndb_global.h> #include <logger/Logger.hpp> #include <getarg.h> diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp index 8dd4f2b4608..11f6238d5f7 100644 --- a/ndb/src/cw/cpcd/main.cpp +++ b/ndb/src/cw/cpcd/main.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <sys/types.h> /* Needed for mkdir(2) */ -#include <sys/stat.h> /* Needed for mkdir(2) */ -#include <errno.h> +#include <ndb_global.h> /* Needed for mkdir(2) */ #include <signal.h> #include "CPCD.hpp" diff --git a/ndb/src/cw/test/socketclient/socketClientTest.cpp b/ndb/src/cw/test/socketclient/socketClientTest.cpp index a4a0ed1e933..423c196aa43 100644 --- a/ndb/src/cw/test/socketclient/socketClientTest.cpp +++ b/ndb/src/cw/test/socketclient/socketClientTest.cpp @@ -15,11 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <NdbOut.hpp> #include <Properties.hpp> #include <socket_io.h> -#include <NdbStdio.h> -#include <stdlib.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbSleep.h> diff --git a/ndb/src/cw/util/ClientInterface.hpp b/ndb/src/cw/util/ClientInterface.hpp index 764705afacd..66ecfe05197 100644 --- a/ndb/src/cw/util/ClientInterface.hpp +++ b/ndb/src/cw/util/ClientInterface.hpp @@ -16,6 +16,7 @@ #ifndef CLIENT_IF_HPP #define CLIENT_IF_HPP +#include <ndb_global.h> #include <Parser.hpp> #include <InputStream.hpp> #include <Parser.hpp> @@ -23,9 +24,6 @@ #include <Properties.hpp> #include "SocketRegistry.hpp" #include "SocketService.hpp" -#include "string.h" -#include <stdio.h> -#include <stdlib.h> class ClientInterface { private: diff --git a/ndb/src/kernel/blocks/backup/FsBuffer.hpp b/ndb/src/kernel/blocks/backup/FsBuffer.hpp index 4b5d95a19a5..2f3c7daae43 100644 --- a/ndb/src/kernel/blocks/backup/FsBuffer.hpp +++ b/ndb/src/kernel/blocks/backup/FsBuffer.hpp @@ -17,10 +17,7 @@ #ifndef FS_BUFFER_HPP #define FS_BUFFER_HPP -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include <ndb_types.h> +#include <ndb_global.h> #define DEBUG(x) diff --git a/ndb/src/kernel/blocks/backup/read.cpp b/ndb/src/kernel/blocks/backup/read.cpp index 8300c74ab43..921c352ea13 100644 --- a/ndb/src/kernel/blocks/backup/read.cpp +++ b/ndb/src/kernel/blocks/backup/read.cpp @@ -15,9 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <ndb_global.h> #include <NdbTCP.h> #include <NdbOut.hpp> diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile b/ndb/src/kernel/blocks/backup/restore/Makefile index f99e3e3da0d..4c884525d73 100644 --- a/ndb/src/kernel/blocks/backup/restore/Makefile +++ b/ndb/src/kernel/blocks/backup/restore/Makefile @@ -1,12 +1,12 @@ include .defs.mk -TYPE := ndbapi ndbapiclient +TYPE := * BIN_TARGET := restore BIN_TARGET_LIBS := -BIN_TARGET_ARCHIVES := NDB_API general +BIN_TARGET_ARCHIVES := NDB_API -CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi +CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi -I$(NDB_TOP)/include/ndbapi -I$(NDB_TOP)/include/util -I$(NDB_TOP)/include/portlib -I$(NDB_TOP)/include/kernel #ifneq ($(MYSQLCLUSTER_TOP),) #CCFLAGS_LOC +=-I$(MYSQLCLUSTER_TOP)/include -D USE_MYSQL diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp index 50eb0df7c56..2c3c1c8df7b 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp @@ -14,11 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "Restore.hpp" #include "BackupFormat.hpp" #include <NdbTCP.h> -#include <NdbStdio.h> #include <OutputStream.hpp> #include <Bitmask.hpp> @@ -514,7 +512,8 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, NdbDictionary::Column::Type type; if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) { tableImpl->setName(tableName); - for(Uint32 i = 0 ; i < tableImpl->getNoOfColumns(); i++) { + Uint32 noOfColumns = tableImpl->getNoOfColumns(); + for(Uint32 i = 0 ; i < noOfColumns; i++) { type = convertToV3x(tableImpl->getColumn(i)->m_extType, columnTypeMapping, -1); @@ -562,7 +561,7 @@ bool TupleS::prepareRecord(const TableS & tab){ m_currentTable = &tab; for(int i = 0; i<allAttributes.size(); i++) { - if(!allAttributes[i] == NULL) + if(allAttributes[i] != NULL) delete allAttributes[i]; } allAttributes.clear(); diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp index f1a73bb18b9..0c075e18933 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp @@ -17,16 +17,13 @@ #ifndef RESTORE_H #define RESTORE_H -#include <stddef.h> +#include <ndb_global.h> #include <BackupFormat.hpp> #include <NdbApi.hpp> #include <AttrType.hpp> #include <NdbOut.hpp> #include "myVector.hpp" -#include <NdbStdio.h> -#include <NdbUnistd.h> -#include <NdbString.h> #include <ndb_version.h> #include <version.h> diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp index b38f6ab751b..4c15785d5c2 100644 --- a/ndb/src/kernel/blocks/backup/restore/main.cpp +++ b/ndb/src/kernel/blocks/backup/restore/main.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "Restore.hpp" #include <getarg.h> #include <NdbSleep.h> diff --git a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp index b16990bda6c..bf721a0b30a 100644 --- a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp +++ b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp @@ -15,13 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> +#include <ndb_global.h> + #include <NdbMain.h> #include <NdbOut.hpp> #include <SchemaFile.hpp> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> void usage(const char * prg){ diff --git a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp index 4c55425bdd7..efa4b9c92c5 100644 --- a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp +++ b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp @@ -15,13 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbStdio.h> +#include <ndb_global.h> + #include <NdbMain.h> #include <NdbOut.hpp> #include <Sysfile.hpp> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> void usage(const char * prg){ diff --git a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp index d2d166fa03e..540df7b507e 100644 --- a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp +++ b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp @@ -25,11 +25,10 @@ //---------------------------------------------------------------- +#include <ndb_global.h> + #include "records.hpp" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> + #define RETURN_ERROR 1 #define RETURN_OK 0 diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp index 887f82308d6..54cb93e9736 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp @@ -49,7 +49,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal) Uint32 noOfAttributes = signal->theData[4]; Uint32 fragId = signal->theData[5]; Uint32 noOfNullAttr = signal->theData[7]; - Uint32 schemaVersion = signal->theData[8]; + /* Uint32 schemaVersion = signal->theData[8];*/ Uint32 noOfKeyAttr = signal->theData[9]; Uint32 noOfNewAttr = signal->theData[10]; diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index c56e455a42a..4737c8422c4 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -83,6 +83,9 @@ #define jamEntry() jamEntryLine(90000 + __LINE__) #endif +#undef max +#undef min + class Configuration; class Dbtux : public SimulatedBlock { diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp index 2cb129bc591..92410e1a784 100644 --- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp +++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "DbUtil.hpp" -#include <new> -#include <stddef.h> #include <ndb_version.h> #include <signaldata/WaitGCP.hpp> @@ -1303,26 +1303,6 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) TcKeyReq::setAIInTcKeyReq(requestInfo, 0); // Attrinfo sent separately prepOpPtr.p->tckey.requestInfo = requestInfo; - if (operationType == UtilPrepareReq::Read) { - // ResultSet - AttrMappingBuffer::ConstDataBufferIterator tmpIt; -#if 0 //def EVENT_DEBUG - ResultSetBuffer & rs = prepOpPtr.p->rsInfo; - ResultSetInfoBuffer::DataBufferIterator it; - rs.first(it); - for (prepOpPtr.p->attrMapping.first(tmpIt); - tmpIt.curr.i != RNIL; - prepOpPtr.p->attrMapping.next(tmpIt)) { - AttributeHeader* ah = (AttributeHeader *) tmpIt.data; - ah->print(stdout); - AttributeHeader* rsah = (AttributeHeader *) it.data; - rsah->print(stdout); - rs.next(it,1); - printf("%d\n",it.data); - } -#endif - } - /**************************** * Confirm completed prepare ****************************/ @@ -1914,7 +1894,6 @@ DbUtil::runOperation(Signal* signal, TransactionPtr & transPtr, Operation * op = opPtr.p; const PreparedOperation * pop = op->prepOp; - Uint32 lastFlag = 0; if(!transPtr.p->operations.next(opPtr)){ TcKeyReq::setCommitFlag(start, 1); // Last operation TcKeyReq::setExecuteFlag(start, 1); @@ -2127,43 +2106,11 @@ DbUtil::execTRANSID_AI(Signal* signal){ /** * Save result */ - Uint32 srcSz = dataLen; const Uint32 *src = &signal->theData[3]; - const Uint32 segSize = opP->rs.getSegmentSize(); - -#if 0 //def EVENT_DEBUG - printf("rsRecv %u, dataLen %u, rsExpect %u\n", - opP->rsRecv, dataLen, opP->rsExpect); -#endif - ResultSetBuffer::DataBufferIterator rs = opP->rsIterator; -#if 0 //def EVENT_DEBUG - for(int i = 0; i < dataLen; i++) - printf("H'%.8x ", src[i]); -#endif - ndbrequire(opP->rs.import(rs,src,dataLen)); opP->rs.next(rs, dataLen); - -#if 0 // replaced this section with import() above - while(srcSz > segSize){ - ndbrequire(rs.curr.i != RNIL); - memcpy(rs.data, src, segSize << 2); - opP->rs.next(rs, segSize); - srcSz -= segSize; - // src += segSize * 4; // Bug? - src += segSize; - } - - if(srcSz > 0){ - jam(); - memcpy(rs.data, src, srcSz << 2); - rs.curr.i = RNIL; - rs.data = 0; - } -#endif - opP->rsIterator = rs; if(!opP->complete()){ @@ -2171,20 +2118,12 @@ DbUtil::execTRANSID_AI(Signal* signal){ return; } -#if 0 //def EVENT_DEBUG - printf("op complete\n"); -#endif - transPtr.p->recv++; if(!transPtr.p->complete()){ jam(); return; } -#if 0 //def EVENT_DEBUG - printf("trans complete\n"); -#endif - finishTransaction(signal, transPtr); } diff --git a/ndb/src/kernel/blocks/grep/Grep.cpp b/ndb/src/kernel/blocks/grep/Grep.cpp index 093e9a225e6..ee506ce922a 100644 --- a/ndb/src/kernel/blocks/grep/Grep.cpp +++ b/ndb/src/kernel/blocks/grep/Grep.cpp @@ -1294,7 +1294,7 @@ Grep::PSPart::execSUB_REMOVE_REF(Signal* signal) jamEntry(); SubRemoveRef * const ref = (SubRemoveRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err = (GrepError::Code)ref->err; + /* GrepError::Code err = (GrepError::Code)ref->err;*/ SubscriptionPtr subPtr; c_subscriptions.getPtr(subPtr, subData); diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 0e2aa4c6903..f73c1ec5ee7 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -23,20 +23,17 @@ #endif #endif +#include <ndb_global.h> + #include "Error.hpp" #include "AsyncFile.hpp" #include <ErrorHandlingMacros.hpp> #include <kernel_types.h> -#include <string.h> #include <NdbMem.h> #include <NdbThread.h> #include <signaldata/FsOpenReq.hpp> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> - #ifdef NDB_LINUX // This is for pread and pwrite #ifndef __USE_UNIX98 @@ -44,9 +41,7 @@ #endif #endif -#include <NdbUnistd.h> #if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE -#include <NdbStdio.h> #else // For readv and writev #include <sys/uio.h> @@ -566,9 +561,8 @@ AsyncFile::writeReq( Request * request) if (((i + 1) < request->par.readWrite.numberOfPages)) { // There are more pages to write // Check that offsets are consequtive - if ((page_offset + request->par.readWrite.pages[i].size) - != - request->par.readWrite.pages[i+1].offset) { + off_t tmp = page_offset + request->par.readWrite.pages[i].size; + if (tmp != request->par.readWrite.pages[i+1].offset) { // Next page is not aligned with previous, not allowed DEBUG(ndbout_c("Page offsets are not aligned")); request->error = EINVAL; diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp index b9954ba130f..004752c9543 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp @@ -16,10 +16,8 @@ //#define TESTDEBUG 1 -#include <sys/stat.h> -#include <fcntl.h> +#include <ndb_global.h> -#include <string.h> #include <kernel_types.h> #include <Pool.hpp> #include "AsyncFile.hpp" diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.cpp b/ndb/src/kernel/blocks/ndbfs/Filename.cpp index c0bc52b4501..494c9c74eb9 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.cpp @@ -14,10 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdlib.h> -#include <string.h> -#include <NdbStdio.h> -#include <NdbUnistd.h> +#include <ndb_global.h> + #include <NdbOut.hpp> #include "Filename.hpp" diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.hpp b/ndb/src/kernel/blocks/ndbfs/Filename.hpp index 4c3569b5485..29aba79c9dc 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.hpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.hpp @@ -52,8 +52,8 @@ // //=========================================================================== +#include <ndb_global.h> #include <kernel_types.h> -#include <NdbUnistd.h> class Filename { diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp index 6e0c2721ca0..435a6a6b208 100644 --- a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp +++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp @@ -76,7 +76,6 @@ #include "NdbCondition.h" #include <NdbOut.hpp> -#include <assert.h> template <class T> class MemoryChannel diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp index 9f70efcadf7..ca90bc60153 100644 --- a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp +++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp @@ -65,7 +65,6 @@ #include "NdbMutex.h" #include "NdbCondition.h" -#include <assert.h> diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index 8992a2104e9..36322ffad1e 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <limits.h> -#include <errno.h> +#include <ndb_global.h> #include "Ndbfs.hpp" #include "AsyncFile.hpp" @@ -855,7 +854,7 @@ int Ndbfs::translateErrno(int aErrno) //no space left on device case ENFILE: case EDQUOT: -#ifndef NDB_MACOSX +#ifdef ENOSR case ENOSR: #endif case ENOSPC: @@ -873,12 +872,16 @@ int Ndbfs::translateErrno(int aErrno) return FsRef::fsErrInvalidParameters; //environment error case ELOOP: -#ifndef NDB_MACOSX +#ifdef ENOLINK case ENOLINK: +#endif +#ifdef EMULTIHOP case EMULTIHOP: #endif -#ifndef NDB_LINUX +#ifdef EOPNOTSUPP case EOPNOTSUPP: +#endif +#ifdef ESPIPE case ESPIPE: #endif case EPIPE: diff --git a/ndb/src/kernel/blocks/suma/SumaInit.cpp b/ndb/src/kernel/blocks/suma/SumaInit.cpp index e9fba5e789c..9f0659942a2 100644 --- a/ndb/src/kernel/blocks/suma/SumaInit.cpp +++ b/ndb/src/kernel/blocks/suma/SumaInit.cpp @@ -132,9 +132,9 @@ SumaParticipant::~SumaParticipant() Suma::Suma(const Configuration & conf) : SumaParticipant(conf), + Restart(*this), c_nodes(c_nodePool), - c_runningSubscriptions(c_subCoordinatorPool), - Restart(*this) + c_runningSubscriptions(c_subCoordinatorPool) { c_nodePool.setSize(MAX_NDB_NODES); diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 1aa937f4675..56627cba46f 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -15,17 +15,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "Error.hpp" #include "ErrorReporter.hpp" #include "ErrorMessages.hpp" #include <FastScheduler.hpp> #include <DebuggerNames.hpp> -#include <NdbUnistd.h> -#include <NdbStdio.h> #include <NdbHost.h> #include <NdbConfig.h> -#include <string.h> #include <Configuration.hpp> #define MESSAGE_LENGTH 400 diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp index f1428821ab0..20340a9602f 100644 --- a/ndb/src/kernel/error/ErrorReporter.hpp +++ b/ndb/src/kernel/error/ErrorReporter.hpp @@ -17,9 +17,10 @@ #ifndef ERRORREPORTER_H #define ERRORREPORTER_H +#include <ndb_global.h> + #include "TimeModule.hpp" #include "Error.hpp" -#include <stdio.h> #include <Emulator.hpp> diff --git a/ndb/src/kernel/error/TimeModule.cpp b/ndb/src/kernel/error/TimeModule.cpp index c0f4e40858f..4bd8e3daf99 100644 --- a/ndb/src/kernel/error/TimeModule.cpp +++ b/ndb/src/kernel/error/TimeModule.cpp @@ -16,8 +16,8 @@ +#include <ndb_global.h> #include "TimeModule.hpp" -#include <time.h> static const char* cMonth[] = { "x", "January", "February", "Mars", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; diff --git a/ndb/src/kernel/ndb-main/Main.cpp b/ndb/src/kernel/ndb-main/Main.cpp index 88fd9d177de..46eb41b0ec6 100644 --- a/ndb/src/kernel/ndb-main/Main.cpp +++ b/ndb/src/kernel/ndb-main/Main.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <ndb_version.h> #include "Configuration.hpp" #include <TransporterRegistry.hpp> @@ -32,7 +34,6 @@ #include <NodeState.hpp> #if defined NDB_SOLARIS -#include <sys/types.h> // For system information #include <sys/processor.h> // For system informatio #endif @@ -41,10 +42,6 @@ #endif extern EventLogger g_eventLogger; -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) -#include <sys/types.h> -#include <sys/wait.h> -#endif void catchsigs(bool ignore); // for process signal handling extern "C" void handler(int signo); // for process signal handling @@ -81,10 +78,6 @@ NDB_MAIN(ndb_kernel){ char homePath[255]; NdbConfig_HomePath(homePath, 255); -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) - /** - * This has only been tested with linux & solaris - */ if (theConfig->getDaemonMode()) { // Become a daemon char lockfile[255], logfile[255]; @@ -137,7 +130,6 @@ NDB_MAIN(ndb_kernel){ } g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid()); -#endif systemInfo(* theConfig, theConfig->clusterConfigurationData().SizeAltData.logLevel); @@ -188,9 +180,9 @@ NDB_MAIN(ndb_kernel){ void systemInfo(const Configuration & config, const LogLevel & logLevel){ +#ifdef NDB_WIN32 int processors = 0; int speed; -#ifdef NDB_WIN32 SYSTEM_INFO sinfo; GetSystemInfo(&sinfo); processors = sinfo.dwNumberOfProcessors; @@ -236,16 +228,25 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ void catchsigs(bool ignore){ #if ! defined NDB_SOFTOSE && !defined NDB_OSE + +#if defined SIGRTMIN + #define MAX_SIG_CATCH SIGRTMIN +#elif defined NSIG + #define MAX_SIG_CATCH NSIG +#else + #error "neither SIGRTMIN or NSIG is defined on this platform, please report bug at bugs.mysql.com" +#endif + // Makes the main process catch process signals, eg installs a // handler named "handler". "handler" will then be called is instead // of the defualt process signal handler) if(ignore){ - for(int i = 1; i<100; i++){ + for(int i = 1; i < MAX_SIG_CATCH; i++){ if(i != SIGCHLD) signal(i, SIG_IGN); - } + } } else { - for(int i = 1; i<100; i++){ + for(int i = 1; i < MAX_SIG_CATCH; i++){ signal(i, handler); } } @@ -260,8 +261,10 @@ handler(int sig){ case SIGINT: /* 2 - Interrupt */ case SIGQUIT: /* 3 - Quit */ case SIGTERM: /* 15 - Terminate */ -#ifndef NDB_MACOSX +#ifdef SIGPWR case SIGPWR: /* 19 - Power fail */ +#endif +#ifdef SIGPOLL case SIGPOLL: /* 22 */ #endif case SIGSTOP: /* 23 */ @@ -270,6 +273,9 @@ handler(int sig){ case SIGTTOU: /* 27 */ globalData.theRestartFlag = perform_stop; break; +#ifdef SIGWINCH + case SIGWINCH: +#endif case SIGPIPE: /** * Can happen in TCP Transporter diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp index 4a84047b614..284d29dcefa 100644 --- a/ndb/src/kernel/vm/ArrayPool.hpp +++ b/ndb/src/kernel/vm/ArrayPool.hpp @@ -17,12 +17,12 @@ #ifndef ARRAY_POOL_HPP #define ARRAY_POOL_HPP +#include <ndb_global.h> + #include <pc.hpp> #include <ErrorReporter.hpp> #include <NdbMem.h> #include <Bitmask.hpp> -#include <assert.h> -#include <stddef.h> template <class T> class Array; template <class T> class SLList; diff --git a/ndb/src/kernel/vm/ClusterConfiguration.cpp b/ndb/src/kernel/vm/ClusterConfiguration.cpp index f04081ee3c1..3a6478380d1 100644 --- a/ndb/src/kernel/vm/ClusterConfiguration.cpp +++ b/ndb/src/kernel/vm/ClusterConfiguration.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "ClusterConfiguration.hpp" #include <ErrorHandlingMacros.hpp> @@ -27,9 +29,6 @@ #include <signaldata/TupSizeAltReq.hpp> #include <signaldata/TuxSizeAltReq.hpp> -#include <string.h> -#include <assert.h> - ClusterConfiguration::ClusterConfiguration() { for (unsigned i= 0; i< MAX_SIZEALT_BLOCKS; i++) // initialize diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 03495449787..706d75509f2 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -24,7 +24,6 @@ #include <NdbMem.h> #include <NdbOut.hpp> #include <WatchDog.hpp> -#include <NdbString.h> #include <getarg.h> diff --git a/ndb/src/kernel/vm/DLHashTable.hpp b/ndb/src/kernel/vm/DLHashTable.hpp index f7cd7ae5228..13a9632f8da 100644 --- a/ndb/src/kernel/vm/DLHashTable.hpp +++ b/ndb/src/kernel/vm/DLHashTable.hpp @@ -17,9 +17,8 @@ #ifndef DL_HASHTABLE_HPP #define DL_HASHTABLE_HPP +#include <ndb_global.h> #include "ArrayList.hpp" -#include <assert.h> -#include <stddef.h> /** * DLHashTable implements a hashtable using chaining diff --git a/ndb/src/kernel/vm/DLHashTable2.hpp b/ndb/src/kernel/vm/DLHashTable2.hpp index 8386790b0a6..6b166331631 100644 --- a/ndb/src/kernel/vm/DLHashTable2.hpp +++ b/ndb/src/kernel/vm/DLHashTable2.hpp @@ -17,10 +17,9 @@ #ifndef DL_HASHTABLE2_HPP #define DL_HASHTABLE2_HPP +#include <ndb_global.h> + #include "ArrayList.hpp" -#include <assert.h> -#include <stddef.h> -#include <new> /** * DLHashTable2 is a DLHashTable variant meant for cases where different diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index a852e045c6e..0d6d3f55acb 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "Emulator.hpp" #include <FastScheduler.hpp> #include <SignalLoggerManager.hpp> @@ -31,19 +33,12 @@ #include <NdbOut.hpp> #include <NdbMutex.h> #include <NdbSleep.h> -#include <stdlib.h> #include <new> extern "C" { extern void (* ndb_new_handler)(); } - -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) -#include <sys/types.h> -#include <sys/wait.h> -#endif - /** * Declare the global variables */ diff --git a/ndb/src/kernel/vm/GlobalData.hpp b/ndb/src/kernel/vm/GlobalData.hpp index ca7dd467750..99b65727374 100644 --- a/ndb/src/kernel/vm/GlobalData.hpp +++ b/ndb/src/kernel/vm/GlobalData.hpp @@ -17,11 +17,10 @@ #ifndef GLOBAL_DATA_H #define GLOBAL_DATA_H +#include <ndb_global.h> #include <kernel_types.h> #include "Prio.hpp" #include "VMSignal.hpp" -#include <stdlib.h> -#include <assert.h> #include <BlockNumbers.h> #include <NodeState.hpp> diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index f36b3e43d42..e3f087d7d74 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "SimulatedBlock.hpp" #include <NdbOut.hpp> #include <GlobalData.hpp> @@ -24,8 +26,6 @@ #include <SignalLoggerManager.hpp> #include <FastScheduler.hpp> #include <NdbMem.h> -#include <NdbStdio.h> -#include <stdarg.h> #include <signaldata/EventReport.hpp> #include <signaldata/ContinueFragmented.hpp> #include <signaldata/NodeStateSignalData.hpp> diff --git a/ndb/src/kernel/vm/TransporterCallback.cpp b/ndb/src/kernel/vm/TransporterCallback.cpp index 1fec4ea86bd..3798e4040c8 100644 --- a/ndb/src/kernel/vm/TransporterCallback.cpp +++ b/ndb/src/kernel/vm/TransporterCallback.cpp @@ -14,12 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <TransporterCallback.hpp> #include <TransporterRegistry.hpp> #include <FastScheduler.hpp> #include <Emulator.hpp> #include <ErrorHandlingMacros.hpp> -#include <stdio.h> #include "LongSignal.hpp" diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp index d436143c055..45e731f2079 100644 --- a/ndb/src/kernel/vm/VMSignal.hpp +++ b/ndb/src/kernel/vm/VMSignal.hpp @@ -17,14 +17,15 @@ #ifndef VMSignal_H #define VMSignal_H +#include <ndb_global.h> +#include <ndb_limits.h> +#include <kernel_types.h> + #include <ErrorReporter.hpp> #include <NodeBitmask.hpp> -#include <ndb_limits.h> -#include <kernel_types.h> #include <RefConvert.hpp> #include <TransporterDefinitions.hpp> -#include <stdlib.h> /** * Struct used when sending to multiple blocks diff --git a/ndb/src/kernel/vm/al_test/arrayListTest.cpp b/ndb/src/kernel/vm/al_test/arrayListTest.cpp index 39d8170cfc5..bb320106653 100644 --- a/ndb/src/kernel/vm/al_test/arrayListTest.cpp +++ b/ndb/src/kernel/vm/al_test/arrayListTest.cpp @@ -16,11 +16,11 @@ +#include <ndb_global.hpp> + #include <ArrayList.hpp> -#include <stdlib.h> #include <NdbOut.hpp> #include <NdbTick.h> -#include <assert.h> struct A_Listable_Object { Uint32 next; diff --git a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp index 8b554d5bb41..e80905121e1 100644 --- a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp +++ b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp @@ -16,12 +16,11 @@ +#include <ndb_global.h> + #include <ArrayList.hpp> -#include <stdlib.h> #include <NdbOut.hpp> #include <NdbTick.h> -#include <assert.h> -#include <string.h> struct A_Poolable_Object { Uint32 next; diff --git a/ndb/src/kernel/vm/al_test/main.cpp b/ndb/src/kernel/vm/al_test/main.cpp index 42c36173b56..23193b50725 100644 --- a/ndb/src/kernel/vm/al_test/main.cpp +++ b/ndb/src/kernel/vm/al_test/main.cpp @@ -14,11 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <ArrayList.hpp> -#include <stdlib.h> #include <NdbOut.hpp> #include <NdbTick.h> -#include <assert.h> #include <NdbMain.h> #include "arrayListTest.cpp" diff --git a/ndb/src/kernel/vm/testCopy/rr.cpp b/ndb/src/kernel/vm/testCopy/rr.cpp index 2da8383f523..1e8305dfe4c 100644 --- a/ndb/src/kernel/vm/testCopy/rr.cpp +++ b/ndb/src/kernel/vm/testCopy/rr.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <sched.h> -#include <sys/types.h> -#include <unistd.h> -#include <stdio.h> int main(int argc, char * const argv[]){ diff --git a/ndb/src/kernel/vm/testCopy/testCopy.cpp b/ndb/src/kernel/vm/testCopy/testCopy.cpp index 1b4b24f5934..78a1dab2619 100644 --- a/ndb/src/kernel/vm/testCopy/testCopy.cpp +++ b/ndb/src/kernel/vm/testCopy/testCopy.cpp @@ -15,11 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <NdbOut.hpp> #include <NdbTick.h> -#include <ndb_types.h> -#include <string.h> -#include <stdlib.h> #ifdef __NDB_FORTE6 #define HAND diff --git a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp index def8387e343..5ba59418223 100644 --- a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp +++ b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp @@ -14,10 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <ndb_global.h> #include <NdbTick.h> #include <DataBuffer.hpp> -#include <stdlib.h> -#include <string.h> + +#undef test struct Buffer { Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;} diff --git a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp index 6d421268a0a..af4e2ca6e24 100644 --- a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp +++ b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <editline/editline.h> #include <SignalSender.hpp> -#include <assert.h> -#include <stdlib.h> void print_help(){ diff --git a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp index 20a5d5230fb..e16870edf11 100644 --- a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp +++ b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp @@ -14,12 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <NdbTick.h> #include <TransporterDefinitions.hpp> #include <SimpleProperties.hpp> #include <LongSignal.hpp> -#include <stdlib.h> -#include <string.h> + +#undef test struct Buffer { Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;} diff --git a/ndb/src/mgmapi/Makefile b/ndb/src/mgmapi/Makefile index fac852dbba8..9e7ba4f5ac7 100644 --- a/ndb/src/mgmapi/Makefile +++ b/ndb/src/mgmapi/Makefile @@ -9,7 +9,7 @@ A_LIB := Y SO_LIB := Y PIC_LIB := Y -DIRS := test +#DIRS := test LIB_TARGET := MGM_API LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 4c1355e8e46..fcdfe943fb1 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -14,17 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <NdbTCP.h> #include "mgmapi.h" #include "mgmapi_debug.h" #include <socket_io.h> -#include <stdlib.h> - -#include <string.h> -#include <NdbStdio.h> -#include <NdbString.h> -#include <errno.h> #include <NdbOut.hpp> #include <SocketServer.hpp> #include <Parser.hpp> diff --git a/ndb/src/mgmapi/test/keso.c b/ndb/src/mgmapi/test/keso.c index f4b192e3db8..d5086b20b6a 100644 --- a/ndb/src/mgmapi/test/keso.c +++ b/ndb/src/mgmapi/test/keso.c @@ -15,6 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <mgmapi.h> #ifdef VM_TRACE @@ -22,9 +24,6 @@ #endif #include <NdbOut.hpp> -#include <NdbStdio.h> - -#include <stdlib.h> static int testConnect(NdbMgmHandle h, struct ndb_mgm_reply* reply); static int testDisconnect(NdbMgmHandle h, struct ndb_mgm_reply* reply); @@ -60,8 +59,8 @@ struct test_case test_connect_disconnect[] = { struct test_case tests[] = { { "testStatus", &testStatus }, { "testFilterClusterLog", &testFilterClusterLog }, - //{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog }, - //{ "testSetLogLevelNode", &testSetLogLevelNode }, + /*{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog },*/ + /*{ "testSetLogLevelNode", &testSetLogLevelNode },*/ { "testRestartNode", &testRestartNode }, { "testGetStatPort", &testGetStatPort }, #ifdef VM_TRACE diff --git a/ndb/src/mgmapi/test/mgmSrvApi.cpp b/ndb/src/mgmapi/test/mgmSrvApi.cpp index e93c54ae5a7..4a8e38c9ba5 100644 --- a/ndb/src/mgmapi/test/mgmSrvApi.cpp +++ b/ndb/src/mgmapi/test/mgmSrvApi.cpp @@ -25,11 +25,9 @@ * Server API" document * *****************************************************/ +#include <ndb_global.h> #include "mgmapi.h" #include "mgmapi_commands.h" -#include <stdlib.h> -#include <string.h> -#include <stdio.h> #include <NdbMain.h> #include <NdbOut.hpp> diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 29d25ebf7d3..fba5fda32dd 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -14,13 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <errno.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> -#include <limits.h> - -#include <ndb_version.h> +#include "CommandInterpreter.hpp" #include <mgmapi.h> #include <mgmapi_debug.h> @@ -34,7 +28,6 @@ #endif // HAVE_GLOBAL_REPLICATION #include "MgmtErrorReporter.hpp" -#include "CommandInterpreter.hpp" #include "CpcClient.hpp" #ifdef NDB_SOLARIS // XXX fix me diff --git a/ndb/src/mgmclient/CommandInterpreter.hpp b/ndb/src/mgmclient/CommandInterpreter.hpp index 9049ef39915..796a4e4838e 100644 --- a/ndb/src/mgmclient/CommandInterpreter.hpp +++ b/ndb/src/mgmclient/CommandInterpreter.hpp @@ -22,9 +22,7 @@ // Author: Peter Lind //***************************************************************************** -#include <NdbStdio.h> -#include <ndb_types.h> -#include <stdlib.h> +#include <ndb_global.h> #include <Vector.hpp> #include <editline/editline.h> diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/src/mgmclient/CpcClient.cpp index 24eab7194e9..74fa1a828ed 100644 --- a/ndb/src/mgmclient/CpcClient.cpp +++ b/ndb/src/mgmclient/CpcClient.cpp @@ -14,14 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ndb_types.h> +#include <ndb_global.h> #include <editline/editline.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> #include <netdb.h> -#include <errno.h> #include <NdbOut.hpp> #include <NdbTCP.h> diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index bbadaeb5206..2dcadf9369d 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <sys/param.h> +#include <ndb_global.h> #include <NdbMain.h> #include <NdbHost.h> diff --git a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp index 6b6dc9f1077..32f0adbcf26 100644 --- a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp +++ b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "../CpcClient.hpp" #include <Vector.hpp> -#include <assert.h> -#include <stdlib.h> SimpleCpcClient g_client("localhost", 1234); Vector<SimpleCpcClient::Process> g_procs; @@ -89,10 +88,16 @@ void define(){ //proc.m_proc.m_stdout = "log.out"; //proc.m_proc.m_stderr = "2>&1"; //proc.m_proc.m_runas = proc.m_host->m_user; - //proc.m_proc.m_ulimit = "c:unlimited"; - m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test"); - m_proc.m_path.assign("/bin/sleep"); - m_proc.m_args = "600"; + m_proc.m_ulimit = "c:unlimited"; + if((rand() & 15) >= 0){ + m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "sleep"); + m_proc.m_path.assign("/bin/sleep"); + m_proc.m_args = "600"; + } else { + m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test.sh"); + m_proc.m_path.assign("/home/jonas/run/cpcd/test.sh"); + m_proc.m_args = "600"; + } g_procs.push_back(m_proc); Properties reply; @@ -136,7 +141,7 @@ void list(){ ABORT(); } - for(int i = 0; i<procs.size(); i++){ + for(Uint32 i = 0; i<procs.size(); i++){ SimpleCpcClient::Process * p = find(procs[i].m_id); if(p != 0){ p->m_status = procs[i].m_status; @@ -144,7 +149,7 @@ void list(){ } } SimpleCpcClient::Process* find(int id){ - for(int i = 0; i<g_procs.size(); i++){ + for(Uint32 i = 0; i<g_procs.size(); i++){ if(g_procs[i].m_id == id) return &g_procs[i]; } diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index 1e608c05042..8a7293b8434 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -645,6 +645,8 @@ versionCallback(int nodeId, int version, void * anyData, int errCode){ } break; + case NDB_MGM_NODE_TYPE_UNKNOWN: + abort(); }; } else { diff --git a/ndb/src/mgmsrv/CommandInterpreter.hpp b/ndb/src/mgmsrv/CommandInterpreter.hpp index e68aa7da084..3466ee76226 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.hpp +++ b/ndb/src/mgmsrv/CommandInterpreter.hpp @@ -21,9 +21,7 @@ // Author: Peter Lind //***************************************************************************** -#include <NdbStdio.h> -#include <ndb_types.h> -#include <stdlib.h> +#include <ndb_global.h> #include <Vector.hpp> #include <editline/editline.h> #include <BaseString.hpp> diff --git a/ndb/src/mgmsrv/Makefile b/ndb/src/mgmsrv/Makefile index ebf50ecb76e..b10bdb64d30 100644 --- a/ndb/src/mgmsrv/Makefile +++ b/ndb/src/mgmsrv/Makefile @@ -6,8 +6,6 @@ BIN_TARGET := mgmtsrvr BIN_TARGET_LIBS := BIN_TARGET_ARCHIVES := mgmapi NDB_API mgmsrvcommon -LDFLAGS_LOC = -lpthread - ifneq ($(USE_EDITLINE), N) BIN_TARGET_ARCHIVES += editline DIRS := mkconfig diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 23ceeb15947..7c2d94c6b7f 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -14,10 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> +#include <pthread.h> + #include "MgmtSrvr.hpp" #include "MgmtErrorReporter.hpp" -#include <ctype.h> #include <NdbOut.hpp> #include <AttrType.hpp> #include <NdbApiSignal.hpp> @@ -42,15 +44,11 @@ #include <EventLogger.hpp> #include <DebuggerNames.hpp> #include <ndb_version.h> -#include <string.h> #include "SocketServer.hpp" #include "NodeLogLevel.hpp" #include <NdbConfig.h> -#include <time.h> -#include <pthread.h> - //#define MGM_SRV_DEBUG #ifdef MGM_SRV_DEBUG #define DEBUG(x) do ndbout << x << endl; while(0) diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 4fdf3c99d43..ce8765d6c73 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -20,7 +20,6 @@ #include <kernel_types.h> #include "Config.hpp" #include <NdbCondition.h> -#include <NdbConstant.hpp> #include <mgmapi.h> diff --git a/ndb/src/mgmsrv/NodeLogLevel.hpp b/ndb/src/mgmsrv/NodeLogLevel.hpp index 3e631e57901..3ad758cde99 100644 --- a/ndb/src/mgmsrv/NodeLogLevel.hpp +++ b/ndb/src/mgmsrv/NodeLogLevel.hpp @@ -17,7 +17,8 @@ #ifndef NODELOGLEVEL_H #define NODELOGLEVEL_H -#include <portlib/NdbConstant.hpp> +#include <ndb_global.h> + #include <signaldata/SetLogLevelOrd.hpp> /** diff --git a/ndb/src/mgmsrv/NodeLogLevelList.cpp b/ndb/src/mgmsrv/NodeLogLevelList.cpp index 7cf6dcc4b7e..6c7c091c1a8 100644 --- a/ndb/src/mgmsrv/NodeLogLevelList.cpp +++ b/ndb/src/mgmsrv/NodeLogLevelList.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NodeLogLevelList.hpp" +#include <ndb_global.h> +#include "NodeLogLevelList.hpp" #include "NodeLogLevel.hpp" -#include "NdbStdio.h" // // PUBLIC diff --git a/ndb/src/mgmsrv/convertStrToInt.cpp b/ndb/src/mgmsrv/convertStrToInt.cpp index 82bdb8e4f2f..e5216047d10 100644 --- a/ndb/src/mgmsrv/convertStrToInt.cpp +++ b/ndb/src/mgmsrv/convertStrToInt.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <errno.h> -#include <stdlib.h> -#include <string.h> +#include <ndb_global.h> bool convert(const char* s, int& val) { diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index d10ad8e0f4e..91b443f61a2 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -14,8 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include <signal.h> -#include <sys/ioctl.h> #include "MgmtSrvr.hpp" #include "EventLogger.hpp" @@ -41,6 +42,7 @@ #include "CommandInterpreter.hpp" #endif +#undef DEBUG #define DEBUG(x) ndbout << x << endl; const char progname[] = "mgmtsrvr"; @@ -197,7 +199,6 @@ NDB_MAIN(mgmsrv){ goto error_end; } -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) if (glob.daemon) { // Become a daemon char homePath[255],lockfile[255], logfile[255]; @@ -209,7 +210,6 @@ NDB_MAIN(mgmsrv){ return 1; } } -#endif if(!glob.mgmObject->start()){ ndbout_c("Unable to start management server."); diff --git a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp index 0e9397e43c0..224c82aa8a1 100644 --- a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp +++ b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp @@ -14,15 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> +#include <ndb_version.h> + #include <NdbMain.h> #include <Properties.hpp> -#include <stdlib.h> #include "InitConfigFileParser.hpp" -#include "Config.hpp" -#include <assert.h> -#include <NdbUnistd.h> -#include <ndb_version.h> +#include <Config.hpp> void usage(const char * prg){ ndbout << "Usage " << prg << ": <Init config> <Binary file>" << endl; diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp index 93fb0109669..1b536b6d741 100644 --- a/ndb/src/ndbapi/ClusterMgr.cpp +++ b/ndb/src/ndbapi/ClusterMgr.cpp @@ -14,6 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> +#include <ndb_limits.h> +#include <ndb_version.h> + #include "TransporterFacade.hpp" #include "ClusterMgr.hpp" #include <IPCConfig.hpp> @@ -23,12 +27,8 @@ #include <NdbSleep.h> #include <NdbOut.hpp> #include <NdbTick.h> -#include <ndb_limits.h> -#include <stdio.h> -#include <assert.h> -#include <ndb_version.h> #include <signaldata/NodeFailRep.hpp> #include <signaldata/NFCompleteRep.hpp> #include <signaldata/ApiRegSignalData.hpp> diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index 36fbc85a875..f6f2106f2aa 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -14,12 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "DictCache.hpp" #include "NdbDictionaryImpl.hpp" #include <NdbTick.h> #include <NdbCondition.h> #include <NdbSleep.h> -#include <stdlib.h> LocalDictCache::LocalDictCache(){ m_tableHash.createHashTable(); diff --git a/ndb/src/ndbapi/Makefile b/ndb/src/ndbapi/Makefile index 932fbd844d2..f4c82e5d6ba 100644 --- a/ndb/src/ndbapi/Makefile +++ b/ndb/src/ndbapi/Makefile @@ -31,7 +31,9 @@ SOURCES = \ Ndblist.cpp \ Ndbif.cpp \ Ndbinit.cpp \ - Ndberror.cpp \ + Ndberr.cpp \ + ndberror.c \ + NdbErrorOut.cpp \ NdbConnection.cpp \ NdbConnectionScan.cpp \ NdbOperation.cpp \ diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index d7930f32d72..448a29ca485 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -21,14 +21,17 @@ Name: Ndb.cpp ******************************************************************************/ +#include <ndb_global.h> +#include <pthread.h> + #include "NdbApiSignal.hpp" #include "NdbImpl.hpp" #include "NdbSchemaOp.hpp" #include "NdbSchemaCon.hpp" -#include "NdbOperation.hpp" -#include "NdbConnection.hpp" -#include "NdbEventOperation.hpp" -#include "NdbRecAttr.hpp" +#include <NdbOperation.hpp> +#include <NdbConnection.hpp> +#include <NdbEventOperation.hpp> +#include <NdbRecAttr.hpp> #include <md5_hash.hpp> #include <NdbSleep.h> #include <NdbOut.hpp> @@ -1221,7 +1224,6 @@ Ndb::pollEvents(int aMillisecondNumber) #ifdef VM_TRACE #include <NdbMutex.h> -#include <stdarg.h> static NdbMutex print_state_mutex = NDB_MUTEX_INITIALIZER; static bool checkdups(NdbConnection** list, unsigned no) @@ -1243,7 +1245,7 @@ Ndb::printState(const char* fmt, ...) NdbMutex_Lock(&print_state_mutex); bool dups = false; ndbout << buf << " ndb=" << hex << this << dec; -#ifdef NDB_LINUX +#ifndef NDB_WIN32 ndbout << " thread=" << (int)pthread_self(); #endif ndbout << endl; diff --git a/ndb/src/ndbapi/NdbConnectionScan.cpp b/ndb/src/ndbapi/NdbConnectionScan.cpp index 67f07d2a8c0..962acc0bdac 100644 --- a/ndb/src/ndbapi/NdbConnectionScan.cpp +++ b/ndb/src/ndbapi/NdbConnectionScan.cpp @@ -27,10 +27,12 @@ * Documentation: * Adjust: 2000-06-12 UABRONM First version. ****************************************************************************/ -#include "Ndb.hpp" -#include "NdbConnection.hpp" -#include "NdbOperation.hpp" -#include "NdbScanOperation.hpp" +#include <ndb_global.h> + +#include <Ndb.hpp> +#include <NdbConnection.hpp> +#include <NdbOperation.hpp> +#include <NdbScanOperation.hpp> #include "NdbScanReceiver.hpp" #include "NdbApiSignal.hpp" #include "TransporterFacade.hpp" @@ -41,7 +43,6 @@ #include <signaldata/ScanTab.hpp> #include <NdbOut.hpp> -#include <assert.h> // time out for next scan result (-1 is infinite) // XXX should change default only if non-trivial interpreted program is used diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index ec9a56cda62..b068ea6460f 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -646,7 +646,6 @@ NdbDictionary::Dictionary::Dictionary(NdbDictionaryImpl & impl) : m_impl(impl) { } -#include <assert.h> NdbDictionary::Dictionary::~Dictionary(){ NdbDictionaryImpl * tmp = &m_impl; if(this != tmp){ diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index bd94ba9b080..02e3ee23f9c 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -35,7 +35,6 @@ #include <AttributeList.hpp> #include <NdbEventOperation.hpp> #include "NdbEventOperationImpl.hpp" -#include <assert.h> #define DEBUG_PRINT 0 #define INCOMPATIBLE_VERSION -2 diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index f6b0644ea15..3263a636a79 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -33,7 +33,7 @@ class NdbDictObjectImpl { public: - int m_version; + Uint32 m_version; NdbDictionary::Object::Status m_status; bool change(); diff --git a/ndb/src/ndbapi/NdbErrorOut.cpp b/ndb/src/ndbapi/NdbErrorOut.cpp new file mode 100644 index 00000000000..07e0b2fe6e8 --- /dev/null +++ b/ndb/src/ndbapi/NdbErrorOut.cpp @@ -0,0 +1,45 @@ +/* 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 <ndb_global.h> + +#include <NdbOut.hpp> + +#include <NdbError.hpp> + +/** + * operators + */ +NdbOut & +operator<<(NdbOut & out, const NdbError & error){ + if(error.message != 0) + out << error.code << ": " << error.message; + else + out << error.code << ": "; + return out; +} + +NdbOut & +operator<<(NdbOut & out, const NdbError::Status & status){ + return out << ndberror_status_message((ndberror_status)status); +} + +NdbOut & +operator<<(NdbOut & out, const NdbError::Classification & classification){ + return out << ndberror_classification_message((ndberror_classification)classification); +} + diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index d167b8205a2..acc726e28c5 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> - +#include <ndb_global.h> +#include <kernel_types.h> #include "NdbDictionaryImpl.hpp" #include "API.hpp" @@ -24,21 +24,12 @@ #include <AttrType.hpp> #include "NdbApiSignal.hpp" #include "TransporterFacade.hpp" -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/CreateTable.hpp> -#include <signaldata/CreateIndx.hpp> #include <signaldata/CreateEvnt.hpp> #include <signaldata/SumaImpl.hpp> -#include <signaldata/DropTable.hpp> -#include <signaldata/DropIndx.hpp> -#include <signaldata/ListTables.hpp> #include <SimpleProperties.hpp> #include <Bitmask.hpp> #include <AttributeHeader.hpp> #include <AttributeList.hpp> -#include <ndb_types.h> -#include <kernel_types.h> #include <NdbError.hpp> #include <BaseString.hpp> #include <UtilBuffer.hpp> diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp index eaa2b35965b..ccbfa767542 100644 --- a/ndb/src/ndbapi/NdbOperation.cpp +++ b/ndb/src/ndbapi/NdbOperation.cpp @@ -37,7 +37,6 @@ #include "API.hpp" #include <NdbOut.hpp> -#include <assert.h> /****************************************************************************** diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index a1ce25f19d1..18f8b79d12e 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -164,7 +164,6 @@ NdbOperation::readTupleExclusive() int NdbOperation::simpleRead() { - NdbConnection* tNdbCon = theNdbCon; int tErrorLine = theErrorLine; if (theStatus == Init) { theStatus = OperationDefined; @@ -193,7 +192,6 @@ NdbOperation::dirtyRead() int NdbOperation::committedRead() { - NdbConnection* tNdbCon = theNdbCon; int tErrorLine = theErrorLine; if (theStatus == Init) { theStatus = OperationDefined; diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp index 1b0ad68b1eb..b2a6f99880c 100644 --- a/ndb/src/ndbapi/NdbOperationExec.cpp +++ b/ndb/src/ndbapi/NdbOperationExec.cpp @@ -25,11 +25,12 @@ Version: 1.2 Description: Documentation: ***************************************************************************/ -#include "NdbOperation.hpp" -#include "NdbConnection.hpp" + +#include <NdbOperation.hpp> +#include <NdbConnection.hpp> #include "NdbApiSignal.hpp" -#include "Ndb.hpp" -#include "NdbRecAttr.hpp" +#include <Ndb.hpp> +#include <NdbRecAttr.hpp> #include "NdbUtil.hpp" #include "Interpreter.hpp" diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp index 42f2b1d10d8..e1d5e823077 100644 --- a/ndb/src/ndbapi/NdbOperationSearch.cpp +++ b/ndb/src/ndbapi/NdbOperationSearch.cpp @@ -319,7 +319,7 @@ NdbOperation::setTupleId() return 0; } Uint64 tTupleId = theNdb->getTupleIdFromNdb(m_currentTable->m_tableId); - if (tTupleId == ~0){ + if (tTupleId == ~(Uint64)0){ setErrorCodeAbort(theNdb->theError.code); return 0; } diff --git a/ndb/src/ndbapi/NdbPoolImpl.cpp b/ndb/src/ndbapi/NdbPoolImpl.cpp index 08252d26d79..131edc74246 100644 --- a/ndb/src/ndbapi/NdbPoolImpl.cpp +++ b/ndb/src/ndbapi/NdbPoolImpl.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "NdbPoolImpl.hpp" -#include <assert.h> -#include <string.h> NdbMutex *NdbPool::pool_mutex = NULL; NdbPool *the_pool = NULL; diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 11f36fbd2c4..0f7baeac4f5 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -26,8 +26,8 @@ Description: Interface between TIS and NDB Documentation: Adjust: 971206 UABRONM First version ************************************************************************************************/ +#include <ndb_global.h> #include "NdbRecAttr.hpp" -#include <stdlib.h> #include "NdbDictionaryImpl.hpp" NdbRecAttr::NdbRecAttr() : diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index f753d2f6b34..4db0f30f56c 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -26,6 +26,7 @@ * Adjust: 2002-04-01 UABMASD First version. ****************************************************************************/ +#include <ndb_global.h> #include <Ndb.hpp> #include <NdbScanOperation.hpp> #include <NdbConnection.hpp> @@ -33,12 +34,6 @@ #include "NdbApiSignal.hpp" #include <NdbOut.hpp> #include "NdbDictionaryImpl.hpp" -#include <NdbString.h> -#ifndef NDB_MACOSX -#include <malloc.h> -#else -#include <stdlib.h> -#endif NdbScanOperation::NdbScanOperation(Ndb* aNdb) : NdbCursorOperation(aNdb), @@ -637,6 +632,24 @@ SetValueRecList::callSetValueFn(SetValueRec& aSetValueRec, NdbOperation& oper) } } +SetValueRec::~SetValueRec() +{ + if ((stype == SET_STRING_ATTR1) || + (stype == SET_INT32_ATTR1) || + (stype == SET_UINT32_ATTR1) || + (stype == SET_INT64_ATTR1) || + (stype == SET_UINT64_ATTR1) || + (stype == SET_FLOAT_ATTR1) || + (stype == SET_DOUBLE_ATTR1)) + free(anAttrName); + + if ((stype == SET_STRING_ATTR1) || + (stype == SET_STRING_ATTR2)) + free(stringStruct.aStringValue); + if (next) delete next; + next = 0; +} + int NdbScanOperation::equal_impl(const NdbColumnImpl* anAttrObject, const char* aValue, diff --git a/ndb/src/ndbapi/NdbScanReceiver.hpp b/ndb/src/ndbapi/NdbScanReceiver.hpp index 5e316719194..72f9e48f02c 100644 --- a/ndb/src/ndbapi/NdbScanReceiver.hpp +++ b/ndb/src/ndbapi/NdbScanReceiver.hpp @@ -24,7 +24,6 @@ #include "NdbReceiver.hpp" #include <NdbOut.hpp> -#include <assert.h> class NdbScanReceiver { diff --git a/ndb/src/ndbapi/NdbSchemaOp.cpp b/ndb/src/ndbapi/NdbSchemaOp.cpp index 9f4d7fbcfd4..9e495229661 100644 --- a/ndb/src/ndbapi/NdbSchemaOp.cpp +++ b/ndb/src/ndbapi/NdbSchemaOp.cpp @@ -29,6 +29,7 @@ Documentation: Handles createTable and createAttribute calls Adjust: 980125 UABMNST First version. 020826 EMIKRON New version for new DICT *****************************************************************************/ +#include <assert.h> #include "NdbSchemaOp.hpp" #include "NdbSchemaCon.hpp" #include "API.hpp" @@ -139,6 +140,8 @@ NdbSchemaOp::createAttribute( const char* anAttrName, case String: col.setType(NdbDictionary::Column::Char); break; + case NoAttrTypeDef: + abort(); } col.setLength(anArraySize); col.setNullable(nullable); diff --git a/ndb/src/ndbapi/NdbUtil.hpp b/ndb/src/ndbapi/NdbUtil.hpp index eeee087d548..6a82af85987 100644 --- a/ndb/src/ndbapi/NdbUtil.hpp +++ b/ndb/src/ndbapi/NdbUtil.hpp @@ -29,8 +29,7 @@ Comment: #ifndef NdbUtil_H #define NdbUtil_H -#include <stdlib.h> -#include <ndb_types.h> +#include <ndb_global.h> #include "AttrType.hpp" class NdbApiSignal; diff --git a/ndb/src/ndbapi/Ndberr.cpp b/ndb/src/ndbapi/Ndberr.cpp new file mode 100644 index 00000000000..faa2f00cfce --- /dev/null +++ b/ndb/src/ndbapi/Ndberr.cpp @@ -0,0 +1,75 @@ +/* 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 <NdbError.hpp> +#include "NdbImpl.hpp" +#include "NdbDictionaryImpl.hpp" +#include <NdbSchemaCon.hpp> +#include <NdbOperation.hpp> +#include <NdbConnection.hpp> + + +static void +update(const NdbError & _err){ + NdbError & error = (NdbError &) _err; + ndberror_struct ndberror = (ndberror_struct)error; + ndberror_update(&ndberror); + error = NdbError(ndberror); +} + +const +NdbError & +Ndb::getNdbError(int code){ + theError.code = code; + update(theError); + return theError; +} + +const +NdbError & +Ndb::getNdbError() const { + update(theError); + return theError; +} + +const +NdbError & +NdbDictionaryImpl::getNdbError() const { + update(m_error); + return m_error; +} + +const +NdbError & +NdbConnection::getNdbError() const { + update(theError); + return theError; +} + +const +NdbError & +NdbOperation::getNdbError() const { + update(theError); + return theError; +} + +const +NdbError & +NdbSchemaCon::getNdbError() const { + update(theError); + return theError; +} diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index e334c1bcc39..696dfe68e40 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -40,7 +40,6 @@ #include <NdbOut.hpp> #include <NdbTick.h> -#include <assert.h> /****************************************************************************** * int init( int aNrOfCon, int aNrOfOp ); diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index 9afbbf0df1f..be7acc48d7a 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -55,6 +55,7 @@ Parameters: aDataBase : Name of the database. Remark: Connect to the database. ***************************************************************************/ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : + theNdbObjectIdMap(0), thePreparedTransactionsArray(NULL), theSentTransactionsArray(NULL), theCompletedTransactionsArray(NULL), @@ -89,8 +90,7 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : theFirstTransId(0), theRestartGCI(0), theNdbBlockNumber(-1), - theInitState(NotConstructed), - theNdbObjectIdMap(0) + theInitState(NotConstructed) { cgetSignals =0; cfreeSignals = 0; diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp index a2a8d00b48f..4abb54b5081 100644 --- a/ndb/src/ndbapi/ObjectMap.hpp +++ b/ndb/src/ndbapi/ObjectMap.hpp @@ -17,10 +17,8 @@ #ifndef NDB_OBJECT_ID_MAP_HPP #define NDB_OBJECT_ID_MAP_HPP -#include <ndb_types.h> +#include <ndb_global.h> //#include <NdbMutex.h> -#include <stdlib.h> -#include <string.h> #include <NdbOut.hpp> //#define DEBUG_OBJECTMAP diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index 746ab169b41..f4a3ae3e87d 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -14,8 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <ndb_limits.h> -#include "AttrType.hpp" +#include <AttrType.hpp> #include "TransporterFacade.hpp" #include "ClusterMgr.hpp" #include <IPCConfig.hpp> @@ -25,14 +26,12 @@ #include <NdbOut.hpp> #include <NdbEnv.h> #include <NdbSleep.h> -#include <assert.h> #include "API.hpp" #include <ConfigRetriever.hpp> #include <NdbConfig.h> #include <ndb_version.h> #include <SignalLoggerManager.hpp> -#include <stdlib.h> #if !defined NDB_OSE && !defined NDB_SOFTOSE #include <signal.h> diff --git a/ndb/src/ndbapi/Ndberror.cpp b/ndb/src/ndbapi/ndberror.c index ee668605f0d..ea7cf4de426 100644 --- a/ndb/src/ndbapi/Ndberror.cpp +++ b/ndb/src/ndbapi/ndberror.c @@ -15,40 +15,46 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <NdbError.hpp> -#include <NdbStdio.h> -#include <stdarg.h> +#include <ndb_global.h> -#include <assert.h> +#include <ndberror.h> -struct ErrorBundle { +typedef struct ErrorBundle { int code; - NdbError::Classification classification; + ndberror_classification classification; const char * message; -}; +} ErrorBundle; /** * Shorter names in table below */ -static const NdbError::Classification NE = NdbError::NoError; -static const NdbError::Classification AE = NdbError::ApplicationError; -static const NdbError::Classification ND = NdbError::NoDataFound; -static const NdbError::Classification CV = NdbError::ConstraintViolation; -static const NdbError::Classification SE = NdbError::SchemaError; -static const NdbError::Classification UD = NdbError::UserDefinedError; - -static const NdbError::Classification IS = NdbError::InsufficientSpace; -static const NdbError::Classification TR = NdbError::TemporaryResourceError; -static const NdbError::Classification NR = NdbError::NodeRecoveryError; -static const NdbError::Classification OL = NdbError::OverloadError; -static const NdbError::Classification TO = NdbError::TimeoutExpired; -static const NdbError::Classification NS = NdbError::NodeShutdown; - -static const NdbError::Classification UR = NdbError::UnknownResultError; - -static const NdbError::Classification IE = NdbError::InternalError; -static const NdbError::Classification NI = NdbError::FunctionNotImplemented; -static const NdbError::Classification UE = NdbError::UnknownErrorCode; + +#define ST_S ndberror_st_success +#define ST_P ndberror_st_permanent +#define ST_T ndberror_st_temporary +#define ST_U ndberror_st_unknown + +#define NE ndberror_cl_none +#define AE ndberror_cl_application +#define ND ndberror_cl_no_data_found +#define CV ndberror_cl_constraint_violation +#define SE ndberror_cl_schema_error +#define UD ndberror_cl_user_defined + +#define IS ndberror_cl_insufficient_space +#define TR ndberror_cl_temporary_resource +#define NR ndberror_cl_node_recovery +#define OL ndberror_cl_overload +#define TO ndberror_cl_timeout_expired +#define NS ndberror_cl_node_shutdown + +#define UR ndberror_cl_unknown_result + +#define IE ndberror_cl_internal_error +#define NI ndberror_cl_function_not_implemented +#define UE ndberror_cl_unknown_error_code + +static const char* empty_string = ""; static const @@ -90,7 +96,7 @@ ErrorBundle ErrorCodes[] = { * Node shutdown */ { 280, NS, "Transaction aborted due to node shutdown" }, - // This scan trans had an active fragment scan in a LQH which have crashed + /* This scan trans had an active fragment scan in a LQH which have crashed */ { 270, NS, "Transaction aborted due to node shutdown" }, { 1223, NS, "Read operation aborted due to node shutdown" }, { 4023, NS, "Transaction aborted due to node shutdown" }, @@ -152,9 +158,9 @@ ErrorBundle ErrorCodes[] = { * TimeoutExpired */ { 266, TO, "Time-out in NDB, probably caused by deadlock" }, - { 274, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout - { 296, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout - { 297, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout, temporary!! + { 274, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ + { 296, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ + { 297, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout, temporary!! */ { 237, TO, "Transaction had timed out when trying to commit it" }, @@ -420,41 +426,60 @@ static const int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle); -struct ErrorStatusClassification { - NdbError::Status status; - NdbError::Classification classification; -}; +typedef struct ErrorStatusMessage { + ndberror_status status; + const char * message; +} ErrorStatusMessage; + +typedef struct ErrorStatusClassification { + ndberror_status status; + ndberror_classification classification; + const char * message; +} ErrorStatusClassification; /** * Mapping between classification and status */ static const +ErrorStatusMessage StatusMessageMapping[] = { + { ST_S, "Success"}, + { ST_P, "Permanent error"}, + { ST_T, "Temporary error"}, + { ST_U ,"Unknown result"} +}; + +static +const +int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage); + +static +const ErrorStatusClassification StatusClassificationMapping[] = { - { NdbError::Success, NdbError::NoError }, - { NdbError::PermanentError, NdbError::ApplicationError }, - { NdbError::PermanentError, NdbError::NoDataFound }, - { NdbError::PermanentError, NdbError::ConstraintViolation }, - { NdbError::PermanentError, NdbError::SchemaError }, - { NdbError::PermanentError, NdbError::UserDefinedError }, - { NdbError::PermanentError, NdbError::InsufficientSpace }, + { ST_S, NE, "No error"}, + { ST_P, AE, "Application error"}, + { ST_P, ND, "No data found"}, + { ST_P, CV, "Constraint violation"}, + { ST_P, SE, "Schema error"}, + { ST_P, UD, "User defined error"}, + { ST_P, IS, "Insufficient space"}, - { NdbError::TemporaryError, NdbError::TemporaryResourceError }, - { NdbError::TemporaryError, NdbError::NodeRecoveryError }, - { NdbError::TemporaryError, NdbError::OverloadError }, - { NdbError::TemporaryError, NdbError::TimeoutExpired }, - { NdbError::TemporaryError, NdbError::NodeShutdown }, + { ST_T, TR, "Temporary Resource error"}, + { ST_T, NR, "Node Recovery error"}, + { ST_T, OL, "Overload error"}, + { ST_T, TO, "Timeout expired"}, + { ST_T, NS, "Node shutdown"}, - { NdbError::UnknownResult , NdbError::UnknownResultError }, - { NdbError::UnknownResult , NdbError::UnknownErrorCode }, + { ST_U , UR, "Unknown result error"}, + { ST_U , UE, "Unknown error code"}, - { NdbError::PermanentError, NdbError::InternalError }, - { NdbError::PermanentError, NdbError::FunctionNotImplemented } + { ST_P, IE, "Internal error"}, + { ST_P, NI, "Function not implemented"} }; static const -int Nb = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); +int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); /** * Complete all fields of an NdbError given the error code @@ -462,64 +487,67 @@ int Nb = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); */ static void -set(NdbError & error, int code, const char * details, ...){ - error.code = code; - - va_list ap; - va_start(ap, details); - vsnprintf(error.details, sizeof(error.details), details, ap); - va_end(ap); +set(ndberror_struct * error, int code, const char * details, ...){ + error->code = code; + { + va_list ap; + va_start(ap, details); + vsnprintf(error->details, sizeof(error->details), details, ap); + va_end(ap); + } } -static + void -update(const NdbError & _err){ - NdbError & error = (NdbError &) _err; - - bool found = false; - for(int i = 0; i<NbErrorCodes; i++){ - if(ErrorCodes[i].code == error.code){ - error.classification = ErrorCodes[i].classification; - error.message = ErrorCodes[i].message; - found = true; +ndberror_update(ndberror_struct * error){ + + int found = 0; + int i; + + for(i = 0; i<NbErrorCodes; i++){ + if(ErrorCodes[i].code == error->code){ + error->classification = ErrorCodes[i].classification; + error->message = ErrorCodes[i].message; + found = 1; break; } } if(!found){ - error.classification = NdbError::UnknownErrorCode; - error.message = "Unknown error code"; + error->classification = UE; + error->message = "Unknown error code"; } - found = false; - for(int i = 0; i<Nb; i++){ - if(StatusClassificationMapping[i].classification == error.classification){ - error.status = StatusClassificationMapping[i].status; - found = true; + found = 0; + for(i = 0; i<NbClassification; i++){ + if(StatusClassificationMapping[i].classification == error->classification){ + error->status = StatusClassificationMapping[i].status; + found = 1; break; } } if(!found){ - error.status = NdbError::UnknownResult; + error->status = ST_U; } - error.details = 0; + error->details = 0; } -bool +int checkErrorCodes(){ - for(int i = 0; i<NbErrorCodes; i++) - for(int j = i+1; j<NbErrorCodes; j++) + int i, j; + for(i = 0; i<NbErrorCodes; i++) + for(j = i+1; j<NbErrorCodes; j++) if(ErrorCodes[i].code == ErrorCodes[j].code){ printf("ErrorCode %d is defined multiple times!!\n", ErrorCodes[i].code); assert(0); } - return true; + return 1; } -static const bool a = checkErrorCodes(); +/*static const int a = checkErrorCodes();*/ #if CHECK_ERRORCODES int main(void){ @@ -528,108 +556,35 @@ int main(void){ } #endif -#include <NdbOut.hpp> - -/** - * operators - */ -NdbOut & -operator<<(NdbOut & out, const NdbError & error){ - if(error.message != 0) - out << error.code << ": " << error.message; - else - out << error.code << ": "; - return out; +const char *ndberror_status_message(ndberror_status status) +{ + int i; + for (i= 0; i < NbStatus; i++) + if (StatusMessageMapping[i].status == status) + return StatusMessageMapping[i].message; + return empty_string; } -NdbOut & -operator<<(NdbOut & out, const NdbError::Status & status){ - switch(status) { - case NdbError::Success: out << "Success"; break; - case NdbError::TemporaryError: out << "Temporary error"; break; - case NdbError::PermanentError: out << "Permanent error"; break; - case NdbError::UnknownResult: out << "Unknown result"; break; - } - return out; +const char *ndberror_classification_message(ndberror_classification classification) +{ + int i; + for (i= 0; i < NbClassification; i++) + if (StatusClassificationMapping[i].classification == classification) + return StatusClassificationMapping[i].message; + return empty_string; } -NdbOut & -operator<<(NdbOut & out, const NdbError::Classification & classification){ - switch(classification) { - case NdbError::NoError: out << "No error"; break; - case NdbError::ApplicationError: out << "Application error"; break; - case NdbError::NoDataFound: out << "No data found"; break; - case NdbError::ConstraintViolation: out << "Constraint violation"; break; - case NdbError::SchemaError: out << "Schema error"; break; - case NdbError::UserDefinedError: out << "User defined error"; break; - case NdbError::InsufficientSpace: out << "Insufficient space"; break; - case NdbError::TemporaryResourceError: out << "Temporary Resource error"; - break; - case NdbError::NodeRecoveryError: out << "Node Recovery error"; break; - case NdbError::OverloadError: out << "Overload error"; break; - case NdbError::TimeoutExpired: out << "Timeout expired"; break; - case NdbError::UnknownResultError: out << "Unknown result error"; break; - case NdbError::InternalError: out << "Internal error"; break; - case NdbError::FunctionNotImplemented: out << "Function not implemented"; - break; - case NdbError::UnknownErrorCode: out << "Unknown error code"; break; - case NdbError::NodeShutdown: out << "Node shutdown"; break; - } - return out; -} +int ndb_error_string(int err_no, char *str, unsigned int size) +{ + ndberror_struct error; + unsigned int len; -/****************************************************** - * - */ -#include "NdbImpl.hpp" -#include "NdbDictionaryImpl.hpp" -#include <NdbSchemaCon.hpp> -#include <NdbOperation.hpp> -#include <NdbConnection.hpp> + error.code = err_no; + ndberror_update(&error); + len = snprintf(str, size-1, "%s: %s: %s", error.message, + ndberror_status_message(error.status), ndberror_classification_message(error.classification)); + str[size-1]= '\0'; -const -NdbError & -Ndb::getNdbError(int code){ - theError.code = code; - update(theError); - return theError; -} - -const -NdbError & -Ndb::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbDictionaryImpl::getNdbError() const { - update(m_error); - return m_error; + return len; } - -const -NdbError & -NdbConnection::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbOperation::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbSchemaCon::getNdbError() const { - update(theError); - return theError; -} - - - diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.cpp b/ndb/src/ndbapi/signal-sender/SignalSender.cpp index d60f6240a9c..e642848dcee 100644 --- a/ndb/src/ndbapi/signal-sender/SignalSender.cpp +++ b/ndb/src/ndbapi/signal-sender/SignalSender.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "SignalSender.hpp" #include "ConfigRetriever.hpp" #include <NdbSleep.h> diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.hpp b/ndb/src/ndbapi/signal-sender/SignalSender.hpp index fffe027dbdd..e4e6c1931d2 100644 --- a/ndb/src/ndbapi/signal-sender/SignalSender.hpp +++ b/ndb/src/ndbapi/signal-sender/SignalSender.hpp @@ -17,11 +17,11 @@ #ifndef SIGNAL_SENDER_HPP #define SIGNAL_SENDER_HPP +#include <ndb_global.h> #include <TransporterDefinitions.hpp> #include <TransporterFacade.hpp> #include <ClusterMgr.hpp> #include <Vector.hpp> -#include <stdio.h> struct SimpleSignal { public: diff --git a/ndb/src/newtonapi/dba_binding.cpp b/ndb/src/newtonapi/dba_binding.cpp index 724f54c0e4b..63e48110b1d 100644 --- a/ndb/src/newtonapi/dba_binding.cpp +++ b/ndb/src/newtonapi/dba_binding.cpp @@ -367,6 +367,12 @@ matchSize(NdbDictionary::Column::Type t, unsigned b, Size_t s) { case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Blob: + case NdbDictionary::Column::Tinyint: + case NdbDictionary::Column::Tinyunsigned: + case NdbDictionary::Column::Smallint: + case NdbDictionary::Column::Smallunsigned: + case NdbDictionary::Column::Mediumint: + case NdbDictionary::Column::Mediumunsigned: case NdbDictionary::Column::Undefined: return false; } diff --git a/ndb/src/newtonapi/dba_error.cpp b/ndb/src/newtonapi/dba_error.cpp index 0a154ac1314..f05446522b0 100644 --- a/ndb/src/newtonapi/dba_error.cpp +++ b/ndb/src/newtonapi/dba_error.cpp @@ -15,9 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> + #include "dba_internal.hpp" -#include <NdbStdio.h> -#include <stdarg.h> static DBA_Error_t latestError = DBA_NO_ERROR; static DBA_ErrorCode_t latestNdbError = 0; diff --git a/ndb/src/newtonapi/dba_internal.hpp b/ndb/src/newtonapi/dba_internal.hpp index a021db40a7d..84ae7ba222b 100644 --- a/ndb/src/newtonapi/dba_internal.hpp +++ b/ndb/src/newtonapi/dba_internal.hpp @@ -17,17 +17,16 @@ #ifndef DBA_INTERNAL_HPP #define DBA_INTERNAL_HPP +#include <ndb_global.h> + extern "C" { #include "dba.h" } #include <NdbApi.hpp> #include <NdbMutex.h> -#include <string.h> #include <NdbOut.hpp> -#include <stdlib.h> - #ifndef INT_MAX #define INT_MAX 2147483647 #endif diff --git a/ndb/src/rep/Makefile b/ndb/src/rep/Makefile index 29482b72687..9688a68ec74 100644 --- a/ndb/src/rep/Makefile +++ b/ndb/src/rep/Makefile @@ -12,8 +12,6 @@ BIN_TARGET := ndb_rep BIN_TARGET_LIBS := BIN_TARGET_ARCHIVES += editline repstorage repadapters reprequestor reptransfer mgmapi NDB_API mgmsrvcommon -LDFLAGS_LOC = -lpthread - SOURCES = \ RepMain.cpp \ Requestor.cpp \ diff --git a/ndb/src/rep/RepApiService.cpp b/ndb/src/rep/RepApiService.cpp index f5d51f7990e..d07f7a59375 100644 --- a/ndb/src/rep/RepApiService.cpp +++ b/ndb/src/rep/RepApiService.cpp @@ -23,10 +23,8 @@ #include "RepApiInterpreter.hpp" #include "repapi/repapi.h" #include <NdbMutex.h> -#include <NdbStdio.h> #include <OutputStream.hpp> -#include <NdbString.h> /** const char * name; const char * realName; diff --git a/ndb/src/rep/RepComponents.hpp b/ndb/src/rep/RepComponents.hpp index 8b24858271b..ff0f29e2128 100644 --- a/ndb/src/rep/RepComponents.hpp +++ b/ndb/src/rep/RepComponents.hpp @@ -26,7 +26,6 @@ #include <rep/rep_version.hpp> - /** * Connection data */ diff --git a/ndb/src/rep/RepMain.cpp b/ndb/src/rep/RepMain.cpp index e00f6c0040c..d9f057be9a1 100644 --- a/ndb/src/rep/RepMain.cpp +++ b/ndb/src/rep/RepMain.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> -#include <stdlib.h> +#include <ndb_global.h> #include <NdbApiSignal.hpp> #include <getarg.h> diff --git a/ndb/src/rep/Requestor.cpp b/ndb/src/rep/Requestor.cpp index af16fc33844..3c93a6394a4 100644 --- a/ndb/src/rep/Requestor.cpp +++ b/ndb/src/rep/Requestor.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "Requestor.hpp" #include "ConfigRetriever.hpp" diff --git a/ndb/src/rep/Requestor.hpp b/ndb/src/rep/Requestor.hpp index ba753be60f2..735d2094bde 100644 --- a/ndb/src/rep/Requestor.hpp +++ b/ndb/src/rep/Requestor.hpp @@ -17,12 +17,13 @@ #ifndef REQUESTOR_HPP #define REQUESTOR_HPP +#include <ndb_global.h> + #include <TransporterDefinitions.hpp> #include <TransporterFacade.hpp> #include <ClusterMgr.hpp> #include <API.hpp> #include <Vector.hpp> -#include <stdio.h> #include <GrepError.hpp> #include <rep/storage/GCIContainer.hpp> diff --git a/ndb/src/rep/adapters/AppNDB.hpp b/ndb/src/rep/adapters/AppNDB.hpp index c24774d4ed3..9563a1e41ab 100644 --- a/ndb/src/rep/adapters/AppNDB.hpp +++ b/ndb/src/rep/adapters/AppNDB.hpp @@ -18,13 +18,9 @@ #define APPNDB_HPP #include "NdbApi.hpp" -#include <string.h> -#include <assert.h> - #include <NdbMain.h> #include <NdbOut.hpp> #include <NdbSleep.h> -#include <NdbStdio.h> #include <NdbTick.h> #include <NdbThread.h> diff --git a/ndb/src/rep/adapters/ExtNDB.cpp b/ndb/src/rep/adapters/ExtNDB.cpp index 5ba6bfbbe6e..eb541cdced9 100644 --- a/ndb/src/rep/adapters/ExtNDB.cpp +++ b/ndb/src/rep/adapters/ExtNDB.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "ExtNDB.hpp" #include "ConfigRetriever.hpp" #include <NdbSleep.h> diff --git a/ndb/src/rep/adapters/ExtNDB.hpp b/ndb/src/rep/adapters/ExtNDB.hpp index c69f94d9a7e..bcbf51393aa 100644 --- a/ndb/src/rep/adapters/ExtNDB.hpp +++ b/ndb/src/rep/adapters/ExtNDB.hpp @@ -17,12 +17,13 @@ #ifndef EXTNDB_HPP #define EXTNDB_HPP +#include <ndb_global.h> + #include <TransporterDefinitions.hpp> #include <TransporterFacade.hpp> #include <ClusterMgr.hpp> #include <API.hpp> #include <Vector.hpp> -#include <stdio.h> #include <signaldata/RepImpl.hpp> #include <signaldata/GrepImpl.hpp> diff --git a/ndb/src/rep/dbug_hack.cpp b/ndb/src/rep/dbug_hack.cpp index 364325b55ae..74e5f080777 100644 --- a/ndb/src/rep/dbug_hack.cpp +++ b/ndb/src/rep/dbug_hack.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdarg.h> -#include <string.h> +#include <ndb_global.h> + #include <OutputStream.hpp> #include "NdbOut.hpp" #include "rep_version.hpp" @@ -25,6 +25,7 @@ int replogEnabled; /** * @todo This should be implemented using MySQLs dbug library */ +#if 0 extern "C" void DBUG_PRINT(const char * fmt, ...) @@ -40,6 +41,7 @@ DBUG_PRINT(const char * fmt, ...) va_end(ap); #endif } +#endif extern "C" void diff --git a/ndb/src/rep/rep_version.hpp b/ndb/src/rep/rep_version.hpp index 0182f080730..3830f9c351c 100644 --- a/ndb/src/rep/rep_version.hpp +++ b/ndb/src/rep/rep_version.hpp @@ -29,7 +29,7 @@ extern "C" void -DBUG_PRINT(const char * fmt, ...); +DBUG_PRINT__(const char * fmt, ...); extern "C" void diff --git a/ndb/src/rep/repapi/repapi.cpp b/ndb/src/rep/repapi/repapi.cpp index 80274896004..d34ab098c9c 100644 --- a/ndb/src/rep/repapi/repapi.cpp +++ b/ndb/src/rep/repapi/repapi.cpp @@ -14,17 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include <NdbTCP.h> #include "repapi.h" //#include "mgmapi_debug.h" #include <socket_io.h> -#include <stdlib.h> - -#include <string.h> -#include <NdbStdio.h> -#include <NdbString.h> -#include <errno.h> #include <NdbOut.hpp> #include <SocketServer.hpp> #include <Parser.hpp> diff --git a/ndb/src/rep/state/Interval.cpp b/ndb/src/rep/state/Interval.cpp index 75697fa7548..8266f19c58d 100644 --- a/ndb/src/rep/state/Interval.cpp +++ b/ndb/src/rep/state/Interval.cpp @@ -16,6 +16,8 @@ #include "Interval.hpp" +#undef min +#undef max Uint32 max(Uint32 a, Uint32 b) { return a > b ? a : b; } Uint32 min(Uint32 a, Uint32 b) { return a < b ? a : b; } diff --git a/ndb/src/rep/state/RepState.cpp b/ndb/src/rep/state/RepState.cpp index a34bff25d7f..d8a50961a3c 100644 --- a/ndb/src/rep/state/RepState.cpp +++ b/ndb/src/rep/state/RepState.cpp @@ -681,7 +681,7 @@ Properties * RepState::query(QueryCounter counter, Uint32 replicationId) if(prop == NULL) return NULL; NdbMutex_Lock(m_mutex); - if(counter != (Uint32)-1) + if(counter != ~(Uint32)0) getEpochState((Channel::Position)counter, prop ); prop->put("no_of_nodegroups", m_channel.getNoOfNodeGroups()); prop->put("subid", m_channel.getNoOfNodeGroups()); @@ -714,9 +714,13 @@ RepState::getEpochState(Channel::Position pos, Properties * p) */ pos_first--; pos_last--; + first_buf[pos_first]= '\0'; + last_buf[pos_last]= '\0'; +#if 0 sprintf(first_buf+pos_first,"",""); sprintf(last_buf + pos_last,"",""); - +#endif + p->put("first", first_buf); p->put("last", last_buf); diff --git a/ndb/src/rep/storage/GCIBuffer.cpp b/ndb/src/rep/storage/GCIBuffer.cpp index 5049e47ea66..013600b30a5 100644 --- a/ndb/src/rep/storage/GCIBuffer.cpp +++ b/ndb/src/rep/storage/GCIBuffer.cpp @@ -14,9 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <ndb_global.h> #include "GCIBuffer.hpp" -#include <stdlib.h> -#include <assert.h> /***************************************************************************** * Constructor / Destructor diff --git a/ndb/src/rep/storage/GCIBuffer.hpp b/ndb/src/rep/storage/GCIBuffer.hpp index 5a07b149f81..8a8473d1d49 100644 --- a/ndb/src/rep/storage/GCIBuffer.hpp +++ b/ndb/src/rep/storage/GCIBuffer.hpp @@ -18,7 +18,7 @@ #define GCI_BUFFER_HPP #include "GCIPage.hpp" -#include "Vector.hpp" +#include <Vector.hpp> #include <TransporterDefinitions.hpp> #include <signaldata/RepImpl.hpp> diff --git a/ndb/src/rep/storage/GCIContainer.hpp b/ndb/src/rep/storage/GCIContainer.hpp index 173bb790a57..48cbc66bfbd 100644 --- a/ndb/src/rep/storage/GCIContainer.hpp +++ b/ndb/src/rep/storage/GCIContainer.hpp @@ -22,6 +22,7 @@ #include "LogRecord.hpp" #include "GCIBuffer.hpp" +#undef swap #include <list> #include <iterator> diff --git a/ndb/src/rep/storage/LogRecord.hpp b/ndb/src/rep/storage/LogRecord.hpp index ba2632e23c7..a0bf3d52372 100644 --- a/ndb/src/rep/storage/LogRecord.hpp +++ b/ndb/src/rep/storage/LogRecord.hpp @@ -17,8 +17,7 @@ #ifndef LOG_RECORD_HPP #define LOG_RECORD_HPP -#include <ndb_types.h> -#include <stdlib.h> +#include <ndb_global.h> #include <portlib/NdbMem.h> /** diff --git a/ndb/src/rep/storage/NodeGroupInfo.hpp b/ndb/src/rep/storage/NodeGroupInfo.hpp index 605ccf76a38..3d0499d4425 100644 --- a/ndb/src/rep/storage/NodeGroupInfo.hpp +++ b/ndb/src/rep/storage/NodeGroupInfo.hpp @@ -18,12 +18,10 @@ #define NODE_GROUPINFO_HPP #include <Vector.hpp> -#include <NdbStdio.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> //#include <NdbSleep.h> -#include <NdbString.h> #include "NodeGroup.hpp" #include <rep/rep_version.hpp> diff --git a/ndb/src/rep/transfer/TransPS.cpp b/ndb/src/rep/transfer/TransPS.cpp index 7af53f24415..1f65e95850d 100644 --- a/ndb/src/rep/transfer/TransPS.cpp +++ b/ndb/src/rep/transfer/TransPS.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "ConfigRetriever.hpp" #include <NdbSleep.h> diff --git a/ndb/src/rep/transfer/TransPS.hpp b/ndb/src/rep/transfer/TransPS.hpp index 35823f1eb19..b47f1acfca2 100644 --- a/ndb/src/rep/transfer/TransPS.hpp +++ b/ndb/src/rep/transfer/TransPS.hpp @@ -17,12 +17,10 @@ #ifndef TransPS_HPP #define TransPS_HPP -#include <NdbStdio.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> #include <NdbSleep.h> -#include <NdbString.h> #include <TransporterDefinitions.hpp> #include <TransporterFacade.hpp> diff --git a/ndb/src/rep/transfer/TransSS.cpp b/ndb/src/rep/transfer/TransSS.cpp index 5399bfb4e3f..83f4b570330 100644 --- a/ndb/src/rep/transfer/TransSS.cpp +++ b/ndb/src/rep/transfer/TransSS.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <assert.h> #include "ConfigRetriever.hpp" diff --git a/ndb/src/rep/transfer/TransSS.hpp b/ndb/src/rep/transfer/TransSS.hpp index 90f320a079e..6f2089e46ac 100644 --- a/ndb/src/rep/transfer/TransSS.hpp +++ b/ndb/src/rep/transfer/TransSS.hpp @@ -17,12 +17,10 @@ #ifndef TransSS_HPP #define TransSS_HPP -#include <NdbStdio.h> #include <NdbTick.h> #include <NdbMain.h> #include <NdbOut.hpp> #include <NdbSleep.h> -#include <NdbString.h> #include <TransporterDefinitions.hpp> #include <TransporterFacade.hpp> |