Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c4d8f3ab
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看板
未验证
提交
c4d8f3ab
编写于
8月 26, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
8月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16443 from taosdata/fix/ZhiqiangWang/TD-17004-fix-mac-run-error
os: fix mac run error
上级
6c32845f
e2fd1cb2
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
56 addition
and
186 deletion
+56
-186
cmake/cmake.define
cmake/cmake.define
+3
-2
cmake/cmake.install
cmake/cmake.install
+16
-0
cmake/cmake.options
cmake/cmake.options
+6
-0
include/os/os.h
include/os/os.h
+1
-0
include/os/osSemaphore.h
include/os/osSemaphore.h
+2
-3
packaging/deb/DEBIAN/prerm
packaging/deb/DEBIAN/prerm
+1
-1
packaging/release.bat
packaging/release.bat
+4
-14
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+1
-2
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-0
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+0
-1
source/os/src/osDir.c
source/os/src/osDir.c
+2
-0
source/os/src/osFile.c
source/os/src/osFile.c
+5
-2
source/os/src/osSemaphore.c
source/os/src/osSemaphore.c
+8
-155
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+4
-4
source/util/src/tlog.c
source/util/src/tlog.c
+1
-2
未找到文件。
cmake/cmake.define
浏览文件 @
c4d8f3ab
...
...
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE OFF)
SET(BUILD_SHARED_LIBS "OFF")
#set output directory
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
...
...
@@ -103,6 +101,9 @@ IF (TD_WINDOWS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
ELSE ()
IF (${TD_DARWIN})
set(CMAKE_MACOSX_RPATH 0)
ENDIF ()
IF (${COVER} MATCHES "true")
MESSAGE(STATUS "Test coverage mode, add extra flags")
SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
...
...
cmake/cmake.install
浏览文件 @
c4d8f3ab
SET
(
PREPARE_ENV_CMD
"prepare_env_cmd"
)
SET
(
PREPARE_ENV_TARGET
"prepare_env_target"
)
ADD_CUSTOM_COMMAND
(
OUTPUT
$
{
PREPARE_ENV_CMD
}
POST_BUILD
COMMAND
echo
"make test directory"
DEPENDS
taosd
COMMAND
$
{
CMAKE_COMMAND
}
-
E
make_directory
$
{
TD_TESTS_OUTPUT_DIR
}
/
cfg
/
COMMAND
$
{
CMAKE_COMMAND
}
-
E
make_directory
$
{
TD_TESTS_OUTPUT_DIR
}
/
log
/
COMMAND
$
{
CMAKE_COMMAND
}
-
E
make_directory
$
{
TD_TESTS_OUTPUT_DIR
}
/
data
/
COMMAND
$
{
CMAKE_COMMAND
}
-
E
echo
dataDir
$
{
TD_TESTS_OUTPUT_DIR
}
/
data
>
$
{
TD_TESTS_OUTPUT_DIR
}
/
cfg
/
taos
.
cfg
COMMAND
$
{
CMAKE_COMMAND
}
-
E
echo
logDir
$
{
TD_TESTS_OUTPUT_DIR
}
/
log
>>
$
{
TD_TESTS_OUTPUT_DIR
}
/
cfg
/
taos
.
cfg
COMMAND
$
{
CMAKE_COMMAND
}
-
E
echo
charset
UTF
-
8
>>
$
{
TD_TESTS_OUTPUT_DIR
}
/
cfg
/
taos
.
cfg
COMMAND
$
{
CMAKE_COMMAND
}
-
E
echo
monitor
0
>>
$
{
TD_TESTS_OUTPUT_DIR
}
/
cfg
/
taos
.
cfg
COMMENT
"prepare taosd environment"
)
ADD_CUSTOM_TARGET
(
$
{
PREPARE_ENV_TARGET
}
ALL
WORKING_DIRECTORY
$
{
TD_EXECUTABLE_OUTPUT_PATH
}
DEPENDS
$
{
PREPARE_ENV_CMD
})
IF
(
TD_LINUX
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
...
...
cmake/cmake.options
浏览文件 @
c4d8f3ab
...
...
@@ -90,6 +90,12 @@ ELSE ()
ENDIF ()
ENDIF ()
option(
BUILD_SHARED_LIBS
""
OFF
)
option(
RUST_BINDINGS
"If build with rust-bindings"
...
...
include/os/os.h
浏览文件 @
c4d8f3ab
...
...
@@ -79,6 +79,7 @@ extern "C" {
#include <wchar.h>
#include <wctype.h>
#include "taoserror.h"
#include "osAtomic.h"
#include "osDef.h"
#include "osDir.h"
...
...
include/os/osSemaphore.h
浏览文件 @
c4d8f3ab
...
...
@@ -23,10 +23,9 @@ extern "C" {
#include <semaphore.h>
#if defined(_TD_DARWIN_64)
#include <dispatch/dispatch.h>
// typedef struct tsem_s *tsem_t;
typedef
struct
bosal_sem_t
*
tsem_t
;
typedef
dispatch_semaphore_t
tsem_t
;
int
tsem_init
(
tsem_t
*
sem
,
int
pshared
,
unsigned
int
value
);
int
tsem_wait
(
tsem_t
*
sem
);
...
...
packaging/deb/DEBIAN/prerm
浏览文件 @
c4d8f3ab
#!/bin/bash
if
[
$1
-eq
"abort-upgrade"
]
;
then
if
[
"
$1
"
x
=
"abort-upgrade"
x
]
;
then
exit
0
fi
...
...
packaging/release.bat
浏览文件 @
c4d8f3ab
...
...
@@ -40,10 +40,12 @@ if not exist %work_dir%\debug\ver-%2-x86 (
)
cd
%work_dir%
\debug\ver
-
%
2
-x
64
call
vcvarsall
.bat
x64
cmake
../../
-G
"NMake Makefiles JOM"
-DCMAKE
_MAKE_PROGRAM
=
jom
-DBUILD
_TOOLS
=
true
-DBUILD
_HTTP
=
false
-DVERNUMBER
=
%
2
-DCPUTYPE
=
x64
cmake
../../
-G
"NMake Makefiles JOM"
-DCMAKE
_MAKE_PROGRAM
=
jom
-DBUILD
_TOOLS
=
true
-DBUILD
_HTTP
=
false
-
BUILD
_TEST
=
false
-
DVERNUMBER
=
%
2
-DCPUTYPE
=
x64
cmake
--build
.
rd
/s /Q
C
:\TDengine
cmake
--install
.
for
/r
c
:\TDengine
%%i
in
(*
.dll
)
do
signtool
sign
/f
D
:\\123.pfx
/p
taosdata
%%i
for
/r
c
:\TDengine
%%i
in
(*
.exe
)
do
signtool
sign
/f
D
:\\123.pfx
/p
taosdata
%%i
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
build
x64
failed
&
exit
/b
1
)
cd
%package_dir%
iscc
/DMyAppInstallName
=
"
%packagServerName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DMyAppExcludeSource
=
""
tools
\tdengine.iss
/O
..\release
...
...
@@ -51,19 +53,7 @@ if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% faile
iscc
/DMyAppInstallName
=
"
%packagClientName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DMyAppExcludeSource
=
"taosd.exe"
tools
\tdengine.iss
/O
..\release
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
package
%packagClientName
_x64
%
failed
&
exit
/b
1
)
cd
%work_dir%
\debug\ver
-
%
2
-x
86
call
vcvarsall
.bat
x86
cmake
../../
-G
"NMake Makefiles JOM"
-DCMAKE
_MAKE_PROGRAM
=
jom
-DBUILD
_TOOLS
=
true
-DBUILD
_HTTP
=
false
-DVERNUMBER
=
%
2
-DCPUTYPE
=
x86
cmake
--build
.
rd
/s /Q
C
:\TDengine
cmake
--install
.
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
build
x86
failed
&
exit
/b
1
)
cd
%package_dir%
@REM iscc /DMyAppInstallName="%packagServerName_x86%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
@REM if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x86% failed & exit /b 1)
iscc
/DMyAppInstallName
=
"
%packagClientName
_x86
%
"
/DMyAppVersion
=
"
%
2"
/DMyAppExcludeSource
=
"taosd.exe"
tools
\tdengine.iss
/O
..\release
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
package
%packagClientName
_x86
%
failed
&
exit
/b
1
)
for
/r
..\release
%%i
in
(*
.exe
)
do
signtool
sign
/f
d
:\\123.pfx
/p
taosdata
%%i
goto
EXIT0
:USAGE
...
...
packaging/tools/make_install.sh
浏览文件 @
c4d8f3ab
...
...
@@ -381,8 +381,7 @@ function install_header() {
${
install_main_dir
}
/include
||
${
csudo
}
cp
-f
${
source_dir
}
/include/client/taos.h
${
source_dir
}
/include/common/taosdef.h
${
source_dir
}
/include/util/taoserror.h
${
source_dir
}
/include/libs/function/taosudf.h
\
${
install_main_2_dir
}
/include
&&
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
||
:
${
csudo
}
chmod
644
${
install_main_2_dir
}
/include/
*
${
csudo
}
chmod
644
${
install_main_dir
}
/include/
*
||
${
csudo
}
chmod
644
${
install_main_2_dir
}
/include/
*
fi
}
...
...
source/client/src/clientEnv.c
浏览文件 @
c4d8f3ab
...
...
@@ -393,7 +393,9 @@ void taos_init_imp(void) {
schedulerInit
();
tscDebug
(
"starting to initialize TAOS driver"
);
#ifndef WINDOWS
taosSetCoreDump
(
true
);
#endif
initTaskQueue
();
fmFuncMgtInit
();
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
c4d8f3ab
...
...
@@ -221,7 +221,6 @@ int walCheckAndRepairMeta(SWal* pWal) {
int
code
=
walSaveMeta
(
pWal
);
if
(
code
<
0
)
{
taosArrayDestroy
(
actualLog
);
return
-
1
;
}
}
...
...
source/os/src/osDir.c
浏览文件 @
c4d8f3ab
...
...
@@ -133,6 +133,7 @@ int32_t taosMulMkDir(const char *dirname) {
code
=
mkdir
(
temp
,
0755
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
code
;
}
*
pos
=
TD_DIRSEP
[
0
];
...
...
@@ -146,6 +147,7 @@ int32_t taosMulMkDir(const char *dirname) {
code
=
mkdir
(
temp
,
0755
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
code
;
}
}
...
...
source/os/src/osFile.c
浏览文件 @
c4d8f3ab
...
...
@@ -203,10 +203,11 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
}
int32_t
taosStatFile
(
const
char
*
path
,
int64_t
*
size
,
int32_t
*
mtime
)
{
struct
stat
fileStat
;
#ifdef WINDOWS
int32_t
code
=
_stat
(
path
,
&
fileStat
);
struct
_stati64
fileStat
;
int32_t
code
=
_stati64
(
path
,
&
fileStat
);
#else
struct
stat
fileStat
;
int32_t
code
=
stat
(
path
,
&
fileStat
);
#endif
if
(
code
<
0
)
{
...
...
@@ -312,6 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
assert
(
!
(
tdFileOptions
&
TD_FILE_EXCL
));
fp
=
fopen
(
path
,
mode
);
if
(
fp
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
NULL
;
}
}
else
{
...
...
@@ -334,6 +336,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
#endif
if
(
fd
==
-
1
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
NULL
;
}
}
...
...
source/os/src/osSemaphore.c
浏览文件 @
c4d8f3ab
...
...
@@ -392,179 +392,32 @@ int32_t tsem_timewait(tsem_t* sem, int64_t nanosecs) {
// *sem = NULL;
// return 0;
// }
typedef
struct
{
pthread_mutex_t
count_lock
;
pthread_cond_t
count_bump
;
unsigned
int
count
;
}
bosal_sem_t
;
int
tsem_init
(
tsem_t
*
psem
,
int
flags
,
unsigned
int
count
)
{
bosal_sem_t
*
pnewsem
;
int
result
;
pnewsem
=
(
bosal_sem_t
*
)
malloc
(
sizeof
(
bosal_sem_t
));
if
(
!
pnewsem
)
{
return
-
1
;
}
result
=
pthread_mutex_init
(
&
pnewsem
->
count_lock
,
NULL
);
if
(
result
)
{
free
(
pnewsem
);
return
result
;
}
result
=
pthread_cond_init
(
&
pnewsem
->
count_bump
,
NULL
);
if
(
result
)
{
pthread_mutex_destroy
(
&
pnewsem
->
count_lock
);
free
(
pnewsem
);
return
result
;
}
pnewsem
->
count
=
count
;
*
psem
=
(
tsem_t
)
pnewsem
;
*
psem
=
dispatch_semaphore_create
(
count
);
if
(
*
psem
==
NULL
)
return
-
1
;
return
0
;
}
int
tsem_destroy
(
tsem_t
*
psem
)
{
bosal_sem_t
*
poldsem
;
if
(
!
psem
)
{
return
EINVAL
;
}
poldsem
=
(
bosal_sem_t
*
)
*
psem
;
pthread_mutex_destroy
(
&
poldsem
->
count_lock
);
pthread_cond_destroy
(
&
poldsem
->
count_bump
);
free
(
poldsem
);
return
0
;
}
int
tsem_post
(
tsem_t
*
psem
)
{
bosal_sem_t
*
pxsem
;
int
result
,
xresult
;
if
(
!
psem
)
{
return
EINVAL
;
}
pxsem
=
(
bosal_sem_t
*
)
*
psem
;
result
=
pthread_mutex_lock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
pxsem
->
count
=
pxsem
->
count
+
1
;
xresult
=
pthread_cond_signal
(
&
pxsem
->
count_bump
);
result
=
pthread_mutex_unlock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
if
(
xresult
)
{
errno
=
xresult
;
return
-
1
;
}
return
0
;
}
int
tsem_trywait
(
tsem_t
*
psem
)
{
bosal_sem_t
*
pxsem
;
int
result
,
xresult
;
if
(
!
psem
)
{
return
EINVAL
;
}
pxsem
=
(
bosal_sem_t
*
)
*
psem
;
result
=
pthread_mutex_lock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
xresult
=
0
;
if
(
pxsem
->
count
>
0
)
{
pxsem
->
count
--
;
}
else
{
xresult
=
EAGAIN
;
}
result
=
pthread_mutex_unlock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
if
(
xresult
)
{
errno
=
xresult
;
return
-
1
;
}
if
(
psem
==
NULL
||
*
psem
==
NULL
)
return
-
1
;
dispatch_semaphore_signal
(
*
psem
);
return
0
;
}
int
tsem_wait
(
tsem_t
*
psem
)
{
bosal_sem_t
*
pxsem
;
int
result
,
xresult
;
if
(
!
psem
)
{
return
EINVAL
;
}
pxsem
=
(
bosal_sem_t
*
)
*
psem
;
result
=
pthread_mutex_lock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
xresult
=
0
;
if
(
pxsem
->
count
==
0
)
{
xresult
=
pthread_cond_wait
(
&
pxsem
->
count_bump
,
&
pxsem
->
count_lock
);
}
if
(
!
xresult
)
{
if
(
pxsem
->
count
>
0
)
{
pxsem
->
count
--
;
}
}
result
=
pthread_mutex_unlock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
if
(
xresult
)
{
errno
=
xresult
;
return
-
1
;
}
if
(
psem
==
NULL
||
*
psem
==
NULL
)
return
-
1
;
dispatch_semaphore_wait
(
*
psem
,
DISPATCH_TIME_FOREVER
);
return
0
;
}
int
tsem_timewait
(
tsem_t
*
psem
,
int64_t
nanosecs
)
{
struct
timespec
abstim
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
nanosecs
,
};
bosal_sem_t
*
pxsem
;
int
result
,
xresult
;
if
(
!
psem
)
{
return
EINVAL
;
}
pxsem
=
(
bosal_sem_t
*
)
*
psem
;
result
=
pthread_mutex_lock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
xresult
=
0
;
if
(
pxsem
->
count
==
0
)
{
xresult
=
pthread_cond_timedwait
(
&
pxsem
->
count_bump
,
&
pxsem
->
count_lock
,
&
abstim
);
}
if
(
!
xresult
)
{
if
(
pxsem
->
count
>
0
)
{
pxsem
->
count
--
;
}
}
result
=
pthread_mutex_unlock
(
&
pxsem
->
count_lock
);
if
(
result
)
{
return
result
;
}
if
(
xresult
)
{
errno
=
xresult
;
return
-
1
;
}
if
(
psem
==
NULL
||
*
psem
==
NULL
)
return
-
1
;
dispatch_semaphore_wait
(
*
psem
,
nanosecs
);
return
0
;
}
...
...
source/os/src/osSysinfo.c
浏览文件 @
c4d8f3ab
...
...
@@ -595,6 +595,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
#else
struct
statvfs
info
;
if
(
statvfs
(
dataDir
,
&
info
))
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
else
{
diskSize
->
total
=
info
.
f_blocks
*
info
.
f_frsize
;
...
...
@@ -851,13 +852,12 @@ char *taosGetCmdlineByPID(int pid) {
}
void
taosSetCoreDump
(
bool
enable
)
{
if
(
!
enable
)
return
;
#ifdef WINDOWS
//
SetUnhandledExceptionFilter(exceptionHandler);
//
SetUnhandledExceptionFilter(&FlCrashDump);
SetUnhandledExceptionFilter
(
exceptionHandler
);
SetUnhandledExceptionFilter
(
&
FlCrashDump
);
#elif defined(_TD_DARWIN_64)
#else
if
(
!
enable
)
return
;
// 1. set ulimit -c unlimited
struct
rlimit
rlim
;
struct
rlimit
rlim_new
;
...
...
source/util/src/tlog.c
浏览文件 @
c4d8f3ab
...
...
@@ -429,7 +429,7 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) {
}
static
inline
void
taosPrintLogImp
(
ELogLevel
level
,
int32_t
dflag
,
const
char
*
buffer
,
int32_t
len
)
{
if
((
dflag
&
DEBUG_FILE
)
&&
tsLogObj
.
logHandle
&&
tsLogObj
.
logHandle
->
pFile
!=
NULL
)
{
if
((
dflag
&
DEBUG_FILE
)
&&
tsLogObj
.
logHandle
&&
tsLogObj
.
logHandle
->
pFile
!=
NULL
&&
osLogSpaceAvailable
()
)
{
taosUpdateLogNums
(
level
);
if
(
tsAsyncLog
)
{
taosPushLogBuffer
(
tsLogObj
.
logHandle
,
buffer
,
len
);
...
...
@@ -451,7 +451,6 @@ static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *b
}
void
taosPrintLog
(
const
char
*
flags
,
ELogLevel
level
,
int32_t
dflag
,
const
char
*
format
,
...)
{
if
(
!
osLogSpaceAvailable
())
return
;
if
(
!
(
dflag
&
DEBUG_FILE
)
&&
!
(
dflag
&
DEBUG_SCREEN
))
return
;
char
buffer
[
LOG_MAX_LINE_BUFFER_SIZE
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录