From caf933403f1be7d2a457d36822789877da6d3d79 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 31 Jul 2020 07:23:05 +0000 Subject: [PATCH] [TD-992] --- src/os/inc/os.h | 1 - src/os/inc/osDarwin64.h | 2 +- src/os/inc/osFile.h | 4 +-- src/os/inc/osPthread.h | 31 ------------------- src/os/inc/osSemphone.h | 4 +++ src/os/inc/osString.h | 4 +-- src/os/inc/osSysinfo.h | 2 +- src/os/inc/osWindows64.h | 4 +-- .../src/detail/{osPThread.c => osSemphone.c} | 0 src/os/src/detail/{osWchar.c => osString.c} | 13 ++++++-- src/os/src/detail/osUtil.c | 26 ---------------- 11 files changed, 23 insertions(+), 68 deletions(-) delete mode 100644 src/os/inc/osPthread.h rename src/os/src/detail/{osPThread.c => osSemphone.c} (100%) rename src/os/src/detail/{osWchar.c => osString.c} (94%) delete mode 100644 src/os/src/detail/osUtil.c diff --git a/src/os/inc/os.h b/src/os/inc/os.h index 70f8487baa..9996f7d92a 100644 --- a/src/os/inc/os.h +++ b/src/os/inc/os.h @@ -51,7 +51,6 @@ extern "C" { #include "osLz4.h" #include "osMath.h" #include "osMemory.h" -#include "osPthread.h" #include "osRand.h" #include "osSemphone.h" #include "osSocket.h" diff --git a/src/os/inc/osDarwin64.h b/src/os/inc/osDarwin64.h index 8f0978da53..cda987f6d5 100644 --- a/src/os/inc/osDarwin64.h +++ b/src/os/inc/osDarwin64.h @@ -85,7 +85,7 @@ int tsem_destroy(dispatch_semaphore_t *sem); #define TAOS_OS_FUNC_SOCKET_SETSOCKETOPT #define TAOS_OS_FUNC_SYSINFO #define TAOS_OS_FUNC_TIMER -#define TAOS_OS_FUNC_UTIL +#define TAOS_OS_FUNC_STRING_STR2INT64 // specific #define htobe64 htonll diff --git a/src/os/inc/osFile.h b/src/os/inc/osFile.h index f5513cc709..8ff0089392 100644 --- a/src/os/inc/osFile.h +++ b/src/os/inc/osFile.h @@ -51,11 +51,11 @@ int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t #endif #endif +int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstPath); + // TAOS_OS_FUNC_FILE_GETTMPFILEPATH void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath); -int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstPath); - #ifdef __cplusplus } #endif diff --git a/src/os/inc/osPthread.h b/src/os/inc/osPthread.h deleted file mode 100644 index add5c9042d..0000000000 --- a/src/os/inc/osPthread.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#ifndef TDENGINE_OS_PTHREAD_H -#define TDENGINE_OS_PTHREAD_H - -#ifdef __cplusplus -extern "C" { -#endif - -// TAOS_OS_FUNC_PTHREAD -bool taosCheckPthreadValid(pthread_t thread); -int64_t taosGetPthreadId(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osSemphone.h b/src/os/inc/osSemphone.h index 138a6f97ee..c001f95d89 100644 --- a/src/os/inc/osSemphone.h +++ b/src/os/inc/osSemphone.h @@ -28,6 +28,10 @@ extern "C" { #define tsem_destroy sem_destroy #endif +// TAOS_OS_FUNC_PTHREAD +bool taosCheckPthreadValid(pthread_t thread); +int64_t taosGetPthreadId(); + #ifdef __cplusplus } #endif diff --git a/src/os/inc/osString.h b/src/os/inc/osString.h index c91aef6d18..9d0a7b3352 100644 --- a/src/os/inc/osString.h +++ b/src/os/inc/osString.h @@ -29,7 +29,7 @@ extern "C" { #define taosGetlineImp(lineptr, n, stream) getline(lineptr, n , stream) #endif -#ifndef TAOS_OS_FUNC_WCHAR +#ifndef TAOS_OS_FUNC_STRING_WCHAR #define twcslen wcslen #endif @@ -39,7 +39,7 @@ extern "C" { (dst)[(size)-1] = 0; \ } while (0); -// TAOS_OS_FUNC_UTIL +// TAOS_OS_FUNC_STRING_STR2INT64 int64_t tsosStr2int64(char *str); // USE_LIBICONV diff --git a/src/os/inc/osSysinfo.h b/src/os/inc/osSysinfo.h index ac91e73ab3..c3db406a17 100644 --- a/src/os/inc/osSysinfo.h +++ b/src/os/inc/osSysinfo.h @@ -32,7 +32,7 @@ void taosPrintOsInfo(); int taosSystem(const char * cmd) ; void taosKillSystem(); -// TAOS_OS_FUNC_CORE +// TAOS_OS_FUNC_SYSINFO_CORE void taosSetCoreDump(); #ifdef __cplusplus diff --git a/src/os/inc/osWindows64.h b/src/os/inc/osWindows64.h index 75685744aa..3a42978ff2 100644 --- a/src/os/inc/osWindows64.h +++ b/src/os/inc/osWindows64.h @@ -48,7 +48,7 @@ extern "C" { #endif -#define TAOS_OS_FUNC_WCHAR +#define TAOS_OS_FUNC_STRING_WCHAR #define TAOS_OS_FUNC_FILE #define TAOS_OS_FUNC_SLEEP #define TAOS_OS_FUNC_TIMER @@ -65,7 +65,7 @@ extern "C" { int32_t BUILDIN_CTZL(uint64_t val); int32_t BUILDIN_CTZ(uint32_t val); -#define TAOS_OS_FUNC_UTIL +#define TAOS_OS_FUNC_STRING_STR2INT64 #ifdef _TD_GO_DLL_ int64_t tsosStr2int64(char *str); uint64_t htonll(uint64_t val); diff --git a/src/os/src/detail/osPThread.c b/src/os/src/detail/osSemphone.c similarity index 100% rename from src/os/src/detail/osPThread.c rename to src/os/src/detail/osSemphone.c diff --git a/src/os/src/detail/osWchar.c b/src/os/src/detail/osString.c similarity index 94% rename from src/os/src/detail/osWchar.c rename to src/os/src/detail/osString.c index 4e02973e50..6a613e89fc 100644 --- a/src/os/src/detail/osWchar.c +++ b/src/os/src/detail/osString.c @@ -18,7 +18,16 @@ #include "tglobal.h" #include "taosdef.h" -#ifndef TAOS_OS_FUNC_WCHAR +#ifndef TAOS_OS_FUNC_STRING_STR2INT64 + +int64_t tsosStr2int64(char *str) { + char *endptr = NULL; + return strtoll(str, &endptr, 10); +} + +#endif + +#ifndef TAOS_OS_FUNC_STRING_WCHAR int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) { return wcsncmp((wchar_t *)f1_ucs4, (wchar_t *)f2_ucs4, bytes / TSDB_NCHAR_SIZE); @@ -120,4 +129,4 @@ char *taosCharsetReplace(char *charsetstr) { } return strdup(charsetstr); -} \ No newline at end of file +} diff --git a/src/os/src/detail/osUtil.c b/src/os/src/detail/osUtil.c deleted file mode 100644 index 10576c9a0a..0000000000 --- a/src/os/src/detail/osUtil.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * 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 . - */ - -#define _DEFAULT_SOURCE -#include "os.h" - -#ifndef TAOS_OS_FUNC_UTIL - -int64_t tsosStr2int64(char *str) { - char *endptr = NULL; - return strtoll(str, &endptr, 10); -} - -#endif \ No newline at end of file -- GitLab