mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
[t:2328] Merge 2328 branch onto main,
some minimal porting git-svn-id: file:///svn/toku/tokudb@17597 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
ef06c33f34
commit
c6fcce22ce
29 changed files with 189 additions and 274 deletions
|
@ -117,7 +117,7 @@ log_print.c log_header.h: log_code.c
|
|||
|
||||
#Needs to be done manually since it does not include newbrt.
|
||||
logformat$(BINSUF): logformat.c $(LIBPORTABILITY)
|
||||
$(CC) $< $(BIN_FROM_O_FLAGS_NOLIB) $(LIBPORTABILITY) $(LINK_MUST_BE_LAST)
|
||||
$(CC) $< $(BIN_FROM_O_FLAGS_NOLIB) $(ALWAYS_LINK) $(LINK_MUST_BE_LAST)
|
||||
|
||||
|
||||
libs: $(NEWBRT) $(NEWBRT_BUNDLE)
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
|
||||
/* See merger.h for a description of this module. */
|
||||
|
||||
#include <toku_portability.h>
|
||||
#include "brttypes.h"
|
||||
#include "merger.h"
|
||||
#include <memory.h>
|
||||
#include <toku_assert.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char BOOL;
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
struct merger {
|
||||
int n_files;
|
||||
FILE **files;
|
||||
|
@ -84,7 +82,7 @@ static int merge_fill_dbt (MERGER m, int i)
|
|||
}
|
||||
// Got something, so we should be able to get the rest.
|
||||
if (m->keys[i].ulen < keylen) {
|
||||
REALLOC_N(keylen, m->keys[i].data);
|
||||
m->keys[i].data = toku_xrealloc(m->keys[i].data, keylen);
|
||||
m->keys[i].ulen = keylen;
|
||||
}
|
||||
{
|
||||
|
@ -97,7 +95,7 @@ static int merge_fill_dbt (MERGER m, int i)
|
|||
assert(n==1);
|
||||
}
|
||||
if (m->vals[i].ulen < vallen) {
|
||||
REALLOC_N(vallen, m->vals[i].data);
|
||||
m->vals[i].data = toku_xrealloc(m->vals[i].data, vallen);
|
||||
m->vals[i].ulen = vallen;
|
||||
}
|
||||
{
|
||||
|
|
|
@ -381,7 +381,7 @@ static int add222_fetch (CACHEFILE cf, CACHEKEY key, u_int32_t fullhash, void **
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if !TOKU_WINDOWS
|
||||
|
||||
static void test_multi_filehandles (void) {
|
||||
CACHETABLE t;
|
||||
|
@ -721,7 +721,7 @@ test_main (int argc, const char *argv[]) {
|
|||
test_mutex_init();
|
||||
|
||||
// run tests
|
||||
#if !defined(_WIN32)
|
||||
#if !TOKU_WINDOWS
|
||||
test_multi_filehandles();
|
||||
#endif
|
||||
test_cachetable_create();
|
||||
|
@ -732,7 +732,7 @@ test_main (int argc, const char *argv[]) {
|
|||
for (i=0; i<1; i++) {
|
||||
test0();
|
||||
test_nested_pin();
|
||||
#if !defined(_WIN32)
|
||||
#if !TOKU_WINDOWS
|
||||
test_multi_filehandles ();
|
||||
#endif
|
||||
test_dirty();
|
||||
|
|
33
src/Makefile
33
src/Makefile
|
@ -45,24 +45,23 @@ LIBRARIES+= \
|
|||
$(LIBRARY_S) \
|
||||
#Purposely here for \ at end of prev
|
||||
|
||||
ifeq ($(OS_CHOICE),windows)
|
||||
#Does not support parallel builds for files in src.
|
||||
.NOTPARALLEL:;
|
||||
ifeq ($(DEBUG),0)
|
||||
WINYDB = $(IPO_YDB)
|
||||
else
|
||||
WINYDB = $(NOIPO_YDB)
|
||||
endif
|
||||
LIBRARIES += $(WINYDB)
|
||||
libtokudb.pdb : $(WINYDB);
|
||||
endif
|
||||
|
||||
INSTALL_LIBRARIES= $(patsubst %,%.install,$(LIBRARIES))
|
||||
ifeq ($(OS_CHOICE),windows)
|
||||
INSTALL_LIBRARIES += libtokudb.pdb.install
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CHOICE),windows)
|
||||
#Does not support parallel builds for files in src.
|
||||
.NOTPARALLEL:;
|
||||
ifeq ($(DEBUG),0)
|
||||
WINYDB = $(IPO_YDB)
|
||||
else
|
||||
WINYDB = $(NOIPO_YDB)
|
||||
endif
|
||||
LIBRARIES += $(WINYDB)
|
||||
libtokudb.pdb : $(WINYDB);
|
||||
endif
|
||||
|
||||
|
||||
|
||||
.PHONY:install_libs install.% build install local build_tests
|
||||
|
||||
|
@ -84,9 +83,12 @@ install: libs install_libs ;
|
|||
.PHONY: local libs buildlocktrees
|
||||
libs: $(LIBRARIES) ;
|
||||
$(IPO_YDB) $(NOIPO_YDB) $(LIBRARIES): | export.def
|
||||
export.def: export.map
|
||||
|
||||
#Generate export.def
|
||||
#Take everything from export.map, add snprintf and vsnprintf, and then convert into export.def format.
|
||||
export.def: export.map Makefile
|
||||
echo "EXPORTS" > $@
|
||||
cat export.map |sed -n "s/\([a-zA-Z_0-9][a-zA-Z_0-9]*\);/\t\1 @/g;/@/ P" |sed -n 'P;=' | sed '{;N;s/\n//;}' >> $@
|
||||
cat export.map | sed 's/global:$$/global:\n snprintf;\n usleep;/' | sed -n "s/\([a-zA-Z_0-9][a-zA-Z_0-9]*\);/\t\1 @/g;/@/ P" |sort | sed -n 'P;=' | sed '{;N;s/\n//;}' >> $@
|
||||
echo "" >> $@
|
||||
|
||||
buildlocktrees: $(LOCKTREE) $(RANGETREE) ;
|
||||
|
@ -133,6 +135,7 @@ strip: $(LIBRARY)
|
|||
strip $<
|
||||
|
||||
clean:
|
||||
rm -f export.def
|
||||
cd tests && $(MAKE) clean
|
||||
cd lock_tree && $(MAKE) clean
|
||||
cd range_tree && $(MAKE) clean
|
||||
|
|
|
@ -164,7 +164,7 @@ toku_ydb_lock(void) {
|
|||
t = MAX_SLEEP;
|
||||
(void) toku_sync_fetch_and_increment_uint64(&status.times_max_sleep_used);
|
||||
}
|
||||
#if !TOKU_WINDOWS || TOKU_WINDOWS_HAS_FAST_ATOMIC_64
|
||||
#if !TOKU_WINDOWS || TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
(void) toku_sync_fetch_and_add_uint64(&status.total_sleep_time, t);
|
||||
#endif
|
||||
(void) toku_sync_fetch_and_increment_uint64(&status.total_sleepers);
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
toku_os_full_write;
|
||||
toku_os_full_pwrite;
|
||||
|
||||
toku_os_get_max_process_data_size;
|
||||
toku_os_get_phys_memory_size;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* a REFERENCE IMPLEMENTATION of the loader
|
||||
*/
|
||||
|
||||
#include <toku_portability.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ydb-internal.h"
|
||||
|
|
|
@ -188,7 +188,7 @@ random_acts(void * d) {
|
|||
}
|
||||
|
||||
|
||||
#if IS_TDB && !defined(_WIN32) && !defined(_WIN64)
|
||||
#if IS_TDB && !TOKU_WINDOWS
|
||||
return intothevoid;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ static void __attribute__((destructor)) libtokudb_destroy(void) {
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#if TOKU_WINDOWS
|
||||
#include <windows.h>
|
||||
#define UNUSED(x) x=x
|
||||
|
||||
|
|
|
@ -218,28 +218,31 @@ ifeq ($(CC),icc)
|
|||
SYMBOLS= -g -debug all -inline-debug-info
|
||||
PORTABILITY=-diag-enable port-win
|
||||
AR=xiar
|
||||
DISABLE_WARNING=
|
||||
ifneq ($(CYGWIN),)
|
||||
#Cygwin
|
||||
ICC_NOWARN=-Qdiag-disable:
|
||||
SKIP_WARNING += $(ICC_NOWARN)869 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
|
||||
SKIP_WARNING += $(ICC_NOWARN)593 # Don't complain about unused variables (since we defined __attribute__ to be nothing.)
|
||||
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about multi-file optimization
|
||||
SKIP_WARNING += $(ICC_NOWARN)11000 # Disable message about single-file optimization
|
||||
SKIP_WARNING += $(ICC_NOWARN)11005 # Disable message about creating object file
|
||||
SKIP_WARNING += $(ICC_NOWARN)188 # Disable message about 0 used for enum
|
||||
SKIP_WARNING += $(ICC_NOWARN)1011 # Disable message about missing return with an abort
|
||||
DISABLE_WARNING +=869# Don't complain about unused variables (since we defined __attribute__ to be nothing.)
|
||||
DISABLE_WARNING +=593# Don't complain about unused variables (since we defined __attribute__ to be nothing.)
|
||||
DISABLE_WARNING +=11000# Disable message about multi-file optimization
|
||||
DISABLE_WARNING +=11000# Disable message about single-file optimization
|
||||
DISABLE_WARNING +=11005# Disable message about creating object file
|
||||
DISABLE_WARNING +=188# Disable message about 0 used for enum
|
||||
DISABLE_WARNING +=1011# Disable message about missing return with an abort
|
||||
else
|
||||
#Linux
|
||||
ICC_NOWARN=-diag-disable #Need the space
|
||||
endif
|
||||
SKIP_WARNING += $(ICC_NOWARN)810 # Remove warnings about losing precision
|
||||
SKIP_WARNING += $(ICC_NOWARN)94 # Allow arrays of length 0
|
||||
SKIP_WARNING += $(ICC_NOWARN)118 # Allow void functions to return void functions
|
||||
SKIP_WARNING += $(ICC_NOWARN)177 # Don't complain about static variables that are not used.
|
||||
#SKIP_WARNING += $(ICC_NOWARN)188 # Don't complain about enumerated type mixed with another type.
|
||||
SKIP_WARNING += $(ICC_NOWARN)589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
|
||||
SKIP_WARNING += $(ICC_NOWARN)981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
|
||||
SKIP_WARNING += $(ICC_NOWARN)1324 # Don't complain about rdtsc clobbering its registers more than once.
|
||||
DISABLE_WARNING +=810# Remove warnings about losing precision
|
||||
DISABLE_WARNING +=94# Allow arrays of length 0
|
||||
DISABLE_WARNING +=118# Allow void functions to return void functions
|
||||
DISABLE_WARNING +=177# Don't complain about static variables that are not used.
|
||||
#DISABLE_WARNING +=188# Don't complain about enumerated type mixed with another type.
|
||||
DISABLE_WARNING +=589# Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
|
||||
DISABLE_WARNING +=981# Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
|
||||
DISABLE_WARNING +=1324# Don't complain about rdtsc clobbering its registers more than once.
|
||||
DISABLE_WARNING +=1786# Don't complain about 'read/write/other standards' being deprecated
|
||||
SKIP_WARNING = $(ICC_NOWARN)$(shell sed 's/ /,/g' <<< "$(DISABLE_WARNING)" | sed 's/,//')
|
||||
endif
|
||||
|
||||
ifneq ($(CC),icc)
|
||||
|
@ -291,7 +294,6 @@ ifneq ($(CYGWIN),)
|
|||
WERROR += -Qdiag-error:167,266,810,592 # Workarounds for -WX not being complete on windows icc
|
||||
SYMBOLS= -Zi -debug:all -Qinline-debug-info
|
||||
PORTABILITY=
|
||||
SKIP_WARNING += $(ICC_NOWARN)1786 # Don't complain about 'read/write/other standards' being deprecated
|
||||
PORTABILITY_HEADERS = $(TOKUROOT)windows
|
||||
AR=xilib
|
||||
DBG_AROPT=-qnoipo
|
||||
|
|
|
@ -19,20 +19,20 @@ toku_sync_fetch_and_decrement_int32(volatile int32_t *a) {
|
|||
}
|
||||
|
||||
#define TOKU_WINDOWS_MIN_SUPPORTED_IS_VISTA 0
|
||||
|
||||
//Vista has 64 bit atomic instruction functions.
|
||||
//64 bit windows should also have it, but we're using neither right now.
|
||||
#if TOKU_WINDOWS_MIN_SUPPORTED_IS_VISTA
|
||||
#define TOKU_WINDOWS_HAS_FAST_ATOMIC_64 1
|
||||
#if TOKU_WINDOWS_MIN_SUPPORTED_IS_VISTA || defined(_WIN64)
|
||||
#define TOKU_WINDOWS_HAS_ATOMIC_64 1
|
||||
#else
|
||||
#define TOKU_WINDOWS_HAS_FAST_ATOMIC_64 0
|
||||
#define TOKU_WINDOWS_HAS_ATOMIC_64 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static inline uint64_t
|
||||
toku_sync_fetch_and_add_uint64(volatile uint64_t *a, uint64_t b) {
|
||||
#if TOKU_WINDOWS_MIN_SUPPORTED_IS_VISTA
|
||||
//Need Vista or later for this function to exist.
|
||||
#if TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
return _InterlockedExchangeAdd64((int64_t*)a, b);
|
||||
#else
|
||||
//Temporarily just use 32 bit atomic instructions (treat the values as 32
|
||||
|
@ -44,8 +44,7 @@ toku_sync_fetch_and_add_uint64(volatile uint64_t *a, uint64_t b) {
|
|||
|
||||
static inline uint64_t
|
||||
toku_sync_fetch_and_increment_uint64(volatile uint64_t *a) {
|
||||
#if TOKU_WINDOWS_MIN_SUPPORTED_IS_VISTA
|
||||
//Need Vista or later for this function to exist.
|
||||
#if TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
return _InterlockedIncrement64((int64_t*)a);
|
||||
#else
|
||||
//Temporarily just use 32 bit atomic instructions (treat the values as 32
|
||||
|
|
|
@ -23,7 +23,7 @@ int toku_os_get_number_active_processors(void);
|
|||
int toku_os_get_pagesize(void);
|
||||
|
||||
// Returns: the size of physical memory (in bytes)
|
||||
uint64_t toku_os_get_phys_memory_size(void);
|
||||
uint64_t toku_os_get_phys_memory_size(void) __attribute__((__visibility__("default")));
|
||||
|
||||
// Returns the processor frequency in Hz
|
||||
// Returns 0 if success
|
||||
|
@ -58,7 +58,7 @@ int toku_os_get_max_rss(int64_t *maxrss);
|
|||
// Get the maximum size of the process data size (in bytes)
|
||||
// Success: returns 0 and sets *maxdata to the data size
|
||||
// Fail: returns an error number
|
||||
int toku_os_get_max_process_data_size(uint64_t *maxdata);
|
||||
int toku_os_get_max_process_data_size(uint64_t *maxdata) __attribute__((__visibility__("default")));
|
||||
|
||||
int toku_os_initialize_settings(int verbosity) __attribute__((__visibility__("default")));
|
||||
|
||||
|
@ -67,7 +67,7 @@ int toku_os_initialize_settings(int verbosity) __attribute__((__visibility__("d
|
|||
//
|
||||
int toku_os_is_absolute_name(const char* path) __attribute__((__visibility__("default")));
|
||||
|
||||
#if defined(TOKU_WINDOWS) && TOKU_WINDOWS
|
||||
#if TOKU_WINDOWS
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
//Test if st_mode (from stat) is a directory
|
||||
|
|
|
@ -239,14 +239,14 @@ resend_signals(void) {
|
|||
}
|
||||
|
||||
#include <memory.h>
|
||||
#if IS_TDB && !defined(_WIN32) && !defined(_WIN64) && TDB_IS_STATIC
|
||||
#if IS_TDB && !TOKU_WINDOWS && TDB_IS_STATIC
|
||||
#include <ydb.h>
|
||||
#endif
|
||||
static int test_main (int argc, char *argv[]);
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
int r;
|
||||
#if IS_TDB && !defined(_WIN32) && !defined(_WIN64) && TDB_IS_STATIC
|
||||
#if IS_TDB && !TOKU_WINDOWS && TDB_IS_STATIC
|
||||
toku_ydb_init();
|
||||
#endif
|
||||
#if !IS_TDB && DB_VERSION_MINOR==4 && DB_VERSION_MINOR == 7
|
||||
|
@ -255,7 +255,7 @@ main(int argc, char *argv[]) {
|
|||
r = db_env_set_func_realloc(toku_realloc); assert(r==0);
|
||||
#endif
|
||||
r = test_main(argc, argv);
|
||||
#if IS_TDB && !defined(_WIN32) && !defined(_WIN64) && TDB_IS_STATIC
|
||||
#if IS_TDB && !TOKU_WINDOWS && TDB_IS_STATIC
|
||||
toku_ydb_destroy();
|
||||
#endif
|
||||
return r;
|
||||
|
|
|
@ -171,7 +171,7 @@ static int test_main (int argc, char *argv[]) {
|
|||
}
|
||||
sort_delimiter[0] = (char)temp;
|
||||
sort_delimiter[1] = '\0';
|
||||
#if defined(TOKU_WINDOWS) && TOKU_WINDOWS
|
||||
#if TOKU_WINDOWS
|
||||
if (!strcmp(sort_delimiter, "\n")) {
|
||||
strcpy(sort_delimiter, "\r\n");
|
||||
}
|
||||
|
|
|
@ -194,14 +194,14 @@ static int (*t_fsync)(int) = 0;
|
|||
static uint64_t toku_fsync_count;
|
||||
static uint64_t toku_fsync_time;
|
||||
|
||||
#if !TOKU_WINDOWS_HAS_FAST_ATOMIC_64
|
||||
#if !TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
static toku_pthread_mutex_t fsync_lock;
|
||||
#endif
|
||||
|
||||
int
|
||||
toku_fsync_init(void) {
|
||||
int r = 0;
|
||||
#if !TOKU_WINDOWS_HAS_FAST_ATOMIC_64
|
||||
#if !TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
r = toku_pthread_mutex_init(&fsync_lock, NULL); assert(r == 0);
|
||||
#endif
|
||||
return r;
|
||||
|
@ -210,7 +210,7 @@ toku_fsync_init(void) {
|
|||
int
|
||||
toku_fsync_destroy(void) {
|
||||
int r = 0;
|
||||
#if !TOKU_WINDOWS_HAS_FAST_ATOMIC_64
|
||||
#if !TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
r = toku_pthread_mutex_destroy(&fsync_lock); assert(r == 0);
|
||||
#endif
|
||||
return r;
|
||||
|
@ -240,7 +240,7 @@ toku_file_fsync(int fd) {
|
|||
if (r)
|
||||
assert(errno==EINTR);
|
||||
}
|
||||
#if TOKU_WINDOWS_HAS_FAST_ATOMIC_64
|
||||
#if TOKU_WINDOWS_HAS_ATOMIC_64
|
||||
toku_sync_fetch_and_increment_uint64(&toku_fsync_count);
|
||||
toku_sync_fetch_and_add_uint64(&toku_fsync_time, get_tnow() - tstart);
|
||||
#else
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* See the README file for an explanation of the pthreads-win32 version
|
||||
* numbering scheme and how the DLL is named etc.
|
||||
*/
|
||||
#define PTW32_VERSION 2,8,0,0
|
||||
#define PTW32_VERSION_STRING "2, 8, 0, 0\0"
|
||||
#define PTW32_VERSION 2,9,0,0
|
||||
#define PTW32_VERSION_STRING "2, 9, 0, 0\0"
|
||||
|
||||
/* There are three implementations of cancel cleanup.
|
||||
* Note that pthread.h is included in both application
|
||||
|
@ -104,7 +104,7 @@
|
|||
|
||||
#define PTW32_LEVEL_MAX 3
|
||||
|
||||
#if !defined(PTW32_LEVEL)
|
||||
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
|
||||
#define PTW32_LEVEL PTW32_LEVEL_MAX
|
||||
/* Include everything */
|
||||
#endif
|
||||
|
@ -210,9 +210,6 @@ typedef unsigned long DWORD_PTR;
|
|||
* -----------------
|
||||
*/
|
||||
|
||||
//IF YOU GET AN ERROR on HAVE_CONFIG_H:
|
||||
//You used #include "toku_portability.h" <-- WRONG
|
||||
//instead of #include <toku_portability.h> <-- CORRECT
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
@ -308,7 +305,7 @@ enum {
|
|||
#ifndef HAVE_STRUCT_TIMESPEC
|
||||
#define HAVE_STRUCT_TIMESPEC 1
|
||||
struct timespec {
|
||||
long tv_sec;
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif /* HAVE_STRUCT_TIMESPEC */
|
||||
|
@ -902,13 +899,13 @@ PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
|
|||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
|
||||
int);
|
||||
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *,
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *,
|
||||
int *);
|
||||
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
|
||||
int inheritsched);
|
||||
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr,
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr,
|
||||
int * inheritsched);
|
||||
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
|
||||
|
@ -987,7 +984,7 @@ PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t
|
|||
int pshared);
|
||||
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
|
||||
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind);
|
||||
|
||||
/*
|
||||
* Barrier Attribute Functions
|
||||
|
@ -1187,6 +1184,10 @@ PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
|
|||
* Returns the Win32 HANDLE for the POSIX thread.
|
||||
*/
|
||||
PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
|
||||
/*
|
||||
* Returns the win32 thread ID for POSIX thread.
|
||||
*/
|
||||
PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1248,13 +1249,19 @@ PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
|
|||
( strcpy( (_buf), ctime( (_clock) ) ), \
|
||||
(_buf) )
|
||||
|
||||
/*
|
||||
* gmtime(tm) and localtime(tm) return 0 if tm represents
|
||||
* a time prior to 1/1/1970.
|
||||
*/
|
||||
#define gmtime_r( _clock, _result ) \
|
||||
( *(_result) = *gmtime( (_clock) ), \
|
||||
(_result) )
|
||||
( gmtime( (_clock) ) \
|
||||
? (*(_result) = *gmtime( (_clock) ), (_result) ) \
|
||||
: (0) )
|
||||
|
||||
#define localtime_r( _clock, _result ) \
|
||||
( *(_result) = *localtime( (_clock) ), \
|
||||
(_result) )
|
||||
( localtime( (_clock) ) \
|
||||
? (*(_result) = *localtime( (_clock) ), (_result) ) \
|
||||
: (0) )
|
||||
|
||||
#define rand_r( _seed ) \
|
||||
( _seed == _seed? rand() : rand() )
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
#define PTW32_LEVEL_MAX 3
|
||||
|
||||
#if !defined(PTW32_LEVEL)
|
||||
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
|
||||
#define PTW32_LEVEL PTW32_LEVEL_MAX
|
||||
/* Include everything */
|
||||
#endif
|
||||
|
@ -114,12 +114,14 @@
|
|||
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
|
||||
|
||||
#if defined(__MINGW32__) || defined(_UWIN)
|
||||
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
|
||||
# if PTW32_LEVEL >= PTW32_LEVEL_MAX
|
||||
/* For pid_t */
|
||||
# include <sys/types.h>
|
||||
/* Required by Unix 98 */
|
||||
# include <time.h>
|
||||
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
|
||||
# else
|
||||
typedef int pid_t;
|
||||
# endif
|
||||
#else
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
|
|
8
windows/scripts/amd64/Cygwin.bat
Executable file
8
windows/scripts/amd64/Cygwin.bat
Executable file
|
@ -0,0 +1,8 @@
|
|||
@echo off
|
||||
|
||||
call "C:\Program Files (x86)\Intel\Compiler\C++\10.1.032\EM64T\Bin\ICLVars.bat"
|
||||
C:
|
||||
chdir C:\cygwin\bin
|
||||
|
||||
bash --login -i %*
|
||||
|
68
windows/scripts/install_amd64.sh
Executable file
68
windows/scripts/install_amd64.sh
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
#Install BDB
|
||||
echo Installing BDB if necessary ...
|
||||
if ! test -d /usr/local/BerkeleyDB.4.6 ; then
|
||||
(
|
||||
echo "BDB is missing. Downloading from svn" &&
|
||||
cd /usr/local &&
|
||||
svn co -q https://svn.tokutek.com/tokudb/berkeleydb/windows/amd64/BerkeleyDB.4.6
|
||||
) || { echo Failed; exit 1; }
|
||||
fi
|
||||
if ! grep 'export BDB=' ~/.bashrc > /dev/null; then
|
||||
echo "Adding 'export BDB=/usr/local/BerkeleyDB.4.6' to ~/.bashrc"
|
||||
echo 'export BDB=/usr/local/BerkeleyDB.4.6' >> ~/.bashrc
|
||||
fi
|
||||
if ! grep 'export BDBDIR=' ~/.bashrc > /dev/null; then
|
||||
echo "Adding 'export BDBDIR=C:/cygwin/usr/local/BerkeleyDB.4.6'' to ~/.bashrc"
|
||||
echo 'export BDBDIR=C:/cygwin/usr/local/BerkeleyDB.4.6' >> ~/.bashrc
|
||||
fi
|
||||
echo Done installing BDB.
|
||||
echo
|
||||
|
||||
|
||||
#Install licenses.
|
||||
if ! test -e ../licenses/install_licenses_amd64.bat; then
|
||||
echo Missing ../licenses directory.
|
||||
exit 1
|
||||
fi
|
||||
echo Installing licenses...
|
||||
(cd ../licenses && cmd /c install_licenses_amd64.bat)
|
||||
echo Done installing licenses.
|
||||
echo
|
||||
|
||||
|
||||
#install icc integration
|
||||
(
|
||||
cd amd64 &&
|
||||
if ! diff -q Cygwin.bat /cygdrive/c/cygwin/Cygwin.bat > /dev/null; then
|
||||
cp Cygwin.bat /cygdrive/c/cygwin/
|
||||
fi
|
||||
)
|
||||
if ! grep 'export CC=' ~/.bashrc > /dev/null; then
|
||||
echo "Adding 'export CC=icc' to ~/.bashrc"
|
||||
echo 'export CC=icc' >> ~/.bashrc
|
||||
fi
|
||||
if ! grep 'export CYGWIN=' ~/.bashrc > /dev/null; then
|
||||
echo "Adding 'export CYGWIN=CYGWIN' to ~/.bashrc"
|
||||
echo 'export CYGWIN=CYGWIN' >> ~/.bashrc
|
||||
fi
|
||||
|
||||
#cygwin link is in the way
|
||||
if test -e /usr/bin/link; then
|
||||
mv /usr/bin/link /usr/bin/link_DISABLED
|
||||
fi
|
||||
#cygwin cmake is in the way
|
||||
if test -e /usr/bin/cmake; then
|
||||
mv /usr/bin/cmake /usr/bin/cmake_DISABLED
|
||||
fi
|
||||
|
||||
#Set up aliases
|
||||
( cd amd64/symlinks && cp -d * /usr/local/bin/ )
|
||||
|
||||
echo You can now install the intel compiler.
|
||||
echo You must restart cygwin after intel compiler is installed.
|
||||
echo If the intel compiler is already installed, just restart cygwin.
|
||||
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
mkdir -p /usr/local/BerkeleyDB.$1/bin
|
||||
mkdir -p /usr/local/BerkeleyDB.$1/lib
|
||||
ln -s /usr/bin/db$1_load.exe /usr/local/BerkeleyDB.$1/bin/db_load
|
||||
ln -s /usr/bin/db$1_dump.exe /usr/local/BerkeleyDB.$1/bin/db_dump
|
||||
ln -s /usr/include/db /usr/local/BerkeleyDB.$1/include
|
||||
ln -s /usr/lib/libdb-.a /usr/local/BerkeleyDB.$1/lib/libdb.a
|
||||
ln -s /usr/lib/libdb-.dll.a /usr/local/BerkeleyDB.$1/lib/libdb.dll.a
|
||||
ln -s /usr/lib/libdb-.la /usr/local/BerkeleyDB.$1/lib/libdb.la
|
||||
ln -s /usr/lib/libdb_cxx-.la /usr/local/BerkeleyDB.$1/lib/libdb_cxx.la
|
||||
ln -s /usr/lib/libdb_cxx-.a /usr/local/BerkeleyDB.$1/lib/libdb_cxx.a
|
||||
ln -s /usr/lib/libdb_cxx-.dll.a /usr/local/BerkeleyDB.$1/lib/libdb_cxx.dll.a
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
* Module: semaphore.h
|
||||
*
|
||||
* Purpose:
|
||||
* Semaphores aren't actually part of the PThreads standard.
|
||||
* They are defined by the POSIX Standard:
|
||||
*
|
||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
||||
*
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Pthreads-win32 - POSIX Threads Library for Win32
|
||||
* Copyright(C) 1998 John E. Bossom
|
||||
* Copyright(C) 1999,2005 Pthreads-win32 contributors
|
||||
*
|
||||
* Contact Email: rpj@callisto.canberra.edu.au
|
||||
*
|
||||
* The current list of contributors is contained
|
||||
* in the file CONTRIBUTORS included with the source
|
||||
* code distribution. The list can also be seen at the
|
||||
* following World Wide Web location:
|
||||
* http://sources.redhat.com/pthreads-win32/contributors.html
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library in the file COPYING.LIB;
|
||||
* if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined( SEMAPHORE_H )
|
||||
#define SEMAPHORE_H
|
||||
|
||||
#undef PTW32_LEVEL
|
||||
|
||||
#if defined(_POSIX_SOURCE)
|
||||
#define PTW32_LEVEL 0
|
||||
/* Early POSIX */
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
|
||||
#undef PTW32_LEVEL
|
||||
#define PTW32_LEVEL 1
|
||||
/* Include 1b, 1c and 1d */
|
||||
#endif
|
||||
|
||||
#if defined(INCLUDE_NP)
|
||||
#undef PTW32_LEVEL
|
||||
#define PTW32_LEVEL 2
|
||||
/* Include Non-Portable extensions */
|
||||
#endif
|
||||
|
||||
#define PTW32_LEVEL_MAX 3
|
||||
|
||||
#if !defined(PTW32_LEVEL)
|
||||
#define PTW32_LEVEL PTW32_LEVEL_MAX
|
||||
/* Include everything */
|
||||
#endif
|
||||
|
||||
#if __GNUC__ && ! defined (__declspec)
|
||||
# error Please upgrade your GNU compiler to one that supports __declspec.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When building the DLL code, you should define PTW32_BUILD so that
|
||||
* the variables/functions are exported correctly. When using the DLL,
|
||||
* do NOT define PTW32_BUILD, and then the variables/functions will
|
||||
* be imported correctly.
|
||||
*/
|
||||
#ifndef PTW32_STATIC_LIB
|
||||
# ifdef PTW32_BUILD
|
||||
# define PTW32_DLLPORT __declspec (dllexport)
|
||||
# else
|
||||
# define PTW32_DLLPORT __declspec (dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define PTW32_DLLPORT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is a duplicate of what is in the autoconf config.h,
|
||||
* which is only used when building the pthread-win32 libraries.
|
||||
*/
|
||||
|
||||
#ifndef PTW32_CONFIG_H
|
||||
# if defined(WINCE)
|
||||
# define NEED_ERRNO
|
||||
# define NEED_SEM
|
||||
# endif
|
||||
# if defined(_UWIN) || defined(__MINGW32__)
|
||||
# define HAVE_MODE_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
|
||||
#ifdef NEED_ERRNO
|
||||
#include "need_errno.h"
|
||||
#else
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
|
||||
|
||||
#define _POSIX_SEMAPHORES
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef HAVE_MODE_T
|
||||
typedef unsigned int mode_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct sem_t_ * sem_t;
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
|
||||
int pshared,
|
||||
unsigned int value);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
|
||||
const struct timespec * abstime);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
|
||||
int count);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_open (const char * name,
|
||||
int oflag,
|
||||
mode_t mode,
|
||||
unsigned int value);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
|
||||
int * sval);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#undef PTW32_LEVEL
|
||||
#undef PTW32_LEVEL_MAX
|
||||
|
||||
#endif /* !SEMAPHORE_H */
|
|
@ -24,9 +24,9 @@ check: $(BINS) $(RUNTARGETS);
|
|||
%.tdbrun: %$(BINSUF) $(PTHREAD_LOCAL)
|
||||
mkdir -p dir.$*
|
||||
ifeq ($(VGRIND),)
|
||||
cd dir.$* && ../$< $(SUMMARIZE_CMD)
|
||||
cd dir.$* && ../$< $(VERBVERBOSE) $(SUMMARIZE_CMD)
|
||||
else
|
||||
cd dir.$* && .$(VGRIND) --log-file=$<.valgrind ../$<; \
|
||||
cd dir.$* && .$(VGRIND) --log-file=$<.valgrind ../$< $(VERBVERBOSE); \
|
||||
if [ $$? = 0 ] ; then \
|
||||
grep "LEAK SUMMARY" dir.$*/$<.valgrind >/dev/null 2>&1; \
|
||||
if [ $$? = 0 ] ; then cat dir.$*/$<.valgrind; test 0 = 1; fi \
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if 0 && defined _WIN32
|
||||
#if 0 && TOKU_WINDOWS
|
||||
#include <windows.h>
|
||||
static int ftruncate(int fd, uint64_t offset) {
|
||||
HANDLE h = (HANDLE) _get_osfhandle(fd);
|
||||
|
@ -38,8 +38,7 @@ int test_main(int argc, char *argv[]) {
|
|||
for (i=0; i<32; i++) {
|
||||
char junk[4096];
|
||||
memset(junk, 0, sizeof junk);
|
||||
r = write(fd, junk, sizeof junk);
|
||||
assert(r == sizeof junk);
|
||||
toku_os_full_write(fd, junk, sizeof junk);
|
||||
}
|
||||
|
||||
toku_struct_stat filestat;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <toku_assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
#if TOKU_WINDOWS
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
@ -37,7 +37,7 @@ int test_main(int argc, char *argv[]) {
|
|||
r = close(fd);
|
||||
assert(r == 0);
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
#if TOKU_WINDOWS
|
||||
assert(r == -1);
|
||||
|
||||
r = close(fd);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <toku_assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
#if TOKU_WINDOWS
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
@ -35,7 +35,7 @@ int test_main(int argc, char *argv[]) {
|
|||
r = close(fd);
|
||||
assert(r == 0);
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
#if TOKU_WINDOWS
|
||||
assert(r == -1);
|
||||
|
||||
r = close(fd);
|
||||
|
|
|
@ -33,7 +33,7 @@ int test_main(int argc, char *argv[]) {
|
|||
|
||||
WSAStartup(MAKEWORD(1, 0), &wsadata);
|
||||
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
printf("s=%u\n", s);
|
||||
printf("s=%"PRIu64"\n", s);
|
||||
|
||||
for (i=0; i<1000; i++) {
|
||||
if (verbose) {
|
||||
|
|
|
@ -4,9 +4,11 @@ int test_main(int argc, char *argv[]);
|
|||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
toku_portability_init();
|
||||
int ri = toku_portability_init();
|
||||
assert(ri==0);
|
||||
int r = test_main(argc, argv);
|
||||
toku_portability_destroy();
|
||||
int rd = toku_portability_destroy();
|
||||
assert(rd==0);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _TOKU_HTONL_H
|
||||
#define _TOKU_HTONL_H
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if !TOKU_WINDOWS
|
||||
#error
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
static int
|
||||
toku_malloc_init(void) {
|
||||
int r = 0;
|
||||
#if defined(_WIN32)
|
||||
//Set the heap (malloc/free/realloc) to use the low fragmentation mode.
|
||||
ULONG HeapFragValue = 2;
|
||||
|
||||
|
@ -34,6 +35,7 @@ toku_malloc_init(void) {
|
|||
//if (success==0) //Do some error output if necessary.
|
||||
if (!success)
|
||||
r = GetLastError();
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -174,19 +176,18 @@ toku_os_gettid(void) {
|
|||
|
||||
int
|
||||
toku_os_get_max_process_data_size(uint64_t *maxdata) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
// the process gets 1/2 of the 32 bit address space.
|
||||
// we are ignoring the 3GB feature for now.
|
||||
*maxdata = 1ULL << 31;
|
||||
return 0;
|
||||
#else
|
||||
#ifdef _WIN64
|
||||
#elif defined(_WIN64)
|
||||
*maxdata = ~0ULL;
|
||||
return 0;
|
||||
#else
|
||||
#error
|
||||
return EINVAL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue