From 34f508c505eb139ca41b18780d5d8ae3619cc0a0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 11:34:07 +0800 Subject: [PATCH 1/5] TD-4088 --- src/os/inc/os.h | 37 +----------- src/os/inc/osAlpine.h | 92 ----------------------------- src/os/inc/osArm32.h | 92 ----------------------------- src/os/inc/osArm64.h | 87 ---------------------------- src/os/inc/osDarwin.h | 99 ------------------------------- src/os/inc/osDef.h | 103 +++++++++++++++++++++++++++++++++ src/os/inc/osInc.h | 118 +++++++++++++++++++++++++++++++++++++ src/os/inc/osLinux32.h | 86 --------------------------- src/os/inc/osLinux64.h | 89 ---------------------------- src/os/inc/osMips64.h | 87 ---------------------------- src/os/inc/osWindows.h | 128 ----------------------------------------- 11 files changed, 222 insertions(+), 796 deletions(-) delete mode 100644 src/os/inc/osAlpine.h delete mode 100644 src/os/inc/osArm32.h delete mode 100644 src/os/inc/osArm64.h delete mode 100644 src/os/inc/osDarwin.h create mode 100644 src/os/inc/osInc.h delete mode 100644 src/os/inc/osLinux32.h delete mode 100644 src/os/inc/osLinux64.h delete mode 100644 src/os/inc/osMips64.h delete mode 100644 src/os/inc/osWindows.h diff --git a/src/os/inc/os.h b/src/os/inc/os.h index 6006f1b969..6731ca6d7d 100644 --- a/src/os/inc/os.h +++ b/src/os/inc/os.h @@ -20,42 +20,7 @@ extern "C" { #endif -#ifdef _TD_DARWIN_64 -#include "osDarwin.h" -#endif - -#ifdef _TD_ARM_64 -#include "osArm64.h" -#endif - -#ifdef _TD_ARM_32 -#include "osArm32.h" -#endif - -#ifdef _TD_MIPS_64 -#include "osMips64.h" -#endif - -#ifdef _TD_LINUX_64 -#include "osLinux64.h" -#endif - -#ifdef _TD_LINUX_32 -#include "osLinux32.h" -#endif - -#ifdef _ALPINE -#include "osAlpine.h" -#endif - -#ifdef _TD_NINGSI_60 -#include "osNingsi.h" -#endif - -#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) -#include "osWindows.h" -#endif - +#include "osInc.h" #include "osDef.h" #include "osAtomic.h" #include "osDir.h" diff --git a/src/os/inc/osAlpine.h b/src/os/inc/osAlpine.h deleted file mode 100644 index eba9459395..0000000000 --- a/src/os/inc/osAlpine.h +++ /dev/null @@ -1,92 +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_ALPINE_H -#define TDENGINE_OS_ALPINE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef int(*__compar_fn_t)(const void *, const void *); -void error (int, int, const char *); -#ifndef PTHREAD_MUTEX_RECURSIVE_NP - #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osArm32.h b/src/os/inc/osArm32.h deleted file mode 100644 index 54835a1ca8..0000000000 --- a/src/os/inc/osArm32.h +++ /dev/null @@ -1,92 +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_ARM32_H -#define TDENGINE_OS_ARM32_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TAOS_OS_FUNC_LZ4 - #define BUILDIN_CLZL(val) __builtin_clzll(val) - #define BUILDIN_CTZL(val) __builtin_ctzll(val) - #define BUILDIN_CLZ(val) __builtin_clz(val) - #define BUILDIN_CTZ(val) __builtin_ctz(val) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osArm64.h b/src/os/inc/osArm64.h deleted file mode 100644 index 76098f6846..0000000000 --- a/src/os/inc/osArm64.h +++ /dev/null @@ -1,87 +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_ARM64_H -#define TDENGINE_OS_ARM64_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osDarwin.h b/src/os/inc/osDarwin.h deleted file mode 100644 index 5b8d27568d..0000000000 --- a/src/os/inc/osDarwin.h +++ /dev/null @@ -1,99 +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_DARWIN_H -#define TDENGINE_OS_DARWIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "osEok.h" - -// specific -typedef int(*__compar_fn_t)(const void *, const void *); - -// for send function in tsocket.c -#if defined(MSG_NOSIGNAL) -#undef MSG_NOSIGNAL -#endif - -#define MSG_NOSIGNAL 0 - -#define SO_NO_CHECK 0x1234 -#define SOL_TCP 0x1234 -#define TCP_KEEPIDLE 0x1234 - -#ifndef PTHREAD_MUTEX_RECURSIVE_NP - #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osDef.h b/src/os/inc/osDef.h index 74256e0091..7b5e9c8447 100644 --- a/src/os/inc/osDef.h +++ b/src/os/inc/osDef.h @@ -20,6 +20,109 @@ extern "C" { #endif +#if defined(TD_DARWIN_64) + // specific + typedef int(*__compar_fn_t)(const void *, const void *); + + // for send function in tsocket.c + #if defined(MSG_NOSIGNAL) + #undef MSG_NOSIGNAL + #endif + + #define MSG_NOSIGNAL 0 + + #define SO_NO_CHECK 0x1234 + #define SOL_TCP 0x1234 + #define TCP_KEEPIDLE 0x1234 + + #ifndef PTHREAD_MUTEX_RECURSIVE_NP + #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE + #endif +#endif + +#if defined(_ALPINE) + typedef int(*__compar_fn_t)(const void *, const void *); + void error (int, int, const char *); + #ifndef PTHREAD_MUTEX_RECURSIVE_NP + #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE + #endif +#endif + +#if defined(_TD_ARM_32) + #define BUILDIN_CTZL(val) __builtin_ctzll(val) + #define BUILDIN_CLZ(val) __builtin_clz(val) + #define BUILDIN_CTZ(val) __builtin_ctz(val) +#endif + +#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) + char *stpcpy (char *dest, const char *src); + char *stpncpy (char *dest, const char *src, size_t n); + + // specific + typedef int (*__compar_fn_t)(const void *, const void *); + #define ssize_t int + #define bzero(ptr, size) memset((ptr), 0, (size)) + #define strcasecmp _stricmp + #define strncasecmp _strnicmp + #define wcsncasecmp _wcsnicmp + #define strtok_r strtok_s + #define snprintf _snprintf + #define in_addr_t unsigned long + #define socklen_t int + + struct tm *localtime_r(const time_t *timep, struct tm *result); + char * strptime(const char *buf, const char *fmt, struct tm *tm); + char * strsep(char **stringp, const char *delim); + char * getpass(const char *prefix); + int flock(int fd, int option); + char * strndup(const char *s, size_t n); + int gettimeofday(struct timeval *ptv, void *pTimeZone); + + // for send function in tsocket.c + #define MSG_NOSIGNAL 0 + #define SO_NO_CHECK 0x1234 + #define SOL_TCP 0x1234 + + #ifndef TCP_KEEPCNT + #define TCP_KEEPCNT 0x1234 + #endif + + #ifndef TCP_KEEPIDLE + #define TCP_KEEPIDLE 0x1234 + #endif + + #ifndef TCP_KEEPINTVL + #define TCP_KEEPINTVL 0x1234 + #endif + + #define SHUT_RDWR SD_BOTH + #define SHUT_RD SD_RECEIVE + #define SHUT_WR SD_SEND + + #define LOCK_EX 1 + #define LOCK_NB 2 + #define LOCK_UN 3 + + #ifndef PATH_MAX + #define PATH_MAX 256 + #endif + + typedef struct { + int we_wordc; + char *we_wordv[1]; + int we_offs; + char wordPos[1025]; + } wordexp_t; + int wordexp(char *words, wordexp_t *pwordexp, int flags); + void wordfree(wordexp_t *pwordexp); + + #define openlog(a, b, c) + #define closelog() + #define LOG_ERR 0 + #define LOG_INFO 1 + void syslog(int unused, const char *format, ...); +#endif + #ifndef WINDOWS #ifndef O_BINARY #define O_BINARY 0 diff --git a/src/os/inc/osInc.h b/src/os/inc/osInc.h new file mode 100644 index 0000000000..3776501139 --- /dev/null +++ b/src/os/inc/osInc.h @@ -0,0 +1,118 @@ +/* + * 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_LINUX64_H +#define TDENGINE_OS_LINUX64_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_TD_LINUX_64) || defined(_TD_LINUX_32) || defined(_TD_MIPS_64) || defined(_TD_ARM_32) || defined(_TD_ARM_64) || defined(_TD_DARWIN_64) + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #if defined(TD_DARWIN_64) + #include + #include "osEok.h" + #else + #include + #include + #include + #include + #include + #include + #include + #include + + #if !(defined(_ALPINE)) + #include + #endif + #endif +#endif + +#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) + #include + #include + #include "winsock2.h" + #include + #include + #include + #include + #include + #include "msvcProcess.h" + #include "msvcDirect.h" + #include "msvcFcntl.h" + #include "msvcLibgen.h" + #include "msvcStdio.h" + #include "msvcUnistd.h" + #include "msvcLibgen.h" + #include "sys/msvcStat.h" + #include "sys/msvcTypes.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/os/inc/osLinux32.h b/src/os/inc/osLinux32.h deleted file mode 100644 index 6d9a01a9a8..0000000000 --- a/src/os/inc/osLinux32.h +++ /dev/null @@ -1,86 +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_LINUX32_H -#define TDENGINE_OS_LINUX32_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osLinux64.h b/src/os/inc/osLinux64.h deleted file mode 100644 index 0dfc819da3..0000000000 --- a/src/os/inc/osLinux64.h +++ /dev/null @@ -1,89 +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_LINUX64_H -#define TDENGINE_OS_LINUX64_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _ALPINE -#include -#endif -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osMips64.h b/src/os/inc/osMips64.h deleted file mode 100644 index ed7b08a311..0000000000 --- a/src/os/inc/osMips64.h +++ /dev/null @@ -1,87 +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_MIPS64_H -#define TDENGINE_OS_MIPS64_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/os/inc/osWindows.h b/src/os/inc/osWindows.h deleted file mode 100644 index 5a29471034..0000000000 --- a/src/os/inc/osWindows.h +++ /dev/null @@ -1,128 +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_WINDOWS_H -#define TDENGINE_OS_WINDOWS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "winsock2.h" -#include -#include -#include -#include -#include -#include -#include -#include "msvcProcess.h" -#include "msvcDirect.h" -#include "msvcFcntl.h" -#include "msvcLibgen.h" -#include "msvcStdio.h" -#include "msvcUnistd.h" -#include "msvcLibgen.h" -#include "sys/msvcStat.h" -#include "sys/msvcTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -char *stpcpy (char *dest, const char *src); -char *stpncpy (char *dest, const char *src, size_t n); - -// specific -typedef int (*__compar_fn_t)(const void *, const void *); -#define ssize_t int -#define bzero(ptr, size) memset((ptr), 0, (size)) -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -#define wcsncasecmp _wcsnicmp -#define strtok_r strtok_s -#define snprintf _snprintf -#define in_addr_t unsigned long -#define socklen_t int - -struct tm *localtime_r(const time_t *timep, struct tm *result); -char * strptime(const char *buf, const char *fmt, struct tm *tm); -char * strsep(char **stringp, const char *delim); -char * getpass(const char *prefix); -int flock(int fd, int option); -char * strndup(const char *s, size_t n); -int gettimeofday(struct timeval *ptv, void *pTimeZone); - -// for send function in tsocket.c -#define MSG_NOSIGNAL 0 -#define SO_NO_CHECK 0x1234 -#define SOL_TCP 0x1234 - -#ifndef TCP_KEEPCNT - #define TCP_KEEPCNT 0x1234 -#endif - -#ifndef TCP_KEEPIDLE - #define TCP_KEEPIDLE 0x1234 -#endif - -#ifndef TCP_KEEPINTVL - #define TCP_KEEPINTVL 0x1234 -#endif - -#define SHUT_RDWR SD_BOTH -#define SHUT_RD SD_RECEIVE -#define SHUT_WR SD_SEND - -#define LOCK_EX 1 -#define LOCK_NB 2 -#define LOCK_UN 3 - -#ifndef PATH_MAX - #define PATH_MAX 256 -#endif - -typedef struct { - int we_wordc; - char *we_wordv[1]; - int we_offs; - char wordPos[1025]; -} wordexp_t; -int wordexp(char *words, wordexp_t *pwordexp, int flags); -void wordfree(wordexp_t *pwordexp); - -#define openlog(a, b, c) -#define closelog() -#define LOG_ERR 0 -#define LOG_INFO 1 -void syslog(int unused, const char *format, ...); - -#ifdef __cplusplus -} -#endif -#endif From aa1ea68b8575c21ec8610f6f26a2e9c8fc22c853 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 14:10:58 +0800 Subject: [PATCH 2/5] TD-4088 --- src/os/CMakeLists.txt | 4 +-- src/os/inc/osEok.h | 4 +-- src/os/src/alpine/CMakeLists.txt | 7 ---- src/os/src/alpine/alpineEnv.c | 32 ------------------- src/os/src/darwin/CMakeLists.txt | 2 +- src/os/src/detail/CMakeLists.txt | 15 ++++++--- .../src/{linux/ningsi.c => detail/osAtomic.c} | 1 - .../src/{linux/linuxEnv.c => detail/osEnv.c} | 0 src/os/src/linux/CMakeLists.txt | 7 ---- src/os/src/windows/CMakeLists.txt | 4 +-- src/os/tests/CMakeLists.txt | 2 +- src/sync/CMakeLists.txt | 2 +- src/util/CMakeLists.txt | 2 +- src/util/tests/CMakeLists.txt | 2 +- src/wal/test/CMakeLists.txt | 4 +-- 15 files changed, 22 insertions(+), 66 deletions(-) delete mode 100644 src/os/src/alpine/CMakeLists.txt delete mode 100644 src/os/src/alpine/alpineEnv.c rename src/os/src/{linux/ningsi.c => detail/osAtomic.c} (99%) rename src/os/src/{linux/linuxEnv.c => detail/osEnv.c} (100%) delete mode 100644 src/os/src/linux/CMakeLists.txt diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index ab8b0f7678..efe2a1ed77 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -1,9 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_LINUX) - ADD_SUBDIRECTORY(src/linux) -ELSEIF (TD_DARWIN) +IF (TD_DARWIN) ADD_SUBDIRECTORY(src/darwin) ELSEIF (TD_WINDOWS) ADD_SUBDIRECTORY(src/windows) diff --git a/src/os/inc/osEok.h b/src/os/inc/osEok.h index 0874ca975b..3ca476f840 100644 --- a/src/os/inc/osEok.h +++ b/src/os/inc/osEok.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _eok_h_fd274616_996c_400e_9023_ae70be881fa3_ -#define _eok_h_fd274616_996c_400e_9023_ae70be881fa3_ +#ifndef TDENGINE_OS_EOK_H +#define TDENGINE_OS_EOK_H #include diff --git a/src/os/src/alpine/CMakeLists.txt b/src/os/src/alpine/CMakeLists.txt deleted file mode 100644 index b5e739c24c..0000000000 --- a/src/os/src/alpine/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(TDengine) - -AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) -TARGET_LINK_LIBRARIES(os m rt) - diff --git a/src/os/src/alpine/alpineEnv.c b/src/os/src/alpine/alpineEnv.c deleted file mode 100644 index 811d98ad7f..0000000000 --- a/src/os/src/alpine/alpineEnv.c +++ /dev/null @@ -1,32 +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" -#include "tglobal.h" - -void osInit() { - if (configDir[0] == 0) { - strcpy(configDir, "/etc/taos"); - } - - strcpy(tsVnodeDir, ""); - strcpy(tsDnodeDir, ""); - strcpy(tsMnodeDir, ""); - strcpy(tsDataDir, "/var/lib/taos"); - strcpy(tsLogDir, "/var/log/taos"); - strcpy(tsScriptDir, "/etc/taos"); - strcpy(tsOsName, "Linux"); -} \ No newline at end of file diff --git a/src/os/src/darwin/CMakeLists.txt b/src/os/src/darwin/CMakeLists.txt index c4cb28aa05..f46dfac6a1 100644 --- a/src/os/src/darwin/CMakeLists.txt +++ b/src/os/src/darwin/CMakeLists.txt @@ -2,4 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) +ADD_LIBRARY(osd ${SRC}) diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index facfbd23af..a3db8bd8b8 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -7,10 +7,15 @@ AUX_SOURCE_DIRECTORY(. SRC) SET_SOURCE_FILES_PROPERTIES(osSysinfo.c PROPERTIES COMPILE_FLAGS -w) SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w) -ADD_LIBRARY(osdetail ${SRC}) -TARGET_LINK_LIBRARIES(osdetail os) +ADD_LIBRARY(os ${SRC}) -IF (TD_ARM_32 OR TD_LINUX_32) - TARGET_LINK_LIBRARIES(osdetail atomic) +IF (TD_LINUX) + TARGET_LINK_LIBRARIES(os m rt z) + IF (TD_ARM_32 OR TD_LINUX_32) + TARGET_LINK_LIBRARIES(os atomic) + ENDIF () +ELSEIF (TD_DARWIN) + TARGET_LINK_LIBRARIES(os osd) +ELSEIF (TD_WINDOWS) + TARGET_LINK_LIBRARIES(os osw) ENDIF () - diff --git a/src/os/src/linux/ningsi.c b/src/os/src/detail/osAtomic.c similarity index 99% rename from src/os/src/linux/ningsi.c rename to src/os/src/detail/osAtomic.c index 2514c38ece..ecda573528 100644 --- a/src/os/src/linux/ningsi.c +++ b/src/os/src/detail/osAtomic.c @@ -53,4 +53,3 @@ int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val ) { return old; } #endif - diff --git a/src/os/src/linux/linuxEnv.c b/src/os/src/detail/osEnv.c similarity index 100% rename from src/os/src/linux/linuxEnv.c rename to src/os/src/detail/osEnv.c diff --git a/src/os/src/linux/CMakeLists.txt b/src/os/src/linux/CMakeLists.txt deleted file mode 100644 index b1a7ebf54e..0000000000 --- a/src/os/src/linux/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(TDengine) - -AUX_SOURCE_DIRECTORY(. SRC) - -ADD_LIBRARY(os ${SRC}) -TARGET_LINK_LIBRARIES(os m rt z) diff --git a/src/os/src/windows/CMakeLists.txt b/src/os/src/windows/CMakeLists.txt index 9dcc9e7e6d..1ac2700f1d 100644 --- a/src/os/src/windows/CMakeLists.txt +++ b/src/os/src/windows/CMakeLists.txt @@ -2,6 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) +ADD_LIBRARY(osw ${SRC}) -TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32 MsvcLibXw) +TARGET_LINK_LIBRARIES(osw winmm IPHLPAPI ws2_32 MsvcLibXw) diff --git a/src/os/tests/CMakeLists.txt b/src/os/tests/CMakeLists.txt index 1a18a72b40..b87e3d2a62 100644 --- a/src/os/tests/CMakeLists.txt +++ b/src/os/tests/CMakeLists.txt @@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) ADD_EXECUTABLE(osTest ${SOURCE_LIST}) - TARGET_LINK_LIBRARIES(osTest taos osdetail tutil common gtest pthread) + TARGET_LINK_LIBRARIES(osTest taos os tutil common gtest pthread) ENDIF() \ No newline at end of file diff --git a/src/sync/CMakeLists.txt b/src/sync/CMakeLists.txt index 82d0bbf520..521f51ceb7 100644 --- a/src/sync/CMakeLists.txt +++ b/src/sync/CMakeLists.txt @@ -11,6 +11,6 @@ TARGET_LINK_LIBRARIES(sync tutil pthread common) LIST(APPEND BIN_SRC src/syncArbitrator.c) LIST(APPEND BIN_SRC src/syncTcp.c) ADD_EXECUTABLE(tarbitrator ${BIN_SRC}) -TARGET_LINK_LIBRARIES(tarbitrator sync common osdetail tutil) +TARGET_LINK_LIBRARIES(tarbitrator sync common os tutil) #ADD_SUBDIRECTORY(test) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index a7f4f59e07..e8a1d61ee5 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/rmonotonic/inc) AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tutil ${SRC}) -TARGET_LINK_LIBRARIES(tutil pthread osdetail lz4 z rmonotonic) +TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic) IF (TD_LINUX) TARGET_LINK_LIBRARIES(tutil m rt) diff --git a/src/util/tests/CMakeLists.txt b/src/util/tests/CMakeLists.txt index 0c96ed2a2f..ee99348cd9 100644 --- a/src/util/tests/CMakeLists.txt +++ b/src/util/tests/CMakeLists.txt @@ -12,7 +12,7 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR) LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c) ADD_EXECUTABLE(utilTest ${SOURCE_LIST}) - TARGET_LINK_LIBRARIES(utilTest tutil common osdetail gtest pthread gcov) + TARGET_LINK_LIBRARIES(utilTest tutil common os gtest pthread gcov) LIST(APPEND BIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c) ADD_EXECUTABLE(trefTest ${BIN_SRC}) diff --git a/src/wal/test/CMakeLists.txt b/src/wal/test/CMakeLists.txt index f20a57899e..071ff6fdba 100644 --- a/src/wal/test/CMakeLists.txt +++ b/src/wal/test/CMakeLists.txt @@ -6,7 +6,7 @@ IF (TD_LINUX) LIST(APPEND WALTEST_SRC ./waltest.c) ADD_EXECUTABLE(waltest ${WALTEST_SRC}) - TARGET_LINK_LIBRARIES(waltest twal osdetail tutil) + TARGET_LINK_LIBRARIES(waltest twal os tutil) ENDIF () @@ -15,7 +15,7 @@ IF (TD_DARWIN) LIST(APPEND WALTEST_SRC ./waltest.c) ADD_EXECUTABLE(waltest ${WALTEST_SRC}) - TARGET_LINK_LIBRARIES(waltest twal osdetail tutil) + TARGET_LINK_LIBRARIES(waltest twal os tutil) ENDIF () From 274d420f8233fde0e1d4b4a7aa5a9f3ba27e4a96 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 14:38:41 +0800 Subject: [PATCH 3/5] TD-4088 --- src/os/inc/osDef.h | 8 +------- src/os/inc/osInc.h | 2 +- src/os/inc/osSocket.h | 4 +++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/os/inc/osDef.h b/src/os/inc/osDef.h index 7b5e9c8447..80617eec56 100644 --- a/src/os/inc/osDef.h +++ b/src/os/inc/osDef.h @@ -20,7 +20,7 @@ extern "C" { #endif -#if defined(TD_DARWIN_64) +#if defined(_TD_DARWIN_64) // specific typedef int(*__compar_fn_t)(const void *, const void *); @@ -48,12 +48,6 @@ extern "C" { #endif #endif -#if defined(_TD_ARM_32) - #define BUILDIN_CTZL(val) __builtin_ctzll(val) - #define BUILDIN_CLZ(val) __builtin_clz(val) - #define BUILDIN_CTZ(val) __builtin_ctz(val) -#endif - #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) char *stpcpy (char *dest, const char *src); char *stpncpy (char *dest, const char *src, size_t n); diff --git a/src/os/inc/osInc.h b/src/os/inc/osInc.h index 3776501139..2e639732f8 100644 --- a/src/os/inc/osInc.h +++ b/src/os/inc/osInc.h @@ -72,7 +72,7 @@ extern "C" { #include #include - #if defined(TD_DARWIN_64) + #if defined(_TD_DARWIN_64) #include #include "osEok.h" #else diff --git a/src/os/inc/osSocket.h b/src/os/inc/osSocket.h index 69b8eb1b42..a172c0bf34 100644 --- a/src/os/inc/osSocket.h +++ b/src/os/inc/osSocket.h @@ -95,7 +95,9 @@ const char *taosInetNtoa(struct in_addr ipInt); #if defined(_TD_GO_DLL_) uint64_t htonll(uint64_t val); #endif -#elif defined(_TD_DARWIN_64) +#endif + +#if defined(_TD_DARWIN_64) #define htobe64 htonll #endif From 6e97dce120fde581a5f6520855151374fb90c6d6 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 15:15:38 +0800 Subject: [PATCH 4/5] TD-4088 --- src/os/CMakeLists.txt | 4 +++- src/os/src/darwin/CMakeLists.txt | 2 +- src/os/src/detail/CMakeLists.txt | 6 +++--- src/os/src/linux/CMakeLists.txt | 7 +++++++ src/os/src/{detail/osEnv.c => linux/linuxEnv.c} | 3 +-- src/os/src/windows/CMakeLists.txt | 4 ++-- 6 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 src/os/src/linux/CMakeLists.txt rename src/os/src/{detail/osEnv.c => linux/linuxEnv.c} (98%) diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index efe2a1ed77..4472c683c7 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -1,7 +1,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_DARWIN) +IF (TD_LINUX) + ADD_SUBDIRECTORY(src/linux) +ELSEIF (TD_DARWIN) ADD_SUBDIRECTORY(src/darwin) ELSEIF (TD_WINDOWS) ADD_SUBDIRECTORY(src/windows) diff --git a/src/os/src/darwin/CMakeLists.txt b/src/os/src/darwin/CMakeLists.txt index f46dfac6a1..259e1a7a0b 100644 --- a/src/os/src/darwin/CMakeLists.txt +++ b/src/os/src/darwin/CMakeLists.txt @@ -2,4 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(osd ${SRC}) +ADD_LIBRARY(osdarwin ${SRC}) diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index a3db8bd8b8..5c49df24c1 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -10,12 +10,12 @@ SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w) ADD_LIBRARY(os ${SRC}) IF (TD_LINUX) - TARGET_LINK_LIBRARIES(os m rt z) + TARGET_LINK_LIBRARIES(os oslinux) IF (TD_ARM_32 OR TD_LINUX_32) TARGET_LINK_LIBRARIES(os atomic) ENDIF () ELSEIF (TD_DARWIN) - TARGET_LINK_LIBRARIES(os osd) + TARGET_LINK_LIBRARIES(os osdarwin) ELSEIF (TD_WINDOWS) - TARGET_LINK_LIBRARIES(os osw) + TARGET_LINK_LIBRARIES(os oswindows) ENDIF () diff --git a/src/os/src/linux/CMakeLists.txt b/src/os/src/linux/CMakeLists.txt new file mode 100644 index 0000000000..08b696ba1a --- /dev/null +++ b/src/os/src/linux/CMakeLists.txt @@ -0,0 +1,7 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +AUX_SOURCE_DIRECTORY(. SRC) +ADD_LIBRARY(oslinux ${SRC}) + +TARGET_LINK_LIBRARIES(oslinux m rt z) \ No newline at end of file diff --git a/src/os/src/detail/osEnv.c b/src/os/src/linux/linuxEnv.c similarity index 98% rename from src/os/src/detail/osEnv.c rename to src/os/src/linux/linuxEnv.c index e3eadbc94b..417513314c 100644 --- a/src/os/src/detail/osEnv.c +++ b/src/os/src/linux/linuxEnv.c @@ -40,9 +40,8 @@ void osInit() { strcpy(tsOsName, "Linux"); } -char cmdline[1024]; - char* taosGetCmdlineByPID(int pid) { + static char cmdline[1024]; sprintf(cmdline, "/proc/%d/cmdline", pid); FILE* f = fopen(cmdline, "r"); if (f) { diff --git a/src/os/src/windows/CMakeLists.txt b/src/os/src/windows/CMakeLists.txt index 1ac2700f1d..e5472e1abd 100644 --- a/src/os/src/windows/CMakeLists.txt +++ b/src/os/src/windows/CMakeLists.txt @@ -2,6 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(osw ${SRC}) +ADD_LIBRARY(oswindows ${SRC}) -TARGET_LINK_LIBRARIES(osw winmm IPHLPAPI ws2_32 MsvcLibXw) +TARGET_LINK_LIBRARIES(oswindows winmm IPHLPAPI ws2_32 MsvcLibXw) \ No newline at end of file From 733001f633b1bed10bd3e8469d5352fdba802bb4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 15:47:07 +0800 Subject: [PATCH 5/5] TD-4088 --- src/common/inc/tdataformat.h | 5 +---- src/inc/taosdef.h | 1 - src/inc/ttype.h | 2 ++ src/os/inc/osInc.h | 4 ++-- src/util/src/exception.c | 16 +++++++++++++++- src/util/src/tarray.c | 1 + src/util/src/tbase64.c | 28 ++++++++++++---------------- src/util/src/tbuffer.c | 5 +---- src/util/src/tcompare.c | 16 ++++++++++++++++ src/util/src/tcompression.c | 2 +- src/util/src/tcrc32c.c | 1 + src/util/src/tdes.c | 14 ++++++++++++++ src/util/src/terror.c | 7 ++----- src/util/src/thashutil.c | 19 +++++++++++++------ src/util/src/tidpool.c | 1 - src/util/src/tlist.c | 3 +-- src/util/src/tlockfree.c | 3 +-- src/util/src/tlosertree.c | 2 +- src/util/src/tmd5.c | 4 +--- 19 files changed, 85 insertions(+), 49 deletions(-) diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index e8c0760997..88d5b85010 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -15,10 +15,7 @@ #ifndef _TD_DATA_FORMAT_H_ #define _TD_DATA_FORMAT_H_ -#include -#include -#include - +#include "os.h" #include "talgo.h" #include "ttype.h" #include "tutil.h" diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index e9170860a6..e596ee67ec 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -22,7 +22,6 @@ extern "C" { #include #include -#include "osDef.h" #include "taos.h" #define TSDB__packed diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 662a23bfdb..9949f31c59 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -5,6 +5,8 @@ extern "C" { #endif +#include +#include #include "taosdef.h" // ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR diff --git a/src/os/inc/osInc.h b/src/os/inc/osInc.h index 2e639732f8..6a3c754dcc 100644 --- a/src/os/inc/osInc.h +++ b/src/os/inc/osInc.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_LINUX64_H -#define TDENGINE_OS_LINUX64_H +#ifndef TDENGINE_OS_INC_H +#define TDENGINE_OS_INC_H #ifdef __cplusplus extern "C" { diff --git a/src/util/src/exception.c b/src/util/src/exception.c index 0b716b6aba..9740b9031b 100644 --- a/src/util/src/exception.c +++ b/src/util/src/exception.c @@ -1,7 +1,21 @@ +/* + * 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 . + */ + #include "os.h" #include "exception.h" - static threadlocal SExceptionNode* expList; void exceptionPushNode( SExceptionNode* node ) { diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index 4dde5dbba2..f4587b33e7 100644 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "os.h" #include "tarray.h" void* taosArrayInit(size_t size, size_t elemSize) { diff --git a/src/util/src/tbase64.c b/src/util/src/tbase64.c index 937adfde5c..1b1f53df17 100644 --- a/src/util/src/tbase64.c +++ b/src/util/src/tbase64.c @@ -1,23 +1,19 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. +/* + * Copyright (c) 2019 TAOS Data, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ -#include -#include -#include -#include +#include "os.h" // deprecated this file for bug prone // base64 encode diff --git a/src/util/src/tbuffer.c b/src/util/src/tbuffer.c index a2cb32c1f4..abfa35f42c 100644 --- a/src/util/src/tbuffer.c +++ b/src/util/src/tbuffer.c @@ -14,12 +14,9 @@ */ #include "os.h" -#include -#include -#include #include "tbuffer.h" #include "exception.h" -#include +#include "taoserror.h" //////////////////////////////////////////////////////////////////////////////// // reader functions diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 354e7899c2..09199eaee3 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -1,3 +1,19 @@ +/* + * 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 . + */ + +#include "os.h" #include "ttype.h" #include "tcompare.h" #include "tarray.h" diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 1a5d28625f..1de6e76f71 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -47,8 +47,8 @@ * */ -#include "lz4.h" #include "os.h" +#include "lz4.h" #include "taosdef.h" #include "tscompression.h" #include "tulog.h" diff --git a/src/util/src/tcrc32c.c b/src/util/src/tcrc32c.c index 054b8f8171..4009973a9f 100644 --- a/src/util/src/tcrc32c.c +++ b/src/util/src/tcrc32c.c @@ -17,6 +17,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + #ifndef _TD_ARM_ #include #endif diff --git a/src/util/src/tdes.c b/src/util/src/tdes.c index 871ae15a8a..6e003756a3 100644 --- a/src/util/src/tdes.c +++ b/src/util/src/tdes.c @@ -1,3 +1,17 @@ +/* + * 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 . + */ #include "os.h" #include "tkey.h" diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 586a886f47..bc5c513137 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 TAOS Data, Inc. + * 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 @@ -13,10 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include +#include "os.h" #define TAOS_ERROR_C diff --git a/src/util/src/thashutil.c b/src/util/src/thashutil.c index 681d73db3d..3634dca4c0 100644 --- a/src/util/src/thashutil.c +++ b/src/util/src/thashutil.c @@ -1,12 +1,19 @@ -/** - * MurmurHash3 by Austin Appleby - * @ref - * https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp +/* + * Copyright (c) 2019 TAOS Data, Inc. * - * Plese refers to the link above for the complete implementation of - * MurmurHash algorithm + * 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 . */ + +#include "os.h" #include "hashfunc.h" #include "tutil.h" diff --git a/src/util/src/tidpool.c b/src/util/src/tidpool.c index bd3f774543..61cecf54c0 100644 --- a/src/util/src/tidpool.c +++ b/src/util/src/tidpool.c @@ -15,7 +15,6 @@ #include "os.h" #include "tulog.h" -#include typedef struct { int maxId; diff --git a/src/util/src/tlist.c b/src/util/src/tlist.c index 2f52551e2a..c5b4dbad10 100644 --- a/src/util/src/tlist.c +++ b/src/util/src/tlist.c @@ -12,9 +12,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include -#include +#include "os.h" #include "tlist.h" SList *tdListNew(int eleSize) { diff --git a/src/util/src/tlockfree.c b/src/util/src/tlockfree.c index 3161518a36..f54206f5cb 100644 --- a/src/util/src/tlockfree.c +++ b/src/util/src/tlockfree.c @@ -12,9 +12,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -// #define _GNU_SOURCE -// #include +#include "os.h" #include "tlockfree.h" #define TD_RWLATCH_WRITE_FLAG 0x40000000 diff --git a/src/util/src/tlosertree.c b/src/util/src/tlosertree.c index fa7e4fc340..e793548407 100644 --- a/src/util/src/tlosertree.c +++ b/src/util/src/tlosertree.c @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#include "tlosertree.h" #include "os.h" +#include "tlosertree.h" #include "taosmsg.h" #include "tulog.h" diff --git a/src/util/src/tmd5.c b/src/util/src/tmd5.c index 4971ed7a12..a1fdcc6a05 100644 --- a/src/util/src/tmd5.c +++ b/src/util/src/tmd5.c @@ -33,10 +33,8 @@ *********************************************************************** */ +#include "os.h" #include "tmd5.h" -#include -#include -#include #include "taosdef.h" /* forward declaration */