Commit 63b40952 authored by unknown's avatar unknown
Browse files

wl1744 - nbd windoze port


ndb/include/logger/SysLogHandler.hpp:
  win-port
ndb/include/ndb_global.h:
  win-port
ndb/include/portlib/PortDefs.h:
  win-port
ndb/src/common/mgmcommon/NdbConfig.c:
  win-port
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  win-port
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  win-port
ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  win-port
ndb/src/kernel/main.cpp:
  win-port
ndb/src/kernel/vm/Configuration.cpp:
  win-port
ndb/src/kernel/vm/Emulator.cpp:
  win-port
ndb/src/mgmsrv/CommandInterpreter.cpp:
  win-port
ndb/src/mgmsrv/main.cpp:
  win-port
scripts/make_win_src_distribution.sh:
  win-port
parent 6049821c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
#define SYSLOGHANDLER_H

#include "LogHandler.hpp"
#ifndef NDB_WIN32
#include <syslog.h>
#endif

/**
 * Logs messages to syslog. The default identity is 'NDB'. 
@@ -62,7 +64,7 @@ public:
   * @param pIdentity a syslog identity.
   * @param facility syslog facility, defaults to LOG_USER
   */
  SysLogHandler(const char* pIdentity, int facility = LOG_USER);
  SysLogHandler(const char* pIdentity, int facility);

  /**
   * Destructor.
+21 −24
Original line number Diff line number Diff line
@@ -2,16 +2,23 @@
#ifndef NDBGLOBAL_H
#define NDBGLOBAL_H

#include <my_global.h>

/** signal & SIG_PIPE */
#include <my_alarm.h>
#include <ndb_types.h>

#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#define NDB_WIN32
#include <winsock2.h>
#include <my_global.h>
#include <m_ctype.h>

#define PATH_MAX 256
#define DIR_SEPARATOR "\\"

#pragma warning(disable: 4503 4786)

#else
#undef NDB_WIN32
#endif
#include <my_global.h>
#include <my_alarm.h>

#ifdef _AIX
#undef _H_STRINGS
@@ -47,23 +54,22 @@
#include <sys/mman.h>
#endif

#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>

#define DIR_SEPARATOR "\\"
#define PATH_MAX 256
#define DIR_SEPARATOR "/"

#pragma warning(disable: 4503 4786)
#else
#endif

#define DIR_SEPARATOR "/"
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif

#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif

static const char table_name_separator =  '/';

#if defined(_AIX) || defined(NDB_VC98)
#if defined(_AIX) || defined(WIN32) || defined(NDB_VC98)
#define STATIC_CONST(x) enum { x }
#else
#define STATIC_CONST(x) static const Uint32 x
@@ -84,15 +90,6 @@ extern int ndb_init(void);
extern void ndb_end(int);
#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}

#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif

#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif

#ifdef SCO

#ifndef PATH_MAX
+0 −43
Original line number Diff line number Diff line
@@ -22,55 +22,12 @@

  $Id: PortDefs.h,v 1.5 2003/10/07 07:59:59 mikael Exp $
*/
#ifdef NDB_WIN32
#include <time.h>


struct tms 
{
  time_t      tms_utime;  /* user time */
  time_t      tms_stime;  /* system time */
  time_t      tms_cutime; /* user time of children */
  time_t      tms_cstime; /* system time of children */
};

struct timespec 
{
  long        tv_sec;  /* Seconds */
  long        tv_nsec; /* Nanoseconds */
};

#define strcasecmp(a,b) _strcmpi(a,b)

/* Exports a WIN32 getopt function */
extern int  optind;
extern char *optarg;
int getopt(int, char **, char *opts);
#endif /* NDB_WIN32 */

#ifdef NDB_ALPHA
#ifdef NDB_GCC /* only for NDB_ALPHA */
extern int gnuShouldNotUseRPCC();
#define RPCC() gnuShouldNotUseRPCC();
#else 
#ifdef NDB_WIN32
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
    u_int64 __asm(char *, ...);
    double __dasm(char *, ...);
    float __fasm(char *, ...);
    void _AcquireSpinLock(long *);
    void _ReleaseSpinLock(long *);
    int __ADD_ATOMIC_LONG2(void *, int);
#ifdef __cplusplus
};
#endif /* __cplusplus */
#pragma intrinsic (__asm, __dasm, __fasm)
#pragma intrinsic(_ReleaseSpinLock, _AcquireSpinLock)
#pragma intrinsic(__ADD_ATOMIC_LONG2)
#endif /* NDB_WIN32 */

#define RPCC() ((int)__asm(" rpcc v0;"))
#define MB() __asm(" mb;");
#define WMB() __asm(" wmb;");
+12 −11
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <NdbConfig.h>
#include <NdbEnv.h>
#include <NdbMem.h>
#include <basestring_vsnprintf.h>

static const char *datadir_path= 0;

@@ -48,7 +49,7 @@ NdbConfig_AllocHomePath(int _len)
  const char *path= NdbConfig_get_path(&path_len);
  int len= _len+path_len;
  char *buf= NdbMem_Allocate(len);
  snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
  basestring_snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
  return buf;
}

@@ -67,7 +68,7 @@ NdbConfig_NdbCfgName(int with_ndb_home){
    len= strlen(buf);
  } else
    buf= NdbMem_Allocate(128);
  snprintf(buf+len, 128, "Ndb.cfg");
  basestring_snprintf(buf+len, 128, "Ndb.cfg");
  return buf;
}

@@ -77,9 +78,9 @@ char *get_prefix_buf(int len, int node_id)
  char tmp_buf[sizeof("ndb_pid#########")+1];
  char *buf;
  if (node_id > 0)
    snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
    basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
  else
    snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
    basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
  tmp_buf[sizeof(tmp_buf)-1]= 0;

  buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf));
@@ -91,7 +92,7 @@ char*
NdbConfig_ErrorFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_error.log");
  basestring_snprintf(buf+len, 128, "_error.log");
  return buf;
}

@@ -99,7 +100,7 @@ char*
NdbConfig_ClusterLogFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_cluster.log");
  basestring_snprintf(buf+len, 128, "_cluster.log");
  return buf;
}

@@ -107,7 +108,7 @@ char*
NdbConfig_SignalLogFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_signal.log");
  basestring_snprintf(buf+len, 128, "_signal.log");
  return buf;
}

@@ -115,7 +116,7 @@ char*
NdbConfig_TraceFileName(int node_id, int file_no){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_trace.log.%u", file_no);
  basestring_snprintf(buf+len, 128, "_trace.log.%u", file_no);
  return buf;
}

@@ -123,7 +124,7 @@ char*
NdbConfig_NextTraceFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_trace.log.next");
  basestring_snprintf(buf+len, 128, "_trace.log.next");
  return buf;
}

@@ -131,7 +132,7 @@ char*
NdbConfig_PidFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, ".pid");
  basestring_snprintf(buf+len, 128, ".pid");
  return buf;
}

@@ -139,6 +140,6 @@ char*
NdbConfig_StdoutFileName(int node_id){
  char *buf= get_prefix_buf(128, node_id);
  int len= strlen(buf);
  snprintf(buf+len, 128, "_out.log");
  basestring_snprintf(buf+len, 128, "_out.log");
  return buf;
}
+2 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
    ndbrequire(false);
  }

#ifndef NDB_WIN32
  if(ERROR_INSERTED(9996)){
    simulate_error_during_shutdown= SIGSEGV;
    ndbrequire(false);
@@ -159,6 +160,7 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
    simulate_error_during_shutdown= SIGSEGV;
    kill(getpid(), SIGABRT);
  }
#endif
}//execNDB_TAMPER()

void Cmvmi::execSET_LOGLEVELORD(Signal* signal) 
Loading