Commit c1c86995 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

closes #5120 remove TOKU_ALLOW_DEPRECATED, reorganize some headers a bit to accomodate

git-svn-id: file:///svn/toku/tokudb@50922 c7de825b-a66e-492c-adef-691d508d4ae1
parent 491c2460
......@@ -4,8 +4,6 @@ endfunction(add_c_defines)
if (APPLE)
add_c_defines(DARWIN=1 _DARWIN_C_SOURCE)
message(WARNING "Setting TOKU_ALLOW_DEPRECATED on Darwin and with clang. TODO: find a portable way to deprecate, and remove this.")
add_c_defines(TOKU_ALLOW_DEPRECATED)
endif ()
## preprocessor definitions we want everywhere
......
......@@ -12,8 +12,6 @@
* The struct definitions.
* The Latex documentation.
*/
#include <toku_portability.h>
#include <toku_assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
......@@ -23,6 +21,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <toku_portability.h>
#include <toku_assert.h>
typedef struct field {
......
......@@ -6,8 +6,9 @@ set(tokuportability_srcs
os_malloc
portability
toku_assert
toku_pthread
toku_fair_rwlock
toku_pthread
toku_time
)
add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs})
......
......@@ -30,19 +30,20 @@
// During unpin: It grabs the mutex, unlocks the rwlock lock in the pair, and releases the mutex.
// Both actions must acquire a cachetable lock during that time, so definitely saves time to do it that way.
#include <toku_pthread.h>
#include <toku_portability.h>
#include <toku_time.h>
#include <toku_assert.h>
#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <toku_pthread.h>
#include <toku_portability.h>
#include <toku_time.h>
#include <toku_assert.h>
#include <util/rwlock.h>
#include <util/frwlock.h>
#include <portability/toku_atomic.h>
#include "toku_fair_rwlock.h"
#include <sys/types.h>
#include "rwlock_condvar.h"
......
......@@ -5,9 +5,9 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
// use strace to very that the toku_fsync_directory function works
#include "test.h"
#include <stdlib.h>
#include <string.h>
#include "test.h"
static int verbose = 0;
......
......@@ -3,12 +3,12 @@
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "test.h"
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "test.h"
#include "toku_time.h"
......
......@@ -3,13 +3,13 @@
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <test.h>
#include <toku_assert.h>
#include <toku_pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <memory.h>
#include <toku_assert.h>
#include <toku_pthread.h>
#include "test.h"
int test_main(int argc __attribute__((__unused__)), char *const argv[] __attribute__((__unused__))) {
toku_pthread_rwlock_t rwlock;
......
......@@ -3,13 +3,13 @@
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <toku_portability.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <toku_assert.h>
#include <sys/stat.h>
#include <errno.h>
#include <toku_assert.h>
#include <toku_portability.h>
static void test_stat(const char *dirname, int result, int ex_errno) {
int r;
......
......@@ -9,40 +9,23 @@
#include "config.h"
#include <time.h>
#include <sys/time.h>
#include <stdint.h>
static inline float toku_tdiff (struct timeval *a, struct timeval *b) {
return (float)((a->tv_sec - b->tv_sec) + 1e-6 * (a->tv_usec - b->tv_usec));
}
#if !defined(HAVE_CLOCK_REALTIME) // OS X does not have clock_gettime, use clock_get_time
# include <errno.h>
# include <mach/clock.h>
# include <mach/mach.h>
typedef int clockid_t;
# define CLOCK_REALTIME 0x01867234 // just something bogus, it doesn't matter
#endif
static inline int
toku_clock_gettime(clockid_t clk_id, struct timespec *ts)
{
#if !defined(HAVE_CLOCK_REALTIME)
if (clk_id != CLOCK_REALTIME) {
// dunno how to fake any of the other ones on osx
return EINVAL;
}
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
return 0;
#else
return clock_gettime(clk_id, ts);
// OS X does not have clock_gettime, we fake clockid_t for the interface, and we'll implement it with clock_get_time.
typedef int clockid_t;
// just something bogus, it doesn't matter, we just want to make sure we're
// only supporting this mode because we're not sure we can support other modes
// without a real clock_gettime()
#define CLOCK_REALTIME 0x01867234
#endif
}
int
toku_clock_gettime(clockid_t clk_id, struct timespec *ts);
// *************** Performance timers ************************
// What do you really want from a performance timer:
......
......@@ -169,7 +169,7 @@ int creat(const char *pathname, mode_t mode) __attribute__((__deprecated_
int fstat(int fd, struct stat *buf) __attribute__((__deprecated__));
int stat(const char *path, struct stat *buf) __attribute__((__deprecated__));
int getpid(void) __attribute__((__deprecated__));
# if defined(__FreeBSD__)
# if defined(__FreeBSD__) || defined(__APPLE__)
int syscall(int __sysno, ...) __attribute__((__deprecated__));
# else
long int syscall(long int __sysno, ...) __attribute__((__deprecated__));
......@@ -183,6 +183,8 @@ int _dup2(int fd, int fd2) __attribute__((__deprecated_
#undef strdup
# if defined(__FreeBSD__)
char* strdup(const char *) __malloc_like __attribute__((__deprecated__));
# elif defined(__APPLE__)
char* strdup(const char *) __attribute__((__deprecated__));
# else
char* strdup(const char *) __THROW __attribute_malloc__ __nonnull ((1)) __attribute__((__deprecated__));
# endif
......@@ -197,6 +199,10 @@ ssize_t pwrite(int, const void *, size_t, off_t) __attribute__((__deprecated_
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__)
extern void *malloc(size_t) __attribute__((__deprecated__));
extern void free(void*) __attribute__((__deprecated__));
extern void *realloc(void*, size_t) __attribute__((__deprecated__));
# else
extern void *malloc(size_t) __THROW __attribute__((__deprecated__));
extern void free(void*) __THROW __attribute__((__deprecated__));
......@@ -206,13 +212,16 @@ extern void *realloc(void*, size_t) __THROW __attribute__((__deprecat
# ifndef DONT_DEPRECATE_ERRNO
//extern int errno __attribute__((__deprecated__));
# endif
#pragma GCC poison u_int8_t
#pragma GCC poison u_int16_t
#pragma GCC poison u_int32_t
#pragma GCC poison u_int64_t
#pragma GCC poison BOOL
#pragma GCC poison FALSE
#pragma GCC poison TRUE
#if !defined(__APPLE__)
// Darwin headers use these types, we should not poison them
# pragma GCC poison u_int8_t
# pragma GCC poison u_int16_t
# pragma GCC poison u_int32_t
# pragma GCC poison u_int64_t
# pragma GCC poison BOOL
# pragma GCC poison FALSE
# pragma GCC poison TRUE
#endif
#pragma GCC poison __sync_fetch_and_add
#pragma GCC poison __sync_fetch_and_sub
#pragma GCC poison __sync_fetch_and_or
......
......@@ -8,9 +8,9 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <stdint.h>
#include <memory.h>
#include <toku_portability.h>
#include <toku_race_tools.h>
#include <memory.h>
#include "growable_array.h"
namespace toku {
......
......@@ -6,10 +6,10 @@
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <type_traits>
#include <memory.h>
#include <toku_portability.h>
#include <toku_assert.h>
#include <toku_time.h>
#include <memory.h>
#include <util/omt.h>
namespace toku {
......
......@@ -3,13 +3,13 @@
#ident "$Id: test-rwlock.cc 46971 2012-08-18 22:03:43Z zardosht $"
#ident "Copyright (c) 2010 Tokutek Inc. All rights reserved."
#include <toku_portability.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <toku_portability.h>
#include <toku_assert.h>
#include <portability/toku_fair_rwlock.h>
#include <portability/toku_pthread.h>
......
......@@ -29,13 +29,13 @@
// During unpin: It grabs the mutex, unlocks the rwlock lock in the pair, and releases the mutex.
// Both actions must acquire a cachetable lock during that time, so definitely saves time to do it that way.
#include <toku_portability.h>
#include <errno.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <toku_portability.h>
#include <toku_assert.h>
#include <portability/toku_atomic.h>
#include <portability/toku_fair_rwlock.h>
......
......@@ -4,11 +4,11 @@
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <stdlib.h>
#include <toku_portability.h>
#include <toku_assert.h>
#include <util/partitioned_counter.h>
#include <string.h>
#include <stdlib.h>
#define CKERR(r) ({ int __r = r; if (__r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, __r, strerror(r)); assert(__r==0); })
#define CKERR2(r,r2) do { if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); } while (0)
......
......@@ -4,12 +4,12 @@
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <memory.h>
#include <toku_portability.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <memory.h>
#include <toku_assert.h>
#include <toku_list.h>
#include <portability/toku_pthread.h>
......
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