未验证 提交 23bef711 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Feature/sangshuduo/td 13063 3.0 windows (#10720)

* [TD-13063]<feature>: 3.0 on Windows

* add pthread in contrib

* fix linux compile

* fix osSemaphore

* add gnu regex for Windows

* fix compile error for Windows

* support arm platform

* port more OS files

* fix for Windows compile

* port more files

* fix macOS on x86_64

* port osFile

* port osSemaphone.h

* port osSocket.c

* port tconfig.c

* port ttimer.c

* add couple files
上级 7f9521b3
...@@ -60,8 +60,9 @@ def pre_test(){ ...@@ -60,8 +60,9 @@ def pre_test(){
sh ''' sh '''
cd ${WKC} cd ${WKC}
git checkout 3.0 git checkout 3.0
[ -d contrib/bdb ] && cd contrib/bdb && git clean -fxd && cd ../..
''' '''
} }
else{ else{
sh ''' sh '''
cd ${WKC} cd ${WKC}
......
...@@ -36,7 +36,14 @@ IF (TD_WINDOWS) ...@@ -36,7 +36,14 @@ IF (TD_WINDOWS)
ENDIF () ENDIF ()
ELSE () ELSE ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -fPIC -gdwarf-2 -msse4.2 -mfma -g3") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -fPIC -gdwarf-2 -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fPIC -gdwarf-2 -msse4.2 -mfma -g3") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fPIC -gdwarf-2 -g3")
MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
ADD_DEFINITIONS("-D_TD_ARM_")
ELSE ()
ADD_DEFINITIONS("-msse4.2 -mfma")
ENDIF ()
ENDIF () ENDIF ()
...@@ -7,30 +7,52 @@ SET(TD_LINUX FALSE) ...@@ -7,30 +7,52 @@ SET(TD_LINUX FALSE)
SET(TD_WINDOWS FALSE) SET(TD_WINDOWS FALSE)
SET(TD_DARWIN FALSE) SET(TD_DARWIN FALSE)
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") MESSAGE("Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
if(CMAKE_COMPILER_IS_GNUCXX MATCHES 1)
set(CXX_COMPILER_IS_GNU TRUE)
else()
set(CXX_COMPILER_IS_GNU FALSE)
endif()
SET(TD_LINUX TRUE) MESSAGE("Current system name is ${CMAKE_SYSTEM_NAME}.")
SET(OSTYPE "Linux")
ADD_DEFINITIONS("-DLINUX")
IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8) IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(TD_LINUX_64 TRUE)
IF (${CXX_COMPILER_IS_GNU})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
ELSE () ELSE ()
SET(TD_LINUX_32 TRUE) ADD_DEFINITIONS("-Wno-tautological-constant-out-of-range-compare -Wno-pointer-sign -Wno-unknown-warning-option")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
ENDIF () ENDIF ()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(TD_DARWIN TRUE) SET(TD_LINUX TRUE)
SET(OSTYPE "macOS") SET(OSTYPE "Linux")
ADD_DEFINITIONS("-DDARWIN") ADD_DEFINITIONS("-DLINUX")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
MESSAGE("Current system arch is arm64") IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
SET(TD_DARWIN_64 TRUE) SET(TD_LINUX_64 TRUE)
ADD_DEFINITIONS("-D_TD_DARWIN_64") ELSE ()
ENDIF () SET(TD_LINUX_32 TRUE)
ENDIF ()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ADD_DEFINITIONS("-DHAVE_UNISTD_H") SET(TD_DARWIN TRUE)
SET(OSTYPE "macOS")
ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare")
MESSAGE("Current system processor is ${CMAKE_SYSTEM_PROCESSOR}.")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
MESSAGE("Current system arch is arm64")
SET(TD_DARWIN_64 TRUE)
ADD_DEFINITIONS("-D_TD_DARWIN_64")
ENDIF ()
ADD_DEFINITIONS("-DHAVE_UNISTD_H")
ENDIF ()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
...@@ -45,6 +67,7 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ...@@ -45,6 +67,7 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
SET(TD_WINDOWS_32 TRUE) SET(TD_WINDOWS_32 TRUE)
ADD_DEFINITIONS("-D_TD_WINDOWS_32") ADD_DEFINITIONS("-D_TD_WINDOWS_32")
ENDIF () ENDIF ()
ENDIF() ENDIF()
MESSAGE("C Compiler ID: ${CMAKE_C_COMPILER_ID}") MESSAGE("C Compiler ID: ${CMAKE_C_COMPILER_ID}")
......
...@@ -22,6 +22,8 @@ extern "C" { ...@@ -22,6 +22,8 @@ extern "C" {
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <pthread.h>
#include <semaphore.h>
#if !defined(WINDOWS) #if !defined(WINDOWS)
#include <unistd.h> #include <unistd.h>
...@@ -34,7 +36,12 @@ extern "C" { ...@@ -34,7 +36,12 @@ extern "C" {
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/mman.h> #include <sys/mman.h>
#if defined(DARWIN)
#else
#include <sys/prctl.h> #include <sys/prctl.h>
#include <argp.h>
#endif
#endif #endif
...@@ -54,9 +61,12 @@ extern "C" { ...@@ -54,9 +61,12 @@ extern "C" {
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <wchar.h> #include <wchar.h>
#include <termios.h>
#include <wctype.h> #include <wctype.h>
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program 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.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_OS_EOK_H
#define TDENGINE_OS_EOK_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __APPLE__
enum EPOLL_EVENTS
{
EPOLLIN = 0x001,
#define EPOLLIN EPOLLIN
EPOLLPRI = 0x002,
#define EPOLLPRI EPOLLPRI
EPOLLOUT = 0x004,
#define EPOLLOUT EPOLLOUT
EPOLLRDNORM = 0x040,
#define EPOLLRDNORM EPOLLRDNORM
EPOLLRDBAND = 0x080,
#define EPOLLRDBAND EPOLLRDBAND
EPOLLWRNORM = 0x100,
#define EPOLLWRNORM EPOLLWRNORM
EPOLLWRBAND = 0x200,
#define EPOLLWRBAND EPOLLWRBAND
EPOLLMSG = 0x400,
#define EPOLLMSG EPOLLMSG
EPOLLERR = 0x008,
#define EPOLLERR EPOLLERR
EPOLLHUP = 0x010,
#define EPOLLHUP EPOLLHUP
EPOLLRDHUP = 0x2000,
#define EPOLLRDHUP EPOLLRDHUP
EPOLLEXCLUSIVE = 1u << 28,
#define EPOLLEXCLUSIVE EPOLLEXCLUSIVE
EPOLLWAKEUP = 1u << 29,
#define EPOLLWAKEUP EPOLLWAKEUP
EPOLLONESHOT = 1u << 30,
#define EPOLLONESHOT EPOLLONESHOT
EPOLLET = 1u << 31
#define EPOLLET EPOLLET
};
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
typedef union epoll_data
{
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
struct epoll_event
{
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
int epoll_create(int size);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
int epoll_close(int epfd);
#endif // __APPLE__
#ifdef __cplusplus
}
#endif
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_
...@@ -49,6 +49,15 @@ int64_t taosRead(FileFd fd, void *buf, int64_t count); ...@@ -49,6 +49,15 @@ int64_t taosRead(FileFd fd, void *buf, int64_t count);
#define PATH_MAX 256 #define PATH_MAX 256
#endif #endif
typedef int32_t FileFd;
typedef struct TdFile {
pthread_rwlock_t rwlock;
int refId;
FileFd fd;
FILE *fp;
} * TdFilePtr, TdFile;
typedef struct TdFile *TdFilePtr; typedef struct TdFile *TdFilePtr;
#define TD_FILE_CTEATE 0x0001 #define TD_FILE_CTEATE 0x0001
...@@ -101,8 +110,16 @@ int64_t taosCopyFile(const char *from, const char *to); ...@@ -101,8 +110,16 @@ int64_t taosCopyFile(const char *from, const char *to);
int32_t taosRemoveFile(const char *path); int32_t taosRemoveFile(const char *path);
void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath); void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath);
#if defined(_TD_DARWIN_64)
typedef int32_t SocketFd;
int64_t taosSendFile(SocketFd fdDst, FileFd pFileSrc, int64_t *offset, int64_t size);
int64_t taosFSendFile(FILE *pFileOut, FILE *pFileIn, int64_t *offset, int64_t size);
#else
int64_t taosSendFile(SocketFd fdDst, TdFilePtr pFileSrc, int64_t *offset, int64_t size);
int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, int64_t size); int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, int64_t size);
#endif
void *taosMmapReadOnlyFile(TdFilePtr pFile, int64_t length); void *taosMmapReadOnlyFile(TdFilePtr pFile, int64_t length);
bool taosValidFile(TdFilePtr pFile); bool taosValidFile(TdFilePtr pFile);
......
...@@ -38,12 +38,12 @@ extern "C" { ...@@ -38,12 +38,12 @@ extern "C" {
#endif #endif
#if defined (_TD_DARWIN_64) #if defined (_TD_DARWIN_64)
#define pthread_rwlock_t pthread_mutex_t // #define pthread_rwlock_t pthread_mutex_t
#define pthread_rwlock_init(lock, NULL) pthread_mutex_init(lock, NULL) // #define pthread_rwlock_init(lock, NULL) pthread_mutex_init(lock, NULL)
#define pthread_rwlock_destroy(lock) pthread_mutex_destroy(lock) // #define pthread_rwlock_destroy(lock) pthread_mutex_destroy(lock)
#define pthread_rwlock_wrlock(lock) pthread_mutex_lock(lock) // #define pthread_rwlock_wrlock(lock) pthread_mutex_lock(lock)
#define pthread_rwlock_rdlock(lock) pthread_mutex_lock(lock) // #define pthread_rwlock_rdlock(lock) pthread_mutex_lock(lock)
#define pthread_rwlock_unlock(lock) pthread_mutex_unlock(lock) // #define pthread_rwlock_unlock(lock) pthread_mutex_unlock(lock)
#define pthread_spinlock_t pthread_mutex_t #define pthread_spinlock_t pthread_mutex_t
#define pthread_spin_init(lock, NULL) pthread_mutex_init(lock, NULL) #define pthread_spin_init(lock, NULL) pthread_mutex_init(lock, NULL)
......
...@@ -33,8 +33,15 @@ ...@@ -33,8 +33,15 @@
#include <winbase.h> #include <winbase.h>
#include <Winsock2.h> #include <Winsock2.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/epoll.h> #include <sys/socket.h>
#if defined(_TD_DARWIN_64)
#include <osEok.h>
#else
#include <netinet/in.h>
#include <sys/epoll.h>
#endif
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
...@@ -49,7 +56,29 @@ extern "C" { ...@@ -49,7 +56,29 @@ extern "C" {
#endif #endif
#if defined(_TD_DARWIN_64) #if defined(_TD_DARWIN_64)
#define htobe64 htonll // #define htobe64 htonll
# include <libkern/OSByteOrder.h>
# define htobe16(x) OSSwapHostToBigInt16(x)
# define htole16(x) OSSwapHostToLittleInt16(x)
# define be16toh(x) OSSwapBigToHostInt16(x)
# define le16toh(x) OSSwapLittleToHostInt16(x)
# define htobe32(x) OSSwapHostToBigInt32(x)
# define htole32(x) OSSwapHostToLittleInt32(x)
# define be32toh(x) OSSwapBigToHostInt32(x)
# define le32toh(x) OSSwapLittleToHostInt32(x)
# define htobe64(x) OSSwapHostToBigInt64(x)
# define htole64(x) OSSwapHostToLittleInt64(x)
# define be64toh(x) OSSwapBigToHostInt64(x)
# define le64toh(x) OSSwapLittleToHostInt64(x)
# define __BYTE_ORDER BYTE_ORDER
# define __BIG_ENDIAN BIG_ENDIAN
# define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __PDP_ENDIAN PDP_ENDIAN
#endif #endif
#define TAOS_EPOLL_WAIT_TIME 500 #define TAOS_EPOLL_WAIT_TIME 500
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#ifndef _TD_OS_SYSINFO_H_ #ifndef _TD_OS_SYSINFO_H_
#define _TD_OS_SYSINFO_H_ #define _TD_OS_SYSINFO_H_
#include <sys/statvfs.h>
#include "os.h" #include "os.h"
#ifdef __cplusplus #ifdef __cplusplus
...@@ -52,7 +53,7 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen); ...@@ -52,7 +53,7 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen);
char *taosGetCmdlineByPID(int32_t pid); char *taosGetCmdlineByPID(int32_t pid);
void taosSetCoreDump(bool enable); void taosSetCoreDump(bool enable);
#if defined(WINDOWS) #if !defined(LINUX)
#define _UTSNAME_LENGTH 65 #define _UTSNAME_LENGTH 65
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH #define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
......
...@@ -864,7 +864,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs ...@@ -864,7 +864,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs
qsort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); qsort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn);
int64_t p1 = taosGetTimestampUs(); int64_t p1 = taosGetTimestampUs();
printf("sort:%ld, rows:%d\n", p1 - p0, pDataBlock->info.rows); printf("sort:%" PRId64 ", rows:%d\n", p1 - p0, pDataBlock->info.rows);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { // var data type } else { // var data type
...@@ -912,7 +912,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs ...@@ -912,7 +912,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs
copyBackToBlock(pDataBlock, pCols); copyBackToBlock(pDataBlock, pCols);
int64_t p4 = taosGetTimestampUs(); int64_t p4 = taosGetTimestampUs();
printf("sort:%ld, create:%ld, assign:%ld, copyback:%ld, rows:%d\n", p1-p0, p2 - p1, p3 - p2, p4-p3, rows); printf("sort:%" PRId64 ", create:%" PRId64 ", assign:%" PRId64 ", copyback:%" PRId64 ", rows:%d\n", p1-p0, p2 - p1, p3 - p2, p4-p3, rows);
destroyTupleIndex(index); destroyTupleIndex(index);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -1017,7 +1017,7 @@ int32_t dataBlockCompar_rv(const void* p1, const void* p2, const void* param) { ...@@ -1017,7 +1017,7 @@ int32_t dataBlockCompar_rv(const void* p1, const void* p2, const void* param) {
} }
int32_t varColSort(SColumnInfoData* pColumnInfoData, SBlockOrderInfo* pOrder) { int32_t varColSort(SColumnInfoData* pColumnInfoData, SBlockOrderInfo* pOrder) {
return 0;
} }
int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirst) { int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirst) {
...@@ -1055,8 +1055,9 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF ...@@ -1055,8 +1055,9 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
copyBackToBlock(pDataBlock, pCols); copyBackToBlock(pDataBlock, pCols);
int64_t p4 = taosGetTimestampUs(); int64_t p4 = taosGetTimestampUs();
printf("sort:%ld, create:%ld, assign:%ld, copyback:%ld, rows:%d\n", p1 - p0, p2 - p1, p3 - p2, p4 - p3, rows); printf("sort:%" PRId64 ", create:%" PRId64", assign:%" PRId64 ", copyback:%" PRId64 ", rows:%d\n", p1 - p0, p2 - p1, p3 - p2, p4 - p3, rows);
// destroyTupleIndex(index); // destroyTupleIndex(index);
return 0;
} }
void blockDataClearup(SSDataBlock* pDataBlock) { void blockDataClearup(SSDataBlock* pDataBlock) {
......
...@@ -845,7 +845,11 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) { ...@@ -845,7 +845,11 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
int64_t offset = getDataStartOffset(); int64_t offset = getDataStartOffset();
int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset; int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset;
#if defined(_TD_DARWIN_64)
int64_t written = taosFSendFile(pDestBuf->pFile->fp, pSrcBuf->pFile->fp, &offset, size);
#else
int64_t written = taosFSendFile(pDestBuf->pFile, pSrcBuf->pFile, &offset, size); int64_t written = taosFSendFile(pDestBuf->pFile, pSrcBuf->pFile, &offset, size);
#endif
if (written == -1 || written != size) { if (written == -1 || written != size) {
return -1; return -1;
......
...@@ -1062,7 +1062,7 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { ...@@ -1062,7 +1062,7 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) {
int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) { int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) {
int16_t widx = abs(id % mgmt->slotNum); int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx]; SCtgRentSlot *slot = &mgmt->slots[widx];
int32_t code = 0; int32_t code = 0;
...@@ -1092,11 +1092,11 @@ _return: ...@@ -1092,11 +1092,11 @@ _return:
} }
int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare, __compar_fn_t searchCompare) { int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare, __compar_fn_t searchCompare) {
int16_t widx = abs(id % mgmt->slotNum); int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx]; SCtgRentSlot *slot = &mgmt->slots[widx];
int32_t code = 0; int32_t code = 0;
CTG_LOCK(CTG_WRITE, &slot->lock); CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) { if (NULL == slot->meta) {
qError("empty meta slot, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qError("empty meta slot, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
...@@ -1133,7 +1133,7 @@ _return: ...@@ -1133,7 +1133,7 @@ _return:
} }
int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortCompare, __compar_fn_t searchCompare) { int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortCompare, __compar_fn_t searchCompare) {
int16_t widx = abs(id % mgmt->slotNum); int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx]; SCtgRentSlot *slot = &mgmt->slots[widx];
int32_t code = 0; int32_t code = 0;
......
...@@ -240,6 +240,7 @@ int indexRebuild(SIndex* index, SIndexOpts* opts){ ...@@ -240,6 +240,7 @@ int indexRebuild(SIndex* index, SIndexOpts* opts){
#ifdef USE_INVERTED_INDEX #ifdef USE_INVERTED_INDEX
#endif #endif
return 0;
} }
SIndexOpts* indexOptsCreate() { SIndexOpts* indexOptsCreate() {
......
...@@ -190,7 +190,10 @@ int indexCacheSchedToMerge(IndexCache* pCache) { ...@@ -190,7 +190,10 @@ int indexCacheSchedToMerge(IndexCache* pCache) {
schedMsg.msg = NULL; schedMsg.msg = NULL;
taosScheduleTask(indexQhandle, &schedMsg); taosScheduleTask(indexQhandle, &schedMsg);
return 0;
} }
static void indexCacheMakeRoomForWrite(IndexCache* cache) { static void indexCacheMakeRoomForWrite(IndexCache* cache) {
while (true) { while (true) {
if (cache->occupiedMem * MEM_ESTIMATE_RADIO < MEM_THRESHOLD) { if (cache->occupiedMem * MEM_ESTIMATE_RADIO < MEM_THRESHOLD) {
......
...@@ -571,6 +571,8 @@ uint64_t fstStateFindInput(FstState* s, FstNode* node, uint8_t b, bool* null) { ...@@ -571,6 +571,8 @@ uint64_t fstStateFindInput(FstState* s, FstNode* node, uint8_t b, bool* null) {
} }
fstSliceDestroy(&t); fstSliceDestroy(&t);
} }
return 0;
} }
// fst node function // fst node function
...@@ -1027,6 +1029,8 @@ Fst* fstCreate(FstSlice* slice) { ...@@ -1027,6 +1029,8 @@ Fst* fstCreate(FstSlice* slice) {
FST_CREAT_FAILED: FST_CREAT_FAILED:
free(fst->meta); free(fst->meta);
free(fst); free(fst);
return NULL;
} }
void fstDestroy(Fst* fst) { void fstDestroy(Fst* fst) {
if (fst) { if (fst) {
...@@ -1286,6 +1290,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) { ...@@ -1286,6 +1290,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min) {
} }
return false; return false;
} }
return false;
} }
StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback) { StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback) {
......
...@@ -763,6 +763,8 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, ...@@ -763,6 +763,8 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema,
// todo construct payload // todo construct payload
tfree(row); tfree(row);
return 0;
} }
// pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)
......
...@@ -425,6 +425,7 @@ static SLogicNode* createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt) { ...@@ -425,6 +425,7 @@ static SLogicNode* createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt) {
default: default:
break; break;
} }
return NULL; // to avoid compiler error
} }
int32_t createLogicPlan(SPlanContext* pCxt, SLogicNode** pLogicNode) { int32_t createLogicPlan(SPlanContext* pCxt, SLogicNode** pLogicNode) {
......
...@@ -792,7 +792,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { ...@@ -792,7 +792,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) {
} }
SFilterGroup *gp = NULL; SFilterGroup *gp = NULL;
while (gp = (SFilterGroup *)taosArrayPop(right)) { while ((gp = (SFilterGroup *)taosArrayPop(right)) != NULL) {
taosArrayPush(group, gp); taosArrayPush(group, gp);
} }
...@@ -801,7 +801,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { ...@@ -801,7 +801,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) {
if (taosArrayGetSize(right) <= 0) { if (taosArrayGetSize(right) <= 0) {
SFilterGroup *gp = NULL; SFilterGroup *gp = NULL;
while (gp = (SFilterGroup *)taosArrayPop(left)) { while ((gp = (SFilterGroup *)taosArrayPop(left)) != NULL) {
taosArrayPush(group, gp); taosArrayPush(group, gp);
} }
......
...@@ -239,6 +239,9 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t ...@@ -239,6 +239,9 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
break; break;
} }
default:
break;
} }
if (param->num > *rowNum) { if (param->num > *rowNum) {
......
...@@ -282,8 +282,10 @@ int32_t schLaunchTasksInFlowCtrlList(SSchJob *pJob, SSchTask *pTask) { ...@@ -282,8 +282,10 @@ int32_t schLaunchTasksInFlowCtrlList(SSchJob *pJob, SSchTask *pTask) {
SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR);
} }
SCH_ERR_RET(schLaunchTasksInFlowCtrlListImpl(pJob, ctrl)); int32_t code = schLaunchTasksInFlowCtrlListImpl(pJob, ctrl);;
SCH_ERR_RET(code);
return code; // to avoid compiler error
} }
...@@ -74,12 +74,12 @@ cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) { ...@@ -74,12 +74,12 @@ cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) {
cJSON_AddNumberToObject(pRoot, "bytes", pEntry->bytes); cJSON_AddNumberToObject(pRoot, "bytes", pEntry->bytes);
cJSON_AddNumberToObject(pRoot, "msgType", pEntry->msgType); cJSON_AddNumberToObject(pRoot, "msgType", pEntry->msgType);
cJSON_AddNumberToObject(pRoot, "originalRpcType", pEntry->originalRpcType); cJSON_AddNumberToObject(pRoot, "originalRpcType", pEntry->originalRpcType);
snprintf(u64buf, sizeof(u64buf), "%lu", pEntry->seqNum); snprintf(u64buf, sizeof(u64buf), "%" PRIu64 "", pEntry->seqNum);
cJSON_AddStringToObject(pRoot, "seqNum", u64buf); cJSON_AddStringToObject(pRoot, "seqNum", u64buf);
cJSON_AddNumberToObject(pRoot, "isWeak", pEntry->isWeak); cJSON_AddNumberToObject(pRoot, "isWeak", pEntry->isWeak);
snprintf(u64buf, sizeof(u64buf), "%lu", pEntry->term); snprintf(u64buf, sizeof(u64buf), "%" PRIu64 "", pEntry->term);
cJSON_AddStringToObject(pRoot, "term", u64buf); cJSON_AddStringToObject(pRoot, "term", u64buf);
snprintf(u64buf, sizeof(u64buf), "%lu", pEntry->index); snprintf(u64buf, sizeof(u64buf), "%" PRIu64 "", pEntry->index);
cJSON_AddStringToObject(pRoot, "index", u64buf); cJSON_AddStringToObject(pRoot, "index", u64buf);
cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen); cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen);
...@@ -107,26 +107,26 @@ char* syncEntry2Str(const SSyncRaftEntry* pEntry) { ...@@ -107,26 +107,26 @@ char* syncEntry2Str(const SSyncRaftEntry* pEntry) {
// for debug ---------------------- // for debug ----------------------
void syncEntryPrint(const SSyncRaftEntry* pObj) { void syncEntryPrint(const SSyncRaftEntry* pObj) {
char* serialized = syncEntry2Str(pObj); char* serialized = syncEntry2Str(pObj);
printf("syncEntryPrint | len:%lu | %s \n", strlen(serialized), serialized); printf("syncEntryPrint | len:%zu | %s \n", strlen(serialized), serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj) { void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj) {
char* serialized = syncEntry2Str(pObj); char* serialized = syncEntry2Str(pObj);
printf("syncEntryPrint2 | len:%lu | %s | %s \n", strlen(serialized), s, serialized); printf("syncEntryPrint2 | len:%zu | %s | %s \n", strlen(serialized), s, serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void syncEntryLog(const SSyncRaftEntry* pObj) { void syncEntryLog(const SSyncRaftEntry* pObj) {
char* serialized = syncEntry2Str(pObj); char* serialized = syncEntry2Str(pObj);
sTrace("syncEntryLog | len:%lu | %s", strlen(serialized), serialized); sTrace("syncEntryLog | len:%zu | %s", strlen(serialized), serialized);
free(serialized); free(serialized);
} }
void syncEntryLog2(char* s, const SSyncRaftEntry* pObj) { void syncEntryLog2(char* s, const SSyncRaftEntry* pObj) {
char* serialized = syncEntry2Str(pObj); char* serialized = syncEntry2Str(pObj);
sTrace("syncEntryLog2 | len:%lu | %s | %s", strlen(serialized), s, serialized); sTrace("syncEntryLog2 | len:%zu | %s | %s", strlen(serialized), s, serialized);
free(serialized); free(serialized);
} }
\ No newline at end of file
...@@ -97,7 +97,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) { ...@@ -97,7 +97,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
cJSON_AddItemToObject(pRoot, "isGranted", pIsGranted); cJSON_AddItemToObject(pRoot, "isGranted", pIsGranted);
cJSON_AddNumberToObject(pRoot, "votes", pVotesGranted->votes); cJSON_AddNumberToObject(pRoot, "votes", pVotesGranted->votes);
snprintf(u64buf, sizeof(u64buf), "%lu", pVotesGranted->term); snprintf(u64buf, sizeof(u64buf), "%" PRIu64 "", pVotesGranted->term);
cJSON_AddStringToObject(pRoot, "term", u64buf); cJSON_AddStringToObject(pRoot, "term", u64buf);
cJSON_AddNumberToObject(pRoot, "quorum", pVotesGranted->quorum); cJSON_AddNumberToObject(pRoot, "quorum", pVotesGranted->quorum);
cJSON_AddNumberToObject(pRoot, "toLeader", pVotesGranted->toLeader); cJSON_AddNumberToObject(pRoot, "toLeader", pVotesGranted->toLeader);
...@@ -122,27 +122,27 @@ char *voteGranted2Str(SVotesGranted *pVotesGranted) { ...@@ -122,27 +122,27 @@ char *voteGranted2Str(SVotesGranted *pVotesGranted) {
// for debug ------------------- // for debug -------------------
void voteGrantedPrint(SVotesGranted *pObj) { void voteGrantedPrint(SVotesGranted *pObj) {
char *serialized = voteGranted2Str(pObj); char *serialized = voteGranted2Str(pObj);
printf("voteGrantedPrint | len:%lu | %s \n", strlen(serialized), serialized); printf("voteGrantedPrint | len:%zu | %s \n", strlen(serialized), serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void voteGrantedPrint2(char *s, SVotesGranted *pObj) { void voteGrantedPrint2(char *s, SVotesGranted *pObj) {
char *serialized = voteGranted2Str(pObj); char *serialized = voteGranted2Str(pObj);
printf("voteGrantedPrint2 | len:%lu | %s | %s \n", strlen(serialized), s, serialized); printf("voteGrantedPrint2 | len:%zu | %s | %s \n", strlen(serialized), s, serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void voteGrantedLog(SVotesGranted *pObj) { void voteGrantedLog(SVotesGranted *pObj) {
char *serialized = voteGranted2Str(pObj); char *serialized = voteGranted2Str(pObj);
sTrace("voteGrantedLog | len:%lu | %s", strlen(serialized), serialized); sTrace("voteGrantedLog | len:%zu | %s", strlen(serialized), serialized);
free(serialized); free(serialized);
} }
void voteGrantedLog2(char *s, SVotesGranted *pObj) { void voteGrantedLog2(char *s, SVotesGranted *pObj) {
char *serialized = voteGranted2Str(pObj); char *serialized = voteGranted2Str(pObj);
sTrace("voteGrantedLog2 | len:%lu | %s | %s", strlen(serialized), s, serialized); sTrace("voteGrantedLog2 | len:%zu | %s | %s", strlen(serialized), s, serialized);
free(serialized); free(serialized);
} }
...@@ -222,7 +222,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) { ...@@ -222,7 +222,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
cJSON_AddItemToObject(pRoot, "isRespond", pIsRespond); cJSON_AddItemToObject(pRoot, "isRespond", pIsRespond);
cJSON_AddNumberToObject(pRoot, "respondNum", respondNum); cJSON_AddNumberToObject(pRoot, "respondNum", respondNum);
snprintf(u64buf, sizeof(u64buf), "%lu", pVotesRespond->term); snprintf(u64buf, sizeof(u64buf), "%" PRIu64 "", pVotesRespond->term);
cJSON_AddStringToObject(pRoot, "term", u64buf); cJSON_AddStringToObject(pRoot, "term", u64buf);
snprintf(u64buf, sizeof(u64buf), "%p", pVotesRespond->pSyncNode); snprintf(u64buf, sizeof(u64buf), "%p", pVotesRespond->pSyncNode);
cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf);
...@@ -242,26 +242,26 @@ char *votesRespond2Str(SVotesRespond *pVotesRespond) { ...@@ -242,26 +242,26 @@ char *votesRespond2Str(SVotesRespond *pVotesRespond) {
// for debug ------------------- // for debug -------------------
void votesRespondPrint(SVotesRespond *pObj) { void votesRespondPrint(SVotesRespond *pObj) {
char *serialized = votesRespond2Str(pObj); char *serialized = votesRespond2Str(pObj);
printf("votesRespondPrint | len:%lu | %s \n", strlen(serialized), serialized); printf("votesRespondPrint | len:%zu | %s \n", strlen(serialized), serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void votesRespondPrint2(char *s, SVotesRespond *pObj) { void votesRespondPrint2(char *s, SVotesRespond *pObj) {
char *serialized = votesRespond2Str(pObj); char *serialized = votesRespond2Str(pObj);
printf("votesRespondPrint2 | len:%lu | %s | %s \n", strlen(serialized), s, serialized); printf("votesRespondPrint2 | len:%zu | %s | %s \n", strlen(serialized), s, serialized);
fflush(NULL); fflush(NULL);
free(serialized); free(serialized);
} }
void votesRespondLog(SVotesRespond *pObj) { void votesRespondLog(SVotesRespond *pObj) {
char *serialized = votesRespond2Str(pObj); char *serialized = votesRespond2Str(pObj);
sTrace("votesRespondLog | len:%lu | %s", strlen(serialized), serialized); sTrace("votesRespondLog | len:%zu | %s", strlen(serialized), serialized);
free(serialized); free(serialized);
} }
void votesRespondLog2(char *s, SVotesRespond *pObj) { void votesRespondLog2(char *s, SVotesRespond *pObj) {
char *serialized = votesRespond2Str(pObj); char *serialized = votesRespond2Str(pObj);
sTrace("votesRespondLog2 | len:%lu | %s | %s", strlen(serialized), s, serialized); sTrace("votesRespondLog2 | len:%zu | %s | %s", strlen(serialized), s, serialized);
free(serialized); free(serialized);
} }
\ No newline at end of file
...@@ -558,4 +558,6 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) { ...@@ -558,4 +558,6 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) {
} }
} }
tfsUnLock(pTfs); tfsUnLock(pTfs);
}
\ No newline at end of file return 0;
}
...@@ -291,6 +291,7 @@ void* destroyConnPool(void* pool) { ...@@ -291,6 +291,7 @@ void* destroyConnPool(void* pool) {
connList = taosHashIterate((SHashObj*)pool, connList); connList = taosHashIterate((SHashObj*)pool, connList);
} }
taosHashCleanup(pool); taosHashCleanup(pool);
return NULL;
} }
static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port) { static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port) {
...@@ -576,6 +577,8 @@ static void* cliWorkThread(void* arg) { ...@@ -576,6 +577,8 @@ static void* cliWorkThread(void* arg) {
SCliThrdObj* pThrd = (SCliThrdObj*)arg; SCliThrdObj* pThrd = (SCliThrdObj*)arg;
setThreadName("trans-cli-work"); setThreadName("trans-cli-work");
uv_run(pThrd->loop, UV_RUN_DEFAULT); uv_run(pThrd->loop, UV_RUN_DEFAULT);
return NULL;
} }
void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle) { void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle) {
......
...@@ -155,14 +155,16 @@ bool transReadComplete(SConnBuffer* connBuf) { ...@@ -155,14 +155,16 @@ bool transReadComplete(SConnBuffer* connBuf) {
} }
return false; return false;
} }
int transPackMsg(STransMsgHead* msgHead, bool sercured, bool auth) {} int transPackMsg(STransMsgHead* msgHead, bool sercured, bool auth) {return 0;}
int transUnpackMsg(STransMsgHead* msgHead) {} int transUnpackMsg(STransMsgHead* msgHead) {return 0;}
int transDestroyBuffer(SConnBuffer* buf) { int transDestroyBuffer(SConnBuffer* buf) {
if (buf->cap > 0) { if (buf->cap > 0) {
tfree(buf->buf); tfree(buf->buf);
} }
transClearBuffer(buf); transClearBuffer(buf);
return 0;
} }
int transSetConnOption(uv_tcp_t* stream) { int transSetConnOption(uv_tcp_t* stream) {
......
...@@ -538,6 +538,8 @@ void* acceptThread(void* arg) { ...@@ -538,6 +538,8 @@ void* acceptThread(void* arg) {
setThreadName("trans-accept"); setThreadName("trans-accept");
SServerObj* srv = (SServerObj*)arg; SServerObj* srv = (SServerObj*)arg;
uv_run(srv->loop, UV_RUN_DEFAULT); uv_run(srv->loop, UV_RUN_DEFAULT);
return NULL;
} }
static bool addHandleToWorkloop(void* arg) { static bool addHandleToWorkloop(void* arg) {
SWorkThrdObj* pThrd = arg; SWorkThrdObj* pThrd = arg;
...@@ -593,6 +595,8 @@ void* workerThread(void* arg) { ...@@ -593,6 +595,8 @@ void* workerThread(void* arg) {
setThreadName("trans-worker"); setThreadName("trans-worker");
SWorkThrdObj* pThrd = (SWorkThrdObj*)arg; SWorkThrdObj* pThrd = (SWorkThrdObj*)arg;
uv_run(pThrd->loop, UV_RUN_DEFAULT); uv_run(pThrd->loop, UV_RUN_DEFAULT);
return NULL;
} }
static SSrvConn* createConn(void* hThrd) { static SSrvConn* createConn(void* hThrd) {
......
...@@ -169,7 +169,7 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { ...@@ -169,7 +169,7 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
} }
if (pRead->pHead->head.version != ver) { if (pRead->pHead->head.version != ver) {
wError("unexpected wal log version: %ld, read request version:%ld", pRead->pHead->head.version, ver); wError("unexpected wal log version: %" PRId64 ", read request version:%" PRId64 "", pRead->pHead->head.version, ver);
pRead->curVersion = -1; pRead->curVersion = -1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED; terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1; return -1;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#define ALLOW_FORBID_FUNC #define ALLOW_FORBID_FUNC
#include "os.h" #include "os.h"
#include "osSemaphore.h"
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#include <io.h> #include <io.h>
...@@ -35,26 +36,18 @@ extern int openU(const char *, int, ...); /* MsvcLibX UTF-8 version of open */ ...@@ -35,26 +36,18 @@ extern int openU(const char *, int, ...); /* MsvcLibX UTF-8 version of open */
#else #else
#include <fcntl.h> #include <fcntl.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/sendfile.h>
#if !defined(_TD_DARWIN_64)
#include <sys/sendfile.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#define LINUX_FILE_NO_TEXT_OPTION 0 #define LINUX_FILE_NO_TEXT_OPTION 0
#define O_TEXT LINUX_FILE_NO_TEXT_OPTION #define O_TEXT LINUX_FILE_NO_TEXT_OPTION
#endif #endif
typedef int32_t FileFd;
#define FILE_WITH_LOCK 1 #define FILE_WITH_LOCK 1
typedef struct TdFile {
#if FILE_WITH_LOCK
pthread_rwlock_t rwlock;
#endif
int refId;
FileFd fd;
FILE *fp;
} * TdFilePtr, TdFile;
void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath) { void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath) {
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
const char *tdengineTmpFileNamePrefix = "tdengine-"; const char *tdengineTmpFileNamePrefix = "tdengine-";
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define ALLOW_FORBID_FUNC #define ALLOW_FORBID_FUNC
#include "os.h" #include "os.h"
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) #if defined(WINDOWS)
#include <IPHlpApi.h> #include <IPHlpApi.h>
#include <WS2tcpip.h> #include <WS2tcpip.h>
#include <Winsock2.h> #include <Winsock2.h>
...@@ -37,8 +37,14 @@ ...@@ -37,8 +37,14 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <netinet/udp.h> #include <netinet/udp.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/epoll.h>
#include <unistd.h> #include <unistd.h>
#if defined(DARWIN)
#include <dispatch/dispatch.h>
#include "osEok.h"
#else
#include <sys/epoll.h>
#endif
#endif #endif
typedef int32_t SocketFd; typedef int32_t SocketFd;
...@@ -210,7 +216,7 @@ int32_t taosShutDownSocketServerRDWR(TdSocketServerPtr pSocketServer) { ...@@ -210,7 +216,7 @@ int32_t taosShutDownSocketServerRDWR(TdSocketServerPtr pSocketServer) {
#endif #endif
} }
#if (defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)) #if (defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
#if defined(_TD_GO_DLL_) #if defined(_TD_GO_DLL_)
uint64_t htonll(uint64_t val) { return (((uint64_t)htonl(val)) << 32) + htonl(val >> 32); } uint64_t htonll(uint64_t val) { return (((uint64_t)htonl(val)) << 32) + htonl(val >> 32); }
#endif #endif
......
...@@ -570,6 +570,7 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) { ...@@ -570,6 +570,7 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
case CFG_DTYPE_LOCALE: case CFG_DTYPE_LOCALE:
case CFG_DTYPE_CHARSET: case CFG_DTYPE_CHARSET:
case CFG_DTYPE_TIMEZONE: case CFG_DTYPE_TIMEZONE:
case CFG_DTYPE_NONE:
if (dump) { if (dump) {
printf("%s %s %s", src, name, pItem->str); printf("%s %s %s", src, name, pItem->str);
printf("\n"); printf("\n");
...@@ -655,4 +656,4 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { ...@@ -655,4 +656,4 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
uInfo("load from apoll url %s", url); uInfo("load from apoll url %s", url);
return 0; return 0;
} }
\ No newline at end of file
...@@ -628,7 +628,7 @@ void taosTmrCleanUp(void* handle) { ...@@ -628,7 +628,7 @@ void taosTmrCleanUp(void* handle) {
tmrCtrls = NULL; tmrCtrls = NULL;
unusedTmrCtrl = NULL; unusedTmrCtrl = NULL;
#if !defined(WINDOWS) #if defined(LINUX)
tmrModuleInit = PTHREAD_ONCE_INIT; // to support restart tmrModuleInit = PTHREAD_ONCE_INIT; // to support restart
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册