Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1f3b7197
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1f3b7197
编写于
10月 04, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove some system include files
上级
8ccd079f
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
88 addition
and
53 deletion
+88
-53
include/os/osFile.h
include/os/osFile.h
+0
-2
include/os/osSocket.h
include/os/osSocket.h
+15
-31
include/os/osSysinfo.h
include/os/osSysinfo.h
+2
-0
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+1
-1
source/os/src/osRand.c
source/os/src/osRand.c
+1
-0
source/os/src/osSemaphore.c
source/os/src/osSemaphore.c
+1
-0
source/os/src/osSleep.c
source/os/src/osSleep.c
+2
-0
source/os/src/osSocket.c
source/os/src/osSocket.c
+50
-11
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+6
-0
source/os/src/osTimer.c
source/os/src/osTimer.c
+2
-0
source/server/dnode/src/dnodeTelemetry.c
source/server/dnode/src/dnodeTelemetry.c
+1
-1
source/util/src/tfile.c
source/util/src/tfile.c
+2
-2
source/util/src/tnote.c
source/util/src/tnote.c
+5
-5
未找到文件。
include/os/osFile.h
浏览文件 @
1f3b7197
...
...
@@ -24,10 +24,8 @@ extern "C" {
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
typedef
int32_t
FileFd
;
typedef
SOCKET
SocketFd
;
#else
typedef
int32_t
FileFd
;
typedef
int32_t
SocketFd
;
#endif
#define FD_INITIALIZER ((int32_t)-1)
...
...
include/os/osSocket.h
浏览文件 @
1f3b7197
...
...
@@ -27,49 +27,33 @@ extern "C" {
#include <Winsock2.h>
#else
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <sys/epoll.h>
#include <unistd.h>
#endif
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#define taosSend(sockfd, buf, len, flags) send((SOCKET)sockfd, buf, len, flags)
#define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto((SOCKET)sockfd, buf, len, flags, dest_addr, addrlen)
#define taosWriteSocket(fd, buf, len) send((SOCKET)fd, buf, len, 0)
#define taosReadSocket(fd, buf, len) recv((SOCKET)fd, buf, len, 0)
#define taosCloseSocketNoCheck(fd) closesocket((SOCKET)fd)
#define taosCloseSocket(fd) closesocket((SOCKET)fd)
#else
#define taosSend(sockfd, buf, len, flags) send(sockfd, buf, len, flags)
#define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto(sockfd, buf, len, flags, dest_addr, addrlen)
#define taosReadSocket(fd, buf, len) read(fd, buf, len)
#define taosWriteSocket(fd, buf, len) write(fd, buf, len)
#define taosCloseSocketNoCheck(x) close(x)
#define taosCloseSocket(x) \
{ \
if ((x) > -1) { \
close(x); \
x = FD_INITIALIZER; \
} \
}
#endif
#define TAOS_EPOLL_WAIT_TIME 500
#define TAOS_EPOLL_WAIT_TIME 500
typedef
int32_t
SOCKET
;
typedef
SOCKET
EpollFd
;
typedef
SOCKET
EpollFd
;
#define EpollClose(pollFd) taosCloseSocket(pollFd)
void
taosShutDownSocketRD
(
SOCKET
fd
);
void
taosShutDownSocketWR
(
SOCKET
fd
);
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
typedef
SOCKET
SocketFd
;
#else
typedef
int32_t
SocketFd
;
#endif
int32_t
taosSendto
(
SocketFd
fd
,
void
*
msg
,
int
len
,
unsigned
int
flags
,
const
struct
sockaddr
*
to
,
int
tolen
);
int32_t
taosWriteSocket
(
SocketFd
fd
,
void
*
msg
,
int
len
);
int32_t
taosReadSocket
(
SocketFd
fd
,
void
*
msg
,
int
len
);
int32_t
taosCloseSocketNoCheck
(
SocketFd
fd
);
int32_t
taosCloseSocket
(
SocketFd
fd
);
void
taosShutDownSocketRD
(
SOCKET
fd
);
void
taosShutDownSocketWR
(
SOCKET
fd
);
int32_t
taosSetNonblocking
(
SOCKET
sock
,
int32_t
on
);
void
taosIgnSIGPIPE
();
void
taosBlockSIGPIPE
();
void
taosSetMaskSIGPIPE
();
int32_t
taosSetSockOpt
(
SOCKET
socketfd
,
int32_t
level
,
int32_t
optname
,
void
*
optval
,
int32_t
optlen
);
int32_t
taosGetSockOpt
(
SOCKET
socketfd
,
int32_t
level
,
int32_t
optname
,
void
*
optval
,
int32_t
*
optlen
);
int32_t
taosGetSockOpt
(
SOCKET
socketfd
,
int32_t
level
,
int32_t
optname
,
void
*
optval
,
int32_t
*
optlen
);
uint32_t
taosInetAddr
(
char
*
ipAddr
);
const
char
*
taosInetNtoa
(
struct
in_addr
ipInt
);
...
...
include/os/osSysinfo.h
浏览文件 @
1f3b7197
...
...
@@ -66,6 +66,8 @@ typedef struct {
SysNameInfo
taosGetSysNameInfo
();
int64_t
taosGetPid
();
#ifdef __cplusplus
}
#endif
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
1f3b7197
...
...
@@ -695,7 +695,7 @@ static SRpcConn *rpcAllocateClientConn(SRpcInfo *pRpc) {
pConn
->
sid
=
sid
;
pConn
->
tranId
=
(
uint16_t
)(
taosRand
()
&
0xFFFF
);
pConn
->
ownId
=
htonl
(
pConn
->
sid
);
pConn
->
linkUid
=
(
uint32_t
)((
int64_t
)
pConn
+
(
int64_t
)
getp
id
()
+
(
int64_t
)
pConn
->
tranId
);
pConn
->
linkUid
=
(
uint32_t
)((
int64_t
)
pConn
+
taosGetP
id
()
+
(
int64_t
)
pConn
->
tranId
);
pConn
->
spi
=
pRpc
->
spi
;
pConn
->
encrypt
=
pRpc
->
encrypt
;
if
(
pConn
->
spi
)
memcpy
(
pConn
->
secret
,
pRpc
->
secret
,
TSDB_KEY_LEN
);
...
...
source/os/src/osRand.c
浏览文件 @
1f3b7197
...
...
@@ -18,6 +18,7 @@
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#else
#include <sys/file.h>
#include <unistd.h>
#endif
uint32_t
taosRand
(
void
)
{
return
rand
();
}
...
...
source/os/src/osSemaphore.c
浏览文件 @
1f3b7197
...
...
@@ -376,6 +376,7 @@ int32_t taosGetCurrentAPPName(char *name, int32_t *len) {
*/
#include <sys/syscall.h>
#include <unistd.h>
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
return
thread
!=
0
;
}
...
...
source/os/src/osSleep.c
浏览文件 @
1f3b7197
...
...
@@ -22,6 +22,8 @@ void taosMsleep(int32_t ms) { Sleep(ms); }
#else
#include <unistd.h>
/*
to make taosMsleep work,
signal SIGALRM shall be blocked in the calling thread,
...
...
source/os/src/osSocket.c
浏览文件 @
1f3b7197
...
...
@@ -17,16 +17,57 @@
#include "os.h"
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#include "winsock2.h"
#include <WS2tcpip.h>
#include <winbase.h>
#include <Winsock2.h>
#else
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <sys/socket.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#define taosSend(sockfd, buf, len, flags) send((SOCKET)sockfd, buf, len, flags)
int32_t
taosSendto
(
SocketFd
fd
,
void
*
buf
,
int
len
,
unsigned
int
flags
,
const
struct
sockaddr
*
to
,
int
tolen
)
{
return
sendto
((
SOCKET
)
sockfd
,
buf
,
len
,
flags
,
dest_addr
,
addrlen
);
}
int32_t
taosWriteSocket
(
SocketFd
fd
,
void
*
buf
,
int
len
)
{
return
send
((
SOCKET
)
fd
,
buf
,
len
,
0
);
}
int32_t
taosReadSocket
(
SocketFd
fd
,
void
*
buf
,
int
len
)
{
return
recv
((
SOCKET
)
fd
,
buf
,
len
,
0
)();
}
int32_t
taosCloseSocketNoCheck
(
SocketFd
fd
)
{
return
closesocket
((
SOCKET
)
fd
);
}
int32_t
taosCloseSocket
(
SocketFd
fd
)
{
closesocket
((
SOCKET
)
fd
)
}
#else
#define taosSend(sockfd, buf, len, flags) send(sockfd, buf, len, flags)
int32_t
taosSendto
(
SocketFd
fd
,
void
*
buf
,
int
len
,
unsigned
int
flags
,
const
struct
sockaddr
*
dest_addr
,
int
addrlen
)
{
return
sendto
(
fd
,
buf
,
len
,
flags
,
dest_addr
,
addrlen
);
}
int32_t
taosWriteSocket
(
SocketFd
fd
,
void
*
buf
,
int
len
)
{
return
write
(
fd
,
buf
,
len
);
}
int32_t
taosReadSocket
(
SocketFd
fd
,
void
*
buf
,
int
len
)
{
return
read
(
fd
,
buf
,
len
);
}
int32_t
taosCloseSocketNoCheck
(
SocketFd
fd
)
{
return
close
(
fd
);
}
int32_t
taosCloseSocket
(
SocketFd
fd
)
{
if
(
fd
>
-
1
)
{
close
(
fd
);
}
}
#endif
void
taosShutDownSocketRD
(
SOCKET
fd
)
{
...
...
@@ -226,8 +267,6 @@ uint64_t htonll(uint64_t val) { return (((uint64_t)htonl(val)) << 32) + htonl(va
#endif
#ifndef SIGPIPE
#define SIGPIPE EPIPE
#endif
...
...
source/os/src/osSysinfo.c
浏览文件 @
1f3b7197
...
...
@@ -485,6 +485,7 @@ char *taosGetCmdlineByPID(int pid) {
#include <sys/statvfs.h>
#include <sys/syscall.h>
#include <sys/utsname.h>
#include <unistd.h>
#define PROCESS_ITEM 12
...
...
@@ -1127,4 +1128,9 @@ SysNameInfo taosGetSysNameInfo() {
return
info
;
}
int64_t
taosGetPid
()
{
getpid
();
}
#endif
\ No newline at end of file
source/os/src/osTimer.c
浏览文件 @
1f3b7197
...
...
@@ -62,6 +62,7 @@ void taosUninitTimer() {
#include <sys/syscall.h>
#include <sys/event.h>
#include <unistd.h>
static
void
(
*
timer_callback
)(
int
);
static
int
timer_ms
=
0
;
...
...
@@ -136,6 +137,7 @@ void taos_block_sigalrm(void) {
*/
#include <sys/syscall.h>
#include <unistd.h>
static
void
taosDeleteTimer
(
void
*
tharg
)
{
timer_t
*
pTimer
=
tharg
;
...
...
source/server/dnode/src/dnodeTelemetry.c
浏览文件 @
1f3b7197
...
...
@@ -210,7 +210,7 @@ static void dnodeSendTelemetryReport(DnTelem* telem) {
"Content-Type: application/json
\n
"
"Content-Length: "
;
taosWriteSocket
(
fd
,
header
,
(
int32_t
)
strlen
(
header
));
taosWriteSocket
(
fd
,
(
void
*
)
header
,
(
int32_t
)
strlen
(
header
));
int32_t
contLen
=
(
int32_t
)(
tbufTell
(
&
bw
)
-
1
);
sprintf
(
buf
,
"%d
\n\n
"
,
contLen
);
taosWriteSocket
(
fd
,
buf
,
(
int32_t
)
strlen
(
buf
));
...
...
source/util/src/tfile.c
浏览文件 @
1f3b7197
...
...
@@ -23,7 +23,7 @@
static
int32_t
tsFileRsetId
=
-
1
;
static
void
tfCloseFile
(
void
*
p
)
{
clos
e
((
int32_t
)(
uintptr_t
)
p
);
taosCloseFil
e
((
int32_t
)(
uintptr_t
)
p
);
}
int32_t
tfInit
()
{
...
...
@@ -48,7 +48,7 @@ static int64_t tfOpenImp(int32_t fd) {
void
*
p
=
(
void
*
)(
int64_t
)
fd
;
int64_t
rid
=
taosAddRef
(
tsFileRsetId
,
p
);
if
(
rid
<
0
)
clos
e
(
fd
);
if
(
rid
<
0
)
taosCloseFil
e
(
fd
);
return
rid
;
}
...
...
source/util/src/tnote.c
浏览文件 @
1f3b7197
...
...
@@ -100,7 +100,7 @@ static void *taosThreadToOpenNewNote(void *param) {
}
taosLockNote
(
fd
,
pNote
);
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
(
void
)
taosLSeekFile
(
fd
,
0
,
SEEK_SET
);
int32_t
oldFd
=
pNote
->
fd
;
pNote
->
fd
=
fd
;
...
...
@@ -142,10 +142,10 @@ static bool taosCheckNoteIsOpen(char *noteName, SNoteObj *pNote) {
if
(
taosLockNote
(
fd
,
pNote
))
{
taosUnLockNote
(
fd
,
pNote
);
clos
e
(
fd
);
taosCloseFil
e
(
fd
);
return
false
;
}
else
{
clos
e
(
fd
);
taosCloseFil
e
(
fd
);
return
true
;
}
}
...
...
@@ -226,7 +226,7 @@ static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxN
size
=
(
int32_t
)
filestat_size
;
pNote
->
lines
=
size
/
60
;
lseek
(
pNote
->
fd
,
0
,
SEEK_END
);
taosLSeekFile
(
pNote
->
fd
,
0
,
SEEK_END
);
return
0
;
}
...
...
@@ -271,6 +271,6 @@ void taosNotePrint(SNoteObj *pNote, const char *const format, ...) {
static
void
taosCloseNoteByFd
(
int32_t
fd
,
SNoteObj
*
pNote
)
{
if
(
fd
>=
0
)
{
taosUnLockNote
(
fd
,
pNote
);
clos
e
(
fd
);
taosCloseFil
e
(
fd
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录