diff --git a/cmake/define.inc b/cmake/define.inc index 4115dd0c4143535130b1bf8a132ee400d828d87d..52b0ead1a5309047e4649c3cf1e56881ef061196 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -138,7 +138,7 @@ IF (TD_DARWIN_64) ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT) ADD_DEFINITIONS(-DUSE_LIBICONV) MESSAGE(STATUS "darwin64 is defined") - SET(COMMON_FLAGS "-Wall -Werror -Wno-missing-braces -fPIC -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") + SET(COMMON_FLAGS "-Wall -Werror -Wno-missing-braces -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG") SET(RELEASE_FLAGS "-Og") INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc) diff --git a/src/os/inc/osSemphone.h b/src/os/inc/osSemphone.h index 2e2d432607bdc96de63edf5993345f9780452c1f..fe59095205010bef553413809706c62cd772a7e3 100644 --- a/src/os/inc/osSemphone.h +++ b/src/os/inc/osSemphone.h @@ -29,7 +29,7 @@ extern "C" { #else #define tsem_t sem_t #define tsem_init sem_init - int32_t tsem_wait(tsem_t* sem); + int tsem_wait(tsem_t* sem); #define tsem_post sem_post #define tsem_destroy sem_destroy #endif diff --git a/src/os/src/darwin/dwEok.c b/src/os/src/darwin/dwEok.c index c8e270214f0e876bc919ecee2951dc156ed8a4c4..22d92607635ab81793dd7c7d7e2303a8a9d76477 100644 --- a/src/os/src/darwin/dwEok.c +++ b/src/os/src/darwin/dwEok.c @@ -18,9 +18,9 @@ // https://stackoverflow.com/questions/4393197/erlangs-let-it-crash-philosophy-applicable-elsewhere // experimentally, we follow log-and-crash here -#include "osEok.h" - +#define _DEFAULT_SOURCE #include "os.h" +#include "osEok.h" #include diff --git a/src/os/src/darwin/dwSemphone.c b/src/os/src/darwin/dwSemphone.c index 317611fa30c91348bcec3903e1b7e6f8928b0d15..898410647ad6e23428656f6f820504126268af07 100644 --- a/src/os/src/darwin/dwSemphone.c +++ b/src/os/src/darwin/dwSemphone.c @@ -20,8 +20,6 @@ #define _DEFAULT_SOURCE #include "os.h" -#include - #include // #define SEM_USE_PTHREAD @@ -38,7 +36,7 @@ static pthread_t sem_thread; static pthread_once_t sem_once; static task_t sem_port; -static volatile int32_t sem_inited = 0; +static volatile int sem_inited = 0; static semaphore_t sem_exit; static void* sem_thread_routine(void *arg) { @@ -56,7 +54,7 @@ static void* sem_thread_routine(void *arg) { } static void once_init(void) { - int32_t r = 0; + int r = 0; r = pthread_create(&sem_thread, NULL, sem_thread_routine, NULL); if (r) { fprintf(stderr, "==%s[%d]%s()==failed to create thread\n", basename(__FILE__), __LINE__, __func__); @@ -82,10 +80,10 @@ struct tsem_s { dispatch_semaphore_t sem; #endif // SEM_USE_PTHREAD - volatile unsigned int32_t valid:1; + volatile unsigned int valid:1; }; -int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) { +int tsem_init(tsem_t *sem, int pshared, unsigned int value) { // fprintf(stderr, "==%s[%d]%s():[%p]==creating\n", basename(__FILE__), __LINE__, __func__, sem); if (*sem) { fprintf(stderr, "==%s[%d]%s():[%p]==already initialized\n", basename(__FILE__), __LINE__, __func__, sem); @@ -98,7 +96,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) { } #ifdef SEM_USE_PTHREAD - int32_t r = pthread_mutex_init(&p->lock, NULL); + int r = pthread_mutex_init(&p->lock, NULL); do { if (r) break; r = pthread_cond_init(&p->cond, NULL); @@ -125,7 +123,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) { p->sem = sem_open(name, O_CREAT|O_EXCL, pshared, value); p->id = id; if (p->sem!=SEM_FAILED) break; - int32_t e = errno; + int e = errno; if (e==EEXIST) continue; if (e==EINTR) continue; fprintf(stderr, "==%s[%d]%s():[%p]==not created[%d]%s\n", basename(__FILE__), __LINE__, __func__, sem, e, strerror(e)); @@ -159,7 +157,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) { return 0; } -int32_t tsem_wait(tsem_t *sem) { +int tsem_wait(tsem_t *sem) { if (!*sem) { fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem); abort(); @@ -195,7 +193,7 @@ int32_t tsem_wait(tsem_t *sem) { #endif // SEM_USE_PTHREAD } -int32_t tsem_post(tsem_t *sem) { +int tsem_post(tsem_t *sem) { if (!*sem) { fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem); abort(); @@ -231,7 +229,7 @@ int32_t tsem_post(tsem_t *sem) { #endif // SEM_USE_PTHREAD } -int32_t tsem_destroy(tsem_t *sem) { +int tsem_destroy(tsem_t *sem) { // fprintf(stderr, "==%s[%d]%s():[%p]==destroying\n", basename(__FILE__), __LINE__, __func__, sem); if (!*sem) { // fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem); @@ -265,9 +263,9 @@ int32_t tsem_destroy(tsem_t *sem) { #elif defined(SEM_USE_POSIX) char name[NAME_MAX-4]; snprintf(name, sizeof(name), "/t%ld", p->id); - int32_t r = sem_unlink(name); + int r = sem_unlink(name); if (r) { - int32_t e = errno; + int e = errno; fprintf(stderr, "==%s[%d]%s():[%p]==unlink failed[%d]%s\n", basename(__FILE__), __LINE__, __func__, sem, e, strerror(e)); abort(); } @@ -285,7 +283,7 @@ int32_t tsem_destroy(tsem_t *sem) { bool taosCheckPthreadValid(pthread_t thread) { uint64_t id = 0; - int32_t r = pthread_threadid_np(thread, &id); + int r = pthread_threadid_np(thread, &id); return r ? false : true; } diff --git a/src/os/src/darwin/dwSysInfo.c b/src/os/src/darwin/dwSysInfo.c index 6e70043779d01be361f66a67b16608b56a9285ed..b3c9bd528e9459a8d5798a2ff6ca4a1664503a90 100644 --- a/src/os/src/darwin/dwSysInfo.c +++ b/src/os/src/darwin/dwSysInfo.c @@ -22,7 +22,6 @@ #include #include - static void taosGetSystemTimezone() { SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone"); if (cfg_timezone == NULL) return; diff --git a/src/os/src/detail/osTimer.c b/src/os/src/detail/osTimer.c index 6ce1b73703abc74ad8f3563ff70db2b09585870a..b054f08c7842ed405f818b26be6040c543fa7644 100644 --- a/src/os/src/detail/osTimer.c +++ b/src/os/src/detail/osTimer.c @@ -18,7 +18,7 @@ #include "ttimer.h" #include "tulog.h" -#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)) +#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) || defined(_TD_DARWIN_64)) static void taosDeleteTimer(void *tharg) { timer_t *pTimer = tharg;