-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial set of patches for TokuDB engine build.
- Loading branch information
Filip Hajny
committed
May 26, 2015
1 parent
d183fba
commit 450762b
Showing
9 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
mariadb10-client/patches/patch-storage_tokudb_CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/CMakeLists.txt.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/CMakeLists.txt | ||
@@ -1,5 +1,5 @@ | ||
# ft-index only supports x86-64 and cmake-2.8.9+ | ||
-IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND | ||
+IF( | ||
NOT CMAKE_VERSION VERSION_LESS "2.8.9") | ||
CHECK_CXX_SOURCE_COMPILES( | ||
" |
14 changes: 14 additions & 0 deletions
14
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_file.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/file.cc.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/file.cc | ||
@@ -373,6 +373,9 @@ toku_os_open_direct(const char *path, in | ||
perror("setting F_NOCACHE"); | ||
} | ||
} | ||
+#elif defined(__sun) | ||
+ rval = toku_os_open(path, oflag, mode); | ||
+ directio(rval, DIRECTIO_ON); | ||
#else | ||
# error "No direct I/O implementation found." | ||
#endif |
60 changes: 60 additions & 0 deletions
60
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_portability.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/portability.cc.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/portability.cc | ||
@@ -130,6 +130,9 @@ PATENT RIGHTS GRANT: | ||
#include "memory.h" | ||
#include <portability/toku_atomic.h> | ||
#include <util/partitioned_counter.h> | ||
+#if defined(__sun) | ||
+#include <thread.h> | ||
+#endif | ||
|
||
int | ||
toku_portability_init(void) { | ||
@@ -160,6 +163,8 @@ toku_os_gettid(void) { | ||
return syscall(SYS_gettid); | ||
#elif defined(HAVE_PTHREAD_GETTHREADID_NP) | ||
return pthread_getthreadid_np(); | ||
+#elif defined(__sun) | ||
+ return thr_self(); | ||
#else | ||
# error "no implementation of gettid available" | ||
#endif | ||
@@ -244,7 +249,18 @@ toku_os_lock_file(const char *name) { | ||
int r; | ||
int fd = open(name, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR); | ||
if (fd>=0) { | ||
+#if defined(__sun) | ||
+ struct flock lock; | ||
+ | ||
+ lock.l_start = 0; | ||
+ lock.l_len = 0; | ||
+ lock.l_type = F_WRLCK; | ||
+ lock.l_whence = SEEK_SET; | ||
+ | ||
+ r = fcntl(fd, F_SETLK, &lock); | ||
+#else | ||
r = flock(fd, LOCK_EX | LOCK_NB); | ||
+#endif | ||
if (r!=0) { | ||
r = errno; //Save errno from flock. | ||
close(fd); | ||
@@ -257,7 +273,17 @@ toku_os_lock_file(const char *name) { | ||
|
||
int | ||
toku_os_unlock_file(int fildes) { | ||
+#if defined(__sun) | ||
+ struct flock lock; | ||
+ | ||
+ lock.l_start = 0; | ||
+ lock.l_len = 0; | ||
+ lock.l_type = F_WRLCK; | ||
+ lock.l_whence = SEEK_SET; | ||
+ int r = fcntl(fildes, F_SETLK, &lock); | ||
+#else | ||
int r = flock(fildes, LOCK_UN); | ||
+#endif | ||
if (r==0) r = close(fildes); | ||
return r; | ||
} |
20 changes: 20 additions & 0 deletions
20
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_toku__htod.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/toku_htod.h.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/toku_htod.h | ||
@@ -116,6 +116,15 @@ PATENT RIGHTS GRANT: | ||
# define __BYTE_ORDER __DARWIN_BYTE_ORDER | ||
# define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN | ||
# define __BIG_ENDIAN __DARWIN_BIG_ENDIAN | ||
+#elif defined(__sun) | ||
+# include <sys/isa_defs.h> | ||
+# define __BIG_ENDIAN 4321 | ||
+# define __LITTLE_ENDIAN 1234 | ||
+# if defined(_BIG_ENDIAN) | ||
+# define __BYTE_ORDER __BIG_ENDIAN | ||
+# else | ||
+# define __BYTE_ORDER __LITTLE_ENDIAN | ||
+# endif | ||
#endif | ||
#if !defined(__BYTE_ORDER) || \ | ||
!defined(__LITTLE_ENDIAN) || \ |
22 changes: 22 additions & 0 deletions
22
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_toku__portability.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/toku_portability.h.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/toku_portability.h | ||
@@ -200,7 +200,7 @@ int _dup2(int fd, int fd2) | ||
#undef strdup | ||
# if defined(__FreeBSD__) | ||
char* strdup(const char *) __malloc_like __attribute__((__deprecated__)); | ||
-# elif defined(__APPLE__) | ||
+# elif defined(__APPLE__) || defined(__sun) | ||
char* strdup(const char *) __attribute__((__deprecated__)); | ||
# else | ||
char* strdup(const char *) __THROW __attribute_malloc__ __nonnull ((1)) __attribute__((__deprecated__)); | ||
@@ -216,7 +216,7 @@ ssize_t pwrite(int, const void *, size_ | ||
extern void *malloc(size_t) __malloc_like __attribute__((__deprecated__)); | ||
extern void free(void*) __attribute__((__deprecated__)); | ||
extern void *realloc(void*, size_t) __malloc_like __attribute__((__deprecated__)); | ||
-# elif defined(__APPLE__) | ||
+# elif defined(__APPLE__) || defined(__sun) | ||
extern void *malloc(size_t) __attribute__((__deprecated__)); | ||
extern void free(void*) __attribute__((__deprecated__)); | ||
extern void *realloc(void*, size_t) __attribute__((__deprecated__)); |
24 changes: 24 additions & 0 deletions
24
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/toku_pthread.cc.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/toku_pthread.cc | ||
@@ -92,6 +92,10 @@ PATENT RIGHTS GRANT: | ||
#include <portability/toku_config.h> | ||
#include <toku_pthread.h> | ||
|
||
+#if defined(__sun) | ||
+#include <sched.h> // for sched_yield() | ||
+#endif | ||
+ | ||
int toku_pthread_yield(void) { | ||
#if defined(HAVE_PTHREAD_YIELD) | ||
# if defined(PTHREAD_YIELD_RETURNS_INT) | ||
@@ -105,6 +109,8 @@ int toku_pthread_yield(void) { | ||
#elif defined(HAVE_PTHREAD_YIELD_NP) | ||
pthread_yield_np(); | ||
return 0; | ||
+#elif defined(__sun) | ||
+ return sched_yield(); | ||
#else | ||
# error "cannot find pthread_yield or pthread_yield_np" | ||
#endif |
13 changes: 13 additions & 0 deletions
13
mariadb10-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$NetBSD$ | ||
|
||
--- storage/tokudb/ft-index/portability/toku_pthread.h.orig 2015-02-25 15:40:56.000000000 +0000 | ||
+++ storage/tokudb/ft-index/portability/toku_pthread.h | ||
@@ -142,7 +142,7 @@ typedef struct toku_mutex_aligned { | ||
#endif | ||
// Darwin doesn't provide adaptive mutexes | ||
-#if defined(__APPLE__) | ||
+#if defined(__APPLE__) || defined(__sun) | ||
# define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT | ||
# if TOKU_PTHREAD_DEBUG | ||
# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters