Commit dff56fc7 authored by tomas@mc05.(none)'s avatar tomas@mc05.(none)

portability fixes and some comments

parent 0422d559
...@@ -49,7 +49,7 @@ int getopt(int, char **, char *opts); ...@@ -49,7 +49,7 @@ int getopt(int, char **, char *opts);
#endif // NDB_WIN32 #endif // NDB_WIN32
#ifdef NDB_ALPHA #ifdef NDB_ALPHA
#ifdef NDB_GCC #ifdef NDB_GCC // only for NDB_ALPHA
extern int gnuShouldNotUseRPCC(); extern int gnuShouldNotUseRPCC();
#define RPCC() gnuShouldNotUseRPCC(); #define RPCC() gnuShouldNotUseRPCC();
#else #else
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// misc defs // misc defs
#ifdef NDB_GCC #ifdef NDB_GCC // only for odbc
#define PRINTFLIKE(i,j) __attribute__ ((format (printf, i, j))) #define PRINTFLIKE(i,j) __attribute__ ((format (printf, i, j)))
#else #else
#define PRINTFLIKE(i,j) #define PRINTFLIKE(i,j)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define MAX_THREAD_NAME 16 #define MAX_THREAD_NAME 16
//#define USE_PTHREAD_EXTRAS
struct NdbThread struct NdbThread
{ {
...@@ -52,11 +53,9 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, ...@@ -52,11 +53,9 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
pthread_attr_init(&thread_attr); pthread_attr_init(&thread_attr);
pthread_attr_setstacksize(&thread_attr, thread_stack_size); pthread_attr_setstacksize(&thread_attr, thread_stack_size);
#if defined NDB_SOLARIS #ifdef USE_PTHREAD_EXTRAS
#if !defined NDB_SOLARIS6
/* Guard stack overflow with a 2k databuffer */ /* Guard stack overflow with a 2k databuffer */
pthread_attr_setguardsize(&thread_attr, 2048); pthread_attr_setguardsize(&thread_attr, 2048);
#endif
#endif #endif
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE); pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
...@@ -104,7 +103,7 @@ void NdbThread_Exit(int status) ...@@ -104,7 +103,7 @@ void NdbThread_Exit(int status)
int NdbThread_SetConcurrencyLevel(int level) int NdbThread_SetConcurrencyLevel(int level)
{ {
#ifndef NDB_SOLARIS6 #ifdef USE_PTHREAD_EXTRAS
return pthread_setconcurrency(level); return pthread_setconcurrency(level);
#else #else
return 0; return 0;
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
/** /**
* O_DIRECT * O_DIRECT
*/ */
#ifdef NDB_LINUX #if 0
//#ifdef NDB_LINUX
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif #endif
...@@ -34,12 +35,14 @@ ...@@ -34,12 +35,14 @@
#include <NdbThread.h> #include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp> #include <signaldata/FsOpenReq.hpp>
#ifdef NDB_LINUX #if 0
#ifdef HAVE_PREAD
// This is for pread and pwrite // This is for pread and pwrite
#ifndef __USE_UNIX98 #ifndef __USE_UNIX98
#define __USE_UNIX98 #define __USE_UNIX98
#endif #endif
#endif #endif
#endif
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE #if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
#else #else
...@@ -343,11 +346,10 @@ void AsyncFile::openReq(Request* request) ...@@ -343,11 +346,10 @@ void AsyncFile::openReq(Request* request)
} }
#if 0 #if 0
#if NDB_LINUX //#if NDB_LINUX
if(Global_useO_DIRECT){ if(Global_useO_DIRECT){
new_flags |= O_DIRECT; new_flags |= O_DIRECT;
} }
#endif
#endif #endif
switch(flags & 0x3){ switch(flags & 0x3){
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <EventLogger.hpp> #include <EventLogger.hpp>
#include <NodeState.hpp> #include <NodeState.hpp>
#if defined NDB_SOLARIS #if defined NDB_SOLARIS // ok
#include <sys/processor.h> // For system informatio #include <sys/processor.h> // For system informatio
#endif #endif
...@@ -199,7 +199,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ ...@@ -199,7 +199,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
#elif defined NDB_SOLARIS #elif defined NDB_SOLARIS // ok
// Search for at max 16 processors among the first 256 processor ids // Search for at max 16 processors among the first 256 processor ids
processor_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo)); processor_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo));
int pid = 0; int pid = 0;
...@@ -213,7 +213,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ ...@@ -213,7 +213,7 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){
if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){ if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){
g_eventLogger.info("NDB Cluster -- DB node %d", globalData.ownId); g_eventLogger.info("NDB Cluster -- DB node %d", globalData.ownId);
g_eventLogger.info("%s --", NDB_VERSION_STRING); g_eventLogger.info("%s --", NDB_VERSION_STRING);
#ifdef NDB_SOLARIS #ifdef NDB_SOLARIS // ok
g_eventLogger.info("NDB is running on a machine with %d processor(s) at %d MHz", g_eventLogger.info("NDB is running on a machine with %d processor(s) at %d MHz",
processor, speed); processor, speed);
#endif #endif
......
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
#include "MgmtErrorReporter.hpp" #include "MgmtErrorReporter.hpp"
#include "CpcClient.hpp" #include "CpcClient.hpp"
#ifdef NDB_SOLARIS // XXX fix me
static char* strsep(char** x, const char* y) { return 0; }
#endif
/***************************************************************************** /*****************************************************************************
* HELP * HELP
...@@ -1865,17 +1861,36 @@ CommandInterpreter::executeRep(char* parameters) ...@@ -1865,17 +1861,36 @@ CommandInterpreter::executeRep(char* parameters)
* CPC * CPC
*****************************************************************************/ *****************************************************************************/
#if 0
#if 0
//#ifdef NDB_SOLARIS // XXX fix me
static char* strsep(char** x, const char* y) { return 0; }
#endif
// Note this code has not been verified
#if 0
static char * my_strsep(char **stringp, const char *delim)
{
char *tmp= *stringp;
if (tmp == 0)
return 0;
*stringp = strtok(tmp, delim);
return tmp;
}
#endif
void void
CommandInterpreter::executeCpc(char *parameters) CommandInterpreter::executeCpc(char *parameters)
{ {
char *host_str = NULL, *port_str = NULL, *end; char *host_str = NULL, *port_str = NULL, *end;
long port = 1234; /* XXX */ long port = 1234; /* XXX */
while((host_str = strsep(&parameters, " \t:")) != NULL && while((host_str = my_strsep(&parameters, " \t:")) != NULL &&
host_str[0] == '\0'); host_str[0] == '\0');
if(parameters && parameters[0] != '\0') { if(parameters && parameters[0] != '\0') {
while((port_str = strsep(&parameters, " \t:")) != NULL && while((port_str = my_strsep(&parameters, " \t:")) != NULL &&
port_str[0] == '\0'); port_str[0] == '\0');
errno = 0; errno = 0;
...@@ -1944,6 +1959,7 @@ CommandInterpreter::executeCpc(char *parameters) ...@@ -1944,6 +1959,7 @@ CommandInterpreter::executeCpc(char *parameters)
<< endl; << endl;
return; return;
} }
#endif
#if 0 #if 0
static static
......
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