From e889008732b3ac5a7db00c7c165723115a41d2cd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 30 Sep 2021 17:10:36 +0800 Subject: [PATCH] include file for os module --- include/os/os.h | 16 +++++----------- include/os/osAtomic.h | 6 +++--- include/os/osDir.h | 6 +++--- include/os/osRand.h | 6 +++--- include/os/osSemaphore.h | 6 +++--- include/os/osSignal.h | 30 ++++++++++++++++++++++++++++++ include/os/osSocket.h | 1 + include/os/osString.h | 6 +++--- include/os/osTime.h | 6 +++--- include/os/osTimer.h | 30 ++++++++++++++++++++++++++++++ source/libs/transport/src/rpcTcp.c | 3 --- 11 files changed, 84 insertions(+), 32 deletions(-) create mode 100644 include/os/osSignal.h create mode 100644 include/os/osTimer.h diff --git a/include/os/os.h b/include/os/os.h index 935923195b..d450ff620f 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -36,15 +36,6 @@ extern "C" { #include #include -// #include -// #include -// #include -// // #include -// -// #include -// #include -// #include - #include "osAtomic.h" #include "osDef.h" #include "osDir.h" @@ -52,12 +43,15 @@ extern "C" { #include "osFile.h" #include "osMath.h" #include "osMemory.h" +#include "osRand.h" #include "osSemaphore.h" +#include "osSignal.h" +#include "osSleep.h" #include "osSocket.h" #include "osString.h" -#include "osSleep.h" -#include "osTime.h" #include "osThread.h" +#include "osTime.h" +#include "osTimer.h" #ifdef __cplusplus } diff --git a/include/os/osAtomic.h b/include/os/osAtomic.h index 7affa444ee..bd3d372fc0 100644 --- a/include/os/osAtomic.h +++ b/include/os/osAtomic.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_ATOMIC_H -#define TDENGINE_OS_ATOMIC_H +#ifndef _TD_OS_ATOMIC_H_ +#define _TD_OS_ATOMIC_H_ #ifdef __cplusplus extern "C" { @@ -355,4 +355,4 @@ extern "C" { } #endif -#endif +#endif /*_TD_OS_ATOMIC_H_*/ diff --git a/include/os/osDir.h b/include/os/osDir.h index 7afe126451..dfd814d70b 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_DIR_H -#define TDENGINE_OS_DIR_H +#ifndef _TD_OS_DIR_H_ +#define _TD_OS_DIR_H_ #ifdef __cplusplus extern "C" { @@ -31,4 +31,4 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName); } #endif -#endif +#endif /*_TD_OS_DIR_H_*/ diff --git a/include/os/osRand.h b/include/os/osRand.h index e08768c2cc..422ea92a71 100644 --- a/include/os/osRand.h +++ b/include/os/osRand.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_RAND_H -#define TDENGINE_OS_RAND_H +#ifndef _TD_OS_RAND_H_ +#define _TD_OS_RAND_H_ #ifdef __cplusplus extern "C" { @@ -28,4 +28,4 @@ uint32_t taosSafeRand(void); } #endif -#endif +#endif /*_TD_OS_RAND_H_*/ diff --git a/include/os/osSemaphore.h b/include/os/osSemaphore.h index d945e721c2..86a9f10819 100644 --- a/include/os/osSemaphore.h +++ b/include/os/osSemaphore.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_SEMAPHORE_H -#define TDENGINE_OS_SEMAPHORE_H +#ifndef _TD_OS_SEMPHONE_H_ +#define _TD_OS_SEMPHONE_H_ #ifdef __cplusplus extern "C" { @@ -63,4 +63,4 @@ int32_t taosGetCurrentAPPName(char* name, int32_t* len); } #endif -#endif +#endif /*_TD_OS_SEMPHONE_H_*/ diff --git a/include/os/osSignal.h b/include/os/osSignal.h new file mode 100644 index 0000000000..ce133e62b7 --- /dev/null +++ b/include/os/osSignal.h @@ -0,0 +1,30 @@ +/* + * 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 _TD_OS_SIGNAL_H_ +#define _TD_OS_SIGNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms); +void taosUninitTimer(); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_OS_SIGNAL_H_*/ diff --git a/include/os/osSocket.h b/include/os/osSocket.h index 0b183b9ece..719c693765 100644 --- a/include/os/osSocket.h +++ b/include/os/osSocket.h @@ -30,6 +30,7 @@ extern "C" { #include #include #include + #include #include #endif diff --git a/include/os/osString.h b/include/os/osString.h index 33f858485c..3adee83c84 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_STRING_H -#define TDENGINE_OS_STRING_H +#ifndef _TD_OS_STRING_H_ +#define _TD_OS_STRING_H_ #ifdef __cplusplus extern "C" { @@ -51,4 +51,4 @@ char * taosCharsetReplace(char *charsetstr); } #endif -#endif +#endif /*_TD_OS_STRING_H_*/ diff --git a/include/os/osTime.h b/include/os/osTime.h index c5ee26e6ef..d076d50276 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_TIME_H -#define TDENGINE_OS_TIME_H +#ifndef _TD_OS_TIME_H_ +#define _TD_OS_TIME_H_ #ifdef __cplusplus extern "C" { @@ -55,4 +55,4 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec } #endif -#endif // TDENGINE_TTIME_H +#endif /*_TD_OS_TIME_H_*/ diff --git a/include/os/osTimer.h b/include/os/osTimer.h new file mode 100644 index 0000000000..623d2da20a --- /dev/null +++ b/include/os/osTimer.h @@ -0,0 +1,30 @@ +/* + * 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 _TD_OS_TIMER_H_ +#define _TD_OS_TIMER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms); +void taosUninitTimer(); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_OS_TIMER_H_*/ diff --git a/source/libs/transport/src/rpcTcp.c b/source/libs/transport/src/rpcTcp.c index 5eb7e39ff2..1f657a5b8d 100644 --- a/source/libs/transport/src/rpcTcp.c +++ b/source/libs/transport/src/rpcTcp.c @@ -22,9 +22,6 @@ #include "rpcHead.h" #include "rpcTcp.h" - -#include - typedef struct SFdObj { void *signature; SOCKET fd; // TCP socket FD -- GitLab