Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93a0c69e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
93a0c69e
编写于
5月 23, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(os): win ctest error
上级
403b2ba1
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
963 addition
and
417 deletion
+963
-417
cmake/cmake.define
cmake/cmake.define
+1
-1
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+45
-41
packaging/tools/install.sh
packaging/tools/install.sh
+757
-340
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+9
-1
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+1
-0
source/os/CMakeLists.txt
source/os/CMakeLists.txt
+9
-7
source/os/src/osDir.c
source/os/src/osDir.c
+33
-10
source/os/src/osFile.c
source/os/src/osFile.c
+21
-10
source/os/src/osMemory.c
source/os/src/osMemory.c
+43
-0
source/os/src/osSemaphore.c
source/os/src/osSemaphore.c
+26
-3
source/os/src/osSocket.c
source/os/src/osSocket.c
+17
-3
tools/taos-tools
tools/taos-tools
+1
-1
未找到文件。
cmake/cmake.define
浏览文件 @
93a0c69e
...
...
@@ -46,7 +46,7 @@ ENDIF ()
IF (TD_WINDOWS)
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
SET(COMMON_FLAGS "/w /D_WIN32")
SET(COMMON_FLAGS "/w /D_WIN32
/Zi
")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
...
...
contrib/CMakeLists.txt
浏览文件 @
93a0c69e
...
...
@@ -100,8 +100,10 @@ endif(${BUILD_WITH_NURAFT})
# addr2line
if
(
${
BUILD_ADDR2LINE
}
)
cat
(
"
${
TD_SUPPORT_DIR
}
/libdwarf_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
cat
(
"
${
TD_SUPPORT_DIR
}
/addr2line_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
if
(
NOT
${
TD_WINDOWS
}
)
cat
(
"
${
TD_SUPPORT_DIR
}
/libdwarf_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
cat
(
"
${
TD_SUPPORT_DIR
}
/addr2line_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
endif
(
NOT
${
TD_WINDOWS
}
)
endif
(
${
BUILD_ADDR2LINE
}
)
# download dependencies
...
...
@@ -335,45 +337,47 @@ endif(${BUILD_WITH_SQLITE})
# addr2line
if
(
${
BUILD_ADDR2LINE
}
)
check_include_file
(
"sys/types.h"
HAVE_SYS_TYPES_H
)
check_include_file
(
"sys/stat.h"
HAVE_SYS_STAT_H
)
check_include_file
(
"inttypes.h"
HAVE_INTTYPES_H
)
check_include_file
(
"stddef.h"
HAVE_STDDEF_H
)
check_include_file
(
"stdlib.h"
HAVE_STDLIB_H
)
check_include_file
(
"string.h"
HAVE_STRING_H
)
check_include_file
(
"memory.h"
HAVE_MEMORY_H
)
check_include_file
(
"strings.h"
HAVE_STRINGS_H
)
check_include_file
(
"stdint.h"
HAVE_STDINT_H
)
check_include_file
(
"unistd.h"
HAVE_UNISTD_H
)
check_include_file
(
"sgidefs.h"
HAVE_SGIDEFS_H
)
check_include_file
(
"stdafx.h"
HAVE_STDAFX_H
)
check_include_file
(
"elf.h"
HAVE_ELF_H
)
check_include_file
(
"libelf.h"
HAVE_LIBELF_H
)
check_include_file
(
"libelf/libelf.h"
HAVE_LIBELF_LIBELF_H
)
check_include_file
(
"alloca.h"
HAVE_ALLOCA_H
)
check_include_file
(
"elfaccess.h"
HAVE_ELFACCESS_H
)
check_include_file
(
"sys/elf_386.h"
HAVE_SYS_ELF_386_H
)
check_include_file
(
"sys/elf_amd64.h"
HAVE_SYS_ELF_AMD64_H
)
check_include_file
(
"sys/elf_sparc.h"
HAVE_SYS_ELF_SPARC_H
)
check_include_file
(
"sys/ia64/elf.h"
HAVE_SYS_IA64_ELF_H
)
set
(
VERSION 0.3.1
)
set
(
PACKAGE_VERSION
"
\"
${
VERSION
}
\"
"
)
configure_file
(
libdwarf/cmake/config.h.cmake config.h
)
file
(
GLOB_RECURSE LIBDWARF_SOURCES
"libdwarf/src/lib/libdwarf/*.c"
)
add_library
(
libdwarf STATIC
${
LIBDWARF_SOURCES
}
)
set_target_properties
(
libdwarf PROPERTIES OUTPUT_NAME
"libdwarf"
)
if
(
HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H
)
target_link_libraries
(
libdwarf PUBLIC libelf
)
endif
()
target_include_directories
(
libdwarf SYSTEM PUBLIC
"libdwarf/src/lib/libdwarf"
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
READ
"addr2line/addr2line.c"
ADDR2LINE_CONTENT
)
string
(
REPLACE
"static int"
"int"
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
string
(
REPLACE
"static void"
"void"
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
string
(
REPLACE
"main("
"main_addr2line("
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
file
(
WRITE
"addr2line/addr2line.c"
"
${
ADDR2LINE_CONTENT
}
"
)
add_library
(
addr2line STATIC
"addr2line/addr2line.c"
)
target_link_libraries
(
addr2line PUBLIC libdwarf dl z
)
target_include_directories
(
addr2line PUBLIC
"libdwarf/src/lib/libdwarf"
)
if
(
NOT
${
TD_WINDOWS
}
)
check_include_file
(
"sys/types.h"
HAVE_SYS_TYPES_H
)
check_include_file
(
"sys/stat.h"
HAVE_SYS_STAT_H
)
check_include_file
(
"inttypes.h"
HAVE_INTTYPES_H
)
check_include_file
(
"stddef.h"
HAVE_STDDEF_H
)
check_include_file
(
"stdlib.h"
HAVE_STDLIB_H
)
check_include_file
(
"string.h"
HAVE_STRING_H
)
check_include_file
(
"memory.h"
HAVE_MEMORY_H
)
check_include_file
(
"strings.h"
HAVE_STRINGS_H
)
check_include_file
(
"stdint.h"
HAVE_STDINT_H
)
check_include_file
(
"unistd.h"
HAVE_UNISTD_H
)
check_include_file
(
"sgidefs.h"
HAVE_SGIDEFS_H
)
check_include_file
(
"stdafx.h"
HAVE_STDAFX_H
)
check_include_file
(
"elf.h"
HAVE_ELF_H
)
check_include_file
(
"libelf.h"
HAVE_LIBELF_H
)
check_include_file
(
"libelf/libelf.h"
HAVE_LIBELF_LIBELF_H
)
check_include_file
(
"alloca.h"
HAVE_ALLOCA_H
)
check_include_file
(
"elfaccess.h"
HAVE_ELFACCESS_H
)
check_include_file
(
"sys/elf_386.h"
HAVE_SYS_ELF_386_H
)
check_include_file
(
"sys/elf_amd64.h"
HAVE_SYS_ELF_AMD64_H
)
check_include_file
(
"sys/elf_sparc.h"
HAVE_SYS_ELF_SPARC_H
)
check_include_file
(
"sys/ia64/elf.h"
HAVE_SYS_IA64_ELF_H
)
set
(
VERSION 0.3.1
)
set
(
PACKAGE_VERSION
"
\"
${
VERSION
}
\"
"
)
configure_file
(
libdwarf/cmake/config.h.cmake config.h
)
file
(
GLOB_RECURSE LIBDWARF_SOURCES
"libdwarf/src/lib/libdwarf/*.c"
)
add_library
(
libdwarf STATIC
${
LIBDWARF_SOURCES
}
)
set_target_properties
(
libdwarf PROPERTIES OUTPUT_NAME
"libdwarf"
)
if
(
HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H
)
target_link_libraries
(
libdwarf PUBLIC libelf
)
endif
()
target_include_directories
(
libdwarf SYSTEM PUBLIC
"libdwarf/src/lib/libdwarf"
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
READ
"addr2line/addr2line.c"
ADDR2LINE_CONTENT
)
string
(
REPLACE
"static int"
"int"
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
string
(
REPLACE
"static void"
"void"
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
string
(
REPLACE
"main("
"main_addr2line("
ADDR2LINE_CONTENT
"
${
ADDR2LINE_CONTENT
}
"
)
file
(
WRITE
"addr2line/addr2line.c"
"
${
ADDR2LINE_CONTENT
}
"
)
add_library
(
addr2line STATIC
"addr2line/addr2line.c"
)
target_link_libraries
(
addr2line PUBLIC libdwarf dl z
)
target_include_directories
(
addr2line PUBLIC
"libdwarf/src/lib/libdwarf"
)
endif
(
NOT
${
TD_WINDOWS
}
)
endif
(
${
BUILD_ADDR2LINE
}
)
...
...
packaging/tools/install.sh
浏览文件 @
93a0c69e
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
93a0c69e
...
...
@@ -72,12 +72,20 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
char
path
[
PATH_MAX
]
=
{
0
};
if
(
tsProcPath
==
NULL
)
{
path
[
0
]
=
'.'
;
#ifdef WINDOWS
GetModuleFileName
(
NULL
,
path
,
PATH_MAX
);
taosDirName
(
path
);
#endif
}
else
{
strncpy
(
path
,
tsProcPath
,
strlen
(
tsProcPath
));
taosDirName
(
path
);
}
#ifdef WINDOWS
strcat
(
path
,
"udfd.exe"
);
if
(
strlen
(
path
)
==
0
)
{
strcat
(
path
,
"udfd.exe"
);
}
else
{
strcat
(
path
,
"
\\
udfd.exe"
);
}
#else
strcat
(
path
,
"/udfd"
);
#endif
...
...
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
93a0c69e
...
...
@@ -14,6 +14,7 @@
*/
#include "planTestUtil.h"
#include <getopt.h>
#include <algorithm>
#include <array>
...
...
source/os/CMakeLists.txt
浏览文件 @
93a0c69e
...
...
@@ -18,14 +18,16 @@ if(USE_TD_MEMORY)
add_definitions
(
-DUSE_TD_MEMORY
)
endif
()
if
(
BUILD_ADDR2LINE
)
target_include_directories
(
os
PUBLIC
"
${
TD_SOURCE_DIR
}
/contrib/libdwarf/src/lib/libdwarf"
)
if
(
NOT TD_WINDOWS
)
target_include_directories
(
os
PUBLIC
"
${
TD_SOURCE_DIR
}
/contrib/libdwarf/src/lib/libdwarf"
)
target_link_libraries
(
os PUBLIC addr2line dl z
)
endif
()
add_definitions
(
-DUSE_ADDR2LINE
)
target_link_libraries
(
os PUBLIC addr2line dl z
)
endif
()
if
(
CHECK_STR2INT_ERROR
)
add_definitions
(
-DTD_CHECK_STR_TO_INT_ERROR
)
...
...
source/os/src/osDir.c
浏览文件 @
93a0c69e
...
...
@@ -91,7 +91,12 @@ void taosRemoveDir(const char *dirname) {
bool
taosDirExist
(
const
char
*
dirname
)
{
return
taosCheckExistFile
(
dirname
);
}
int32_t
taosMkDir
(
const
char
*
dirname
)
{
if
(
taosDirExist
(
dirname
))
return
0
;
#ifdef WINDOWS
int32_t
code
=
_mkdir
(
dirname
,
0755
);
#else
int32_t
code
=
mkdir
(
dirname
,
0755
);
#endif
if
(
code
<
0
&&
errno
==
EEXIST
)
{
return
0
;
}
...
...
@@ -101,36 +106,48 @@ int32_t taosMkDir(const char *dirname) {
int32_t
taosMulMkDir
(
const
char
*
dirname
)
{
if
(
dirname
==
NULL
)
return
-
1
;
char
*
temp
=
strdup
(
dirname
);
char
temp
[
1024
];
#ifdef WINDOWS
taosRealPath
(
dirname
,
temp
,
sizeof
(
temp
));
#else
strcpy
(
temp
,
dirname
);
#endif
char
*
pos
=
temp
;
int32_t
code
=
0
;
if
(
strncmp
(
temp
,
"/"
,
1
)
==
0
)
{
if
(
taosDirExist
(
temp
))
return
code
;
if
(
strncmp
(
temp
,
TD_DIRSEP
,
1
)
==
0
)
{
pos
+=
1
;
}
else
if
(
strncmp
(
temp
,
".
/"
,
2
)
==
0
)
{
}
else
if
(
strncmp
(
temp
,
".
"
TD_DIRSEP
,
2
)
==
0
)
{
pos
+=
2
;
}
for
(;
*
pos
!=
'\0'
;
pos
++
)
{
if
(
*
pos
==
'/'
)
{
if
(
*
pos
==
TD_DIRSEP
[
0
]
)
{
*
pos
=
'\0'
;
#ifdef WINDOWS
code
=
_mkdir
(
temp
,
0755
);
#else
code
=
mkdir
(
temp
,
0755
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
free
(
temp
);
return
code
;
}
*
pos
=
'/'
;
*
pos
=
TD_DIRSEP
[
0
]
;
}
}
if
(
*
(
pos
-
1
)
!=
'/'
)
{
if
(
*
(
pos
-
1
)
!=
TD_DIRSEP
[
0
])
{
#ifdef WINDOWS
code
=
_mkdir
(
temp
,
0755
);
#else
code
=
mkdir
(
temp
,
0755
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
free
(
temp
);
return
code
;
}
}
free
(
temp
);
// int32_t code = mkdir(dirname, 0755);
if
(
code
<
0
&&
errno
==
EEXIST
)
{
...
...
@@ -233,7 +250,13 @@ char *taosDirName(char *name) {
_splitpath
(
name
,
Drive1
,
Dir1
,
NULL
,
NULL
);
size_t
dirNameLen
=
strlen
(
Drive1
)
+
strlen
(
Dir1
);
if
(
dirNameLen
>
0
)
{
name
[
dirNameLen
]
=
0
;
if
(
name
[
dirNameLen
-
1
]
==
'/'
||
name
[
dirNameLen
-
1
]
==
'\\'
)
{
name
[
dirNameLen
-
1
]
=
0
;
}
else
{
name
[
dirNameLen
]
=
0
;
}
}
else
{
name
[
0
]
=
0
;
}
return
name
;
#else
...
...
source/os/src/osFile.c
浏览文件 @
93a0c69e
...
...
@@ -109,8 +109,11 @@ void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, cha
int64_t
taosCopyFile
(
const
char
*
from
,
const
char
*
to
)
{
#ifdef WINDOWS
assert
(
0
);
return
-
1
;
if
(
CopyFile
(
from
,
to
,
0
))
{
return
1
;
}
else
{
return
-
1
;
}
#else
char
buffer
[
4096
];
int64_t
size
=
0
;
...
...
@@ -236,7 +239,7 @@ int32_t taosDevInoFile(TdFilePtr pFile, int64_t *stDev, int64_t *stIno) {
void
autoDelFileListAdd
(
const
char
*
path
)
{
return
;
}
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
)
{
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
)
{
int
fd
=
-
1
;
FILE
*
fp
=
NULL
;
if
(
tdFileOptions
&
TD_FILE_STREAM
)
{
...
...
@@ -343,7 +346,11 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
char
*
tbuf
=
(
char
*
)
buf
;
while
(
leftbytes
>
0
)
{
#ifdef WINDOWS
readbytes
=
_read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
#else
readbytes
=
read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
#endif
if
(
readbytes
<
0
)
{
if
(
errno
==
EINTR
)
{
continue
;
...
...
@@ -379,10 +386,10 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#endif
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
#ifdef WINDOWS
size_t
pos
=
lseek
(
pFile
->
fd
,
0
,
SEEK_CUR
);
lseek
(
pFile
->
fd
,
offset
,
SEEK_SET
);
int64_t
ret
=
read
(
pFile
->
fd
,
buf
,
count
);
lseek
(
pFile
->
fd
,
pos
,
SEEK_SET
);
size_t
pos
=
_
lseek
(
pFile
->
fd
,
0
,
SEEK_CUR
);
_
lseek
(
pFile
->
fd
,
offset
,
SEEK_SET
);
int64_t
ret
=
_
read
(
pFile
->
fd
,
buf
,
count
);
_
lseek
(
pFile
->
fd
,
pos
,
SEEK_SET
);
#else
int64_t
ret
=
pread
(
pFile
->
fd
,
buf
,
count
,
offset
);
#endif
...
...
@@ -428,7 +435,11 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
#ifdef WINDOWS
int64_t
ret
=
_lseek
(
pFile
->
fd
,
offset
,
whence
);
#else
int64_t
ret
=
lseek
(
pFile
->
fd
,
offset
,
whence
);
#endif
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
#endif
...
...
@@ -567,12 +578,12 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
#ifdef WINDOWS
lseek
(
pFileIn
->
fd
,
(
int32_t
)(
*
offset
),
0
);
_
lseek
(
pFileIn
->
fd
,
(
int32_t
)(
*
offset
),
0
);
int64_t
writeLen
=
0
;
uint8_t
buffer
[
_SEND_FILE_STEP_
]
=
{
0
};
for
(
int64_t
len
=
0
;
len
<
(
size
-
_SEND_FILE_STEP_
);
len
+=
_SEND_FILE_STEP_
)
{
size_t
rlen
=
read
(
pFileIn
->
fd
,
(
void
*
)
buffer
,
_SEND_FILE_STEP_
);
size_t
rlen
=
_
read
(
pFileIn
->
fd
,
(
void
*
)
buffer
,
_SEND_FILE_STEP_
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
if
(
rlen
<
_SEND_FILE_STEP_
)
{
...
...
@@ -586,7 +597,7 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
int64_t
remain
=
size
-
writeLen
;
if
(
remain
>
0
)
{
size_t
rlen
=
read
(
pFileIn
->
fd
,
(
void
*
)
buffer
,
(
size_t
)
remain
);
size_t
rlen
=
_
read
(
pFileIn
->
fd
,
(
void
*
)
buffer
,
(
size_t
)
remain
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
{
...
...
source/os/src/osMemory.c
浏览文件 @
93a0c69e
...
...
@@ -37,6 +37,49 @@ typedef struct TdMemoryInfo {
#ifdef WINDOWS
#define tstrdup(str) _strdup(str)
int32_t
taosBackTrace
(
void
**
buffer
,
int32_t
size
)
{
int32_t
frame
=
0
;
return
frame
;
}
#ifdef USE_ADDR2LINE
#include <DbgHelp.h>
#pragma comment(lib, "dbghelp.lib")
void
taosPrintBackTrace
()
{
#define MAX_STACK_FRAMES 20
void
*
pStack
[
MAX_STACK_FRAMES
];
HANDLE
process
=
GetCurrentProcess
();
SymInitialize
(
process
,
NULL
,
TRUE
);
WORD
frames
=
CaptureStackBackTrace
(
1
,
MAX_STACK_FRAMES
,
pStack
,
NULL
);
char
buf_tmp
[
1024
];
for
(
WORD
i
=
0
;
i
<
frames
;
++
i
)
{
DWORD64
address
=
(
DWORD64
)(
pStack
[
i
]);
DWORD64
displacementSym
=
0
;
char
buffer
[
sizeof
(
SYMBOL_INFO
)
+
MAX_SYM_NAME
*
sizeof
(
TCHAR
)];
PSYMBOL_INFO
pSymbol
=
(
PSYMBOL_INFO
)
buffer
;
pSymbol
->
SizeOfStruct
=
sizeof
(
SYMBOL_INFO
);
pSymbol
->
MaxNameLen
=
MAX_SYM_NAME
;
DWORD
displacementLine
=
0
;
IMAGEHLP_LINE64
line
;
//SymSetOptions(SYMOPT_LOAD_LINES);
line
.
SizeOfStruct
=
sizeof
(
IMAGEHLP_LINE64
);
if
(
SymFromAddr
(
process
,
address
,
&
displacementSym
,
pSymbol
)
&&
SymGetLineFromAddr64
(
process
,
address
,
&
displacementLine
,
&
line
))
{
snprintf
(
buf_tmp
,
sizeof
(
buf_tmp
),
"BackTrace %08"
PRId64
" %s:%d %s
\n
"
,
taosGetSelfPthreadId
(),
line
.
FileName
,
line
.
LineNumber
,
pSymbol
->
Name
);
}
else
{
snprintf
(
buf_tmp
,
sizeof
(
buf_tmp
),
"BackTrace error: %d
\n
"
,
GetLastError
());
}
write
(
1
,
buf_tmp
,
strlen
(
buf_tmp
));
}
}
#endif
#else
#define tstrdup(str) strdup(str)
...
...
source/os/src/osSemaphore.c
浏览文件 @
93a0c69e
...
...
@@ -68,9 +68,32 @@ int32_t tsem_wait(tsem_t* sem) {
}
int32_t
tsem_timewait
(
tsem_t
*
sem
,
int64_t
nanosecs
)
{
int
ret
=
0
;
return
ret
;
struct
timespec
ts
,
rel
;
FILETIME
ft_before
,
ft_after
;
int
rc
;
rel
.
tv_sec
=
0
;
rel
.
tv_nsec
=
nanosecs
;
GetSystemTimeAsFileTime
(
&
ft_before
);
errno
=
0
;
rc
=
sem_timedwait
(
&
sem
,
pthread_win32_getabstime_np
(
&
ts
,
&
rel
));
/* This should have timed out */
assert
(
errno
==
ETIMEDOUT
);
assert
(
rc
!=
0
);
GetSystemTimeAsFileTime
(
&
ft_after
);
// We specified a non-zero wait. Time must advance.
if
(
ft_before
.
dwLowDateTime
==
ft_after
.
dwLowDateTime
&&
ft_before
.
dwHighDateTime
==
ft_after
.
dwHighDateTime
)
{
printf
(
"nanoseconds: %d, rc: %d, errno: %d. before filetime: %d, %d; after filetime: %d, %d
\n
"
,
nanosecs
,
rc
,
errno
,
(
int
)
ft_before
.
dwLowDateTime
,
(
int
)
ft_before
.
dwHighDateTime
,
(
int
)
ft_after
.
dwLowDateTime
,
(
int
)
ft_after
.
dwHighDateTime
);
printf
(
"time must advance during sem_timedwait."
);
return
1
;
}
return
0
;
}
#elif defined(_TD_DARWIN_64)
...
...
source/os/src/osSocket.c
浏览文件 @
93a0c69e
...
...
@@ -718,7 +718,11 @@ bool taosValidIpAndPort(uint32_t ip, uint16_t port) {
bzero
((
char
*
)
&
serverAdd
,
sizeof
(
serverAdd
));
serverAdd
.
sin_family
=
AF_INET
;
#ifdef WINDOWS
serverAdd
.
sin_addr
.
s_addr
=
INADDR_ANY
;
#else
serverAdd
.
sin_addr
.
s_addr
=
ip
;
#endif
serverAdd
.
sin_port
=
(
uint16_t
)
htons
(
port
);
if
((
fd
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<=
2
)
{
...
...
@@ -882,6 +886,16 @@ void taosBlockSIGPIPE() {
}
uint32_t
taosGetIpv4FromFqdn
(
const
char
*
fqdn
)
{
#ifdef WINDOWS
// Initialize Winsock
WSADATA
wsaData
;
int
iResult
;
iResult
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsaData
);
if
(
iResult
!=
0
)
{
printf
(
"WSAStartup failed: %d
\n
"
,
iResult
);
return
1
;
}
#endif
struct
addrinfo
hints
=
{
0
};
hints
.
ai_family
=
AF_INET
;
hints
.
ai_socktype
=
SOCK_STREAM
;
...
...
@@ -899,12 +913,12 @@ uint32_t taosGetIpv4FromFqdn(const char *fqdn) {
}
else
{
#ifdef EAI_SYSTEM
if
(
ret
==
EAI_SYSTEM
)
{
// printf("failed to get the ip address, fqdn:%s, since:%s", fqdn
, strerror(errno));
printf
(
"failed to get the ip address, fqdn:%s, errno:%d, since:%s"
,
fqdn
,
errno
,
strerror
(
errno
));
}
else
{
// printf("failed to get the ip address, fqdn:%s, since:%s", fqdn
, gai_strerror(ret));
printf
(
"failed to get the ip address, fqdn:%s, ret:%d, since:%s"
,
fqdn
,
ret
,
gai_strerror
(
ret
));
}
#else
// printf("failed to get the ip address, fqdn:%s, since:%s", fqdn
, gai_strerror(ret));
printf
(
"failed to get the ip address, fqdn:%s, ret:%d, since:%s"
,
fqdn
,
ret
,
gai_strerror
(
ret
));
#endif
return
0xFFFFFFFF
;
}
...
...
taos-tools
@
788929bd
比较
772aef45
...
788929bd
Subproject commit 7
72aef458fec13804c654e59c7a248b55ba3807b
Subproject commit 7
88929bdc475d264d8306ceff30f7df006fd18d8
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录