diff --git a/src/os/inc/os.h b/src/os/inc/os.h index 70f8487baa0b52daa9becfd8c2488c537ff91e9f..9996f7d92a5d73f7d1707fd75d3a076f30c84b8b 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 8f0978da53643294da5fd409621c8aa89da7cf4c..cda987f6d5c8aa6ace2217a6857ad45e4a627be8 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 f5513cc7099c7c5845430cd4eea8d251f85747ea..8ff00893926b833bfb20e7f191faddb7da8f26b9 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 add5c9042d9d333ccf2500ff5771892585822354..0000000000000000000000000000000000000000 --- 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 138a6f97ee147f70e11b51d4a6bd54bfca7d3c3c..c001f95d8962062455d14f764d392e3b738715d3 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 c91aef6d18cf7c017167ad3ab4af511fcbc16769..9d0a7b335259349bd3bae7c2de98a109d587e29f 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 ac91e73ab3d1f3ca12b10ec2b590087c6802a614..c3db406a172e8d00fe9f3c7b42ae9b98cdfffe00 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 75685744aaf1986fe194e1a7502114573ffd717a..3a42978ff214181780ea1415a755893ca2f503bf 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 4e02973e500076780f0a745c10eecb5fe824bb82..6a613e89fca37c197e0b72e2e8cb0a8eb4e549df 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 10576c9a0a01a0704fc8b54564364fba9424d6da..0000000000000000000000000000000000000000 --- 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