From dc64d4edc5f38afb4c778a03e2adad5aa566ec4d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 31 Jul 2020 23:33:02 +0800 Subject: [PATCH] [TD-1037] --- src/inc/taosdef.h | 3 ++- src/os/inc/osString.h | 5 +++-- src/os/inc/osTime.h | 2 +- src/os/inc/osWindows.h | 2 ++ src/os/src/windows/CMakeLists.txt | 20 +++++++++++-------- src/os/src/windows/w64File.c | 8 ++++++-- src/rpc/CMakeLists.txt | 11 ++--------- src/util/CMakeLists.txt | 33 +------------------------------ 8 files changed, 29 insertions(+), 55 deletions(-) diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index c70ca8662e..c328e57453 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -22,6 +22,7 @@ extern "C" { #include #include +#include "osDef.h" #include "taos.h" #define TSDB__packed @@ -161,7 +162,7 @@ extern tDataTypeDescriptor tDataTypeDesc[11]; bool isValidDataType(int32_t type); //bool isNull(const char *val, int32_t type); -static inline __attribute__((always_inline)) bool isNull(const char *val, int32_t type) { +static FORCE_INLINE bool isNull(const char *val, int32_t type) { switch (type) { case TSDB_DATA_TYPE_BOOL: return *(uint8_t *)val == TSDB_DATA_BOOL_NULL; diff --git a/src/os/inc/osString.h b/src/os/inc/osString.h index 1e1953c81d..b2846a31bc 100644 --- a/src/os/inc/osString.h +++ b/src/os/inc/osString.h @@ -41,8 +41,9 @@ extern "C" { (dst)[(size)-1] = 0; \ } while (0); -// TAOS_OS_FUNC_STRING_STR2INT64 -int64_t tsosStr2int64(char *str); +#ifndef TAOS_OS_FUNC_STRING_STR2INT64 + int64_t tsosStr2int64(char *str); +#endif // USE_LIBICONV int32_t taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs); diff --git a/src/os/inc/osTime.h b/src/os/inc/osTime.h index e2d3e081a1..cd2553f753 100644 --- a/src/os/inc/osTime.h +++ b/src/os/inc/osTime.h @@ -23,7 +23,7 @@ extern "C" { #include "os.h" #include "taosdef.h" -#ifndef TAOS_OS_DEF_TIME +#ifndef TAOS_OS_FUNC_TIME_DEF #define MILLISECOND_PER_SECOND ((int64_t)1000L) #endif #define MILLISECOND_PER_MINUTE (MILLISECOND_PER_SECOND * 60) diff --git a/src/os/inc/osWindows.h b/src/os/inc/osWindows.h index b44a41832e..a8c2243253 100644 --- a/src/os/inc/osWindows.h +++ b/src/os/inc/osWindows.h @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -124,6 +125,7 @@ typedef int (*__compar_fn_t)(const void *, const void *); #define socklen_t int #define htobe64 htonll #define twrite write +#define getpid _getpid int gettimeofday(struct timeval *tv, struct timezone *tz); struct tm *localtime_r(const time_t *timep, struct tm *result); diff --git a/src/os/src/windows/CMakeLists.txt b/src/os/src/windows/CMakeLists.txt index dc60b736ea..60fab63cd1 100644 --- a/src/os/src/windows/CMakeLists.txt +++ b/src/os/src/windows/CMakeLists.txt @@ -1,11 +1,15 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_WINDOWS_64) - INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) - INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) - INCLUDE_DIRECTORIES(inc) - AUX_SOURCE_DIRECTORY(src SRC) - ADD_LIBRARY(os ${SRC}) - TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32) -ENDIF () +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc) +AUX_SOURCE_DIRECTORY(. SRC) + +ADD_LIBRARY(os ${SRC}) + +TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32) diff --git a/src/os/src/windows/w64File.c b/src/os/src/windows/w64File.c index 54a95297ac..f2c59c3639 100644 --- a/src/os/src/windows/w64File.c +++ b/src/os/src/windows/w64File.c @@ -37,10 +37,9 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) { snprintf(dstPath, PATH_MAX, tmpPath, getpid(), rand); } - #define _SEND_FILE_STEP_ 1000 -int taosTSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t count) { +int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t count) { fseek(in_file, (int32_t)(*offset), 0); int writeLen = 0; uint8_t buffer[_SEND_FILE_STEP_] = { 0 }; @@ -74,3 +73,8 @@ int taosTSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t cou return writeLen; } + +ssize_t taosTSendFileImp(int dfd, int sfd, off_t *offset, size_t size) { + uError("taosTSendFileImp no implemented yet"); + return 0; +} \ No newline at end of file diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt index 902c8b66e4..15a8923d21 100644 --- a/src/rpc/CMakeLists.txt +++ b/src/rpc/CMakeLists.txt @@ -10,19 +10,12 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc) INCLUDE_DIRECTORIES(inc) IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) - AUX_SOURCE_DIRECTORY(./src SRC) + AUX_SOURCE_DIRECTORY(src SRC) ELSEIF (TD_DARWIN_64) - #LIST(APPEND SRC ./src/thaship.c) - #LIST(APPEND SRC ./src/trpc.c) - #LIST(APPEND SRC ./src/tstring.c) - #LIST(APPEND SRC ./src/tudp.c) AUX_SOURCE_DIRECTORY(src SRC) ELSEIF (TD_WINDOWS_64) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) - LIST(APPEND SRC ./src/thaship.c) - LIST(APPEND SRC ./src/trpc.c) - LIST(APPEND SRC ./src/tstring.c) - LIST(APPEND SRC ./src/tudp.c) + AUX_SOURCE_DIRECTORY(src SRC) ENDIF () ADD_LIBRARY(trpc ${SRC}) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 2521c582d1..d91ef075ef 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -34,38 +34,7 @@ ELSEIF (TD_WINDOWS_64) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) - LIST(APPEND SRC ./src/hash.c) - LIST(APPEND SRC ./src/ihash.c) - LIST(APPEND SRC ./src/lz4.c) - LIST(APPEND SRC ./src/shash.c) - LIST(APPEND SRC ./src/tbase64.c) - LIST(APPEND SRC ./src/tcache.c) - LIST(APPEND SRC ./src/tcompression.c) - LIST(APPEND SRC ./src/textbuffer.c) - LIST(APPEND SRC ./src/tglobalcfg.c) - LIST(APPEND SRC ./src/thash.c) - LIST(APPEND SRC ./src/thashutil.c) - LIST(APPEND SRC ./src/thistogram.c) - LIST(APPEND SRC ./src/tidpool.c) - LIST(APPEND SRC ./src/tinterpolation.c) - LIST(APPEND SRC ./src/tlog.c) - LIST(APPEND SRC ./src/tlosertree.c) - LIST(APPEND SRC ./src/tmd5.c) - LIST(APPEND SRC ./src/tmem.c) - LIST(APPEND SRC ./src/tmempool.c) - LIST(APPEND SRC ./src/tmodule.c) - LIST(APPEND SRC ./src/tnote.c) - LIST(APPEND SRC ./src/tpercentile.c) - LIST(APPEND SRC ./src/tsched.c) - LIST(APPEND SRC ./src/tskiplist.c) - LIST(APPEND SRC ./src/tsocket.c) - LIST(APPEND SRC ./src/tstrbuild.c) - LIST(APPEND SRC ./src/ttime.c) - LIST(APPEND SRC ./src/ttimer.c) - LIST(APPEND SRC ./src/ttokenizer.c) - LIST(APPEND SRC ./src/ttypes.c) - LIST(APPEND SRC ./src/tutil.c) - LIST(APPEND SRC ./src/version.c) + AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tutil ${SRC}) TARGET_LINK_LIBRARIES(tutil iconv regex pthread osdetail winmm IPHLPAPI ws2_32 lz4) ELSEIF(TD_DARWIN_64) -- GitLab