Commit 2e9dee04 authored by unknown's avatar unknown

portability/autoconf fixes


ndb/config/Defs.LINUX.x86.GCC.mk:
  postability/autoconf fixes
ndb/include/portlib/NdbMutex.h:
  postability/autoconf fixes
ndb/src/common/editline/unix.h:
  postability/autoconf fixes
ndb/src/common/portlib/memtest/memtest.c:
  postability/autoconf fixes
ndb/src/common/portlib/unix/NdbTCP.c:
  postability/autoconf fixes
ndb/src/common/portlib/unix/NdbThread.c:
  postability/autoconf fixes
ndb/src/common/transporter/Makefile:
  postability/autoconf fixes
ndb/src/common/transporter/SHM_Transporter.cpp:
  postability/autoconf fixes
ndb/src/mgmsrv/MgmtSrvr.cpp:
  postability/autoconf fixes
parent 69424ca9
...@@ -6,9 +6,11 @@ SHELL := /bin/sh ...@@ -6,9 +6,11 @@ SHELL := /bin/sh
C++ := gcc$(GCC_VERSION) C++ := gcc$(GCC_VERSION)
CC := gcc$(GCC_VERSION) CC := gcc$(GCC_VERSION)
AR_RCS := $(PURE) ar rcs AR_RCS := $(PURE) ar rcs
SO := gcc$(GCC_VERSION) -shared -lpthread -o SO := gcc$(GCC_VERSION) -shared -lpthread -o
#SO := gcc$(GCC_VERSION) -shared -o
MAKEDEPEND := gcc$(GCC_VERSION) -M MAKEDEPEND := gcc$(GCC_VERSION) -M
#MAKEDEPEND := gcc$(GCC_VERSION) -M -nostdinc -nostdinc++
PIC := -fPIC PIC := -fPIC
RPCGENFLAGS := -M -C -N RPCGENFLAGS := -M -C -N
...@@ -27,7 +29,8 @@ else ...@@ -27,7 +29,8 @@ else
CCFLAGS_WARNINGS = -Wno-long-long -Wall CCFLAGS_WARNINGS = -Wno-long-long -Wall
endif endif
# Add these for more warnings -Weffc++ -W # Add these for more warnings -Weffc++ -W
CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS CCFLAGS_TOP =
#CCFLAGS_TOP = -DSAFE_MUTEX
CCFLAGS_TOP += -fno-rtti -fno-exceptions CCFLAGS_TOP += -fno-rtti -fno-exceptions
ifeq (RELEASE, $(NDB_VERSION)) ifeq (RELEASE, $(NDB_VERSION))
...@@ -53,4 +56,5 @@ LINK.cc = $(PURE) $(CC) $(CCFLAGS) $(LDFLAGS) ...@@ -53,4 +56,5 @@ LINK.cc = $(PURE) $(CC) $(CCFLAGS) $(LDFLAGS)
LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS)
LDFLAGS_LAST = -lpthread -lrt $(NDB_TOP)/src/common/portlib/gcc.cpp LDFLAGS_LAST = -lrt -lpthread $(NDB_TOP)/src/common/portlib/gcc.cpp
#LDFLAGS_LAST = -lrt $(NDB_TOP)/src/common/portlib/gcc.cpp $(NDB_TOP)/../mysys/libmysys.a $(NDB_TOP)/../dbug/libdbug.a $(NDB_TOP)/../regex/libregex.a $(NDB_TOP)/../strings/libmystrings.a -lpthread
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#ifdef NDB_WIN32 #ifdef NDB_WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <windows.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -21,6 +21,5 @@ ...@@ -21,6 +21,5 @@
#define CRLF "\r\n" #define CRLF "\r\n"
#include <sys/types.h> #include <ndb_global.h>
#include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
...@@ -4,38 +4,16 @@ DIRS := ...@@ -4,38 +4,16 @@ DIRS :=
ifeq ($(NDB_OS), SOFTOSE) ifeq ($(NDB_OS), SOFTOSE)
DIRS += ose DIRS += ose
endif else
ifeq ($(NDB_OS), OSE) ifeq ($(NDB_OS), OSE)
DIRS += ose DIRS += ose
endif else
ifeq ($(NDB_OS), WIN32)
ifeq ($(NDB_OS), SIMCELLO) DIRS += win32
DIRS += ose else
endif
ifeq ($(NDB_OS), LINUX)
DIRS += unix
endif
ifeq ($(NDB_OS), MACOSX)
DIRS += unix
endif
ifeq ($(NDB_OS), SOLARIS)
DIRS += unix DIRS += unix
endif endif
ifeq ($(NDB_OS), SOLARIS6)
DIRS += unix
endif endif
ifeq ($(NDB_OS), HPUX)
DIRS += unix
endif
ifeq ($(NDB_OS), WIN32)
DIRS += win32
endif endif
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <sys/time.h>
#include <sys/mman.h>
long long getMilli(); long long getMilli();
long long getMicro(); long long getMicro();
void malloctest(int loopcount, int memsize, int touch); void malloctest(int loopcount, int memsize, int touch);
......
...@@ -15,20 +15,26 @@ ...@@ -15,20 +15,26 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbMutex.h>
#include "NdbTCP.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 int
Ndb_getInAddr(struct in_addr * dst, const char *address) { Ndb_getInAddr(struct in_addr * dst, const char *address) {
struct hostent host, * hostPtr; struct hostent * hostPtr;
char buf[1024]; NdbMutex_Lock(&LOCK_gethostbyname);
int h_errno; hostPtr = gethostbyname(address);
hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno);
if (hostPtr != NULL) { if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
NdbMutex_Unlock(&LOCK_gethostbyname);
return 0; return 0;
} }
NdbMutex_Unlock(&LOCK_gethostbyname);
/* Try it as aaa.bbb.ccc.ddd. */ /* Try it as aaa.bbb.ccc.ddd. */
dst->s_addr = inet_addr(address); dst->s_addr = inet_addr(address);
...@@ -37,13 +43,14 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { ...@@ -37,13 +43,14 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
} }
return -1; return -1;
} }
#endif
#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX #if 0
int int
Ndb_getInAddr(struct in_addr * dst, const char *address) { Ndb_getInAddr(struct in_addr * dst, const char *address) {
struct hostent * hostPtr; struct hostent host, * hostPtr;
hostPtr = gethostbyname(address); char buf[1024];
int h_errno;
hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno);
if (hostPtr != NULL) { if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
return 0; return 0;
...@@ -57,4 +64,3 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { ...@@ -57,4 +64,3 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
return -1; return -1;
} }
#endif #endif
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbThread.h> #include <NdbThread.h>
#include <my_pthread.h> #include <pthread.h>
#define MAX_THREAD_NAME 16 #define MAX_THREAD_NAME 16
......
...@@ -10,7 +10,6 @@ DIRS := basictest perftest ...@@ -10,7 +10,6 @@ DIRS := basictest perftest
SOURCES = \ SOURCES = \
Transporter.cpp \ Transporter.cpp \
SendBuffer.cpp \ SendBuffer.cpp \
SHM_Transporter.cpp \
TCP_Transporter.cpp \ TCP_Transporter.cpp \
TransporterRegistry.cpp \ TransporterRegistry.cpp \
Packer.cpp Packer.cpp
...@@ -22,6 +21,7 @@ CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \ ...@@ -22,6 +21,7 @@ CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \
ifeq ($(NDB_SHM), Y) ifeq ($(NDB_SHM), Y)
SOURCES += SHM_Transporter.cpp
ifeq ($(NDB_OS), WIN32) ifeq ($(NDB_OS), WIN32)
SOURCES += SHM_Transporter.win32.cpp SOURCES += SHM_Transporter.win32.cpp
else else
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
#include <NdbSleep.h> #include <NdbSleep.h>
#include <NdbOut.hpp> #include <NdbOut.hpp>
#ifdef NDB_WIN32 #ifndef NDB_WIN32
#include <windows.h>
#else
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#endif #endif
......
...@@ -78,10 +78,6 @@ NDB_MAIN(ndb_kernel){ ...@@ -78,10 +78,6 @@ NDB_MAIN(ndb_kernel){
char homePath[255]; char homePath[255];
NdbConfig_HomePath(homePath, 255); NdbConfig_HomePath(homePath, 255);
#if defined (NDB_LINUX) || defined (NDB_SOLARIS)
/**
* This has only been tested with linux & solaris
*/
if (theConfig->getDaemonMode()) { if (theConfig->getDaemonMode()) {
// Become a daemon // Become a daemon
char lockfile[255], logfile[255]; char lockfile[255], logfile[255];
...@@ -134,7 +130,6 @@ NDB_MAIN(ndb_kernel){ ...@@ -134,7 +130,6 @@ NDB_MAIN(ndb_kernel){
} }
g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid()); g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid());
#endif
systemInfo(* theConfig, systemInfo(* theConfig,
theConfig->clusterConfigurationData().SizeAltData.logLevel); theConfig->clusterConfigurationData().SizeAltData.logLevel);
......
...@@ -6,8 +6,6 @@ BIN_TARGET := mgmtsrvr ...@@ -6,8 +6,6 @@ BIN_TARGET := mgmtsrvr
BIN_TARGET_LIBS := BIN_TARGET_LIBS :=
BIN_TARGET_ARCHIVES := mgmapi NDB_API mgmsrvcommon BIN_TARGET_ARCHIVES := mgmapi NDB_API mgmsrvcommon
LDFLAGS_LOC = -lpthread
ifneq ($(USE_EDITLINE), N) ifneq ($(USE_EDITLINE), N)
BIN_TARGET_ARCHIVES += editline BIN_TARGET_ARCHIVES += editline
DIRS := mkconfig DIRS := mkconfig
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> #include <ndb_global.h>
#include <my_pthread.h> #include <pthread.h>
#include "MgmtSrvr.hpp" #include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp" #include "MgmtErrorReporter.hpp"
......
...@@ -22,6 +22,7 @@ Name: Ndb.cpp ...@@ -22,6 +22,7 @@ Name: Ndb.cpp
******************************************************************************/ ******************************************************************************/
#include <ndb_global.h> #include <ndb_global.h>
#include <pthread.h>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include "NdbImpl.hpp" #include "NdbImpl.hpp"
...@@ -1244,7 +1245,7 @@ Ndb::printState(const char* fmt, ...) ...@@ -1244,7 +1245,7 @@ Ndb::printState(const char* fmt, ...)
NdbMutex_Lock(&print_state_mutex); NdbMutex_Lock(&print_state_mutex);
bool dups = false; bool dups = false;
ndbout << buf << " ndb=" << hex << this << dec; ndbout << buf << " ndb=" << hex << this << dec;
#ifdef NDB_LINUX #ifndef NDB_WIN32
ndbout << " thread=" << (int)pthread_self(); ndbout << " thread=" << (int)pthread_self();
#endif #endif
ndbout << endl; ndbout << endl;
......
...@@ -12,8 +12,6 @@ BIN_TARGET := ndb_rep ...@@ -12,8 +12,6 @@ BIN_TARGET := ndb_rep
BIN_TARGET_LIBS := BIN_TARGET_LIBS :=
BIN_TARGET_ARCHIVES += editline repstorage repadapters reprequestor reptransfer mgmapi NDB_API mgmsrvcommon BIN_TARGET_ARCHIVES += editline repstorage repadapters reprequestor reptransfer mgmapi NDB_API mgmsrvcommon
LDFLAGS_LOC = -lpthread
SOURCES = \ SOURCES = \
RepMain.cpp \ RepMain.cpp \
Requestor.cpp \ Requestor.cpp \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment